@cetusprotocol/aggregator-sdk 0.2.0 → 0.2.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/dist/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +198 -171
- package/dist/index.mjs +197 -172
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/msafe.d.ts +2 -0
- package/package.json +1 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/msafe.ts +31 -0
package/package.json
CHANGED
package/src/utils/index.ts
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
import BN from 'bn.js'
|
|
3
|
+
import Decimal from "decimal.js"
|
|
4
|
+
|
|
5
|
+
export const dealWithFastRouterSwapParamsForMsafe = (data: any) => {
|
|
6
|
+
const result =data.map((route: any) => {
|
|
7
|
+
return {
|
|
8
|
+
...route,
|
|
9
|
+
amountIn: route.amountIn.toString(),
|
|
10
|
+
amountOut: route.amountOut.toString(),
|
|
11
|
+
initialPrice: route.initialPrice.toString(),
|
|
12
|
+
path: route.path
|
|
13
|
+
}
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
return result
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const restituteMsafeFastRouterSwapParams = (data: any) => {
|
|
20
|
+
const result =data.map((route: any) => {
|
|
21
|
+
return {
|
|
22
|
+
...route,
|
|
23
|
+
amountIn: new BN(route.amountIn),
|
|
24
|
+
amountOut: new BN(route.amountOut),
|
|
25
|
+
initialPrice: new Decimal(route.initialPrice.toString()),
|
|
26
|
+
path: route.path
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
return result
|
|
31
|
+
}
|