@mysten/sui 1.17.0 → 1.18.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 (97) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/client/types/generated.d.ts +76 -27
  3. package/dist/cjs/client/types/generated.js.map +1 -1
  4. package/dist/cjs/client/types/params.d.ts +5 -1
  5. package/dist/cjs/client/types/params.js.map +1 -1
  6. package/dist/cjs/cryptography/publickey.d.ts +4 -0
  7. package/dist/cjs/cryptography/publickey.js +6 -0
  8. package/dist/cjs/cryptography/publickey.js.map +2 -2
  9. package/dist/cjs/graphql/generated/latest/tada-env.d.js +17 -0
  10. package/dist/cjs/graphql/generated/latest/tada-env.d.js.map +7 -0
  11. package/dist/cjs/graphql/generated/latest/tsconfig.tada.js +12 -0
  12. package/dist/cjs/graphql/generated/latest/tsconfig.tada.js.map +7 -0
  13. package/dist/cjs/graphql/schemas/latest/index.d.ts +9831 -0
  14. package/dist/cjs/graphql/schemas/latest/index.js +31 -0
  15. package/dist/cjs/graphql/schemas/latest/index.js.map +7 -0
  16. package/dist/cjs/keypairs/ed25519/ed25519-hd-key.d.ts +0 -5
  17. package/dist/cjs/keypairs/ed25519/ed25519-hd-key.js +1 -25
  18. package/dist/cjs/keypairs/ed25519/ed25519-hd-key.js.map +3 -3
  19. package/dist/cjs/keypairs/ed25519/keypair.js +22 -18
  20. package/dist/cjs/keypairs/ed25519/keypair.js.map +3 -3
  21. package/dist/cjs/keypairs/ed25519/publickey.js +2 -12
  22. package/dist/cjs/keypairs/ed25519/publickey.js.map +3 -3
  23. package/dist/cjs/transactions/ObjectCache.d.ts +2 -1
  24. package/dist/cjs/transactions/ObjectCache.js +8 -3
  25. package/dist/cjs/transactions/ObjectCache.js.map +2 -2
  26. package/dist/cjs/transactions/Transaction.d.ts +5 -1
  27. package/dist/cjs/transactions/Transaction.js +8 -8
  28. package/dist/cjs/transactions/Transaction.js.map +2 -2
  29. package/dist/cjs/transactions/executor/serial.d.ts +2 -2
  30. package/dist/cjs/transactions/executor/serial.js +3 -5
  31. package/dist/cjs/transactions/executor/serial.js.map +3 -3
  32. package/dist/cjs/verify/verify.d.ts +5 -1
  33. package/dist/cjs/verify/verify.js +10 -1
  34. package/dist/cjs/verify/verify.js.map +2 -2
  35. package/dist/cjs/version.d.ts +1 -1
  36. package/dist/cjs/version.js +1 -1
  37. package/dist/cjs/version.js.map +1 -1
  38. package/dist/cjs/zklogin/publickey.d.ts +4 -0
  39. package/dist/cjs/zklogin/publickey.js +22 -10
  40. package/dist/cjs/zklogin/publickey.js.map +2 -2
  41. package/dist/esm/client/types/generated.d.ts +76 -27
  42. package/dist/esm/client/types/params.d.ts +5 -1
  43. package/dist/esm/cryptography/publickey.d.ts +4 -0
  44. package/dist/esm/cryptography/publickey.js +6 -0
  45. package/dist/esm/cryptography/publickey.js.map +2 -2
  46. package/dist/esm/graphql/generated/latest/tada-env.d.js +1 -0
  47. package/dist/esm/graphql/generated/latest/tada-env.d.js.map +7 -0
  48. package/dist/esm/graphql/generated/latest/tsconfig.tada.js +17 -0
  49. package/dist/esm/graphql/generated/latest/tsconfig.tada.js.map +7 -0
  50. package/dist/esm/graphql/schemas/latest/index.d.ts +9831 -0
  51. package/dist/esm/graphql/schemas/latest/index.js +10 -0
  52. package/dist/esm/graphql/schemas/latest/index.js.map +7 -0
  53. package/dist/esm/keypairs/ed25519/ed25519-hd-key.d.ts +0 -5
  54. package/dist/esm/keypairs/ed25519/ed25519-hd-key.js +1 -15
  55. package/dist/esm/keypairs/ed25519/ed25519-hd-key.js.map +2 -2
  56. package/dist/esm/keypairs/ed25519/keypair.js +22 -8
  57. package/dist/esm/keypairs/ed25519/keypair.js.map +2 -2
  58. package/dist/esm/keypairs/ed25519/publickey.js +2 -2
  59. package/dist/esm/keypairs/ed25519/publickey.js.map +2 -2
  60. package/dist/esm/transactions/ObjectCache.d.ts +2 -1
  61. package/dist/esm/transactions/ObjectCache.js +8 -3
  62. package/dist/esm/transactions/ObjectCache.js.map +2 -2
  63. package/dist/esm/transactions/Transaction.d.ts +5 -1
  64. package/dist/esm/transactions/Transaction.js +8 -8
  65. package/dist/esm/transactions/Transaction.js.map +2 -2
  66. package/dist/esm/transactions/executor/serial.d.ts +2 -2
  67. package/dist/esm/transactions/executor/serial.js +3 -5
  68. package/dist/esm/transactions/executor/serial.js.map +2 -2
  69. package/dist/esm/verify/verify.d.ts +5 -1
  70. package/dist/esm/verify/verify.js +10 -1
  71. package/dist/esm/verify/verify.js.map +2 -2
  72. package/dist/esm/version.d.ts +1 -1
  73. package/dist/esm/version.js +1 -1
  74. package/dist/esm/version.js.map +1 -1
  75. package/dist/esm/zklogin/publickey.d.ts +4 -0
  76. package/dist/esm/zklogin/publickey.js +21 -9
  77. package/dist/esm/zklogin/publickey.js.map +2 -2
  78. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  79. package/dist/tsconfig.tsbuildinfo +1 -1
  80. package/graphql/schemas/latest/package.json +6 -0
  81. package/package.json +5 -2
  82. package/src/client/types/generated.ts +110 -59
  83. package/src/client/types/params.ts +5 -1
  84. package/src/cryptography/publickey.ts +7 -0
  85. package/src/graphql/generated/latest/schema.graphql +4808 -0
  86. package/src/graphql/generated/latest/tada-env.d.ts +220 -0
  87. package/src/graphql/generated/latest/tsconfig.tada.json +11 -0
  88. package/src/graphql/schemas/latest/index.ts +17 -0
  89. package/src/keypairs/ed25519/ed25519-hd-key.ts +4 -14
  90. package/src/keypairs/ed25519/keypair.ts +23 -8
  91. package/src/keypairs/ed25519/publickey.ts +2 -2
  92. package/src/transactions/ObjectCache.ts +5 -1
  93. package/src/transactions/Transaction.ts +18 -14
  94. package/src/transactions/executor/serial.ts +3 -5
  95. package/src/verify/verify.ts +21 -3
  96. package/src/version.ts +1 -1
  97. package/src/zklogin/publickey.ts +19 -8
@@ -0,0 +1,6 @@
1
+ {
2
+ "private": true,
3
+ "import": "../../../dist/esm/graphql/schemas/latest/index.js",
4
+ "main": "../../../dist/cjs/graphql/schemas/latest/index.js",
5
+ "sideEffects": false
6
+ }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "author": "Mysten Labs <build@mystenlabs.com>",
4
4
  "description": "Sui TypeScript API(Work in Progress)",
5
5
  "homepage": "https://sdk.mystenlabs.com",
6
- "version": "1.17.0",
6
+ "version": "1.18.0",
7
7
  "license": "Apache-2.0",
8
8
  "sideEffects": false,
9
9
  "files": [
@@ -93,6 +93,10 @@
93
93
  "./graphql/schemas/2024.4": {
94
94
  "import": "./dist/esm/graphql/schemas/2024.4/index.js",
95
95
  "require": "./dist/cjs/graphql/schemas/2024.4/index.js"
96
+ },
97
+ "./graphql/schemas/latest": {
98
+ "import": "./dist/esm/graphql/schemas/latest/index.js",
99
+ "require": "./dist/cjs/graphql/schemas/latest/index.js"
96
100
  }
97
101
  },
98
102
  "bugs": {
@@ -137,7 +141,6 @@
137
141
  "graphql": "^16.9.0",
138
142
  "jose": "^5.6.3",
139
143
  "poseidon-lite": "^0.2.0",
140
- "tweetnacl": "^1.0.3",
141
144
  "valibot": "^0.36.0",
142
145
  "@mysten/bcs": "1.2.0"
143
146
  },
@@ -10,6 +10,11 @@
10
10
  * /crates/sui-open-rpc/spec/openrpc.json
11
11
  */
12
12
 
13
+ export type Authenticator =
14
+ /** The contained SuiAddress exclusively has all permissions: read, write, delete, transfer */
15
+ {
16
+ SingleOwner: string;
17
+ };
13
18
  export interface Balance {
14
19
  coinObjectCount: number;
15
20
  coinType: string;
@@ -164,15 +169,27 @@ export interface DryRunTransactionBlockResponse {
164
169
  input: TransactionBlockData;
165
170
  objectChanges: SuiObjectChange[];
166
171
  }
167
- export interface DynamicFieldInfo {
168
- bcsName: string;
169
- digest: string;
170
- name: DynamicFieldName;
171
- objectId: string;
172
- objectType: string;
173
- type: DynamicFieldType;
174
- version: string;
175
- }
172
+ export type DynamicFieldInfo =
173
+ | {
174
+ digest: string;
175
+ name: DynamicFieldName;
176
+ objectId: string;
177
+ objectType: string;
178
+ type: DynamicFieldType;
179
+ version: string;
180
+ bcsEncoding: 'base64';
181
+ bcsName: string;
182
+ }
183
+ | {
184
+ digest: string;
185
+ name: DynamicFieldName;
186
+ objectId: string;
187
+ objectType: string;
188
+ type: DynamicFieldType;
189
+ version: string;
190
+ bcsEncoding: 'base58';
191
+ bcsName: string;
192
+ };
176
193
  export interface DynamicFieldName {
177
194
  type: string;
178
195
  value: unknown;
@@ -200,38 +217,64 @@ export interface EndOfEpochData {
200
217
  */
201
218
  nextEpochProtocolVersion: string;
202
219
  }
203
- export interface SuiEvent {
204
- /** Base 58 encoded bcs bytes of the move event */
205
- bcs: string;
206
- /**
207
- * Sequential event ID, ie (transaction seq number, event seq number). 1) Serves as a unique event ID
208
- * for each fullnode 2) Also serves to sequence events for the purposes of pagination and querying. A
209
- * higher id is an event seen later by that fullnode. This ID is the "cursor" for event querying.
210
- */
211
- id: EventId;
212
- /** Move package where this event was emitted. */
213
- packageId: string;
214
- /** Parsed json value of the event */
215
- parsedJson: unknown;
216
- /** Sender's Sui address. */
217
- sender: string;
218
- /** UTC timestamp in milliseconds since epoch (1/1/1970) */
219
- timestampMs?: string | null;
220
- /** Move module where this event was emitted. */
221
- transactionModule: string;
222
- /** Move event type. */
223
- type: string;
224
- }
220
+ export type SuiEvent =
221
+ | {
222
+ /**
223
+ * Sequential event ID, ie (transaction seq number, event seq number). 1) Serves as a unique event ID
224
+ * for each fullnode 2) Also serves to sequence events for the purposes of pagination and querying. A
225
+ * higher id is an event seen later by that fullnode. This ID is the "cursor" for event querying.
226
+ */
227
+ id: EventId;
228
+ /** Move package where this event was emitted. */
229
+ packageId: string;
230
+ /** Parsed json value of the event */
231
+ parsedJson: unknown;
232
+ /** Sender's Sui address. */
233
+ sender: string;
234
+ /** UTC timestamp in milliseconds since epoch (1/1/1970) */
235
+ timestampMs?: string | null;
236
+ /** Move module where this event was emitted. */
237
+ transactionModule: string;
238
+ /** Move event type. */
239
+ type: string;
240
+ bcs: string;
241
+ bcsEncoding: 'base64';
242
+ }
243
+ | {
244
+ /**
245
+ * Sequential event ID, ie (transaction seq number, event seq number). 1) Serves as a unique event ID
246
+ * for each fullnode 2) Also serves to sequence events for the purposes of pagination and querying. A
247
+ * higher id is an event seen later by that fullnode. This ID is the "cursor" for event querying.
248
+ */
249
+ id: EventId;
250
+ /** Move package where this event was emitted. */
251
+ packageId: string;
252
+ /** Parsed json value of the event */
253
+ parsedJson: unknown;
254
+ /** Sender's Sui address. */
255
+ sender: string;
256
+ /** UTC timestamp in milliseconds since epoch (1/1/1970) */
257
+ timestampMs?: string | null;
258
+ /** Move module where this event was emitted. */
259
+ transactionModule: string;
260
+ /** Move event type. */
261
+ type: string;
262
+ bcs: string;
263
+ bcsEncoding: 'base58';
264
+ };
225
265
  export type SuiEventFilter =
226
- /** Query by sender address. */
266
+ /** Return all events. */
267
+ | {
268
+ All: [];
269
+ } /** Return events that match any of the given filters. Only supported on event subscriptions. */
270
+ | {
271
+ Any: SuiEventFilter[];
272
+ } /** Query by sender address. */
227
273
  | {
228
274
  Sender: string;
229
275
  } /** Return events emitted by the given transaction. */
230
276
  | {
231
277
  Transaction: string;
232
- } /** Return events emitted in a specified Package. */
233
- | {
234
- Package: string;
235
278
  } /**
236
279
  * Return events emitted in a specified Move module. If the event is defined in Module A but emitted in
237
280
  * a tx with Module B, query `MoveModule` by module B returns the event. Query `MoveEventModule` by
@@ -262,12 +305,6 @@ export type SuiEventFilter =
262
305
  /** the Move package ID */
263
306
  package: string;
264
307
  };
265
- }
266
- | {
267
- MoveEventField: {
268
- path: string;
269
- value: unknown;
270
- };
271
308
  } /** Return events emitted in [start_time, end_time] interval */
272
309
  | {
273
310
  TimeRange: {
@@ -276,22 +313,8 @@ export type SuiEventFilter =
276
313
  /** left endpoint of time interval, milliseconds since epoch, inclusive */
277
314
  startTime: string;
278
315
  };
279
- }
280
- | {
281
- All: SuiEventFilter[];
282
- }
283
- | {
284
- Any: SuiEventFilter[];
285
- }
286
- | {
287
- And: [SuiEventFilter, SuiEventFilter];
288
- }
289
- | {
290
- Or: [SuiEventFilter, SuiEventFilter];
291
316
  };
292
- /**
293
- * Unique ID of a Sui Event, the ID is a combination of transaction digest and event seq number.
294
- */
317
+ /** Unique ID of a Sui Event, the ID is a combination of transaction digest and event seq number. */
295
318
  export interface EventId {
296
319
  eventSeq: string;
297
320
  txDigest: string;
@@ -648,7 +671,22 @@ export type ObjectOwner =
648
671
  initial_shared_version: string;
649
672
  };
650
673
  }
651
- | 'Immutable';
674
+ | 'Immutable' /**
675
+ * Object is sequenced via consensus. Ownership is managed by the configured authenticator.
676
+ *
677
+ * Note: wondering what happened to `V1`? `Shared` above was the V1 of consensus objects.
678
+ */
679
+ | {
680
+ ConsensusV2: {
681
+ /** The authentication mode of the object */
682
+ authenticator: Authenticator;
683
+ /**
684
+ * The version at which the object most recently became a consensus object. This serves the same
685
+ * function as `initial_shared_version`, except it may change if the object's Owner type changes.
686
+ */
687
+ start_version: string;
688
+ };
689
+ };
652
690
  /**
653
691
  * `next_cursor` points to the last item in the page; Reading with `next_cursor` will start from the
654
692
  * next item after `next_cursor` if `next_cursor` is `Some`, otherwise it will start from the first
@@ -954,6 +992,13 @@ export interface SuiMoveModuleId {
954
992
  address: string;
955
993
  name: string;
956
994
  }
995
+ export interface SuiMoveNormalizedEnum {
996
+ abilities: SuiMoveAbilitySet;
997
+ typeParameters: SuiMoveStructTypeParameter[];
998
+ variants: {
999
+ [key: string]: SuiMoveNormalizedField[];
1000
+ };
1001
+ }
957
1002
  export interface SuiMoveNormalizedField {
958
1003
  name: string;
959
1004
  type: SuiMoveNormalizedType;
@@ -967,6 +1012,9 @@ export interface SuiMoveNormalizedFunction {
967
1012
  }
968
1013
  export interface SuiMoveNormalizedModule {
969
1014
  address: string;
1015
+ enums?: {
1016
+ [key: string]: SuiMoveNormalizedEnum;
1017
+ };
970
1018
  exposedFunctions: {
971
1019
  [key: string]: SuiMoveNormalizedFunction;
972
1020
  };
@@ -1465,7 +1513,7 @@ export interface SuiTransactionBlockResponseQuery {
1465
1513
  options?: SuiTransactionBlockResponseOptions | null;
1466
1514
  }
1467
1515
  export type TransactionFilter =
1468
- /** Query by checkpoint. */
1516
+ /** CURRENTLY NOT SUPPORTED. Query by checkpoint. */
1469
1517
  | {
1470
1518
  Checkpoint: string;
1471
1519
  } /** Query by move function. */
@@ -1481,6 +1529,9 @@ export type TransactionFilter =
1481
1529
  } /** Query by changed object, including created, mutated and unwrapped objects. */
1482
1530
  | {
1483
1531
  ChangedObject: string;
1532
+ } /** Query for transactions that touch this object. */
1533
+ | {
1534
+ AffectedObject: string;
1484
1535
  } /** Query by sender address. */
1485
1536
  | {
1486
1537
  FromAddress: string;
@@ -1493,7 +1544,7 @@ export type TransactionFilter =
1493
1544
  from: string;
1494
1545
  to: string;
1495
1546
  };
1496
- } /** Query txs that have a given address as sender or recipient. */
1547
+ } /** CURRENTLY NOT SUPPORTED. Query txs that have a given address as sender or recipient. */
1497
1548
  | {
1498
1549
  FromOrToAddress: {
1499
1550
  addr: string;
@@ -204,7 +204,11 @@ export interface GetBalanceParams {
204
204
  */
205
205
  coinType?: string | null | undefined;
206
206
  }
207
- /** Return metadata(e.g., symbol, decimals) for a coin */
207
+ /**
208
+ * Return metadata (e.g., symbol, decimals) for a coin. Note that if the coin's metadata was wrapped in
209
+ * the transaction that published its marker type, or the latest version of the metadata object is
210
+ * wrapped or deleted, it will not be found.
211
+ */
208
212
  export interface GetCoinMetadataParams {
209
213
  /** type name for the coin (e.g., 0x168da5bf1f48dafc111b0a488fa454aca95e0b5e::usdc::USDC) */
210
214
  coinType: string;
@@ -93,6 +93,13 @@ export abstract class PublicKey {
93
93
  return this.verifyWithIntent(transaction, signature, 'TransactionData');
94
94
  }
95
95
 
96
+ /**
97
+ * Verifies that the public key is associated with the provided address
98
+ */
99
+ verifyAddress(address: string): boolean {
100
+ return this.toSuiAddress() === address;
101
+ }
102
+
96
103
  /**
97
104
  * Returns the bytes representation of the public key
98
105
  * prefixed with the signature scheme flag