Across Provider
The Across Protocol provider enables cross-chain token transfers using the Across bridge infrastructure.
Status: Testnet
Configuration
| Field | Type | Required | Description |
|---|---|---|---|
isTestnet | boolean | No | Use testnet API (default: false) |
apiUrl | string | No | Custom API endpoint URL (overrides isTestnet) |
providerId | string | No | Custom provider identifier |
Notes:
isTestnetalso affects tracking defaults (see below).apiUrloverrides 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:
| Operation | Validation |
|---|---|
| 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