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

2.1.0 • Public • Published

Thala Router

SDK to get optimal swap routing for ThalaSwap. Currently, we support finding routes of no more than 3 hops.

Examples

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

Development

This package uses Bun for development and package management.

# install dependencies
bun install

# test the app
bun test

# build the app, available under dist
bun run build

Readme

Keywords

none

Package Sidebar

Install

npm i @thalalabs/router-sdk

Weekly Downloads

116

Version

2.1.0

License

MIT

Unpacked Size

41 kB

Total Files

4

Last publish

Collaborators

  • samuelqzq
  • 0xbe1