throw new Error(`Bip44Wallet cannot be instantiated directly. Use 'await Bip44Wallet.create()' instead.`)\r
}\r
Bip44Wallet.#isInternal = false\r
- super(id, seed, mnemonic)\r
+ super(id, 'BIP-44', seed, mnemonic)\r
}\r
\r
/**\r
throw new Error(`Blake2bWallet cannot be instantiated directly. Use 'await Blake2bWallet.create()' instead.`)\r
}\r
Blake2bWallet.#isInternal = false\r
- super(id, seed, mnemonic)\r
+ super(id, 'BLAKE2b', seed, mnemonic)\r
}\r
\r
/**\r
import { bytes, hex, utf8 } from '#src/lib/convert.js'\r
import { Entropy } from '#src/lib/entropy.js'\r
import { Rpc } from '#src/lib/rpc.js'\r
-import { Key, KeyPair } from '#types'\r
+import { Key, KeyPair, WalletType } from '#types'\r
import { SafeWorker } from '#workers'\r
\r
/**\r
#locked: boolean\r
#m?: Bip39Mnemonic\r
#s?: Uint8Array<ArrayBuffer>\r
+ #type: WalletType\r
\r
get id () { return this.#id.hex }\r
get isLocked () { return this.#locked }\r
if (this.#locked || this.#s == null) throw new Error('failed to get seed', { cause: 'wallet locked' })\r
return bytes.toHex(this.#s)\r
}\r
+ get type () { return this.#type }\r
\r
- constructor (id: Entropy, seed?: Uint8Array<ArrayBuffer>, mnemonic?: Bip39Mnemonic) {\r
+ constructor (id: Entropy, type: WalletType, seed?: Uint8Array<ArrayBuffer>, mnemonic?: Bip39Mnemonic) {\r
if (this.constructor === Wallet) {\r
throw new Error('Wallet is an abstract class and cannot be instantiated directly.')\r
}\r
this.#locked = false\r
this.#m = mnemonic\r
this.#s = seed\r
+ this.#type = type\r
}\r
\r
/**\r
verify: typeof verify
}
+export type WalletType = 'BIP-44' | 'BLAKE2b' | 'Ledger'
+
/**
* Represents a wallet containing numerous Nano accounts derived from a single
* source, the form of which can vary based on the type of wallet. The Wallet
get isUnlocked (): boolean
get mnemonic (): string
get seed (): string
+ get type (): WalletType
constructor (id: Entropy, seed?: Uint8Array<ArrayBuffer>, mnemonic?: Bip39Mnemonic)
/**
* Retrieves an account from a wallet using its child key derivation function.