router-sdk 2.1.1
Install from the command line:
Learn more about npm packages
$ npm install @thalalabs/router-sdk@2.1.1
Install via package.json:
"@thalalabs/router-sdk": "2.1.1"
About this version
SDK to get optimal swap routing for ThalaSwap. Currently, we support finding routes of no more than 3 hops.
Edit or add a .npmrc
file to including following lines:
//npm.pkg.github.com/:_authToken=_authToken
@thalalabs:registry=https://npm.pkg.github.com
Run command to login:
$ npm login --registry=https://npm.pkg.github.com
> Username: USERNAME
> Password: TOKEN
USERNAME is you github account username. Get the token from your github settings, see "Managing your personal access tokens.".
$ npm i @thalalabs/router-sdk
const router = new ThalaswapRouter("https://fullnode.mainnet.aptoslabs.com/v1");
const fromToken = "0x1::aptos_coin::AptosCoin";
const toToken = "0xec84c05cc40950c86d8a8bed19552f1e8ebb783196bb021c916161d22dc179f7::asset::USDC";
const amountIn = 0.1;
const route = await router.getRouteGivenExactInput(
fromToken,
toToken,
amountIn
);
console.log("Route:", route);
console.log("Entry function payload with 0.5% slippage:", router.encodeRoute(route!, 0.5));
See examples.ts
for more details
This package uses Bun for development and package management.
# install dependencies
pnpm install
# test the app
pnpm run test
# build the app, available under dist
pnpm run build
Details
- router-sdk
-
ThalaLabs
- 9 months ago
- MIT
- 17 dependencies
Assets
- router-sdk-2.1.1.tgz
Download activity
- Total downloads 0
- Last 30 days 0
- Last week 0
- Today 0