Wallet API
EBWallet — created via client.wallet() — is the main interface for encrypted balance operations.
Creating a Wallet
const wallet = client.wallet({
spendingKey: keys.spendingKey,
account: privateKeyToAccount('0x...'),
// OR
walletClient: metamaskWalletClient,
});
Properties
| Property | Type | Description |
|---|---|---|
BPK | Point | Balance Public Key (share to receive transfers) |
address | Address | ETH address from account |
currency | string? | Current currency (undefined = default) |
stealth | StealthManager | Stealth address manager — see Stealth API |
client | EBClient | Underlying client |
Multi-Currency
const usdWallet = wallet.token('USD');
const eurWallet = wallet.EUR;
const plnWallet = wallet.PLN;
const balances = await wallet.getAllBalances();
const cached = wallet.getCachedBalances();
Balance
const balance = await wallet.USD.getBalance();
const publicBalance = await wallet.USD.getPublicBalance();
wallet.USD.seedBalance(savedBalance);
const instant = wallet.USD.getCachedBalance();
const amount = await wallet.USD.decryptCiphertext(ciphertext);
Shield
await wallet.USD.shield({
amount: 1000_000000n,
to: recipientBPK, // optional, defaults to self
useRelayer: true, // optional
});
Transfer
await wallet.USD.transfer({
to: recipientBPK, // Point or zk1 address string
amount: 500_000000n,
useRelayer: true,
});
Prepare Without Submitting
For atomic swaps — generates the proof but doesn't submit:
const { proof, proofHex, publicInputs } = await wallet.USD.prepareTransfer(
recipientBPK,
amount,
{ authorizedCaller: swapRegistryAddress }
);
Unshield
await wallet.USD.unshield(100_000000n);
await wallet.USD.unshield(100_000000n, '0x...recipient', { useRelayer: true });
Registration
const registered = await wallet.USD.isRegistered();
await wallet.USD.registerBPK();
const enabled = await wallet.USD.getAutoshield();
await wallet.USD.setAutoshield(true);
await wallet.USD.faucet();
Transfer Decryption
const received = await wallet.USD.decryptTransferAmount(txHash);
const sent = await wallet.USD.decryptOutgoingTransferAmount(txHash);
History
const history = await wallet.USD.getHistory({ limit: 50 });
const fresh = await wallet.USD.getHistory({ refresh: true });
const allHistory = await wallet.getAllHistory({ limit: 100 });
Options:
| Field | Type | Description |
|---|---|---|
fromBlock | bigint | Start block (default: deployment block) |
limit | number | Max items (default: 50) |
refresh | boolean | Bypass cache (default: false) |
Returns HistoryItem[] — see Types.