Skip to main content

Across Provider

The Across Protocol provider enables cross-chain token transfers using the Across bridge infrastructure.

Status: Testnet

Configuration

FieldTypeRequiredDescription
isTestnetbooleanNoUse testnet API (default: false)
apiUrlstringNoCustom API endpoint URL (overrides isTestnet)
providerIdstringNoCustom provider identifier

Notes:

  • isTestnet also affects tracking defaults (see below).
  • apiUrl overrides the quote endpoint. Tracking uses the standard Across API base URL for the selected network.

Creating the Provider

import { createCrossChainProvider } from "@wonderland/interop-cross-chain";

// Across config is optional - defaults to mainnet
// Mainnet: https://app.across.to/api
// Testnet: https://testnet.across.to/api
const acrossProvider = createCrossChainProvider("across", { isTestnet: true });

Getting Quotes

const quotes = await acrossProvider.getQuotes({
user: USER_INTEROP_ADDRESS, // user's interop address (binary format)
intent: {
intentType: "oif-swap",
inputs: [
// Across only supports single input/output
{
user: USER_INTEROP_ADDRESS, // sender's interop address (binary format)
asset: INPUT_TOKEN_INTEROP_ADDRESS, // input token interop address (binary format)
amount: "1000000000000000000", // 1 token (in wei)
},
],
outputs: [
{
receiver: RECEIVER_INTEROP_ADDRESS, // recipient's interop address (binary format)
asset: OUTPUT_TOKEN_INTEROP_ADDRESS, // output token interop address (binary format)
},
],
swapType: "exact-input",
},
supportedTypes: ["across"], // Required by OIF interface, value is ignored by Across
});

const quote = quotes[0]; // Select the first quote

Executing Transactions

After getting a quote, execute the transaction using the prepared transaction:

import { createWalletClient, http } from "viem";
import { sepolia } from "viem/chains";

const walletClient = createWalletClient({
chain: sepolia,
transport: http(),
account: yourAccount,
});

if (quote.preparedTransaction) {
const hash = await walletClient.sendTransaction(quote.preparedTransaction);
console.log("Transaction sent:", hash);
}

Features

  • Cross-chain token transfers
  • Quote fetching with fee calculation
  • Transaction simulation
  • Order tracking support
  • EIP-7683 Open Intent Framework integration
  • Payload validation for simple bridges

Tracking (Mainnet vs Testnet)

Across tracking is implemented as:

  • Mainnet: API-based fill tracking (polls GET /deposit/status?depositTxnRef=<openTxHash>)
  • Testnet: Event-based fill tracking (Across testnet API is not reliable)

In both cases, the SDK parses the ERC-7683 open event on the origin chain, so you should provide an origin-chain RPC URL for robust tracking.

Payload Validation

The provider validates that calldata from the solver API matches the user's intent:

OperationValidation
Simple bridge (same token)Full validation (depositor, recipient, tokens, amount, chain)
Cross-chain swap (different tokens)Coming soon

Next Step

See a complete working example: Execute Intent

References