@mysten/sui 2.9.1 → 2.10.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 (43) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/client/core.d.mts +1 -0
  3. package/dist/client/core.d.mts.map +1 -1
  4. package/dist/client/core.mjs +17 -4
  5. package/dist/client/core.mjs.map +1 -1
  6. package/dist/client/types.d.mts +16 -0
  7. package/dist/client/types.d.mts.map +1 -1
  8. package/dist/graphql/core.d.mts +1 -0
  9. package/dist/graphql/core.d.mts.map +1 -1
  10. package/dist/graphql/core.mjs +13 -1
  11. package/dist/graphql/core.mjs.map +1 -1
  12. package/dist/graphql/generated/queries.d.mts.map +1 -1
  13. package/dist/graphql/generated/queries.mjs +18 -1
  14. package/dist/graphql/generated/queries.mjs.map +1 -1
  15. package/dist/grpc/core.d.mts +1 -0
  16. package/dist/grpc/core.d.mts.map +1 -1
  17. package/dist/grpc/core.mjs +12 -0
  18. package/dist/grpc/core.mjs.map +1 -1
  19. package/dist/grpc/proto/sui/rpc/v2/ledger_service.client.d.mts +4 -4
  20. package/dist/grpc/proto/sui/rpc/v2/move_package_service.client.d.mts +4 -4
  21. package/dist/grpc/proto/sui/rpc/v2/signature_verification_service.client.d.mts +4 -4
  22. package/dist/grpc/proto/sui/rpc/v2/state_service.client.d.mts +4 -4
  23. package/dist/grpc/proto/sui/rpc/v2/transaction.d.mts.map +1 -1
  24. package/dist/grpc/proto/sui/rpc/v2/transaction_execution_service.client.d.mts +4 -4
  25. package/dist/jsonRpc/core.d.mts +1 -0
  26. package/dist/jsonRpc/core.d.mts.map +1 -1
  27. package/dist/jsonRpc/core.mjs +19 -0
  28. package/dist/jsonRpc/core.mjs.map +1 -1
  29. package/dist/transactions/data/internal.d.mts +109 -109
  30. package/dist/transactions/data/internal.d.mts.map +1 -1
  31. package/dist/transactions/data/v1.d.mts +220 -220
  32. package/dist/transactions/data/v1.d.mts.map +1 -1
  33. package/dist/version.mjs +1 -1
  34. package/dist/version.mjs.map +1 -1
  35. package/package.json +3 -3
  36. package/src/client/core.ts +34 -4
  37. package/src/client/types.ts +20 -0
  38. package/src/graphql/core.ts +27 -0
  39. package/src/graphql/generated/queries.ts +22 -0
  40. package/src/graphql/queries/getProtocolConfig.graphql +18 -0
  41. package/src/grpc/core.ts +27 -0
  42. package/src/jsonRpc/core.ts +34 -0
  43. package/src/version.ts +1 -1
@@ -404,6 +404,8 @@ export namespace SuiClientTypes {
404
404
  Include extends TransactionInclude = {},
405
405
  > extends GetTransactionOptions<Include> {
406
406
  timeout?: number;
407
+ /** Absolute times (ms from start) to poll, e.g. [0, 300, 600, 1500]. After exhausted, repeats the last interval. */
408
+ pollSchedule?: number[];
407
409
  result?: never;
408
410
  }
409
411
 
@@ -413,6 +415,8 @@ export namespace SuiClientTypes {
413
415
  result: TransactionResult<any>;
414
416
  include?: Include & TransactionInclude;
415
417
  timeout?: number;
418
+ /** Absolute times (ms from start) to poll, e.g. [0, 300, 600, 1500]. After exhausted, repeats the last interval. */
419
+ pollSchedule?: number[];
416
420
  digest?: never;
417
421
  }
418
422
 
@@ -464,6 +468,22 @@ export namespace SuiClientTypes {
464
468
  systemState: SystemStateInfo;
465
469
  }
466
470
 
471
+ export interface GetProtocolConfigOptions extends CoreClientMethodOptions {}
472
+
473
+ export interface TransportMethods {
474
+ getProtocolConfig?: (options?: GetProtocolConfigOptions) => Promise<GetProtocolConfigResponse>;
475
+ }
476
+
477
+ export interface GetProtocolConfigResponse {
478
+ protocolConfig: ProtocolConfig;
479
+ }
480
+
481
+ export interface ProtocolConfig {
482
+ protocolVersion: string;
483
+ featureFlags: Record<string, boolean>;
484
+ attributes: Record<string, string | null>;
485
+ }
486
+
467
487
  export interface GetChainIdentifierOptions extends CoreClientMethodOptions {}
468
488
 
469
489
  export interface TransportMethods {
@@ -24,6 +24,7 @@ import {
24
24
  GetCoinsDocument,
25
25
  GetCurrentSystemStateDocument,
26
26
  GetMoveFunctionDocument,
27
+ GetProtocolConfigDocument,
27
28
  GetOwnedObjectsDocument,
28
29
  GetReferenceGasPriceDocument,
29
30
  GetTransactionBlockDocument,
@@ -453,6 +454,32 @@ export class GraphQLCoreClient extends CoreClient {
453
454
  };
454
455
  }
455
456
 
457
+ async getProtocolConfig(): Promise<SuiClientTypes.GetProtocolConfigResponse> {
458
+ const result = await this.#graphqlQuery(
459
+ {
460
+ query: GetProtocolConfigDocument,
461
+ },
462
+ (result) => result.epoch?.protocolConfigs,
463
+ );
464
+
465
+ const featureFlags: Record<string, boolean> = {};
466
+ for (const flag of result?.featureFlags ?? []) {
467
+ featureFlags[flag.key] = flag.value;
468
+ }
469
+ const attributes: Record<string, string | null> = {};
470
+ for (const config of result?.configs ?? []) {
471
+ attributes[config.key] = config.value ?? null;
472
+ }
473
+
474
+ return {
475
+ protocolConfig: {
476
+ protocolVersion: result?.protocolVersion?.toString() ?? (null as never),
477
+ featureFlags,
478
+ attributes,
479
+ },
480
+ };
481
+ }
482
+
456
483
  async getCurrentSystemState(): Promise<SuiClientTypes.GetCurrentSystemStateResponse> {
457
484
  const result = await this.#graphqlQuery(
458
485
  {
@@ -4868,6 +4868,11 @@ export type GetMoveFunctionQueryVariables = Exact<{
4868
4868
 
4869
4869
  export type GetMoveFunctionQuery = { __typename?: 'Query', package?: { __typename?: 'MovePackage', module?: { __typename?: 'MoveModule', function?: { __typename?: 'MoveFunction', name: string, visibility?: MoveVisibility | null, isEntry?: boolean | null, typeParameters?: Array<{ __typename?: 'MoveFunctionTypeParameter', constraints: Array<MoveAbility> }> | null, parameters?: Array<{ __typename?: 'OpenMoveType', signature: OpenMoveTypeSignature }> | null, return?: Array<{ __typename?: 'OpenMoveType', signature: OpenMoveTypeSignature }> | null } | null } | null } | null };
4870
4870
 
4871
+ export type GetProtocolConfigQueryVariables = Exact<{ [key: string]: never; }>;
4872
+
4873
+
4874
+ export type GetProtocolConfigQuery = { __typename?: 'Query', epoch?: { __typename?: 'Epoch', protocolConfigs?: { __typename?: 'ProtocolConfigs', protocolVersion: number, featureFlags: Array<{ __typename?: 'FeatureFlag', key: string, value: boolean }>, configs: Array<{ __typename?: 'ProtocolConfig', key: string, value?: string | null }> } | null } | null };
4875
+
4871
4876
  export type GetReferenceGasPriceQueryVariables = Exact<{ [key: string]: never; }>;
4872
4877
 
4873
4878
 
@@ -5402,6 +5407,23 @@ export const GetMoveFunctionDocument = new TypedDocumentString(`
5402
5407
  }
5403
5408
  }
5404
5409
  `) as unknown as TypedDocumentString<GetMoveFunctionQuery, GetMoveFunctionQueryVariables>;
5410
+ export const GetProtocolConfigDocument = new TypedDocumentString(`
5411
+ query getProtocolConfig {
5412
+ epoch {
5413
+ protocolConfigs {
5414
+ protocolVersion
5415
+ featureFlags {
5416
+ key
5417
+ value
5418
+ }
5419
+ configs {
5420
+ key
5421
+ value
5422
+ }
5423
+ }
5424
+ }
5425
+ }
5426
+ `) as unknown as TypedDocumentString<GetProtocolConfigQuery, GetProtocolConfigQueryVariables>;
5405
5427
  export const GetReferenceGasPriceDocument = new TypedDocumentString(`
5406
5428
  query getReferenceGasPrice {
5407
5429
  epoch {
@@ -0,0 +1,18 @@
1
+ # Copyright (c) Mysten Labs, Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ query getProtocolConfig {
5
+ epoch {
6
+ protocolConfigs {
7
+ protocolVersion
8
+ featureFlags {
9
+ key
10
+ value
11
+ }
12
+ configs {
13
+ key
14
+ value
15
+ }
16
+ }
17
+ }
18
+ }
package/src/grpc/core.ts CHANGED
@@ -492,6 +492,33 @@ export class GrpcCoreClient extends CoreClient {
492
492
  };
493
493
  }
494
494
 
495
+ async getProtocolConfig(): Promise<SuiClientTypes.GetProtocolConfigResponse> {
496
+ const response = await this.#client.ledgerService.getEpoch({
497
+ readMask: { paths: ['protocol_config'] },
498
+ });
499
+
500
+ const protocolConfig = response.response.epoch?.protocolConfig;
501
+ if (!protocolConfig) {
502
+ throw new Error('Protocol config not found in response');
503
+ }
504
+
505
+ const featureFlags: Record<string, boolean> = { ...protocolConfig.featureFlags };
506
+ const attributes: Record<string, string | null> = {};
507
+ if (protocolConfig.attributes) {
508
+ for (const [key, value] of Object.entries(protocolConfig.attributes)) {
509
+ attributes[key] = value ?? null;
510
+ }
511
+ }
512
+
513
+ return {
514
+ protocolConfig: {
515
+ protocolVersion: protocolConfig.protocolVersion?.toString() ?? (null as never),
516
+ featureFlags,
517
+ attributes,
518
+ },
519
+ };
520
+ }
521
+
495
522
  async getCurrentSystemState(): Promise<SuiClientTypes.GetCurrentSystemStateResponse> {
496
523
  const response = await this.#client.ledgerService.getEpoch({
497
524
  readMask: {
@@ -457,6 +457,40 @@ export class JSONRpcCoreClient extends CoreClient {
457
457
  };
458
458
  }
459
459
 
460
+ async getProtocolConfig(
461
+ options?: SuiClientTypes.GetProtocolConfigOptions,
462
+ ): Promise<SuiClientTypes.GetProtocolConfigResponse> {
463
+ const result = await this.#jsonRpcClient.getProtocolConfig({ signal: options?.signal });
464
+
465
+ const attributes: Record<string, string | null> = {};
466
+ for (const [key, value] of Object.entries(result.attributes)) {
467
+ if (value === null) {
468
+ attributes[key] = null;
469
+ } else if ('u16' in value) {
470
+ attributes[key] = value.u16;
471
+ } else if ('u32' in value) {
472
+ attributes[key] = value.u32;
473
+ } else if ('u64' in value) {
474
+ attributes[key] = value.u64;
475
+ } else if ('f64' in value) {
476
+ attributes[key] = value.f64;
477
+ } else if ('bool' in value) {
478
+ attributes[key] = value.bool;
479
+ } else {
480
+ const entries = Object.entries(value);
481
+ attributes[key] = entries.length === 1 ? String(entries[0][1]) : JSON.stringify(value);
482
+ }
483
+ }
484
+
485
+ return {
486
+ protocolConfig: {
487
+ protocolVersion: result.protocolVersion,
488
+ featureFlags: { ...result.featureFlags },
489
+ attributes,
490
+ },
491
+ };
492
+ }
493
+
460
494
  async getCurrentSystemState(
461
495
  options?: SuiClientTypes.GetCurrentSystemStateOptions,
462
496
  ): Promise<SuiClientTypes.GetCurrentSystemStateResponse> {
package/src/version.ts CHANGED
@@ -3,5 +3,5 @@
3
3
 
4
4
  // This file is generated by genversion.mjs. Do not edit it directly.
5
5
 
6
- export const PACKAGE_VERSION = '2.9.1';
6
+ export const PACKAGE_VERSION = '2.10.0';
7
7
  export const TARGETED_RPC_VERSION = '1.69.0';