@armada/sdk / wallet / WalletFactory
Interface: WalletFactory
Defined in: src/wallet/index.ts:258
Enrollment factory (SPEC §4.2). rootSecret is the canonical identity; no mnemonic intermediary.
Methods
fromRootSecret()
fromRootSecret(
rootSecret,opts):Promise<Wallet>
Defined in: src/wallet/index.ts:273
Load a wallet from its rootSecret. Spend-capable by DEFAULT (SPEC §4.2.1: LocalSigner is the default) — the SDK derives a LocalSigner internally, since the rootSecret already grants spend power. Pass signer to attach a different signer (e.g. ExternalSigner), or viewOnly: true for a view-only wallet from a rootSecret (the derived spend key is zeroed at once; spend-path calls throw NoSpendCapabilityError). A signer must hold this wallet's spending key: one whose getSpendingPublicKey() differs is rejected with SignerContractViolationError before the wallet loads. Deriving from the root secret puts the spend key in the SDK briefly even with an external signer; to keep it out entirely, use viewOnlyFromViewingKey with a signer.
creationBlock is where the wallet starts looking for its notes; the merkle tree is always built from the pool's deploy block, so a later value never breaks syncing. Pass the deploy block when the same rootSecret may already have notes (e.g. a returning user on a new device).
Parameters
rootSecret
Uint8Array
opts
creationBlock
number
signer?
viewOnly?
boolean
Returns
Promise<Wallet>
ephemeralFromSeed()
ephemeralFromSeed(
seed):Promise<Wallet>
Defined in: src/wallet/index.ts:278
Ephemeral, in-memory only, never persisted — for claimable payments (SPEC §6).
Parameters
seed
Uint8Array
Returns
Promise<Wallet>
fromMnemonic()
fromMnemonic(
mnemonic,opts):Promise<Wallet>
Defined in: src/wallet/index.ts:284
BIP-39 compat for the relayer's mnemonic-provisioned wallet. Validates the mnemonic checksum; spend-capable by default (auto-derives a LocalSigner), with signer/viewOnly overrides and an optional derivationIndex (default 0).
Parameters
mnemonic
string
opts
creationBlock
number
signer?
viewOnly?
boolean
derivationIndex?
number
Returns
Promise<Wallet>
viewOnlyFromViewingKey()
viewOnlyFromViewingKey(
shareableViewingKey,opts):Promise<Wallet>
Defined in: src/wallet/index.ts:294
From a shareable viewing key: full scan/balance/history. View-only by default (spend-path calls throw NoSpendCapabilityError). Pass signer (e.g. an ExternalSigner over an HSM or policy service) to make it spend-capable while the spend key never enters the SDK — the only way to spend without the SDK seeing the root secret.
Parameters
shareableViewingKey
string
opts
creationBlock
number
signer?
Returns
Promise<Wallet>