rainbow-swap-sdk 1.1.17 → 1.1.19
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 +10 -27
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -23,10 +23,7 @@ npm install rainbow-swap-sdk
|
|
|
23
23
|
```typescript
|
|
24
24
|
import {
|
|
25
25
|
getAssetsRecord,
|
|
26
|
-
getIsRainbowWalletActive,
|
|
27
26
|
getBestRoute,
|
|
28
|
-
getIsActivationRequired,
|
|
29
|
-
getRainbowWalletActivationMessages,
|
|
30
27
|
getSwapMessages
|
|
31
28
|
} from 'rainbow-swap-sdk';
|
|
32
29
|
|
|
@@ -35,13 +32,7 @@ const assetsRecord = await getAssetsRecord();
|
|
|
35
32
|
|
|
36
33
|
...
|
|
37
34
|
|
|
38
|
-
// 2. On
|
|
39
|
-
const userAddress = 'UQDGGjjuwhikx8ZPJsrLbKXGq7mx26D8pK_l8GqBejzB52Pa'; // user wallet address
|
|
40
|
-
const isRainbowWalletActive = await getIsRainbowWalletActive(userAddress);
|
|
41
|
-
|
|
42
|
-
...
|
|
43
|
-
|
|
44
|
-
// 3. On input asset amount, input asset, or output asset change: fetch a new swap route
|
|
35
|
+
// 2. On input asset amount, input asset, or output asset change: fetch a new swap route
|
|
45
36
|
const params = {
|
|
46
37
|
inputAssetAmount: '1000000000', // 1 TON in nano
|
|
47
38
|
inputAssetAddress: 'ton', // TON
|
|
@@ -51,23 +42,15 @@ const bestRouteResponse = await getBestRoute(params);
|
|
|
51
42
|
|
|
52
43
|
...
|
|
53
44
|
|
|
54
|
-
//
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
// After the transaction is confirmed, or if activation is not required, the user can proceed with the swap transaction
|
|
64
|
-
const slippageTolerance = '2.5'; // 2.5%
|
|
65
|
-
const swapMessages = await getSwapMessages(
|
|
66
|
-
userAddress,
|
|
67
|
-
bestRouteResponse.bestRoute,
|
|
68
|
-
slippageTolerance
|
|
69
|
-
);
|
|
70
|
-
}
|
|
45
|
+
// 3. Generate sign request messages & send it via @tonconnect
|
|
46
|
+
const userAddress = 'UQDGGjjuwhikx8ZPJsrLbKXGq7mx26D8pK_l8GqBejzB52Pa'; // user wallet address
|
|
47
|
+
const slippageTolerance = '2.5'; // 2.5%
|
|
48
|
+
|
|
49
|
+
const swapMessages = await getSwapMessages(
|
|
50
|
+
userAddress,
|
|
51
|
+
bestRouteResponse.bestRoute,
|
|
52
|
+
slippageTolerance
|
|
53
|
+
);
|
|
71
54
|
```
|
|
72
55
|
|
|
73
56
|
### Live example
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rainbow-swap-sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.19",
|
|
4
4
|
"description": "SDK for building applications on top of Rainbow Swap 🌈 - The Next Gen DEX Aggregator on TON 💎.",
|
|
5
5
|
"repository": "https://github.com/0xblackbot/rainbow-swap-sdk.git",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@rnw-community/shared": "^0.73.0",
|
|
20
20
|
"@ton/core": "^0.56.3",
|
|
21
|
-
"@ton/crypto": "^3.
|
|
22
|
-
"@ton/ton": "^
|
|
23
|
-
"axios": "^1.7.
|
|
21
|
+
"@ton/crypto": "^3.3.0",
|
|
22
|
+
"@ton/ton": "^14.0.0",
|
|
23
|
+
"axios": "^1.7.3",
|
|
24
24
|
"buffer": "^6.0.3"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|