33<p align =" center " >
44 <a href =" https://across.to " >
55 <picture>
6- <source media="(prefers-color-scheme: dark)" srcset=". /.github/across-logo-dark.png">
7- <img alt="across logo" src=". /.github/across-logo-light.png" width="auto" height="60">
6+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/across-protocol/toolkit/refs/heads/master /.github/across-logo-dark.png">
7+ <img alt="across logo" src="https://raw.githubusercontent.com/across-protocol/toolkit/refs/heads/master /.github/across-logo-light.png" width="auto" height="60">
88 </picture>
99</a >
1010</p >
1111
1212<p align =" center " >
13- Toolkit for building on top of the <a href =" https://across.to " >Across Protocol</a > 🛠️
13+ Toolkit 🛠️ for building on top of the <a href =" https://across.to " >Across Protocol</a >
1414<p >
15+ <p align =" center " >
16+ Fastest and lowest-cost bridging for end-users. Streamlined interoperability for developers.
17+ </p >
1518
1619<p align =" center " >
17- <a href =" https://www.npmjs.com/package/@across-protocol/integrator-sdk " >
18- <picture>
19- <source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/npm/v/@across-protocol/integrator-sdk?colorA=21262d&colorB=21262d&style=flat">
20- <img src="https://img.shields.io/npm/v/@across-protocol/integrator-sdk?colorA=f6f8fa&colorB=f6f8fa&style=flat" alt="Version">
21- </picture>
20+ <a href =" https://discord.across.to " target =" _blank " rel =" noreferrer " >
21+ <img src="https://img.shields.io/badge/Chat%20on-Discord-%235766f2" />
2222 </a >
23- <a href =" https://github.com//@ across-protocol/integrator /blob/master/LICENSE " >
23+ <a href =" https://github.com/across-protocol/toolkit /blob/master/LICENSE " >
2424 <picture>
2525 <source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/badge/license-AGPL-21262d?style=flat">
2626 <img src="https://img.shields.io/badge/license-AGPL-f6f8fa?style=flat" alt="MIT License">
2727 </picture>
2828 </a >
29+ <a href =" https://twitter.com/AcrossProtocol/ " target =" _blank " rel =" noreferrer " >
30+ <img src="https://img.shields.io/twitter/follow/AcrossProtocol?style=social"/>
31+ </a >
2932</p >
3033
3134<br >
3235
33- # Getting Started
34-
35- The ` @across-protocol/integrator-sdk ` provides useful abstractions on top of Across' Smart Contracts and Quotes API.
36-
37- To learn more visit our [ docs] ( https://docs.across.to/ ) .
38-
39- ## Installation
36+ ## Overview
4037
41- To get started, install the integrator sdk and its peer dependency [ viem] ( https://viem.sh/ ) .
42-
43- ``` bash
44- pnpm i @across-protocol/integrator-sdk viem
45- ```
46-
47- ## Quick Start
48-
49- ### 1. Set up the ` AcrossClient `
50-
51- Firstly, you need to set up the ` AcrossClient ` and configure the chains you want to support.
38+ Quickly integrate with a few lines of code. See [ here] ( ./packages/sdk/README.md ) for more details.
5239
5340``` ts
5441import { createAcrossClient } from " @across-protocol/integrator-sdk" ;
5542import { mainnet , optimism , arbitrum } from " viem/chains" ;
43+ import { useWalletClient } from " wagmi" ;
44+
45+ const wallet = useWalletClient ();
5646
47+ // 1. Create client
5748const client = createAcrossClient ({
58- integratorId: " YOUR_INTEGRATOR_ID " ,
49+ integratorId: " 0xdead " , // 2-byte hex string
5950 chains: [mainnet , optimism , arbitrum ],
6051});
61- ```
62-
63- ### 2. Retrieve a quote
6452
65- Now, you can retrieve a quote for a given route.
66-
67- ``` ts
68- // USDC from Optimism -> Arbitrum
53+ // 2. Retrieve quote for USDC from Optimism -> Arbitrum
6954const route = {
7055 originChainId: optimism .chainId
7156 destinationChainId : arbitrum .chainId ,
@@ -76,46 +61,33 @@ const quote = await client.getQuote({
7661 route ,
7762 inputAmount: parseUnit (" 1000" , 6 ) // USDC decimals
7863})
79- ```
80-
81- Note that we provide additional utilities for retrieving available routes, chain details, and token infos.
82- See [ SDK reference] ( ./packages/sdk/README.md ) .
83-
84- ### 3. Execute a quote
85-
86- After retrieving a quote, you are ready to execute it.
87-
88- ``` ts
89- import { useWalletClient } from " wagmi" ;
90-
91- const wallet = useWalletClient ();
9264
65+ // 3. Execute quote
9366await client .executeQuote ({
9467 walletClient: wallet ,
95- deposit: quote .deposit , // returned by `getQuote`
68+ deposit: quote .deposit ,
9669 onProgress : (progress ) => {
9770 // handle progress
9871 },
9972});
10073```
10174
102- The method will execute a quote by:
103-
104- 1 . Approving the SpokePool contract if necessary
105- 2 . Depositing the input token on the origin chain
106- 3 . Waiting for the deposit to be filled on the destination chain
107-
108- You can use the ` onProgress ` callback to act on different stages of the execution.
109- Have a look at our [ example app] ( ./apps/example/ ) for a more detailed usage of this method.
110-
111- ## Cross-chain message handling
75+ ## Tools
11276
113- TODO
77+ | Package | Description |
78+ | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
79+ | [ ` @across-protocol/integrator-sdk ` ] ( ./packages/sdk/README.md ) | TypeScript package for building on top of Across Protocol's Smart Contracts and Quotes API |
11480
115- ## Error handling and debugging
81+ ## Examples
11682
117- TODO
83+ | App | Description |
84+ | ---------------------------------- | ------------------------------------ |
85+ | [ using viem] ( ./apps/example/app ) | Example Next.js app using [ viem] ( ) |
86+ | [ using ethers] ( ./apps/example/app ) | Example Next.js app using [ ethers] ( ) |
11887
119- ## Route, chain and token details
88+ ## Links
12089
121- TODO
90+ - Website: < https://across.to >
91+ - App: < https://app.across.to >
92+ - Docs: < https://docs.across.to >
93+ - Medium: < https://medium.com/across-protocol >
0 commit comments