How to use the icon-sdk-js.IconWallet.loadPrivateKey function in icon-sdk-js

To help you get started, we’ve selected a few icon-sdk-js examples, based on popular ways it is used in public projects.

github icon-project / icon-sdk-js / quickstart / example / js / IcxTransactionExample.js View on Github external
constructor() {

		// HttpProvider is used to communicate with http.
		this.provider = new HttpProvider(MockData.NODE_URL);
		
		// Create IconService instance
        this.iconService = new IconService(this.provider);
        
        // Load wallet
        this.wallet = IconWallet.loadPrivateKey(MockData.PRIVATE_KEY_1);
        this.txHash = '';

        this.addListener();
        (async () => {
            try {
              await this.getWalletBalance();
            } catch(e) {
              console.log(e);
            }
        })();
    }
github icon-project / icon-sdk-js / quickstart / example / js / DeployAndTransferTokenExample.js View on Github external
constructor() {
		// HttpProvider is used to communicate with http.
		this.provider = new HttpProvider(MockData.NODE_URL);
		
		// Create IconService instance
        this.iconService = new IconService(this.provider);
        
        // Load wallet
        this.wallet = IconWallet.loadPrivateKey(MockData.PRIVATE_KEY_1);
        
        this.deployTxHash = '';
        this.transactionTxHash = '';
        this.content = '';

        this.scoreAddress = '';

        this.addListener();
    }
github icon-project / icon-sdk-js / quickstart / example / js / WalletExample.js View on Github external
document.getElementById('W02').addEventListener('click', () => {
			const privateKey = MockData.PRIVATE_KEY_1;
			const wallet = IconWallet.loadPrivateKey(privateKey);
			const keystore = wallet.store(MockData.PASSWORD);

			document.getElementById('W02-1').innerHTML = `Keystore object: ${JSON.stringify(keystore)}`;
			document.getElementById('W02-2').innerHTML = `Successfully stored. Wallet loaded by private key (${MockData.PRIVATE_KEY_1}) is encrypted by password "${MockData.PASSWORD}"`;
		});
github icon-project / icon-sdk-js / quickstart / example / js / WalletExample.js View on Github external
document.getElementById('W04').addEventListener('click', () => {
			const walletLoadedByPrivateKey = IconWallet.loadPrivateKey(MockData.PRIVATE_KEY_1);

			document.getElementById('W04-1').innerHTML = `Address: ${walletLoadedByPrivateKey.getAddress()}`;
			document.getElementById('W04-2').innerHTML = `Successfully loaded.`;
		});
	}