Unified Balance
The Omni Account uses the aggregated balance of the user’s funds across all supported chains, taking into account any outstanding intents.
To get the aggregated portfolio of tokens:
To get the aggregated portfolio of testnet tokens:
This will return the list of spendable tokens (i.e., not part of any pending transaction).
Max Spendable Amount
Often, you want to let the user spend the maximum possible amount of tokens for a transaction (e.g. deposit all available USDC into a savings vault).
While the getPortfolio
util provides the total spendable balance, it doesn’t consider the execution fee, as it is chain-specific and depends on the transaction gas cost.
To get an estimate of the maximum amount of tokens you can spend on a given transaction, use getMaxSpendableAmount
. In this case, we get the maximum spendable USDC amount on Base Sepolia: