@mysten/sui 2.39.1 → 3.0.1

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 (425) hide show
  1. package/CHANGELOG.md +169 -0
  2. package/README.md +5 -188
  3. package/dist/bcs/bcs.d.mts +6 -6
  4. package/dist/bcs/bcs.d.mts.map +1 -1
  5. package/dist/bcs/bcs.mjs +49 -22
  6. package/dist/bcs/bcs.mjs.map +1 -1
  7. package/dist/bcs/effects.mjs +49 -20
  8. package/dist/bcs/effects.mjs.map +1 -1
  9. package/dist/bcs/index.d.mts +1441 -624
  10. package/dist/bcs/index.d.mts.map +1 -1
  11. package/dist/bcs/index.mjs +2 -1
  12. package/dist/bcs/index.mjs.map +1 -1
  13. package/dist/bcs/transactions.d.mts +1059 -0
  14. package/dist/bcs/transactions.d.mts.map +1 -0
  15. package/dist/bcs/transactions.mjs +33 -14
  16. package/dist/bcs/transactions.mjs.map +1 -1
  17. package/dist/bcs/types.d.mts +6 -1
  18. package/dist/bcs/types.d.mts.map +1 -1
  19. package/dist/client/core-resolver.mjs +4 -4
  20. package/dist/client/core-resolver.mjs.map +1 -1
  21. package/dist/client/core.d.mts +55 -4
  22. package/dist/client/core.d.mts.map +1 -1
  23. package/dist/client/core.mjs +98 -1
  24. package/dist/client/core.mjs.map +1 -1
  25. package/dist/client/errors.mjs +11 -1
  26. package/dist/client/errors.mjs.map +1 -1
  27. package/dist/client/index.d.mts +5 -3
  28. package/dist/client/index.mjs +6 -3
  29. package/dist/client/mvr.d.mts +12 -2
  30. package/dist/client/mvr.d.mts.map +1 -1
  31. package/dist/client/mvr.mjs +34 -13
  32. package/dist/client/mvr.mjs.map +1 -1
  33. package/dist/client/query-filters.mjs +80 -76
  34. package/dist/client/query-filters.mjs.map +1 -1
  35. package/dist/client/stream/adapter.d.mts +102 -0
  36. package/dist/client/stream/adapter.d.mts.map +1 -0
  37. package/dist/client/stream/errors.d.mts +14 -0
  38. package/dist/client/stream/errors.d.mts.map +1 -0
  39. package/dist/client/stream/errors.mjs +25 -0
  40. package/dist/client/stream/errors.mjs.map +1 -0
  41. package/dist/client/stream/filter.mjs +18 -0
  42. package/dist/client/stream/filter.mjs.map +1 -0
  43. package/dist/client/stream/follow.mjs +48 -0
  44. package/dist/client/stream/follow.mjs.map +1 -0
  45. package/dist/client/stream/index.d.mts +4 -0
  46. package/dist/client/stream/pager.mjs +123 -0
  47. package/dist/client/stream/pager.mjs.map +1 -0
  48. package/dist/client/stream/plan.mjs +79 -0
  49. package/dist/client/stream/plan.mjs.map +1 -0
  50. package/dist/client/stream/position.d.mts +30 -0
  51. package/dist/client/stream/position.d.mts.map +1 -0
  52. package/dist/client/stream/position.mjs +121 -0
  53. package/dist/client/stream/position.mjs.map +1 -0
  54. package/dist/client/stream/run.d.mts +2 -0
  55. package/dist/client/stream/run.mjs +99 -0
  56. package/dist/client/stream/run.mjs.map +1 -0
  57. package/dist/client/stream/session.mjs +205 -0
  58. package/dist/client/stream/session.mjs.map +1 -0
  59. package/dist/client/stream/status.mjs +47 -0
  60. package/dist/client/stream/status.mjs.map +1 -0
  61. package/dist/client/stream/token.mjs +80 -0
  62. package/dist/client/stream/token.mjs.map +1 -0
  63. package/dist/client/transaction-data.d.mts +17 -0
  64. package/dist/client/transaction-data.d.mts.map +1 -0
  65. package/dist/client/transaction-data.mjs +472 -0
  66. package/dist/client/transaction-data.mjs.map +1 -0
  67. package/dist/client/transaction-resolver.mjs +102 -58
  68. package/dist/client/transaction-resolver.mjs.map +1 -1
  69. package/dist/client/types.d.mts +560 -240
  70. package/dist/client/types.d.mts.map +1 -1
  71. package/dist/client/utils.d.mts +2 -2
  72. package/dist/client/utils.d.mts.map +1 -1
  73. package/dist/client/utils.mjs +91 -30
  74. package/dist/client/utils.mjs.map +1 -1
  75. package/dist/cryptography/index.d.mts +1 -1
  76. package/dist/cryptography/keypair.d.mts +1 -1
  77. package/dist/cryptography/publickey.d.mts +11 -0
  78. package/dist/cryptography/publickey.d.mts.map +1 -1
  79. package/dist/cryptography/publickey.mjs +12 -1
  80. package/dist/cryptography/publickey.mjs.map +1 -1
  81. package/dist/cryptography/signature.d.mts +8 -8
  82. package/dist/cryptography/signature.mjs +18 -7
  83. package/dist/cryptography/signature.mjs.map +1 -1
  84. package/dist/graphql/client.d.mts +51 -35
  85. package/dist/graphql/client.d.mts.map +1 -1
  86. package/dist/graphql/client.mjs +125 -69
  87. package/dist/graphql/client.mjs.map +1 -1
  88. package/dist/graphql/core.d.mts +14 -9
  89. package/dist/graphql/core.d.mts.map +1 -1
  90. package/dist/graphql/core.mjs +294 -118
  91. package/dist/graphql/core.mjs.map +1 -1
  92. package/dist/graphql/errors.d.mts +20 -0
  93. package/dist/graphql/errors.d.mts.map +1 -0
  94. package/dist/graphql/errors.mjs +19 -0
  95. package/dist/graphql/errors.mjs.map +1 -0
  96. package/dist/graphql/filters.mjs +32 -0
  97. package/dist/graphql/filters.mjs.map +1 -0
  98. package/dist/graphql/generated/queries.d.mts.map +1 -1
  99. package/dist/graphql/generated/queries.mjs +1216 -208
  100. package/dist/graphql/generated/queries.mjs.map +1 -1
  101. package/dist/graphql/generated/tada-env.d.mts +820 -11
  102. package/dist/graphql/index.d.mts +2 -1
  103. package/dist/graphql/index.mjs +2 -1
  104. package/dist/graphql/sse-parser.mjs +82 -0
  105. package/dist/graphql/sse-parser.mjs.map +1 -0
  106. package/dist/graphql/stream/families.mjs +306 -0
  107. package/dist/graphql/stream/families.mjs.map +1 -0
  108. package/dist/graphql/stream/index.mjs +38 -0
  109. package/dist/graphql/stream/index.mjs.map +1 -0
  110. package/dist/graphql/stream/live.mjs +60 -0
  111. package/dist/graphql/stream/live.mjs.map +1 -0
  112. package/dist/graphql/stream/page.mjs +38 -0
  113. package/dist/graphql/stream/page.mjs.map +1 -0
  114. package/dist/graphql/stream/query.mjs +47 -0
  115. package/dist/graphql/stream/query.mjs.map +1 -0
  116. package/dist/graphql/subscribe.mjs +70 -0
  117. package/dist/graphql/subscribe.mjs.map +1 -0
  118. package/dist/grpc/client.d.mts +31 -27
  119. package/dist/grpc/client.d.mts.map +1 -1
  120. package/dist/grpc/client.mjs +42 -46
  121. package/dist/grpc/client.mjs.map +1 -1
  122. package/dist/grpc/core.d.mts +13 -6
  123. package/dist/grpc/core.d.mts.map +1 -1
  124. package/dist/grpc/core.mjs +254 -166
  125. package/dist/grpc/core.mjs.map +1 -1
  126. package/dist/grpc/filters.mjs +44 -34
  127. package/dist/grpc/filters.mjs.map +1 -1
  128. package/dist/grpc/grpc-web-pull.mjs +245 -0
  129. package/dist/grpc/grpc-web-pull.mjs.map +1 -0
  130. package/dist/grpc/index.d.mts +2 -1
  131. package/dist/grpc/index.mjs +1 -1
  132. package/dist/grpc/network-error.mjs +31 -0
  133. package/dist/grpc/network-error.mjs.map +1 -0
  134. package/dist/grpc/proto/google/rpc/error_details.mjs +306 -0
  135. package/dist/grpc/proto/google/rpc/error_details.mjs.map +1 -0
  136. package/dist/grpc/proto/sui/forking/v1alpha/forking_service.client.d.mts +4 -4
  137. package/dist/grpc/proto/sui/rpc/v2/error_reason.d.mts +176 -1
  138. package/dist/grpc/proto/sui/rpc/v2/error_reason.d.mts.map +1 -1
  139. package/dist/grpc/proto/sui/rpc/v2/error_reason.mjs +175 -0
  140. package/dist/grpc/proto/sui/rpc/v2/error_reason.mjs.map +1 -1
  141. package/dist/grpc/proto/sui/rpc/v2/executed_transaction.d.mts +2 -2
  142. package/dist/grpc/proto/sui/rpc/v2/ledger_service.client.d.mts +4 -4
  143. package/dist/grpc/proto/sui/rpc/v2/ledger_service.d.mts +111 -0
  144. package/dist/grpc/proto/sui/rpc/v2/ledger_service.d.mts.map +1 -1
  145. package/dist/grpc/proto/sui/rpc/v2/ledger_service.mjs +46 -0
  146. package/dist/grpc/proto/sui/rpc/v2/ledger_service.mjs.map +1 -1
  147. package/dist/grpc/proto/sui/rpc/v2/move_package_service.client.d.mts +4 -4
  148. package/dist/grpc/proto/sui/rpc/v2/move_package_service.d.mts +24 -1
  149. package/dist/grpc/proto/sui/rpc/v2/move_package_service.d.mts.map +1 -1
  150. package/dist/grpc/proto/sui/rpc/v2/move_package_service.mjs +25 -7
  151. package/dist/grpc/proto/sui/rpc/v2/move_package_service.mjs.map +1 -1
  152. package/dist/grpc/proto/sui/rpc/v2/name_service.client.d.mts +4 -4
  153. package/dist/grpc/proto/sui/rpc/v2/object.mjs +1 -1
  154. package/dist/grpc/proto/sui/rpc/v2/query_options.d.mts +111 -9
  155. package/dist/grpc/proto/sui/rpc/v2/query_options.d.mts.map +1 -1
  156. package/dist/grpc/proto/sui/rpc/v2/query_options.mjs +63 -19
  157. package/dist/grpc/proto/sui/rpc/v2/query_options.mjs.map +1 -1
  158. package/dist/grpc/proto/sui/rpc/v2/signature.d.mts +5 -5
  159. package/dist/grpc/proto/sui/rpc/v2/signature.mjs.map +1 -1
  160. package/dist/grpc/proto/sui/rpc/v2/signature_scheme.d.mts +5 -1
  161. package/dist/grpc/proto/sui/rpc/v2/signature_scheme.d.mts.map +1 -1
  162. package/dist/grpc/proto/sui/rpc/v2/signature_scheme.mjs +4 -0
  163. package/dist/grpc/proto/sui/rpc/v2/signature_scheme.mjs.map +1 -1
  164. package/dist/grpc/proto/sui/rpc/v2/signature_verification_service.client.d.mts +4 -4
  165. package/dist/grpc/proto/sui/rpc/v2/signature_verification_service.d.mts +20 -1
  166. package/dist/grpc/proto/sui/rpc/v2/signature_verification_service.d.mts.map +1 -1
  167. package/dist/grpc/proto/sui/rpc/v2/signature_verification_service.mjs +30 -13
  168. package/dist/grpc/proto/sui/rpc/v2/signature_verification_service.mjs.map +1 -1
  169. package/dist/grpc/proto/sui/rpc/v2/state_service.client.d.mts +4 -4
  170. package/dist/grpc/proto/sui/rpc/v2/subscription_service.client.d.mts +20 -14
  171. package/dist/grpc/proto/sui/rpc/v2/subscription_service.client.d.mts.map +1 -1
  172. package/dist/grpc/proto/sui/rpc/v2/subscription_service.client.mjs +8 -5
  173. package/dist/grpc/proto/sui/rpc/v2/subscription_service.client.mjs.map +1 -1
  174. package/dist/grpc/proto/sui/rpc/v2/transaction.d.mts +11 -5
  175. package/dist/grpc/proto/sui/rpc/v2/transaction.d.mts.map +1 -1
  176. package/dist/grpc/proto/sui/rpc/v2/transaction.mjs +6 -0
  177. package/dist/grpc/proto/sui/rpc/v2/transaction.mjs.map +1 -1
  178. package/dist/grpc/proto/sui/rpc/v2/transaction_execution_service.d.mts +6 -2
  179. package/dist/grpc/proto/sui/rpc/v2/transaction_execution_service.d.mts.map +1 -1
  180. package/dist/grpc/proto/sui/rpc/v2/transaction_execution_service.mjs.map +1 -1
  181. package/dist/grpc/proto/types.d.mts +7 -7
  182. package/dist/grpc/proto/types.mjs +3 -2
  183. package/dist/grpc/pull-call.d.mts +20 -0
  184. package/dist/grpc/pull-call.d.mts.map +1 -0
  185. package/dist/grpc/pull-call.mjs +28 -0
  186. package/dist/grpc/pull-call.mjs.map +1 -0
  187. package/dist/grpc/stream/call.mjs +238 -0
  188. package/dist/grpc/stream/call.mjs.map +1 -0
  189. package/dist/grpc/stream/families.d.mts +26 -0
  190. package/dist/grpc/stream/families.d.mts.map +1 -0
  191. package/dist/grpc/stream/families.mjs +145 -0
  192. package/dist/grpc/stream/families.mjs.map +1 -0
  193. package/dist/grpc/stream/index.d.mts +41 -0
  194. package/dist/grpc/stream/index.d.mts.map +1 -0
  195. package/dist/grpc/stream/index.mjs +127 -0
  196. package/dist/grpc/stream/index.mjs.map +1 -0
  197. package/dist/grpc/stream/live.mjs +31 -0
  198. package/dist/grpc/stream/live.mjs.map +1 -0
  199. package/dist/grpc/stream/page.mjs +120 -0
  200. package/dist/grpc/stream/page.mjs.map +1 -0
  201. package/dist/grpc/stream-types.d.mts +28 -0
  202. package/dist/grpc/stream-types.d.mts.map +1 -0
  203. package/dist/grpc/transport.d.mts +8 -3
  204. package/dist/grpc/transport.d.mts.map +1 -1
  205. package/dist/grpc/transport.mjs +88 -45
  206. package/dist/grpc/transport.mjs.map +1 -1
  207. package/dist/jsonRpc/index.d.mts +34 -12
  208. package/dist/jsonRpc/index.d.mts.map +1 -0
  209. package/dist/jsonRpc/index.mjs +39 -5
  210. package/dist/jsonRpc/index.mjs.map +1 -0
  211. package/dist/jsonRpc/types.d.mts +420 -0
  212. package/dist/jsonRpc/types.d.mts.map +1 -0
  213. package/dist/keypairs/passkey/keypair.d.mts +1 -1
  214. package/dist/multisig/publickey.d.mts +12 -4
  215. package/dist/multisig/publickey.d.mts.map +1 -1
  216. package/dist/multisig/publickey.mjs +5 -5
  217. package/dist/multisig/publickey.mjs.map +1 -1
  218. package/dist/multisig/signer.d.mts +1 -1
  219. package/dist/transactions/ObjectCache.d.mts +1 -1
  220. package/dist/transactions/ObjectCache.mjs +5 -5
  221. package/dist/transactions/ObjectCache.mjs.map +1 -1
  222. package/dist/transactions/Transaction.d.mts +10 -9
  223. package/dist/transactions/Transaction.d.mts.map +1 -1
  224. package/dist/transactions/Transaction.mjs +17 -6
  225. package/dist/transactions/Transaction.mjs.map +1 -1
  226. package/dist/transactions/data/internal.d.mts +2 -0
  227. package/dist/transactions/data/internal.d.mts.map +1 -1
  228. package/dist/transactions/data/internal.mjs +2 -1
  229. package/dist/transactions/data/internal.mjs.map +1 -1
  230. package/dist/transactions/executor/parallel.d.mts +2 -2
  231. package/dist/transactions/executor/serial.d.mts +1 -1
  232. package/dist/transactions/executor/serial.mjs +2 -2
  233. package/dist/transactions/executor/serial.mjs.map +1 -1
  234. package/dist/transactions/index.d.mts +3 -2
  235. package/dist/transactions/index.mjs +4 -3
  236. package/dist/transactions/intents/AllowanceBalance.mjs +1 -1
  237. package/dist/transactions/intents/CoinWithBalance.mjs +1 -1
  238. package/dist/transactions/resolve.d.mts +6 -0
  239. package/dist/transactions/resolve.d.mts.map +1 -1
  240. package/dist/transactions/resolve.mjs.map +1 -1
  241. package/dist/transactions/restricted-move-calls.d.mts +25 -0
  242. package/dist/transactions/restricted-move-calls.d.mts.map +1 -0
  243. package/dist/transactions/restricted-move-calls.mjs +47 -0
  244. package/dist/transactions/restricted-move-calls.mjs.map +1 -0
  245. package/dist/transactions/serializer.d.mts +1 -4
  246. package/dist/transactions/serializer.d.mts.map +1 -1
  247. package/dist/transactions/serializer.mjs +1 -44
  248. package/dist/transactions/serializer.mjs.map +1 -1
  249. package/dist/transactions/utils.d.mts +0 -1
  250. package/dist/transactions/utils.d.mts.map +1 -1
  251. package/dist/transactions/utils.mjs.map +1 -1
  252. package/dist/utils/abort.mjs +89 -0
  253. package/dist/utils/abort.mjs.map +1 -0
  254. package/dist/utils/coin-reservation.mjs +1 -4
  255. package/dist/utils/coin-reservation.mjs.map +1 -1
  256. package/dist/utils/index.mjs +1 -1
  257. package/dist/utils/sui-types.mjs +1 -1
  258. package/dist/verify/index.d.mts +2 -2
  259. package/dist/verify/verify.d.mts +74 -24
  260. package/dist/verify/verify.d.mts.map +1 -1
  261. package/dist/verify/verify.mjs +128 -42
  262. package/dist/verify/verify.mjs.map +1 -1
  263. package/dist/version.mjs +1 -1
  264. package/dist/version.mjs.map +1 -1
  265. package/dist/zklogin/bcs.d.mts +14 -14
  266. package/dist/zklogin/publickey.d.mts.map +1 -1
  267. package/dist/zklogin/publickey.mjs +15 -20
  268. package/dist/zklogin/publickey.mjs.map +1 -1
  269. package/docs/bcs.md +2 -2
  270. package/docs/clients/core.md +19 -18
  271. package/docs/clients/executing.md +53 -8
  272. package/docs/clients/graphql.md +81 -11
  273. package/docs/clients/grpc.md +31 -15
  274. package/docs/clients/index.md +8 -7
  275. package/docs/clients/querying.md +134 -30
  276. package/docs/clients/streaming.md +324 -0
  277. package/docs/cryptography/index.md +85 -58
  278. package/docs/llms-index.md +4 -2
  279. package/docs/migrations/sui-2.0/dapp-kit.md +3 -2
  280. package/docs/migrations/sui-2.0/json-rpc-migration.md +106 -79
  281. package/docs/migrations/sui-3.0/index.md +247 -0
  282. package/docs/plugins.md +10 -10
  283. package/docs/sdk-building.md +3 -4
  284. package/docs/transactions/coins-and-balances.md +6 -11
  285. package/docs/transactions/reference.md +36 -1
  286. package/package.json +4 -5
  287. package/src/bcs/bcs.ts +80 -41
  288. package/src/bcs/effects.ts +61 -25
  289. package/src/bcs/index.ts +2 -0
  290. package/src/bcs/transactions.ts +36 -17
  291. package/src/bcs/types.ts +10 -4
  292. package/src/client/core-resolver.ts +3 -5
  293. package/src/client/core.ts +180 -8
  294. package/src/client/errors.ts +12 -0
  295. package/src/client/index.ts +4 -2
  296. package/src/client/mvr.ts +37 -10
  297. package/src/client/query-filters.ts +151 -97
  298. package/src/client/stream/adapter.ts +110 -0
  299. package/src/client/stream/errors.ts +40 -0
  300. package/src/client/stream/filter.ts +17 -0
  301. package/src/client/stream/follow.ts +63 -0
  302. package/src/client/stream/index.ts +9 -0
  303. package/src/client/stream/pager.ts +158 -0
  304. package/src/client/stream/plan.ts +147 -0
  305. package/src/client/stream/position.ts +143 -0
  306. package/src/client/stream/run.ts +147 -0
  307. package/src/client/stream/session.ts +259 -0
  308. package/src/client/stream/status.ts +44 -0
  309. package/src/client/stream/token.ts +104 -0
  310. package/src/client/transaction-data.ts +610 -0
  311. package/src/client/transaction-resolver.ts +158 -69
  312. package/src/client/types.ts +530 -115
  313. package/src/client/utils.ts +146 -61
  314. package/src/cryptography/publickey.ts +12 -1
  315. package/src/cryptography/signature.ts +6 -3
  316. package/src/graphql/client.ts +204 -135
  317. package/src/graphql/core.ts +446 -139
  318. package/src/graphql/errors.ts +24 -0
  319. package/src/graphql/filters.ts +48 -0
  320. package/src/graphql/generated/queries.ts +1455 -277
  321. package/src/graphql/generated/schema.graphql +282 -9
  322. package/src/graphql/generated/tada-env.ts +933 -4
  323. package/src/graphql/queries/checkpoints.graphql +34 -0
  324. package/src/graphql/queries/getDynamicFields.graphql +1 -0
  325. package/src/graphql/queries/listEvents.graphql +16 -24
  326. package/src/graphql/queries/streams.graphql +212 -0
  327. package/src/graphql/queries/transactions.graphql +71 -28
  328. package/src/graphql/queries/verifySignature.graphql +17 -0
  329. package/src/graphql/sse-parser.ts +99 -0
  330. package/src/graphql/stream/families.ts +515 -0
  331. package/src/graphql/stream/index.ts +55 -0
  332. package/src/graphql/stream/live.ts +70 -0
  333. package/src/graphql/stream/page.ts +47 -0
  334. package/src/graphql/stream/query.ts +52 -0
  335. package/src/graphql/subscribe.ts +83 -0
  336. package/src/grpc/client.ts +81 -79
  337. package/src/grpc/core.ts +388 -274
  338. package/src/grpc/filters.ts +59 -60
  339. package/src/grpc/grpc-web-pull.ts +360 -0
  340. package/src/grpc/index.ts +5 -0
  341. package/src/grpc/network-error.ts +33 -0
  342. package/src/grpc/proto/sui/rpc/v2/error_reason.ts +175 -0
  343. package/src/grpc/proto/sui/rpc/v2/ledger_service.ts +145 -0
  344. package/src/grpc/proto/sui/rpc/v2/move_package_service.ts +43 -1
  345. package/src/grpc/proto/sui/rpc/v2/query_options.ts +132 -8
  346. package/src/grpc/proto/sui/rpc/v2/signature.ts +4 -4
  347. package/src/grpc/proto/sui/rpc/v2/signature_scheme.ts +4 -0
  348. package/src/grpc/proto/sui/rpc/v2/signature_verification_service.ts +30 -0
  349. package/src/grpc/proto/sui/rpc/v2/subscription_service.client.ts +16 -10
  350. package/src/grpc/proto/sui/rpc/v2/transaction.ts +6 -0
  351. package/src/grpc/proto/sui/rpc/v2/transaction_execution_service.ts +5 -1
  352. package/src/grpc/pull-call.ts +54 -0
  353. package/src/grpc/stream/call.ts +317 -0
  354. package/src/grpc/stream/families.ts +228 -0
  355. package/src/grpc/stream/index.ts +182 -0
  356. package/src/grpc/stream/live.ts +33 -0
  357. package/src/grpc/stream/page.ts +161 -0
  358. package/src/grpc/stream-types.ts +33 -0
  359. package/src/grpc/transport.ts +116 -59
  360. package/src/jsonRpc/index.ts +60 -17
  361. package/src/jsonRpc/types.ts +421 -0
  362. package/src/multisig/publickey.ts +19 -7
  363. package/src/transactions/ObjectCache.ts +6 -6
  364. package/src/transactions/Transaction.ts +30 -6
  365. package/src/transactions/data/internal.ts +2 -0
  366. package/src/transactions/executor/serial.ts +2 -2
  367. package/src/transactions/index.ts +8 -1
  368. package/src/transactions/resolve.ts +6 -0
  369. package/src/transactions/restricted-move-calls.ts +87 -0
  370. package/src/transactions/serializer.ts +0 -70
  371. package/src/transactions/utils.ts +0 -37
  372. package/src/utils/abort.ts +101 -0
  373. package/src/verify/index.ts +1 -0
  374. package/src/verify/verify.ts +190 -62
  375. package/src/version.ts +1 -1
  376. package/src/zklogin/publickey.ts +18 -34
  377. package/dist/client/core-resolver.d.mts +0 -9
  378. package/dist/client/core-resolver.d.mts.map +0 -1
  379. package/dist/jsonRpc/client.d.mts +0 -507
  380. package/dist/jsonRpc/client.d.mts.map +0 -1
  381. package/dist/jsonRpc/client.mjs +0 -868
  382. package/dist/jsonRpc/client.mjs.map +0 -1
  383. package/dist/jsonRpc/core.d.mts +0 -168
  384. package/dist/jsonRpc/core.d.mts.map +0 -1
  385. package/dist/jsonRpc/core.mjs +0 -1054
  386. package/dist/jsonRpc/core.mjs.map +0 -1
  387. package/dist/jsonRpc/errors.d.mts +0 -27
  388. package/dist/jsonRpc/errors.d.mts.map +0 -1
  389. package/dist/jsonRpc/errors.mjs +0 -50
  390. package/dist/jsonRpc/errors.mjs.map +0 -1
  391. package/dist/jsonRpc/http-transport.d.mts +0 -62
  392. package/dist/jsonRpc/http-transport.d.mts.map +0 -1
  393. package/dist/jsonRpc/http-transport.mjs +0 -60
  394. package/dist/jsonRpc/http-transport.mjs.map +0 -1
  395. package/dist/jsonRpc/network.d.mts +0 -9
  396. package/dist/jsonRpc/network.d.mts.map +0 -1
  397. package/dist/jsonRpc/network.mjs +0 -18
  398. package/dist/jsonRpc/network.mjs.map +0 -1
  399. package/dist/jsonRpc/types/chain.d.mts +0 -169
  400. package/dist/jsonRpc/types/chain.d.mts.map +0 -1
  401. package/dist/jsonRpc/types/changes.d.mts +0 -48
  402. package/dist/jsonRpc/types/changes.d.mts.map +0 -1
  403. package/dist/jsonRpc/types/coins.d.mts +0 -15
  404. package/dist/jsonRpc/types/coins.d.mts.map +0 -1
  405. package/dist/jsonRpc/types/common.d.mts +0 -9
  406. package/dist/jsonRpc/types/common.d.mts.map +0 -1
  407. package/dist/jsonRpc/types/generated.d.mts +0 -1976
  408. package/dist/jsonRpc/types/generated.d.mts.map +0 -1
  409. package/dist/jsonRpc/types/index.d.mts +0 -6
  410. package/dist/jsonRpc/types/params.d.mts +0 -898
  411. package/dist/jsonRpc/types/params.d.mts.map +0 -1
  412. package/src/graphql/generated/tsconfig.tada.json +0 -11
  413. package/src/graphql/queries/verifyZkLoginSignature.graphql +0 -15
  414. package/src/jsonRpc/client.ts +0 -1252
  415. package/src/jsonRpc/core.ts +0 -1557
  416. package/src/jsonRpc/errors.ts +0 -57
  417. package/src/jsonRpc/http-transport.ts +0 -118
  418. package/src/jsonRpc/network.ts +0 -21
  419. package/src/jsonRpc/types/chain.ts +0 -190
  420. package/src/jsonRpc/types/changes.ts +0 -35
  421. package/src/jsonRpc/types/coins.ts +0 -14
  422. package/src/jsonRpc/types/common.ts +0 -8
  423. package/src/jsonRpc/types/generated.ts +0 -2165
  424. package/src/jsonRpc/types/index.ts +0 -9
  425. package/src/jsonRpc/types/params.ts +0 -908
@@ -0,0 +1,247 @@
1
+ # Migrate to 3.0
2
+
3
+ > Breaking changes in @mysten/sui 3.0, which removes the deprecated JSON-RPC transport
4
+
5
+ `@mysten/sui` 3.0 removes the JSON-RPC transport. If you still use `SuiJsonRpcClient`, move to
6
+ [`SuiGrpcClient`](/sui/clients/grpc) (recommended) or [`SuiGraphQLClient`](/sui/clients/graphql) by
7
+ following [Migrating from JSON-RPC](/sui/migrations/sui-2.0/json-rpc-migration), which maps every
8
+ JSON-RPC method to its replacement. Code that already runs on gRPC or GraphQL needs few or no
9
+ changes.
10
+
11
+ Every `@mysten/*` package with a peer dependency on `@mysten/sui`, except the legacy
12
+ `@mysten/dapp-kit`, gets a new release that requires `@mysten/sui@^3`: a major release, or a minor
13
+ release for packages still on 0.x. `@mysten/dapp-kit-react` also gets a major release, because it
14
+ depends on `@mysten/dapp-kit-core` 2.0. Apart from the items below, these releases have no breaking
15
+ changes: upgrade them together with `@mysten/sui`.
16
+
17
+ The legacy `@mysten/dapp-kit` has a peer dependency on `@mysten/sui` and uses JSON-RPC, so it can't
18
+ run on 3.0 or keep a 2.x copy of its own.
19
+ [Migrate to `@mysten/dapp-kit-react`](/sui/migrations/sui-2.0/dapp-kit) before upgrading.
20
+
21
+ ## Breaking changes
22
+
23
+ ### Removed JSON-RPC APIs
24
+
25
+ - **`@mysten/sui/jsonRpc` no longer supports JSON-RPC.** Code that imports it still loads, but
26
+ `SuiJsonRpcClient`, `JsonRpcHTTPTransport` and the JSON-RPC error classes throw when constructed,
27
+ and `isSuiJsonRpcClient` returns `false`. Its types, such as `ObjectOwner`, are deprecated aliases
28
+ of `any`. Follow [Migrating from JSON-RPC](/sui/migrations/sui-2.0/json-rpc-migration), and use
29
+ the `SuiClientTypes` equivalents from `@mysten/sui/client` for the types.
30
+ - **`getJsonRpcFullnodeUrl` throws.** Pass the full node URL (for example
31
+ `https://fullnode.mainnet.sui.io:443`) to `SuiGrpcClient`'s `baseUrl`.
32
+ - **`normalizedTypeToMoveTypeSignature` is removed.** `getMoveFunction` already returns
33
+ `OpenSignature`s.
34
+ - **Untyped pure values are no longer supported.** `SuiJsonRpcClient` serialized `UnresolvedPure`
35
+ inputs, such as raw Move call arguments in v1 transaction JSON restored with `Transaction.from`,
36
+ from the Move function signature; `SuiGrpcClient` and `SuiGraphQLClient` reject them. Pass typed
37
+ values such as `tx.pure.u64(...)` instead.
38
+
39
+ ### Core API
40
+
41
+ - **`listDynamicFields` pagination loops may need a type annotation.** If a loop that passes the
42
+ cursor back in fails with `TS7022`, annotate the page as
43
+ `SuiClientTypes.ListDynamicFieldsResponse`.
44
+ - **On `SuiGrpcClient`, `listDynamicFields` with `include: { value: true }` returns a dynamic object
45
+ field's child object as its value**, matching `SuiGraphQLClient`: `value.bcs` is the child
46
+ object's BCS contents instead of its ID. Read the child's ID from `childId`.
47
+ - **On `SuiGraphQLClient`, an empty last page of `listTransactions` or `listEvents` has `null`
48
+ cursors**, as on `SuiGrpcClient`. When polling, keep your previous cursor
49
+ (`cursor = page.endCursor ?? cursor`).
50
+ - **On `SuiGraphQLClient`, a transaction's `events` take `packageId` and `module` from the Move call
51
+ that emitted the event**, as `listEvents` and `SuiGrpcClient` do, rather than from the event type.
52
+
53
+ ### Transaction data and BCS
54
+
55
+ - **Transaction data (`include: { transaction: true }`) has a `kind`.** Inputs and commands carry
56
+ `$kind`, so narrow with `input.$kind === 'Pure'` rather than `'Pure' in input`. Decode transaction
57
+ bytes into this type with `parseTransactionBcs`. See
58
+ [transaction data](/sui/clients/executing#transaction-data). It is no longer the builder's
59
+ serialized type, so to rebuild a `Transaction` from a query result, request
60
+ `include: { bcs: true }` and pass the result's `bcs` to `Transaction.from`.
61
+ - **`bcs.Owner` has a `Party` variant, and `bcs.MoveObjectType`'s `AccumulatorBalanceWrapper` is
62
+ renamed to `SuiBalanceAccumulatorField`.**
63
+ - **System transaction kinds decoded with `bcs.TransactionKind` use named fields instead of
64
+ tuples**, and `authenticatorObjInitialSharedVersion` and `randomnessObjInitialSharedVersion` are
65
+ renamed to `authenticatorObjectInitialSharedVersion` and `randomnessObjectInitialSharedVersion`.
66
+ - **`SuiClientTypes.MoveLocation.function` (the function index) is removed.** Use
67
+ `location.functionName`.
68
+ - **`bcs.TransactionEffects` tuples are structs with named fields**, for example `changedObjects`
69
+ entries (`{ objectId, inputState, outputState, idOperation }`), `IntegerTuple`
70
+ (`{ first, second }`) and V1 `modifiedAtVersions` entries (`{ objectId, version }`).
71
+ `InsufficientBalanceForWithdraw` is renamed to `InsufficientFundsForWithdraw` and
72
+ `congested_objects` to `congestedObjects`. The encoded bytes are unchanged.
73
+ - **Multisig BCS fields are camelCase:** `multisigPk` instead of `multisig_pk` and `pkMap` instead
74
+ of `pk_map`. The old names still work on `parseSerializedSignature` results but are deprecated.
75
+ - **Execution error names in `effects.status` match `SuiGrpcClient` everywhere**, including
76
+ `SuiGraphQLClient` and dApp Kit wallet results: `InvalidBcsBytes`, `InvalidUsageOfPureArgument`,
77
+ `ConsensusObjectOperationNotAllowed` and `PackageIdDoesNotMatch` replace `InvalidBCSBytes`,
78
+ `InvalidUsageOfPureArg`, `SharedObjectOperationNotAllowed` and `PackageIDDoesNotMatch`.
79
+ - **`parseGrpcTransactionResponse` needs `transaction.sender` in the read mask.**
80
+ - **Building or serializing a transaction that calls `0x2::address_alias` throws.** Pass
81
+ `restrictedMoveCalls: []` to the client constructor, or to `build` or `toJSON`, to allow it. See
82
+ [Restricted Move calls](/sui/transactions/reference#restricted-move-calls).
83
+
84
+ ### Transports
85
+
86
+ - **gRPC-web uses the binary format by default.** If a proxy in front of your full node only
87
+ supports `application/grpc-web-text`, pass `format: 'text'`.
88
+ - **Client URLs are checked at construction.** A GraphQL `url` or gRPC `baseUrl` that is neither an
89
+ absolute http(s) URL nor a path starting with `/` throws when the client is created.
90
+ - **Network errors changed.** `SuiGrpcClient` reports `UNAVAILABLE` instead of `INTERNAL`, and
91
+ `SuiGraphQLClient` throws `SuiGraphQLRequestError`, with the original error as `cause`, for
92
+ network failures and malformed or unreadable bodies.
93
+ - **The raw gRPC `GetPackageRequest` type requires a `selector`.** Existing
94
+ `client.movePackageService.getPackage({ packageId })` calls still work at runtime. To satisfy the
95
+ type, pass `selector: { oneofKind: undefined }` or build the request with
96
+ `GrpcTypes.GetPackageRequest.create({ packageId })`.
97
+
98
+ ### Signature verification
99
+
100
+ - **`verifyPersonalMessageSignature`, `verifyTransactionSignature`,
101
+ `isValidPersonalMessageSignature` and `isValidTransactionSignature` require a `client` or
102
+ `offline: true`.** Without either it's a type error; at runtime they verify offline and log a
103
+ warning. With a client, the node verifies the signature and checks zkLogin signatures; with
104
+ `address`, it also accepts the address's [address aliases](/sui/cryptography#address-aliases), and
105
+ throws on nodes that can't check them unless you pass `checkAddressAliases: false`. With
106
+ `offline: true`, zkLogin signatures throw. See
107
+ [Online or offline](/sui/cryptography#online-or-offline) for which to choose.
108
+ - **With a client, the public key the verify helpers return may belong to one of the address's
109
+ aliases.** Use `address`, not `publicKey.toSuiAddress()`, as the account's identity.
110
+ - **`verifyZkLoginSignature` accepts signatures from the address's aliases** and throws on nodes
111
+ that can't check address aliases. It's deprecated: use `client.core.verifySignature`.
112
+
113
+ ## Other packages
114
+
115
+ - **`@mysten-incubation/sponsor`'s `userSignatureMatchesSender` verifies on the node**, and fails
116
+ with `ANALYSIS_FAILED` if the node can't be reached.
117
+ - **`@mysten/wallet-sdk`'s `restrictedMoveCalls` and `@mysten-incubation/sponsor`'s
118
+ `noRestrictedMoveCalls` take `{ restrictedMoveCalls }`** (`package`, `package::module` or
119
+ `package::module::function` entries) instead of `addressAliases` and `targets`, and throw on any
120
+ other option. The list replaces the default, so keep `'0x2::address_alias'` in it to keep flagging
121
+ alias changes. Results no longer have a `level`, and `matchedBy` is a single entry instead of an
122
+ array.
123
+ - **`@mysten/wallet-standard` and `@mysten/kiosk` no longer use JSON-RPC types.** Import legacy
124
+ response types from the `SuiJsonRpcTypes` namespace in `@mysten/wallet-standard`.
125
+ `TransferPolicy.owner` in `@mysten/kiosk` is a `SuiClientTypes.ObjectOwner`.
126
+
127
+ Wallets that still implement the deprecated `sui:signAndExecuteTransactionBlock` feature can build
128
+ its legacy response from a gRPC or GraphQL execution with `@mysten/wallet-sdk/json-rpc-compat`:
129
+
130
+ ```typescript
131
+
132
+ mappableIncludeFor,
133
+ transactionBlockResponseFromExecution,
134
+ } from '@mysten/wallet-sdk/json-rpc-compat';
135
+
136
+ // `input` is the dApp's `sui:signAndExecuteTransactionBlock` input; `bytes` (a `Uint8Array`) and
137
+ // `signature` are what the wallet signed.
138
+ const result = await client.core.executeTransaction({
139
+ transaction: bytes,
140
+ signatures: [signature],
141
+ include: mappableIncludeFor(input.options),
142
+ });
143
+
144
+ return transactionBlockResponseFromExecution(result.Transaction ?? result.FailedTransaction, {
145
+ bytes,
146
+ signatures: [signature],
147
+ options: input.options,
148
+ });
149
+ ```
150
+
151
+ For wallet code that still reads the JSON-RPC dry-run shape, `dryRunFromSimulation` builds a
152
+ `DryRunTransactionBlockResponse` from the simulated transaction
153
+ (`result.Transaction ?? result.FailedTransaction`) of a `simulateTransaction` call made with
154
+ `include: { balanceChanges: true, effects: true, events: true, objectTypes: true, transaction: true }`.
155
+
156
+ ## Dependencies that still require 2.x
157
+
158
+ You can upgrade before your dependencies release versions for 3.0. How a dependency lists
159
+ `@mysten/sui` decides which copy it uses:
160
+
161
+ - **A regular dependency on 2.x:** it installs its own 2.x copy and keeps working on it.
162
+ `Transaction`s built by its copy skip the
163
+ [restricted Move calls](/sui/transactions/reference#restricted-move-calls) check.
164
+ - **A peer dependency on `^2`:** npm refuses to install it next to 3.0. pnpm and Yarn print a
165
+ warning and give it your 3.0 copy.
166
+
167
+ Run `npm ls @mysten/sui` or `pnpm why @mysten/sui` to see which copies you have.
168
+
169
+ Let packages keep their own 2.x copy where you can. Only values that cross between your code and the
170
+ package are affected:
171
+
172
+ - Clients, `Transaction`s and signers from your copy may not type-check where its API expects its
173
+ own, and fail its `instanceof` checks on SDK classes. A package that accepts `ClientWithCoreApi`
174
+ and doesn't use `instanceof` on SDK classes accepts them at runtime.
175
+ - A package that calls methods on your 3.0 client gets 3.0 results, with the [Core API](#core-api)
176
+ and [transaction data](#transaction-data-and-bcs) changes above.
177
+
178
+ If a package needs to use your copy, for example a peer dependency that npm won't install, add an
179
+ override:
180
+
181
+ ```json title="package.json (npm)"
182
+ {
183
+ "overrides": {
184
+ "@mysten/sui": "$@mysten/sui"
185
+ }
186
+ }
187
+ ```
188
+
189
+ `$@mysten/sui` reuses the version in your own `dependencies`.
190
+
191
+ ```yaml title="pnpm-workspace.yaml (pnpm 10.5 and later)"
192
+ overrides:
193
+ '@mysten/sui': '$@mysten/sui'
194
+ ```
195
+
196
+ Earlier pnpm versions ignore overrides in `pnpm-workspace.yaml`: put the same entry under
197
+ `pnpm.overrides` in `package.json` instead. pnpm resolves `$@mysten/sui` from the root
198
+ `package.json`, so if only a workspace package depends on `@mysten/sui`, write the range instead,
199
+ for example `^3.0.0`.
200
+
201
+ ```json title="package.json (Yarn, Bun)"
202
+ {
203
+ "resolutions": {
204
+ "@mysten/sui": "^3.0.0"
205
+ }
206
+ }
207
+ ```
208
+
209
+ Yarn still prints a peer dependency warning, which you can ignore.
210
+
211
+ An override applies to every package, so all of them run on 3.0, as does a peer dependency that pnpm
212
+ or Yarn gives your copy. The breaking changes above affect these packages as they affect your code.
213
+ Most often, a package that imports `@mysten/sui/jsonRpc` loads, but throws when it uses JSON-RPC. It
214
+ needs a release for 3.0; until then, don't add an override, so that a regular dependency keeps its
215
+ own 2.x copy.
216
+
217
+ Test the flows that use each dependency, and remove the override once every dependency supports 3.0.
218
+
219
+ ## Libraries built on `@mysten/sui`
220
+
221
+ If you publish a package that uses `@mysten/sui`, release a version for 3.0 that:
222
+
223
+ - **Lists `@mysten/sui@^3` in `peerDependencies`**, not `dependencies`, so apps keep a single copy.
224
+ See [Building SDKs](/sui/sdk-building#use-mysten-packages-as-peer-dependencies).
225
+ - **Doesn't import `@mysten/sui/jsonRpc`.** On 3.0 its classes and `getJsonRpcFullnodeUrl` throw,
226
+ and its types are `any`.
227
+ - **Accepts `ClientWithCoreApi`** from `@mysten/sui/client` instead of a specific client class, and
228
+ reads through `client.core`.
229
+ - **Doesn't use `instanceof` on SDK classes**, which fails for values from another copy of
230
+ `@mysten/sui`. Use `isTransaction` from `@mysten/sui/transactions`, `isSuiGrpcClient` from
231
+ `@mysten/sui/grpc` and `isSuiGraphQLClient` from `@mysten/sui/graphql`.
232
+
233
+ ## New in 3.0
234
+
235
+ - `listTransactions` filters accept `affectedAddress` and `affectedObject`, and `sender` combines
236
+ with other predicates.
237
+ - `listTransactions` and `listEvents` accept `startCheckpoint` and `endCheckpoint`, and `after` and
238
+ `before` can be combined to read a window.
239
+ - `doGasSelection` is available on every client's `simulateTransaction`.
240
+ - A `listCheckpoints` method for paging through checkpoints.
241
+ - `SuiGraphQLClient.subscribe` runs GraphQL subscriptions; `subscriptionUrl` sets their endpoint.
242
+ - Resumable checkpoint, transaction, and event streams on `SuiGrpcClient` and `SuiGraphQLClient`.
243
+ See [Resumable ledger streams](/sui/clients/streaming).
244
+ - `client.core.listDynamicFields({ include: { value: true } })` returns each field's value with the
245
+ listing, on every client.
246
+ - `client.core.verifySignature`, which verifies a personal message or transaction signature on the
247
+ node and checks address aliases, and `client.core.getAddressAliases`.
package/docs/plugins.md CHANGED
@@ -50,21 +50,21 @@ objects or Pure values and can be represented in several different ways:
50
50
  `initialSharedVersion`, and whether the shared object is used mutably.
51
51
  - `Receiving`: A reference to a receiving object, including the object's `id`, `version`, and
52
52
  `digest`.
53
- - `UnresolvedPure`: A placeholder for a pure value that has not been serialized to BCS.
53
+ - `UnresolvedPure`: A pure value that has not been serialized to BCS. The built-in clients do not
54
+ support untyped pure values; use typed inputs such as `tx.pure.u64(value)`.
54
55
  - `UnresolvedObject`: A partial reference to an object, often containing just the object's `id`, but
55
56
  might also include a version, digest, or initialSharedVersion.
56
57
 
57
58
  ## Lifecycle of a transaction
58
59
 
59
- Because transactions can contain `UnresolvedPure` and `UnresolvedObject` inputs, these values need
60
- to be resolved before the transaction can be serialized to BCS. However, these unresolved inputs can
61
- be represented in JSON. What might not be able to be represented in JSON are Transaction Intents.
62
- Transaction Intents represent custom concepts added by plugins or third-party SDKs. To account for
63
- this, the build process of a transaction is split into two phases: serialization and building.
64
- Serialization prepares the transaction to be serialized to JSON by running serialization plugins,
65
- and resolving any unsupported intents. The Build phase then runs, which runs build plugins and
66
- resolves any UnresolvedPure and UnresolvedObject inputs, before the transaction is serialized to
67
- BCS.
60
+ Because transactions can contain `UnresolvedObject` inputs, these values need to be resolved before
61
+ the transaction can be serialized to BCS. However, these unresolved inputs can be represented in
62
+ JSON. What might not be able to be represented in JSON are Transaction Intents. Transaction Intents
63
+ represent custom concepts added by plugins or third-party SDKs. To account for this, the build
64
+ process of a transaction is split into two phases: serialization and building. Serialization
65
+ prepares the transaction to be serialized to JSON by running serialization plugins, and resolving
66
+ any unsupported intents. The Build phase then runs, which runs build plugins and resolves any
67
+ `UnresolvedObject` inputs, before the transaction is serialized to BCS.
68
68
 
69
69
  ## Serialization plugins
70
70
 
@@ -5,8 +5,7 @@
5
5
  This guide covers recommended patterns for building TypeScript SDKs that integrate with the Sui SDK.
6
6
  Following these patterns ensures your SDK integrates seamlessly with the ecosystem, works with
7
7
  `SuiGrpcClient` and `SuiGraphQLClient` through the shared Core API, and composes well with other
8
- SDKs. Legacy JSON-RPC clients can also be supported during migration because they implement the same
9
- Core API contract.
8
+ SDKs.
10
9
 
11
10
  All SDKs should depend on [`ClientWithCoreApi`](./clients/core), which is the transport-agnostic
12
11
  interface implemented by Sui clients. This lets application code choose one concrete client and use
@@ -24,11 +23,11 @@ duplicate code.
24
23
  {
25
24
  "name": "@your-org/your-sdk",
26
25
  "peerDependencies": {
27
- "@mysten/sui": "^2.0.0",
26
+ "@mysten/sui": "^3.0.0",
28
27
  "@mysten/bcs": "^2.0.0"
29
28
  },
30
29
  "devDependencies": {
31
- "@mysten/sui": "^2.0.0",
30
+ "@mysten/sui": "^3.0.0",
32
31
  "@mysten/bcs": "^2.0.0"
33
32
  }
34
33
  }
@@ -254,10 +254,10 @@ Gasless transactions are limited to transactions that send funds as balances for
254
254
  allowlisted stablecoins. Using `0x2::balance::send_funds` with `tx.balance()` is the recommended way
255
255
  to build gasless transactions with the TypeScript SDK.
256
256
 
257
- ### SDK support (gRPC and GraphQL)
257
+ ### SDK support
258
258
 
259
- When using the gRPC or GraphQL transports, transactions that qualify are automatically detected, and
260
- the gas price is set when the transaction is built.
259
+ When a transaction is built with `SuiGrpcClient` or `SuiGraphQLClient`, transactions that qualify
260
+ are automatically detected, and the gas price is set when the transaction is built.
261
261
 
262
262
  ```tsx
263
263
 
@@ -282,14 +282,9 @@ const result = await client.signAndExecuteTransaction({
282
282
  });
283
283
  ```
284
284
 
285
- The JSON-RPC transport does not automatically detect gasless eligibility. You can opt in by setting
286
- the gas price to zero with `tx.setGasPrice(0)`, but only after confirming the coin type is on the
287
- [allowlist](https://docs.sui.io/develop/transaction-payment/gasless-stablecoin-transfers#eligible-stablecoins)
288
- and the PTB shape is eligible. Otherwise the transaction fails at validation.
289
-
290
- > **Warning:** If your wallet builds transactions with gRPC but executes through a different transport (for
291
- > example, dapp-kit wallets that still execute over JSON-RPC), pass the gRPC client to `build` so
292
- > the gas price still gets set correctly:
285
+ > **Warning:** If your wallet builds transactions with one client but executes them somewhere else (for example,
286
+ > through its own backend), pass a gRPC or GraphQL client to `build` so the gas price still gets set
287
+ > correctly:
293
288
  >
294
289
  > ```tsx
295
290
  > const bytes = await tx.build({ client: grpcClient });
@@ -377,4 +377,39 @@ const [a, b] = tx.moveCall({ target: '0xPkg::mod::returns_two' });
377
377
  // or
378
378
  const result = tx.moveCall({ target: '0xPkg::mod::returns_two' });
379
379
  tx.transferObjects([result[0], result[1]], address);
380
- ```
380
+ ```
381
+
382
+ ## Restricted Move calls
383
+
384
+ Building or serializing a transaction that makes a restricted Move call throws. The default
385
+ (`DEFAULT_RESTRICTED_MOVE_CALLS`) is only `0x2::address_alias`: adding an alias lets another address
386
+ sign for the account.
387
+
388
+ Configure the list on the client; `[]` turns the check off:
389
+
390
+ ```typescript
391
+ const client = new SuiGrpcClient({ network, baseUrl, restrictedMoveCalls: [] });
392
+ ```
393
+
394
+ To restrict more calls, extend the default rather than replacing it:
395
+
396
+ ```typescript
397
+
398
+ const client = new SuiGrpcClient({
399
+ network,
400
+ baseUrl,
401
+ restrictedMoveCalls: [...DEFAULT_RESTRICTED_MOVE_CALLS, '0xbad'],
402
+ });
403
+ ```
404
+
405
+ `build()` and `toJSON()` also take `restrictedMoveCalls`, which takes precedence over the client's
406
+ list. Entries are `package`, `package::module` or `package::module::function`.
407
+
408
+ Entries only match top-level `moveCall` commands with that exact package ID, so they don't cover
409
+ upgraded package IDs or Move code that makes the call for you. `findRestrictedMoveCalls` from
410
+ `@mysten/sui/transactions` runs the same check on a transaction's data without throwing.
411
+
412
+ Anything that builds with a client, such as `signAndExecuteTransaction`, `simulateTransaction`, the
413
+ executors and dapp-kit, uses that client's list. Wallets that only support the legacy
414
+ `sui:signTransactionBlock` features apply the default list, so a client-level `[]` doesn't reach
415
+ them.
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "author": "Mysten Labs <build@mystenlabs.com>",
4
4
  "description": "Sui TypeScript API",
5
5
  "homepage": "https://sdk.mystenlabs.com",
6
- "version": "2.39.1",
6
+ "version": "3.0.1",
7
7
  "license": "Apache-2.0",
8
8
  "sideEffects": false,
9
9
  "files": [
@@ -136,7 +136,6 @@
136
136
  "access": "public"
137
137
  },
138
138
  "devDependencies": {
139
- "@0no-co/graphqlsp": "^1.17.3",
140
139
  "@graphql-codegen/add": "^7.1.0",
141
140
  "@graphql-codegen/cli": "^7.4.6",
142
141
  "@graphql-codegen/typed-document-node": "^7.1.0",
@@ -164,7 +163,7 @@
164
163
  "@noble/curves": "^2.3.0",
165
164
  "@noble/hashes": "^2.3.0",
166
165
  "@noble/post-quantum": "^0.7.1",
167
- "@protobuf-ts/grpcweb-transport": "^2.11.1",
166
+ "@protobuf-ts/grpcweb-transport": "~2.11.1",
168
167
  "@protobuf-ts/runtime": "^2.11.1",
169
168
  "@protobuf-ts/runtime-rpc": "^2.11.1",
170
169
  "@scure/base": "^2.3.0",
@@ -174,8 +173,8 @@
174
173
  "graphql": "^17.0.2",
175
174
  "poseidon-lite": "0.3.0",
176
175
  "valibot": "^1.4.2",
177
- "@mysten/bcs": "^2.1.4",
178
- "@mysten/utils": "^0.4.2"
176
+ "@mysten/utils": "^0.4.2",
177
+ "@mysten/bcs": "^2.1.4"
179
178
  },
180
179
  "scripts": {
181
180
  "clean": "rm -rf tsconfig.tsbuildinfo ./dist",
package/src/bcs/bcs.ts CHANGED
@@ -6,7 +6,7 @@ import { bcs, fromBase58, fromBase64, toBase58, toBase64, toHex } from '@mysten/
6
6
 
7
7
  import { isValidSuiAddress, normalizeSuiAddress, SUI_ADDRESS_LENGTH } from '../utils/sui-types.js';
8
8
  import { TypeTagSerializer } from './type-tag-serializer.js';
9
- import type { TypeTag as TypeTagType } from './types.js';
9
+ import type { SharedObjectAccess, TypeTag as TypeTagType } from './types.js';
10
10
 
11
11
  function unsafe_u64(options?: BcsTypeOptions<number>) {
12
12
  return bcs
@@ -111,10 +111,45 @@ export const SuiObjectRef = bcs.struct('SuiObjectRef', {
111
111
  digest: ObjectDigest,
112
112
  });
113
113
 
114
- export const SharedObjectRef = bcs.struct('SharedObjectRef', {
114
+ // Rust: crates/sui-types/src/transaction.rs
115
+ // `Immutable` and `Mutable` encode as the bytes `false` and `true` do.
116
+ export const SharedObjectMutability = bcs.enum('SharedObjectMutability', {
117
+ Immutable: null,
118
+ Mutable: null,
119
+ NonExclusiveWrite: null,
120
+ });
121
+
122
+ const SharedObjectRefStruct = bcs.struct('SharedObjectRef', {
115
123
  objectId: Address,
116
124
  initialSharedVersion: bcs.u64(),
117
- mutable: bcs.bool(),
125
+ mutability: SharedObjectMutability,
126
+ });
127
+
128
+ /**
129
+ * A shared object input. Non-exclusive write access, used only by system transactions, parses as
130
+ * `mutable: false` with `mutability: 'NonExclusiveWrite'`.
131
+ */
132
+ export const SharedObjectRef = SharedObjectRefStruct.transform({
133
+ name: 'SharedObjectRef',
134
+ validate: ({ mutable }) => bcs.bool().validate(mutable),
135
+ input: ({
136
+ mutable,
137
+ mutability,
138
+ ...ref
139
+ }: Omit<typeof SharedObjectRefStruct.$inferInput, 'mutability'> &
140
+ SharedObjectAccess): typeof SharedObjectRefStruct.$inferInput => ({
141
+ ...ref,
142
+ mutability: {
143
+ [mutability ?? (mutable ? 'Mutable' : 'Immutable')]: true,
144
+ } as typeof SharedObjectMutability.$inferInput,
145
+ }),
146
+ output: ({
147
+ mutability,
148
+ ...ref
149
+ }): { objectId: string; initialSharedVersion: string } & SharedObjectAccess =>
150
+ mutability.$kind === 'NonExclusiveWrite'
151
+ ? { ...ref, mutable: false, mutability: 'NonExclusiveWrite' }
152
+ : { ...ref, mutable: mutability.$kind === 'Mutable' },
118
153
  });
119
154
 
120
155
  export const ObjectArg = bcs.enum('ObjectArg', {
@@ -135,6 +170,20 @@ export const Owner = bcs.enum('Owner', {
135
170
  startVersion: bcs.u64(),
136
171
  owner: Address,
137
172
  }),
173
+ Party: bcs.struct('PartyOwner', {
174
+ startVersion: bcs.u64(),
175
+ permissions: bcs.struct('Party', {
176
+ // `ObjectPermissions` bitflags
177
+ defaultPermissions: bcs.u64(),
178
+ members: bcs.vector(
179
+ bcs.struct('PartyMember', {
180
+ address: Address,
181
+ // `ObjectPermissions` bitflags
182
+ permissions: bcs.u64(),
183
+ }),
184
+ ),
185
+ }),
186
+ }),
138
187
  });
139
188
 
140
189
  // Rust: crates/sui-types/src/transaction.rs
@@ -164,12 +213,14 @@ export const FundsWithdrawal = bcs.struct('FundsWithdrawal', {
164
213
  withdrawFrom: WithdrawFrom,
165
214
  });
166
215
 
216
+ export const base64String = bcs.byteVector().transform({
217
+ input: (val: string | Uint8Array) => (typeof val === 'string' ? fromBase64(val) : val),
218
+ output: (val) => toBase64(val),
219
+ });
220
+
167
221
  export const CallArg = bcs.enum('CallArg', {
168
222
  Pure: bcs.struct('Pure', {
169
- bytes: bcs.byteVector().transform({
170
- input: (val: string | Uint8Array) => (typeof val === 'string' ? fromBase64(val) : val),
171
- output: (val) => toBase64(val),
172
- }),
223
+ bytes: base64String,
173
224
  }),
174
225
  Object: ObjectArg,
175
226
  FundsWithdrawal: FundsWithdrawal,
@@ -224,37 +275,31 @@ export const Command = bcs.enum('Command', {
224
275
  objects: bcs.vector(Argument),
225
276
  address: Argument,
226
277
  }),
227
- // /**
228
- // * Split `amount` from a `coin`.
229
- // */
278
+ /**
279
+ * Split `amounts` from a `coin`.
280
+ */
230
281
  SplitCoins: bcs.struct('SplitCoins', {
231
282
  coin: Argument,
232
283
  amounts: bcs.vector(Argument),
233
284
  }),
234
- // /**
235
- // * Merge Vector of Coins (`sources`) into a `destination`.
236
- // */
285
+ /**
286
+ * Merge `sources` coins into a `destination` coin.
287
+ */
237
288
  MergeCoins: bcs.struct('MergeCoins', {
238
289
  destination: Argument,
239
290
  sources: bcs.vector(Argument),
240
291
  }),
241
- // /**
242
- // * Publish a Move module.
243
- // */
292
+ /**
293
+ * Publish a Move package.
294
+ */
244
295
  Publish: bcs.struct('Publish', {
245
- modules: bcs.vector(
246
- bcs.byteVector().transform({
247
- input: (val: string | Uint8Array) => (typeof val === 'string' ? fromBase64(val) : val),
248
- output: (val) => toBase64(val),
249
- }),
250
- ),
296
+ modules: bcs.vector(base64String),
251
297
  dependencies: bcs.vector(Address),
252
298
  }),
253
- // /**
254
- // * Build a vector of objects using the input arguments.
255
- // * It is impossible to export construct a `vector<T: key>` otherwise,
256
- // * so this call serves a utility function.
257
- // */
299
+ /**
300
+ * Build a vector from the input arguments. This is the only way to construct a
301
+ * `vector<T: key>` in a transaction.
302
+ */
258
303
  MakeMoveVec: bcs.struct('MakeMoveVec', {
259
304
  type: optionEnum(TypeTag).transform({
260
305
  input: (val: string | null) =>
@@ -269,13 +314,11 @@ export const Command = bcs.enum('Command', {
269
314
  }),
270
315
  elements: bcs.vector(Argument),
271
316
  }),
317
+ /**
318
+ * Upgrade a Move package.
319
+ */
272
320
  Upgrade: bcs.struct('Upgrade', {
273
- modules: bcs.vector(
274
- bcs.byteVector().transform({
275
- input: (val: string | Uint8Array) => (typeof val === 'string' ? fromBase64(val) : val),
276
- output: (val) => toBase64(val),
277
- }),
278
- ),
321
+ modules: bcs.vector(base64String),
279
322
  dependencies: bcs.vector(Address),
280
323
  package: Address,
281
324
  ticket: Argument,
@@ -416,19 +459,14 @@ export const MultiSigPkMap = bcs.struct('MultiSigPkMap', {
416
459
  });
417
460
 
418
461
  export const MultiSigPublicKey = bcs.struct('MultiSigPublicKey', {
419
- pk_map: bcs.vector(MultiSigPkMap),
462
+ pkMap: bcs.vector(MultiSigPkMap),
420
463
  threshold: bcs.u16(),
421
464
  });
422
465
 
423
466
  export const MultiSig = bcs.struct('MultiSig', {
424
467
  sigs: bcs.vector(CompressedSignature),
425
468
  bitmap: bcs.u16(),
426
- multisig_pk: MultiSigPublicKey,
427
- });
428
-
429
- export const base64String = bcs.byteVector().transform({
430
- input: (val: string | Uint8Array) => (typeof val === 'string' ? fromBase64(val) : val),
431
- output: (val) => toBase64(val),
469
+ multisigPk: MultiSigPublicKey,
432
470
  });
433
471
 
434
472
  export const PasskeyAuthenticator = bcs.struct('PasskeyAuthenticator', {
@@ -443,7 +481,8 @@ export const MoveObjectType = bcs.enum('MoveObjectType', {
443
481
  GasCoin: null,
444
482
  StakedSui: null,
445
483
  Coin: TypeTag,
446
- AccumulatorBalanceWrapper: null,
484
+ SuiBalanceAccumulatorField: null,
485
+ BalanceAccumulatorField: TypeTag,
447
486
  });
448
487
 
449
488
  // Rust: crates/sui-types/src/object.rs