For the complete documentation index, see llms.txt. This page is also available as Markdown.

API & SDK

Integrate XRPL cross-chain swaps directly using Squid's routing API or TypeScript SDK. This gives you full control over the swap lifecycle — routing, execution, and status tracking — so you can build custom UIs or backend flows.


API Integration

Route to XRPL (EVM → XRPL)

To route from an EVM chain to XRPL, set toChain to xrpl-mainnet and toToken to one of the supported XRPL token addresses.

const params = {
  fromAddress: "0xYourEVMAddress",
  fromChain: "8453",                  // Base
  fromToken: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",  // ETH
  fromAmount: "1000000000000000",      // Amount in wei
  toChain: "xrpl-mainnet",
  toToken: "xrp",
  toAddress: "YourXRPLAddress",
  quoteOnly: false,
};

const routeResult = await axios.post(
  "https://v2.api.squidrouter.com/v2/route",
  params,
  {
    headers: {
      "x-integrator-id": "<your-integrator-id>",
      "Content-Type": "application/json",
    },
  }
);

const route = routeResult.data.route;
const quoteId = route.quoteId;  // Required for status tracking

Transaction type: DEPOSIT_ADDRESS_CALLDATA — The route response will include a deposit address and calldata. Transfer the specified amount to the deposit address to initiate the swap.

Same-Chain Swap on XRPL (XRPL → XRPL)

You can also perform same-chain swaps between XRPL tokens.

Transaction type: DEPOSIT_ADDRESS_CALLDATA

Route from XRPL (XRPL → EVM)

To route from XRPL to an EVM chain, set fromChain to xrpl-mainnet.

Transaction type: DEPOSIT_ADDRESS_CALLDATA

API Code Examples

Route
Example

EVM → XRPL

XRPL → XRPL

XRPL → EVM


SDK Integration

The Squid SDK provides the same XRPL routing capabilities. After initializing the SDK with your integrator ID, use squid.route() with the same parameters as the API examples above, then execute using the returned transaction request.

For full SDK setup and execution details, see the SDK documentation.

SDK Code Examples

Route
Example

EVM → XRPL

XRPL → XRPL

XRPL → EVM


Status Tracking

XRPL routes are powered by Squid Intents, which requires the quoteId for status polling. The quoteId is returned in the route response.

Important: A Squid Intent transaction will fail unless status is polled with the quoteId. See the Integrating Squid Intents guide for full status polling details.

Last updated