@cetusprotocol/aggregator-sdk 1.5.8 → 1.5.9

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 CHANGED
@@ -3416,7 +3416,7 @@ var AGGREGATOR_V3_CONFIG = {
3416
3416
  };
3417
3417
 
3418
3418
  // src/api.ts
3419
- var SDK_VERSION = 1010508;
3419
+ var SDK_VERSION = 1010509;
3420
3420
  function parseRouterResponse(data, byAmountIn) {
3421
3421
  let packages = /* @__PURE__ */ new Map();
3422
3422
  if (data.packages) {
@@ -8325,6 +8325,37 @@ function exportToCSV(comparison) {
8325
8325
  return rows.join("\n");
8326
8326
  }
8327
8327
 
8328
+ // src/utils/gas-budget.ts
8329
+ var SWAP_GAS_BUDGET_TABLE = [
8330
+ { maxCommands: 10, noPyth: 5e7, pyth: 5e7 },
8331
+ { maxCommands: 19, noPyth: 15e7, pyth: 1e8 },
8332
+ { maxCommands: 29, noPyth: 25e7, pyth: 2e8 },
8333
+ { maxCommands: 39, noPyth: 35e7, pyth: 3e8 },
8334
+ { maxCommands: Infinity, noPyth: 5e8, pyth: 5e8 }
8335
+ ];
8336
+ var PYTH_PRELUDE_CALLS = /* @__PURE__ */ new Set([
8337
+ "vaa::parse_and_verify",
8338
+ "pyth::create_authenticated_price_infos_using_accumulator",
8339
+ "pyth::update_single_price_feed",
8340
+ "hot_potato_vector::destroy"
8341
+ ]);
8342
+ function hasPythPrelude(tx) {
8343
+ return tx.getData().commands.some(
8344
+ (command) => command.MoveCall != null && PYTH_PRELUDE_CALLS.has(
8345
+ `${command.MoveCall.module}::${command.MoveCall.function}`
8346
+ )
8347
+ );
8348
+ }
8349
+ function lookupGasBudget(commandCount, hasPyth) {
8350
+ const bucket = SWAP_GAS_BUDGET_TABLE.find(
8351
+ (row) => commandCount <= row.maxCommands
8352
+ );
8353
+ return hasPyth ? bucket.pyth : bucket.noPyth;
8354
+ }
8355
+ function estimateSwapGasBudget(tx) {
8356
+ return lookupGasBudget(tx.getData().commands.length, hasPythPrelude(tx));
8357
+ }
8358
+
8328
8359
  // src/utils/msafe.ts
8329
8360
  var import_bn5 = __toESM(require_bn());
8330
8361
  var dealWithFastRouterSwapParamsForMsafe = (data) => {
@@ -9811,10 +9842,16 @@ var _AggregatorClient = class _AggregatorClient {
9811
9842
  tempMaxAmount = amount2;
9812
9843
  }
9813
9844
  } else {
9814
- const amount2 = new import_bn6.default(eventJson2?.data?.amount_out ?? 0);
9815
- if (amount2.lt(tempMaxAmount)) {
9845
+ const amountOut = new import_bn6.default(eventJson2?.data?.amount_out ?? 0);
9846
+ if (!amountOut.eq(amount)) {
9847
+ continue;
9848
+ }
9849
+ const pureAmountIn2 = new import_bn6.default(eventJson2?.data?.amount_in ?? 0);
9850
+ const feeAmount2 = new import_bn6.default(eventJson2?.data?.fee_amount ?? 0);
9851
+ const totalAmountIn = pureAmountIn2.add(feeAmount2);
9852
+ if (totalAmountIn.lt(tempMaxAmount)) {
9816
9853
  tempIndex = i;
9817
- tempMaxAmount = amount2;
9854
+ tempMaxAmount = totalAmountIn;
9818
9855
  }
9819
9856
  }
9820
9857
  }
@@ -10063,6 +10100,7 @@ exports.PAY_MODULE = PAY_MODULE;
10063
10100
  exports.POOL_MODULT = POOL_MODULT;
10064
10101
  exports.PUBLISHED_ADDRESSES = PUBLISHED_ADDRESSES;
10065
10102
  exports.PYTH_CONFIG = PYTH_CONFIG;
10103
+ exports.PYTH_PRELUDE_CALLS = PYTH_PRELUDE_CALLS;
10066
10104
  exports.REPAY_FLASH_SWAP_A2B_FUNC = REPAY_FLASH_SWAP_A2B_FUNC;
10067
10105
  exports.REPAY_FLASH_SWAP_B2A_FUNC = REPAY_FLASH_SWAP_B2A_FUNC;
10068
10106
  exports.REPAY_FLASH_SWAP_WITH_PARTNER_A2B_FUNC = REPAY_FLASH_SWAP_WITH_PARTNER_A2B_FUNC;
@@ -10079,6 +10117,7 @@ exports.SUILEND = SUILEND;
10079
10117
  exports.SUI_SYSTEM_STATE_OBJECT_ID = SUI_SYSTEM_STATE_OBJECT_ID;
10080
10118
  exports.SWAP_A2B_FUNC = SWAP_A2B_FUNC;
10081
10119
  exports.SWAP_B2A_FUNC = SWAP_B2A_FUNC;
10120
+ exports.SWAP_GAS_BUDGET_TABLE = SWAP_GAS_BUDGET_TABLE;
10082
10121
  exports.SuiZeroCoinFn = SuiZeroCoinFn;
10083
10122
  exports.TEN_POW_NINE = TEN_POW_NINE;
10084
10123
  exports.TESTNET_AFTERMATH_INSURANCE_FUND_ID = TESTNET_AFTERMATH_INSURANCE_FUND_ID;
@@ -10113,6 +10152,7 @@ exports.completionCoin = completionCoin;
10113
10152
  exports.composeType = composeType;
10114
10153
  exports.createTarget = createTarget;
10115
10154
  exports.dealWithFastRouterSwapParamsForMsafe = dealWithFastRouterSwapParamsForMsafe;
10155
+ exports.estimateSwapGasBudget = estimateSwapGasBudget;
10116
10156
  exports.exportToCSV = exportToCSV;
10117
10157
  exports.exportToJSON = exportToJSON;
10118
10158
  exports.extractAddressFromType = extractAddressFromType;
@@ -10135,8 +10175,10 @@ exports.getOrCreateAccountCap = getOrCreateAccountCap;
10135
10175
  exports.getProvidersExcluding = getProvidersExcluding;
10136
10176
  exports.getProvidersIncluding = getProvidersIncluding;
10137
10177
  exports.getRouterResult = getRouterResult;
10178
+ exports.hasPythPrelude = hasPythPrelude;
10138
10179
  exports.isSortedSymbols = isSortedSymbols;
10139
10180
  exports.isValidDowngradeUuid6 = isValidDowngradeUuid6;
10181
+ exports.lookupGasBudget = lookupGasBudget;
10140
10182
  exports.mintZeroCoin = mintZeroCoin;
10141
10183
  exports.normalizeCoinType = normalizeCoinType;
10142
10184
  exports.parseAftermathFeeType = parseAftermathFeeType;
package/dist/index.d.cts CHANGED
@@ -786,6 +786,49 @@ declare function exportToJSON(comparison: ComparisonResult): string;
786
786
  */
787
787
  declare function exportToCSV(comparison: ComparisonResult): string;
788
788
 
789
+ /**
790
+ * Fixed gas budget table for SDK-generated swap PTBs, bucketed by command
791
+ * count and whether the PTB contains a Pyth oracle prelude.
792
+ *
793
+ * Values are in MIST (1 SUI = 1e9 MIST). Each bucket's budget is at least 2x
794
+ * the worst observed `required_gas_floor` across 15504 replayed mainnet
795
+ * router transactions (validated 2026-06), and holds up to a 10x increase of
796
+ * the reference gas price.
797
+ */
798
+ declare const SWAP_GAS_BUDGET_TABLE: ReadonlyArray<{
799
+ maxCommands: number;
800
+ noPyth: number;
801
+ pyth: number;
802
+ }>;
803
+ /**
804
+ * `module::function` pairs of the Pyth oracle prelude calls emitted by the
805
+ * SDK (see src/pyth/adapter.ts). Matched without the package id since Pyth /
806
+ * Wormhole package ids change across upgrades.
807
+ */
808
+ declare const PYTH_PRELUDE_CALLS: ReadonlySet<string>;
809
+ /**
810
+ * Whether the transaction contains a Pyth oracle prelude (price feed update)
811
+ * emitted by the SDK.
812
+ */
813
+ declare function hasPythPrelude(tx: Transaction): boolean;
814
+ /**
815
+ * Look up the fixed gas budget (in MIST) for a swap PTB with the given
816
+ * command count and Pyth flag.
817
+ */
818
+ declare function lookupGasBudget(commandCount: number, hasPyth: boolean): number;
819
+ /**
820
+ * Estimate the gas budget (in MIST) for a built swap transaction, using a
821
+ * fixed table bucketed by command count and Pyth prelude presence — no RPC
822
+ * call needed. Usage: `tx.setGasBudget(estimateSwapGasBudget(tx))`.
823
+ *
824
+ * Only valid for swap PTBs generated by this SDK (router context + DEX
825
+ * swaps + optional Pyth prelude). If you append calls with unbounded storage
826
+ * costs (flashloans, LP zaps, position management, lending, ...), dry-run
827
+ * the transaction instead or add your own margin. Note the gas coin balance
828
+ * must be >= the budget, even though only the actual gas used is charged.
829
+ */
830
+ declare function estimateSwapGasBudget(tx: Transaction): number;
831
+
789
832
  declare const dealWithFastRouterSwapParamsForMsafe: (data: any) => any;
790
833
  declare const restituteMsafeFastRouterSwapParams: (data: any) => any;
791
834
 
@@ -1134,4 +1177,4 @@ declare class CoinUtils {
1134
1177
  static calculateTotalBalance(coins: CoinAsset[]): bigint;
1135
1178
  }
1136
1179
 
1137
- export { AFSUI, AFTERMATH, AFTERMATH_AMM, AFTERMATH_MODULE, AGGREGATOR, AGGREGATOR_V3_CONFIG, ALL_DEXES, ALPHAFI, AggregatorClient, type AggregatorClientParams, AggregatorConfig, AggregatorError, type AggregatorErrorCode, type AggregatorResponse, AggregatorServerErrorCode, BLUEFIN, BLUEMOVE, BOLT, type BigNumber, type BuildCoinResult, type BuildFastMergeSwapParams, type BuildFastRouterSwapParams, type BuildFastRouterSwapParamsV2, type BuildFastRouterSwapParamsV3, type BuildMergeSwapParams, type BuildRouterSwapParams, type BuildRouterSwapParamsV2, type BuildRouterSwapParamsV3, CETUS, CETUSDLMM, CETUS_DEX, CETUS_MODULE, CETUS_PUBLISHED_AT, CHECK_COINS_THRESHOLD_FUNC, CLIENT_CONFIG, CLOCK_ADDRESS, type CoinAsset, CoinInfoAddress, CoinStoreAddress, CoinUtils, type ComparisonResult, ConfigErrorCode, DEEPBOOKV2, DEEPBOOKV3, DEEPBOOK_CLOB_V2_MODULE, DEEPBOOK_CUSTODIAN_V2_MODULE, DEEPBOOK_DEX, DEEPBOOK_MODULE, DEEPBOOK_PACKAGE_ID, DEEPBOOK_PUBLISHED_AT, DEEPBOOK_V3_DEEP_FEE_TYPES, DEFAULT_AGG_V2_ENDPOINT, DEFAULT_AGG_V3_ENDPOINT, DEFAULT_ENDPOINT, DEFAULT_GAS_BUDGET_FOR_MERGE, DEFAULT_GAS_BUDGET_FOR_SPLIT, DEFAULT_GAS_BUDGET_FOR_STAKE, DEFAULT_GAS_BUDGET_FOR_TRANSFER, DEFAULT_GAS_BUDGET_FOR_TRANSFER_SUI, DEFAULT_NFT_TRANSFER_GAS_FEE, type DeepbookV3Config, type DeepbookV3ConfigResponse, type Dex, Env, type ExtendedDetails, FERRACLMM, FERRADLMM, FLOWXV2, FLOWXV3, FLOWX_AMM, FLOWX_AMM_MODULE, FULLSAIL, type FindRouterParams, FlashSwapA2BFunc, FlashSwapB2AFunc, FlashSwapFunc, FlashSwapWithPartnerA2BFunc, FlashSwapWithPartnerB2AFunc, FlashSwapWithPartnerFunc, type FlattenedPath, GAS_SYMBOL, GAS_TYPE_ARG, GAS_TYPE_ARG_LONG, type GasMetrics, type GetOrCreateAccountCapResult, HAEDAL, HAEDALHMMV2, HAEDALPMM, HAEDALPROPAMM, HAWAL, INTEGRATE, JOIN_FUNC, KRIYA, KRIYAV3, KRIYA_DEX, KRIYA_MODULE, MAGMA, MAGMAPROPAMM, MAINNET_AFTERMATH_INSURANCE_FUND_ID, MAINNET_AFTERMATH_PROTOCOL_FEE_VAULT_ID, MAINNET_AFTERMATH_REFERRAL_VAULT_ID, MAINNET_AFTERMATH_REGISTRY_ID, MAINNET_AFTERMATH_TREASURY_ID, MAINNET_CETUS_V3_PUBLISHED_AT, MAINNET_FLOWX_AMM_CONTAINER_ID, METASTABLE, MOMENTUM, type MergeRoute, type MergeSwapFromCoin, type MergeSwapInputCoin, type MergeSwapParams, type MergeSwapRouterData, type NFT, OBRIC, ONE, PACKAGE_NAMES, PAY_MODULE, POOL_MODULT, PUBLISHED_ADDRESSES, PYTH_CONFIG, type Package, type Path, type PathV2, type PreSwapLpChangeParams, type ProcessedRouterData, type PythConfig, REPAY_FLASH_SWAP_A2B_FUNC, REPAY_FLASH_SWAP_B2A_FUNC, REPAY_FLASH_SWAP_WITH_PARTNER_A2B_FUNC, REPAY_FLASH_SWAP_WITH_PARTNER_B2A_FUNC, RepayFalshSwapFunc, RepayFlashSwapWithPartnerFunc, type Router, type RouterData, type RouterDataV2, type RouterDataV3, type RouterError, type RouterV2, SCALLOP, SEVENK, SPRINGSUI, STEAMM, STEAMM_OMM, STEAMM_OMM_V2, SUILEND, SUI_SYSTEM_STATE_OBJECT_ID, SWAP_A2B_FUNC, SWAP_B2A_FUNC, type SimulateTransactionResult, type SuiAddress, type SuiBasicTypes, type SuiInputTypes, type SuiMoveObject, type SuiObjectIdType, type SuiResource, type SuiStructTag, type SuiTxArg, SuiZeroCoinFn, type SwapGasAnalysis, type SwapInPoolsParams, type SwapInPoolsResultV3, TEN_POW_NINE, TESTNET_AFTERMATH_INSURANCE_FUND_ID, TESTNET_AFTERMATH_PROTOCOL_FEE_VAULT_ID, TESTNET_AFTERMATH_REFERRAL_VAULT_ID, TESTNET_AFTERMATH_REGISTRY_ID, TESTNET_AFTERMATH_TREASURY_ID, TESTNET_CETUS_V3_PUBLISHED_AT, TESTNET_FLOWX_AMM_CONTAINER_ID, TRANSFER_ACCOUNT_CAP, TRANSFER_OR_DESTORY_COIN_FUNC, TURBOS, TURBOS_DEX, TURBOS_MODULE, TURBOS_VERSIONED, TWO, TransactionErrorCode, TypesErrorCode, U128, U64_MAX, U64_MAX_BN, UTILS_MODULE, VOLO, ZERO, buildInputCoin, calculateGasEfficiency, calculatePriceImpact, checkInvalidSuiAddress, compareCoins, compareGasMetrics, completionCoin, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, exportToCSV, exportToJSON, extractAddressFromType, extractGasMetrics, extractStructTagFromType, extractTimestampFromDowngradeUuid6, fixSuiObjectId, formatGasMetrics, generateDowngradeUuid6, generateSimpleDowngradeUuid6, getAggregatorServerErrorMessage, getAggregatorV2Extend2PublishedAt, getAggregatorV2ExtendPublishedAt, getAggregatorV2PublishedAt, getAllProviders, getDeepbookV3Config, getDefaultSuiInputType, getMergeSwapResult, getOrCreateAccountCap, getProvidersExcluding, getProvidersIncluding, getRouterResult, isSortedSymbols, isValidDowngradeUuid6, mintZeroCoin, normalizeCoinType, parseAftermathFeeType, parseTurbosPoolFeeType, patchFixSuiObjectId, printTransaction, processEndpoint, processFlattenRoutes, restituteMsafeFastRouterSwapParams };
1180
+ export { AFSUI, AFTERMATH, AFTERMATH_AMM, AFTERMATH_MODULE, AGGREGATOR, AGGREGATOR_V3_CONFIG, ALL_DEXES, ALPHAFI, AggregatorClient, type AggregatorClientParams, AggregatorConfig, AggregatorError, type AggregatorErrorCode, type AggregatorResponse, AggregatorServerErrorCode, BLUEFIN, BLUEMOVE, BOLT, type BigNumber, type BuildCoinResult, type BuildFastMergeSwapParams, type BuildFastRouterSwapParams, type BuildFastRouterSwapParamsV2, type BuildFastRouterSwapParamsV3, type BuildMergeSwapParams, type BuildRouterSwapParams, type BuildRouterSwapParamsV2, type BuildRouterSwapParamsV3, CETUS, CETUSDLMM, CETUS_DEX, CETUS_MODULE, CETUS_PUBLISHED_AT, CHECK_COINS_THRESHOLD_FUNC, CLIENT_CONFIG, CLOCK_ADDRESS, type CoinAsset, CoinInfoAddress, CoinStoreAddress, CoinUtils, type ComparisonResult, ConfigErrorCode, DEEPBOOKV2, DEEPBOOKV3, DEEPBOOK_CLOB_V2_MODULE, DEEPBOOK_CUSTODIAN_V2_MODULE, DEEPBOOK_DEX, DEEPBOOK_MODULE, DEEPBOOK_PACKAGE_ID, DEEPBOOK_PUBLISHED_AT, DEEPBOOK_V3_DEEP_FEE_TYPES, DEFAULT_AGG_V2_ENDPOINT, DEFAULT_AGG_V3_ENDPOINT, DEFAULT_ENDPOINT, DEFAULT_GAS_BUDGET_FOR_MERGE, DEFAULT_GAS_BUDGET_FOR_SPLIT, DEFAULT_GAS_BUDGET_FOR_STAKE, DEFAULT_GAS_BUDGET_FOR_TRANSFER, DEFAULT_GAS_BUDGET_FOR_TRANSFER_SUI, DEFAULT_NFT_TRANSFER_GAS_FEE, type DeepbookV3Config, type DeepbookV3ConfigResponse, type Dex, Env, type ExtendedDetails, FERRACLMM, FERRADLMM, FLOWXV2, FLOWXV3, FLOWX_AMM, FLOWX_AMM_MODULE, FULLSAIL, type FindRouterParams, FlashSwapA2BFunc, FlashSwapB2AFunc, FlashSwapFunc, FlashSwapWithPartnerA2BFunc, FlashSwapWithPartnerB2AFunc, FlashSwapWithPartnerFunc, type FlattenedPath, GAS_SYMBOL, GAS_TYPE_ARG, GAS_TYPE_ARG_LONG, type GasMetrics, type GetOrCreateAccountCapResult, HAEDAL, HAEDALHMMV2, HAEDALPMM, HAEDALPROPAMM, HAWAL, INTEGRATE, JOIN_FUNC, KRIYA, KRIYAV3, KRIYA_DEX, KRIYA_MODULE, MAGMA, MAGMAPROPAMM, MAINNET_AFTERMATH_INSURANCE_FUND_ID, MAINNET_AFTERMATH_PROTOCOL_FEE_VAULT_ID, MAINNET_AFTERMATH_REFERRAL_VAULT_ID, MAINNET_AFTERMATH_REGISTRY_ID, MAINNET_AFTERMATH_TREASURY_ID, MAINNET_CETUS_V3_PUBLISHED_AT, MAINNET_FLOWX_AMM_CONTAINER_ID, METASTABLE, MOMENTUM, type MergeRoute, type MergeSwapFromCoin, type MergeSwapInputCoin, type MergeSwapParams, type MergeSwapRouterData, type NFT, OBRIC, ONE, PACKAGE_NAMES, PAY_MODULE, POOL_MODULT, PUBLISHED_ADDRESSES, PYTH_CONFIG, PYTH_PRELUDE_CALLS, type Package, type Path, type PathV2, type PreSwapLpChangeParams, type ProcessedRouterData, type PythConfig, REPAY_FLASH_SWAP_A2B_FUNC, REPAY_FLASH_SWAP_B2A_FUNC, REPAY_FLASH_SWAP_WITH_PARTNER_A2B_FUNC, REPAY_FLASH_SWAP_WITH_PARTNER_B2A_FUNC, RepayFalshSwapFunc, RepayFlashSwapWithPartnerFunc, type Router, type RouterData, type RouterDataV2, type RouterDataV3, type RouterError, type RouterV2, SCALLOP, SEVENK, SPRINGSUI, STEAMM, STEAMM_OMM, STEAMM_OMM_V2, SUILEND, SUI_SYSTEM_STATE_OBJECT_ID, SWAP_A2B_FUNC, SWAP_B2A_FUNC, SWAP_GAS_BUDGET_TABLE, type SimulateTransactionResult, type SuiAddress, type SuiBasicTypes, type SuiInputTypes, type SuiMoveObject, type SuiObjectIdType, type SuiResource, type SuiStructTag, type SuiTxArg, SuiZeroCoinFn, type SwapGasAnalysis, type SwapInPoolsParams, type SwapInPoolsResultV3, TEN_POW_NINE, TESTNET_AFTERMATH_INSURANCE_FUND_ID, TESTNET_AFTERMATH_PROTOCOL_FEE_VAULT_ID, TESTNET_AFTERMATH_REFERRAL_VAULT_ID, TESTNET_AFTERMATH_REGISTRY_ID, TESTNET_AFTERMATH_TREASURY_ID, TESTNET_CETUS_V3_PUBLISHED_AT, TESTNET_FLOWX_AMM_CONTAINER_ID, TRANSFER_ACCOUNT_CAP, TRANSFER_OR_DESTORY_COIN_FUNC, TURBOS, TURBOS_DEX, TURBOS_MODULE, TURBOS_VERSIONED, TWO, TransactionErrorCode, TypesErrorCode, U128, U64_MAX, U64_MAX_BN, UTILS_MODULE, VOLO, ZERO, buildInputCoin, calculateGasEfficiency, calculatePriceImpact, checkInvalidSuiAddress, compareCoins, compareGasMetrics, completionCoin, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, estimateSwapGasBudget, exportToCSV, exportToJSON, extractAddressFromType, extractGasMetrics, extractStructTagFromType, extractTimestampFromDowngradeUuid6, fixSuiObjectId, formatGasMetrics, generateDowngradeUuid6, generateSimpleDowngradeUuid6, getAggregatorServerErrorMessage, getAggregatorV2Extend2PublishedAt, getAggregatorV2ExtendPublishedAt, getAggregatorV2PublishedAt, getAllProviders, getDeepbookV3Config, getDefaultSuiInputType, getMergeSwapResult, getOrCreateAccountCap, getProvidersExcluding, getProvidersIncluding, getRouterResult, hasPythPrelude, isSortedSymbols, isValidDowngradeUuid6, lookupGasBudget, mintZeroCoin, normalizeCoinType, parseAftermathFeeType, parseTurbosPoolFeeType, patchFixSuiObjectId, printTransaction, processEndpoint, processFlattenRoutes, restituteMsafeFastRouterSwapParams };
package/dist/index.d.ts CHANGED
@@ -786,6 +786,49 @@ declare function exportToJSON(comparison: ComparisonResult): string;
786
786
  */
787
787
  declare function exportToCSV(comparison: ComparisonResult): string;
788
788
 
789
+ /**
790
+ * Fixed gas budget table for SDK-generated swap PTBs, bucketed by command
791
+ * count and whether the PTB contains a Pyth oracle prelude.
792
+ *
793
+ * Values are in MIST (1 SUI = 1e9 MIST). Each bucket's budget is at least 2x
794
+ * the worst observed `required_gas_floor` across 15504 replayed mainnet
795
+ * router transactions (validated 2026-06), and holds up to a 10x increase of
796
+ * the reference gas price.
797
+ */
798
+ declare const SWAP_GAS_BUDGET_TABLE: ReadonlyArray<{
799
+ maxCommands: number;
800
+ noPyth: number;
801
+ pyth: number;
802
+ }>;
803
+ /**
804
+ * `module::function` pairs of the Pyth oracle prelude calls emitted by the
805
+ * SDK (see src/pyth/adapter.ts). Matched without the package id since Pyth /
806
+ * Wormhole package ids change across upgrades.
807
+ */
808
+ declare const PYTH_PRELUDE_CALLS: ReadonlySet<string>;
809
+ /**
810
+ * Whether the transaction contains a Pyth oracle prelude (price feed update)
811
+ * emitted by the SDK.
812
+ */
813
+ declare function hasPythPrelude(tx: Transaction): boolean;
814
+ /**
815
+ * Look up the fixed gas budget (in MIST) for a swap PTB with the given
816
+ * command count and Pyth flag.
817
+ */
818
+ declare function lookupGasBudget(commandCount: number, hasPyth: boolean): number;
819
+ /**
820
+ * Estimate the gas budget (in MIST) for a built swap transaction, using a
821
+ * fixed table bucketed by command count and Pyth prelude presence — no RPC
822
+ * call needed. Usage: `tx.setGasBudget(estimateSwapGasBudget(tx))`.
823
+ *
824
+ * Only valid for swap PTBs generated by this SDK (router context + DEX
825
+ * swaps + optional Pyth prelude). If you append calls with unbounded storage
826
+ * costs (flashloans, LP zaps, position management, lending, ...), dry-run
827
+ * the transaction instead or add your own margin. Note the gas coin balance
828
+ * must be >= the budget, even though only the actual gas used is charged.
829
+ */
830
+ declare function estimateSwapGasBudget(tx: Transaction): number;
831
+
789
832
  declare const dealWithFastRouterSwapParamsForMsafe: (data: any) => any;
790
833
  declare const restituteMsafeFastRouterSwapParams: (data: any) => any;
791
834
 
@@ -1134,4 +1177,4 @@ declare class CoinUtils {
1134
1177
  static calculateTotalBalance(coins: CoinAsset[]): bigint;
1135
1178
  }
1136
1179
 
1137
- export { AFSUI, AFTERMATH, AFTERMATH_AMM, AFTERMATH_MODULE, AGGREGATOR, AGGREGATOR_V3_CONFIG, ALL_DEXES, ALPHAFI, AggregatorClient, type AggregatorClientParams, AggregatorConfig, AggregatorError, type AggregatorErrorCode, type AggregatorResponse, AggregatorServerErrorCode, BLUEFIN, BLUEMOVE, BOLT, type BigNumber, type BuildCoinResult, type BuildFastMergeSwapParams, type BuildFastRouterSwapParams, type BuildFastRouterSwapParamsV2, type BuildFastRouterSwapParamsV3, type BuildMergeSwapParams, type BuildRouterSwapParams, type BuildRouterSwapParamsV2, type BuildRouterSwapParamsV3, CETUS, CETUSDLMM, CETUS_DEX, CETUS_MODULE, CETUS_PUBLISHED_AT, CHECK_COINS_THRESHOLD_FUNC, CLIENT_CONFIG, CLOCK_ADDRESS, type CoinAsset, CoinInfoAddress, CoinStoreAddress, CoinUtils, type ComparisonResult, ConfigErrorCode, DEEPBOOKV2, DEEPBOOKV3, DEEPBOOK_CLOB_V2_MODULE, DEEPBOOK_CUSTODIAN_V2_MODULE, DEEPBOOK_DEX, DEEPBOOK_MODULE, DEEPBOOK_PACKAGE_ID, DEEPBOOK_PUBLISHED_AT, DEEPBOOK_V3_DEEP_FEE_TYPES, DEFAULT_AGG_V2_ENDPOINT, DEFAULT_AGG_V3_ENDPOINT, DEFAULT_ENDPOINT, DEFAULT_GAS_BUDGET_FOR_MERGE, DEFAULT_GAS_BUDGET_FOR_SPLIT, DEFAULT_GAS_BUDGET_FOR_STAKE, DEFAULT_GAS_BUDGET_FOR_TRANSFER, DEFAULT_GAS_BUDGET_FOR_TRANSFER_SUI, DEFAULT_NFT_TRANSFER_GAS_FEE, type DeepbookV3Config, type DeepbookV3ConfigResponse, type Dex, Env, type ExtendedDetails, FERRACLMM, FERRADLMM, FLOWXV2, FLOWXV3, FLOWX_AMM, FLOWX_AMM_MODULE, FULLSAIL, type FindRouterParams, FlashSwapA2BFunc, FlashSwapB2AFunc, FlashSwapFunc, FlashSwapWithPartnerA2BFunc, FlashSwapWithPartnerB2AFunc, FlashSwapWithPartnerFunc, type FlattenedPath, GAS_SYMBOL, GAS_TYPE_ARG, GAS_TYPE_ARG_LONG, type GasMetrics, type GetOrCreateAccountCapResult, HAEDAL, HAEDALHMMV2, HAEDALPMM, HAEDALPROPAMM, HAWAL, INTEGRATE, JOIN_FUNC, KRIYA, KRIYAV3, KRIYA_DEX, KRIYA_MODULE, MAGMA, MAGMAPROPAMM, MAINNET_AFTERMATH_INSURANCE_FUND_ID, MAINNET_AFTERMATH_PROTOCOL_FEE_VAULT_ID, MAINNET_AFTERMATH_REFERRAL_VAULT_ID, MAINNET_AFTERMATH_REGISTRY_ID, MAINNET_AFTERMATH_TREASURY_ID, MAINNET_CETUS_V3_PUBLISHED_AT, MAINNET_FLOWX_AMM_CONTAINER_ID, METASTABLE, MOMENTUM, type MergeRoute, type MergeSwapFromCoin, type MergeSwapInputCoin, type MergeSwapParams, type MergeSwapRouterData, type NFT, OBRIC, ONE, PACKAGE_NAMES, PAY_MODULE, POOL_MODULT, PUBLISHED_ADDRESSES, PYTH_CONFIG, type Package, type Path, type PathV2, type PreSwapLpChangeParams, type ProcessedRouterData, type PythConfig, REPAY_FLASH_SWAP_A2B_FUNC, REPAY_FLASH_SWAP_B2A_FUNC, REPAY_FLASH_SWAP_WITH_PARTNER_A2B_FUNC, REPAY_FLASH_SWAP_WITH_PARTNER_B2A_FUNC, RepayFalshSwapFunc, RepayFlashSwapWithPartnerFunc, type Router, type RouterData, type RouterDataV2, type RouterDataV3, type RouterError, type RouterV2, SCALLOP, SEVENK, SPRINGSUI, STEAMM, STEAMM_OMM, STEAMM_OMM_V2, SUILEND, SUI_SYSTEM_STATE_OBJECT_ID, SWAP_A2B_FUNC, SWAP_B2A_FUNC, type SimulateTransactionResult, type SuiAddress, type SuiBasicTypes, type SuiInputTypes, type SuiMoveObject, type SuiObjectIdType, type SuiResource, type SuiStructTag, type SuiTxArg, SuiZeroCoinFn, type SwapGasAnalysis, type SwapInPoolsParams, type SwapInPoolsResultV3, TEN_POW_NINE, TESTNET_AFTERMATH_INSURANCE_FUND_ID, TESTNET_AFTERMATH_PROTOCOL_FEE_VAULT_ID, TESTNET_AFTERMATH_REFERRAL_VAULT_ID, TESTNET_AFTERMATH_REGISTRY_ID, TESTNET_AFTERMATH_TREASURY_ID, TESTNET_CETUS_V3_PUBLISHED_AT, TESTNET_FLOWX_AMM_CONTAINER_ID, TRANSFER_ACCOUNT_CAP, TRANSFER_OR_DESTORY_COIN_FUNC, TURBOS, TURBOS_DEX, TURBOS_MODULE, TURBOS_VERSIONED, TWO, TransactionErrorCode, TypesErrorCode, U128, U64_MAX, U64_MAX_BN, UTILS_MODULE, VOLO, ZERO, buildInputCoin, calculateGasEfficiency, calculatePriceImpact, checkInvalidSuiAddress, compareCoins, compareGasMetrics, completionCoin, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, exportToCSV, exportToJSON, extractAddressFromType, extractGasMetrics, extractStructTagFromType, extractTimestampFromDowngradeUuid6, fixSuiObjectId, formatGasMetrics, generateDowngradeUuid6, generateSimpleDowngradeUuid6, getAggregatorServerErrorMessage, getAggregatorV2Extend2PublishedAt, getAggregatorV2ExtendPublishedAt, getAggregatorV2PublishedAt, getAllProviders, getDeepbookV3Config, getDefaultSuiInputType, getMergeSwapResult, getOrCreateAccountCap, getProvidersExcluding, getProvidersIncluding, getRouterResult, isSortedSymbols, isValidDowngradeUuid6, mintZeroCoin, normalizeCoinType, parseAftermathFeeType, parseTurbosPoolFeeType, patchFixSuiObjectId, printTransaction, processEndpoint, processFlattenRoutes, restituteMsafeFastRouterSwapParams };
1180
+ export { AFSUI, AFTERMATH, AFTERMATH_AMM, AFTERMATH_MODULE, AGGREGATOR, AGGREGATOR_V3_CONFIG, ALL_DEXES, ALPHAFI, AggregatorClient, type AggregatorClientParams, AggregatorConfig, AggregatorError, type AggregatorErrorCode, type AggregatorResponse, AggregatorServerErrorCode, BLUEFIN, BLUEMOVE, BOLT, type BigNumber, type BuildCoinResult, type BuildFastMergeSwapParams, type BuildFastRouterSwapParams, type BuildFastRouterSwapParamsV2, type BuildFastRouterSwapParamsV3, type BuildMergeSwapParams, type BuildRouterSwapParams, type BuildRouterSwapParamsV2, type BuildRouterSwapParamsV3, CETUS, CETUSDLMM, CETUS_DEX, CETUS_MODULE, CETUS_PUBLISHED_AT, CHECK_COINS_THRESHOLD_FUNC, CLIENT_CONFIG, CLOCK_ADDRESS, type CoinAsset, CoinInfoAddress, CoinStoreAddress, CoinUtils, type ComparisonResult, ConfigErrorCode, DEEPBOOKV2, DEEPBOOKV3, DEEPBOOK_CLOB_V2_MODULE, DEEPBOOK_CUSTODIAN_V2_MODULE, DEEPBOOK_DEX, DEEPBOOK_MODULE, DEEPBOOK_PACKAGE_ID, DEEPBOOK_PUBLISHED_AT, DEEPBOOK_V3_DEEP_FEE_TYPES, DEFAULT_AGG_V2_ENDPOINT, DEFAULT_AGG_V3_ENDPOINT, DEFAULT_ENDPOINT, DEFAULT_GAS_BUDGET_FOR_MERGE, DEFAULT_GAS_BUDGET_FOR_SPLIT, DEFAULT_GAS_BUDGET_FOR_STAKE, DEFAULT_GAS_BUDGET_FOR_TRANSFER, DEFAULT_GAS_BUDGET_FOR_TRANSFER_SUI, DEFAULT_NFT_TRANSFER_GAS_FEE, type DeepbookV3Config, type DeepbookV3ConfigResponse, type Dex, Env, type ExtendedDetails, FERRACLMM, FERRADLMM, FLOWXV2, FLOWXV3, FLOWX_AMM, FLOWX_AMM_MODULE, FULLSAIL, type FindRouterParams, FlashSwapA2BFunc, FlashSwapB2AFunc, FlashSwapFunc, FlashSwapWithPartnerA2BFunc, FlashSwapWithPartnerB2AFunc, FlashSwapWithPartnerFunc, type FlattenedPath, GAS_SYMBOL, GAS_TYPE_ARG, GAS_TYPE_ARG_LONG, type GasMetrics, type GetOrCreateAccountCapResult, HAEDAL, HAEDALHMMV2, HAEDALPMM, HAEDALPROPAMM, HAWAL, INTEGRATE, JOIN_FUNC, KRIYA, KRIYAV3, KRIYA_DEX, KRIYA_MODULE, MAGMA, MAGMAPROPAMM, MAINNET_AFTERMATH_INSURANCE_FUND_ID, MAINNET_AFTERMATH_PROTOCOL_FEE_VAULT_ID, MAINNET_AFTERMATH_REFERRAL_VAULT_ID, MAINNET_AFTERMATH_REGISTRY_ID, MAINNET_AFTERMATH_TREASURY_ID, MAINNET_CETUS_V3_PUBLISHED_AT, MAINNET_FLOWX_AMM_CONTAINER_ID, METASTABLE, MOMENTUM, type MergeRoute, type MergeSwapFromCoin, type MergeSwapInputCoin, type MergeSwapParams, type MergeSwapRouterData, type NFT, OBRIC, ONE, PACKAGE_NAMES, PAY_MODULE, POOL_MODULT, PUBLISHED_ADDRESSES, PYTH_CONFIG, PYTH_PRELUDE_CALLS, type Package, type Path, type PathV2, type PreSwapLpChangeParams, type ProcessedRouterData, type PythConfig, REPAY_FLASH_SWAP_A2B_FUNC, REPAY_FLASH_SWAP_B2A_FUNC, REPAY_FLASH_SWAP_WITH_PARTNER_A2B_FUNC, REPAY_FLASH_SWAP_WITH_PARTNER_B2A_FUNC, RepayFalshSwapFunc, RepayFlashSwapWithPartnerFunc, type Router, type RouterData, type RouterDataV2, type RouterDataV3, type RouterError, type RouterV2, SCALLOP, SEVENK, SPRINGSUI, STEAMM, STEAMM_OMM, STEAMM_OMM_V2, SUILEND, SUI_SYSTEM_STATE_OBJECT_ID, SWAP_A2B_FUNC, SWAP_B2A_FUNC, SWAP_GAS_BUDGET_TABLE, type SimulateTransactionResult, type SuiAddress, type SuiBasicTypes, type SuiInputTypes, type SuiMoveObject, type SuiObjectIdType, type SuiResource, type SuiStructTag, type SuiTxArg, SuiZeroCoinFn, type SwapGasAnalysis, type SwapInPoolsParams, type SwapInPoolsResultV3, TEN_POW_NINE, TESTNET_AFTERMATH_INSURANCE_FUND_ID, TESTNET_AFTERMATH_PROTOCOL_FEE_VAULT_ID, TESTNET_AFTERMATH_REFERRAL_VAULT_ID, TESTNET_AFTERMATH_REGISTRY_ID, TESTNET_AFTERMATH_TREASURY_ID, TESTNET_CETUS_V3_PUBLISHED_AT, TESTNET_FLOWX_AMM_CONTAINER_ID, TRANSFER_ACCOUNT_CAP, TRANSFER_OR_DESTORY_COIN_FUNC, TURBOS, TURBOS_DEX, TURBOS_MODULE, TURBOS_VERSIONED, TWO, TransactionErrorCode, TypesErrorCode, U128, U64_MAX, U64_MAX_BN, UTILS_MODULE, VOLO, ZERO, buildInputCoin, calculateGasEfficiency, calculatePriceImpact, checkInvalidSuiAddress, compareCoins, compareGasMetrics, completionCoin, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, estimateSwapGasBudget, exportToCSV, exportToJSON, extractAddressFromType, extractGasMetrics, extractStructTagFromType, extractTimestampFromDowngradeUuid6, fixSuiObjectId, formatGasMetrics, generateDowngradeUuid6, generateSimpleDowngradeUuid6, getAggregatorServerErrorMessage, getAggregatorV2Extend2PublishedAt, getAggregatorV2ExtendPublishedAt, getAggregatorV2PublishedAt, getAllProviders, getDeepbookV3Config, getDefaultSuiInputType, getMergeSwapResult, getOrCreateAccountCap, getProvidersExcluding, getProvidersIncluding, getRouterResult, hasPythPrelude, isSortedSymbols, isValidDowngradeUuid6, lookupGasBudget, mintZeroCoin, normalizeCoinType, parseAftermathFeeType, parseTurbosPoolFeeType, patchFixSuiObjectId, printTransaction, processEndpoint, processFlattenRoutes, restituteMsafeFastRouterSwapParams };
package/dist/index.js CHANGED
@@ -3410,7 +3410,7 @@ var AGGREGATOR_V3_CONFIG = {
3410
3410
  };
3411
3411
 
3412
3412
  // src/api.ts
3413
- var SDK_VERSION = 1010508;
3413
+ var SDK_VERSION = 1010509;
3414
3414
  function parseRouterResponse(data, byAmountIn) {
3415
3415
  let packages = /* @__PURE__ */ new Map();
3416
3416
  if (data.packages) {
@@ -8319,6 +8319,37 @@ function exportToCSV(comparison) {
8319
8319
  return rows.join("\n");
8320
8320
  }
8321
8321
 
8322
+ // src/utils/gas-budget.ts
8323
+ var SWAP_GAS_BUDGET_TABLE = [
8324
+ { maxCommands: 10, noPyth: 5e7, pyth: 5e7 },
8325
+ { maxCommands: 19, noPyth: 15e7, pyth: 1e8 },
8326
+ { maxCommands: 29, noPyth: 25e7, pyth: 2e8 },
8327
+ { maxCommands: 39, noPyth: 35e7, pyth: 3e8 },
8328
+ { maxCommands: Infinity, noPyth: 5e8, pyth: 5e8 }
8329
+ ];
8330
+ var PYTH_PRELUDE_CALLS = /* @__PURE__ */ new Set([
8331
+ "vaa::parse_and_verify",
8332
+ "pyth::create_authenticated_price_infos_using_accumulator",
8333
+ "pyth::update_single_price_feed",
8334
+ "hot_potato_vector::destroy"
8335
+ ]);
8336
+ function hasPythPrelude(tx) {
8337
+ return tx.getData().commands.some(
8338
+ (command) => command.MoveCall != null && PYTH_PRELUDE_CALLS.has(
8339
+ `${command.MoveCall.module}::${command.MoveCall.function}`
8340
+ )
8341
+ );
8342
+ }
8343
+ function lookupGasBudget(commandCount, hasPyth) {
8344
+ const bucket = SWAP_GAS_BUDGET_TABLE.find(
8345
+ (row) => commandCount <= row.maxCommands
8346
+ );
8347
+ return hasPyth ? bucket.pyth : bucket.noPyth;
8348
+ }
8349
+ function estimateSwapGasBudget(tx) {
8350
+ return lookupGasBudget(tx.getData().commands.length, hasPythPrelude(tx));
8351
+ }
8352
+
8322
8353
  // src/utils/msafe.ts
8323
8354
  var import_bn5 = __toESM(require_bn());
8324
8355
  var dealWithFastRouterSwapParamsForMsafe = (data) => {
@@ -9805,10 +9836,16 @@ var _AggregatorClient = class _AggregatorClient {
9805
9836
  tempMaxAmount = amount2;
9806
9837
  }
9807
9838
  } else {
9808
- const amount2 = new import_bn6.default(eventJson2?.data?.amount_out ?? 0);
9809
- if (amount2.lt(tempMaxAmount)) {
9839
+ const amountOut = new import_bn6.default(eventJson2?.data?.amount_out ?? 0);
9840
+ if (!amountOut.eq(amount)) {
9841
+ continue;
9842
+ }
9843
+ const pureAmountIn2 = new import_bn6.default(eventJson2?.data?.amount_in ?? 0);
9844
+ const feeAmount2 = new import_bn6.default(eventJson2?.data?.fee_amount ?? 0);
9845
+ const totalAmountIn = pureAmountIn2.add(feeAmount2);
9846
+ if (totalAmountIn.lt(tempMaxAmount)) {
9810
9847
  tempIndex = i;
9811
- tempMaxAmount = amount2;
9848
+ tempMaxAmount = totalAmountIn;
9812
9849
  }
9813
9850
  }
9814
9851
  }
@@ -9966,4 +10003,4 @@ decimal.js/decimal.mjs:
9966
10003
  *)
9967
10004
  */
9968
10005
 
9969
- export { AFSUI, AFTERMATH, AFTERMATH_AMM, AFTERMATH_MODULE, AGGREGATOR, AGGREGATOR_V3_CONFIG, ALL_DEXES, ALPHAFI, AggregatorClient, AggregatorConfig, AggregatorError, AggregatorServerErrorCode, BLUEFIN, BLUEMOVE, BOLT, CETUS, CETUSDLMM, CETUS_DEX, CETUS_MODULE, CETUS_PUBLISHED_AT, CHECK_COINS_THRESHOLD_FUNC, CLIENT_CONFIG, CLOCK_ADDRESS, CoinInfoAddress, CoinStoreAddress, CoinUtils, ConfigErrorCode, DEEPBOOKV2, DEEPBOOKV3, DEEPBOOK_CLOB_V2_MODULE, DEEPBOOK_CUSTODIAN_V2_MODULE, DEEPBOOK_DEX, DEEPBOOK_MODULE, DEEPBOOK_PACKAGE_ID, DEEPBOOK_PUBLISHED_AT, DEEPBOOK_V3_DEEP_FEE_TYPES, DEFAULT_AGG_V2_ENDPOINT, DEFAULT_AGG_V3_ENDPOINT, DEFAULT_ENDPOINT, DEFAULT_GAS_BUDGET_FOR_MERGE, DEFAULT_GAS_BUDGET_FOR_SPLIT, DEFAULT_GAS_BUDGET_FOR_STAKE, DEFAULT_GAS_BUDGET_FOR_TRANSFER, DEFAULT_GAS_BUDGET_FOR_TRANSFER_SUI, DEFAULT_NFT_TRANSFER_GAS_FEE, Env, FERRACLMM, FERRADLMM, FLOWXV2, FLOWXV3, FLOWX_AMM, FLOWX_AMM_MODULE, FULLSAIL, FlashSwapA2BFunc, FlashSwapB2AFunc, FlashSwapFunc, FlashSwapWithPartnerA2BFunc, FlashSwapWithPartnerB2AFunc, FlashSwapWithPartnerFunc, GAS_SYMBOL, GAS_TYPE_ARG, GAS_TYPE_ARG_LONG, HAEDAL, HAEDALHMMV2, HAEDALPMM, HAEDALPROPAMM, HAWAL, INTEGRATE, JOIN_FUNC, KRIYA, KRIYAV3, KRIYA_DEX, KRIYA_MODULE, MAGMA, MAGMAPROPAMM, MAINNET_AFTERMATH_INSURANCE_FUND_ID, MAINNET_AFTERMATH_PROTOCOL_FEE_VAULT_ID, MAINNET_AFTERMATH_REFERRAL_VAULT_ID, MAINNET_AFTERMATH_REGISTRY_ID, MAINNET_AFTERMATH_TREASURY_ID, MAINNET_CETUS_V3_PUBLISHED_AT, MAINNET_FLOWX_AMM_CONTAINER_ID, METASTABLE, MOMENTUM, OBRIC, ONE, PACKAGE_NAMES, PAY_MODULE, POOL_MODULT, PUBLISHED_ADDRESSES, PYTH_CONFIG, REPAY_FLASH_SWAP_A2B_FUNC, REPAY_FLASH_SWAP_B2A_FUNC, REPAY_FLASH_SWAP_WITH_PARTNER_A2B_FUNC, REPAY_FLASH_SWAP_WITH_PARTNER_B2A_FUNC, RepayFalshSwapFunc, RepayFlashSwapWithPartnerFunc, SCALLOP, SEVENK, SPRINGSUI, STEAMM, STEAMM_OMM, STEAMM_OMM_V2, SUILEND, SUI_SYSTEM_STATE_OBJECT_ID, SWAP_A2B_FUNC, SWAP_B2A_FUNC, SuiZeroCoinFn, TEN_POW_NINE, TESTNET_AFTERMATH_INSURANCE_FUND_ID, TESTNET_AFTERMATH_PROTOCOL_FEE_VAULT_ID, TESTNET_AFTERMATH_REFERRAL_VAULT_ID, TESTNET_AFTERMATH_REGISTRY_ID, TESTNET_AFTERMATH_TREASURY_ID, TESTNET_CETUS_V3_PUBLISHED_AT, TESTNET_FLOWX_AMM_CONTAINER_ID, TRANSFER_ACCOUNT_CAP, TRANSFER_OR_DESTORY_COIN_FUNC, TURBOS, TURBOS_DEX, TURBOS_MODULE, TURBOS_VERSIONED, TWO, TransactionErrorCode, TypesErrorCode, U128, U64_MAX, U64_MAX_BN, UTILS_MODULE, VOLO, ZERO, buildInputCoin, calculateGasEfficiency, calculatePriceImpact, checkInvalidSuiAddress, compareCoins, compareGasMetrics, completionCoin, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, exportToCSV, exportToJSON, extractAddressFromType, extractGasMetrics, extractStructTagFromType, extractTimestampFromDowngradeUuid6, fixSuiObjectId, formatGasMetrics, generateDowngradeUuid6, generateSimpleDowngradeUuid6, getAggregatorServerErrorMessage, getAggregatorV2Extend2PublishedAt, getAggregatorV2ExtendPublishedAt, getAggregatorV2PublishedAt, getAllProviders, getDeepbookV3Config, getDefaultSuiInputType, getMergeSwapResult, getOrCreateAccountCap, getProvidersExcluding, getProvidersIncluding, getRouterResult, isSortedSymbols, isValidDowngradeUuid6, mintZeroCoin, normalizeCoinType, parseAftermathFeeType, parseTurbosPoolFeeType, patchFixSuiObjectId, printTransaction, processEndpoint, processFlattenRoutes, restituteMsafeFastRouterSwapParams };
10006
+ export { AFSUI, AFTERMATH, AFTERMATH_AMM, AFTERMATH_MODULE, AGGREGATOR, AGGREGATOR_V3_CONFIG, ALL_DEXES, ALPHAFI, AggregatorClient, AggregatorConfig, AggregatorError, AggregatorServerErrorCode, BLUEFIN, BLUEMOVE, BOLT, CETUS, CETUSDLMM, CETUS_DEX, CETUS_MODULE, CETUS_PUBLISHED_AT, CHECK_COINS_THRESHOLD_FUNC, CLIENT_CONFIG, CLOCK_ADDRESS, CoinInfoAddress, CoinStoreAddress, CoinUtils, ConfigErrorCode, DEEPBOOKV2, DEEPBOOKV3, DEEPBOOK_CLOB_V2_MODULE, DEEPBOOK_CUSTODIAN_V2_MODULE, DEEPBOOK_DEX, DEEPBOOK_MODULE, DEEPBOOK_PACKAGE_ID, DEEPBOOK_PUBLISHED_AT, DEEPBOOK_V3_DEEP_FEE_TYPES, DEFAULT_AGG_V2_ENDPOINT, DEFAULT_AGG_V3_ENDPOINT, DEFAULT_ENDPOINT, DEFAULT_GAS_BUDGET_FOR_MERGE, DEFAULT_GAS_BUDGET_FOR_SPLIT, DEFAULT_GAS_BUDGET_FOR_STAKE, DEFAULT_GAS_BUDGET_FOR_TRANSFER, DEFAULT_GAS_BUDGET_FOR_TRANSFER_SUI, DEFAULT_NFT_TRANSFER_GAS_FEE, Env, FERRACLMM, FERRADLMM, FLOWXV2, FLOWXV3, FLOWX_AMM, FLOWX_AMM_MODULE, FULLSAIL, FlashSwapA2BFunc, FlashSwapB2AFunc, FlashSwapFunc, FlashSwapWithPartnerA2BFunc, FlashSwapWithPartnerB2AFunc, FlashSwapWithPartnerFunc, GAS_SYMBOL, GAS_TYPE_ARG, GAS_TYPE_ARG_LONG, HAEDAL, HAEDALHMMV2, HAEDALPMM, HAEDALPROPAMM, HAWAL, INTEGRATE, JOIN_FUNC, KRIYA, KRIYAV3, KRIYA_DEX, KRIYA_MODULE, MAGMA, MAGMAPROPAMM, MAINNET_AFTERMATH_INSURANCE_FUND_ID, MAINNET_AFTERMATH_PROTOCOL_FEE_VAULT_ID, MAINNET_AFTERMATH_REFERRAL_VAULT_ID, MAINNET_AFTERMATH_REGISTRY_ID, MAINNET_AFTERMATH_TREASURY_ID, MAINNET_CETUS_V3_PUBLISHED_AT, MAINNET_FLOWX_AMM_CONTAINER_ID, METASTABLE, MOMENTUM, OBRIC, ONE, PACKAGE_NAMES, PAY_MODULE, POOL_MODULT, PUBLISHED_ADDRESSES, PYTH_CONFIG, PYTH_PRELUDE_CALLS, REPAY_FLASH_SWAP_A2B_FUNC, REPAY_FLASH_SWAP_B2A_FUNC, REPAY_FLASH_SWAP_WITH_PARTNER_A2B_FUNC, REPAY_FLASH_SWAP_WITH_PARTNER_B2A_FUNC, RepayFalshSwapFunc, RepayFlashSwapWithPartnerFunc, SCALLOP, SEVENK, SPRINGSUI, STEAMM, STEAMM_OMM, STEAMM_OMM_V2, SUILEND, SUI_SYSTEM_STATE_OBJECT_ID, SWAP_A2B_FUNC, SWAP_B2A_FUNC, SWAP_GAS_BUDGET_TABLE, SuiZeroCoinFn, TEN_POW_NINE, TESTNET_AFTERMATH_INSURANCE_FUND_ID, TESTNET_AFTERMATH_PROTOCOL_FEE_VAULT_ID, TESTNET_AFTERMATH_REFERRAL_VAULT_ID, TESTNET_AFTERMATH_REGISTRY_ID, TESTNET_AFTERMATH_TREASURY_ID, TESTNET_CETUS_V3_PUBLISHED_AT, TESTNET_FLOWX_AMM_CONTAINER_ID, TRANSFER_ACCOUNT_CAP, TRANSFER_OR_DESTORY_COIN_FUNC, TURBOS, TURBOS_DEX, TURBOS_MODULE, TURBOS_VERSIONED, TWO, TransactionErrorCode, TypesErrorCode, U128, U64_MAX, U64_MAX_BN, UTILS_MODULE, VOLO, ZERO, buildInputCoin, calculateGasEfficiency, calculatePriceImpact, checkInvalidSuiAddress, compareCoins, compareGasMetrics, completionCoin, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, estimateSwapGasBudget, exportToCSV, exportToJSON, extractAddressFromType, extractGasMetrics, extractStructTagFromType, extractTimestampFromDowngradeUuid6, fixSuiObjectId, formatGasMetrics, generateDowngradeUuid6, generateSimpleDowngradeUuid6, getAggregatorServerErrorMessage, getAggregatorV2Extend2PublishedAt, getAggregatorV2ExtendPublishedAt, getAggregatorV2PublishedAt, getAllProviders, getDeepbookV3Config, getDefaultSuiInputType, getMergeSwapResult, getOrCreateAccountCap, getProvidersExcluding, getProvidersIncluding, getRouterResult, hasPythPrelude, isSortedSymbols, isValidDowngradeUuid6, lookupGasBudget, mintZeroCoin, normalizeCoinType, parseAftermathFeeType, parseTurbosPoolFeeType, patchFixSuiObjectId, printTransaction, processEndpoint, processFlattenRoutes, restituteMsafeFastRouterSwapParams };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cetusprotocol/aggregator-sdk",
3
- "version": "1.5.8",
3
+ "version": "1.5.9",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "main": "dist/index.js",