Skip to content
docs

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.

TAccount extends IWalletAccount

TConfig extends object = Record<string, never>

new WalletManager<TAccount, TConfig>(seedOrSigner, config): WalletManager<TAccount, TConfig>

Defined in: wallet-manager.ts:33

string | Uint8Array<ArrayBufferLike> | Signer

TConfig

WalletManager<TAccount, TConfig>

protected readonly _accounts: Map<string, TAccount>

Defined in: wallet-manager.ts:30


protected readonly _config: TConfig

Defined in: wallet-manager.ts:29


protected readonly _signer: Signer | undefined

Defined in: wallet-manager.ts:28

protected cachedAccount(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.

string

() => TAccount | Promise<TAccount>

Promise<TAccount>


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.

void


protected externalSigner(): 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.

Signer | undefined


abstract getAccount(index?): Promise<TAccount>

Defined in: wallet-manager.ts:75

Account index on the chain’s standard path. Cached per index.

number

Promise<TAccount>


abstract getAccountByPath(path): Promise<TAccount>

Defined in: wallet-manager.ts:77

Account at an explicit path. Cached per path.

string

Promise<TAccount>


abstract getFeeRates(): Promise<FeeRates>

Defined in: wallet-manager.ts:79

Current network fee rates at three speeds.

Promise<FeeRates>


protected requireSigner(curve): Signer

Defined in: wallet-manager.ts:69

The external signer, asserted to sign on curve; throws when the manager holds a mnemonic instead.

SignerCurve

Signer


protected seedBytes(): Uint8Array

Defined in: wallet-manager.ts:47

The 64-byte seed this manager derives from; throws for a Signer-built or disposed manager.

Uint8Array


protected signerAccount(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.

string

Signer

string | undefined

(leaf, publicKey) => TAccount

Promise<TAccount>


static getRandomSeedPhrase(words?): string

Defined in: wallet-manager.ts:59

Same as the core getRandomSeedPhrase.

12 | 24

string


static isValidSeedPhrase(seed): boolean

Defined in: wallet-manager.ts:54

Same as the core isValidSeedPhrase.

string

boolean