getPortfolio
utility provides the total balance, it doesn’t consider the execution fee, as this fee 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
. This will take all the gas and bridging fees for a given chain into consideration, as well as the user’s token portfolio across all chains, and output the max amount of tokens you can spend
In this case, we get the maximum spendable USDC amount on Base Sepolia: