@mysten/sui 2.6.0 → 2.7.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 (50) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/bcs/index.d.mts +20 -20
  3. package/dist/client/types.d.mts +17 -0
  4. package/dist/client/types.d.mts.map +1 -1
  5. package/dist/cryptography/signature.d.mts +8 -8
  6. package/dist/graphql/core.d.mts.map +1 -1
  7. package/dist/graphql/core.mjs +21 -8
  8. package/dist/graphql/core.mjs.map +1 -1
  9. package/dist/graphql/generated/queries.d.mts.map +1 -1
  10. package/dist/graphql/generated/queries.mjs +18 -3
  11. package/dist/graphql/generated/queries.mjs.map +1 -1
  12. package/dist/graphql/generated/tada-env.d.mts +703 -73
  13. package/dist/grpc/core.d.mts.map +1 -1
  14. package/dist/grpc/core.mjs +15 -2
  15. package/dist/grpc/core.mjs.map +1 -1
  16. package/dist/grpc/proto/sui/rpc/v2/ledger_service.client.d.mts +4 -4
  17. package/dist/grpc/proto/sui/rpc/v2/move_package_service.client.d.mts +4 -4
  18. package/dist/grpc/proto/sui/rpc/v2/object.d.mts +38 -1
  19. package/dist/grpc/proto/sui/rpc/v2/object.d.mts.map +1 -1
  20. package/dist/grpc/proto/sui/rpc/v2/object.mjs +26 -1
  21. package/dist/grpc/proto/sui/rpc/v2/object.mjs.map +1 -1
  22. package/dist/grpc/proto/sui/rpc/v2/signature_verification_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/grpc/proto/sui/rpc/v2/transaction_execution_service.d.mts +8 -0
  26. package/dist/grpc/proto/sui/rpc/v2/transaction_execution_service.d.mts.map +1 -1
  27. package/dist/grpc/proto/sui/rpc/v2/transaction_execution_service.mjs +23 -12
  28. package/dist/grpc/proto/sui/rpc/v2/transaction_execution_service.mjs.map +1 -1
  29. package/dist/grpc/proto/types.d.mts +2 -2
  30. package/dist/grpc/proto/types.mjs +2 -1
  31. package/dist/jsonRpc/core.d.mts.map +1 -1
  32. package/dist/jsonRpc/core.mjs +10 -3
  33. package/dist/jsonRpc/core.mjs.map +1 -1
  34. package/dist/transactions/Transaction.d.mts +3 -3
  35. package/dist/transactions/Transaction.d.mts.map +1 -1
  36. package/dist/version.mjs +1 -1
  37. package/dist/version.mjs.map +1 -1
  38. package/package.json +1 -1
  39. package/src/client/types.ts +16 -0
  40. package/src/graphql/core.ts +34 -13
  41. package/src/graphql/generated/queries.ts +252 -14
  42. package/src/graphql/generated/schema.graphql +324 -8
  43. package/src/graphql/generated/tada-env.ts +844 -99
  44. package/src/graphql/queries/objects.graphql +10 -0
  45. package/src/graphql/queries/verifyZkLoginSignature.graphql +0 -1
  46. package/src/grpc/core.ts +34 -0
  47. package/src/grpc/proto/sui/rpc/v2/object.ts +44 -0
  48. package/src/grpc/proto/sui/rpc/v2/transaction_execution_service.ts +16 -0
  49. package/src/jsonRpc/core.ts +9 -0
  50. package/src/version.ts +1 -1
@@ -10,6 +10,7 @@ query getOwnedObjects(
10
10
  $includePreviousTransaction: Boolean = false
11
11
  $includeObjectBcs: Boolean = false
12
12
  $includeJson: Boolean = false
13
+ $includeDisplay: Boolean = false
13
14
  ) {
14
15
  address(address: $owner) {
15
16
  objects(first: $limit, after: $cursor, filter: $filter) {
@@ -30,6 +31,7 @@ query multiGetObjects(
30
31
  $includePreviousTransaction: Boolean = false
31
32
  $includeObjectBcs: Boolean = false
32
33
  $includeJson: Boolean = false
34
+ $includeDisplay: Boolean = false
33
35
  ) {
34
36
  multiGetObjects(keys: $objectKeys) {
35
37
  ...OBJECT_FIELDS
@@ -45,6 +47,10 @@ fragment OBJECT_FIELDS on Object {
45
47
  contents {
46
48
  bcs @include(if: $includeContent)
47
49
  json @include(if: $includeJson)
50
+ display @include(if: $includeDisplay) {
51
+ output
52
+ errors
53
+ }
48
54
  type {
49
55
  repr
50
56
  }
@@ -69,6 +75,10 @@ fragment MOVE_OBJECT_FIELDS on MoveObject {
69
75
  contents {
70
76
  bcs @include(if: $includeContent)
71
77
  json @include(if: $includeJson)
78
+ display @include(if: $includeDisplay) {
79
+ output
80
+ errors
81
+ }
72
82
  type {
73
83
  repr
74
84
  }
@@ -11,6 +11,5 @@ query verifyZkLoginSignature(
11
11
  author: $author
12
12
  ) {
13
13
  success
14
- error
15
14
  }
16
15
  }
package/src/grpc/core.ts CHANGED
@@ -74,6 +74,9 @@ export class GrpcCoreClient extends CoreClient {
74
74
  if (options.include?.json) {
75
75
  paths.push('json');
76
76
  }
77
+ if (options.include?.display) {
78
+ paths.push('display');
79
+ }
77
80
 
78
81
  for (const batch of batches) {
79
82
  const response = await this.#client.ledgerService.batchGetObjects({
@@ -110,6 +113,11 @@ export class GrpcCoreClient extends CoreClient {
110
113
  : null
111
114
  : undefined;
112
115
 
116
+ const displayData = mapDisplayProto(
117
+ options.include?.display,
118
+ object.result.object.display,
119
+ );
120
+
113
121
  return {
114
122
  objectId: object.result.object.objectId!,
115
123
  version: object.result.object.version?.toString()!,
@@ -121,6 +129,7 @@ export class GrpcCoreClient extends CoreClient {
121
129
  undefined) as SuiClientTypes.Object<Include>['previousTransaction'],
122
130
  objectBcs: objectBcs as SuiClientTypes.Object<Include>['objectBcs'],
123
131
  json: jsonContent as SuiClientTypes.Object<Include>['json'],
132
+ display: displayData as SuiClientTypes.Object<Include>['display'],
124
133
  };
125
134
  }),
126
135
  );
@@ -146,6 +155,9 @@ export class GrpcCoreClient extends CoreClient {
146
155
  if (options.include?.json) {
147
156
  paths.push('json');
148
157
  }
158
+ if (options.include?.display) {
159
+ paths.push('display');
160
+ }
149
161
 
150
162
  const response = await this.#client.stateService.listOwnedObjects({
151
163
  owner: options.owner,
@@ -175,6 +187,10 @@ export class GrpcCoreClient extends CoreClient {
175
187
  ? (Value.toJson(object.json) as Record<string, unknown>)
176
188
  : null
177
189
  : undefined) as SuiClientTypes.Object<Include>['json'],
190
+ display: mapDisplayProto(
191
+ options.include?.display,
192
+ object.display,
193
+ ) as SuiClientTypes.Object<Include>['display'],
178
194
  }),
179
195
  );
180
196
 
@@ -752,6 +768,24 @@ export class GrpcCoreClient extends CoreClient {
752
768
  }
753
769
  }
754
770
 
771
+ function mapDisplayProto(
772
+ include: boolean | undefined,
773
+ display: { output?: Value; errors?: Value } | undefined,
774
+ ): SuiClientTypes.Display | null | undefined {
775
+ if (!include) return undefined;
776
+ if (display === undefined) return null;
777
+ return {
778
+ output:
779
+ display.output !== undefined
780
+ ? (Value.toJson(display.output) as Record<string, string> | null)
781
+ : null,
782
+ errors:
783
+ display.errors !== undefined
784
+ ? (Value.toJson(display.errors) as Record<string, string> | null)
785
+ : null,
786
+ };
787
+ }
788
+
755
789
  function mapOwner(owner: Owner | null | undefined): SuiClientTypes.ObjectOwner | null {
756
790
  if (!owner) {
757
791
  return null;
@@ -107,6 +107,13 @@ export interface Object {
107
107
  * @generated from protobuf field: optional uint64 balance = 101;
108
108
  */
109
109
  balance?: bigint;
110
+ /**
111
+ * JSON rendering of the object based on an on-chain template.
112
+ * This will not be set if the value's type does not have an associated `Display` template.
113
+ *
114
+ * @generated from protobuf field: optional sui.rpc.v2.Display display = 102;
115
+ */
116
+ display?: Display;
110
117
  }
111
118
  /**
112
119
  * Set of Objects
@@ -121,6 +128,29 @@ export interface ObjectSet {
121
128
  */
122
129
  objects: Object[];
123
130
  }
131
+ /**
132
+ * A rendered JSON blob based on an on-chain template.
133
+ *
134
+ * @generated from protobuf message sui.rpc.v2.Display
135
+ */
136
+ export interface Display {
137
+ /**
138
+ * Output for all successfully substituted display fields. Unsuccessful
139
+ * fields will be `null`, and will be accompanied by a field in `errors`,
140
+ * explaining the error.
141
+ *
142
+ * @generated from protobuf field: optional google.protobuf.Value output = 1;
143
+ */
144
+ output?: Value;
145
+ /**
146
+ * If any fields failed to render, this will contain a mapping from failed
147
+ * field names to error messages. If all fields succeed, this will either be
148
+ * `null` or not set.
149
+ *
150
+ * @generated from protobuf field: optional google.protobuf.Value errors = 2;
151
+ */
152
+ errors?: Value;
153
+ }
124
154
  // @generated message type with reflection information, may provide speed optimized methods
125
155
  class Object$Type extends MessageType<Object> {
126
156
  constructor() {
@@ -165,6 +195,7 @@ class Object$Type extends MessageType<Object> {
165
195
  T: 4 /*ScalarType.UINT64*/,
166
196
  L: 0 /*LongType.BIGINT*/,
167
197
  },
198
+ { no: 102, name: 'display', kind: 'message', T: () => Display },
168
199
  ]);
169
200
  }
170
201
  }
@@ -184,3 +215,16 @@ class ObjectSet$Type extends MessageType<ObjectSet> {
184
215
  * @generated MessageType for protobuf message sui.rpc.v2.ObjectSet
185
216
  */
186
217
  export const ObjectSet = new ObjectSet$Type();
218
+ // @generated message type with reflection information, may provide speed optimized methods
219
+ class Display$Type extends MessageType<Display> {
220
+ constructor() {
221
+ super('sui.rpc.v2.Display', [
222
+ { no: 1, name: 'output', kind: 'message', T: () => Value },
223
+ { no: 2, name: 'errors', kind: 'message', T: () => Value },
224
+ ]);
225
+ }
226
+ }
227
+ /**
228
+ * @generated MessageType for protobuf message sui.rpc.v2.Display
229
+ */
230
+ export const Display = new Display$Type();
@@ -111,6 +111,14 @@ export interface SimulateTransactionResponse {
111
111
  * @generated from protobuf field: repeated sui.rpc.v2.CommandResult command_outputs = 2;
112
112
  */
113
113
  commandOutputs: CommandResult[];
114
+ /**
115
+ * A suggested gas price to use, that is above RGP, in order to provide a
116
+ * better chance of the transaction being included in the presence of
117
+ * congested objects.
118
+ *
119
+ * @generated from protobuf field: optional uint64 suggested_gas_price = 3;
120
+ */
121
+ suggestedGasPrice?: bigint;
114
122
  }
115
123
  /**
116
124
  * An intermediate result/output from the execution of a single command
@@ -214,6 +222,14 @@ class SimulateTransactionResponse$Type extends MessageType<SimulateTransactionRe
214
222
  repeat: 1 /*RepeatType.PACKED*/,
215
223
  T: () => CommandResult,
216
224
  },
225
+ {
226
+ no: 3,
227
+ name: 'suggested_gas_price',
228
+ kind: 'scalar',
229
+ opt: true,
230
+ T: 4 /*ScalarType.UINT64*/,
231
+ L: 0 /*LongType.BIGINT*/,
232
+ },
217
233
  ]);
218
234
  }
219
235
  }
@@ -131,6 +131,7 @@ export class JSONRpcCoreClient extends CoreClient {
131
131
  options.include?.previousTransaction || options.include?.objectBcs ? true : false,
132
132
  showStorageRebate: options.include?.objectBcs ?? false,
133
133
  showContent: options.include?.json ?? false,
134
+ showDisplay: options.include?.display ?? false,
134
135
  },
135
136
  signal: options.signal,
136
137
  });
@@ -175,6 +176,7 @@ export class JSONRpcCoreClient extends CoreClient {
175
176
  options.include?.previousTransaction || options.include?.objectBcs ? true : false,
176
177
  showStorageRebate: options.include?.objectBcs ?? false,
177
178
  showContent: options.include?.json ?? false,
179
+ showDisplay: options.include?.display ?? false,
178
180
  },
179
181
  filter,
180
182
  signal: options.signal,
@@ -687,6 +689,12 @@ function parseObject<Include extends SuiClientTypes.ObjectInclude = {}>(
687
689
  ? null
688
690
  : undefined;
689
691
 
692
+ const displayData = include?.display
693
+ ? object.display?.data != null
694
+ ? { output: object.display.data as Record<string, string>, errors: null }
695
+ : null
696
+ : undefined;
697
+
690
698
  return {
691
699
  objectId: object.objectId,
692
700
  version: object.version,
@@ -701,6 +709,7 @@ function parseObject<Include extends SuiClientTypes.ObjectInclude = {}>(
701
709
  : undefined) as SuiClientTypes.Object<Include>['previousTransaction'],
702
710
  objectBcs: objectBcs as SuiClientTypes.Object<Include>['objectBcs'],
703
711
  json: jsonContent as SuiClientTypes.Object<Include>['json'],
712
+ display: displayData as SuiClientTypes.Object<Include>['display'],
704
713
  };
705
714
  }
706
715
 
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.6.0';
6
+ export const PACKAGE_VERSION = '2.7.0';
7
7
  export const TARGETED_RPC_VERSION = '1.68.0';