Skip to main content

Across Provider

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

Status: Active (mainnet + 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: "0xYourAddress",
input: {
chainId: 11155111,
assetAddress: "0xInputTokenAddress",
amount: "1000000000000000000", // 1 token (in wei)
},
output: {
chainId: 84532,
assetAddress: "0xOutputTokenAddress",
recipient: "0xRecipientAddress",
},
swapType: "exact-input",
});

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

Fees

After getting a quote, you can inspect the standardized fee breakdown via quote.fees:

const quote = quotes[0];

console.log(quote.fees?.bridgeFee); // { amount, amountUsd, token }
console.log(quote.fees?.bridgeFeePct); // percentage (wei-encoded, 1e18 = 100%)
console.log(quote.fees?.originGas); // origin chain gas estimate

See the API reference for the full QuoteFees type.

Executing Transactions

Across quotes always contain transaction steps. After getting a quote, execute the transaction:

import { getTransactionSteps } from "@wonderland/interop-cross-chain";
import { createWalletClient, http } from "viem";
import { sepolia } from "viem/chains";

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

const step = getTransactionSteps(quote.order)[0];
const hash = await walletClient.sendTransaction({
to: step.transaction.to,
data: step.transaction.data,
value: step.transaction.value ? BigInt(step.transaction.value) : undefined,
});
console.log("Transaction sent:", hash);

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.

Next Step

See a complete working example: Execute Intent

References