rainbow-swap-sdk 1.4.9 → 1.4.10

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.
@@ -1,11 +1,14 @@
1
- import { GenericAbortSignal } from 'axios';
2
1
  import { AppStatus } from '../types/app-status.type';
3
2
  import { Asset } from '../types/asset.type';
4
3
  import { AssetsListParams } from '../types/assets-list-patams.type';
5
4
  import { AssetsRecord } from '../types/assets-record.type';
6
5
  import { BestRouteParams } from '../types/best-route-params.type';
7
6
  import { BestRouteResponse } from '../types/best-route-response.type';
7
+ export declare const getAppStatus: () => Promise<AppStatus>;
8
+ /**
9
+ * @deprecated This method is deprecated and will be removed in the next major release.
10
+ * Please use `getAssetsList` instead for improved performance and features.
11
+ */
8
12
  export declare const getAssetsRecord: () => Promise<AssetsRecord>;
9
13
  export declare const getAssetsList: (params: AssetsListParams) => Promise<Asset[]>;
10
- export declare const getBestRoute: (params: BestRouteParams, signal?: GenericAbortSignal) => Promise<BestRouteResponse>;
11
- export declare const getAppStatus: () => Promise<AppStatus>;
14
+ export declare const getBestRoute: (params: BestRouteParams) => Promise<BestRouteResponse>;
@@ -1,12 +1,38 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAppStatus = exports.getBestRoute = exports.getAssetsList = exports.getAssetsRecord = void 0;
3
+ exports.getBestRoute = exports.getAssetsList = exports.getAssetsRecord = exports.getAppStatus = void 0;
4
4
  const globals_1 = require("../globals");
5
+ const getAppStatus = () => globals_1.API.get('/app-status').then(response => response.data);
6
+ exports.getAppStatus = getAppStatus;
7
+ /**
8
+ * @deprecated This method is deprecated and will be removed in the next major release.
9
+ * Please use `getAssetsList` instead for improved performance and features.
10
+ */
5
11
  const getAssetsRecord = () => globals_1.API.get('/assets-record').then(response => response.data);
6
12
  exports.getAssetsRecord = getAssetsRecord;
7
- const getAssetsList = (params) => globals_1.API.post('/assets-list', params).then(response => response.data);
13
+ // Used to cancel the previous request if it exists
14
+ const abortControllers = {
15
+ assetsList: null,
16
+ bestRoute: null
17
+ };
18
+ const getAssetsList = (params) => {
19
+ if (abortControllers.assetsList) {
20
+ abortControllers.assetsList.abort();
21
+ }
22
+ abortControllers.assetsList = new AbortController();
23
+ return globals_1.API.post('/assets-list', params, {
24
+ signal: abortControllers.assetsList.signal
25
+ }).then(response => response.data);
26
+ };
8
27
  exports.getAssetsList = getAssetsList;
9
- const getBestRoute = (params, signal) => globals_1.API.get('/best-route', { params, signal }).then(response => response.data);
28
+ const getBestRoute = (params) => {
29
+ if (abortControllers.bestRoute) {
30
+ abortControllers.bestRoute.abort();
31
+ }
32
+ abortControllers.bestRoute = new AbortController();
33
+ return globals_1.API.get('/best-route', {
34
+ params,
35
+ signal: abortControllers.bestRoute.signal
36
+ }).then(response => response.data);
37
+ };
10
38
  exports.getBestRoute = getBestRoute;
11
- const getAppStatus = () => globals_1.API.get('/app-status').then(response => response.data);
12
- exports.getAppStatus = getAppStatus;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rainbow-swap-sdk",
3
- "version": "1.4.9",
3
+ "version": "1.4.10",
4
4
  "description": "SDK for building applications on top of Rainbow.ag - Swap Aggregator on TON 💎.",
5
5
  "repository": "https://github.com/0xblackbot/rainbow-swap-sdk.git",
6
6
  "license": "Apache-2.0",