getTotalAmountIn
The getTotalAmountIn method calculates the total input amount required for the route, including all split paths.
Signature
async getTotalAmountIn(): Promise<{
amountIn: bigint | BigNumber;
amountInFormatted: string;
tokenIn: string;
tokenOut: string;
}>TypeScript Types
// Import for viem/ethers v6 (uses bigint)
import type { AmountInfo } from 'symphony-sdk/types/viem';
// Import for ethersV5 (uses BigNumber)
import type { AmountInfo } from 'symphony-sdk/types/ethersV5';
import type { BigNumber } from 'ethers';
interface AmountInfo {
amountIn: bigint | BigNumber;
amountInFormatted: string;
tokenIn: string;
tokenOut: string;
}Returns
Returns a Promise that resolves to an object containing:
amountIn- Total input amount in raw units (bigint for viem/ethers v6, BigNumber for ethersV5)amountInFormatted- Total input amount formatted with token decimals (string)tokenIn- Token in address (string)tokenOut- Token out address (string)
Example Usage
const symphony = new Symphony();
// Get an arbitrary route
const route = await symphony.getRoute(
"0x0", // SEI
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
"1.0"
);
// Get total input amount
const totalAmountIn = await route.getTotalAmountIn();
console.log(totalAmountIn.amountIn.toString()); // "1000000000000000000" (1 SEI in wei)
// or Ethers BigNumber representation for Ethers V5 library (1 SEI in wei)
console.log(totalAmountIn.amountInFormatted.toString()); // "1" (1 SEI)Error Handling
The method will throw an error if:
- The route is invalid or empty
- The route array structure is incorrect
- The input amounts are not properly initialized

