1.1.9 • Published 13 days ago

@tangleswap/orbit-router v1.1.9

Weekly downloads
-
License
GPL-3.0-or-later
Repository
github
Last release
13 days ago

TangleSwap Orbit Router 🛰️

This repository enables optimized swapping on the TangleSwap protocol. It searches within seconds for the most efficient way to trade token A for token B, considering splitting swaps across multiple routes, fee tiers, and gas costs.

List of Supported Chains

Please reference the TangleSwap list of supported networks for information on currently available chains, and instructions on how to add support for a new EVM.

Getting Started — from npm

Install the latest version of the Orbit Router package from npmjs:

yarn add @tangleswap/orbit-router

Usage

Import the OrbitRouter class and create a new instance. On Javascript / Typescript:

import { OrbitRouter } from '@tangleswap/orbit-router'

/**
 * @param param1 XXX
 * @param param2 XXX
 * @param param3 XXX
*/
const orbitRouter = new OrbitRouter(
  param1,
  param2,
  param3,
)

Going Into Orbit

Get a Quote

Request a trading quote from the Orbit Router:

/**
 * @param param1 XXX
 * @param param2 XXX
 * @param param3 XXX
*/
orbitRouter.buildSwapRoute(
  param1,
  param2,
  param3,
).then((rawQuote) => {
  setRawQuote(rawQuote)
})

Parse the Quote

Optionally, parse the quote obtained previously to be used with the TangleSwap SDK module:

/**
 * @param param1 XXX
 * @param param2 XXX
 * @param param3 XXX
*/
orbitRouter.parseSwapRoute(
  param1,
  param2,
  param3,
).then((quote) => {
  setSwapQuote(quote)
})

Getting Started — from source

git clone this-project-code

cd /path/to/this/project/folder/

Run command to install package dependencies

npm install

npm run build

2. Config .env

Notice: Replace with your own your-api-key-here.

JSON_RPC_PROVIDER_SEPOLIA=https://sepolia.infura.io/v3/your-api-key-here
JSON_RPC_PROVIDER_SHIMMER_TESTNET=https://json-rpc.evm.testnet.shimmer.network
JSON_RPC_PROVIDER_CARDANO_TESTNET=https://rpc-devnet-cardano-evm.c1.milkomeda.com
JSON_RPC_PROVIDER_SHIMMER=https://json-rpc.evm.shimmer.network
JSON_RPC_PROVIDER_CARDANO=https://rpc-mainnet-cardano-evm.c1.milkomeda.com

3. Run command and check logs

Shimmer Testnet:

./bin/cli quote --tokenIn 0x1074010000000000000000000000000000000000 --tokenOut 0x89131F3EaC8455897645A2428b07E693DCd89407 --amount 10 --exactIn --recipient 0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B --chainId 1073 --protocols v3

Sepolia:

./bin/cli quote --tokenIn 0x5EaE0A9EE86cC7783b1846e9Dc6865Ec841fecDd --tokenOut 0x00adF8Da72Adb86D9bD9ddc9fcbc089C06a7777e --amount 1 --exactIn --recipient 0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B --chainId 11155111 --protocols v3

Cardano Testnet:

./bin/cli quote --tokenIn 0xe42f60abfc51c9620706b69aeeef838d25120150 --tokenOut 0x18a6752fa58ea77bbfbb13aed9993f77b465205f --amount 10 --exactIn --recipient 0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B --chainId 200101 --protocols v3

./bin/cli quote --tokenIn 0x65a51e52ecd17b641f8f0d1d56a6c9738951fdc9 --tokenOut 0x18a6752fa58ea77bbfbb13aed9993f77b465205f --amount 10 --exactIn --recipient 0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B --chainId 200101 --protocols v3

Shimmer Mainnet:

./bin/cli quote --tokenIn 0x1074010000000000000000000000000000000000 --tokenOut 0xa158a39d00c79019a01a6e86c56e96c461334eb0 --amount 100 --exactIn --recipient 0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B --chainId 148 --protocols v3

./bin/cli quote --tokenIn 0xE5f3dCC241Dd008E3c308e57cf4F7880eA9210F8 --tokenOut 0x1074010000000000000000000000000000000000 --amount 9146 --exactIn --recipient 0xA28d3136372F640D00938cf921b376eE55dD5F96 --chainId 148 --protocols v3

./bin/cli quote --tokenIn 0xE5f3dCC241Dd008E3c308e57cf4F7880eA9210F8 --tokenOut 0x1074010000000000000000000000000000000000 --amount 100 --exactIn --recipient 0xA28d3136372F640D00938cf921b376eE55dD5F96 --chainId 148 --protocols v3

Cardano:

./bin/cli quote --tokenIn 0x46f07469c0163d509f22443a6aa4eb6536a74f58 --tokenOut 0xae83571000af4499798d1e3b0fa0070eb3a3e3f9 --amount 10 --exactIn --recipient 0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B --chainId 2001 --protocols v3

./bin/cli quote --tokenIn 0x6085c822b7a4c688d114468b1380a0ed1873a0b3 --tokenOut 0xae83571000af4499798d1e3b0fa0070eb3a3e3f9 --amount 1 --exactIn --recipient 0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B --chainId 2001 --protocols v3

./bin/cli quote --tokenIn 0x6085c822b7a4c688d114468b1380a0ed1873a0b3 --tokenOut 0xbfb54440448e6b702fa2a1d7033cd5fb0d9c5a27 --amount 1 --exactIn --recipient 0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B --chainId 2001 --protocols v3

IOTA L1:

./bin/cli quote --tokenIn 0x6e47f8d48a01b44DF3fFF35d258A10A3AEdC114c --tokenOut 0xE5f3dCC241Dd008E3c308e57cf4F7880eA9210F8 --amount 1 --exactIn --recipient 0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B --chainId 8822 --protocols v3
1.1.9

13 days ago

1.1.8

13 days ago

1.1.7

4 months ago

1.1.6

4 months ago

1.1.5

4 months ago

1.1.4

5 months ago

1.1.3

6 months ago

1.1.2

6 months ago

1.1.1

6 months ago

1.1.0

6 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago

0.10.4

8 months ago

0.10.3

8 months ago

0.10.2

8 months ago

0.10.1

8 months ago

0.10.0

8 months ago

0.7.3

12 months ago

0.7.2

1 year ago

0.7.1

1 year ago

0.7.0

1 year ago

0.6.3

1 year ago

0.6.2

1 year ago

0.6.1

1 year ago

0.6.0

1 year ago

0.2.0

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago

0.9.3

1 year ago

0.9.2

1 year ago

0.9.1

1 year ago

0.9.0

1 year ago