@cetusprotocol/aggregator-sdk 0.0.0-experimental-20250115173818 → 0.0.0-experimental-20250118224413
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/dist/index.js +24 -14
- package/dist/index.mjs +24 -14
- package/package.json +1 -1
- package/src/utils/msafe.ts +27 -18
package/dist/index.js
CHANGED
|
@@ -6786,24 +6786,34 @@ function getAggregatorV2ExtendPublishedAt(aggregatorV2ExtendPublishedAt, package
|
|
|
6786
6786
|
// src/utils/msafe.ts
|
|
6787
6787
|
var import_bn6 = __toESM(require_bn());
|
|
6788
6788
|
var dealWithFastRouterSwapParamsForMsafe = (data) => {
|
|
6789
|
-
|
|
6790
|
-
|
|
6791
|
-
|
|
6792
|
-
|
|
6793
|
-
|
|
6794
|
-
|
|
6795
|
-
|
|
6789
|
+
var _a, _b, _c;
|
|
6790
|
+
const result = __spreadProps(__spreadValues({}, data), {
|
|
6791
|
+
amountIn: (_a = data == null ? void 0 : data.amountIn) == null ? void 0 : _a.toString(),
|
|
6792
|
+
amountOut: (_b = data == null ? void 0 : data.amountIn) == null ? void 0 : _b.toString(),
|
|
6793
|
+
routes: (_c = data == null ? void 0 : data.routes) == null ? void 0 : _c.map((item) => {
|
|
6794
|
+
var _a2, _b2, _c2;
|
|
6795
|
+
return __spreadProps(__spreadValues({}, item), {
|
|
6796
|
+
amountIn: (_a2 = item == null ? void 0 : item.amountIn) == null ? void 0 : _a2.toString(),
|
|
6797
|
+
amountOut: (_b2 = item == null ? void 0 : item.amountOut) == null ? void 0 : _b2.toString(),
|
|
6798
|
+
initialPrice: (_c2 = item == null ? void 0 : item.initialPrice) == null ? void 0 : _c2.toString()
|
|
6799
|
+
});
|
|
6800
|
+
})
|
|
6796
6801
|
});
|
|
6797
6802
|
return result;
|
|
6798
6803
|
};
|
|
6799
6804
|
var restituteMsafeFastRouterSwapParams = (data) => {
|
|
6800
|
-
|
|
6801
|
-
|
|
6802
|
-
|
|
6803
|
-
|
|
6804
|
-
|
|
6805
|
-
|
|
6806
|
-
|
|
6805
|
+
var _a;
|
|
6806
|
+
const result = __spreadProps(__spreadValues({}, data), {
|
|
6807
|
+
amountIn: new import_bn6.default(data == null ? void 0 : data.amountIn),
|
|
6808
|
+
amountOut: new import_bn6.default(data == null ? void 0 : data.amountIn),
|
|
6809
|
+
routes: (_a = data == null ? void 0 : data.routes) == null ? void 0 : _a.map((item) => {
|
|
6810
|
+
var _a2;
|
|
6811
|
+
return __spreadProps(__spreadValues({}, item), {
|
|
6812
|
+
amountIn: new import_bn6.default(item == null ? void 0 : item.amountIn),
|
|
6813
|
+
amountOut: new import_bn6.default(item == null ? void 0 : item.amountOut),
|
|
6814
|
+
initialPrice: new decimal_default((_a2 = item == null ? void 0 : item.initialPrice) == null ? void 0 : _a2.toString())
|
|
6815
|
+
});
|
|
6816
|
+
})
|
|
6807
6817
|
});
|
|
6808
6818
|
return result;
|
|
6809
6819
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -6784,24 +6784,34 @@ function getAggregatorV2ExtendPublishedAt(aggregatorV2ExtendPublishedAt, package
|
|
|
6784
6784
|
// src/utils/msafe.ts
|
|
6785
6785
|
var import_bn6 = __toESM(require_bn());
|
|
6786
6786
|
var dealWithFastRouterSwapParamsForMsafe = (data) => {
|
|
6787
|
-
|
|
6788
|
-
|
|
6789
|
-
|
|
6790
|
-
|
|
6791
|
-
|
|
6792
|
-
|
|
6793
|
-
|
|
6787
|
+
var _a, _b, _c;
|
|
6788
|
+
const result = __spreadProps(__spreadValues({}, data), {
|
|
6789
|
+
amountIn: (_a = data == null ? void 0 : data.amountIn) == null ? void 0 : _a.toString(),
|
|
6790
|
+
amountOut: (_b = data == null ? void 0 : data.amountIn) == null ? void 0 : _b.toString(),
|
|
6791
|
+
routes: (_c = data == null ? void 0 : data.routes) == null ? void 0 : _c.map((item) => {
|
|
6792
|
+
var _a2, _b2, _c2;
|
|
6793
|
+
return __spreadProps(__spreadValues({}, item), {
|
|
6794
|
+
amountIn: (_a2 = item == null ? void 0 : item.amountIn) == null ? void 0 : _a2.toString(),
|
|
6795
|
+
amountOut: (_b2 = item == null ? void 0 : item.amountOut) == null ? void 0 : _b2.toString(),
|
|
6796
|
+
initialPrice: (_c2 = item == null ? void 0 : item.initialPrice) == null ? void 0 : _c2.toString()
|
|
6797
|
+
});
|
|
6798
|
+
})
|
|
6794
6799
|
});
|
|
6795
6800
|
return result;
|
|
6796
6801
|
};
|
|
6797
6802
|
var restituteMsafeFastRouterSwapParams = (data) => {
|
|
6798
|
-
|
|
6799
|
-
|
|
6800
|
-
|
|
6801
|
-
|
|
6802
|
-
|
|
6803
|
-
|
|
6804
|
-
|
|
6803
|
+
var _a;
|
|
6804
|
+
const result = __spreadProps(__spreadValues({}, data), {
|
|
6805
|
+
amountIn: new import_bn6.default(data == null ? void 0 : data.amountIn),
|
|
6806
|
+
amountOut: new import_bn6.default(data == null ? void 0 : data.amountIn),
|
|
6807
|
+
routes: (_a = data == null ? void 0 : data.routes) == null ? void 0 : _a.map((item) => {
|
|
6808
|
+
var _a2;
|
|
6809
|
+
return __spreadProps(__spreadValues({}, item), {
|
|
6810
|
+
amountIn: new import_bn6.default(item == null ? void 0 : item.amountIn),
|
|
6811
|
+
amountOut: new import_bn6.default(item == null ? void 0 : item.amountOut),
|
|
6812
|
+
initialPrice: new decimal_default((_a2 = item == null ? void 0 : item.initialPrice) == null ? void 0 : _a2.toString())
|
|
6813
|
+
});
|
|
6814
|
+
})
|
|
6805
6815
|
});
|
|
6806
6816
|
return result;
|
|
6807
6817
|
};
|
package/package.json
CHANGED
package/src/utils/msafe.ts
CHANGED
|
@@ -3,29 +3,38 @@ import BN from 'bn.js'
|
|
|
3
3
|
import Decimal from "decimal.js"
|
|
4
4
|
|
|
5
5
|
export const dealWithFastRouterSwapParamsForMsafe = (data: any) => {
|
|
6
|
-
|
|
6
|
+
const result = {
|
|
7
|
+
...data,
|
|
8
|
+
amountIn: data?.amountIn?.toString(),
|
|
9
|
+
amountOut: data?.amountIn?.toString(),
|
|
10
|
+
routes: data?.routes?.map((item:any) => {
|
|
7
11
|
return {
|
|
8
|
-
...
|
|
9
|
-
amountIn:
|
|
10
|
-
amountOut:
|
|
11
|
-
initialPrice:
|
|
12
|
-
path: route.path
|
|
12
|
+
...item,
|
|
13
|
+
amountIn: item?.amountIn?.toString(),
|
|
14
|
+
amountOut: item?.amountOut?.toString(),
|
|
15
|
+
initialPrice: item?.initialPrice?.toString()
|
|
13
16
|
}
|
|
14
17
|
})
|
|
15
|
-
|
|
16
|
-
return result
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
return result
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
export const restituteMsafeFastRouterSwapParams = (data: any) => {
|
|
25
|
+
const result = {
|
|
26
|
+
...data,
|
|
27
|
+
amountIn: new BN(data?.amountIn),
|
|
28
|
+
amountOut: new BN(data?.amountIn),
|
|
29
|
+
routes: data?.routes?.map((item:any) => {
|
|
21
30
|
return {
|
|
22
|
-
...
|
|
23
|
-
amountIn: new BN(
|
|
24
|
-
amountOut: new BN(
|
|
25
|
-
initialPrice: new Decimal(
|
|
26
|
-
path: route.path
|
|
31
|
+
...item,
|
|
32
|
+
amountIn: new BN(item?.amountIn),
|
|
33
|
+
amountOut: new BN(item?.amountOut),
|
|
34
|
+
initialPrice: new Decimal(item?.initialPrice?.toString())
|
|
27
35
|
}
|
|
28
36
|
})
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return result
|
|
40
|
+
}
|