How routing uses balances
When routing across a unified portfolio, the orchestrator generally prefers:- The requested token on the target chain.
- The same token on another chain.
- An equivalent asset, such as ETH and WETH or USDC and USDT.
- Another target-chain asset that can be swapped.
- Other available assets, including balances split across tokens or chains.
A portfolio is a routing snapshot, not a reservation guarantee. Prepare a
transaction to receive the executable quote and current costs.
Spendable balance
Portfolio results exclude balances already committed to outstanding intents. This prevents the same funds from being allocated twice while claims or settlement are pending. The spendable amount can still change between a portfolio read and quote preparation. Refresh the portfolio after completed or failed intents, deposits, withdrawals, and other balance changes.Read and spend a unified balance
- Embedded wallet
- Custom signer
- REST API
Use the initialized Each balance includes its chain ID, token address, symbol, decimals, and a base-unit balance string. Add
oneAuth client and authenticated accountAddress from Accounts.Read assets
UsegetAssets to read the portfolio:getAssets requires the application access-token configuration from Sponsorship setup, including for user-paid intents. The access token identifies the application; it does not grant fee sponsorship by itself.getAssets rejects on missing app credentials, access-token failures, or portfolio request failures. Handle it with try/catch. This differs from sendIntent, which returns a structured success or failure result.Fund an intent
Reuse the target token, amount, and calls from Send a transaction. IncludetokenRequests and omit source constraints to let the orchestrator select from available mainnet balances:sourceAssets and sourceChainId when the user explicitly chooses an input token on a particular chain. sourceAssets accepts ERC-20 addresses, not token symbols. Restrictions can prevent a route even when the portfolio has enough value elsewhere.With neither tokenRequests nor sourceAssets, omitting sourceChainId defaults funding to the target chain. Do not treat that call shape as a request to search the full crosschain portfolio.Sponsorship is required by default. sendIntent() does not expose the custom signer SDK’s prepared quote object to your application. See Send a transaction for funding and review options, then use the result to track the intent.Keep displayed and executable amounts distinct
- Display portfolio balances as available assets, not guaranteed transaction outputs.
- Use the prepared quote to show exact inputs, outputs, and fees when your client exposes one.
- Keep pending intent IDs and refresh balances after their terminal result.
- Do not add an account’s existing balance to
auxiliaryFunds; doing so double-counts funds during quoting. - If source restrictions cause insufficient liquidity, relax only the restrictions the user has agreed to change and prepare a new quote.