Skip to main content

Specifying Assets

When creating an asset movement, it is essential to correctly specify the assets that will be included in a cross-chain order or a same-chain swap. This section shows how to do it, and covers some special cases. This article is relevant for both same-chain swaps and cross-chain orders.
Hands on examples can be found in the examples repository.

EVM and SPL tokens

When specifying EVM or SPL tokens in an asset movement, token’s contract/program address must be provided.

EVM Example

const orderInput: deBridgeOrderInput = {
    srcChainId: '42161',
    srcChainTokenIn: "0xaf88d065e77c8cc2239327c5edb3a432268e5831", // USDC Arbitrum
    srcChainTokenInAmount: "1000000", // 1 USDC (6 decimals)
    dstChainId: '137',
    dstChainTokenOut: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359", // USDC Polygon
    dstChainTokenOutRecipient: recipientAddress,
    account: senderAddress,
    srcChainOrderAuthorityAddress: senderAddress,
    dstChainOrderAuthorityAddress: recipientAddress,
  };

Solana Example

  const orderInput: deBridgeOrderInput = {
    srcChainId: '7565164',
    srcChainTokenIn: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", // USDC Solana
    srcChainTokenInAmount: "1000000", // 1 USDC (6 decimals)
    dstChainId: '137',
    dstChainTokenOut: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359", // USDC Polygon
    dstChainTokenOutRecipient: evmUserAddress,
    account: solWallet.publicKey.toBase58(),
    srcChainOrderAuthorityAddress: solWallet.publicKey.toBase58(),
    dstChainOrderAuthorityAddress: evmUserAddress,
  };

Native Assets

When specifying native assets, such as ETH on Ethereum or SOL on Solana, predefined identifiers for these assets must be used.

EVM Example

On EVM chains, the native asset (e.g., ETH on Mainnet, ETH on Arbitrum, MATIC on Polygon, BNB on BNB) is represented by the zero address: 0x0000000000000000000000000000000000000000.
  const orderInput: deBridgeOrderInput = {
    srcChainId: '137',
    srcChainTokenIn: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359", // USDC Polygon
    srcChainTokenInAmount: "1000000", // 1 USDC (6 decimals)
    dstChainId: '56',
    dstChainTokenOut: "0x0000000000000000000000000000000000000000",
    dstChainTokenOutRecipient: recipientAddress,
    account: senderAddress,
    srcChainOrderAuthorityAddress: wallet.address,
    dstChainOrderAuthorityAddress: recipientAddress
  };
Wrapped versions of native assets (e.g., WETH, WMATIC) should be specified using their respective contract addresses.

Solana Example

On Solana, we have two cases to consider: SOL and WSOL. It is important to not confuse the two.

SOL (Native SOL)

The native SOL asset is represented by the special identifier: 11111111111111111111111111111111. In this example, native SOL is moved to MATIC on Polygon:
  const orderInput: deBridgeOrderInput = {
    srcChainId: '7565164',
    srcChainTokenIn: "11111111111111111111111111111111", // SOL native token
    srcChainTokenInAmount: "100000000", // 0.1 SOL (9 decimals)
    dstChainId: '137',
    dstChainTokenOut: "0x0000000000000000000000000000000000000000", // Polygon native token
    dstChainTokenOutRecipient: evmUserAddress,
    account: solWallet.publicKey.toBase58(),
    srcChainOrderAuthorityAddress: solWallet.publicKey.toBase58(),
    dstChainOrderAuthorityAddress: evmUserAddress,
  };

WSOL (Wrapped SOL)

The wrapped SOL asset is represented by the special identifier: So11111111111111111111111111111111111111112. This example exchanged SOL for WSOL on Solana through a same-chain swap:
  const sameChainSwapInput: SameChainSwapInput = {
    chainId: '7565164',
    tokenIn: "11111111111111111111111111111111", // native SOL
    tokenInAmount: "100000000", // 0.1 SOL (9 decimals)
    tokenOut: "So11111111111111111111111111111111111111112", // WSOL 
    tokenOutRecipient: solWallet.publicKey.toBase58(),
    senderAddress: solWallet.publicKey.toBase58(),
  };