Recommended: JavaScript SDK with React Hooks
For new React apps, we recommend the JavaScript SDK with React Hooks (
@dynamic-labs-sdk/react-hooks) instead of the legacy React SDK documented here. The JS SDK comes with many benefits such as a much smaller bundle size and other optimizations. Use the React quickstart (JavaScript SDK) to get started.Aleo support is embedded-only today. The methods below are exposed on
wallet.* for
Dynamic embedded (MPC) Aleo wallets and route through the iframe (the Aleo Feemaster +
Provable’s Decentralized Proving Service). Wallet Adapter Aleo wallets expose
a separate wallet.requestTransaction / wallet.requestRecords API and will throw if
these embedded-only methods are called.- Public — balances tracked on-chain like a standard ledger.
- Private — balances held inside owned records (encrypted UTXOs). Spending a record reveals nothing about the rest of the wallet’s state.
Installation
Setup
Include the Aleo wallet connector in your provider configuration:Checking if a wallet is an Aleo wallet
Sign a message
Available on every Aleo wallet (embedded and Wallet Adapter):Fetch private balances
For a per-token aggregated view of the wallet’s private balances (credits, stablecoins, ARC-21), use theusePrivateTokenBalances hook. It mirrors useTokenBalances and is the recommended way to render shielded balances next to public ones:
List owned records
If you need the raw owned records (rather than the per-token aggregation thatusePrivateTokenBalances returns), call listOwnedRecords directly. Each entry carries program_name and record_name so you can group/display by token. Backed by Provable’s RecordScanner via the iframe — the view key never leaves the iframe.
Send balance
sendBalance is available on all Aleo wallets, but the transfer path differs by wallet type:
Embedded wallets
Embedded wallets always draw from the wallet’s private records — the public balance is never touched directly. Two modes control the transfer path:
Record selection:
sendBalance scans owned records and picks the smallest single record
that covers the requested amount. If no single record is large enough, it throws — call
wallet.joinRecords() first to merge smaller records into one that covers the transfer.
If no single owned record covers the requested amount,
sendBalance throws with a message
asking you to call wallet.joinRecords() first to merge smaller records into one that covers
the transfer.Wallet Adapter wallets
For Wallet Adapter wallets (Leo, Puzzle, Fox),sendBalance executes a transfer_public —
a straightforward public balance transfer with no private record interaction.
Execute a program transition (proveTransaction)
The generic Aleo entry point: signs through MPC, optionally injects a Sealance freeze-list
proof for Sealance-compliant stablecoins, applies Feemaster sponsorship when covered, and
submits to Provable DPS.
Common transitions
- Public transfer
- Private transfer
- Unshield (private → public)
- Shield (public → private)
credits.aleo/transfer_public(receiver: address, amount: u64) — public→public credits transfer.Shield a token (public → private)
The shield operation maps a public balance into a fresh private record owned by the user. The helpers below let you check eligibility and Feemaster sponsorship before dispatching.The SDK applies optimistic updates the moment
shieldToken resolves: the public balance is
debited and a synthesised record is added to the private balance, so the UI reacts immediately
without waiting for the indexer. Both useTokenBalances
and usePrivateTokenBalances reflect the
optimistic state, and reconcile silently once the new record is indexed.Merge owned records (joinRecords)
Pairwise-merges owned records down to one per program by recursively running
<program>/join. Sponsored by Feemaster for credits.aleo today; stablecoin / ARC-21 fall
through to user-paid if Feemaster doesn’t yet cover the pair.
Programs the connector doesn’t recognise (no registered join shape) are reported as
skipped: 'unsupported' in results rather than thrown — iterate the results to surface
what merged vs. what didn’t.
Check Feemaster sponsorship (generic)
For any(programId, functionName) pair on the currently-selected Aleo network. Useful to
decide whether to dispatch silently or surface a user-paid fee confirmation. Never throws —
returns false on any failure so callers can default to “show modal”.
Send flow widget integration
The Dynamic Widget’s “Send” button drives the sameindividual / exchange modes as
sendBalance above. Auto-shield is paused for the in-flight token during the exchange flow
so the just-unshielded amount isn’t immediately re-shielded by the background optimisation.