@cetusprotocol/aggregator-sdk 0.0.0-experimental-20250625192907 → 0.0.0-experimental-20250625194659
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 +18 -15
- package/dist/index.mjs +18 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7714,8 +7714,8 @@ function parseRouterResponse(data, byAmountIn) {
|
|
|
7714
7714
|
version
|
|
7715
7715
|
};
|
|
7716
7716
|
}),
|
|
7717
|
-
amountIn: new import_bn5.default(
|
|
7718
|
-
amountOut: new import_bn5.default(
|
|
7717
|
+
amountIn: new import_bn5.default(route.amount_in.toString()),
|
|
7718
|
+
amountOut: new import_bn5.default(route.amount_out.toString()),
|
|
7719
7719
|
initialPrice: new decimal_default(route.initial_price.toString())
|
|
7720
7720
|
};
|
|
7721
7721
|
}),
|
|
@@ -7825,23 +7825,26 @@ function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceive
|
|
|
7825
7825
|
};
|
|
7826
7826
|
}
|
|
7827
7827
|
console.log("sdk getRouterResult \u{1F680} ~ response:", response);
|
|
7828
|
-
const
|
|
7829
|
-
const
|
|
7830
|
-
|
|
7831
|
-
|
|
7828
|
+
const data = yield response.text().then((text) => {
|
|
7829
|
+
const bigNumbers = [];
|
|
7830
|
+
const regex = /"([^"]+)"\s*:\s*(\d{16,})/g;
|
|
7831
|
+
const matches = text.matchAll(regex);
|
|
7832
|
+
for (const match of matches) {
|
|
7833
|
+
const key = match[1];
|
|
7834
|
+
const value = match[2];
|
|
7835
|
+
if (value.length > 15) {
|
|
7836
|
+
bigNumbers.push({ key, value });
|
|
7832
7837
|
}
|
|
7833
|
-
|
|
7838
|
+
}
|
|
7839
|
+
let safeText = text;
|
|
7840
|
+
bigNumbers.forEach(({ key, value }) => {
|
|
7841
|
+
safeText = safeText.replace(`"${key}":${value}`, `"${key}":"${value}"`);
|
|
7834
7842
|
});
|
|
7835
|
-
|
|
7843
|
+
const data2 = JSON.parse(safeText);
|
|
7844
|
+
console.log("\u5B89\u5168\u89E3\u6790\u7684\u6570\u636E:", data2);
|
|
7836
7845
|
return data2;
|
|
7837
7846
|
});
|
|
7838
|
-
console.log("sdk getRouterResult \u{1F680} ~
|
|
7839
|
-
const blob = yield response.blob().then((blob2) => blob2.text()).then((rawText) => {
|
|
7840
|
-
console.log("sdk getRouterResult\u539F\u59CB\u54CD\u5E94\u6587\u672C:", rawText);
|
|
7841
|
-
return rawText;
|
|
7842
|
-
});
|
|
7843
|
-
console.log("sdk getRouterResult \u{1F680} ~ blob:", blob);
|
|
7844
|
-
const data = yield response.json();
|
|
7847
|
+
console.log("sdk getRouterResult \u{1F680} ~ data:", data);
|
|
7845
7848
|
console.log("sdk getRouterResult \u{1F680} ~ data:", data);
|
|
7846
7849
|
const insufficientLiquidity = data.msg === "liquidity is not enough";
|
|
7847
7850
|
if (data.msg && data.msg.indexOf("HoneyPot scam") > -1) {
|
package/dist/index.mjs
CHANGED
|
@@ -7712,8 +7712,8 @@ function parseRouterResponse(data, byAmountIn) {
|
|
|
7712
7712
|
version
|
|
7713
7713
|
};
|
|
7714
7714
|
}),
|
|
7715
|
-
amountIn: new import_bn5.default(
|
|
7716
|
-
amountOut: new import_bn5.default(
|
|
7715
|
+
amountIn: new import_bn5.default(route.amount_in.toString()),
|
|
7716
|
+
amountOut: new import_bn5.default(route.amount_out.toString()),
|
|
7717
7717
|
initialPrice: new decimal_default(route.initial_price.toString())
|
|
7718
7718
|
};
|
|
7719
7719
|
}),
|
|
@@ -7823,23 +7823,26 @@ function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceive
|
|
|
7823
7823
|
};
|
|
7824
7824
|
}
|
|
7825
7825
|
console.log("sdk getRouterResult \u{1F680} ~ response:", response);
|
|
7826
|
-
const
|
|
7827
|
-
const
|
|
7828
|
-
|
|
7829
|
-
|
|
7826
|
+
const data = yield response.text().then((text) => {
|
|
7827
|
+
const bigNumbers = [];
|
|
7828
|
+
const regex = /"([^"]+)"\s*:\s*(\d{16,})/g;
|
|
7829
|
+
const matches = text.matchAll(regex);
|
|
7830
|
+
for (const match of matches) {
|
|
7831
|
+
const key = match[1];
|
|
7832
|
+
const value = match[2];
|
|
7833
|
+
if (value.length > 15) {
|
|
7834
|
+
bigNumbers.push({ key, value });
|
|
7830
7835
|
}
|
|
7831
|
-
|
|
7836
|
+
}
|
|
7837
|
+
let safeText = text;
|
|
7838
|
+
bigNumbers.forEach(({ key, value }) => {
|
|
7839
|
+
safeText = safeText.replace(`"${key}":${value}`, `"${key}":"${value}"`);
|
|
7832
7840
|
});
|
|
7833
|
-
|
|
7841
|
+
const data2 = JSON.parse(safeText);
|
|
7842
|
+
console.log("\u5B89\u5168\u89E3\u6790\u7684\u6570\u636E:", data2);
|
|
7834
7843
|
return data2;
|
|
7835
7844
|
});
|
|
7836
|
-
console.log("sdk getRouterResult \u{1F680} ~
|
|
7837
|
-
const blob = yield response.blob().then((blob2) => blob2.text()).then((rawText) => {
|
|
7838
|
-
console.log("sdk getRouterResult\u539F\u59CB\u54CD\u5E94\u6587\u672C:", rawText);
|
|
7839
|
-
return rawText;
|
|
7840
|
-
});
|
|
7841
|
-
console.log("sdk getRouterResult \u{1F680} ~ blob:", blob);
|
|
7842
|
-
const data = yield response.json();
|
|
7845
|
+
console.log("sdk getRouterResult \u{1F680} ~ data:", data);
|
|
7843
7846
|
console.log("sdk getRouterResult \u{1F680} ~ data:", data);
|
|
7844
7847
|
const insufficientLiquidity = data.msg === "liquidity is not enough";
|
|
7845
7848
|
if (data.msg && data.msg.indexOf("HoneyPot scam") > -1) {
|