diff --git a/docs/offline.html b/docs/offline.html index 27df1a6..87199e8 100644 --- a/docs/offline.html +++ b/docs/offline.html @@ -241,6 +241,17 @@ + + + + + + + + + Test + + @@ -503,9 +514,11 @@
Troubleshooting
// --- DATA --- data: { wallet: { - type: 'privatekey', // 'mnemonics', // 'privatekey', 'keystorefile' + type: 'keystorefile', // 'mnemonics', // 'privatekey', 'keystorefile' mnemonics: null, - keystore: null, + keystoreFile: null, + keystoreFilePassword: null, + keystoreFileContent: null, privateKey: null, publicKey: null, @@ -975,9 +988,36 @@
Troubleshooting
} } else if (this.wallet.type == 'keystorefile'){ console.log(moment().format("HH:mm:ss") + " recomputeWallet - keystorefile: " + JSON.stringify(this.wallet)); + try { + console.log(moment().format("HH:mm:ss") + " recomputeWallet - this.wallet.keystoreFileContent: " + JSON.stringify(this.wallet.keystoreFileContent, null, 2)); + console.log(moment().format("HH:mm:ss") + " recomputeWallet - this.wallet.keystoreFilePassword: " + this.wallet.keystoreFilePassword); + const wallet = await ethers.Wallet.fromEncryptedJsonSync(JSON.stringify(this.wallet.keystoreFileContent), this.wallet.keystoreFilePassword); + this.wallet.address = wallet.address; + this.wallet.publicKey = wallet.publicKey; + this.wallet.compressedPublicKey = ethers.utils.computePublicKey(wallet.publicKey, true); + } catch (e) { + console.log(moment().format("HH:mm:ss") + " recomputeWallet - keystorefile ERROR: " + e.message); + } } }, + async keystoreFileChange(fileName, fileList) { + console.log(moment().format("HH:mm:ss") + " keystoreFileChange: " + JSON.stringify(fileName)); + const reader = new FileReader(); + this.wallet.keystoreFileContent = {}; + const t = this; + reader.onload = function (event) { + const data = event.target.result; + t.wallet.keystoreFileContent = JSON.parse(data); + console.log(moment().format("HH:mm:ss") + " keystoreFileContent: " + JSON.stringify(t.wallet.keystoreFileContent, null, 2)); + }; + await reader.readAsText(fileList[0]); + }, + + async testIt() { + console.log(moment().format("HH:mm:ss") + " testIt"); + }, + approvalsRowSelected(item) { console.log(moment().format("HH:mm:ss") + " approvalsRowSelected: " + JSON.stringify(item)); if (item && item.length > 0) {