Integration

1. Search for best swap router

GET https://2bird.xyz/api/dex/router/search

Request parameters

Name
Type
Required
Description

coinInType

string

Yes

Full Sui coin type of the token you are swapping from

coinOutType

string

Yes

Full Sui coin type of the token you are swapping to

coinInAmount

string

Yes

Amount of input token in base units (no decimals applied)

feeRate

string

No

Fee rate in basis points (default: "0"). Max: 100(1% ), protocol will charge 20% base on the fee if available.

Response

{
  "paths": [
    [
      {
        "coinIn": "0x...::usdc::USDC",
        "coinOut": "0x...::sui::SUI",
        "amountIn": "1000000",
        "amountOut": "5000000",
        "poolId": "0x..."
      }
    ]
  ],
  "amountIn": "1000000",
  "amountOut": "5000000"
}

Example Request


2. Build Swap Transaction

Description

Given paths from /search, builds a serialized transaction block you can sign and execute.

Request Body

Response

  • buildTxb – Transaction bytes (as an object with numeric keys).

  • error – Error message if building failed.


Frontend Integration

Last updated