![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
rainbow-swap-sdk
Advanced tools
SDK for building applications on top of Rainbow Swap ๐ - The Next Gen DEX Aggregator on TON ๐.
This SDK is designed for building applications on top of Rainbow Swap ๐ - The Next Gen DEX Aggregator on the TON blockchain ๐.
We have plans to integrate commissions and share them with those who have integrated this SDK into their DApps.
To install the rainbow-swap-sdk, use the following npm command:
npm install rainbow-swap-sdk
import {
getAssetsRecord,
getBestRoute,
getSwapMessages
} from 'rainbow-swap-sdk';
// 1. On page load: fetch the list of available tokens
const assetsRecord = await getAssetsRecord();
...
// 2. On input asset amount, input asset, or output asset change: fetch a new swap route
const params = {
inputAssetAmount: '1000000000', // 1 TON in nano
inputAssetAddress: 'ton', // TON
outputAssetAddress: 'EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs' // USDT jetton master address
};
const bestRouteResponse = await getBestRoute(params);
...
// 3. Generate sign request messages & send it via @tonconnect
const userAddress = 'UQDGGjjuwhikx8ZPJsrLbKXGq7mx26D8pK_l8GqBejzB52Pa'; // user wallet address
const slippageTolerance = 2.5; // 2.5%
const swapMessages = await getSwapMessages(
userAddress,
bestRouteResponse.bestRoute,
slippageTolerance
);
Additionally, you might want to check if everything is functioning correctly. For instance, you could temporarily disable swaps if block production on TON is disrupted due to the DOGS listing.
import { getAppStatus } from 'rainbow-swap-sdk';
const {
isSwapsEnabled, // true - if everything works fine
message // explanations why swaps are disabled
} = await getAppStatus();
For a live example of using the SDK, visit Rainbow Swap ๐ repository.
For questions and suggestions, contact us at Blackbot.
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
FAQs
SDK for building applications on top of Rainbow.ag - Swap Aggregator on TON ๐.
The npm package rainbow-swap-sdk receives a total of 4 weekly downloads. As such, rainbow-swap-sdk popularity was classified as not popular.
We found that rainbow-swap-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.ย It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenanceโdevelopers should switch to Vite or other modern alternatives.