@cetusprotocol/aggregator-sdk 0.13.0 → 0.13.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.js +16 -3
- package/dist/index.mjs +12 -3
- package/package.json +4 -2
package/dist/index.js
CHANGED
|
@@ -4,6 +4,11 @@ var client = require('@mysten/sui/client');
|
|
|
4
4
|
var utils = require('@mysten/sui/utils');
|
|
5
5
|
var transactions = require('@mysten/sui/transactions');
|
|
6
6
|
var pythSuiJs = require('@pythnetwork/pyth-sui-js');
|
|
7
|
+
var JSONbig = require('json-bigint');
|
|
8
|
+
|
|
9
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
|
|
11
|
+
var JSONbig__default = /*#__PURE__*/_interopDefault(JSONbig);
|
|
7
12
|
|
|
8
13
|
var __create = Object.create;
|
|
9
14
|
var __defProp = Object.defineProperty;
|
|
@@ -7069,10 +7074,18 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7069
7074
|
);
|
|
7070
7075
|
for (let i = 0; i < routers.length; i++) {
|
|
7071
7076
|
const router = routers[i];
|
|
7072
|
-
let amount_arg = txb.pure.u64(
|
|
7077
|
+
let amount_arg = txb.pure.u64(
|
|
7078
|
+
router.amountOut.toString()
|
|
7079
|
+
);
|
|
7073
7080
|
for (let j = router.path.length - 1; j >= 0; j--) {
|
|
7074
7081
|
const path = router.path[j];
|
|
7075
|
-
const flashSwapResult = dex.flash_swap(
|
|
7082
|
+
const flashSwapResult = dex.flash_swap(
|
|
7083
|
+
this,
|
|
7084
|
+
txb,
|
|
7085
|
+
path,
|
|
7086
|
+
amount_arg,
|
|
7087
|
+
false
|
|
7088
|
+
);
|
|
7076
7089
|
amount_arg = flashSwapResult.payAmount;
|
|
7077
7090
|
returnCoins.unshift(flashSwapResult.targetCoin);
|
|
7078
7091
|
receipts.unshift(flashSwapResult.flashReceipt);
|
|
@@ -7824,7 +7837,7 @@ function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceive
|
|
|
7824
7837
|
}
|
|
7825
7838
|
};
|
|
7826
7839
|
}
|
|
7827
|
-
const data = yield response.
|
|
7840
|
+
const data = JSONbig__default.default.parse(yield response.text());
|
|
7828
7841
|
const insufficientLiquidity = data.msg === "liquidity is not enough";
|
|
7829
7842
|
if (data.msg && data.msg.indexOf("HoneyPot scam") > -1) {
|
|
7830
7843
|
return {
|
package/dist/index.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import { SuiClient, getFullnodeUrl } from '@mysten/sui/client';
|
|
|
2
2
|
import { normalizeSuiObjectId, SUI_CLOCK_OBJECT_ID, SUI_FRAMEWORK_ADDRESS } from '@mysten/sui/utils';
|
|
3
3
|
import { Transaction } from '@mysten/sui/transactions';
|
|
4
4
|
import { SuiPythClient, SuiPriceServiceConnection } from '@pythnetwork/pyth-sui-js';
|
|
5
|
+
import JSONbig from 'json-bigint';
|
|
5
6
|
|
|
6
7
|
var __create = Object.create;
|
|
7
8
|
var __defProp = Object.defineProperty;
|
|
@@ -7067,10 +7068,18 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
7067
7068
|
);
|
|
7068
7069
|
for (let i = 0; i < routers.length; i++) {
|
|
7069
7070
|
const router = routers[i];
|
|
7070
|
-
let amount_arg = txb.pure.u64(
|
|
7071
|
+
let amount_arg = txb.pure.u64(
|
|
7072
|
+
router.amountOut.toString()
|
|
7073
|
+
);
|
|
7071
7074
|
for (let j = router.path.length - 1; j >= 0; j--) {
|
|
7072
7075
|
const path = router.path[j];
|
|
7073
|
-
const flashSwapResult = dex.flash_swap(
|
|
7076
|
+
const flashSwapResult = dex.flash_swap(
|
|
7077
|
+
this,
|
|
7078
|
+
txb,
|
|
7079
|
+
path,
|
|
7080
|
+
amount_arg,
|
|
7081
|
+
false
|
|
7082
|
+
);
|
|
7074
7083
|
amount_arg = flashSwapResult.payAmount;
|
|
7075
7084
|
returnCoins.unshift(flashSwapResult.targetCoin);
|
|
7076
7085
|
receipts.unshift(flashSwapResult.flashReceipt);
|
|
@@ -7822,7 +7831,7 @@ function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceive
|
|
|
7822
7831
|
}
|
|
7823
7832
|
};
|
|
7824
7833
|
}
|
|
7825
|
-
const data = yield response.
|
|
7834
|
+
const data = JSONbig.parse(yield response.text());
|
|
7826
7835
|
const insufficientLiquidity = data.msg === "liquidity is not enough";
|
|
7827
7836
|
if (data.msg && data.msg.indexOf("HoneyPot scam") > -1) {
|
|
7828
7837
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cetusprotocol/aggregator-sdk",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -30,13 +30,15 @@
|
|
|
30
30
|
"@mysten/sui": "^1.6.0",
|
|
31
31
|
"@pythnetwork/pyth-sui-js": "^2.1.0",
|
|
32
32
|
"@types/jest": "^29.5.12",
|
|
33
|
+
"@types/json-bigint": "^1.0.4",
|
|
33
34
|
"@types/node": "^20.12.12",
|
|
34
35
|
"babel-jest": "^29.7.0",
|
|
35
36
|
"bip39": "^3.1.0",
|
|
36
37
|
"dotenv": "^16.4.5",
|
|
37
38
|
"jest": "^29.7.0",
|
|
39
|
+
"json-bigint": "^1.0.0",
|
|
38
40
|
"node-fetch": "^3.3.2",
|
|
39
41
|
"ts-jest": "^29.1.3",
|
|
40
|
-
"typescript": "^5.
|
|
42
|
+
"typescript": "^5.0.0"
|
|
41
43
|
}
|
|
42
44
|
}
|