Getting Started
Introduction
The Router SDK provides a seamless integration interface for interacting with the Tucana Router Protocol. It simplifies the process of querying and managing liquidity pools, find best swap router and executing trades.
2. Installation
Before you can use the TucanaSpotSDK Client, you need to set up your project environment.
npm i @tucana-network/router-sdk
3. Instantiate TucanaRouterSDK
Typescript Example:
export const pools = [
{
"poolAddress":"0x5ac29fe7b20de263252ef6c32e2142561199bb56f73480414032b209a094f8d7",
"token0Address":"0xdcc53a7a807e573c7f048bcf2b736717db0894fc4a6682e0ce71beb2a3875b4b",
"token1Address":"0x4b7cf6f28fdff5237c85b77f2ba4adabdca4f5c69877d314ba28e776d4d2730f",
"decimal0":9,
"decimal1":6,
"feeRate":2500,
"isPause":false
},
{
"poolAddress":"0xcc93acb770844c4b005f897e09dff9d6b0d4afe0055ab70ae4faffce95c4ce0b",
"token0Address":"0x9976e868ba06d58fb8566b294efcf5ac6929aa7a0f306afc90313abc0d6a3ec4",
"token1Address":"0x8e4733bdabcf7d4afc3d14f0dd46c9bf52fb0fce9e4b996c939e195b8bc891d9",
"decimal0":6,
"decimal1":6,
"feeRate":2500,
"isPause":false
}]
const sdkConfig: SdkConfig = {
tokenPriority: ['USDT', 'USDC'],
nativeToken: 'init',
rpcUrl: 'https://lcd.layer1.initia.xyz',
contractAddress: {
tucana_clmm: '0x8609f642a8ab1c13d661c14d733cab227bba15635a730af2057051b3f2ada3f6',
tucana_router: '0x3933C6AB1A6F84E9CDA13AE78F389666C9B83E69'
},
chainId: 'layer1',
defaultGasPrice: '0.005uinit',
defaultGasAdjustment: '2.0',
defaultMaxHops: 2,
}
const lcd = genLCDClient(sdkConfig)
const tucanaRouterClient = new TucanaRouterClient(sdkConfig, pools, lcd)
Last updated