rainbow-swap-sdk 1.2.4 → 1.3.0

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.
Files changed (35) hide show
  1. package/dist/dexes/dedust/dex-pair.interface.d.ts +6 -0
  2. package/dist/dexes/dedust/dex-pair.interface.js +2 -0
  3. package/dist/dexes/dedust/transfer-params.utils.js +2 -2
  4. package/dist/dexes/dedust-stable/dex-pair.interface.d.ts +8 -0
  5. package/dist/dexes/dedust-stable/dex-pair.interface.js +2 -0
  6. package/dist/dexes/rainbow/transfer-params-pack.utils.js +1 -1
  7. package/dist/dexes/rainbow/transfer-params.utils.js +3 -3
  8. package/dist/dexes/shared/calculated-swap-route.utils.js +9 -7
  9. package/dist/dexes/shared/transfer-params.utils.js +4 -0
  10. package/dist/dexes/ston/dex-pair.interface.d.ts +4 -0
  11. package/dist/dexes/ston/dex-pair.interface.js +2 -0
  12. package/dist/dexes/ston-v2/calculated-swap-route.interface.d.ts +6 -0
  13. package/dist/dexes/ston-v2/calculated-swap-route.interface.js +2 -0
  14. package/dist/dexes/ston-v2/calculated-swap-route.utils.d.ts +2 -0
  15. package/dist/dexes/ston-v2/calculated-swap-route.utils.js +5 -0
  16. package/dist/dexes/ston-v2/dex-pair.interface.d.ts +5 -0
  17. package/dist/dexes/ston-v2/dex-pair.interface.js +2 -0
  18. package/dist/dexes/ston-v2/sdk.d.ts +10 -0
  19. package/dist/dexes/ston-v2/sdk.js +22 -0
  20. package/dist/dexes/ston-v2/transfer-params-pack.utils.d.ts +17 -0
  21. package/dist/dexes/ston-v2/transfer-params-pack.utils.js +33 -0
  22. package/dist/dexes/ston-v2/transfer-params.utils.d.ts +7 -0
  23. package/dist/dexes/ston-v2/transfer-params.utils.js +70 -0
  24. package/dist/enums/dex-type.enum.d.ts +2 -1
  25. package/dist/enums/dex-type.enum.js +2 -1
  26. package/dist/enums/swap-route-type.enum.d.ts +1 -0
  27. package/dist/enums/swap-route-type.enum.js +1 -0
  28. package/dist/globals.d.ts +1 -0
  29. package/dist/globals.js +2 -1
  30. package/dist/index.d.ts +1 -0
  31. package/dist/interfaces/route-step.interface.d.ts +2 -3
  32. package/dist/types/calculated-swap-route.type.d.ts +2 -1
  33. package/dist/types/dex-pair.type.d.ts +12 -0
  34. package/dist/types/dex-pair.type.js +2 -0
  35. package/package.json +3 -3
@@ -0,0 +1,6 @@
1
+ import { DexTypeEnum } from '../../enums/dex-type.enum';
2
+ import { SharedDexPair } from '../../types/dex-pair.type';
3
+ export interface dedust_DexPair extends SharedDexPair<DexTypeEnum.DeDust> {
4
+ feeNumerator: string;
5
+ feeDenominator: string;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -12,7 +12,7 @@ const createNextSwapStepPayload = (remainingRoute, slippageTolerance) => {
12
12
  return undefined;
13
13
  }
14
14
  const routeStep = remainingRoute[0];
15
- const poolAddress = core_1.Address.parse(routeStep.dexPairAddress);
15
+ const poolAddress = core_1.Address.parse(routeStep.dexPair.dexPairAddress);
16
16
  const limit = (0, slippage_tolerance_utils_1.applySlippageTolerance)(routeStep.outputAssetAmount, slippageTolerance);
17
17
  const next = createNextSwapStepPayload(remainingRoute.slice(1), slippageTolerance);
18
18
  return {
@@ -27,7 +27,7 @@ const dedust_getTransferParams = async (route, queryId, gasAmount, senderAddress
27
27
  }
28
28
  const firstRouteStep = route[0];
29
29
  const vaultAddress = await (0, vault_utils_1.dedust_getVaultAddress)(firstRouteStep.inputAssetAddress);
30
- const poolAddress = core_1.Address.parse(firstRouteStep.dexPairAddress);
30
+ const poolAddress = core_1.Address.parse(firstRouteStep.dexPair.dexPairAddress);
31
31
  const minOutputAmount = (0, slippage_tolerance_utils_1.applySlippageTolerance)(firstRouteStep.outputAssetAmount, slippageTolerance);
32
32
  const nextSwapStep = createNextSwapStepPayload(route.slice(1), slippageTolerance);
33
33
  const swapParams = {
@@ -0,0 +1,8 @@
1
+ import { DexTypeEnum } from '../../enums/dex-type.enum';
2
+ import { SharedDexPair } from '../../types/dex-pair.type';
3
+ export interface dedustStable_DexPair extends SharedDexPair<DexTypeEnum.DeDustStable> {
4
+ feeNumerator: string;
5
+ feeDenominator: string;
6
+ decimals0: string;
7
+ decimals1: string;
8
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -40,7 +40,7 @@ const packJettonReceiveEffect = (params) => {
40
40
  };
41
41
  exports.packJettonReceiveEffect = packJettonReceiveEffect;
42
42
  const getDexTransferParams = (route, queryId, gasAmount, senderAddress, receiverAddress, responseDestination, slippageTolerance) => {
43
- const dexType = route[0].dexType;
43
+ const dexType = route[0].dexPair.dexType;
44
44
  if (dexType === dex_type_enum_1.DexTypeEnum.DeDust) {
45
45
  return (0, transfer_params_utils_1.dedust_getTransferParams)(route, queryId, gasAmount, senderAddress, receiverAddress, responseDestination, slippageTolerance);
46
46
  }
@@ -15,10 +15,10 @@ const rainbow_getTransferParams = async (firstChunk, secondChunk, queryId, gasAm
15
15
  });
16
16
  const inputAssetAddress = firstChunk[0].inputAssetAddress;
17
17
  const secondChunk_transferParams = await (0, transfer_params_pack_utils_1.getDexTransferParams)(secondChunk, queryId, gasAmount, rainbowWallet.address, senderAddress, senderAddress, slippageTolerance);
18
- const jettonSenderAddressToListen = firstChunk[0].dexType === dex_type_enum_1.DexTypeEnum.Ston
18
+ const jettonSenderAddressToListen = firstChunk[0].dexPair.dexType === dex_type_enum_1.DexTypeEnum.Ston
19
19
  ? sdk_1.STON_ROUTER_ADDRESS
20
20
  : await (0, vault_utils_1.dedust_getVaultAddress)(firstChunk[firstChunk.length - 1].outputAssetAddress);
21
- const jettonReceiveEffectType = secondChunk[0].dexType === dex_type_enum_1.DexTypeEnum.DeDust &&
21
+ const jettonReceiveEffectType = secondChunk[0].dexPair.dexType === dex_type_enum_1.DexTypeEnum.DeDust &&
22
22
  secondChunk[0].inputAssetAddress === globals_1.TON
23
23
  ? transfer_params_pack_utils_1.EffectType.DedustTonSwap
24
24
  : transfer_params_pack_utils_1.EffectType.JettonTransfer;
@@ -30,7 +30,7 @@ const rainbow_getTransferParams = async (firstChunk, secondChunk, queryId, gasAm
30
30
  destination: secondChunk_transferParams.to,
31
31
  fullBody: secondChunk_transferParams.body
32
32
  });
33
- const tweakedSlippageTolerance = firstChunk[0].dexType === dex_type_enum_1.DexTypeEnum.Ston &&
33
+ const tweakedSlippageTolerance = firstChunk[0].dexPair.dexType === dex_type_enum_1.DexTypeEnum.Ston &&
34
34
  firstChunk[0].inputAssetAmount !== globals_1.TON
35
35
  ? 100 // We could not handle Ston.fi returned jettons
36
36
  : slippageTolerance;
@@ -5,13 +5,15 @@ const swap_route_type_enum_1 = require("../../enums/swap-route-type.enum");
5
5
  const calculated_swap_route_utils_1 = require("../dedust/calculated-swap-route.utils");
6
6
  const calculated_swap_route_utils_2 = require("../rainbow/calculated-swap-route.utils");
7
7
  const calculated_swap_route_utils_3 = require("../ston/calculated-swap-route.utils");
8
+ const calculated_swap_route_utils_4 = require("../ston-v2/calculated-swap-route.utils");
9
+ const FnRecord = {
10
+ [swap_route_type_enum_1.SwapRouteType.DeDust]: calculated_swap_route_utils_1.dedust_mapSwapRouteToRoute,
11
+ [swap_route_type_enum_1.SwapRouteType.Ston]: calculated_swap_route_utils_3.ston_mapSwapRouteToRoute,
12
+ [swap_route_type_enum_1.SwapRouteType.Ston_v2]: calculated_swap_route_utils_4.stonV2_mapSwapRouteToRoute,
13
+ [swap_route_type_enum_1.SwapRouteType.Rainbow]: calculated_swap_route_utils_2.rainbow_mapSwapRouteToRoute
14
+ };
8
15
  const mapSwapRouteToRoute = (swapRoute) => {
9
- if (swapRoute.type === swap_route_type_enum_1.SwapRouteType.DeDust) {
10
- return (0, calculated_swap_route_utils_1.dedust_mapSwapRouteToRoute)(swapRoute);
11
- }
12
- if (swapRoute.type === swap_route_type_enum_1.SwapRouteType.Ston) {
13
- return (0, calculated_swap_route_utils_3.ston_mapSwapRouteToRoute)(swapRoute);
14
- }
15
- return (0, calculated_swap_route_utils_2.rainbow_mapSwapRouteToRoute)(swapRoute);
16
+ const fn = FnRecord[swapRoute.type];
17
+ return fn(swapRoute);
16
18
  };
17
19
  exports.mapSwapRouteToRoute = mapSwapRouteToRoute;
@@ -9,6 +9,7 @@ const transfer_params_utils_2 = require("../dedust/transfer-params.utils");
9
9
  const rainbow_wallet_contract_1 = require("../rainbow/rainbow-wallet.contract");
10
10
  const transfer_params_utils_3 = require("../rainbow/transfer-params.utils");
11
11
  const transfer_params_utils_4 = require("../ston/transfer-params.utils");
12
+ const transfer_params_utils_5 = require("../ston-v2/transfer-params.utils");
12
13
  const getSwapRouteTransferParams = (swapRoute, senderAddress, slippageTolerance) => {
13
14
  const queryId = (0, transfer_params_utils_1.getQueryId)();
14
15
  if (swapRoute.type === swap_route_type_enum_1.SwapRouteType.DeDust) {
@@ -17,6 +18,9 @@ const getSwapRouteTransferParams = (swapRoute, senderAddress, slippageTolerance)
17
18
  if (swapRoute.type === swap_route_type_enum_1.SwapRouteType.Ston) {
18
19
  return (0, transfer_params_utils_4.ston_getTransferParams)(swapRoute.routeStep, queryId, globals_1.GAS_AMOUNT, senderAddress, senderAddress, senderAddress, slippageTolerance);
19
20
  }
21
+ if (swapRoute.type === swap_route_type_enum_1.SwapRouteType.Ston_v2) {
22
+ return (0, transfer_params_utils_5.stonV2_getTransferParams)(swapRoute.route, queryId, globals_1.GAS_AMOUNT, senderAddress, senderAddress, senderAddress, slippageTolerance);
23
+ }
20
24
  return (0, transfer_params_utils_3.rainbow_getTransferParams)(swapRoute.firstChunk, swapRoute.secondChunk, queryId, globals_1.GAS_AMOUNT, senderAddress, slippageTolerance);
21
25
  };
22
26
  exports.getSwapRouteTransferParams = getSwapRouteTransferParams;
@@ -0,0 +1,4 @@
1
+ import { DexTypeEnum } from '../../enums/dex-type.enum';
2
+ import { SharedDexPair } from '../../types/dex-pair.type';
3
+ export interface ston_DexPair extends SharedDexPair<DexTypeEnum.Ston> {
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ import { SwapRouteType } from '../../enums/swap-route-type.enum';
2
+ import { RouteStepWithCalculation } from '../../interfaces/route-step-with-calculation.interface';
3
+ import { AbstractCalculatedSwapRoute } from '../abstract/calculated-swap-route.interface';
4
+ export interface StonV2CalculatedSwapRoute extends AbstractCalculatedSwapRoute<SwapRouteType.Ston_v2> {
5
+ route: RouteStepWithCalculation[];
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ import { StonV2CalculatedSwapRoute } from './calculated-swap-route.interface';
2
+ export declare const stonV2_mapSwapRouteToRoute: (swapRoute: StonV2CalculatedSwapRoute) => import("../..").RouteStepWithCalculation[];
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stonV2_mapSwapRouteToRoute = void 0;
4
+ const stonV2_mapSwapRouteToRoute = (swapRoute) => swapRoute.route;
5
+ exports.stonV2_mapSwapRouteToRoute = stonV2_mapSwapRouteToRoute;
@@ -0,0 +1,5 @@
1
+ import { DexTypeEnum } from '../../enums/dex-type.enum';
2
+ import { SharedDexPair } from '../../types/dex-pair.type';
3
+ export interface stonV2_DexPair extends SharedDexPair<DexTypeEnum.Ston_v2> {
4
+ routerAddress: string;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ import { Address, Cell } from '@ton/core';
2
+ export declare const PROXY_TON_V2_MASTER_ADDRESS = "EQBnGWMCf3-FZZq1W4IWcWiGAc3PHuZ0_H-7sad2oY00o83S";
3
+ interface pTonV2_TonTransferParams {
4
+ queryId?: number;
5
+ amount: bigint;
6
+ refundAddress: Address;
7
+ forwardPayload?: Cell;
8
+ }
9
+ export declare const pTonV2_createTonTransferBody: (params: pTonV2_TonTransferParams) => Cell;
10
+ export {};
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.pTonV2_createTonTransferBody = exports.PROXY_TON_V2_MASTER_ADDRESS = void 0;
4
+ const core_1 = require("@ton/core");
5
+ exports.PROXY_TON_V2_MASTER_ADDRESS = 'EQBnGWMCf3-FZZq1W4IWcWiGAc3PHuZ0_H-7sad2oY00o83S';
6
+ var Operation;
7
+ (function (Operation) {
8
+ Operation[Operation["TON_TRANSFER"] = 32736093] = "TON_TRANSFER";
9
+ })(Operation || (Operation = {}));
10
+ const pTonV2_createTonTransferBody = (params) => {
11
+ const builder = (0, core_1.beginCell)();
12
+ builder.storeUint(Operation.TON_TRANSFER, 32);
13
+ builder.storeUint(params.queryId ?? 0, 64);
14
+ builder.storeCoins(params.amount);
15
+ builder.storeAddress(params.refundAddress);
16
+ if (params.forwardPayload) {
17
+ builder.storeBit(true);
18
+ builder.storeRef(params.forwardPayload);
19
+ }
20
+ return builder.endCell();
21
+ };
22
+ exports.pTonV2_createTonTransferBody = pTonV2_createTonTransferBody;
@@ -0,0 +1,17 @@
1
+ import { Address, Cell } from '@ton/core';
2
+ interface SwapParams {
3
+ outputJettonWalletAddress: Address;
4
+ receiverAddress: Address;
5
+ minOutputAmount: bigint;
6
+ refundAddress: Address;
7
+ excessesAddress?: Address;
8
+ dexCustomPayload?: Cell;
9
+ dexCustomPayloadForwardGasAmount?: bigint;
10
+ refundPayload?: Cell;
11
+ refundForwardGasAmount?: bigint;
12
+ referralAddress: Address | null;
13
+ referralValue: bigint;
14
+ deadline?: number;
15
+ }
16
+ export declare const packSwapParams: (params: SwapParams) => Cell;
17
+ export {};
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.packSwapParams = void 0;
4
+ const core_1 = require("@ton/core");
5
+ const TX_DEADLINE = 15 * 60; // 15 minutes
6
+ const getDefaultDeadline = () => Math.floor(Date.now() / 1000) + TX_DEADLINE;
7
+ var Operation;
8
+ (function (Operation) {
9
+ Operation[Operation["SWAP"] = 1717886506] = "SWAP";
10
+ })(Operation || (Operation = {}));
11
+ const packSwapParams = (params) => {
12
+ if (params.referralValue < 0 || params.referralValue > 100) {
13
+ throw Error(`'referralValue' should be in range [0, 100] BPS`);
14
+ }
15
+ return (0, core_1.beginCell)()
16
+ .storeUint(Operation.SWAP, 32)
17
+ .storeAddress(params.outputJettonWalletAddress)
18
+ .storeAddress(params.refundAddress)
19
+ .storeAddress(params.excessesAddress ?? params.refundAddress)
20
+ .storeUint(params.deadline ?? getDefaultDeadline(), 64)
21
+ .storeRef((0, core_1.beginCell)()
22
+ .storeCoins(params.minOutputAmount)
23
+ .storeAddress(params.receiverAddress)
24
+ .storeCoins(params.dexCustomPayloadForwardGasAmount ?? 0)
25
+ .storeMaybeRef(params.dexCustomPayload)
26
+ .storeCoins(params.refundForwardGasAmount ?? 0)
27
+ .storeMaybeRef(params.refundPayload)
28
+ .storeUint(params.referralValue, 16)
29
+ .storeAddress(params.referralAddress)
30
+ .endCell())
31
+ .endCell();
32
+ };
33
+ exports.packSwapParams = packSwapParams;
@@ -0,0 +1,7 @@
1
+ import { Address } from '@ton/core';
2
+ import { RouteStepWithCalculation } from '../../interfaces/route-step-with-calculation.interface';
3
+ export declare const stonV2_getTransferParams: (route: RouteStepWithCalculation[], queryId: number, gasAmount: bigint, senderAddress: Address, receiverAddress: Address, responseDestination: Address, slippageTolerance: number) => Promise<{
4
+ to: Address;
5
+ value: bigint;
6
+ body: import("@ton/core").Cell;
7
+ }>;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stonV2_getTransferParams = void 0;
4
+ const core_1 = require("@ton/core");
5
+ const sdk_1 = require("./sdk");
6
+ const transfer_params_pack_utils_1 = require("./transfer-params-pack.utils");
7
+ const dex_type_enum_1 = require("../../enums/dex-type.enum");
8
+ const globals_1 = require("../../globals");
9
+ const jetton_utils_1 = require("../../utils/jetton.utils");
10
+ const slippage_tolerance_utils_1 = require("../shared/slippage-tolerance.utils");
11
+ const stonV2_getTransferParams = async (route, queryId, gasAmount, senderAddress, receiverAddress, responseDestination, slippageTolerance) => {
12
+ if (route.length !== 1) {
13
+ throw new Error('Only 1 step route is supported rn');
14
+ }
15
+ const routeStep = route[0];
16
+ if (routeStep.dexPair.dexType !== dex_type_enum_1.DexTypeEnum.Ston_v2) {
17
+ throw new Error(`Unsupported dexType ${routeStep.dexPair.dexType}, ${dex_type_enum_1.DexTypeEnum.Ston_v2} expected`);
18
+ }
19
+ const routerAddress = core_1.Address.parse(routeStep.dexPair.routerAddress);
20
+ const minOutputAmount = (0, slippage_tolerance_utils_1.applySlippageTolerance)(routeStep.outputAssetAmount, slippageTolerance);
21
+ if (routeStep.inputAssetAddress === globals_1.TON) {
22
+ const stonRouterProxyTonWalletAddress = await (0, jetton_utils_1.getJettonWalletAddress)(sdk_1.PROXY_TON_V2_MASTER_ADDRESS, routerAddress);
23
+ const stonRouterOutputJettonWalletAddress = await (0, jetton_utils_1.getJettonWalletAddress)(routeStep.outputAssetAddress, routerAddress);
24
+ const tonSwapPayload = (0, transfer_params_pack_utils_1.packSwapParams)({
25
+ outputJettonWalletAddress: stonRouterOutputJettonWalletAddress,
26
+ receiverAddress,
27
+ minOutputAmount,
28
+ refundAddress: responseDestination,
29
+ referralAddress: globals_1.REFERRAL_ADDRESS,
30
+ referralValue: globals_1.REFERRAL_VALUE
31
+ });
32
+ return {
33
+ to: stonRouterProxyTonWalletAddress,
34
+ value: gasAmount + BigInt(routeStep.inputAssetAmount),
35
+ body: (0, sdk_1.pTonV2_createTonTransferBody)({
36
+ queryId,
37
+ amount: BigInt(routeStep.inputAssetAmount),
38
+ refundAddress: responseDestination,
39
+ forwardPayload: tonSwapPayload
40
+ })
41
+ };
42
+ }
43
+ else {
44
+ const inputJettonWalletAddress = await (0, jetton_utils_1.getJettonWalletAddress)(routeStep.inputAssetAddress, senderAddress);
45
+ const outputJettonWalletAddress = await (0, jetton_utils_1.getJettonWalletAddress)(routeStep.outputAssetAddress === globals_1.TON
46
+ ? sdk_1.PROXY_TON_V2_MASTER_ADDRESS
47
+ : routeStep.outputAssetAddress, routerAddress);
48
+ const jettonSwapPayload = (0, transfer_params_pack_utils_1.packSwapParams)({
49
+ outputJettonWalletAddress,
50
+ receiverAddress,
51
+ minOutputAmount,
52
+ refundAddress: responseDestination,
53
+ referralAddress: globals_1.REFERRAL_ADDRESS,
54
+ referralValue: globals_1.REFERRAL_VALUE
55
+ });
56
+ return {
57
+ to: inputJettonWalletAddress,
58
+ value: gasAmount + globals_1.JETTON_TRANSFER_GAS_AMOUNT,
59
+ body: (0, jetton_utils_1.getJettonTransferBody)({
60
+ queryId,
61
+ amount: BigInt(routeStep.inputAssetAmount),
62
+ destination: routerAddress,
63
+ responseDestination: responseDestination,
64
+ forwardTonAmount: gasAmount,
65
+ forwardPayload: jettonSwapPayload
66
+ })
67
+ };
68
+ }
69
+ };
70
+ exports.stonV2_getTransferParams = stonV2_getTransferParams;
@@ -1,5 +1,6 @@
1
1
  export declare enum DexTypeEnum {
2
2
  DeDust = "DeDust",
3
+ DeDustStable = "DeDustStable",
3
4
  Ston = "Ston",
4
- DeDustStable = "DeDustStable"
5
+ Ston_v2 = "Ston_v2"
5
6
  }
@@ -4,6 +4,7 @@ exports.DexTypeEnum = void 0;
4
4
  var DexTypeEnum;
5
5
  (function (DexTypeEnum) {
6
6
  DexTypeEnum["DeDust"] = "DeDust";
7
- DexTypeEnum["Ston"] = "Ston";
8
7
  DexTypeEnum["DeDustStable"] = "DeDustStable";
8
+ DexTypeEnum["Ston"] = "Ston";
9
+ DexTypeEnum["Ston_v2"] = "Ston_v2";
9
10
  })(DexTypeEnum || (exports.DexTypeEnum = DexTypeEnum = {}));
@@ -1,5 +1,6 @@
1
1
  export declare enum SwapRouteType {
2
2
  DeDust = "DeDust",
3
3
  Ston = "Ston",
4
+ Ston_v2 = "Ston_v2",
4
5
  Rainbow = "Rainbow"
5
6
  }
@@ -5,5 +5,6 @@ var SwapRouteType;
5
5
  (function (SwapRouteType) {
6
6
  SwapRouteType["DeDust"] = "DeDust";
7
7
  SwapRouteType["Ston"] = "Ston";
8
+ SwapRouteType["Ston_v2"] = "Ston_v2";
8
9
  SwapRouteType["Rainbow"] = "Rainbow";
9
10
  })(SwapRouteType || (exports.SwapRouteType = SwapRouteType = {}));
package/dist/globals.d.ts CHANGED
@@ -7,3 +7,4 @@ export declare const TON_CLIENT: TonClient;
7
7
  export declare const GAS_AMOUNT: bigint;
8
8
  export declare const JETTON_TRANSFER_GAS_AMOUNT: bigint;
9
9
  export declare const REFERRAL_ADDRESS: Address;
10
+ export declare const REFERRAL_VALUE = 0n;
package/dist/globals.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.REFERRAL_ADDRESS = exports.JETTON_TRANSFER_GAS_AMOUNT = exports.GAS_AMOUNT = exports.TON_CLIENT = exports.API = exports.WORKCHAIN = exports.TON = void 0;
6
+ exports.REFERRAL_VALUE = exports.REFERRAL_ADDRESS = exports.JETTON_TRANSFER_GAS_AMOUNT = exports.GAS_AMOUNT = exports.TON_CLIENT = exports.API = exports.WORKCHAIN = exports.TON = void 0;
7
7
  const core_1 = require("@ton/core");
8
8
  const ton_1 = require("@ton/ton");
9
9
  const axios_1 = __importDefault(require("axios"));
@@ -18,3 +18,4 @@ exports.TON_CLIENT = new ton_1.TonClient({
18
18
  exports.GAS_AMOUNT = (0, core_1.toNano)('0.255');
19
19
  exports.JETTON_TRANSFER_GAS_AMOUNT = (0, core_1.toNano)('0.065');
20
20
  exports.REFERRAL_ADDRESS = core_1.Address.parse('UQBBPVrn4Y6F0Fci4j0mXuSAXmRDeE-nZCRIInQsNC9__8vG');
21
+ exports.REFERRAL_VALUE = 0n;
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export { mapSwapRouteToRoute } from './dexes/shared/calculated-swap-route.utils'
2
2
  export { DexTypeEnum } from './enums/dex-type.enum';
3
3
  export { RouteDirectionEnum } from './enums/route-direction.enum';
4
4
  export { SwapRouteType } from './enums/swap-route-type.enum';
5
+ export type { Message } from './interfaces/message.interface';
5
6
  export type { RouteStep } from './interfaces/route-step.interface';
6
7
  export type { RouteStepWithCalculation } from './interfaces/route-step-with-calculation.interface';
7
8
  export type { AppStatus } from './types/app-status.type';
@@ -1,8 +1,7 @@
1
- import { DexTypeEnum } from '../enums/dex-type.enum';
2
1
  import { RouteDirectionEnum } from '../enums/route-direction.enum';
2
+ import { DexPair } from '../types/dex-pair.type';
3
3
  export interface RouteStep {
4
- dexType: DexTypeEnum;
5
- dexPairAddress: string;
4
+ dexPair: DexPair;
6
5
  inputAssetAddress: string;
7
6
  outputAssetAddress: string;
8
7
  routeDirection: RouteDirectionEnum;
@@ -1,4 +1,5 @@
1
1
  import { DeDustCalculatedSwapRoute } from '../dexes/dedust/calculated-swap-route.interface';
2
2
  import { RainbowCalculatedSwapRoute } from '../dexes/rainbow/calculated-swap-route.interface';
3
3
  import { StonCalculatedSwapRoute } from '../dexes/ston/calculated-swap-route.interface';
4
- export type CalculatedSwapRoute = DeDustCalculatedSwapRoute | StonCalculatedSwapRoute | RainbowCalculatedSwapRoute;
4
+ import { StonV2CalculatedSwapRoute } from '../dexes/ston-v2/calculated-swap-route.interface';
5
+ export type CalculatedSwapRoute = DeDustCalculatedSwapRoute | StonCalculatedSwapRoute | StonV2CalculatedSwapRoute | RainbowCalculatedSwapRoute;
@@ -0,0 +1,12 @@
1
+ import { dedust_DexPair } from '../dexes/dedust/dex-pair.interface';
2
+ import { dedustStable_DexPair } from '../dexes/dedust-stable/dex-pair.interface';
3
+ import { ston_DexPair } from '../dexes/ston/dex-pair.interface';
4
+ import { stonV2_DexPair } from '../dexes/ston-v2/dex-pair.interface';
5
+ import { DexTypeEnum } from '../enums/dex-type.enum';
6
+ export interface SharedDexPair<T extends DexTypeEnum> {
7
+ dexType: T;
8
+ dexPairAddress: string;
9
+ aAssetAddress: string;
10
+ bAssetAddress: string;
11
+ }
12
+ export type DexPair = dedust_DexPair | dedustStable_DexPair | ston_DexPair | stonV2_DexPair;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rainbow-swap-sdk",
3
- "version": "1.2.4",
3
+ "version": "1.3.0",
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",
@@ -17,10 +17,10 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "@rnw-community/shared": "^0.74.0",
20
- "@ton/core": "^0.57.0",
20
+ "@ton/core": "^0.58.1",
21
21
  "@ton/crypto": "^3.3.0",
22
22
  "@ton/ton": "^15.0.0",
23
- "axios": "^1.7.3",
23
+ "axios": "^1.7.7",
24
24
  "buffer": "^6.0.3"
25
25
  },
26
26
  "devDependencies": {