@kaiachain/web3js-ext
Version:
web3.js extension for kaiachain blockchain
20 lines (19 loc) • 978 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Wallet = void 0;
const js_ext_core_1 = require("@kaiachain/js-ext-core");
const web3_eth_accounts_1 = require("web3-eth-accounts");
class Wallet extends web3_eth_accounts_1.Wallet {
async decrypt(encryptedWallets, password, options) {
const keystores = encryptedWallets.map((wallet) => JSON.stringify(wallet));
for (const keystore of keystores) {
if ((0, js_ext_core_1.isKIP3Json)(keystore)) {
// Do not support because KIP-3 keystores contain multiple keys for the same address,
// but Wallet assumes an account is uniquely identified by its address.
throw new Error("KIP-3 (v4) keystores unsupported in Wallet. Use web3.eth.accounts.decrypt and web3.eth.accounts.decryptList instead.");
}
}
return super.decrypt(encryptedWallets, password, options);
}
}
exports.Wallet = Wallet;