Skip to content

getTokenOut

The getTokenOut method retrieves the output token address from a route.

Signature

getTokenOut(): Address | undefined;

TypeScript Types

// Import for viem
import type { Address } from 'symphony-sdk/types/viem';
 
// Import for ethersV5
import type { Address } from 'symphony-sdk/types/ethersV5';
 
// Import for ethers v6
import type { Address } from 'symphony-sdk/types/ethers';
 
type Address = `0x${string}`;

Returns

Returns the address of the output token. For native SEI token swaps, returns the wrapped SEI (WSEI) address.

Example Usage

const symphony = new Symphony();
 
// Get a route for USDC -> SEI swap
const route = await symphony.getRoute(
  "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
  "0x0", // SEI
  "1.0"
);
 
// Get output token address
const tokenOut = route.getTokenOut();
console.log(tokenOut); // "0xe30fedd158a2e3b13e9badaeabafc5516e95e8c7" (WSEI)

Notes

  • For native SEI token swaps, returns the WSEI (Wrapped SEI) address
  • The token address is always returned in lowercase format
  • Use getRouteDetails if you need more token information like decimals or symbol

Error Handling

The method will return undefined if:

  • The route is invalid or empty
  • The route array structure is incorrect