@mysten/sui 2.24.0 → 2.25.0

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.
Files changed (65) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/dist/bcs/bcs.d.mts +6 -6
  3. package/dist/bcs/index.d.mts +36 -36
  4. package/dist/client/core.d.mts.map +1 -1
  5. package/dist/client/core.mjs +4 -1
  6. package/dist/client/core.mjs.map +1 -1
  7. package/dist/client/mvr.d.mts.map +1 -1
  8. package/dist/client/mvr.mjs +1 -0
  9. package/dist/client/mvr.mjs.map +1 -1
  10. package/dist/cryptography/signature.d.mts +6 -6
  11. package/dist/graphql/client.d.mts +5 -1
  12. package/dist/graphql/client.d.mts.map +1 -1
  13. package/dist/graphql/client.mjs +15 -2
  14. package/dist/graphql/client.mjs.map +1 -1
  15. package/dist/graphql/core.d.mts +4 -4
  16. package/dist/graphql/core.d.mts.map +1 -1
  17. package/dist/graphql/core.mjs +50 -13
  18. package/dist/graphql/core.mjs.map +1 -1
  19. package/dist/graphql/generated/tada-env.d.mts +16 -0
  20. package/dist/grpc/client.d.mts +5 -1
  21. package/dist/grpc/client.d.mts.map +1 -1
  22. package/dist/grpc/client.mjs +14 -2
  23. package/dist/grpc/client.mjs.map +1 -1
  24. package/dist/grpc/proto/sui/rpc/v2/move_package_service.client.d.mts +4 -4
  25. package/dist/grpc/proto/sui/rpc/v2/signature_verification_service.client.d.mts +4 -4
  26. package/dist/grpc/proto/sui/rpc/v2/state_service.client.d.mts +4 -4
  27. package/dist/grpc/proto/sui/rpc/v2/subscription_service.client.d.mts +4 -4
  28. package/dist/grpc/proto/sui/rpc/v2/transaction_execution_service.client.d.mts +4 -4
  29. package/dist/jsonRpc/client.d.mts.map +1 -1
  30. package/dist/jsonRpc/client.mjs +60 -15
  31. package/dist/jsonRpc/client.mjs.map +1 -1
  32. package/dist/jsonRpc/core.d.mts +1 -1
  33. package/dist/jsonRpc/core.d.mts.map +1 -1
  34. package/dist/jsonRpc/core.mjs +18 -7
  35. package/dist/jsonRpc/core.mjs.map +1 -1
  36. package/dist/transactions/Transaction.d.mts +3 -3
  37. package/dist/transactions/data/v1.d.mts +220 -220
  38. package/dist/transactions/data/v1.d.mts.map +1 -1
  39. package/dist/transactions/data/v2.d.mts +16 -16
  40. package/dist/transactions/data/v2.d.mts.map +1 -1
  41. package/dist/version.mjs +1 -1
  42. package/dist/version.mjs.map +1 -1
  43. package/dist/zklogin/bcs.d.mts +14 -14
  44. package/docs/bcs.md +2 -2
  45. package/docs/clients/core.md +150 -710
  46. package/docs/clients/executing.md +113 -0
  47. package/docs/clients/graphql.md +80 -70
  48. package/docs/clients/grpc.md +223 -208
  49. package/docs/clients/index.md +56 -67
  50. package/docs/clients/querying.md +539 -0
  51. package/docs/llms-index.md +6 -5
  52. package/docs/migrations/sui-2.0/json-rpc-migration.md +3 -1
  53. package/docs/transactions/signing-and-execution.md +8 -28
  54. package/package.json +1 -1
  55. package/src/client/core.ts +1 -0
  56. package/src/client/mvr.ts +6 -0
  57. package/src/graphql/client.ts +29 -2
  58. package/src/graphql/core.ts +42 -10
  59. package/src/graphql/generated/schema.graphql +11 -1
  60. package/src/graphql/generated/tada-env.ts +20 -0
  61. package/src/grpc/client.ts +28 -2
  62. package/src/jsonRpc/client.ts +15 -0
  63. package/src/jsonRpc/core.ts +19 -6
  64. package/src/version.ts +1 -1
  65. package/docs/clients/json-rpc.md +0 -243
@@ -249,8 +249,28 @@ export class SuiGraphQLClient<Queries extends Record<string, GraphQLDocument> =
249
249
  return this.core.simulateTransaction(input);
250
250
  }
251
251
 
252
- getReferenceGasPrice(): Promise<SuiClientTypes.GetReferenceGasPriceResponse> {
253
- return this.core.getReferenceGasPrice();
252
+ getReferenceGasPrice(
253
+ input?: SuiClientTypes.GetReferenceGasPriceOptions,
254
+ ): Promise<SuiClientTypes.GetReferenceGasPriceResponse> {
255
+ return this.core.getReferenceGasPrice(input);
256
+ }
257
+
258
+ getCurrentSystemState(
259
+ input?: SuiClientTypes.GetCurrentSystemStateOptions,
260
+ ): Promise<SuiClientTypes.GetCurrentSystemStateResponse> {
261
+ return this.core.getCurrentSystemState(input);
262
+ }
263
+
264
+ getProtocolConfig(
265
+ input?: SuiClientTypes.GetProtocolConfigOptions,
266
+ ): Promise<SuiClientTypes.GetProtocolConfigResponse> {
267
+ return this.core.getProtocolConfig(input);
268
+ }
269
+
270
+ getChainIdentifier(
271
+ input?: SuiClientTypes.GetChainIdentifierOptions,
272
+ ): Promise<SuiClientTypes.GetChainIdentifierResponse> {
273
+ return this.core.getChainIdentifier(input);
254
274
  }
255
275
 
256
276
  async listDynamicFields<Include extends DynamicFieldInclude = {}>(
@@ -260,6 +280,7 @@ export class SuiGraphQLClient<Queries extends Record<string, GraphQLDocument> =
260
280
 
261
281
  const { data, errors } = await this.query({
262
282
  query: GetDynamicFieldsDocument,
283
+ signal: input.signal,
263
284
  variables: {
264
285
  parentId: input.parentId,
265
286
  first: input.limit,
@@ -338,6 +359,12 @@ export class SuiGraphQLClient<Queries extends Record<string, GraphQLDocument> =
338
359
  return this.core.getDynamicField(input);
339
360
  }
340
361
 
362
+ getDynamicObjectField<Include extends SuiClientTypes.ObjectInclude = {}>(
363
+ input: SuiClientTypes.GetDynamicObjectFieldOptions<Include>,
364
+ ): Promise<SuiClientTypes.GetDynamicObjectFieldResponse<Include>> {
365
+ return this.core.getDynamicObjectField(input);
366
+ }
367
+
341
368
  listTransactions<Include extends SuiClientTypes.TransactionInclude = {}>(
342
369
  input: SuiClientTypes.ListTransactionsOptions<Include>,
343
370
  ): Promise<SuiClientTypes.ListTransactionsResponse<Include>> {
@@ -2,6 +2,7 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  import { CoreClient } from '../client/core.js';
5
+ import { raceSignal } from '../client/mvr.js';
5
6
  import type { SuiClientTypes } from '../client/types.js';
6
7
  import { SUI_TYPE_ARG } from '../utils/constants.js';
7
8
  import type { GraphQLQueryOptions, SuiGraphQLClient } from './client.js';
@@ -109,6 +110,7 @@ export class GraphQLCoreClient extends CoreClient {
109
110
  const page = await this.#graphqlQuery(
110
111
  {
111
112
  query: MultiGetObjectsDocument,
113
+ signal: options.signal,
112
114
  variables: {
113
115
  objectKeys: batch.map((address) => ({ address })),
114
116
  includeContent: options.include?.content ?? false,
@@ -187,12 +189,16 @@ export class GraphQLCoreClient extends CoreClient {
187
189
  const objects = await this.#graphqlQuery(
188
190
  {
189
191
  query: GetOwnedObjectsDocument,
192
+ signal: options.signal,
190
193
  variables: {
191
194
  owner: options.owner,
192
195
  limit: options.limit,
193
196
  cursor: options.cursor,
194
197
  filter: options.type
195
- ? { type: (await this.mvr.resolveType({ type: options.type })).type }
198
+ ? {
199
+ type: (await this.mvr.resolveType({ type: options.type, signal: options.signal }))
200
+ .type,
201
+ }
196
202
  : undefined,
197
203
  includeContent: options.include?.content ?? false,
198
204
  includePreviousTransaction: options.include?.previousTransaction ?? false,
@@ -242,11 +248,12 @@ export class GraphQLCoreClient extends CoreClient {
242
248
  const coins = await this.#graphqlQuery(
243
249
  {
244
250
  query: GetCoinsDocument,
251
+ signal: options.signal,
245
252
  variables: {
246
253
  owner: options.owner,
247
254
  cursor: options.cursor,
248
255
  first: options.limit,
249
- type: `0x2::coin::Coin<${(await this.mvr.resolveType({ type: coinType })).type}>`,
256
+ type: `0x2::coin::Coin<${(await this.mvr.resolveType({ type: coinType, signal: options.signal })).type}>`,
250
257
  },
251
258
  },
252
259
  (result) => result.address?.objects,
@@ -275,9 +282,10 @@ export class GraphQLCoreClient extends CoreClient {
275
282
  const result = await this.#graphqlQuery(
276
283
  {
277
284
  query: GetBalanceDocument,
285
+ signal: options.signal,
278
286
  variables: {
279
287
  owner: options.owner,
280
- coinType: (await this.mvr.resolveType({ type: coinType })).type,
288
+ coinType: (await this.mvr.resolveType({ type: coinType, signal: options.signal })).type,
281
289
  },
282
290
  },
283
291
  (result) => result.address?.balance,
@@ -298,10 +306,13 @@ export class GraphQLCoreClient extends CoreClient {
298
306
  async getCoinMetadata(
299
307
  options: SuiClientTypes.GetCoinMetadataOptions,
300
308
  ): Promise<SuiClientTypes.GetCoinMetadataResponse> {
301
- const coinType = (await this.mvr.resolveType({ type: options.coinType })).type;
309
+ const coinType = (
310
+ await this.mvr.resolveType({ type: options.coinType, signal: options.signal })
311
+ ).type;
302
312
 
303
313
  const { data, errors } = await this.#graphqlClient.query({
304
314
  query: GetCoinMetadataDocument,
315
+ signal: options.signal,
305
316
  variables: {
306
317
  coinType,
307
318
  },
@@ -331,6 +342,7 @@ export class GraphQLCoreClient extends CoreClient {
331
342
  const balances = await this.#graphqlQuery(
332
343
  {
333
344
  query: GetAllBalancesDocument,
345
+ signal: options.signal,
334
346
  variables: {
335
347
  owner: options.owner,
336
348
  limit: options.limit,
@@ -361,6 +373,7 @@ export class GraphQLCoreClient extends CoreClient {
361
373
  const result = await this.#graphqlQuery(
362
374
  {
363
375
  query: GetTransactionBlockDocument,
376
+ signal: options.signal,
364
377
  variables: {
365
378
  digest: options.digest,
366
379
  includeTransaction: options.include?.transaction ?? false,
@@ -382,6 +395,7 @@ export class GraphQLCoreClient extends CoreClient {
382
395
  const result = await this.#graphqlQuery(
383
396
  {
384
397
  query: ExecuteTransactionDocument,
398
+ signal: options.signal,
385
399
  variables: {
386
400
  transactionDataBcs: toBase64(options.transaction),
387
401
  signatures: options.signatures,
@@ -417,6 +431,7 @@ export class GraphQLCoreClient extends CoreClient {
417
431
  const result = await this.#graphqlQuery(
418
432
  {
419
433
  query: SimulateTransactionDocument,
434
+ signal: options.signal,
420
435
  variables: {
421
436
  transaction:
422
437
  options.transaction instanceof Uint8Array
@@ -470,10 +485,13 @@ export class GraphQLCoreClient extends CoreClient {
470
485
  };
471
486
  }
472
487
  }
473
- async getReferenceGasPrice(): Promise<SuiClientTypes.GetReferenceGasPriceResponse> {
488
+ async getReferenceGasPrice(
489
+ options?: SuiClientTypes.GetReferenceGasPriceOptions,
490
+ ): Promise<SuiClientTypes.GetReferenceGasPriceResponse> {
474
491
  const result = await this.#graphqlQuery(
475
492
  {
476
493
  query: GetReferenceGasPriceDocument,
494
+ signal: options?.signal,
477
495
  },
478
496
  (result) => result.epoch?.referenceGasPrice,
479
497
  );
@@ -483,10 +501,13 @@ export class GraphQLCoreClient extends CoreClient {
483
501
  };
484
502
  }
485
503
 
486
- async getProtocolConfig(): Promise<SuiClientTypes.GetProtocolConfigResponse> {
504
+ async getProtocolConfig(
505
+ options?: SuiClientTypes.GetProtocolConfigOptions,
506
+ ): Promise<SuiClientTypes.GetProtocolConfigResponse> {
487
507
  const result = await this.#graphqlQuery(
488
508
  {
489
509
  query: GetProtocolConfigDocument,
510
+ signal: options?.signal,
490
511
  },
491
512
  (result) => result.epoch?.protocolConfigs,
492
513
  );
@@ -509,10 +530,13 @@ export class GraphQLCoreClient extends CoreClient {
509
530
  };
510
531
  }
511
532
 
512
- async getCurrentSystemState(): Promise<SuiClientTypes.GetCurrentSystemStateResponse> {
533
+ async getCurrentSystemState(
534
+ options?: SuiClientTypes.GetCurrentSystemStateOptions,
535
+ ): Promise<SuiClientTypes.GetCurrentSystemStateResponse> {
513
536
  const result = await this.#graphqlQuery(
514
537
  {
515
538
  query: GetCurrentSystemStateDocument,
539
+ signal: options?.signal,
516
540
  },
517
541
  (result) => result.epoch,
518
542
  );
@@ -744,6 +768,7 @@ export class GraphQLCoreClient extends CoreClient {
744
768
 
745
769
  const { data } = await this.#graphqlClient.query({
746
770
  query: VerifyZkLoginSignatureDocument,
771
+ signal: options.signal,
747
772
  variables: {
748
773
  bytes: options.bytes,
749
774
  signature: options.signature,
@@ -797,8 +822,11 @@ export class GraphQLCoreClient extends CoreClient {
797
822
  const moveFunction = await this.#graphqlQuery(
798
823
  {
799
824
  query: GetMoveFunctionDocument,
825
+ signal: options.signal,
800
826
  variables: {
801
- package: (await this.mvr.resolvePackage({ package: options.packageId })).package,
827
+ package: (
828
+ await this.mvr.resolvePackage({ package: options.packageId, signal: options.signal })
829
+ ).package,
802
830
  module: options.moduleName,
803
831
  function: options.name,
804
832
  },
@@ -856,9 +884,11 @@ export class GraphQLCoreClient extends CoreClient {
856
884
  }
857
885
 
858
886
  async getChainIdentifier(
859
- _options?: SuiClientTypes.GetChainIdentifierOptions,
887
+ options?: SuiClientTypes.GetChainIdentifierOptions,
860
888
  ): Promise<SuiClientTypes.GetChainIdentifierResponse> {
861
- return this.cache.read(['chainIdentifier'], async () => {
889
+ // The result is cached and shared across callers, so the underlying request must
890
+ // not carry any single caller's signal. Isolate cancellation per-caller instead.
891
+ const cached = this.cache.read(['chainIdentifier'], async () => {
862
892
  const checkpoint = await this.#graphqlQuery(
863
893
  {
864
894
  query: GetChainIdentifierDocument,
@@ -872,6 +902,8 @@ export class GraphQLCoreClient extends CoreClient {
872
902
  chainIdentifier: checkpoint.digest,
873
903
  };
874
904
  });
905
+
906
+ return raceSignal(Promise.resolve(cached), options?.signal);
875
907
  }
876
908
 
877
909
  resolveTransactionPlugin() {
@@ -1225,7 +1225,7 @@ type EndOfEpochTransaction {
1225
1225
  transactions(first: Int, after: String, last: Int, before: String): EndOfEpochTransactionKindConnection
1226
1226
  }
1227
1227
 
1228
- union EndOfEpochTransactionKind = ChangeEpochTransaction | AuthenticatorStateCreateTransaction | AuthenticatorStateExpireTransaction | RandomnessStateCreateTransaction | CoinDenyListStateCreateTransaction | StoreExecutionTimeObservationsTransaction | BridgeStateCreateTransaction | BridgeCommitteeInitTransaction | AccumulatorRootCreateTransaction | CoinRegistryCreateTransaction | DisplayRegistryCreateTransaction | AddressAliasStateCreateTransaction | WriteAccumulatorStorageCostTransaction
1228
+ union EndOfEpochTransactionKind = ChangeEpochTransaction | AuthenticatorStateCreateTransaction | AuthenticatorStateExpireTransaction | RandomnessStateCreateTransaction | CoinDenyListStateCreateTransaction | StoreExecutionTimeObservationsTransaction | BridgeStateCreateTransaction | BridgeCommitteeInitTransaction | AccumulatorRootCreateTransaction | CoinRegistryCreateTransaction | DisplayRegistryCreateTransaction | AddressAliasStateCreateTransaction | WriteAccumulatorStorageCostTransaction | ForwardingAddressRegistryCreateTransaction
1229
1229
 
1230
1230
  type EndOfEpochTransactionKindConnection {
1231
1231
  """
@@ -1578,6 +1578,16 @@ type FeatureFlag {
1578
1578
  }
1579
1579
 
1580
1580
 
1581
+ """
1582
+ System transaction for creating the forwarding address registry.
1583
+ """
1584
+ type ForwardingAddressRegistryCreateTransaction {
1585
+ """
1586
+ A workaround to define an empty variant of a GraphQL union.
1587
+ """
1588
+ _: Boolean
1589
+ }
1590
+
1581
1591
  """
1582
1592
  Access to the gas inputs, after they have been smashed into one coin. The gas coin can only be used by reference, except for with `TransferObjectsTransaction` that can accept it by value.
1583
1593
  """
@@ -3697,6 +3697,10 @@ const introspection = {
3697
3697
  "kind": "OBJECT",
3698
3698
  "name": "DisplayRegistryCreateTransaction"
3699
3699
  },
3700
+ {
3701
+ "kind": "OBJECT",
3702
+ "name": "ForwardingAddressRegistryCreateTransaction"
3703
+ },
3700
3704
  {
3701
3705
  "kind": "OBJECT",
3702
3706
  "name": "RandomnessStateCreateTransaction"
@@ -4551,6 +4555,22 @@ const introspection = {
4551
4555
  ],
4552
4556
  "interfaces": []
4553
4557
  },
4558
+ {
4559
+ "kind": "OBJECT",
4560
+ "name": "ForwardingAddressRegistryCreateTransaction",
4561
+ "fields": [
4562
+ {
4563
+ "name": "_",
4564
+ "type": {
4565
+ "kind": "SCALAR",
4566
+ "name": "Boolean"
4567
+ },
4568
+ "args": [],
4569
+ "isDeprecated": false
4570
+ }
4571
+ ],
4572
+ "interfaces": []
4573
+ },
4554
4574
  {
4555
4575
  "kind": "OBJECT",
4556
4576
  "name": "GasCoin",
@@ -246,8 +246,28 @@ export class SuiGrpcClient extends BaseClient implements SuiClientTypes.Transpor
246
246
  return this.core.simulateTransaction(input) as Promise<GrpcSimulateTransactionResult<Include>>;
247
247
  }
248
248
 
249
- getReferenceGasPrice(): Promise<SuiClientTypes.GetReferenceGasPriceResponse> {
250
- return this.core.getReferenceGasPrice();
249
+ getReferenceGasPrice(
250
+ input?: SuiClientTypes.GetReferenceGasPriceOptions,
251
+ ): Promise<SuiClientTypes.GetReferenceGasPriceResponse> {
252
+ return this.core.getReferenceGasPrice(input);
253
+ }
254
+
255
+ getCurrentSystemState(
256
+ input?: SuiClientTypes.GetCurrentSystemStateOptions,
257
+ ): Promise<SuiClientTypes.GetCurrentSystemStateResponse> {
258
+ return this.core.getCurrentSystemState(input);
259
+ }
260
+
261
+ getProtocolConfig(
262
+ input?: SuiClientTypes.GetProtocolConfigOptions,
263
+ ): Promise<SuiClientTypes.GetProtocolConfigResponse> {
264
+ return this.core.getProtocolConfig(input);
265
+ }
266
+
267
+ getChainIdentifier(
268
+ input?: SuiClientTypes.GetChainIdentifierOptions,
269
+ ): Promise<SuiClientTypes.GetChainIdentifierResponse> {
270
+ return this.core.getChainIdentifier(input);
251
271
  }
252
272
 
253
273
  async listDynamicFields<Include extends DynamicFieldInclude = {}>(
@@ -305,6 +325,12 @@ export class SuiGrpcClient extends BaseClient implements SuiClientTypes.Transpor
305
325
  return this.core.getDynamicField(input);
306
326
  }
307
327
 
328
+ getDynamicObjectField<Include extends SuiClientTypes.ObjectInclude = {}>(
329
+ input: SuiClientTypes.GetDynamicObjectFieldOptions<Include>,
330
+ ): Promise<SuiClientTypes.GetDynamicObjectFieldResponse<Include>> {
331
+ return this.core.getDynamicObjectField(input);
332
+ }
333
+
308
334
  listTransactions<Include extends SuiClientTypes.TransactionInclude = {}>(
309
335
  input: SuiClientTypes.ListTransactionsOptions<Include>,
310
336
  ): Promise<SuiClientTypes.ListTransactionsResponse<Include>> {
@@ -220,6 +220,7 @@ export class SuiJsonRpcClient extends BaseClient {
220
220
  coinType = (
221
221
  await this.core.mvr.resolveType({
222
222
  type: coinType,
223
+ signal,
223
224
  })
224
225
  ).type;
225
226
  }
@@ -272,6 +273,7 @@ export class SuiJsonRpcClient extends BaseClient {
272
273
  coinType = (
273
274
  await this.core.mvr.resolveType({
274
275
  type: coinType,
276
+ signal,
275
277
  })
276
278
  ).type;
277
279
  }
@@ -309,6 +311,7 @@ export class SuiJsonRpcClient extends BaseClient {
309
311
  coinType = (
310
312
  await this.core.mvr.resolveType({
311
313
  type: coinType,
314
+ signal,
312
315
  })
313
316
  ).type;
314
317
  }
@@ -330,6 +333,7 @@ export class SuiJsonRpcClient extends BaseClient {
330
333
  coinType = (
331
334
  await this.core.mvr.resolveType({
332
335
  type: coinType,
336
+ signal,
333
337
  })
334
338
  ).type;
335
339
  }
@@ -371,6 +375,7 @@ export class SuiJsonRpcClient extends BaseClient {
371
375
  pkg = (
372
376
  await this.core.mvr.resolvePackage({
373
377
  package: pkg,
378
+ signal,
374
379
  })
375
380
  ).package;
376
381
  }
@@ -396,6 +401,7 @@ export class SuiJsonRpcClient extends BaseClient {
396
401
  pkg = (
397
402
  await this.core.mvr.resolvePackage({
398
403
  package: pkg,
404
+ signal,
399
405
  })
400
406
  ).package;
401
407
  }
@@ -421,6 +427,7 @@ export class SuiJsonRpcClient extends BaseClient {
421
427
  pkg = (
422
428
  await this.core.mvr.resolvePackage({
423
429
  package: pkg,
430
+ signal,
424
431
  })
425
432
  ).package;
426
433
  }
@@ -447,6 +454,7 @@ export class SuiJsonRpcClient extends BaseClient {
447
454
  pkg = (
448
455
  await this.core.mvr.resolvePackage({
449
456
  package: pkg,
457
+ signal,
450
458
  })
451
459
  ).package;
452
460
  }
@@ -473,6 +481,7 @@ export class SuiJsonRpcClient extends BaseClient {
473
481
  pkg = (
474
482
  await this.core.mvr.resolvePackage({
475
483
  package: pkg,
484
+ signal,
476
485
  })
477
486
  ).package;
478
487
  }
@@ -506,6 +515,7 @@ export class SuiJsonRpcClient extends BaseClient {
506
515
  package: (
507
516
  await this.core.mvr.resolvePackage({
508
517
  package: filter.MoveModule.package,
518
+ signal: input.signal,
509
519
  })
510
520
  ).package,
511
521
  };
@@ -513,6 +523,7 @@ export class SuiJsonRpcClient extends BaseClient {
513
523
  filter.StructType = (
514
524
  await this.core.mvr.resolveType({
515
525
  type: filter.StructType,
526
+ signal: input.signal,
516
527
  })
517
528
  ).type;
518
529
  }
@@ -603,6 +614,7 @@ export class SuiJsonRpcClient extends BaseClient {
603
614
  package: (
604
615
  await this.core.mvr.resolvePackage({
605
616
  package: filter.MoveFunction.package,
617
+ signal,
606
618
  })
607
619
  ).package,
608
620
  },
@@ -820,6 +832,7 @@ export class SuiJsonRpcClient extends BaseClient {
820
832
  MoveEventType: (
821
833
  await this.core.mvr.resolveType({
822
834
  type: query.MoveEventType,
835
+ signal,
823
836
  })
824
837
  ).type,
825
838
  };
@@ -833,6 +846,7 @@ export class SuiJsonRpcClient extends BaseClient {
833
846
  package: (
834
847
  await this.core.mvr.resolvePackage({
835
848
  package: query.MoveEventModule.package,
849
+ signal,
836
850
  })
837
851
  ).package,
838
852
  },
@@ -847,6 +861,7 @@ export class SuiJsonRpcClient extends BaseClient {
847
861
  package: (
848
862
  await this.core.mvr.resolvePackage({
849
863
  package: query.MoveModule.package,
864
+ signal,
850
865
  })
851
866
  ).package,
852
867
  },
@@ -26,6 +26,7 @@ import {
26
26
  resolveTransactionFilter,
27
27
  validateTransactionQuery,
28
28
  } from '../client/query-filters.js';
29
+ import { raceSignal } from '../client/mvr.js';
29
30
  import { Transaction } from '../transactions/Transaction.js';
30
31
  import { computeGasBudget, coreClientResolveTransactionPlugin } from '../client/core-resolver.js';
31
32
  import { TransactionDataBuilder } from '../transactions/TransactionData.js';
@@ -282,7 +283,9 @@ export class JSONRpcCoreClient extends CoreClient {
282
283
  async getCoinMetadata(
283
284
  options: SuiClientTypes.GetCoinMetadataOptions,
284
285
  ): Promise<SuiClientTypes.GetCoinMetadataResponse> {
285
- const coinType = (await this.mvr.resolveType({ type: options.coinType })).type;
286
+ const coinType = (
287
+ await this.mvr.resolveType({ type: options.coinType, signal: options.signal })
288
+ ).type;
286
289
 
287
290
  const result = await this.#jsonRpcClient.getCoinMetadata({
288
291
  coinType,
@@ -402,7 +405,9 @@ export class JSONRpcCoreClient extends CoreClient {
402
405
  overrides: {
403
406
  gasData: {
404
407
  budget: data.gasData.budget ?? String(MAX_GAS),
405
- price: data.gasData.price ?? String(await this.#jsonRpcClient.getReferenceGasPrice()),
408
+ price:
409
+ data.gasData.price ??
410
+ String(await this.#jsonRpcClient.getReferenceGasPrice({ signal: options.signal })),
406
411
  payment: data.gasData.payment ?? [],
407
412
  },
408
413
  },
@@ -627,6 +632,7 @@ export class JSONRpcCoreClient extends CoreClient {
627
632
  parentId: options.parentId,
628
633
  limit: options.limit,
629
634
  cursor: options.cursor,
635
+ signal: options.signal,
630
636
  });
631
637
 
632
638
  return {
@@ -775,6 +781,7 @@ export class JSONRpcCoreClient extends CoreClient {
775
781
  */
776
782
  async verifyZkLoginSignature(options: SuiClientTypes.VerifyZkLoginSignatureOptions) {
777
783
  const result = await this.#jsonRpcClient.verifyZkLoginSignature({
784
+ signal: options.signal,
778
785
  bytes: options.bytes,
779
786
  signature: options.signature,
780
787
  intentScope: options.intentScope,
@@ -829,12 +836,14 @@ export class JSONRpcCoreClient extends CoreClient {
829
836
  async getMoveFunction(
830
837
  options: SuiClientTypes.GetMoveFunctionOptions,
831
838
  ): Promise<SuiClientTypes.GetMoveFunctionResponse> {
832
- const resolvedPackageId = (await this.mvr.resolvePackage({ package: options.packageId }))
833
- .package;
839
+ const resolvedPackageId = (
840
+ await this.mvr.resolvePackage({ package: options.packageId, signal: options.signal })
841
+ ).package;
834
842
  const result = await this.#jsonRpcClient.getNormalizedMoveFunction({
835
843
  package: resolvedPackageId,
836
844
  module: options.moduleName,
837
845
  function: options.name,
846
+ signal: options.signal,
838
847
  });
839
848
 
840
849
  return {
@@ -859,14 +868,18 @@ export class JSONRpcCoreClient extends CoreClient {
859
868
  * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
860
869
  */
861
870
  async getChainIdentifier(
862
- _options?: SuiClientTypes.GetChainIdentifierOptions,
871
+ options?: SuiClientTypes.GetChainIdentifierOptions,
863
872
  ): Promise<SuiClientTypes.GetChainIdentifierResponse> {
864
- return this.cache.read(['chainIdentifier'], async () => {
873
+ // The result is cached and shared across callers, so the underlying request must
874
+ // not carry any single caller's signal. Isolate cancellation per-caller instead.
875
+ const cached = this.cache.read(['chainIdentifier'], async () => {
865
876
  const checkpoint = await this.#jsonRpcClient.getCheckpoint({ id: '0' });
866
877
  return {
867
878
  chainIdentifier: checkpoint.digest,
868
879
  };
869
880
  });
881
+
882
+ return raceSignal(Promise.resolve(cached), options?.signal);
870
883
  }
871
884
  }
872
885
 
package/src/version.ts CHANGED
@@ -3,4 +3,4 @@
3
3
 
4
4
  // This file is generated by genversion.mjs. Do not edit it directly.
5
5
 
6
- export const PACKAGE_VERSION = '2.24.0';
6
+ export const PACKAGE_VERSION = '2.25.0';