@mysten/sui 2.16.3 → 2.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 (138) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/bcs/bcs.d.mts +6 -6
  3. package/dist/bcs/index.d.mts +20 -20
  4. package/dist/graphql/generated/queries.d.mts.map +1 -1
  5. package/dist/graphql/generated/queries.mjs.map +1 -1
  6. package/dist/graphql/generated/tada-env.d.mts +82 -1
  7. package/dist/grpc/client.d.mts +2 -0
  8. package/dist/grpc/client.d.mts.map +1 -1
  9. package/dist/grpc/client.mjs +2 -0
  10. package/dist/grpc/client.mjs.map +1 -1
  11. package/dist/grpc/proto/google/protobuf/struct.mjs +1 -1
  12. package/dist/grpc/proto/google/protobuf/struct.mjs.map +1 -1
  13. package/dist/grpc/proto/google/rpc/status.mjs +1 -1
  14. package/dist/grpc/proto/google/rpc/status.mjs.map +1 -1
  15. package/dist/grpc/proto/sui/forking/v1alpha/forking_service.client.d.mts +66 -0
  16. package/dist/grpc/proto/sui/forking/v1alpha/forking_service.client.d.mts.map +1 -0
  17. package/dist/grpc/proto/sui/forking/v1alpha/forking_service.client.mjs +48 -0
  18. package/dist/grpc/proto/sui/forking/v1alpha/forking_service.client.mjs.map +1 -0
  19. package/dist/grpc/proto/sui/forking/v1alpha/forking_service.d.mts +135 -0
  20. package/dist/grpc/proto/sui/forking/v1alpha/forking_service.d.mts.map +1 -0
  21. package/dist/grpc/proto/sui/forking/v1alpha/forking_service.mjs +144 -0
  22. package/dist/grpc/proto/sui/forking/v1alpha/forking_service.mjs.map +1 -0
  23. package/dist/grpc/proto/sui/rpc/v2/checkpoint.mjs +1 -1
  24. package/dist/grpc/proto/sui/rpc/v2/checkpoint.mjs.map +1 -1
  25. package/dist/grpc/proto/sui/rpc/v2/checkpoint_contents.mjs +3 -3
  26. package/dist/grpc/proto/sui/rpc/v2/checkpoint_contents.mjs.map +1 -1
  27. package/dist/grpc/proto/sui/rpc/v2/checkpoint_summary.mjs +3 -3
  28. package/dist/grpc/proto/sui/rpc/v2/checkpoint_summary.mjs.map +1 -1
  29. package/dist/grpc/proto/sui/rpc/v2/effects.d.mts +71 -3
  30. package/dist/grpc/proto/sui/rpc/v2/effects.d.mts.map +1 -1
  31. package/dist/grpc/proto/sui/rpc/v2/effects.mjs +71 -5
  32. package/dist/grpc/proto/sui/rpc/v2/effects.mjs.map +1 -1
  33. package/dist/grpc/proto/sui/rpc/v2/event.mjs +1 -1
  34. package/dist/grpc/proto/sui/rpc/v2/event.mjs.map +1 -1
  35. package/dist/grpc/proto/sui/rpc/v2/executed_transaction.mjs +2 -2
  36. package/dist/grpc/proto/sui/rpc/v2/executed_transaction.mjs.map +1 -1
  37. package/dist/grpc/proto/sui/rpc/v2/ledger_service.client.d.mts +4 -4
  38. package/dist/grpc/proto/sui/rpc/v2/ledger_service.mjs +3 -3
  39. package/dist/grpc/proto/sui/rpc/v2/ledger_service.mjs.map +1 -1
  40. package/dist/grpc/proto/sui/rpc/v2/move_package.d.mts.map +1 -1
  41. package/dist/grpc/proto/sui/rpc/v2/move_package.mjs +13 -13
  42. package/dist/grpc/proto/sui/rpc/v2/move_package.mjs.map +1 -1
  43. package/dist/grpc/proto/sui/rpc/v2/move_package_service.client.d.mts +4 -4
  44. package/dist/grpc/proto/sui/rpc/v2/move_package_service.mjs +1 -1
  45. package/dist/grpc/proto/sui/rpc/v2/move_package_service.mjs.map +1 -1
  46. package/dist/grpc/proto/sui/rpc/v2/name_service.client.d.mts +4 -4
  47. package/dist/grpc/proto/sui/rpc/v2/object.d.mts.map +1 -1
  48. package/dist/grpc/proto/sui/rpc/v2/object.mjs +1 -1
  49. package/dist/grpc/proto/sui/rpc/v2/object.mjs.map +1 -1
  50. package/dist/grpc/proto/sui/rpc/v2/signature.mjs +3 -3
  51. package/dist/grpc/proto/sui/rpc/v2/signature.mjs.map +1 -1
  52. package/dist/grpc/proto/sui/rpc/v2/signature_verification_service.client.d.mts +4 -4
  53. package/dist/grpc/proto/sui/rpc/v2/signature_verification_service.d.mts.map +1 -1
  54. package/dist/grpc/proto/sui/rpc/v2/signature_verification_service.mjs +1 -1
  55. package/dist/grpc/proto/sui/rpc/v2/signature_verification_service.mjs.map +1 -1
  56. package/dist/grpc/proto/sui/rpc/v2/state_service.client.d.mts +4 -4
  57. package/dist/grpc/proto/sui/rpc/v2/state_service.d.mts.map +1 -1
  58. package/dist/grpc/proto/sui/rpc/v2/state_service.mjs +3 -3
  59. package/dist/grpc/proto/sui/rpc/v2/state_service.mjs.map +1 -1
  60. package/dist/grpc/proto/sui/rpc/v2/subscription_service.client.d.mts +4 -4
  61. package/dist/grpc/proto/sui/rpc/v2/system_state.mjs +2 -2
  62. package/dist/grpc/proto/sui/rpc/v2/system_state.mjs.map +1 -1
  63. package/dist/grpc/proto/sui/rpc/v2/transaction.d.mts.map +1 -1
  64. package/dist/grpc/proto/sui/rpc/v2/transaction.mjs +16 -16
  65. package/dist/grpc/proto/sui/rpc/v2/transaction.mjs.map +1 -1
  66. package/dist/grpc/proto/sui/rpc/v2/transaction_execution_service.mjs +4 -4
  67. package/dist/grpc/proto/sui/rpc/v2/transaction_execution_service.mjs.map +1 -1
  68. package/dist/grpc/proto/types.d.mts +3 -2
  69. package/dist/grpc/proto/types.mjs +11 -1
  70. package/dist/grpc/proto/types.mjs.map +1 -1
  71. package/dist/jsonRpc/types/params.d.mts +5 -5
  72. package/dist/transactions/Transaction.d.mts +25 -11
  73. package/dist/transactions/Transaction.d.mts.map +1 -1
  74. package/dist/transactions/Transaction.mjs +8 -3
  75. package/dist/transactions/Transaction.mjs.map +1 -1
  76. package/dist/transactions/index.d.mts +2 -2
  77. package/dist/version.mjs +1 -1
  78. package/dist/version.mjs.map +1 -1
  79. package/dist/zklogin/jwt-utils.d.mts.map +1 -1
  80. package/dist/zklogin/jwt-utils.mjs.map +1 -1
  81. package/dist/zklogin/utils.d.mts.map +1 -1
  82. package/dist/zklogin/utils.mjs +9 -0
  83. package/dist/zklogin/utils.mjs.map +1 -1
  84. package/docs/bcs.md +11 -6
  85. package/docs/clients/core.md +10 -9
  86. package/docs/clients/grpc.md +1 -1
  87. package/docs/index.md +176 -22
  88. package/docs/llms-index.md +6 -9
  89. package/docs/migrations/0.38.md +2 -2
  90. package/docs/migrations/sui-1.0.md +2 -2
  91. package/docs/migrations/sui-2.0/json-rpc-migration.md +76 -33
  92. package/docs/plugins.md +29 -5
  93. package/docs/transactions/basics.md +279 -0
  94. package/docs/transactions/coins-and-balances.md +293 -0
  95. package/docs/transactions/offline.md +192 -0
  96. package/docs/transactions/reference.md +380 -0
  97. package/docs/transactions/signing-and-execution.md +401 -0
  98. package/package.json +27 -27
  99. package/src/graphql/generated/queries.ts +46 -1
  100. package/src/graphql/generated/schema.graphql +49 -3
  101. package/src/graphql/generated/tada-env.ts +97 -1
  102. package/src/grpc/client.ts +3 -0
  103. package/src/grpc/proto/google/protobuf/struct.ts +1 -1
  104. package/src/grpc/proto/google/rpc/error_details.ts +4 -4
  105. package/src/grpc/proto/google/rpc/status.ts +1 -1
  106. package/src/grpc/proto/sui/forking/v1alpha/forking_service.client.ts +125 -0
  107. package/src/grpc/proto/sui/forking/v1alpha/forking_service.ts +230 -0
  108. package/src/grpc/proto/sui/rpc/v2/checkpoint.ts +1 -1
  109. package/src/grpc/proto/sui/rpc/v2/checkpoint_contents.ts +3 -3
  110. package/src/grpc/proto/sui/rpc/v2/checkpoint_summary.ts +3 -3
  111. package/src/grpc/proto/sui/rpc/v2/effects.ts +112 -6
  112. package/src/grpc/proto/sui/rpc/v2/event.ts +1 -1
  113. package/src/grpc/proto/sui/rpc/v2/executed_transaction.ts +2 -2
  114. package/src/grpc/proto/sui/rpc/v2/ledger_service.ts +3 -3
  115. package/src/grpc/proto/sui/rpc/v2/move_package.ts +19 -13
  116. package/src/grpc/proto/sui/rpc/v2/move_package_service.ts +1 -1
  117. package/src/grpc/proto/sui/rpc/v2/object.ts +7 -1
  118. package/src/grpc/proto/sui/rpc/v2/signature.ts +3 -3
  119. package/src/grpc/proto/sui/rpc/v2/signature_verification_service.ts +7 -1
  120. package/src/grpc/proto/sui/rpc/v2/state_service.ts +9 -3
  121. package/src/grpc/proto/sui/rpc/v2/system_state.ts +2 -2
  122. package/src/grpc/proto/sui/rpc/v2/transaction.ts +22 -16
  123. package/src/grpc/proto/sui/rpc/v2/transaction_execution_service.ts +4 -4
  124. package/src/grpc/proto/types.ts +1 -0
  125. package/src/jsonRpc/types/params.ts +5 -5
  126. package/src/transactions/Transaction.ts +36 -5
  127. package/src/transactions/index.ts +1 -0
  128. package/src/version.ts +1 -1
  129. package/src/zklogin/jwt-utils.ts +3 -0
  130. package/src/zklogin/utils.ts +17 -0
  131. package/docs/faucet.md +0 -26
  132. package/docs/hello-sui.md +0 -115
  133. package/docs/install.md +0 -61
  134. package/docs/transaction-building/basics.md +0 -299
  135. package/docs/transaction-building/gas.md +0 -61
  136. package/docs/transaction-building/intents.md +0 -62
  137. package/docs/transaction-building/offline.md +0 -73
  138. package/docs/transaction-building/sponsored-transactions.md +0 -22
@@ -1,61 +0,0 @@
1
- # Paying for Sui Transactions with Gas Coins
2
-
3
- > Configure gas budget, price, and coin selection for Sui transactions.
4
-
5
- With Programmable Transactions, you can use the gas payment coin to construct coins with a set
6
- balance using `splitCoin`. This is useful for Sui payments, and avoids the need for up-front coin
7
- selection. You can use `tx.gas` to access the gas coin in a transaction, and it is valid as input
8
- for any arguments, as long as it is used
9
- [by-reference](https://docs.sui.io/guides/developer/sui-101/simulating-refs). Practically speaking,
10
- this means you can also add to the gas coin with `mergeCoins` and borrow it for Move functions with
11
- `moveCall`.
12
-
13
- You can also transfer the gas coin using `transferObjects`, in the event that you want to transfer
14
- all of your coin balance to another address.
15
-
16
- ## Gas configuration
17
-
18
- The new transaction builder comes with default behavior for all gas logic, including automatically
19
- setting the gas price, budget, and selecting coins to be used as gas. This behavior can be
20
- customized.
21
-
22
- ### Gas price
23
-
24
- By default, the gas price is set to the reference gas price of the network. You can also explicitly
25
- set the gas price of the transaction by calling `setGasPrice` on the transaction builder.
26
-
27
- ```tsx
28
- tx.setGasPrice(gasPrice);
29
- ```
30
-
31
- ### Budget
32
-
33
- By default, the gas budget is automatically derived by executing a dry-run of the transaction
34
- beforehand. The dry run gas consumption is then used to determine a balance for the transaction. You
35
- can override this behavior by explicitly setting a gas budget for the transaction, by calling
36
- `setGasBudget` on the transaction builder.
37
-
38
- The gas budget is represented in Sui and should take the gas price of the transaction into account.
39
-
40
- ```tsx
41
- tx.setGasBudget(gasBudgetAmount);
42
- ```
43
-
44
- ### Gas payment
45
-
46
- By default, the gas payment is automatically determined by the SDK. The SDK selects all of the users
47
- coins that are not used as inputs in the transaction.
48
-
49
- The list of coins used as gas payment will be merged down into a single gas coin before executing
50
- the transaction, and all but one of the gas objects will be deleted. The gas coin at the 0-index
51
- will be the coin that all others are merged into.
52
-
53
- ```tsx
54
- // you need to ensure that the coins do not overlap with any
55
- // of the input objects for the transaction
56
- tx.setGasPayment([coin1, coin2]);
57
- ```
58
-
59
- Gas coins should be objects containing the coins objectId, version, and digest.
60
-
61
- <auto-type-table type="{ objectId: string, version: string | number, digest: string }" />
@@ -1,62 +0,0 @@
1
- # Transaction Intents
2
-
3
- > Use high-level intents to simplify transaction building.
4
-
5
- Transaction Intents enable third-party SDKs and [Transaction Plugins](../plugins) to more easily add
6
- operations to a Transaction. The TypeScript SDK currently only includes a single Intent
7
- (CoinWithBalance), but more will be added in the future.
8
-
9
- ## The CoinWithBalance intent
10
-
11
- The `CoinWithBalance` intent makes it easy to get a coin with a specific balance. For SUI, this has
12
- generally been done by splitting the gas coin:
13
-
14
- ```typescript
15
- const tx = new Transaction();
16
-
17
- const [coin] = tx.splitCoins(tx.gas, [100]);
18
-
19
- tx.transferObjects([coin], recipient);
20
- ```
21
-
22
- This approach works well for SUI, but can't be used for other coin types. The CoinWithBalance intent
23
- solves this by providing a helper function that automatically adds the correct SplitCoins and
24
- MergeCoins commands to the transaction:
25
-
26
- ```typescript
27
-
28
- const tx = new Transaction();
29
-
30
- // Setting the sender is required for the CoinWithBalance intent to resolve coins when not using the gas coin
31
- tx.setSender(keypair.toSuiAddress());
32
-
33
- tx.transferObjects(
34
- [
35
- // Create a SUI coin (balance is in MIST)
36
- coinWithBalance({ balance: 100 }),
37
- // Create a coin of another type
38
- coinWithBalance({ balance: 100, type: '0x123::foo:Bar' }),
39
- ],
40
- recipient,
41
- );
42
- ```
43
-
44
- Splitting the gas coin also causes problems for sponsored transactions. When sponsoring
45
- transactions, the gas coin comes from the sponsor instead of the transaction sender. Transaction
46
- sponsors usually do not sponsor transactions that use the gas coin for anything other than gas. To
47
- transfer SUI that does not use the gas coin, you can set the `useGasCoin` option to `false`:
48
-
49
- ```typescript
50
- const tx = new Transaction();
51
- tx.transferObjects([coinWithBalance({ balance: 100, useGasCoin: false })], recipient);
52
- ```
53
-
54
- It's important to only set `useGasCoin` option to false for sponsored transactions, otherwise the
55
- coinWithBalance intent might use all the SUI coins, leaving no coins to use for gas.
56
-
57
- ## How it works
58
-
59
- When the `CoinWithBalance` intent is resolved, it will look up the senders owned coins for each type
60
- that needs to be created. It will then find a set of coins with sufficient balance to cover the
61
- desired balance, to combine them into a single coin. This coin is then used in a `SplitCoins`
62
- command to create the desired coin.
@@ -1,73 +0,0 @@
1
- # Building Offline
2
-
3
- > Build transactions without a network connection.
4
-
5
- To build a transaction offline (with no `client` required), you need to fully define all of your
6
- inputs, gas configuration, and expiration.
7
-
8
- ## Required configuration
9
-
10
- When building offline, you must set the following:
11
-
12
- - Sender address: The address that will execute the transaction
13
- - Gas price: The price per gas unit (can be obtained from the network beforehand)
14
- - Gas budget: The maximum gas to spend on this transaction
15
- - Gas payment: One or more coin object references to use for gas, or an empty array for Address
16
- Balances
17
- - Expiration: Only needed when using address balances for gas
18
-
19
- ```tsx
20
-
21
- const { referenceGasPrice } = await client.getReferenceGasPrice();
22
-
23
- const tx = new Transaction();
24
-
25
- tx.setSender('0x<your-address>');
26
- tx.setGasPrice(referenceGasPrice);
27
- tx.setGasBudget(50_000_000);
28
- tx.setGasPayment([
29
- {
30
- objectId: '0x<gas-coin-object-id>',
31
- version: '<object-version>',
32
- digest: '<object-digest>',
33
- },
34
- ]);
35
-
36
- // Build the transaction without a client
37
- const bytes = await tx.build();
38
- ```
39
-
40
- ## Object references
41
-
42
- For objects used in your transaction, you must provide full object references using the `Inputs`
43
- helper:
44
-
45
- ```tsx
46
-
47
- // For owned or immutable objects
48
- tx.object(
49
- Inputs.ObjectRef({
50
- objectId: '0x<object-id>',
51
- version: '<object-version>',
52
- digest: '<object-digest>',
53
- }),
54
- );
55
-
56
- // For shared objects
57
- tx.object(
58
- Inputs.SharedObjectRef({
59
- objectId: '0x<object-id>',
60
- initialSharedVersion: '<initial-shared-version>',
61
- mutable: true,
62
- }),
63
- );
64
-
65
- // For receiving objects (objects being received by another object)
66
- tx.object(
67
- Inputs.ReceivingRef({
68
- objectId: '0x<object-id>',
69
- version: '<object-version>',
70
- digest: '<object-digest>',
71
- }),
72
- );
73
- ```
@@ -1,22 +0,0 @@
1
- # Sponsored Transactions
2
-
3
- > Pay gas fees on behalf of other users with sponsored transactions.
4
-
5
- The transaction builder can support sponsored transactions by using the `onlyTransactionKind` flag
6
- when building the transaction.
7
-
8
- ```tsx
9
- const tx = new Transaction();
10
-
11
- // ... add some transactions...
12
-
13
- const kindBytes = await tx.build({ provider, onlyTransactionKind: true });
14
-
15
- // construct a sponsored transaction from the kind bytes
16
- const sponsoredtx = Transaction.fromKind(kindBytes);
17
-
18
- // you can now set the sponsored transaction data that is required
19
- sponsoredtx.setSender(sender);
20
- sponsoredtx.setGasOwner(sponsor);
21
- sponsoredtx.setGasPayment(sponsorCoins);
22
- ```