Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
}
})();
}
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();
}
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}"`;
});
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.`;
});
}