@mysten/sui 2.23.1 → 2.24.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 (75) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +9 -9
  3. package/dist/bcs/index.d.mts +36 -36
  4. package/dist/client/core.d.mts +1 -0
  5. package/dist/client/core.d.mts.map +1 -1
  6. package/dist/client/core.mjs.map +1 -1
  7. package/dist/client/types.d.mts +7 -0
  8. package/dist/client/types.d.mts.map +1 -1
  9. package/dist/cryptography/signature.d.mts +6 -6
  10. package/dist/graphql/client.d.mts +1 -0
  11. package/dist/graphql/client.d.mts.map +1 -1
  12. package/dist/graphql/client.mjs +3 -0
  13. package/dist/graphql/client.mjs.map +1 -1
  14. package/dist/graphql/core.d.mts +1 -0
  15. package/dist/graphql/core.d.mts.map +1 -1
  16. package/dist/graphql/core.mjs +10 -1
  17. package/dist/graphql/core.mjs.map +1 -1
  18. package/dist/graphql/generated/queries.d.mts.map +1 -1
  19. package/dist/graphql/generated/queries.mjs +8 -1
  20. package/dist/graphql/generated/queries.mjs.map +1 -1
  21. package/dist/grpc/client.d.mts +1 -0
  22. package/dist/grpc/client.d.mts.map +1 -1
  23. package/dist/grpc/client.mjs +3 -0
  24. package/dist/grpc/client.mjs.map +1 -1
  25. package/dist/grpc/core.d.mts +1 -0
  26. package/dist/grpc/core.d.mts.map +1 -1
  27. package/dist/grpc/core.mjs +32 -12
  28. package/dist/grpc/core.mjs.map +1 -1
  29. package/dist/grpc/proto/sui/rpc/v2/ledger_service.client.d.mts +4 -4
  30. package/dist/grpc/proto/sui/rpc/v2/name_service.client.d.mts +4 -4
  31. package/dist/grpc/proto/sui/rpc/v2/signature_verification_service.client.d.mts +4 -4
  32. package/dist/grpc/proto/sui/rpc/v2/state_service.client.d.mts +4 -4
  33. package/dist/grpc/proto/sui/rpc/v2/subscription_service.client.d.mts +4 -4
  34. package/dist/grpc/proto/sui/rpc/v2/transaction_execution_service.client.d.mts +4 -4
  35. package/dist/jsonRpc/core.d.mts +6 -0
  36. package/dist/jsonRpc/core.d.mts.map +1 -1
  37. package/dist/jsonRpc/core.mjs +15 -4
  38. package/dist/jsonRpc/core.mjs.map +1 -1
  39. package/dist/transactions/Transaction.d.mts +3 -3
  40. package/dist/transactions/data/v1.d.mts +220 -220
  41. package/dist/transactions/data/v1.d.mts.map +1 -1
  42. package/dist/transactions/data/v2.d.mts +16 -16
  43. package/dist/transactions/data/v2.d.mts.map +1 -1
  44. package/dist/version.mjs +1 -1
  45. package/dist/version.mjs.map +1 -1
  46. package/docs/clients/core.md +31 -10
  47. package/docs/clients/graphql.md +43 -8
  48. package/docs/clients/grpc.md +91 -9
  49. package/docs/clients/index.md +86 -39
  50. package/docs/clients/json-rpc.md +30 -26
  51. package/docs/executors.md +28 -13
  52. package/docs/index.md +1 -1
  53. package/docs/llms-index.md +17 -17
  54. package/docs/migrations/sui-2.0/dapp-kit.md +3 -3
  55. package/docs/migrations/sui-2.0/deepbook-v3.md +2 -2
  56. package/docs/migrations/sui-2.0/index.md +46 -25
  57. package/docs/migrations/sui-2.0/json-rpc-migration.md +460 -284
  58. package/docs/migrations/sui-2.0/kiosk.md +10 -9
  59. package/docs/migrations/sui-2.0/sdk-maintainers.md +17 -11
  60. package/docs/migrations/sui-2.0/sui.md +47 -29
  61. package/docs/migrations/sui-2.0/suins.md +2 -2
  62. package/docs/migrations/sui-2.0/walrus.md +3 -3
  63. package/docs/migrations/sui-2.0/zksend.md +9 -8
  64. package/docs/sdk-building.md +7 -5
  65. package/package.json +1 -1
  66. package/src/client/core.ts +4 -0
  67. package/src/client/types.ts +11 -0
  68. package/src/graphql/client.ts +6 -0
  69. package/src/graphql/core.ts +15 -0
  70. package/src/graphql/generated/queries.ts +14 -0
  71. package/src/graphql/queries/nameService.graphql +6 -0
  72. package/src/grpc/client.ts +6 -0
  73. package/src/grpc/core.ts +51 -12
  74. package/src/jsonRpc/core.ts +50 -14
  75. package/src/version.ts +1 -1
@@ -802,6 +802,18 @@ export class JSONRpcCoreClient extends CoreClient {
802
802
  };
803
803
  }
804
804
 
805
+ /**
806
+ * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
807
+ * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
808
+ */
809
+ async resolveNameServiceAddress(
810
+ options: SuiClientTypes.ResolveNameServiceAddressOptions,
811
+ ): Promise<SuiClientTypes.ResolveNameServiceAddressResponse> {
812
+ return {
813
+ address: await this.#jsonRpcClient.resolveNameServiceAddress(options),
814
+ };
815
+ }
816
+
805
817
  /**
806
818
  * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
807
819
  * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
@@ -1182,7 +1194,7 @@ function parseTransaction<Include extends SuiClientTypes.TransactionInclude = {}
1182
1194
  };
1183
1195
  }
1184
1196
 
1185
- function parseTransactionEffectsJson({
1197
+ export function parseTransactionEffectsJson({
1186
1198
  bytes,
1187
1199
  effects,
1188
1200
  objectChanges,
@@ -1302,6 +1314,28 @@ function parseTransactionEffectsJson({
1302
1314
  }
1303
1315
  });
1304
1316
 
1317
+ // When the transaction has no gas object (system transactions, or gas paid
1318
+ // from an address balance), the RPC substitutes a placeholder ref with the
1319
+ // 0x0 object id rather than omitting the field.
1320
+ const hasGasObject =
1321
+ normalizeSuiAddress(effects.gasObject.reference.objectId) !== normalizeSuiAddress('0x0');
1322
+
1323
+ let lamportVersion: string | null = null;
1324
+ if (hasGasObject) {
1325
+ lamportVersion = effects.gasObject.reference.version;
1326
+ } else {
1327
+ // Written objects are all assigned the lamport version, so recover it
1328
+ // from the changed objects when the gas object can't provide it.
1329
+ for (const change of changedObjects) {
1330
+ if (
1331
+ change.outputVersion &&
1332
+ (lamportVersion === null || BigInt(change.outputVersion) > BigInt(lamportVersion))
1333
+ ) {
1334
+ lamportVersion = change.outputVersion;
1335
+ }
1336
+ }
1337
+ }
1338
+
1305
1339
  return {
1306
1340
  objectTypes,
1307
1341
  effects: {
@@ -1310,21 +1344,23 @@ function parseTransactionEffectsJson({
1310
1344
  status: parseJsonRpcExecutionStatus(effects.status, effects.abortError),
1311
1345
  gasUsed: effects.gasUsed,
1312
1346
  transactionDigest: effects.transactionDigest,
1313
- gasObject: {
1314
- objectId: effects.gasObject?.reference.objectId,
1315
- inputState: 'Exists',
1316
- inputVersion: null,
1317
- inputDigest: null,
1318
- inputOwner: null,
1319
- outputState: 'ObjectWrite',
1320
- outputVersion: effects.gasObject.reference.version,
1321
- outputDigest: effects.gasObject.reference.digest,
1322
- outputOwner: parseOwner(effects.gasObject.owner),
1323
- idOperation: 'None',
1324
- },
1347
+ gasObject: hasGasObject
1348
+ ? {
1349
+ objectId: effects.gasObject.reference.objectId,
1350
+ inputState: 'Exists',
1351
+ inputVersion: null,
1352
+ inputDigest: null,
1353
+ inputOwner: null,
1354
+ outputState: 'ObjectWrite',
1355
+ outputVersion: effects.gasObject.reference.version,
1356
+ outputDigest: effects.gasObject.reference.digest,
1357
+ outputOwner: parseOwner(effects.gasObject.owner),
1358
+ idOperation: 'None',
1359
+ }
1360
+ : null,
1325
1361
  eventsDigest: effects.eventsDigest ?? null,
1326
1362
  dependencies: effects.dependencies ?? [],
1327
- lamportVersion: effects.gasObject.reference.version,
1363
+ lamportVersion,
1328
1364
  changedObjects,
1329
1365
  unchangedConsensusObjects,
1330
1366
  auxiliaryDataDigest: null,
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.23.1';
6
+ export const PACKAGE_VERSION = '2.24.0';