@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.
@@ -1 +1,2 @@
1
1
  export * from './contracts';
2
+ export * from './msafe';
@@ -0,0 +1,2 @@
1
+ export declare const dealWithFastRouterSwapParamsForMsafe: (data: any) => any;
2
+ export declare const restituteMsafeFastRouterSwapParams: (data: any) => any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cetusprotocol/aggregator-sdk",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "sideEffects": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1 +1,2 @@
1
1
  export * from './contracts'
2
+ export * from './msafe'
@@ -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
+ }