@cetusprotocol/aggregator-sdk 1.4.5 → 1.4.6

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.
@@ -1,9 +1,8 @@
1
- import * as _mysten_sui_client from '@mysten/sui/client';
2
- import { SuiClient, DevInspectResults, SuiMoveObject } from '@mysten/sui/client';
1
+ import * as _mysten_sui_jsonRpc from '@mysten/sui/jsonRpc';
2
+ import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
3
3
  import { TransactionObjectArgument, Transaction, TransactionArgument } from '@mysten/sui/transactions';
4
4
  import BN from 'bn.js';
5
5
  import Decimal from 'decimal.js';
6
- import { SuiPriceServiceConnection, SuiPythClient } from '@pythnetwork/pyth-sui-js';
7
6
  import { Signer } from '@mysten/sui/cryptography';
8
7
 
9
8
  interface FindRouterParams {
@@ -119,10 +118,15 @@ type ExtendedDetails = {
119
118
  obric_coin_b_price_seed?: string;
120
119
  obric_coin_a_price_id?: string;
121
120
  obric_coin_b_price_id?: string;
121
+ /** @deprecated SevenK DEX is no longer active. */
122
122
  sevenk_coin_a_price_seed?: string;
123
+ /** @deprecated SevenK DEX is no longer active. */
123
124
  sevenk_coin_b_price_seed?: string;
125
+ /** @deprecated SevenK DEX is no longer active. */
124
126
  sevenk_oracle_config_a?: string;
127
+ /** @deprecated SevenK DEX is no longer active. */
125
128
  sevenk_oracle_config_b?: string;
129
+ /** @deprecated SevenK DEX is no longer active. */
126
130
  sevenk_lp_cap_type?: string;
127
131
  };
128
132
  type Path = {
@@ -286,6 +290,35 @@ interface DexRouter {
286
290
  swap(txb: Transaction, flattenedPath: FlattenedPath, swapContext: TransactionObjectArgument, _extends?: Extends): void;
287
291
  }
288
292
 
293
+ type ObjectId = string;
294
+ interface PriceTableInfo {
295
+ id: ObjectId;
296
+ fieldType: string;
297
+ }
298
+ declare class PythAdapter {
299
+ private client;
300
+ private hermesClients;
301
+ private pythStateId;
302
+ private wormholeStateId;
303
+ private pythPackageId;
304
+ private wormholePackageId;
305
+ private priceTableInfo;
306
+ private priceFeedObjectIdCache;
307
+ private baseUpdateFee;
308
+ constructor(client: SuiJsonRpcClient, pythStateId: ObjectId, wormholeStateId: ObjectId, hermesUrls: string[]);
309
+ getPriceFeedsUpdateData(priceIDs: string[]): Promise<Buffer[]>;
310
+ getBaseUpdateFee(): Promise<number>;
311
+ getPackageId(objectId: ObjectId): Promise<string>;
312
+ getWormholePackageId(): Promise<string>;
313
+ getPythPackageId(): Promise<string>;
314
+ getPriceFeedObjectId(feedId: string): Promise<string | undefined>;
315
+ getPriceTableInfo(): Promise<PriceTableInfo>;
316
+ extractVaaBytesFromAccumulatorMessage(accumulatorMessage: Buffer): Buffer;
317
+ private verifyVaas;
318
+ private verifyVaasAndGetHotPotato;
319
+ updatePriceFeeds(tx: Transaction, updates: Buffer[], feedIds: string[]): Promise<ObjectId[]>;
320
+ }
321
+
289
322
  declare const CETUS = "CETUS";
290
323
  declare const DEEPBOOKV2 = "DEEPBOOK";
291
324
  declare const KRIYA = "KRIYA";
@@ -313,6 +346,7 @@ declare const STEAMM_OMM = "STEAMM_OMM";
313
346
  declare const MOMENTUM = "MOMENTUM";
314
347
  declare const STEAMM_OMM_V2 = "STEAMM_OMM_V2";
315
348
  declare const MAGMA = "MAGMA";
349
+ /** @deprecated SevenK DEX is no longer active. Will be removed in a future version. */
316
350
  declare const SEVENK = "SEVENK";
317
351
  declare const HAEDALHMMV2 = "HAEDALHMMV2";
318
352
  declare const FULLSAIL = "FULLSAIL";
@@ -365,7 +399,7 @@ declare function getProvidersIncluding(includeProviders: string[]): string[];
365
399
  type AggregatorClientParams = {
366
400
  endpoint?: string;
367
401
  signer?: string;
368
- client?: SuiClient;
402
+ client?: SuiJsonRpcClient;
369
403
  env?: Env;
370
404
  pythUrls?: string[];
371
405
  apiKey?: string;
@@ -377,18 +411,16 @@ type AggregatorClientParams = {
377
411
  declare class AggregatorClient {
378
412
  endpoint: string;
379
413
  signer: string;
380
- client: SuiClient;
414
+ client: SuiJsonRpcClient;
381
415
  env: Env;
382
416
  apiKey: string;
383
- protected pythConnections: SuiPriceServiceConnection[];
384
- protected pythClient: SuiPythClient;
417
+ protected pythAdapter: PythAdapter;
385
418
  protected overlayFeeRate: number;
386
419
  protected overlayFeeReceiver: string;
387
420
  protected partner?: string;
388
421
  protected cetusDlmmPartner?: string;
389
422
  private static readonly CONFIG;
390
423
  constructor(params: AggregatorClientParams);
391
- newPythClients(pythUrls: string[]): SuiPriceServiceConnection[];
392
424
  deepbookv3DeepFeeType(): string;
393
425
  getDeepbookV3Config(): Promise<DeepbookV3ConfigResponse | null>;
394
426
  getOneCoinUsedToMerge(coinType: string): Promise<string | null>;
@@ -421,8 +453,8 @@ declare class AggregatorClient {
421
453
  fixableRouterSwapV3(params: BuildRouterSwapParamsV3): Promise<TransactionObjectArgument>;
422
454
  swapInPools(params: SwapInPoolsParams): Promise<SwapInPoolsResultV3>;
423
455
  updatePythPriceIDs(priceIDs: string[], txb: Transaction): Promise<Map<string, string>>;
424
- devInspectTransactionBlock(txb: Transaction): Promise<_mysten_sui_client.DevInspectResults>;
425
- sendTransaction(txb: Transaction, signer: Signer): Promise<_mysten_sui_client.SuiTransactionBlockResponse>;
456
+ devInspectTransactionBlock(txb: Transaction): Promise<_mysten_sui_jsonRpc.DevInspectResults>;
457
+ sendTransaction(txb: Transaction, signer: Signer): Promise<_mysten_sui_jsonRpc.SuiTransactionBlockResponse>;
426
458
  }
427
459
 
428
460
  /**
@@ -455,7 +487,7 @@ type GetOrCreateAccountCapResult = {
455
487
  accountCap: TransactionObjectArgument;
456
488
  isCreate: boolean;
457
489
  };
458
- declare function getOrCreateAccountCap(txb: Transaction, client: SuiClient, owner: string): Promise<GetOrCreateAccountCapResult>;
490
+ declare function getOrCreateAccountCap(txb: Transaction, client: SuiJsonRpcClient, owner: string): Promise<GetOrCreateAccountCapResult>;
459
491
 
460
492
  /**
461
493
  * Represents a SUI address, which is a string.
@@ -604,6 +636,25 @@ interface Dex {
604
636
  swap(client: AggregatorClient, ptb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>, deepbookv3DeepFee?: TransactionObjectArgument): Promise<TransactionObjectArgument>;
605
637
  }
606
638
 
639
+ /**
640
+ * Matches the shape of DevInspectResults from JSON-RPC.
641
+ * Using a local type so gas.ts can be used without importing the full SDK.
642
+ */
643
+ type SimulateTransactionResult = {
644
+ effects: {
645
+ status: {
646
+ status: 'success' | 'failure';
647
+ error?: string;
648
+ };
649
+ gasUsed: {
650
+ computationCost: string;
651
+ storageCost: string;
652
+ storageRebate: string;
653
+ nonRefundableStorageFee: string;
654
+ };
655
+ };
656
+ error?: string | null;
657
+ };
607
658
  interface GasMetrics {
608
659
  computationCost: string;
609
660
  storageCost: string;
@@ -641,9 +692,9 @@ interface ComparisonResult {
641
692
  };
642
693
  }
643
694
  /**
644
- * Extract gas metrics from DevInspectResults
695
+ * Extract gas metrics from a simulateTransaction result.
645
696
  */
646
- declare function extractGasMetrics(result: DevInspectResults): GasMetrics;
697
+ declare function extractGasMetrics(result: SimulateTransactionResult): GasMetrics;
647
698
  /**
648
699
  * Calculate gas efficiency (amount out per gas unit)
649
700
  */
@@ -891,6 +942,11 @@ interface PythConfig {
891
942
  pythStateId: string;
892
943
  }
893
944
 
945
+ interface SuiMoveObject {
946
+ type: string;
947
+ fields: Record<string, unknown>;
948
+ }
949
+
894
950
  declare const DEFAULT_GAS_BUDGET_FOR_SPLIT = 1000;
895
951
  declare const DEFAULT_GAS_BUDGET_FOR_MERGE = 500;
896
952
  declare const DEFAULT_GAS_BUDGET_FOR_TRANSFER = 100;
@@ -1012,4 +1068,4 @@ declare class CoinUtils {
1012
1068
  static calculateTotalBalance(coins: CoinAsset[]): bigint;
1013
1069
  }
1014
1070
 
1015
- 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, 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, HAWAL, INTEGRATE, JOIN_FUNC, KRIYA, KRIYAV3, KRIYA_DEX, KRIYA_MODULE, MAGMA, 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 SuiAddress, type SuiBasicTypes, type SuiInputTypes, 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 };
1071
+ 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, 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, HAWAL, INTEGRATE, JOIN_FUNC, KRIYA, KRIYAV3, KRIYA_DEX, KRIYA_MODULE, MAGMA, 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 };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,8 @@
1
- import * as _mysten_sui_client from '@mysten/sui/client';
2
- import { SuiClient, DevInspectResults, SuiMoveObject } from '@mysten/sui/client';
1
+ import * as _mysten_sui_jsonRpc from '@mysten/sui/jsonRpc';
2
+ import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
3
3
  import { TransactionObjectArgument, Transaction, TransactionArgument } from '@mysten/sui/transactions';
4
4
  import BN from 'bn.js';
5
5
  import Decimal from 'decimal.js';
6
- import { SuiPriceServiceConnection, SuiPythClient } from '@pythnetwork/pyth-sui-js';
7
6
  import { Signer } from '@mysten/sui/cryptography';
8
7
 
9
8
  interface FindRouterParams {
@@ -119,10 +118,15 @@ type ExtendedDetails = {
119
118
  obric_coin_b_price_seed?: string;
120
119
  obric_coin_a_price_id?: string;
121
120
  obric_coin_b_price_id?: string;
121
+ /** @deprecated SevenK DEX is no longer active. */
122
122
  sevenk_coin_a_price_seed?: string;
123
+ /** @deprecated SevenK DEX is no longer active. */
123
124
  sevenk_coin_b_price_seed?: string;
125
+ /** @deprecated SevenK DEX is no longer active. */
124
126
  sevenk_oracle_config_a?: string;
127
+ /** @deprecated SevenK DEX is no longer active. */
125
128
  sevenk_oracle_config_b?: string;
129
+ /** @deprecated SevenK DEX is no longer active. */
126
130
  sevenk_lp_cap_type?: string;
127
131
  };
128
132
  type Path = {
@@ -286,6 +290,35 @@ interface DexRouter {
286
290
  swap(txb: Transaction, flattenedPath: FlattenedPath, swapContext: TransactionObjectArgument, _extends?: Extends): void;
287
291
  }
288
292
 
293
+ type ObjectId = string;
294
+ interface PriceTableInfo {
295
+ id: ObjectId;
296
+ fieldType: string;
297
+ }
298
+ declare class PythAdapter {
299
+ private client;
300
+ private hermesClients;
301
+ private pythStateId;
302
+ private wormholeStateId;
303
+ private pythPackageId;
304
+ private wormholePackageId;
305
+ private priceTableInfo;
306
+ private priceFeedObjectIdCache;
307
+ private baseUpdateFee;
308
+ constructor(client: SuiJsonRpcClient, pythStateId: ObjectId, wormholeStateId: ObjectId, hermesUrls: string[]);
309
+ getPriceFeedsUpdateData(priceIDs: string[]): Promise<Buffer[]>;
310
+ getBaseUpdateFee(): Promise<number>;
311
+ getPackageId(objectId: ObjectId): Promise<string>;
312
+ getWormholePackageId(): Promise<string>;
313
+ getPythPackageId(): Promise<string>;
314
+ getPriceFeedObjectId(feedId: string): Promise<string | undefined>;
315
+ getPriceTableInfo(): Promise<PriceTableInfo>;
316
+ extractVaaBytesFromAccumulatorMessage(accumulatorMessage: Buffer): Buffer;
317
+ private verifyVaas;
318
+ private verifyVaasAndGetHotPotato;
319
+ updatePriceFeeds(tx: Transaction, updates: Buffer[], feedIds: string[]): Promise<ObjectId[]>;
320
+ }
321
+
289
322
  declare const CETUS = "CETUS";
290
323
  declare const DEEPBOOKV2 = "DEEPBOOK";
291
324
  declare const KRIYA = "KRIYA";
@@ -313,6 +346,7 @@ declare const STEAMM_OMM = "STEAMM_OMM";
313
346
  declare const MOMENTUM = "MOMENTUM";
314
347
  declare const STEAMM_OMM_V2 = "STEAMM_OMM_V2";
315
348
  declare const MAGMA = "MAGMA";
349
+ /** @deprecated SevenK DEX is no longer active. Will be removed in a future version. */
316
350
  declare const SEVENK = "SEVENK";
317
351
  declare const HAEDALHMMV2 = "HAEDALHMMV2";
318
352
  declare const FULLSAIL = "FULLSAIL";
@@ -365,7 +399,7 @@ declare function getProvidersIncluding(includeProviders: string[]): string[];
365
399
  type AggregatorClientParams = {
366
400
  endpoint?: string;
367
401
  signer?: string;
368
- client?: SuiClient;
402
+ client?: SuiJsonRpcClient;
369
403
  env?: Env;
370
404
  pythUrls?: string[];
371
405
  apiKey?: string;
@@ -377,18 +411,16 @@ type AggregatorClientParams = {
377
411
  declare class AggregatorClient {
378
412
  endpoint: string;
379
413
  signer: string;
380
- client: SuiClient;
414
+ client: SuiJsonRpcClient;
381
415
  env: Env;
382
416
  apiKey: string;
383
- protected pythConnections: SuiPriceServiceConnection[];
384
- protected pythClient: SuiPythClient;
417
+ protected pythAdapter: PythAdapter;
385
418
  protected overlayFeeRate: number;
386
419
  protected overlayFeeReceiver: string;
387
420
  protected partner?: string;
388
421
  protected cetusDlmmPartner?: string;
389
422
  private static readonly CONFIG;
390
423
  constructor(params: AggregatorClientParams);
391
- newPythClients(pythUrls: string[]): SuiPriceServiceConnection[];
392
424
  deepbookv3DeepFeeType(): string;
393
425
  getDeepbookV3Config(): Promise<DeepbookV3ConfigResponse | null>;
394
426
  getOneCoinUsedToMerge(coinType: string): Promise<string | null>;
@@ -421,8 +453,8 @@ declare class AggregatorClient {
421
453
  fixableRouterSwapV3(params: BuildRouterSwapParamsV3): Promise<TransactionObjectArgument>;
422
454
  swapInPools(params: SwapInPoolsParams): Promise<SwapInPoolsResultV3>;
423
455
  updatePythPriceIDs(priceIDs: string[], txb: Transaction): Promise<Map<string, string>>;
424
- devInspectTransactionBlock(txb: Transaction): Promise<_mysten_sui_client.DevInspectResults>;
425
- sendTransaction(txb: Transaction, signer: Signer): Promise<_mysten_sui_client.SuiTransactionBlockResponse>;
456
+ devInspectTransactionBlock(txb: Transaction): Promise<_mysten_sui_jsonRpc.DevInspectResults>;
457
+ sendTransaction(txb: Transaction, signer: Signer): Promise<_mysten_sui_jsonRpc.SuiTransactionBlockResponse>;
426
458
  }
427
459
 
428
460
  /**
@@ -455,7 +487,7 @@ type GetOrCreateAccountCapResult = {
455
487
  accountCap: TransactionObjectArgument;
456
488
  isCreate: boolean;
457
489
  };
458
- declare function getOrCreateAccountCap(txb: Transaction, client: SuiClient, owner: string): Promise<GetOrCreateAccountCapResult>;
490
+ declare function getOrCreateAccountCap(txb: Transaction, client: SuiJsonRpcClient, owner: string): Promise<GetOrCreateAccountCapResult>;
459
491
 
460
492
  /**
461
493
  * Represents a SUI address, which is a string.
@@ -604,6 +636,25 @@ interface Dex {
604
636
  swap(client: AggregatorClient, ptb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>, deepbookv3DeepFee?: TransactionObjectArgument): Promise<TransactionObjectArgument>;
605
637
  }
606
638
 
639
+ /**
640
+ * Matches the shape of DevInspectResults from JSON-RPC.
641
+ * Using a local type so gas.ts can be used without importing the full SDK.
642
+ */
643
+ type SimulateTransactionResult = {
644
+ effects: {
645
+ status: {
646
+ status: 'success' | 'failure';
647
+ error?: string;
648
+ };
649
+ gasUsed: {
650
+ computationCost: string;
651
+ storageCost: string;
652
+ storageRebate: string;
653
+ nonRefundableStorageFee: string;
654
+ };
655
+ };
656
+ error?: string | null;
657
+ };
607
658
  interface GasMetrics {
608
659
  computationCost: string;
609
660
  storageCost: string;
@@ -641,9 +692,9 @@ interface ComparisonResult {
641
692
  };
642
693
  }
643
694
  /**
644
- * Extract gas metrics from DevInspectResults
695
+ * Extract gas metrics from a simulateTransaction result.
645
696
  */
646
- declare function extractGasMetrics(result: DevInspectResults): GasMetrics;
697
+ declare function extractGasMetrics(result: SimulateTransactionResult): GasMetrics;
647
698
  /**
648
699
  * Calculate gas efficiency (amount out per gas unit)
649
700
  */
@@ -891,6 +942,11 @@ interface PythConfig {
891
942
  pythStateId: string;
892
943
  }
893
944
 
945
+ interface SuiMoveObject {
946
+ type: string;
947
+ fields: Record<string, unknown>;
948
+ }
949
+
894
950
  declare const DEFAULT_GAS_BUDGET_FOR_SPLIT = 1000;
895
951
  declare const DEFAULT_GAS_BUDGET_FOR_MERGE = 500;
896
952
  declare const DEFAULT_GAS_BUDGET_FOR_TRANSFER = 100;
@@ -1012,4 +1068,4 @@ declare class CoinUtils {
1012
1068
  static calculateTotalBalance(coins: CoinAsset[]): bigint;
1013
1069
  }
1014
1070
 
1015
- 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, 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, HAWAL, INTEGRATE, JOIN_FUNC, KRIYA, KRIYAV3, KRIYA_DEX, KRIYA_MODULE, MAGMA, 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 SuiAddress, type SuiBasicTypes, type SuiInputTypes, 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 };
1071
+ 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, 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, HAWAL, INTEGRATE, JOIN_FUNC, KRIYA, KRIYAV3, KRIYA_DEX, KRIYA_MODULE, MAGMA, 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 };