@cetusprotocol/aggregator-sdk 1.5.4 → 1.5.5

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",
@@ -8897,8 +8901,8 @@ var _AggregatorClient = class _AggregatorClient {
8897
8901
  constructor(params) {
8898
8902
  this.endpoint = params.endpoint ? processEndpoint(params.endpoint) : DEFAULT_ENDPOINT;
8899
8903
  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 });
8904
+ const grpcUrl = params.env === 1 /* Testnet */ ? "https://fullnode.testnet.sui.io:443" : "https://fullnode.mainnet.sui.io:443";
8905
+ this.client = params.client ?? new grpc.SuiGrpcClient({ network, baseUrl: grpcUrl });
8902
8906
  this.signer = params.signer || "";
8903
8907
  this.env = params.env || 0 /* Mainnet */;
8904
8908
  const config2 = _AggregatorClient.CONFIG[this.env];
@@ -8939,13 +8943,13 @@ var _AggregatorClient = class _AggregatorClient {
8939
8943
  }
8940
8944
  async getOneCoinUsedToMerge(coinType) {
8941
8945
  try {
8942
- const gotCoin = await this.client.getCoins({
8946
+ const gotCoin = await this.client.listCoins({
8943
8947
  owner: this.signer,
8944
8948
  coinType,
8945
8949
  limit: 1
8946
8950
  });
8947
- if (gotCoin.data.length === 1) {
8948
- return gotCoin.data[0].coinObjectId;
8951
+ if (gotCoin.objects.length === 1) {
8952
+ return gotCoin.objects[0].objectId;
8949
8953
  }
8950
8954
  return null;
8951
8955
  } catch (error) {
@@ -9419,15 +9423,7 @@ var _AggregatorClient = class _AggregatorClient {
9419
9423
  * @throws Error if input coin amount exceeds maxAmountIn
9420
9424
  */
9421
9425
  async routerSwapWithMaxAmountIn(params) {
9422
- const {
9423
- router,
9424
- inputCoin,
9425
- slippage,
9426
- txb,
9427
- partner,
9428
- cetusDlmmPartner,
9429
- maxAmountIn
9430
- } = params;
9426
+ const { router, inputCoin, slippage, txb, partner, maxAmountIn } = params;
9431
9427
  if (slippage > 1 || slippage < 0) {
9432
9428
  throw new Error(CLIENT_CONFIG.ERRORS.INVALID_SLIPPAGE);
9433
9429
  }
@@ -9462,8 +9458,7 @@ var _AggregatorClient = class _AggregatorClient {
9462
9458
  amountOut.toString(),
9463
9459
  amountLimit.toString(),
9464
9460
  priceInfoObjectIds,
9465
- partner ?? this.partner,
9466
- cetusDlmmPartner ?? this.cetusDlmmPartner
9461
+ partner ?? this.partner
9467
9462
  );
9468
9463
  } else {
9469
9464
  return this.expectOutputSwapV3WithMaxAmountIn(
@@ -9480,14 +9475,7 @@ var _AggregatorClient = class _AggregatorClient {
9480
9475
  // auto build input coin
9481
9476
  // auto merge, transfer or destory target coin.
9482
9477
  async fastRouterSwap(params) {
9483
- const {
9484
- router,
9485
- slippage,
9486
- txb,
9487
- partner,
9488
- cetusDlmmPartner,
9489
- payDeepFeeAmount
9490
- } = params;
9478
+ const { router, slippage, txb, partner, cetusDlmmPartner, payDeepFeeAmount } = params;
9491
9479
  const fromCoinType = router.paths[0].from;
9492
9480
  const targetCoinType = router.paths[router.paths.length - 1].target;
9493
9481
  const byAmountIn = router.byAmountIn;
@@ -9644,7 +9632,7 @@ var _AggregatorClient = class _AggregatorClient {
9644
9632
  }
9645
9633
  }
9646
9634
  async fixableRouterSwapV3(params) {
9647
- const { router, inputCoin, slippage, txb, partner, cetusDlmmPartner } = params;
9635
+ const { router, inputCoin, slippage, txb, partner } = params;
9648
9636
  checkOverlayFeeConfig(this.overlayFeeRate, this.overlayFeeReceiver);
9649
9637
  let overlayFee = 0;
9650
9638
  if (router.byAmountIn) {
@@ -9673,8 +9661,7 @@ var _AggregatorClient = class _AggregatorClient {
9673
9661
  expectedAmountOut.toString(),
9674
9662
  amountLimit.toString(),
9675
9663
  priceInfoObjectIds,
9676
- partner ?? this.partner,
9677
- cetusDlmmPartner ?? this.cetusDlmmPartner
9664
+ partner ?? this.partner
9678
9665
  );
9679
9666
  } else {
9680
9667
  return this.expectOutputSwapV3(
@@ -9711,16 +9698,18 @@ var _AggregatorClient = class _AggregatorClient {
9711
9698
  });
9712
9699
  }
9713
9700
  tx.setSenderIfNotSet(this.signer || "0x0");
9714
- const simulateRes = await this.client.devInspectTransactionBlock({
9715
- sender: this.signer || "0x0",
9716
- transactionBlock: tx
9701
+ const simulateRes = await this.client.simulateTransaction({
9702
+ transaction: tx,
9703
+ include: { events: true, effects: true }
9717
9704
  });
9718
- if (simulateRes.error) {
9719
- throw new Error("Simulation error: " + simulateRes.error);
9705
+ const txResult = simulateRes.Transaction ?? simulateRes.FailedTransaction;
9706
+ if (!txResult || simulateRes.$kind === "FailedTransaction") {
9707
+ const errorMsg = txResult?.status.success === false ? txResult.status.error.message : "Unknown error";
9708
+ throw new Error("Simulation error: " + errorMsg);
9720
9709
  }
9721
- const events = simulateRes.events ?? [];
9710
+ const events = txResult.events ?? [];
9722
9711
  const valueData = events.filter((item) => {
9723
- return item.type.includes("CalculatedSwapResultEvent");
9712
+ return item.eventType.includes("CalculatedSwapResultEvent");
9724
9713
  });
9725
9714
  if (valueData.length === 0 || valueData.length !== pools.length) {
9726
9715
  throw new Error("Simulate event result error");
@@ -9728,7 +9717,7 @@ var _AggregatorClient = class _AggregatorClient {
9728
9717
  let tempMaxAmount = byAmountIn ? new import_bn6.default(0) : new import_bn6.default(U64_MAX);
9729
9718
  let tempIndex = 0;
9730
9719
  for (let i = 0; i < valueData.length; i += 1) {
9731
- const eventJson2 = valueData[i].parsedJson;
9720
+ const eventJson2 = valueData[i].json;
9732
9721
  if (eventJson2?.data?.is_exceed) {
9733
9722
  continue;
9734
9723
  }
@@ -9746,11 +9735,11 @@ var _AggregatorClient = class _AggregatorClient {
9746
9735
  }
9747
9736
  }
9748
9737
  }
9749
- const eventJson = valueData[tempIndex].parsedJson;
9738
+ const eventJson = valueData[tempIndex].json;
9750
9739
  const eventData = eventJson?.data;
9751
9740
  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)
9741
+ this.client.getCoinMetadata({ coinType: coinA }).then((res) => res.coinMetadata?.decimals ?? null),
9742
+ this.client.getCoinMetadata({ coinType: coinB }).then((res) => res.coinMetadata?.decimals ?? null)
9754
9743
  ]);
9755
9744
  if (decimalA == null || decimalB == null) {
9756
9745
  throw new Error("Cannot get coin decimals");
@@ -9819,9 +9808,9 @@ var _AggregatorClient = class _AggregatorClient {
9819
9808
  }
9820
9809
  async devInspectTransactionBlock(txb) {
9821
9810
  txb.setSenderIfNotSet(this.signer || "0x0");
9822
- const res = await this.client.devInspectTransactionBlock({
9823
- sender: this.signer || "0x0",
9824
- transactionBlock: txb
9811
+ const res = await this.client.simulateTransaction({
9812
+ transaction: txb,
9813
+ include: { events: true, effects: true }
9825
9814
  });
9826
9815
  return res;
9827
9816
  }
@@ -9829,7 +9818,7 @@ var _AggregatorClient = class _AggregatorClient {
9829
9818
  const res = await this.client.signAndExecuteTransaction({
9830
9819
  transaction: txb,
9831
9820
  signer,
9832
- options: { showEffects: true, showEvents: true, showBalanceChanges: true }
9821
+ include: { effects: true, events: true, balanceChanges: true }
9833
9822
  });
9834
9823
  return res;
9835
9824
  }
package/dist/index.d.cts CHANGED
@@ -1,8 +1,8 @@
1
- import * as _mysten_sui_jsonRpc from '@mysten/sui/jsonRpc';
2
- import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
1
+ import * as _mysten_sui_client from '@mysten/sui/client';
3
2
  import { TransactionObjectArgument, Transaction, TransactionArgument } from '@mysten/sui/transactions';
4
3
  import BN from 'bn.js';
5
4
  import Decimal from 'decimal.js';
5
+ import { SuiGrpcClient } from '@mysten/sui/grpc';
6
6
  import { Signer } from '@mysten/sui/cryptography';
7
7
 
8
8
  interface FindRouterParams {
@@ -309,7 +309,7 @@ declare class PythAdapter {
309
309
  private priceTableInfo;
310
310
  private priceFeedObjectIdCache;
311
311
  private baseUpdateFee;
312
- constructor(client: SuiJsonRpcClient, pythStateId: ObjectId, wormholeStateId: ObjectId, hermesUrls: string[]);
312
+ constructor(client: SuiGrpcClient, pythStateId: ObjectId, wormholeStateId: ObjectId, hermesUrls: string[]);
313
313
  getPriceFeedsUpdateData(priceIDs: string[]): Promise<Buffer[]>;
314
314
  getBaseUpdateFee(): Promise<number>;
315
315
  getPackageId(objectId: ObjectId): Promise<string>;
@@ -407,7 +407,7 @@ declare function getProvidersIncluding(includeProviders: string[]): string[];
407
407
  type AggregatorClientParams = {
408
408
  endpoint?: string;
409
409
  signer?: string;
410
- client?: SuiJsonRpcClient;
410
+ client?: SuiGrpcClient;
411
411
  env?: Env;
412
412
  pythUrls?: string[];
413
413
  apiKey?: string;
@@ -419,7 +419,7 @@ type AggregatorClientParams = {
419
419
  declare class AggregatorClient {
420
420
  endpoint: string;
421
421
  signer: string;
422
- client: SuiJsonRpcClient;
422
+ client: SuiGrpcClient;
423
423
  env: Env;
424
424
  apiKey: string;
425
425
  protected pythAdapter: PythAdapter;
@@ -461,8 +461,15 @@ declare class AggregatorClient {
461
461
  fixableRouterSwapV3(params: BuildRouterSwapParamsV3): Promise<TransactionObjectArgument>;
462
462
  swapInPools(params: SwapInPoolsParams): Promise<SwapInPoolsResultV3>;
463
463
  updatePythPriceIDs(priceIDs: string[], txb: Transaction): Promise<Map<string, string>>;
464
- devInspectTransactionBlock(txb: Transaction): Promise<_mysten_sui_jsonRpc.DevInspectResults>;
465
- sendTransaction(txb: Transaction, signer: Signer): Promise<_mysten_sui_jsonRpc.SuiTransactionBlockResponse>;
464
+ devInspectTransactionBlock(txb: Transaction): Promise<_mysten_sui_client.SuiClientTypes.SimulateTransactionResult<{
465
+ events: true;
466
+ effects: true;
467
+ }>>;
468
+ sendTransaction(txb: Transaction, signer: Signer): Promise<_mysten_sui_client.SuiClientTypes.TransactionResult<{
469
+ effects: true;
470
+ events: true;
471
+ balanceChanges: true;
472
+ }>>;
466
473
  }
467
474
 
468
475
  /**
@@ -495,7 +502,7 @@ type GetOrCreateAccountCapResult = {
495
502
  accountCap: TransactionObjectArgument;
496
503
  isCreate: boolean;
497
504
  };
498
- declare function getOrCreateAccountCap(txb: Transaction, client: SuiJsonRpcClient, owner: string): Promise<GetOrCreateAccountCapResult>;
505
+ declare function getOrCreateAccountCap(txb: Transaction, client: SuiGrpcClient, owner: string): Promise<GetOrCreateAccountCapResult>;
499
506
 
500
507
  /**
501
508
  * Represents a SUI address, which is a string.
@@ -645,23 +652,67 @@ interface Dex {
645
652
  }
646
653
 
647
654
  /**
648
- * Matches the shape of DevInspectResults from JSON-RPC.
655
+ * Matches the shape of SuiClientTypes.SimulateTransactionResult with effects included.
649
656
  * Using a local type so gas.ts can be used without importing the full SDK.
650
657
  */
651
658
  type SimulateTransactionResult = {
652
- effects: {
659
+ $kind: 'Transaction' | 'FailedTransaction';
660
+ Transaction?: {
653
661
  status: {
654
- status: 'success' | 'failure';
655
- error?: string;
662
+ success: true;
663
+ error: null;
664
+ } | {
665
+ success: false;
666
+ error: {
667
+ message: string;
668
+ };
656
669
  };
657
- gasUsed: {
658
- computationCost: string;
659
- storageCost: string;
660
- storageRebate: string;
661
- nonRefundableStorageFee: string;
670
+ effects?: {
671
+ status: {
672
+ success: true;
673
+ error: null;
674
+ } | {
675
+ success: false;
676
+ error: {
677
+ message: string;
678
+ };
679
+ };
680
+ gasUsed: {
681
+ computationCost: string;
682
+ storageCost: string;
683
+ storageRebate: string;
684
+ nonRefundableStorageFee: string;
685
+ };
686
+ };
687
+ };
688
+ FailedTransaction?: {
689
+ status: {
690
+ success: true;
691
+ error: null;
692
+ } | {
693
+ success: false;
694
+ error: {
695
+ message: string;
696
+ };
697
+ };
698
+ effects?: {
699
+ status: {
700
+ success: true;
701
+ error: null;
702
+ } | {
703
+ success: false;
704
+ error: {
705
+ message: string;
706
+ };
707
+ };
708
+ gasUsed: {
709
+ computationCost: string;
710
+ storageCost: string;
711
+ storageRebate: string;
712
+ nonRefundableStorageFee: string;
713
+ };
662
714
  };
663
715
  };
664
- error?: string | null;
665
716
  };
666
717
  interface GasMetrics {
667
718
  computationCost: string;