npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@tangleswap/orbit-router

v1.1.9

Published

TangleSwap Orbit Router

Downloads

16

Readme

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