static async verify (secret: string): Promise<boolean> {
const testWallet = await Wallet.load('BIP-44', '', secret)
secret = ''
- await testWallet.unlock('')
- const testAccount = await testWallet.account(0)
- const testOpenBlock = await new Block(testAccount.address, '0', testAccount.publicKey, testAccount.address)
- .receive(testAccount.publicKey, 0)
- .sign(testWallet, 0)
- const testSendBlock = await new Block(testAccount.address, '0', testOpenBlock.hash, testAccount.address)
- .send(testAccount.address, 0)
- .sign(testWallet, 0)
- const testSignature = testSendBlock.signature
try {
+ await testWallet.unlock('')
+ const { address, publicKey } = await testWallet.account(0)
+ const testOpenBlock = await new Block(address, '0', publicKey, address)
+ .receive(publicKey, 0)
+ .sign(testWallet, 0)
+ const testSendBlock = await new Block(address, '0', testOpenBlock.hash, address)
+ .send(address, 0)
+ .sign(testWallet, 0)
+ const testSignature = testSendBlock.signature
+ try {
+ const ledgerSignature = await this.sign(0, testSendBlock, testOpenBlock)
+ return ledgerSignature === testSignature
+ } catch (err) {
+ throw new Error('Failed to verify wallet', { cause: err })
+ }
+ } finally {
await testWallet.destroy()
- const ledgerSignature = await this.sign(0, testSendBlock, testOpenBlock)
- return ledgerSignature === testSignature
- } catch (err) {
- throw new Error('Failed to verify wallet', { cause: err })
}
}