rainbow-swap-sdk 1.9.0 → 1.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -39,12 +39,12 @@ yarn add rainbow-swap-sdk
|
|
|
39
39
|
## What you get
|
|
40
40
|
|
|
41
41
|
- Typed API helpers for assets, routes, and swap history.
|
|
42
|
-
- Utilities for
|
|
42
|
+
- Utilities for GRAM amount conversion (`toNano`, `fromNano`).
|
|
43
43
|
- Enum/type exports to keep your integration strongly typed.
|
|
44
44
|
|
|
45
45
|
## Integrate your dApp
|
|
46
46
|
|
|
47
|
-
### Example: swapping 1.35
|
|
47
|
+
### Example: swapping 1.35 GRAM to USDT
|
|
48
48
|
|
|
49
49
|
```typescript
|
|
50
50
|
import {getAssetsList, getBestRoute, toNano} from 'rainbow-swap-sdk';
|
|
@@ -63,7 +63,7 @@ const outputAsset = assetsList.find(
|
|
|
63
63
|
|
|
64
64
|
// 2. Load the best swap route and swap messages
|
|
65
65
|
const bestRouteResponse = await getBestRoute({
|
|
66
|
-
inputAssetAmount: toNano('1.35', inputAsset.decimals).toString(), // Convert 1.35
|
|
66
|
+
inputAssetAmount: toNano('1.35', inputAsset.decimals).toString(), // Convert 1.35 GRAM to nano format
|
|
67
67
|
inputAssetAddress: inputAsset.address,
|
|
68
68
|
outputAssetAddress: outputAsset.address,
|
|
69
69
|
senderAddress: 'UQDGGjjuwhikx8ZPJsrLbKXGq7mx26D8pK_l8GqBejzB52Pa', // Optional user wallet address; if set, swap messages will be returned
|
|
@@ -3,7 +3,7 @@ export type AssetsListParams = {
|
|
|
3
3
|
* A list of asset addresses that the user holds balances in.
|
|
4
4
|
*
|
|
5
5
|
* **Example values:**
|
|
6
|
-
* - `'ton'` for
|
|
6
|
+
* - `'ton'` for GRAM.
|
|
7
7
|
* - `'EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs'` for USDT.
|
|
8
8
|
*
|
|
9
9
|
* **Default:** An empty array (`[]`), indicating no specified user assets.
|
|
@@ -4,14 +4,14 @@ export type BestRouteParams = {
|
|
|
4
4
|
* The amount of the input asset that the user wants to send, specified in nano units.
|
|
5
5
|
* This should be a string representation of a bigint value.
|
|
6
6
|
*
|
|
7
|
-
* **Example:** `'1350000000'` (represents 1.35
|
|
7
|
+
* **Example:** `'1350000000'` (represents 1.35 GRAM in nano).
|
|
8
8
|
*/
|
|
9
9
|
inputAssetAmount: string;
|
|
10
10
|
/**
|
|
11
11
|
* The address or identifier of the asset that the user wants to send.
|
|
12
12
|
*
|
|
13
13
|
* **Example:**
|
|
14
|
-
* - `'ton'` for
|
|
14
|
+
* - `'ton'` for GRAM.
|
|
15
15
|
* - `'EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs'` for USDT.
|
|
16
16
|
*/
|
|
17
17
|
inputAssetAddress: string;
|
|
@@ -19,7 +19,7 @@ export type BestRouteParams = {
|
|
|
19
19
|
* The address or identifier of the asset that the user wants to receive.
|
|
20
20
|
*
|
|
21
21
|
* **Example:**
|
|
22
|
-
* - `'ton'` for
|
|
22
|
+
* - `'ton'` for GRAM.
|
|
23
23
|
* - `'EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs'` for USDT.
|
|
24
24
|
*/
|
|
25
25
|
outputAssetAddress: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rainbow-swap-sdk",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.1",
|
|
4
4
|
"description": "SDK for building applications on top of Rainbow.ag - Swap Aggregator on TON 💎.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"DEX",
|
|
47
47
|
"decentralized-exchange",
|
|
48
48
|
"TON",
|
|
49
|
+
"GRAM",
|
|
49
50
|
"TON blockchain",
|
|
50
51
|
"decentralized finance",
|
|
51
52
|
"DeFi",
|