@skyxexchange/universal-router-sdk
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

universal-router-sdk

This SDK facilitates interactions with the contracts in Universal Router

Usage

Install latest version of universal-router-sdk. Then import the corresponding Trade class and Data object for each protocol you'd like to interact with.

// Use the raw calldata and value returned to call into Universal Swap Router contracts // Trades will happen in the order that they are handed in const { calldata, value } = SwapRouter.swapCallParameters([looksRareTrades, seaportTrades])


### Trading ERC20s on SkyX
warning: `swapERC20CallParameters()` to be deprecated in favor of `swapCallParameters()`
```typescript
import { TradeType } from '@skyxexchange/sdk-core'
import { Trade as V2TradeSDK } from '@skyxexchange/v2-sdk'
import { Trade as V3TradeSDK } from '@skyxexchange/v3-sdk'
import { MixedRouteTrade, MixedRouteSDK, Trade as RouterTrade } from '@skyxexchange/router-sdk'

const options = { slippageTolerance, recipient }
const routerTrade = new SkyXTrade(
  new RouterTrade({ v2Routes, v3Routes, mixedRoutes, tradeType: TradeType.EXACT_INPUT },
  options
)
// Use the raw calldata and value returned to call into Universal Swap Router contracts
const { calldata, value } = SwapRouter.swapCallParameters(routerTrade)

Running this package

Make sure you are running node v16 Install dependencies and run typescript unit tests

yarn install
yarn test:hardhat

Run forge integration tests

yarn symlink # must install git submodules
forge install
yarn test:forge

Dependents (1)

Package Sidebar

Install

npm i @skyxexchange/universal-router-sdk

Weekly Downloads

0

Version

1.0.0

License

none

Unpacked Size

206 kB

Total Files

21

Last publish

Collaborators

  • skyxexchange