@t2000/sdk 10.27.0 → 10.27.2
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.cjs +12 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -2942,11 +2942,21 @@ var T2000 = class _T2000 extends eventemitter3.EventEmitter {
|
|
|
2942
2942
|
const rawAmount = BigInt(Math.floor(params.amount * 10 ** fromDecimals));
|
|
2943
2943
|
let route;
|
|
2944
2944
|
if (params.serializedRoute) {
|
|
2945
|
-
|
|
2945
|
+
let s = params.serializedRoute;
|
|
2946
|
+
const nested = s.serializedRoute;
|
|
2947
|
+
if (nested && typeof nested === "object" && typeof nested.fromCoinType === "string" && nested.routerData) {
|
|
2948
|
+
s = nested;
|
|
2949
|
+
}
|
|
2950
|
+
if (typeof s.fromCoinType !== "string" || typeof s.toCoinType !== "string") {
|
|
2951
|
+
throw new exports.T2000Error(
|
|
2952
|
+
"SWAP_ROUTE_MISMATCH",
|
|
2953
|
+
"serializedRoute is not the object t2000 quoted \u2014 it is missing fromCoinType/toCoinType. Pass quote.serializedRoute exactly as the quote returned it (not the whole quote response), or omit serializedRoute to discover a fresh route."
|
|
2954
|
+
);
|
|
2955
|
+
}
|
|
2946
2956
|
if (!verifyCetusRouteCoinMatch2(s, { fromCoinType: fromType, toCoinType: toType })) {
|
|
2947
2957
|
throw new exports.T2000Error(
|
|
2948
2958
|
"SWAP_ROUTE_MISMATCH",
|
|
2949
|
-
`The quoted route is for ${s.fromCoinType} -> ${s.toCoinType}, not ${
|
|
2959
|
+
`The quoted route is for ${s.fromCoinType} -> ${s.toCoinType}, not ${fromType} -> ${toType}. Re-quote and pass the new serializedRoute.`
|
|
2950
2960
|
);
|
|
2951
2961
|
}
|
|
2952
2962
|
if (s.byAmountIn !== byAmountIn || BigInt(s.amountIn) !== rawAmount) {
|