Skip to content

across-protocol/toolkit

Repository files navigation


across logo

Toolkit 🛠️ for building on top of the Across Protocol

Fastest and lowest-cost bridging for end-users. Streamlined interoperability for developers.

MIT License


Overview

Quickly integrate with a few lines of code. See here for more details.

import { createAcrossClient } from "@across-protocol/app-sdk";
import { mainnet, optimism, arbitrum } from "viem/chains";
import { useWalletClient } from "wagmi";

const wallet = useWalletClient();

// 1. Create client
const client = createAcrossClient({
  integratorId: "0xdead", // 2-byte hex string
  chains: [mainnet, optimism, arbitrum],
});

// 2. Retrieve quote for USDC from Arbitrum -> Optimism
const route = {
  originChainId: arbitrum.id,
  destinationChainId: optimism.id,
  inputToken: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
  outputToken: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",
};
const quote = await client.getQuote({
  route,
  inputAmount: parseUnit("1000", 6) // USDC decimals
})

// 3. Execute quote
await client.executeQuote({
  walletClient: wallet,
  deposit: quote.deposit,
  onProgress: (progress) => {
    // handle progress
  },
});

Tools

Package Description
@across-protocol/app-sdk TypeScript package for building on top of Across Protocol's Smart Contracts and Quotes API

Examples

App Description
using viem Example Next.js app using viem
using ethers Example Next.js app using ethers

Links