@kaiachain/web3js-ext
Version:
web3.js extension for kaiachain blockchain
16 lines (15 loc) • 817 B
JavaScript
import { isKIP3Json } from "@kaiachain/js-ext-core";
import { Wallet as EthWallet } from "web3-eth-accounts";
export class Wallet extends EthWallet {
async decrypt(encryptedWallets, password, options) {
const keystores = encryptedWallets.map((wallet) => JSON.stringify(wallet));
for (const keystore of keystores) {
if (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);
}
}