WalletManager
Defined in: wallet-manager.ts:27
Base for chain packages. Holds either the 64-byte BIP-39 seed (local seed signers derive from it) or an external Signer, derives accounts by index or path, and zeroizes on dispose.
A mnemonic passed as a string is stretched to the seed bytes right here and
the string is not kept: JS strings cannot be zeroized, Uint8Arrays can.
A 64-byte seed passed as bytes is COPIED (the caller zeroizes its own).
Keep the mnemonic’s own lifetime short on the calling side (read it, build
the manager, drop the reference) — or build from a Signer and never hand
the words to the SDK at all (see @anywalletkit/keyring).
The seed is never an own property: it lives in a module WeakMap, so logging or serializing a manager shows no secret.
Type Parameters
Section titled “Type Parameters”TAccount
Section titled “TAccount”TAccount extends IWalletAccount
TConfig
Section titled “TConfig”TConfig extends object = Record<string, never>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new WalletManager<
TAccount,TConfig>(seedOrSigner,config):WalletManager<TAccount,TConfig>
Defined in: wallet-manager.ts:33
Parameters
Section titled “Parameters”seedOrSigner
Section titled “seedOrSigner”string | Uint8Array<ArrayBufferLike> | Signer
config
Section titled “config”TConfig
Returns
Section titled “Returns”WalletManager<TAccount, TConfig>
Properties
Section titled “Properties”_accounts
Section titled “_accounts”
protectedreadonly_accounts:Map<string,TAccount>
Defined in: wallet-manager.ts:30
_config
Section titled “_config”
protectedreadonly_config:TConfig
Defined in: wallet-manager.ts:29
_signer
Section titled “_signer”
protectedreadonly_signer:Signer|undefined
Defined in: wallet-manager.ts:28
Methods
Section titled “Methods”cachedAccount()
Section titled “cachedAccount()”
protectedcachedAccount(key,create):Promise<TAccount>
Defined in: wallet-manager.ts:86
The account cached under key, built by create at most once: concurrent calls share one
build. Throws once the manager is disposed; an account whose build finishes after dispose()
is disposed itself and the call throws, so no live signing account outlives the manager.
Parameters
Section titled “Parameters”string
create
Section titled “create”() => TAccount | Promise<TAccount>
Returns
Section titled “Returns”Promise<TAccount>
dispose()
Section titled “dispose()”dispose():
void
Defined in: wallet-manager.ts:130
Dispose every derived account and zeroize the seed; subclasses zeroize their own extras first, then call super.
Returns
Section titled “Returns”void
externalSigner()
Section titled “externalSigner()”
protectedexternalSigner():Signer|undefined
Defined in: wallet-manager.ts:64
The Signer this manager was built with, if any (no mnemonic then). Chain managers decide how to turn it into accounts.
Returns
Section titled “Returns”Signer | undefined
getAccount()
Section titled “getAccount()”
abstractgetAccount(index?):Promise<TAccount>
Defined in: wallet-manager.ts:75
Account index on the chain’s standard path. Cached per index.
Parameters
Section titled “Parameters”index?
Section titled “index?”number
Returns
Section titled “Returns”Promise<TAccount>
getAccountByPath()
Section titled “getAccountByPath()”
abstractgetAccountByPath(path):Promise<TAccount>
Defined in: wallet-manager.ts:77
Account at an explicit path. Cached per path.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<TAccount>
getFeeRates()
Section titled “getFeeRates()”
abstractgetFeeRates():Promise<FeeRates>
Defined in: wallet-manager.ts:79
Current network fee rates at three speeds.
Returns
Section titled “Returns”Promise<FeeRates>
requireSigner()
Section titled “requireSigner()”
protectedrequireSigner(curve):Signer
Defined in: wallet-manager.ts:69
The external signer, asserted to sign on curve; throws when the manager holds a mnemonic instead.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”seedBytes()
Section titled “seedBytes()”
protectedseedBytes():Uint8Array
Defined in: wallet-manager.ts:47
The 64-byte seed this manager derives from; throws for a Signer-built or disposed manager.
Returns
Section titled “Returns”Uint8Array
signerAccount()
Section titled “signerAccount()”
protectedsignerAccount(key,signer,relativePath,build):Promise<TAccount>
Defined in: wallet-manager.ts:113
cachedAccount over an injected signer: the signer itself (relativePath undefined) or
its child along relativePath. A child that never becomes an account is disposed.
Parameters
Section titled “Parameters”string
signer
Section titled “signer”relativePath
Section titled “relativePath”string | undefined
(leaf, publicKey) => TAccount
Returns
Section titled “Returns”Promise<TAccount>
getRandomSeedPhrase()
Section titled “getRandomSeedPhrase()”
staticgetRandomSeedPhrase(words?):string
Defined in: wallet-manager.ts:59
Same as the core getRandomSeedPhrase.
Parameters
Section titled “Parameters”words?
Section titled “words?”12 | 24
Returns
Section titled “Returns”string
isValidSeedPhrase()
Section titled “isValidSeedPhrase()”
staticisValidSeedPhrase(seed):boolean
Defined in: wallet-manager.ts:54
Same as the core isValidSeedPhrase.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”boolean