# XRPL Integration

Integrate cross-chain swaps to, from, and within the XRP Ledger using Squid. XRPL support is powered by [**Squid Intents**](/api-and-sdk-integration/coral-intent-swaps.md) — Squid's intent-based execution protocol for fast, solver-driven cross-chain settlement.

> **Squid Intents must be enabled on your integrator ID.** Reach out to the Squid team to request Squid Intents access before integrating with XRPL.

***

## XRPL Parameters

| Parameter    | Value          |
| ------------ | -------------- |
| **Chain ID** | `xrpl-mainnet` |

### Supported Destination Tokens

The following tokens are currently supported as destination tokens on XRPL via Squid Intents:

| Token     | Address                                                                       |
| --------- | ----------------------------------------------------------------------------- |
| **XRP**   | `xrp`                                                                         |
| **RLUSD** | `524c555344000000000000000000000000000000.rmxckbedwqr76quhesumdegf4b9xj8m5de` |
| **SOIL**  | `534F494C00000000000000000000000000000000.rfmS3zqrQrka8wVyhXifEeyTwe8AMz2Yhw` |

***

## Widget Integration

The fastest way to add XRPL swaps to your application is through the Squid Widget. You can prototype your widget configuration interactively using [**Widget Studio**](https://studio.squidrouter.com/).

### Locking Destination to XRPL

To configure the widget so the destination is always XRPL, use the `initialAssets`, `availableChains`, and `availableTokens` configuration options:

```jsx
<SquidWidget
  config={{
    integratorId: "<your-integrator-id>",
    apiUrl: "https://v2.api.squidrouter.com",
    initialAssets: {
      to: {
        address: "xrp",
        chainId: "xrpl-mainnet",
      },
    },
    availableChains: {
      destination: ["xrpl-mainnet"],
    },
    availableTokens: {
      destination: {
        "xrpl-mainnet": [
          "xrp",
          "524c555344000000000000000000000000000000.rmxckbedwqr76quhesumdegf4b9xj8m5de",
          "534F494C00000000000000000000000000000000.rfmS3zqrQrka8wVyhXifEeyTwe8AMz2Yhw",
        ],
      },
    },
    // ... other configuration options
  }}
/>
```

This configuration:

* Sets the default destination token to XRP on XRPL
* Restricts the destination chain selector to XRPL only
* Limits destination token choices to XRP, RLUSD, and SOIL
* Leaves the source chain and token open for the user to select

For more widget customization options, see the [Widget Customization Guide](/widget-integration/add-a-widget/widget/customization-guide.md).

***

## 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.

```typescript
const params = {
  fromAddress: "0xYourEVMAddress",
  fromChain: "8453",                  // Base
  fromToken: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",  // ETH
  fromAmount: "1000000000000000",      // Amount in wei
  toChain: "xrpl-mainnet",
  toToken: "xrp",
  toAddress: "rYourXRPLAddress",
  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.

```typescript
const params = {
  fromAddress: "rYourXRPLAddress",
  fromChain: "xrpl-mainnet",
  fromToken: "xrp",
  fromAmount: "10000000",             // Amount in drops (10 XRP)
  toChain: "xrpl-mainnet",
  toToken: "524c555344000000000000000000000000000000.rmxckbedwqr76quhesumdegf4b9xj8m5de", // RLUSD
  toAddress: "rYourXRPLAddress",
  quoteOnly: false,
};
```

**Transaction type:** `DEPOSIT_ADDRESS_CALLDATA`

### Route from XRPL (XRPL → EVM)

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

```typescript
const params = {
  fromAddress: "rYourXRPLAddress",
  fromChain: "xrpl-mainnet",
  fromToken: "xrp",
  fromAmount: "10000000",             // Amount in drops (10 XRP)
  toChain: "42161",                   // Arbitrum
  toToken: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",  // USDC
  toAddress: "0xYourEVMAddress",
  quoteOnly: false,
};
```

**Transaction type:** `DEPOSIT_ADDRESS_CALLDATA`

### Status Tracking

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

```typescript
const getStatus = async (params) => {
  const result = await axios.get("https://v2.api.squidrouter.com/v2/status", {
    params: {
      transactionId: params.transactionId,
      fromChainId: params.fromChainId,
      toChainId: params.toChainId,
      quoteId: params.quoteId,  // Required for Squid Intents
    },
    headers: {
      "x-integrator-id": "<your-integrator-id>",
    },
  });
  return result.data;
};
```

> **Important:** A Squid Intent transaction will fail unless status is polled with the `quoteId`. See the [Integrating Squid Intents](/api-and-sdk-integration/coral-intent-swaps/integrating-squid-intents.md) guide for full status polling details.

### API Code Examples

| Route       | Example                                                                                       |
| ----------- | --------------------------------------------------------------------------------------------- |
| EVM → XRPL  | [baseToXrplSwap](https://github.com/0xsquid/examples/tree/main/V2/api/baseToXrplSwap)         |
| XRPL → XRPL | [xrplSameChainSwap](https://github.com/0xsquid/examples/tree/main/V2/api/xrplSameChainSwap)   |
| XRPL → EVM  | [xrplToArbitrumSwap](https://github.com/0xsquid/examples/tree/main/V2/api/xrplToArbitrumSwap) |

***

## 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](/api-and-sdk-integration/sdk.md).

### SDK Code Examples

| Route       | Example                                                                                       |
| ----------- | --------------------------------------------------------------------------------------------- |
| EVM → XRPL  | [baseToXrplSwap](https://github.com/0xsquid/examples/tree/main/V2/sdk/baseToXrplSwap)         |
| XRPL → XRPL | [xrplSameChainSwap](https://github.com/0xsquid/examples/tree/main/V2/sdk/xrplSameChainSwap)   |
| XRPL → EVM  | [xrplToArbitrumSwap](https://github.com/0xsquid/examples/tree/main/V2/sdk/xrplToArbitrumSwap) |

***

## Transaction Types

All XRPL routes use the `DEPOSIT_ADDRESS_CALLDATA` transaction type. This applies to:

* **EVM → XRPL** — Direct route, no DEX swap on source
* **XRPL → EVM** — Direct route from XRPL to any EVM chain
* **XRPL → XRPL** — Same-chain swaps between XRPL tokens

The route response will return a `transactionRequest` containing the deposit address and calldata. Transfer the specified amount to the deposit address to initiate the swap.

For a full reference of all transaction types across all chains, see the [Transaction Types](/api-and-sdk-integration/key-concepts/transaction-types.md) page.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.squidrouter.com/api-and-sdk-integration/chain-integration-guides/xrpl-integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
