You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function get_result(hash) {
if (hash.error) {
throw error;
}else{
return hash.data;
}
}
var mnemonic_phrase = 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon';
var wallet = get_result(Module.UnoSemuxWallet.new_wallet());
try {
var hd_group_id = get_result(wallet.add_hd_group(mnemonic_phrase, ''));
var account = get_result(wallet.generate_next_hd_address(hd_group_id));
var address = get_result(account.address());
console.log(`phrase "${mnemonic_phrase}" has primary address "${address}"`);
var found_account = get_result(wallet.find_address(address));
var found_address = get_result(found_account.address());
console.log(`found account ${found_account} with address ${found_address} by address ${address} in original wallet`);
var serial = get_result(wallet.serialize('password'));
var restored_wallet = get_result(Module.UnoSemuxWallet.new_wallet());
restored_wallet.deserialize(serial, 'password');
var found_restored_account = get_result(restored_wallet.find_address(address));
var found_restored_address = get_result(found_restored_account.address());
console.log(`found account ${found_restored_account} with address ${found_restored_address} by address ${address} in restored wallet`);
}
catch(exception) {
console.log(`failed with exception "${exception}"`);
}
When run it outputs:
phrase "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon" has primary address "d430fd0ddbdab8a767d02c7202dfccd037f97bbb"
VM3505:18 found account [object Object] with address d430fd0ddbdab8a767d02c7202dfccd037f97bbb by address d430fd0ddbdab8a767d02c7202dfccd037f97bbb in original wallet
VM3505:28 failed with exception ">_< Ouch! [GpException]: 'Addres 'd430fd0ddbdab8a767d02c7202dfccd037f97bbb' not found'
Function: 'FindAddr'
File: 'UnoSemuxWallet'
Line: 68
"
The text was updated successfully, but these errors were encountered:
Have code:
When run it outputs:
The text was updated successfully, but these errors were encountered: