New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More โ†’
Socket
Sign inDemoInstall
Socket

rainbow-swap-sdk

Package Overview
Dependencies
Maintainers
0
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rainbow-swap-sdk

SDK for building applications on top of Rainbow Swap ๐ŸŒˆ - The Next Gen DEX Aggregator on TON ๐Ÿ’Ž.

  • 1.3.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-96.69%
Maintainers
0
Weekly downloads
ย 
Created
Source

Rainbow Swap ๐ŸŒˆ SDK

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.


npm version NPM License

Installation

To install the rainbow-swap-sdk, use the following npm command:

npm install rainbow-swap-sdk

Integrate your dApp

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
);

Application status check

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();

Live example

For a live example of using the SDK, visit Rainbow Swap ๐ŸŒˆ repository.

Contact

For questions and suggestions, contact us at Blackbot.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Keywords

FAQs

Package last updated on 28 Sep 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with โšก๏ธ by Socket Inc