@cetusprotocol/aggregator-sdk 0.0.0-experimental-20250903180855 → 0.0.0-experimental-20250909121423
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/bun.lock +1151 -0
- package/dist/index.d.mts +7 -6
- package/dist/index.d.ts +7 -6
- package/dist/index.js +46 -29
- package/dist/index.mjs +46 -29
- package/package.json +25 -16
package/dist/index.d.mts
CHANGED
|
@@ -435,7 +435,7 @@ type SuiStructTag = {
|
|
|
435
435
|
/**
|
|
436
436
|
* Represents basic SUI data types.
|
|
437
437
|
*/
|
|
438
|
-
type SuiBasicTypes =
|
|
438
|
+
type SuiBasicTypes = "address" | "bool" | "u8" | "u16" | "u32" | "u64" | "u128" | "u256";
|
|
439
439
|
/**
|
|
440
440
|
* Represents a SUI transaction argument, which can be of various types.
|
|
441
441
|
*/
|
|
@@ -443,7 +443,7 @@ type SuiTxArg = TransactionArgument | string | number | bigint | boolean;
|
|
|
443
443
|
/**
|
|
444
444
|
* Represents input types for SUI data.
|
|
445
445
|
*/
|
|
446
|
-
type SuiInputTypes =
|
|
446
|
+
type SuiInputTypes = "object" | SuiBasicTypes;
|
|
447
447
|
/**
|
|
448
448
|
* Gets the default SUI input type based on the provided value.
|
|
449
449
|
* @param value - The value to determine the default input type for.
|
|
@@ -627,7 +627,7 @@ declare const SuiZeroCoinFn = "0x2::coin::zero";
|
|
|
627
627
|
declare const DEEPBOOK_PACKAGE_ID = "0x000000000000000000000000000000000000000000000000000000000000dee9";
|
|
628
628
|
declare const DEEPBOOK_PUBLISHED_AT = "0x000000000000000000000000000000000000000000000000000000000000dee9";
|
|
629
629
|
declare const CETUS_PUBLISHED_AT = "0x70968826ad1b4ba895753f634b0aea68d0672908ca1075a2abdf0fc9e0b2fc6a";
|
|
630
|
-
declare const CETUS_V3_PUBLISHED_AT = "
|
|
630
|
+
declare const CETUS_V3_PUBLISHED_AT = "0xb1e11ceaf3e7cd3031ef5e24804478ec3441c5aecdace910bdaca317a0c1c535";
|
|
631
631
|
declare const MAINNET_CETUS_GLOBAL_CONFIG_ID = "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f";
|
|
632
632
|
declare const TESTNET_CETUS_GLOBAL_CONFIG_ID = "0x6f4149091a5aea0e818e7243a13adcfb403842d670b9a2089de058512620687a";
|
|
633
633
|
declare const MAINNET_FLOWX_AMM_CONTAINER_ID = "0xb65dcbf63fd3ad5d0ebfbf334780dc9f785eff38a4459e37ab08fa79576ee511";
|
|
@@ -680,6 +680,7 @@ declare const CLIENT_CONFIG: {
|
|
|
680
680
|
readonly DEFAULT_PYTH_URL: "https://hermes.pyth.network";
|
|
681
681
|
readonly PYTH_TIMEOUT: 3000;
|
|
682
682
|
readonly MAX_OVERLAY_FEE_RATE: 0.1;
|
|
683
|
+
readonly MAX_OVERLAY_FEE_RATE_NUMERATOR: 100000;
|
|
683
684
|
readonly FEE_RATE_MULTIPLIER: 1000000;
|
|
684
685
|
readonly DEFAULT_OVERLAY_FEE_RECEIVER: "0x0";
|
|
685
686
|
readonly ERRORS: {
|
|
@@ -701,7 +702,7 @@ declare const AGGREGATOR_V3_CONFIG: {
|
|
|
701
702
|
readonly MAX_FEE_RATE: 100000;
|
|
702
703
|
readonly MAX_AMOUNT_IN: "18446744073709551615";
|
|
703
704
|
readonly DEFAULT_PUBLISHED_AT: {
|
|
704
|
-
readonly Mainnet: "
|
|
705
|
+
readonly Mainnet: "0x33ec64e9bb369bf045ddc198c81adbf2acab424da37465d95296ee02045d2b17";
|
|
705
706
|
readonly Testnet: "0x0";
|
|
706
707
|
};
|
|
707
708
|
};
|
|
@@ -740,8 +741,8 @@ declare function getAggregatorServerErrorMessage(code: AggregatorServerErrorCode
|
|
|
740
741
|
*/
|
|
741
742
|
declare class AggregatorError extends Error {
|
|
742
743
|
message: string;
|
|
743
|
-
errorCode?: AggregatorErrorCode;
|
|
744
|
-
constructor(message: string, errorCode?: AggregatorErrorCode);
|
|
744
|
+
errorCode?: AggregatorErrorCode | string;
|
|
745
|
+
constructor(message: string, errorCode?: AggregatorErrorCode | string);
|
|
745
746
|
static isAggregatorErrorCode(e: any, code: AggregatorErrorCode): boolean;
|
|
746
747
|
}
|
|
747
748
|
|
package/dist/index.d.ts
CHANGED
|
@@ -435,7 +435,7 @@ type SuiStructTag = {
|
|
|
435
435
|
/**
|
|
436
436
|
* Represents basic SUI data types.
|
|
437
437
|
*/
|
|
438
|
-
type SuiBasicTypes =
|
|
438
|
+
type SuiBasicTypes = "address" | "bool" | "u8" | "u16" | "u32" | "u64" | "u128" | "u256";
|
|
439
439
|
/**
|
|
440
440
|
* Represents a SUI transaction argument, which can be of various types.
|
|
441
441
|
*/
|
|
@@ -443,7 +443,7 @@ type SuiTxArg = TransactionArgument | string | number | bigint | boolean;
|
|
|
443
443
|
/**
|
|
444
444
|
* Represents input types for SUI data.
|
|
445
445
|
*/
|
|
446
|
-
type SuiInputTypes =
|
|
446
|
+
type SuiInputTypes = "object" | SuiBasicTypes;
|
|
447
447
|
/**
|
|
448
448
|
* Gets the default SUI input type based on the provided value.
|
|
449
449
|
* @param value - The value to determine the default input type for.
|
|
@@ -627,7 +627,7 @@ declare const SuiZeroCoinFn = "0x2::coin::zero";
|
|
|
627
627
|
declare const DEEPBOOK_PACKAGE_ID = "0x000000000000000000000000000000000000000000000000000000000000dee9";
|
|
628
628
|
declare const DEEPBOOK_PUBLISHED_AT = "0x000000000000000000000000000000000000000000000000000000000000dee9";
|
|
629
629
|
declare const CETUS_PUBLISHED_AT = "0x70968826ad1b4ba895753f634b0aea68d0672908ca1075a2abdf0fc9e0b2fc6a";
|
|
630
|
-
declare const CETUS_V3_PUBLISHED_AT = "
|
|
630
|
+
declare const CETUS_V3_PUBLISHED_AT = "0xb1e11ceaf3e7cd3031ef5e24804478ec3441c5aecdace910bdaca317a0c1c535";
|
|
631
631
|
declare const MAINNET_CETUS_GLOBAL_CONFIG_ID = "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f";
|
|
632
632
|
declare const TESTNET_CETUS_GLOBAL_CONFIG_ID = "0x6f4149091a5aea0e818e7243a13adcfb403842d670b9a2089de058512620687a";
|
|
633
633
|
declare const MAINNET_FLOWX_AMM_CONTAINER_ID = "0xb65dcbf63fd3ad5d0ebfbf334780dc9f785eff38a4459e37ab08fa79576ee511";
|
|
@@ -680,6 +680,7 @@ declare const CLIENT_CONFIG: {
|
|
|
680
680
|
readonly DEFAULT_PYTH_URL: "https://hermes.pyth.network";
|
|
681
681
|
readonly PYTH_TIMEOUT: 3000;
|
|
682
682
|
readonly MAX_OVERLAY_FEE_RATE: 0.1;
|
|
683
|
+
readonly MAX_OVERLAY_FEE_RATE_NUMERATOR: 100000;
|
|
683
684
|
readonly FEE_RATE_MULTIPLIER: 1000000;
|
|
684
685
|
readonly DEFAULT_OVERLAY_FEE_RECEIVER: "0x0";
|
|
685
686
|
readonly ERRORS: {
|
|
@@ -701,7 +702,7 @@ declare const AGGREGATOR_V3_CONFIG: {
|
|
|
701
702
|
readonly MAX_FEE_RATE: 100000;
|
|
702
703
|
readonly MAX_AMOUNT_IN: "18446744073709551615";
|
|
703
704
|
readonly DEFAULT_PUBLISHED_AT: {
|
|
704
|
-
readonly Mainnet: "
|
|
705
|
+
readonly Mainnet: "0x33ec64e9bb369bf045ddc198c81adbf2acab424da37465d95296ee02045d2b17";
|
|
705
706
|
readonly Testnet: "0x0";
|
|
706
707
|
};
|
|
707
708
|
};
|
|
@@ -740,8 +741,8 @@ declare function getAggregatorServerErrorMessage(code: AggregatorServerErrorCode
|
|
|
740
741
|
*/
|
|
741
742
|
declare class AggregatorError extends Error {
|
|
742
743
|
message: string;
|
|
743
|
-
errorCode?: AggregatorErrorCode;
|
|
744
|
-
constructor(message: string, errorCode?: AggregatorErrorCode);
|
|
744
|
+
errorCode?: AggregatorErrorCode | string;
|
|
745
|
+
constructor(message: string, errorCode?: AggregatorErrorCode | string);
|
|
745
746
|
static isAggregatorErrorCode(e: any, code: AggregatorErrorCode): boolean;
|
|
746
747
|
}
|
|
747
748
|
|
package/dist/index.js
CHANGED
|
@@ -1658,6 +1658,7 @@ var require_bn = __commonJS({
|
|
|
1658
1658
|
this.words[i] = carry;
|
|
1659
1659
|
this.length++;
|
|
1660
1660
|
}
|
|
1661
|
+
this.length = num === 0 ? 1 : this.length;
|
|
1661
1662
|
return isNegNum ? this.ineg() : this;
|
|
1662
1663
|
};
|
|
1663
1664
|
BN7.prototype.muln = function muln(num) {
|
|
@@ -3246,7 +3247,7 @@ function buildInputCoin(txb, allCoins, amount, coinType) {
|
|
|
3246
3247
|
}
|
|
3247
3248
|
let totalCoinBalance = CoinUtils.calculateTotalBalance(usedCoinAsests);
|
|
3248
3249
|
if (totalCoinBalance < amount) {
|
|
3249
|
-
throw new
|
|
3250
|
+
throw new AggregatorError(
|
|
3250
3251
|
"Insufficient balance when build merge coin, coinType: " + coinType,
|
|
3251
3252
|
"InsufficientBalance" /* InsufficientBalance */ + coinType
|
|
3252
3253
|
);
|
|
@@ -3340,7 +3341,7 @@ var SuiZeroCoinFn = "0x2::coin::zero";
|
|
|
3340
3341
|
var DEEPBOOK_PACKAGE_ID = "0x000000000000000000000000000000000000000000000000000000000000dee9";
|
|
3341
3342
|
var DEEPBOOK_PUBLISHED_AT = "0x000000000000000000000000000000000000000000000000000000000000dee9";
|
|
3342
3343
|
var CETUS_PUBLISHED_AT = "0x70968826ad1b4ba895753f634b0aea68d0672908ca1075a2abdf0fc9e0b2fc6a";
|
|
3343
|
-
var CETUS_V3_PUBLISHED_AT = "
|
|
3344
|
+
var CETUS_V3_PUBLISHED_AT = "0xb1e11ceaf3e7cd3031ef5e24804478ec3441c5aecdace910bdaca317a0c1c535";
|
|
3344
3345
|
var MAINNET_CETUS_GLOBAL_CONFIG_ID = "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f";
|
|
3345
3346
|
var TESTNET_CETUS_GLOBAL_CONFIG_ID = "0x6f4149091a5aea0e818e7243a13adcfb403842d670b9a2089de058512620687a";
|
|
3346
3347
|
var MAINNET_FLOWX_AMM_CONTAINER_ID = "0xb65dcbf63fd3ad5d0ebfbf334780dc9f785eff38a4459e37ab08fa79576ee511";
|
|
@@ -3398,6 +3399,7 @@ var CLIENT_CONFIG = {
|
|
|
3398
3399
|
DEFAULT_PYTH_URL: "https://hermes.pyth.network",
|
|
3399
3400
|
PYTH_TIMEOUT: 3e3,
|
|
3400
3401
|
MAX_OVERLAY_FEE_RATE: 0.1,
|
|
3402
|
+
MAX_OVERLAY_FEE_RATE_NUMERATOR: 1e5,
|
|
3401
3403
|
FEE_RATE_MULTIPLIER: 1e6,
|
|
3402
3404
|
DEFAULT_OVERLAY_FEE_RECEIVER: "0x0",
|
|
3403
3405
|
// Error Messages
|
|
@@ -3421,13 +3423,13 @@ var AGGREGATOR_V3_CONFIG = {
|
|
|
3421
3423
|
// 10%
|
|
3422
3424
|
MAX_AMOUNT_IN: U64_MAX,
|
|
3423
3425
|
DEFAULT_PUBLISHED_AT: {
|
|
3424
|
-
Mainnet: "
|
|
3426
|
+
Mainnet: "0x33ec64e9bb369bf045ddc198c81adbf2acab424da37465d95296ee02045d2b17",
|
|
3425
3427
|
Testnet: "0x0"
|
|
3426
3428
|
}
|
|
3427
3429
|
};
|
|
3428
3430
|
|
|
3429
3431
|
// src/api.ts
|
|
3430
|
-
var SDK_VERSION =
|
|
3432
|
+
var SDK_VERSION = 1010105;
|
|
3431
3433
|
function parseRouterResponse(data, byAmountIn) {
|
|
3432
3434
|
let packages = /* @__PURE__ */ new Map();
|
|
3433
3435
|
if (data.packages) {
|
|
@@ -3998,18 +4000,17 @@ P.hyperbolicTangent = P.tanh = function() {
|
|
|
3998
4000
|
return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm);
|
|
3999
4001
|
};
|
|
4000
4002
|
P.inverseCosine = P.acos = function() {
|
|
4001
|
-
var
|
|
4003
|
+
var x = this, Ctor = x.constructor, k = x.abs().cmp(1), pr = Ctor.precision, rm = Ctor.rounding;
|
|
4002
4004
|
if (k !== -1) {
|
|
4003
4005
|
return k === 0 ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0) : new Ctor(NaN);
|
|
4004
4006
|
}
|
|
4005
4007
|
if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5);
|
|
4006
4008
|
Ctor.precision = pr + 6;
|
|
4007
4009
|
Ctor.rounding = 1;
|
|
4008
|
-
x = x.
|
|
4009
|
-
halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
|
|
4010
|
+
x = new Ctor(1).minus(x).div(x.plus(1)).sqrt().atan();
|
|
4010
4011
|
Ctor.precision = pr;
|
|
4011
4012
|
Ctor.rounding = rm;
|
|
4012
|
-
return
|
|
4013
|
+
return x.times(2);
|
|
4013
4014
|
};
|
|
4014
4015
|
P.inverseHyperbolicCosine = P.acosh = function() {
|
|
4015
4016
|
var pr, rm, x = this, Ctor = x.constructor;
|
|
@@ -4781,7 +4782,7 @@ function cosine(Ctor, x) {
|
|
|
4781
4782
|
Ctor.precision -= k;
|
|
4782
4783
|
return x;
|
|
4783
4784
|
}
|
|
4784
|
-
var divide = /* @__PURE__ */ function() {
|
|
4785
|
+
var divide = /* @__PURE__ */ (function() {
|
|
4785
4786
|
function multiplyInteger(x, k, base) {
|
|
4786
4787
|
var temp, carry = 0, i = x.length;
|
|
4787
4788
|
for (x = x.slice(); i--; ) {
|
|
@@ -4939,7 +4940,7 @@ var divide = /* @__PURE__ */ function() {
|
|
|
4939
4940
|
}
|
|
4940
4941
|
return q;
|
|
4941
4942
|
};
|
|
4942
|
-
}();
|
|
4943
|
+
})();
|
|
4943
4944
|
function finalise(x, sd, rm, isTruncated) {
|
|
4944
4945
|
var digits, i, j, k, rd, roundUp, w, xd, xdi, Ctor = x.constructor;
|
|
4945
4946
|
out: if (sd != null) {
|
|
@@ -5107,14 +5108,16 @@ function intPow(Ctor, x, n, pr) {
|
|
|
5107
5108
|
function isOdd(n) {
|
|
5108
5109
|
return n.d[n.d.length - 1] & 1;
|
|
5109
5110
|
}
|
|
5110
|
-
function maxOrMin(Ctor, args,
|
|
5111
|
-
var y, x = new Ctor(args[0]), i = 0;
|
|
5111
|
+
function maxOrMin(Ctor, args, n) {
|
|
5112
|
+
var k, y, x = new Ctor(args[0]), i = 0;
|
|
5112
5113
|
for (; ++i < args.length; ) {
|
|
5113
5114
|
y = new Ctor(args[i]);
|
|
5114
5115
|
if (!y.s) {
|
|
5115
5116
|
x = y;
|
|
5116
5117
|
break;
|
|
5117
|
-
}
|
|
5118
|
+
}
|
|
5119
|
+
k = x.cmp(y);
|
|
5120
|
+
if (k === n || k === 0 && x.s === n) {
|
|
5118
5121
|
x = y;
|
|
5119
5122
|
}
|
|
5120
5123
|
}
|
|
@@ -5657,24 +5660,35 @@ function clone(obj) {
|
|
|
5657
5660
|
x.d = [v];
|
|
5658
5661
|
}
|
|
5659
5662
|
return;
|
|
5660
|
-
}
|
|
5663
|
+
}
|
|
5664
|
+
if (v * 0 !== 0) {
|
|
5661
5665
|
if (!v) x.s = NaN;
|
|
5662
5666
|
x.e = NaN;
|
|
5663
5667
|
x.d = null;
|
|
5664
5668
|
return;
|
|
5665
5669
|
}
|
|
5666
5670
|
return parseDecimal(x, v.toString());
|
|
5667
|
-
} else if (t !== "string") {
|
|
5668
|
-
throw Error(invalidArgument + v);
|
|
5669
5671
|
}
|
|
5670
|
-
if (
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5672
|
+
if (t === "string") {
|
|
5673
|
+
if ((i2 = v.charCodeAt(0)) === 45) {
|
|
5674
|
+
v = v.slice(1);
|
|
5675
|
+
x.s = -1;
|
|
5676
|
+
} else {
|
|
5677
|
+
if (i2 === 43) v = v.slice(1);
|
|
5678
|
+
x.s = 1;
|
|
5679
|
+
}
|
|
5680
|
+
return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);
|
|
5676
5681
|
}
|
|
5677
|
-
|
|
5682
|
+
if (t === "bigint") {
|
|
5683
|
+
if (v < 0) {
|
|
5684
|
+
v = -v;
|
|
5685
|
+
x.s = -1;
|
|
5686
|
+
} else {
|
|
5687
|
+
x.s = 1;
|
|
5688
|
+
}
|
|
5689
|
+
return parseDecimal(x, v.toString());
|
|
5690
|
+
}
|
|
5691
|
+
throw Error(invalidArgument + v);
|
|
5678
5692
|
}
|
|
5679
5693
|
Decimal2.prototype = P;
|
|
5680
5694
|
Decimal2.ROUND_UP = 0;
|
|
@@ -5781,10 +5795,10 @@ function log10(x) {
|
|
|
5781
5795
|
return new this(x).log(10);
|
|
5782
5796
|
}
|
|
5783
5797
|
function max() {
|
|
5784
|
-
return maxOrMin(this, arguments,
|
|
5798
|
+
return maxOrMin(this, arguments, -1);
|
|
5785
5799
|
}
|
|
5786
5800
|
function min() {
|
|
5787
|
-
return maxOrMin(this, arguments,
|
|
5801
|
+
return maxOrMin(this, arguments, 1);
|
|
5788
5802
|
}
|
|
5789
5803
|
function mod(x, y) {
|
|
5790
5804
|
return new this(x).mod(y);
|
|
@@ -8876,7 +8890,7 @@ function recordFirstCoinIndex(paths) {
|
|
|
8876
8890
|
return newCoinRecord;
|
|
8877
8891
|
}
|
|
8878
8892
|
function checkOverlayFeeConfig(overlayFeeRate, overlayFeeReceiver) {
|
|
8879
|
-
if (overlayFeeRate > CLIENT_CONFIG.
|
|
8893
|
+
if (overlayFeeRate > CLIENT_CONFIG.MAX_OVERLAY_FEE_RATE_NUMERATOR) {
|
|
8880
8894
|
throw new Error(CLIENT_CONFIG.ERRORS.INVALID_OVERLAY_FEE_RATE);
|
|
8881
8895
|
}
|
|
8882
8896
|
if (overlayFeeReceiver === "0x0" && overlayFeeRate > 0) {
|
|
@@ -8897,16 +8911,19 @@ var getDefaultSuiInputType = (value) => {
|
|
|
8897
8911
|
if (typeof value === "boolean") {
|
|
8898
8912
|
return "bool";
|
|
8899
8913
|
}
|
|
8900
|
-
throw new
|
|
8914
|
+
throw new AggregatorError(
|
|
8915
|
+
`Unknown type for value: ${value}`,
|
|
8916
|
+
"InvalidType" /* InvalidType */
|
|
8917
|
+
);
|
|
8901
8918
|
};
|
|
8902
8919
|
/*! Bundled license information:
|
|
8903
8920
|
|
|
8904
8921
|
decimal.js/decimal.mjs:
|
|
8905
8922
|
(*!
|
|
8906
|
-
* decimal.js v10.
|
|
8923
|
+
* decimal.js v10.6.0
|
|
8907
8924
|
* An arbitrary-precision Decimal type for JavaScript.
|
|
8908
8925
|
* https://github.com/MikeMcl/decimal.js
|
|
8909
|
-
* Copyright (c)
|
|
8926
|
+
* Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
|
|
8910
8927
|
* MIT Licence
|
|
8911
8928
|
*)
|
|
8912
8929
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -1652,6 +1652,7 @@ var require_bn = __commonJS({
|
|
|
1652
1652
|
this.words[i] = carry;
|
|
1653
1653
|
this.length++;
|
|
1654
1654
|
}
|
|
1655
|
+
this.length = num === 0 ? 1 : this.length;
|
|
1655
1656
|
return isNegNum ? this.ineg() : this;
|
|
1656
1657
|
};
|
|
1657
1658
|
BN7.prototype.muln = function muln(num) {
|
|
@@ -3240,7 +3241,7 @@ function buildInputCoin(txb, allCoins, amount, coinType) {
|
|
|
3240
3241
|
}
|
|
3241
3242
|
let totalCoinBalance = CoinUtils.calculateTotalBalance(usedCoinAsests);
|
|
3242
3243
|
if (totalCoinBalance < amount) {
|
|
3243
|
-
throw new
|
|
3244
|
+
throw new AggregatorError(
|
|
3244
3245
|
"Insufficient balance when build merge coin, coinType: " + coinType,
|
|
3245
3246
|
"InsufficientBalance" /* InsufficientBalance */ + coinType
|
|
3246
3247
|
);
|
|
@@ -3334,7 +3335,7 @@ var SuiZeroCoinFn = "0x2::coin::zero";
|
|
|
3334
3335
|
var DEEPBOOK_PACKAGE_ID = "0x000000000000000000000000000000000000000000000000000000000000dee9";
|
|
3335
3336
|
var DEEPBOOK_PUBLISHED_AT = "0x000000000000000000000000000000000000000000000000000000000000dee9";
|
|
3336
3337
|
var CETUS_PUBLISHED_AT = "0x70968826ad1b4ba895753f634b0aea68d0672908ca1075a2abdf0fc9e0b2fc6a";
|
|
3337
|
-
var CETUS_V3_PUBLISHED_AT = "
|
|
3338
|
+
var CETUS_V3_PUBLISHED_AT = "0xb1e11ceaf3e7cd3031ef5e24804478ec3441c5aecdace910bdaca317a0c1c535";
|
|
3338
3339
|
var MAINNET_CETUS_GLOBAL_CONFIG_ID = "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f";
|
|
3339
3340
|
var TESTNET_CETUS_GLOBAL_CONFIG_ID = "0x6f4149091a5aea0e818e7243a13adcfb403842d670b9a2089de058512620687a";
|
|
3340
3341
|
var MAINNET_FLOWX_AMM_CONTAINER_ID = "0xb65dcbf63fd3ad5d0ebfbf334780dc9f785eff38a4459e37ab08fa79576ee511";
|
|
@@ -3392,6 +3393,7 @@ var CLIENT_CONFIG = {
|
|
|
3392
3393
|
DEFAULT_PYTH_URL: "https://hermes.pyth.network",
|
|
3393
3394
|
PYTH_TIMEOUT: 3e3,
|
|
3394
3395
|
MAX_OVERLAY_FEE_RATE: 0.1,
|
|
3396
|
+
MAX_OVERLAY_FEE_RATE_NUMERATOR: 1e5,
|
|
3395
3397
|
FEE_RATE_MULTIPLIER: 1e6,
|
|
3396
3398
|
DEFAULT_OVERLAY_FEE_RECEIVER: "0x0",
|
|
3397
3399
|
// Error Messages
|
|
@@ -3415,13 +3417,13 @@ var AGGREGATOR_V3_CONFIG = {
|
|
|
3415
3417
|
// 10%
|
|
3416
3418
|
MAX_AMOUNT_IN: U64_MAX,
|
|
3417
3419
|
DEFAULT_PUBLISHED_AT: {
|
|
3418
|
-
Mainnet: "
|
|
3420
|
+
Mainnet: "0x33ec64e9bb369bf045ddc198c81adbf2acab424da37465d95296ee02045d2b17",
|
|
3419
3421
|
Testnet: "0x0"
|
|
3420
3422
|
}
|
|
3421
3423
|
};
|
|
3422
3424
|
|
|
3423
3425
|
// src/api.ts
|
|
3424
|
-
var SDK_VERSION =
|
|
3426
|
+
var SDK_VERSION = 1010105;
|
|
3425
3427
|
function parseRouterResponse(data, byAmountIn) {
|
|
3426
3428
|
let packages = /* @__PURE__ */ new Map();
|
|
3427
3429
|
if (data.packages) {
|
|
@@ -3992,18 +3994,17 @@ P.hyperbolicTangent = P.tanh = function() {
|
|
|
3992
3994
|
return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm);
|
|
3993
3995
|
};
|
|
3994
3996
|
P.inverseCosine = P.acos = function() {
|
|
3995
|
-
var
|
|
3997
|
+
var x = this, Ctor = x.constructor, k = x.abs().cmp(1), pr = Ctor.precision, rm = Ctor.rounding;
|
|
3996
3998
|
if (k !== -1) {
|
|
3997
3999
|
return k === 0 ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0) : new Ctor(NaN);
|
|
3998
4000
|
}
|
|
3999
4001
|
if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5);
|
|
4000
4002
|
Ctor.precision = pr + 6;
|
|
4001
4003
|
Ctor.rounding = 1;
|
|
4002
|
-
x = x.
|
|
4003
|
-
halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
|
|
4004
|
+
x = new Ctor(1).minus(x).div(x.plus(1)).sqrt().atan();
|
|
4004
4005
|
Ctor.precision = pr;
|
|
4005
4006
|
Ctor.rounding = rm;
|
|
4006
|
-
return
|
|
4007
|
+
return x.times(2);
|
|
4007
4008
|
};
|
|
4008
4009
|
P.inverseHyperbolicCosine = P.acosh = function() {
|
|
4009
4010
|
var pr, rm, x = this, Ctor = x.constructor;
|
|
@@ -4775,7 +4776,7 @@ function cosine(Ctor, x) {
|
|
|
4775
4776
|
Ctor.precision -= k;
|
|
4776
4777
|
return x;
|
|
4777
4778
|
}
|
|
4778
|
-
var divide = /* @__PURE__ */ function() {
|
|
4779
|
+
var divide = /* @__PURE__ */ (function() {
|
|
4779
4780
|
function multiplyInteger(x, k, base) {
|
|
4780
4781
|
var temp, carry = 0, i = x.length;
|
|
4781
4782
|
for (x = x.slice(); i--; ) {
|
|
@@ -4933,7 +4934,7 @@ var divide = /* @__PURE__ */ function() {
|
|
|
4933
4934
|
}
|
|
4934
4935
|
return q;
|
|
4935
4936
|
};
|
|
4936
|
-
}();
|
|
4937
|
+
})();
|
|
4937
4938
|
function finalise(x, sd, rm, isTruncated) {
|
|
4938
4939
|
var digits, i, j, k, rd, roundUp, w, xd, xdi, Ctor = x.constructor;
|
|
4939
4940
|
out: if (sd != null) {
|
|
@@ -5101,14 +5102,16 @@ function intPow(Ctor, x, n, pr) {
|
|
|
5101
5102
|
function isOdd(n) {
|
|
5102
5103
|
return n.d[n.d.length - 1] & 1;
|
|
5103
5104
|
}
|
|
5104
|
-
function maxOrMin(Ctor, args,
|
|
5105
|
-
var y, x = new Ctor(args[0]), i = 0;
|
|
5105
|
+
function maxOrMin(Ctor, args, n) {
|
|
5106
|
+
var k, y, x = new Ctor(args[0]), i = 0;
|
|
5106
5107
|
for (; ++i < args.length; ) {
|
|
5107
5108
|
y = new Ctor(args[i]);
|
|
5108
5109
|
if (!y.s) {
|
|
5109
5110
|
x = y;
|
|
5110
5111
|
break;
|
|
5111
|
-
}
|
|
5112
|
+
}
|
|
5113
|
+
k = x.cmp(y);
|
|
5114
|
+
if (k === n || k === 0 && x.s === n) {
|
|
5112
5115
|
x = y;
|
|
5113
5116
|
}
|
|
5114
5117
|
}
|
|
@@ -5651,24 +5654,35 @@ function clone(obj) {
|
|
|
5651
5654
|
x.d = [v];
|
|
5652
5655
|
}
|
|
5653
5656
|
return;
|
|
5654
|
-
}
|
|
5657
|
+
}
|
|
5658
|
+
if (v * 0 !== 0) {
|
|
5655
5659
|
if (!v) x.s = NaN;
|
|
5656
5660
|
x.e = NaN;
|
|
5657
5661
|
x.d = null;
|
|
5658
5662
|
return;
|
|
5659
5663
|
}
|
|
5660
5664
|
return parseDecimal(x, v.toString());
|
|
5661
|
-
} else if (t !== "string") {
|
|
5662
|
-
throw Error(invalidArgument + v);
|
|
5663
5665
|
}
|
|
5664
|
-
if (
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
|
|
5666
|
+
if (t === "string") {
|
|
5667
|
+
if ((i2 = v.charCodeAt(0)) === 45) {
|
|
5668
|
+
v = v.slice(1);
|
|
5669
|
+
x.s = -1;
|
|
5670
|
+
} else {
|
|
5671
|
+
if (i2 === 43) v = v.slice(1);
|
|
5672
|
+
x.s = 1;
|
|
5673
|
+
}
|
|
5674
|
+
return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);
|
|
5670
5675
|
}
|
|
5671
|
-
|
|
5676
|
+
if (t === "bigint") {
|
|
5677
|
+
if (v < 0) {
|
|
5678
|
+
v = -v;
|
|
5679
|
+
x.s = -1;
|
|
5680
|
+
} else {
|
|
5681
|
+
x.s = 1;
|
|
5682
|
+
}
|
|
5683
|
+
return parseDecimal(x, v.toString());
|
|
5684
|
+
}
|
|
5685
|
+
throw Error(invalidArgument + v);
|
|
5672
5686
|
}
|
|
5673
5687
|
Decimal2.prototype = P;
|
|
5674
5688
|
Decimal2.ROUND_UP = 0;
|
|
@@ -5775,10 +5789,10 @@ function log10(x) {
|
|
|
5775
5789
|
return new this(x).log(10);
|
|
5776
5790
|
}
|
|
5777
5791
|
function max() {
|
|
5778
|
-
return maxOrMin(this, arguments,
|
|
5792
|
+
return maxOrMin(this, arguments, -1);
|
|
5779
5793
|
}
|
|
5780
5794
|
function min() {
|
|
5781
|
-
return maxOrMin(this, arguments,
|
|
5795
|
+
return maxOrMin(this, arguments, 1);
|
|
5782
5796
|
}
|
|
5783
5797
|
function mod(x, y) {
|
|
5784
5798
|
return new this(x).mod(y);
|
|
@@ -8870,7 +8884,7 @@ function recordFirstCoinIndex(paths) {
|
|
|
8870
8884
|
return newCoinRecord;
|
|
8871
8885
|
}
|
|
8872
8886
|
function checkOverlayFeeConfig(overlayFeeRate, overlayFeeReceiver) {
|
|
8873
|
-
if (overlayFeeRate > CLIENT_CONFIG.
|
|
8887
|
+
if (overlayFeeRate > CLIENT_CONFIG.MAX_OVERLAY_FEE_RATE_NUMERATOR) {
|
|
8874
8888
|
throw new Error(CLIENT_CONFIG.ERRORS.INVALID_OVERLAY_FEE_RATE);
|
|
8875
8889
|
}
|
|
8876
8890
|
if (overlayFeeReceiver === "0x0" && overlayFeeRate > 0) {
|
|
@@ -8891,16 +8905,19 @@ var getDefaultSuiInputType = (value) => {
|
|
|
8891
8905
|
if (typeof value === "boolean") {
|
|
8892
8906
|
return "bool";
|
|
8893
8907
|
}
|
|
8894
|
-
throw new
|
|
8908
|
+
throw new AggregatorError(
|
|
8909
|
+
`Unknown type for value: ${value}`,
|
|
8910
|
+
"InvalidType" /* InvalidType */
|
|
8911
|
+
);
|
|
8895
8912
|
};
|
|
8896
8913
|
/*! Bundled license information:
|
|
8897
8914
|
|
|
8898
8915
|
decimal.js/decimal.mjs:
|
|
8899
8916
|
(*!
|
|
8900
|
-
* decimal.js v10.
|
|
8917
|
+
* decimal.js v10.6.0
|
|
8901
8918
|
* An arbitrary-precision Decimal type for JavaScript.
|
|
8902
8919
|
* https://github.com/MikeMcl/decimal.js
|
|
8903
|
-
* Copyright (c)
|
|
8920
|
+
* Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
|
|
8904
8921
|
* MIT Licence
|
|
8905
8922
|
*)
|
|
8906
8923
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cetusprotocol/aggregator-sdk",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-20250909121423",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -16,33 +16,42 @@
|
|
|
16
16
|
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
|
|
17
17
|
"publish:test": "node version.mjs && npm publish --tag experimental"
|
|
18
18
|
},
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
"@types/bn.js": "^5.1.5",
|
|
21
|
-
"@types/bun": "latest",
|
|
22
|
-
"@types/json-bigint": "^1.0.4",
|
|
23
|
-
"bn.js": "^5.2.1",
|
|
24
|
-
"decimal.js": "^10.4.3",
|
|
25
|
-
"tsup": "^8.0.2"
|
|
26
|
-
},
|
|
27
19
|
"peerDependencies": {
|
|
28
20
|
"typescript": "^5.0.0"
|
|
29
21
|
},
|
|
30
22
|
"dependencies": {
|
|
23
|
+
"@mysten/sui": "^1.0.5",
|
|
24
|
+
"@pythnetwork/pyth-sui-js": "^2.1.0",
|
|
25
|
+
"bip39": "^3.1.0",
|
|
26
|
+
"dotenv": "^16.4.5",
|
|
27
|
+
"json-bigint": "^1.0.0",
|
|
28
|
+
"node-fetch": "^3.3.2"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
31
|
"@babel/core": "^7.24.5",
|
|
32
32
|
"@babel/preset-env": "^7.24.5",
|
|
33
33
|
"@babel/preset-typescript": "^7.24.1",
|
|
34
34
|
"@jest/globals": "^29.7.0",
|
|
35
|
-
"@mysten/sui": "^1.0.5",
|
|
36
|
-
"@pythnetwork/pyth-sui-js": "^2.1.0",
|
|
37
35
|
"@types/jest": "^29.5.12",
|
|
38
36
|
"@types/node": "^20.12.12",
|
|
39
37
|
"babel-jest": "^29.7.0",
|
|
40
|
-
"bip39": "^3.1.0",
|
|
41
|
-
"dotenv": "^16.4.5",
|
|
42
38
|
"jest": "^29.7.0",
|
|
43
|
-
"json-bigint": "^1.0.0",
|
|
44
|
-
"node-fetch": "^3.3.2",
|
|
45
39
|
"ts-jest": "^29.1.3",
|
|
46
|
-
"typescript": "^5.0.0"
|
|
40
|
+
"typescript": "^5.0.0",
|
|
41
|
+
"@types/bn.js": "^5.1.5",
|
|
42
|
+
"@types/bun": "latest",
|
|
43
|
+
"@types/json-bigint": "^1.0.4",
|
|
44
|
+
"bn.js": "^5.2.1",
|
|
45
|
+
"decimal.js": "^10.4.3",
|
|
46
|
+
"tsup": "^8.0.2"
|
|
47
|
+
},
|
|
48
|
+
"overrides": {
|
|
49
|
+
"chalk": "5.3.0",
|
|
50
|
+
"strip-ansi": "7.1.0",
|
|
51
|
+
"color-convert": "2.0.1",
|
|
52
|
+
"color-name": "1.1.4",
|
|
53
|
+
"is-core-module": "2.13.1",
|
|
54
|
+
"error-ex": "1.3.2",
|
|
55
|
+
"has-ansi": "5.0.1"
|
|
47
56
|
}
|
|
48
57
|
}
|