@cetusprotocol/aggregator-sdk 1.5.4 → 1.5.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.
package/dist/index.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
  var transactions = require('@mysten/sui/transactions');
4
4
  var JSONbig = require('json-bigint');
5
5
  var utils = require('@mysten/sui/utils');
6
- var jsonRpc = require('@mysten/sui/jsonRpc');
6
+ var grpc = require('@mysten/sui/grpc');
7
7
  var hermesClient = require('@pythnetwork/hermes-client');
8
8
  var bcs = require('@mysten/sui/bcs');
9
9
 
@@ -43,9 +43,9 @@ var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__
43
43
  mod2
44
44
  ));
45
45
 
46
- // node_modules/.pnpm/bn.js@5.2.3/node_modules/bn.js/lib/bn.js
46
+ // node_modules/bn.js/lib/bn.js
47
47
  var require_bn = __commonJS({
48
- "node_modules/.pnpm/bn.js@5.2.3/node_modules/bn.js/lib/bn.js"(exports$1, module) {
48
+ "node_modules/bn.js/lib/bn.js"(exports, module) {
49
49
  (function(module2, exports2) {
50
50
  function assert(val, msg) {
51
51
  if (!val) throw new Error(msg || "Assertion failed");
@@ -351,7 +351,7 @@ var require_bn = __commonJS({
351
351
  };
352
352
  if (typeof Symbol !== "undefined" && typeof Symbol.for === "function") {
353
353
  try {
354
- BN7.prototype[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")] = inspect;
354
+ BN7.prototype[Symbol.for("nodejs.util.inspect.custom")] = inspect;
355
355
  } catch (e) {
356
356
  BN7.prototype.inspect = inspect;
357
357
  }
@@ -1768,10 +1768,6 @@ var require_bn = __commonJS({
1768
1768
  var mask = 67108863 ^ 67108863 >>> r << r;
1769
1769
  this.words[this.length - 1] &= mask;
1770
1770
  }
1771
- if (this.length === 0) {
1772
- this.words[0] = 0;
1773
- this.length = 1;
1774
- }
1775
1771
  return this._strip();
1776
1772
  };
1777
1773
  BN7.prototype.maskn = function maskn(bits) {
@@ -2787,7 +2783,7 @@ var require_bn = __commonJS({
2787
2783
  var res = this.imod(a._invmp(this.m).mul(this.r2));
2788
2784
  return res._forceRed(this);
2789
2785
  };
2790
- })(typeof module === "undefined" || module, exports$1);
2786
+ })(typeof module === "undefined" || module, exports);
2791
2787
  }
2792
2788
  });
2793
2789
 
@@ -3420,7 +3416,7 @@ var AGGREGATOR_V3_CONFIG = {
3420
3416
  };
3421
3417
 
3422
3418
  // src/api.ts
3423
- var SDK_VERSION = 1010504;
3419
+ var SDK_VERSION = 1010505;
3424
3420
  function parseRouterResponse(data, byAmountIn) {
3425
3421
  let packages = /* @__PURE__ */ new Map();
3426
3422
  if (data.packages) {
@@ -3856,7 +3852,7 @@ var AggregatorConfig = class {
3856
3852
  // src/math.ts
3857
3853
  var import_bn3 = __toESM(require_bn());
3858
3854
 
3859
- // node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.mjs
3855
+ // node_modules/decimal.js/decimal.mjs
3860
3856
  var EXP_LIMIT = 9e15;
3861
3857
  var MAX_DIGITS = 1e9;
3862
3858
  var NUMERALS = "0123456789abcdef";
@@ -6025,7 +6021,7 @@ function tanh(x) {
6025
6021
  function trunc(x) {
6026
6022
  return finalise(x = new this(x), x.e + 1, 1);
6027
6023
  }
6028
- P[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")] = P.toString;
6024
+ P[Symbol.for("nodejs.util.inspect.custom")] = P.toString;
6029
6025
  P[Symbol.toStringTag] = "Decimal";
6030
6026
  var Decimal = P.constructor = clone(DEFAULTS);
6031
6027
  LN10 = new Decimal(LN10);
@@ -7861,12 +7857,11 @@ var PythAdapter = class {
7861
7857
  if (this.baseUpdateFee !== void 0) {
7862
7858
  return this.baseUpdateFee;
7863
7859
  }
7864
- const res = await this.client.getObject({
7865
- id: this.pythStateId,
7866
- options: { showContent: true }
7860
+ const { object } = await this.client.getObject({
7861
+ objectId: this.pythStateId,
7862
+ include: { json: true }
7867
7863
  });
7868
- const content = res.data?.content;
7869
- const json = content && "fields" in content ? content.fields : null;
7864
+ const json = object.json;
7870
7865
  if (!json) {
7871
7866
  throw new Error("Unable to fetch pyth state object");
7872
7867
  }
@@ -7874,21 +7869,16 @@ var PythAdapter = class {
7874
7869
  return this.baseUpdateFee;
7875
7870
  }
7876
7871
  async getPackageId(objectId) {
7877
- const res = await this.client.getObject({
7878
- id: objectId,
7879
- options: { showContent: true }
7872
+ const { object } = await this.client.getObject({
7873
+ objectId,
7874
+ include: { json: true }
7880
7875
  });
7881
- const content = res.data?.content;
7882
- const json = content && "fields" in content ? content.fields : null;
7876
+ const json = object.json;
7883
7877
  if (!json) {
7884
7878
  throw new Error(`Cannot fetch package id for object ${objectId}`);
7885
7879
  }
7886
7880
  if ("upgrade_cap" in json) {
7887
- const upgradeCap = json.upgrade_cap;
7888
- const packageId = upgradeCap?.fields?.package;
7889
- if (typeof packageId === "string") {
7890
- return packageId;
7891
- }
7881
+ return json.upgrade_cap.package;
7892
7882
  }
7893
7883
  throw new Error("upgrade_cap not found");
7894
7884
  }
@@ -7912,19 +7902,20 @@ var PythAdapter = class {
7912
7902
  const { id: tableId, fieldType } = await this.getPriceTableInfo();
7913
7903
  const feedIdBytes = Buffer.from(normalizedFeedId, "hex");
7914
7904
  try {
7915
- const result = await this.client.getDynamicFieldObject({
7905
+ const PriceIdentifier = bcs.bcs.struct("PriceIdentifier", {
7906
+ bytes: bcs.bcs.vector(bcs.bcs.u8())
7907
+ });
7908
+ const bcsBytes = PriceIdentifier.serialize({ bytes: Array.from(feedIdBytes) }).toBytes();
7909
+ const result = await this.client.getDynamicField({
7916
7910
  parentId: tableId,
7917
7911
  name: {
7918
- type: `${fieldType}::price_identifier::PriceIdentifier`,
7919
- value: { bytes: Array.from(feedIdBytes) }
7912
+ type: fieldType,
7913
+ bcs: bcsBytes
7920
7914
  }
7921
7915
  });
7922
- const content = result.data?.content;
7923
- const json = content && "fields" in content ? content.fields : null;
7924
- const objectId = typeof json?.value === "string" ? json.value : void 0;
7925
- if (!objectId) {
7926
- return void 0;
7927
- }
7916
+ const valueBcs = result.dynamicField.value.bcs;
7917
+ const valueBytes = valueBcs instanceof Uint8Array ? valueBcs : new Uint8Array(Object.values(valueBcs));
7918
+ const objectId = "0x" + Array.from(valueBytes).map((b) => b.toString(16).padStart(2, "0")).join("");
7928
7919
  this.priceFeedObjectIdCache.set(normalizedFeedId, objectId);
7929
7920
  return objectId;
7930
7921
  } catch {
@@ -7935,27 +7926,40 @@ var PythAdapter = class {
7935
7926
  if (this.priceTableInfo !== void 0) {
7936
7927
  return this.priceTableInfo;
7937
7928
  }
7938
- const result = await this.client.getDynamicFieldObject({
7939
- parentId: this.pythStateId,
7940
- name: {
7941
- type: "vector<u8>",
7942
- value: "price_info"
7929
+ let cursor = null;
7930
+ let hasNextPage = true;
7931
+ while (hasNextPage) {
7932
+ const dynamicFields = await this.client.listDynamicFields({
7933
+ parentId: this.pythStateId,
7934
+ cursor
7935
+ });
7936
+ for (const field of dynamicFields.dynamicFields) {
7937
+ if (field.name.type === "vector<u8>") {
7938
+ const objectId = field.$kind === "DynamicObject" && field.childId ? field.childId : field.fieldId;
7939
+ const fieldObj = await this.client.getObject({
7940
+ objectId,
7941
+ include: { json: true }
7942
+ });
7943
+ const type = fieldObj.object.type;
7944
+ if (type.includes("table::Table")) {
7945
+ const innerTypes = type.replace(/.*table::Table</, "").replace(/>$/, "");
7946
+ const fieldType = innerTypes.split(",")[0].trim();
7947
+ this.priceTableInfo = { id: fieldObj.object.objectId, fieldType };
7948
+ return this.priceTableInfo;
7949
+ }
7950
+ }
7943
7951
  }
7944
- });
7945
- if (!result.data?.type) {
7946
- throw new Error(
7947
- "Price Table not found, contract may not be initialized"
7948
- );
7952
+ hasNextPage = dynamicFields.hasNextPage;
7953
+ cursor = dynamicFields.cursor;
7949
7954
  }
7950
- let type = result.data.type.replace("0x2::table::Table<", "");
7951
- type = type.replace("::price_identifier::PriceIdentifier, 0x2::object::ID>", "");
7952
- this.priceTableInfo = { id: result.data.objectId, fieldType: type };
7953
- return this.priceTableInfo;
7955
+ throw new Error(
7956
+ "Price Table not found, contract may not be initialized"
7957
+ );
7954
7958
  }
7955
7959
  extractVaaBytesFromAccumulatorMessage(accumulatorMessage) {
7956
- const trailingPayloadSize = accumulatorMessage.readUint8(6);
7960
+ const trailingPayloadSize = accumulatorMessage.readUInt8(6);
7957
7961
  const vaaSizeOffset = 7 + trailingPayloadSize + 1;
7958
- const vaaSize = accumulatorMessage.readUint16BE(vaaSizeOffset);
7962
+ const vaaSize = accumulatorMessage.readUInt16BE(vaaSizeOffset);
7959
7963
  const vaaOffset = vaaSizeOffset + 2;
7960
7964
  return accumulatorMessage.subarray(vaaOffset, vaaOffset + vaaSize);
7961
7965
  }
@@ -8134,21 +8138,21 @@ async function getOrCreateAccountCap(txb, client, owner) {
8134
8138
  }
8135
8139
  async function getAccountCap(client, owner) {
8136
8140
  const limit = 50;
8137
- let cursor = void 0;
8141
+ let cursor = null;
8138
8142
  while (true) {
8139
- const ownedObjects = await client.getOwnedObjects({
8143
+ const ownedObjects = await client.listOwnedObjects({
8140
8144
  owner,
8141
8145
  cursor,
8142
8146
  limit,
8143
- filter: { StructType: `${DEEPBOOK_PACKAGE_ID}::${DEEPBOOK_CUSTODIAN_V2_MODULE}::AccountCap` }
8147
+ type: `${DEEPBOOK_PACKAGE_ID}::${DEEPBOOK_CUSTODIAN_V2_MODULE}::AccountCap`
8144
8148
  });
8145
- if (ownedObjects.data.length !== 0) {
8146
- return ownedObjects.data[0].data?.objectId ?? null;
8149
+ if (ownedObjects.objects.length !== 0) {
8150
+ return ownedObjects.objects[0].objectId;
8147
8151
  }
8148
8152
  if (!ownedObjects.hasNextPage) {
8149
8153
  break;
8150
8154
  }
8151
- cursor = ownedObjects.nextCursor ?? void 0;
8155
+ cursor = ownedObjects.cursor;
8152
8156
  }
8153
8157
  return null;
8154
8158
  }
@@ -8176,10 +8180,10 @@ function getAggregatorV2Extend2PublishedAt(publishedAt, packages) {
8176
8180
  // src/utils/gas.ts
8177
8181
  var import_bn4 = __toESM(require_bn());
8178
8182
  function extractGasMetrics(result) {
8179
- const effects = result.effects;
8180
- const isSuccess = !result.error && effects.status.status === "success";
8181
- if (!isSuccess) {
8182
- const errorMsg = result.error ?? effects.status.error ?? "Unknown error";
8183
+ const txResult = result.Transaction ?? result.FailedTransaction;
8184
+ const effects = txResult?.effects;
8185
+ if (!effects || !effects.status.success) {
8186
+ const errorMsg = effects?.status.success === false ? effects.status.error.message : "Unknown error";
8183
8187
  return {
8184
8188
  computationCost: "0",
8185
8189
  storageCost: "0",
@@ -8758,6 +8762,83 @@ var MagmaPropAmmRouter = class {
8758
8762
  });
8759
8763
  }
8760
8764
  };
8765
+ var TideRouter = class {
8766
+ constructor(_env) {
8767
+ }
8768
+ swap(txb, flattenedPath, swapContext, _extends) {
8769
+ const path = flattenedPath.path;
8770
+ if (!path.extendedDetails) {
8771
+ throw new Error("Extended details not found for TIDE");
8772
+ }
8773
+ this.validateExtendedDetails(path.extendedDetails);
8774
+ const swapData = this.prepareSwapData(flattenedPath);
8775
+ this.executeSwapContract(txb, swapData, swapContext);
8776
+ }
8777
+ validateExtendedDetails(extendedDetails) {
8778
+ if (!extendedDetails.tide_pool_id) {
8779
+ throw new Error("TIDE pool id not found in extended details");
8780
+ }
8781
+ if (!extendedDetails.tide_regime_id) {
8782
+ throw new Error("TIDE regime id not found in extended details");
8783
+ }
8784
+ if (extendedDetails.tide_oracle_mode !== "pyth_core") {
8785
+ throw new Error(
8786
+ `TIDE oracle mode "${extendedDetails.tide_oracle_mode}" not supported (only "pyth_core")`
8787
+ );
8788
+ }
8789
+ if (!extendedDetails.tide_base_price_info_object) {
8790
+ throw new Error("TIDE base price info object not found in extended details");
8791
+ }
8792
+ if (!extendedDetails.tide_quote_price_info_object) {
8793
+ throw new Error(
8794
+ "TIDE quote price info object not found in extended details"
8795
+ );
8796
+ }
8797
+ }
8798
+ prepareSwapData(flattenedPath) {
8799
+ const path = flattenedPath.path;
8800
+ if (path.publishedAt == null) {
8801
+ throw new Error("TIDE not set publishedAt");
8802
+ }
8803
+ const extendedDetails = path.extendedDetails;
8804
+ const [baseType, quoteType] = path.direction ? [path.from, path.target] : [path.target, path.from];
8805
+ const amountIn = flattenedPath.isLastUseOfIntermediateToken ? AGGREGATOR_V3_CONFIG.MAX_AMOUNT_IN : path.amountIn;
8806
+ return {
8807
+ baseType,
8808
+ quoteType,
8809
+ a2b: path.direction,
8810
+ amountIn,
8811
+ publishedAt: path.publishedAt,
8812
+ poolId: extendedDetails.tide_pool_id,
8813
+ regimeId: extendedDetails.tide_regime_id,
8814
+ basePriceInfoObject: extendedDetails.tide_base_price_info_object,
8815
+ quotePriceInfoObject: extendedDetails.tide_quote_price_info_object
8816
+ };
8817
+ }
8818
+ executeSwapContract(txb, swapData, swapContext) {
8819
+ const fn = swapData.a2b ? "swap_a2b_pyth_core" : "swap_b2a_pyth_core";
8820
+ txb.moveCall({
8821
+ target: `${swapData.publishedAt}::tide::${fn}`,
8822
+ typeArguments: [swapData.baseType, swapData.quoteType],
8823
+ arguments: [
8824
+ swapContext,
8825
+ // swap_ctx
8826
+ txb.object(swapData.poolId),
8827
+ // pool_state
8828
+ txb.object(swapData.regimeId),
8829
+ // regime_state
8830
+ txb.object(utils.SUI_CLOCK_OBJECT_ID),
8831
+ // clock
8832
+ txb.object(swapData.basePriceInfoObject),
8833
+ // base_price_info_object
8834
+ txb.object(swapData.quotePriceInfoObject),
8835
+ // quote_price_info_object
8836
+ txb.pure.u64(swapData.amountIn)
8837
+ // amount_in
8838
+ ]
8839
+ });
8840
+ }
8841
+ };
8761
8842
 
8762
8843
  // src/client.ts
8763
8844
  var CETUS = "CETUS";
@@ -8795,6 +8876,7 @@ var FERRADLMM = "FERRADLMM";
8795
8876
  var FERRACLMM = "FERRACLMM";
8796
8877
  var BOLT = "BOLT";
8797
8878
  var MAGMAPROPAMM = "MAGMAPROPAMM";
8879
+ var TIDE = "TIDE";
8798
8880
  var DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v3";
8799
8881
  var ALL_DEXES = [
8800
8882
  CETUS,
@@ -8830,7 +8912,8 @@ var ALL_DEXES = [
8830
8912
  FERRADLMM,
8831
8913
  FERRACLMM,
8832
8914
  BOLT,
8833
- MAGMAPROPAMM
8915
+ MAGMAPROPAMM,
8916
+ TIDE
8834
8917
  ];
8835
8918
  function getAllProviders() {
8836
8919
  return ALL_DEXES;
@@ -8897,8 +8980,8 @@ var _AggregatorClient = class _AggregatorClient {
8897
8980
  constructor(params) {
8898
8981
  this.endpoint = params.endpoint ? processEndpoint(params.endpoint) : DEFAULT_ENDPOINT;
8899
8982
  const network = params.env === 1 /* Testnet */ ? "testnet" : "mainnet";
8900
- const rpcUrl = params.env === 1 /* Testnet */ ? "https://fullnode.testnet.sui.io:443" : "https://fullnode.mainnet.sui.io:443";
8901
- this.client = params.client ?? new jsonRpc.SuiJsonRpcClient({ network, url: rpcUrl });
8983
+ const grpcUrl = params.env === 1 /* Testnet */ ? "https://fullnode.testnet.sui.io:443" : "https://fullnode.mainnet.sui.io:443";
8984
+ this.client = params.client ?? new grpc.SuiGrpcClient({ network, baseUrl: grpcUrl });
8902
8985
  this.signer = params.signer || "";
8903
8986
  this.env = params.env || 0 /* Mainnet */;
8904
8987
  const config2 = _AggregatorClient.CONFIG[this.env];
@@ -8939,13 +9022,13 @@ var _AggregatorClient = class _AggregatorClient {
8939
9022
  }
8940
9023
  async getOneCoinUsedToMerge(coinType) {
8941
9024
  try {
8942
- const gotCoin = await this.client.getCoins({
9025
+ const gotCoin = await this.client.listCoins({
8943
9026
  owner: this.signer,
8944
9027
  coinType,
8945
9028
  limit: 1
8946
9029
  });
8947
- if (gotCoin.data.length === 1) {
8948
- return gotCoin.data[0].coinObjectId;
9030
+ if (gotCoin.objects.length === 1) {
9031
+ return gotCoin.objects[0].objectId;
8949
9032
  }
8950
9033
  return null;
8951
9034
  } catch (error) {
@@ -9042,6 +9125,8 @@ var _AggregatorClient = class _AggregatorClient {
9042
9125
  return new BoltRouter(this.env);
9043
9126
  case MAGMAPROPAMM:
9044
9127
  return new MagmaPropAmmRouter(this.env);
9128
+ case TIDE:
9129
+ return new TideRouter(this.env);
9045
9130
  default:
9046
9131
  throw new Error(
9047
9132
  `${CLIENT_CONFIG.ERRORS.UNSUPPORTED_DEX} ${provider}`
@@ -9419,15 +9504,7 @@ var _AggregatorClient = class _AggregatorClient {
9419
9504
  * @throws Error if input coin amount exceeds maxAmountIn
9420
9505
  */
9421
9506
  async routerSwapWithMaxAmountIn(params) {
9422
- const {
9423
- router,
9424
- inputCoin,
9425
- slippage,
9426
- txb,
9427
- partner,
9428
- cetusDlmmPartner,
9429
- maxAmountIn
9430
- } = params;
9507
+ const { router, inputCoin, slippage, txb, partner, maxAmountIn } = params;
9431
9508
  if (slippage > 1 || slippage < 0) {
9432
9509
  throw new Error(CLIENT_CONFIG.ERRORS.INVALID_SLIPPAGE);
9433
9510
  }
@@ -9462,8 +9539,7 @@ var _AggregatorClient = class _AggregatorClient {
9462
9539
  amountOut.toString(),
9463
9540
  amountLimit.toString(),
9464
9541
  priceInfoObjectIds,
9465
- partner ?? this.partner,
9466
- cetusDlmmPartner ?? this.cetusDlmmPartner
9542
+ partner ?? this.partner
9467
9543
  );
9468
9544
  } else {
9469
9545
  return this.expectOutputSwapV3WithMaxAmountIn(
@@ -9480,14 +9556,7 @@ var _AggregatorClient = class _AggregatorClient {
9480
9556
  // auto build input coin
9481
9557
  // auto merge, transfer or destory target coin.
9482
9558
  async fastRouterSwap(params) {
9483
- const {
9484
- router,
9485
- slippage,
9486
- txb,
9487
- partner,
9488
- cetusDlmmPartner,
9489
- payDeepFeeAmount
9490
- } = params;
9559
+ const { router, slippage, txb, partner, cetusDlmmPartner, payDeepFeeAmount } = params;
9491
9560
  const fromCoinType = router.paths[0].from;
9492
9561
  const targetCoinType = router.paths[router.paths.length - 1].target;
9493
9562
  const byAmountIn = router.byAmountIn;
@@ -9644,7 +9713,7 @@ var _AggregatorClient = class _AggregatorClient {
9644
9713
  }
9645
9714
  }
9646
9715
  async fixableRouterSwapV3(params) {
9647
- const { router, inputCoin, slippage, txb, partner, cetusDlmmPartner } = params;
9716
+ const { router, inputCoin, slippage, txb, partner } = params;
9648
9717
  checkOverlayFeeConfig(this.overlayFeeRate, this.overlayFeeReceiver);
9649
9718
  let overlayFee = 0;
9650
9719
  if (router.byAmountIn) {
@@ -9673,8 +9742,7 @@ var _AggregatorClient = class _AggregatorClient {
9673
9742
  expectedAmountOut.toString(),
9674
9743
  amountLimit.toString(),
9675
9744
  priceInfoObjectIds,
9676
- partner ?? this.partner,
9677
- cetusDlmmPartner ?? this.cetusDlmmPartner
9745
+ partner ?? this.partner
9678
9746
  );
9679
9747
  } else {
9680
9748
  return this.expectOutputSwapV3(
@@ -9711,16 +9779,18 @@ var _AggregatorClient = class _AggregatorClient {
9711
9779
  });
9712
9780
  }
9713
9781
  tx.setSenderIfNotSet(this.signer || "0x0");
9714
- const simulateRes = await this.client.devInspectTransactionBlock({
9715
- sender: this.signer || "0x0",
9716
- transactionBlock: tx
9782
+ const simulateRes = await this.client.simulateTransaction({
9783
+ transaction: tx,
9784
+ include: { events: true, effects: true }
9717
9785
  });
9718
- if (simulateRes.error) {
9719
- throw new Error("Simulation error: " + simulateRes.error);
9786
+ const txResult = simulateRes.Transaction ?? simulateRes.FailedTransaction;
9787
+ if (!txResult || simulateRes.$kind === "FailedTransaction") {
9788
+ const errorMsg = txResult?.status.success === false ? txResult.status.error.message : "Unknown error";
9789
+ throw new Error("Simulation error: " + errorMsg);
9720
9790
  }
9721
- const events = simulateRes.events ?? [];
9791
+ const events = txResult.events ?? [];
9722
9792
  const valueData = events.filter((item) => {
9723
- return item.type.includes("CalculatedSwapResultEvent");
9793
+ return item.eventType.includes("CalculatedSwapResultEvent");
9724
9794
  });
9725
9795
  if (valueData.length === 0 || valueData.length !== pools.length) {
9726
9796
  throw new Error("Simulate event result error");
@@ -9728,7 +9798,7 @@ var _AggregatorClient = class _AggregatorClient {
9728
9798
  let tempMaxAmount = byAmountIn ? new import_bn6.default(0) : new import_bn6.default(U64_MAX);
9729
9799
  let tempIndex = 0;
9730
9800
  for (let i = 0; i < valueData.length; i += 1) {
9731
- const eventJson2 = valueData[i].parsedJson;
9801
+ const eventJson2 = valueData[i].json;
9732
9802
  if (eventJson2?.data?.is_exceed) {
9733
9803
  continue;
9734
9804
  }
@@ -9746,11 +9816,11 @@ var _AggregatorClient = class _AggregatorClient {
9746
9816
  }
9747
9817
  }
9748
9818
  }
9749
- const eventJson = valueData[tempIndex].parsedJson;
9819
+ const eventJson = valueData[tempIndex].json;
9750
9820
  const eventData = eventJson?.data;
9751
9821
  const [decimalA, decimalB] = await Promise.all([
9752
- this.client.getCoinMetadata({ coinType: coinA }).then((res) => res?.decimals ?? null),
9753
- this.client.getCoinMetadata({ coinType: coinB }).then((res) => res?.decimals ?? null)
9822
+ this.client.getCoinMetadata({ coinType: coinA }).then((res) => res.coinMetadata?.decimals ?? null),
9823
+ this.client.getCoinMetadata({ coinType: coinB }).then((res) => res.coinMetadata?.decimals ?? null)
9754
9824
  ]);
9755
9825
  if (decimalA == null || decimalB == null) {
9756
9826
  throw new Error("Cannot get coin decimals");
@@ -9819,9 +9889,9 @@ var _AggregatorClient = class _AggregatorClient {
9819
9889
  }
9820
9890
  async devInspectTransactionBlock(txb) {
9821
9891
  txb.setSenderIfNotSet(this.signer || "0x0");
9822
- const res = await this.client.devInspectTransactionBlock({
9823
- sender: this.signer || "0x0",
9824
- transactionBlock: txb
9892
+ const res = await this.client.simulateTransaction({
9893
+ transaction: txb,
9894
+ include: { events: true, effects: true }
9825
9895
  });
9826
9896
  return res;
9827
9897
  }
@@ -9829,7 +9899,7 @@ var _AggregatorClient = class _AggregatorClient {
9829
9899
  const res = await this.client.signAndExecuteTransaction({
9830
9900
  transaction: txb,
9831
9901
  signer,
9832
- options: { showEffects: true, showEvents: true, showBalanceChanges: true }
9902
+ include: { effects: true, events: true, balanceChanges: true }
9833
9903
  });
9834
9904
  return res;
9835
9905
  }
@@ -10015,6 +10085,7 @@ exports.TESTNET_AFTERMATH_REGISTRY_ID = TESTNET_AFTERMATH_REGISTRY_ID;
10015
10085
  exports.TESTNET_AFTERMATH_TREASURY_ID = TESTNET_AFTERMATH_TREASURY_ID;
10016
10086
  exports.TESTNET_CETUS_V3_PUBLISHED_AT = TESTNET_CETUS_V3_PUBLISHED_AT;
10017
10087
  exports.TESTNET_FLOWX_AMM_CONTAINER_ID = TESTNET_FLOWX_AMM_CONTAINER_ID;
10088
+ exports.TIDE = TIDE;
10018
10089
  exports.TRANSFER_ACCOUNT_CAP = TRANSFER_ACCOUNT_CAP;
10019
10090
  exports.TRANSFER_OR_DESTORY_COIN_FUNC = TRANSFER_OR_DESTORY_COIN_FUNC;
10020
10091
  exports.TURBOS = TURBOS;