SDK
Wallet
openAgentWallet and what an AgentWallet can do.
const wallet = await openAgentWallet({ config, passphrase }); config needs only the wallet variables (loadWalletConfig). Instead of a passphrase you can pass
identity, an Ed25519 signer whose key lives elsewhere (createRemoteEd25519Identity).
| Method | What it does |
|---|---|
address(), shieldedAddress() | Public addresses |
balance(asset?) | { privateBase, publicBase, syncedSlot } |
deposit(amountBase) | Public to private. Visible on chain |
split(parts) | More private outputs, for parallel payments |
merge() | Combine private outputs |
withdraw(to, amountBase) | Private to public. Amount and recipient visible |
privateTransfer(shieldedAddress, amountBase, options?) | One transfer, with the agent as the only public signer |
signExternalMessage(bytes) | Signs the claim proof. Refuses key-derivation messages |
close() | Wipes keys from memory |
Not built
wallet.history() exists in the interface but throws SDK_NOT_IMPLEMENTED. Use journal.history() for what this
agent paid.
Withdraw everything
withdrawAll merges when it has to and withdraws in rounds. Check remainingBase: anything but 0n means part of the
balance is still private. If funds moved and a later step failed, it returns what moved instead of throwing, and sets
unconfirmed when it could not read the balance again.
const result = await withdrawAll(wallet, "<your Solana address>");