@mysten/sui 2.39.1 → 3.0.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 (427) hide show
  1. package/CHANGELOG.md +160 -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 +4 -2
  28. package/dist/client/index.mjs +5 -2
  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 +12 -0
  64. package/dist/client/transaction-data.d.mts.map +1 -0
  65. package/dist/client/transaction-data.mjs +469 -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 +3 -1
  72. package/dist/client/utils.d.mts.map +1 -1
  73. package/dist/client/utils.mjs +91 -26
  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 +2 -2
  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 +293 -117
  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/rpc/v2/error_reason.d.mts +176 -1
  137. package/dist/grpc/proto/sui/rpc/v2/error_reason.d.mts.map +1 -1
  138. package/dist/grpc/proto/sui/rpc/v2/error_reason.mjs +175 -0
  139. package/dist/grpc/proto/sui/rpc/v2/error_reason.mjs.map +1 -1
  140. package/dist/grpc/proto/sui/rpc/v2/executed_transaction.d.mts +2 -2
  141. package/dist/grpc/proto/sui/rpc/v2/ledger_service.client.d.mts +4 -4
  142. package/dist/grpc/proto/sui/rpc/v2/ledger_service.d.mts +111 -0
  143. package/dist/grpc/proto/sui/rpc/v2/ledger_service.d.mts.map +1 -1
  144. package/dist/grpc/proto/sui/rpc/v2/ledger_service.mjs +46 -0
  145. package/dist/grpc/proto/sui/rpc/v2/ledger_service.mjs.map +1 -1
  146. package/dist/grpc/proto/sui/rpc/v2/move_package_service.client.d.mts +4 -4
  147. package/dist/grpc/proto/sui/rpc/v2/move_package_service.d.mts +24 -1
  148. package/dist/grpc/proto/sui/rpc/v2/move_package_service.d.mts.map +1 -1
  149. package/dist/grpc/proto/sui/rpc/v2/move_package_service.mjs +25 -7
  150. package/dist/grpc/proto/sui/rpc/v2/move_package_service.mjs.map +1 -1
  151. package/dist/grpc/proto/sui/rpc/v2/object.mjs +1 -1
  152. package/dist/grpc/proto/sui/rpc/v2/query_options.d.mts +111 -9
  153. package/dist/grpc/proto/sui/rpc/v2/query_options.d.mts.map +1 -1
  154. package/dist/grpc/proto/sui/rpc/v2/query_options.mjs +63 -19
  155. package/dist/grpc/proto/sui/rpc/v2/query_options.mjs.map +1 -1
  156. package/dist/grpc/proto/sui/rpc/v2/signature.d.mts +5 -5
  157. package/dist/grpc/proto/sui/rpc/v2/signature.mjs.map +1 -1
  158. package/dist/grpc/proto/sui/rpc/v2/signature_scheme.d.mts +5 -1
  159. package/dist/grpc/proto/sui/rpc/v2/signature_scheme.d.mts.map +1 -1
  160. package/dist/grpc/proto/sui/rpc/v2/signature_scheme.mjs +4 -0
  161. package/dist/grpc/proto/sui/rpc/v2/signature_scheme.mjs.map +1 -1
  162. package/dist/grpc/proto/sui/rpc/v2/signature_verification_service.client.d.mts +4 -4
  163. package/dist/grpc/proto/sui/rpc/v2/signature_verification_service.d.mts +20 -1
  164. package/dist/grpc/proto/sui/rpc/v2/signature_verification_service.d.mts.map +1 -1
  165. package/dist/grpc/proto/sui/rpc/v2/signature_verification_service.mjs +30 -13
  166. package/dist/grpc/proto/sui/rpc/v2/signature_verification_service.mjs.map +1 -1
  167. package/dist/grpc/proto/sui/rpc/v2/state_service.client.d.mts +4 -4
  168. package/dist/grpc/proto/sui/rpc/v2/subscription_service.client.d.mts +16 -10
  169. package/dist/grpc/proto/sui/rpc/v2/subscription_service.client.d.mts.map +1 -1
  170. package/dist/grpc/proto/sui/rpc/v2/subscription_service.client.mjs +8 -5
  171. package/dist/grpc/proto/sui/rpc/v2/subscription_service.client.mjs.map +1 -1
  172. package/dist/grpc/proto/sui/rpc/v2/transaction.d.mts +11 -5
  173. package/dist/grpc/proto/sui/rpc/v2/transaction.d.mts.map +1 -1
  174. package/dist/grpc/proto/sui/rpc/v2/transaction.mjs +6 -0
  175. package/dist/grpc/proto/sui/rpc/v2/transaction.mjs.map +1 -1
  176. package/dist/grpc/proto/sui/rpc/v2/transaction_execution_service.d.mts +6 -2
  177. package/dist/grpc/proto/sui/rpc/v2/transaction_execution_service.d.mts.map +1 -1
  178. package/dist/grpc/proto/sui/rpc/v2/transaction_execution_service.mjs.map +1 -1
  179. package/dist/grpc/proto/types.d.mts +7 -7
  180. package/dist/grpc/proto/types.mjs +3 -2
  181. package/dist/grpc/pull-call.d.mts +20 -0
  182. package/dist/grpc/pull-call.d.mts.map +1 -0
  183. package/dist/grpc/pull-call.mjs +28 -0
  184. package/dist/grpc/pull-call.mjs.map +1 -0
  185. package/dist/grpc/stream/call.mjs +238 -0
  186. package/dist/grpc/stream/call.mjs.map +1 -0
  187. package/dist/grpc/stream/families.d.mts +26 -0
  188. package/dist/grpc/stream/families.d.mts.map +1 -0
  189. package/dist/grpc/stream/families.mjs +145 -0
  190. package/dist/grpc/stream/families.mjs.map +1 -0
  191. package/dist/grpc/stream/index.d.mts +41 -0
  192. package/dist/grpc/stream/index.d.mts.map +1 -0
  193. package/dist/grpc/stream/index.mjs +127 -0
  194. package/dist/grpc/stream/index.mjs.map +1 -0
  195. package/dist/grpc/stream/live.mjs +31 -0
  196. package/dist/grpc/stream/live.mjs.map +1 -0
  197. package/dist/grpc/stream/page.mjs +120 -0
  198. package/dist/grpc/stream/page.mjs.map +1 -0
  199. package/dist/grpc/stream-types.d.mts +28 -0
  200. package/dist/grpc/stream-types.d.mts.map +1 -0
  201. package/dist/grpc/transport.d.mts +8 -3
  202. package/dist/grpc/transport.d.mts.map +1 -1
  203. package/dist/grpc/transport.mjs +88 -45
  204. package/dist/grpc/transport.mjs.map +1 -1
  205. package/dist/jsonRpc/index.d.mts +34 -12
  206. package/dist/jsonRpc/index.d.mts.map +1 -0
  207. package/dist/jsonRpc/index.mjs +39 -5
  208. package/dist/jsonRpc/index.mjs.map +1 -0
  209. package/dist/jsonRpc/types.d.mts +420 -0
  210. package/dist/jsonRpc/types.d.mts.map +1 -0
  211. package/dist/keypairs/passkey/keypair.d.mts +1 -1
  212. package/dist/multisig/publickey.d.mts +12 -4
  213. package/dist/multisig/publickey.d.mts.map +1 -1
  214. package/dist/multisig/publickey.mjs +5 -5
  215. package/dist/multisig/publickey.mjs.map +1 -1
  216. package/dist/multisig/signer.d.mts +1 -1
  217. package/dist/transactions/ObjectCache.d.mts +1 -1
  218. package/dist/transactions/ObjectCache.mjs +5 -5
  219. package/dist/transactions/ObjectCache.mjs.map +1 -1
  220. package/dist/transactions/Transaction.d.mts +11 -10
  221. package/dist/transactions/Transaction.d.mts.map +1 -1
  222. package/dist/transactions/Transaction.mjs +17 -6
  223. package/dist/transactions/Transaction.mjs.map +1 -1
  224. package/dist/transactions/data/internal.d.mts +135 -133
  225. package/dist/transactions/data/internal.d.mts.map +1 -1
  226. package/dist/transactions/data/internal.mjs +2 -1
  227. package/dist/transactions/data/internal.mjs.map +1 -1
  228. package/dist/transactions/data/v1.d.mts +239 -239
  229. package/dist/transactions/data/v1.d.mts.map +1 -1
  230. package/dist/transactions/data/v2.d.mts +16 -16
  231. package/dist/transactions/data/v2.d.mts.map +1 -1
  232. package/dist/transactions/executor/parallel.d.mts +2 -2
  233. package/dist/transactions/executor/serial.d.mts +1 -1
  234. package/dist/transactions/executor/serial.mjs +2 -2
  235. package/dist/transactions/executor/serial.mjs.map +1 -1
  236. package/dist/transactions/index.d.mts +3 -2
  237. package/dist/transactions/index.mjs +4 -3
  238. package/dist/transactions/intents/AllowanceBalance.mjs +1 -1
  239. package/dist/transactions/intents/CoinWithBalance.mjs +1 -1
  240. package/dist/transactions/resolve.d.mts +6 -0
  241. package/dist/transactions/resolve.d.mts.map +1 -1
  242. package/dist/transactions/resolve.mjs.map +1 -1
  243. package/dist/transactions/restricted-move-calls.d.mts +25 -0
  244. package/dist/transactions/restricted-move-calls.d.mts.map +1 -0
  245. package/dist/transactions/restricted-move-calls.mjs +47 -0
  246. package/dist/transactions/restricted-move-calls.mjs.map +1 -0
  247. package/dist/transactions/serializer.d.mts +1 -4
  248. package/dist/transactions/serializer.d.mts.map +1 -1
  249. package/dist/transactions/serializer.mjs +1 -44
  250. package/dist/transactions/serializer.mjs.map +1 -1
  251. package/dist/transactions/utils.d.mts +0 -1
  252. package/dist/transactions/utils.d.mts.map +1 -1
  253. package/dist/transactions/utils.mjs.map +1 -1
  254. package/dist/utils/abort.mjs +89 -0
  255. package/dist/utils/abort.mjs.map +1 -0
  256. package/dist/utils/coin-reservation.mjs +1 -4
  257. package/dist/utils/coin-reservation.mjs.map +1 -1
  258. package/dist/utils/index.mjs +1 -1
  259. package/dist/utils/sui-types.mjs +1 -1
  260. package/dist/verify/index.d.mts +2 -2
  261. package/dist/verify/verify.d.mts +74 -24
  262. package/dist/verify/verify.d.mts.map +1 -1
  263. package/dist/verify/verify.mjs +128 -42
  264. package/dist/verify/verify.mjs.map +1 -1
  265. package/dist/version.mjs +1 -1
  266. package/dist/version.mjs.map +1 -1
  267. package/dist/zklogin/bcs.d.mts +14 -14
  268. package/dist/zklogin/publickey.d.mts.map +1 -1
  269. package/dist/zklogin/publickey.mjs +15 -20
  270. package/dist/zklogin/publickey.mjs.map +1 -1
  271. package/docs/bcs.md +2 -2
  272. package/docs/clients/core.md +19 -18
  273. package/docs/clients/executing.md +53 -8
  274. package/docs/clients/graphql.md +81 -11
  275. package/docs/clients/grpc.md +31 -15
  276. package/docs/clients/index.md +8 -7
  277. package/docs/clients/querying.md +134 -30
  278. package/docs/clients/streaming.md +324 -0
  279. package/docs/cryptography/index.md +85 -58
  280. package/docs/llms-index.md +4 -2
  281. package/docs/migrations/sui-2.0/dapp-kit.md +3 -2
  282. package/docs/migrations/sui-2.0/json-rpc-migration.md +106 -79
  283. package/docs/migrations/sui-3.0/index.md +250 -0
  284. package/docs/plugins.md +10 -10
  285. package/docs/sdk-building.md +3 -4
  286. package/docs/transactions/coins-and-balances.md +6 -11
  287. package/docs/transactions/reference.md +36 -1
  288. package/package.json +2 -3
  289. package/src/bcs/bcs.ts +80 -41
  290. package/src/bcs/effects.ts +61 -25
  291. package/src/bcs/index.ts +2 -0
  292. package/src/bcs/transactions.ts +36 -17
  293. package/src/bcs/types.ts +10 -4
  294. package/src/client/core-resolver.ts +3 -5
  295. package/src/client/core.ts +180 -8
  296. package/src/client/errors.ts +12 -0
  297. package/src/client/index.ts +4 -1
  298. package/src/client/mvr.ts +37 -10
  299. package/src/client/query-filters.ts +151 -97
  300. package/src/client/stream/adapter.ts +110 -0
  301. package/src/client/stream/errors.ts +40 -0
  302. package/src/client/stream/filter.ts +17 -0
  303. package/src/client/stream/follow.ts +63 -0
  304. package/src/client/stream/index.ts +9 -0
  305. package/src/client/stream/pager.ts +158 -0
  306. package/src/client/stream/plan.ts +147 -0
  307. package/src/client/stream/position.ts +143 -0
  308. package/src/client/stream/run.ts +147 -0
  309. package/src/client/stream/session.ts +259 -0
  310. package/src/client/stream/status.ts +44 -0
  311. package/src/client/stream/token.ts +104 -0
  312. package/src/client/transaction-data.ts +587 -0
  313. package/src/client/transaction-resolver.ts +158 -69
  314. package/src/client/types.ts +530 -115
  315. package/src/client/utils.ts +147 -50
  316. package/src/cryptography/publickey.ts +12 -1
  317. package/src/cryptography/signature.ts +6 -3
  318. package/src/graphql/client.ts +204 -135
  319. package/src/graphql/core.ts +446 -139
  320. package/src/graphql/errors.ts +24 -0
  321. package/src/graphql/filters.ts +48 -0
  322. package/src/graphql/generated/queries.ts +1455 -277
  323. package/src/graphql/generated/schema.graphql +282 -9
  324. package/src/graphql/generated/tada-env.ts +933 -4
  325. package/src/graphql/queries/checkpoints.graphql +34 -0
  326. package/src/graphql/queries/getDynamicFields.graphql +1 -0
  327. package/src/graphql/queries/listEvents.graphql +16 -24
  328. package/src/graphql/queries/streams.graphql +212 -0
  329. package/src/graphql/queries/transactions.graphql +71 -28
  330. package/src/graphql/queries/verifySignature.graphql +17 -0
  331. package/src/graphql/sse-parser.ts +99 -0
  332. package/src/graphql/stream/families.ts +515 -0
  333. package/src/graphql/stream/index.ts +55 -0
  334. package/src/graphql/stream/live.ts +70 -0
  335. package/src/graphql/stream/page.ts +47 -0
  336. package/src/graphql/stream/query.ts +52 -0
  337. package/src/graphql/subscribe.ts +83 -0
  338. package/src/grpc/client.ts +81 -79
  339. package/src/grpc/core.ts +388 -274
  340. package/src/grpc/filters.ts +59 -60
  341. package/src/grpc/grpc-web-pull.ts +360 -0
  342. package/src/grpc/index.ts +5 -0
  343. package/src/grpc/network-error.ts +33 -0
  344. package/src/grpc/proto/sui/rpc/v2/error_reason.ts +175 -0
  345. package/src/grpc/proto/sui/rpc/v2/ledger_service.ts +145 -0
  346. package/src/grpc/proto/sui/rpc/v2/move_package_service.ts +43 -1
  347. package/src/grpc/proto/sui/rpc/v2/query_options.ts +132 -8
  348. package/src/grpc/proto/sui/rpc/v2/signature.ts +4 -4
  349. package/src/grpc/proto/sui/rpc/v2/signature_scheme.ts +4 -0
  350. package/src/grpc/proto/sui/rpc/v2/signature_verification_service.ts +30 -0
  351. package/src/grpc/proto/sui/rpc/v2/subscription_service.client.ts +16 -10
  352. package/src/grpc/proto/sui/rpc/v2/transaction.ts +6 -0
  353. package/src/grpc/proto/sui/rpc/v2/transaction_execution_service.ts +5 -1
  354. package/src/grpc/pull-call.ts +54 -0
  355. package/src/grpc/stream/call.ts +317 -0
  356. package/src/grpc/stream/families.ts +228 -0
  357. package/src/grpc/stream/index.ts +182 -0
  358. package/src/grpc/stream/live.ts +33 -0
  359. package/src/grpc/stream/page.ts +161 -0
  360. package/src/grpc/stream-types.ts +33 -0
  361. package/src/grpc/transport.ts +116 -59
  362. package/src/jsonRpc/index.ts +60 -17
  363. package/src/jsonRpc/types.ts +421 -0
  364. package/src/multisig/publickey.ts +19 -7
  365. package/src/transactions/ObjectCache.ts +6 -6
  366. package/src/transactions/Transaction.ts +30 -6
  367. package/src/transactions/data/internal.ts +2 -0
  368. package/src/transactions/executor/serial.ts +2 -2
  369. package/src/transactions/index.ts +8 -1
  370. package/src/transactions/resolve.ts +6 -0
  371. package/src/transactions/restricted-move-calls.ts +87 -0
  372. package/src/transactions/serializer.ts +0 -70
  373. package/src/transactions/utils.ts +0 -37
  374. package/src/utils/abort.ts +101 -0
  375. package/src/verify/index.ts +1 -0
  376. package/src/verify/verify.ts +190 -62
  377. package/src/version.ts +1 -1
  378. package/src/zklogin/publickey.ts +18 -34
  379. package/dist/client/core-resolver.d.mts +0 -9
  380. package/dist/client/core-resolver.d.mts.map +0 -1
  381. package/dist/jsonRpc/client.d.mts +0 -507
  382. package/dist/jsonRpc/client.d.mts.map +0 -1
  383. package/dist/jsonRpc/client.mjs +0 -868
  384. package/dist/jsonRpc/client.mjs.map +0 -1
  385. package/dist/jsonRpc/core.d.mts +0 -168
  386. package/dist/jsonRpc/core.d.mts.map +0 -1
  387. package/dist/jsonRpc/core.mjs +0 -1054
  388. package/dist/jsonRpc/core.mjs.map +0 -1
  389. package/dist/jsonRpc/errors.d.mts +0 -27
  390. package/dist/jsonRpc/errors.d.mts.map +0 -1
  391. package/dist/jsonRpc/errors.mjs +0 -50
  392. package/dist/jsonRpc/errors.mjs.map +0 -1
  393. package/dist/jsonRpc/http-transport.d.mts +0 -62
  394. package/dist/jsonRpc/http-transport.d.mts.map +0 -1
  395. package/dist/jsonRpc/http-transport.mjs +0 -60
  396. package/dist/jsonRpc/http-transport.mjs.map +0 -1
  397. package/dist/jsonRpc/network.d.mts +0 -9
  398. package/dist/jsonRpc/network.d.mts.map +0 -1
  399. package/dist/jsonRpc/network.mjs +0 -18
  400. package/dist/jsonRpc/network.mjs.map +0 -1
  401. package/dist/jsonRpc/types/chain.d.mts +0 -169
  402. package/dist/jsonRpc/types/chain.d.mts.map +0 -1
  403. package/dist/jsonRpc/types/changes.d.mts +0 -48
  404. package/dist/jsonRpc/types/changes.d.mts.map +0 -1
  405. package/dist/jsonRpc/types/coins.d.mts +0 -15
  406. package/dist/jsonRpc/types/coins.d.mts.map +0 -1
  407. package/dist/jsonRpc/types/common.d.mts +0 -9
  408. package/dist/jsonRpc/types/common.d.mts.map +0 -1
  409. package/dist/jsonRpc/types/generated.d.mts +0 -1976
  410. package/dist/jsonRpc/types/generated.d.mts.map +0 -1
  411. package/dist/jsonRpc/types/index.d.mts +0 -6
  412. package/dist/jsonRpc/types/params.d.mts +0 -898
  413. package/dist/jsonRpc/types/params.d.mts.map +0 -1
  414. package/src/graphql/generated/tsconfig.tada.json +0 -11
  415. package/src/graphql/queries/verifyZkLoginSignature.graphql +0 -15
  416. package/src/jsonRpc/client.ts +0 -1252
  417. package/src/jsonRpc/core.ts +0 -1557
  418. package/src/jsonRpc/errors.ts +0 -57
  419. package/src/jsonRpc/http-transport.ts +0 -118
  420. package/src/jsonRpc/network.ts +0 -21
  421. package/src/jsonRpc/types/chain.ts +0 -190
  422. package/src/jsonRpc/types/changes.ts +0 -35
  423. package/src/jsonRpc/types/coins.ts +0 -14
  424. package/src/jsonRpc/types/common.ts +0 -8
  425. package/src/jsonRpc/types/generated.ts +0 -2165
  426. package/src/jsonRpc/types/index.ts +0 -9
  427. package/src/jsonRpc/types/params.ts +0 -908
@@ -1,1252 +0,0 @@
1
- // Copyright (c) Mysten Labs, Inc.
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { fromBase58, toBase64, toHex } from '@mysten/bcs';
4
-
5
- import type { Signer } from '../cryptography/index.js';
6
- import { BaseClient } from '../client/client.js';
7
- import type { SuiClientTypes } from '../client/types.js';
8
- import { isCoinReservationDigest } from '../utils/coin-reservation.js';
9
- import type { Transaction } from '../transactions/Transaction.js';
10
- import { isTransaction } from '../transactions/Transaction.js';
11
- import {
12
- isValidSuiAddress,
13
- isValidSuiObjectId,
14
- isValidTransactionDigest,
15
- normalizeSuiAddress,
16
- normalizeSuiObjectId,
17
- } from '../utils/sui-types.js';
18
- import { normalizeSuiNSName } from '../utils/suins.js';
19
- import { JsonRpcHTTPTransport } from './http-transport.js';
20
- import type { JsonRpcTransport } from './http-transport.js';
21
- import type {
22
- AddressMetrics,
23
- AllEpochsAddressMetrics,
24
- Checkpoint,
25
- CheckpointPage,
26
- CoinBalance,
27
- CoinMetadata,
28
- CoinSupply,
29
- CommitteeInfo,
30
- DelegatedStake,
31
- DevInspectResults,
32
- DevInspectTransactionBlockParams,
33
- DryRunTransactionBlockParams,
34
- DryRunTransactionBlockResponse,
35
- DynamicFieldPage,
36
- EpochInfo,
37
- EpochMetricsPage,
38
- EpochPage,
39
- ExecuteTransactionBlockParams,
40
- GetAllBalancesParams,
41
- GetAllCoinsParams,
42
- GetBalanceParams,
43
- GetCheckpointParams,
44
- GetCheckpointsParams,
45
- GetCoinMetadataParams,
46
- GetCoinsParams,
47
- GetCommitteeInfoParams,
48
- GetDynamicFieldObjectParams,
49
- GetDynamicFieldsParams,
50
- GetLatestCheckpointSequenceNumberParams,
51
- GetLatestSuiSystemStateParams,
52
- GetMoveFunctionArgTypesParams,
53
- GetNormalizedMoveFunctionParams,
54
- GetNormalizedMoveModuleParams,
55
- GetNormalizedMoveModulesByPackageParams,
56
- GetNormalizedMoveStructParams,
57
- GetObjectParams,
58
- GetOwnedObjectsParams,
59
- GetProtocolConfigParams,
60
- GetReferenceGasPriceParams,
61
- GetStakesByIdsParams,
62
- GetStakesParams,
63
- GetTotalSupplyParams,
64
- GetTransactionBlockParams,
65
- MoveCallMetrics,
66
- MultiGetObjectsParams,
67
- MultiGetTransactionBlocksParams,
68
- NetworkMetrics,
69
- ObjectRead,
70
- Order,
71
- PaginatedCoins,
72
- PaginatedEvents,
73
- PaginatedObjectsResponse,
74
- PaginatedTransactionResponse,
75
- ProtocolConfig,
76
- QueryEventsParams,
77
- QueryTransactionBlocksParams,
78
- ResolvedNameServiceNames,
79
- ResolveNameServiceAddressParams,
80
- ResolveNameServiceNamesParams,
81
- SuiMoveFunctionArgType,
82
- SuiMoveNormalizedFunction,
83
- SuiMoveNormalizedModule,
84
- SuiMoveNormalizedModules,
85
- SuiMoveNormalizedStruct,
86
- SuiObjectResponse,
87
- SuiObjectResponseQuery,
88
- SuiSystemStateSummary,
89
- SuiTransactionBlockResponse,
90
- SuiTransactionBlockResponseQuery,
91
- TryGetPastObjectParams,
92
- ValidatorsApy,
93
- VerifyZkLoginSignatureParams,
94
- ZkLoginVerifyResult,
95
- } from './types/index.js';
96
- import { isValidNamedPackage } from '../utils/move-registry.js';
97
- import { hasMvrName } from '../client/mvr.js';
98
- import { JSONRpcCoreClient } from './core.js';
99
-
100
- /**
101
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
102
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
103
- */
104
- export interface PaginationArguments<Cursor> {
105
- /** Optional paging cursor */
106
- cursor?: Cursor;
107
- /** Maximum item returned per page */
108
- limit?: number | null;
109
- }
110
-
111
- /**
112
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
113
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
114
- */
115
- export interface OrderArguments {
116
- order?: Order | null;
117
- }
118
-
119
- /**
120
- * Configuration options for the SuiJsonRpcClient
121
- * You must provide either a `url` or a `transport`
122
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
123
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
124
- */
125
- export type SuiJsonRpcClientOptions = NetworkOrTransport & {
126
- network: SuiClientTypes.Network;
127
- mvr?: SuiClientTypes.MvrOptions;
128
- };
129
-
130
- type NetworkOrTransport =
131
- | {
132
- url: string;
133
- transport?: never;
134
- }
135
- | {
136
- transport: JsonRpcTransport;
137
- url?: never;
138
- };
139
-
140
- const SUI_CLIENT_BRAND = Symbol.for('@mysten/SuiJsonRpcClient') as never;
141
-
142
- /**
143
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
144
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
145
- */
146
- export function isSuiJsonRpcClient(client: unknown): client is SuiJsonRpcClient {
147
- return (
148
- typeof client === 'object' && client !== null && (client as any)[SUI_CLIENT_BRAND] === true
149
- );
150
- }
151
-
152
- /**
153
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
154
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
155
- */
156
- export class SuiJsonRpcClient extends BaseClient {
157
- /**
158
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
159
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
160
- */
161
- core: JSONRpcCoreClient;
162
- /**
163
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
164
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
165
- */
166
- jsonRpc = this;
167
- protected transport: JsonRpcTransport;
168
-
169
- get [SUI_CLIENT_BRAND]() {
170
- return true;
171
- }
172
-
173
- /**
174
- * Establish a connection to a Sui RPC endpoint
175
- *
176
- * @param options configuration options for the API Client
177
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
178
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
179
- */
180
- constructor(options: SuiJsonRpcClientOptions) {
181
- super({ network: options.network });
182
- this.transport = options.transport ?? new JsonRpcHTTPTransport({ url: options.url });
183
- this.core = new JSONRpcCoreClient({
184
- jsonRpcClient: this,
185
- mvr: options.mvr,
186
- });
187
- }
188
-
189
- /**
190
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
191
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
192
- */
193
- async getRpcApiVersion({ signal }: { signal?: AbortSignal } = {}): Promise<string | undefined> {
194
- const resp = await this.transport.request<{ info: { version: string } }>({
195
- method: 'rpc.discover',
196
- params: [],
197
- signal,
198
- });
199
-
200
- return resp.info.version;
201
- }
202
-
203
- /**
204
- * Get all Coin<`coin_type`> objects owned by an address.
205
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
206
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
207
- */
208
- async getCoins({
209
- coinType,
210
- owner,
211
- cursor,
212
- limit,
213
- signal,
214
- }: GetCoinsParams): Promise<PaginatedCoins> {
215
- if (!owner || !isValidSuiAddress(normalizeSuiAddress(owner))) {
216
- throw new Error('Invalid Sui address');
217
- }
218
-
219
- if (coinType && hasMvrName(coinType)) {
220
- coinType = (
221
- await this.core.mvr.resolveType({
222
- type: coinType,
223
- signal,
224
- })
225
- ).type;
226
- }
227
-
228
- const result: PaginatedCoins = await this.transport.request({
229
- method: 'suix_getCoins',
230
- params: [owner, coinType, cursor, limit],
231
- signal: signal,
232
- });
233
-
234
- return {
235
- ...result,
236
- data: result.data.filter((coin) => !isCoinReservationDigest(coin.digest)),
237
- };
238
- }
239
-
240
- /**
241
- * Get all Coin objects owned by an address.
242
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
243
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
244
- */
245
- async getAllCoins(input: GetAllCoinsParams): Promise<PaginatedCoins> {
246
- if (!input.owner || !isValidSuiAddress(normalizeSuiAddress(input.owner))) {
247
- throw new Error('Invalid Sui address');
248
- }
249
-
250
- const result: PaginatedCoins = await this.transport.request({
251
- method: 'suix_getAllCoins',
252
- params: [input.owner, input.cursor, input.limit],
253
- signal: input.signal,
254
- });
255
-
256
- return {
257
- ...result,
258
- data: result.data.filter((coin) => !isCoinReservationDigest(coin.digest)),
259
- };
260
- }
261
-
262
- /**
263
- * Get the total coin balance for one coin type, owned by the address owner.
264
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
265
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
266
- */
267
- async getBalance({ owner, coinType, signal }: GetBalanceParams): Promise<CoinBalance> {
268
- if (!owner || !isValidSuiAddress(normalizeSuiAddress(owner))) {
269
- throw new Error('Invalid Sui address');
270
- }
271
-
272
- if (coinType && hasMvrName(coinType)) {
273
- coinType = (
274
- await this.core.mvr.resolveType({
275
- type: coinType,
276
- signal,
277
- })
278
- ).type;
279
- }
280
-
281
- return await this.transport.request({
282
- method: 'suix_getBalance',
283
- params: [owner, coinType],
284
- signal: signal,
285
- });
286
- }
287
-
288
- /**
289
- * Get the total coin balance for all coin types, owned by the address owner.
290
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
291
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
292
- */
293
- async getAllBalances(input: GetAllBalancesParams): Promise<CoinBalance[]> {
294
- if (!input.owner || !isValidSuiAddress(normalizeSuiAddress(input.owner))) {
295
- throw new Error('Invalid Sui address');
296
- }
297
- return await this.transport.request({
298
- method: 'suix_getAllBalances',
299
- params: [input.owner],
300
- signal: input.signal,
301
- });
302
- }
303
-
304
- /**
305
- * Fetch CoinMetadata for a given coin type
306
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
307
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
308
- */
309
- async getCoinMetadata({ coinType, signal }: GetCoinMetadataParams): Promise<CoinMetadata | null> {
310
- if (coinType && hasMvrName(coinType)) {
311
- coinType = (
312
- await this.core.mvr.resolveType({
313
- type: coinType,
314
- signal,
315
- })
316
- ).type;
317
- }
318
-
319
- return await this.transport.request({
320
- method: 'suix_getCoinMetadata',
321
- params: [coinType],
322
- signal: signal,
323
- });
324
- }
325
-
326
- /**
327
- * Fetch total supply for a coin
328
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
329
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
330
- */
331
- async getTotalSupply({ coinType, signal }: GetTotalSupplyParams): Promise<CoinSupply> {
332
- if (coinType && hasMvrName(coinType)) {
333
- coinType = (
334
- await this.core.mvr.resolveType({
335
- type: coinType,
336
- signal,
337
- })
338
- ).type;
339
- }
340
-
341
- return await this.transport.request({
342
- method: 'suix_getTotalSupply',
343
- params: [coinType],
344
- signal: signal,
345
- });
346
- }
347
-
348
- /**
349
- * Invoke any RPC method
350
- * @param method the method to be invoked
351
- * @param args the arguments to be passed to the RPC request
352
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
353
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
354
- */
355
- async call<T = unknown>(
356
- method: string,
357
- params: unknown[],
358
- { signal }: { signal?: AbortSignal } = {},
359
- ): Promise<T> {
360
- return await this.transport.request({ method, params, signal });
361
- }
362
-
363
- /**
364
- * Get Move function argument types like read, write and full access
365
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
366
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
367
- */
368
- async getMoveFunctionArgTypes({
369
- package: pkg,
370
- module,
371
- function: fn,
372
- signal,
373
- }: GetMoveFunctionArgTypesParams): Promise<SuiMoveFunctionArgType[]> {
374
- if (pkg && isValidNamedPackage(pkg)) {
375
- pkg = (
376
- await this.core.mvr.resolvePackage({
377
- package: pkg,
378
- signal,
379
- })
380
- ).package;
381
- }
382
-
383
- return await this.transport.request({
384
- method: 'sui_getMoveFunctionArgTypes',
385
- params: [pkg, module, fn],
386
- signal: signal,
387
- });
388
- }
389
-
390
- /**
391
- * Get a map from module name to
392
- * structured representations of Move modules
393
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
394
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
395
- */
396
- async getNormalizedMoveModulesByPackage({
397
- package: pkg,
398
- signal,
399
- }: GetNormalizedMoveModulesByPackageParams): Promise<SuiMoveNormalizedModules> {
400
- if (pkg && isValidNamedPackage(pkg)) {
401
- pkg = (
402
- await this.core.mvr.resolvePackage({
403
- package: pkg,
404
- signal,
405
- })
406
- ).package;
407
- }
408
-
409
- return await this.transport.request({
410
- method: 'sui_getNormalizedMoveModulesByPackage',
411
- params: [pkg],
412
- signal: signal,
413
- });
414
- }
415
-
416
- /**
417
- * Get a structured representation of Move module
418
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
419
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
420
- */
421
- async getNormalizedMoveModule({
422
- package: pkg,
423
- module,
424
- signal,
425
- }: GetNormalizedMoveModuleParams): Promise<SuiMoveNormalizedModule> {
426
- if (pkg && isValidNamedPackage(pkg)) {
427
- pkg = (
428
- await this.core.mvr.resolvePackage({
429
- package: pkg,
430
- signal,
431
- })
432
- ).package;
433
- }
434
-
435
- return await this.transport.request({
436
- method: 'sui_getNormalizedMoveModule',
437
- params: [pkg, module],
438
- signal: signal,
439
- });
440
- }
441
-
442
- /**
443
- * Get a structured representation of Move function
444
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
445
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
446
- */
447
- async getNormalizedMoveFunction({
448
- package: pkg,
449
- module,
450
- function: fn,
451
- signal,
452
- }: GetNormalizedMoveFunctionParams): Promise<SuiMoveNormalizedFunction> {
453
- if (pkg && isValidNamedPackage(pkg)) {
454
- pkg = (
455
- await this.core.mvr.resolvePackage({
456
- package: pkg,
457
- signal,
458
- })
459
- ).package;
460
- }
461
-
462
- return await this.transport.request({
463
- method: 'sui_getNormalizedMoveFunction',
464
- params: [pkg, module, fn],
465
- signal: signal,
466
- });
467
- }
468
-
469
- /**
470
- * Get a structured representation of Move struct
471
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
472
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
473
- */
474
- async getNormalizedMoveStruct({
475
- package: pkg,
476
- module,
477
- struct,
478
- signal,
479
- }: GetNormalizedMoveStructParams): Promise<SuiMoveNormalizedStruct> {
480
- if (pkg && isValidNamedPackage(pkg)) {
481
- pkg = (
482
- await this.core.mvr.resolvePackage({
483
- package: pkg,
484
- signal,
485
- })
486
- ).package;
487
- }
488
-
489
- return await this.transport.request({
490
- method: 'sui_getNormalizedMoveStruct',
491
- params: [pkg, module, struct],
492
- signal: signal,
493
- });
494
- }
495
-
496
- /**
497
- * Get all objects owned by an address
498
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
499
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
500
- */
501
- async getOwnedObjects(input: GetOwnedObjectsParams): Promise<PaginatedObjectsResponse> {
502
- if (!input.owner || !isValidSuiAddress(normalizeSuiAddress(input.owner))) {
503
- throw new Error('Invalid Sui address');
504
- }
505
-
506
- const filter = input.filter
507
- ? {
508
- ...input.filter,
509
- }
510
- : undefined;
511
-
512
- if (filter && 'MoveModule' in filter && isValidNamedPackage(filter.MoveModule.package)) {
513
- filter.MoveModule = {
514
- module: filter.MoveModule.module,
515
- package: (
516
- await this.core.mvr.resolvePackage({
517
- package: filter.MoveModule.package,
518
- signal: input.signal,
519
- })
520
- ).package,
521
- };
522
- } else if (filter && 'StructType' in filter && hasMvrName(filter.StructType)) {
523
- filter.StructType = (
524
- await this.core.mvr.resolveType({
525
- type: filter.StructType,
526
- signal: input.signal,
527
- })
528
- ).type;
529
- }
530
-
531
- return await this.transport.request({
532
- method: 'suix_getOwnedObjects',
533
- params: [
534
- input.owner,
535
- {
536
- filter,
537
- options: input.options,
538
- } as SuiObjectResponseQuery,
539
- input.cursor,
540
- input.limit,
541
- ],
542
- signal: input.signal,
543
- });
544
- }
545
-
546
- /**
547
- * Get details about an object
548
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
549
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
550
- */
551
- async getObject(input: GetObjectParams): Promise<SuiObjectResponse> {
552
- if (!input.id || !isValidSuiObjectId(normalizeSuiObjectId(input.id))) {
553
- throw new Error('Invalid Sui Object id');
554
- }
555
- return await this.transport.request({
556
- method: 'sui_getObject',
557
- params: [input.id, input.options],
558
- signal: input.signal,
559
- });
560
- }
561
-
562
- /**
563
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
564
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
565
- */
566
- async tryGetPastObject(input: TryGetPastObjectParams): Promise<ObjectRead> {
567
- return await this.transport.request({
568
- method: 'sui_tryGetPastObject',
569
- params: [input.id, input.version, input.options],
570
- signal: input.signal,
571
- });
572
- }
573
-
574
- /**
575
- * Batch get details about a list of objects. If any of the object ids are duplicates the call will fail
576
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
577
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
578
- */
579
- async multiGetObjects(input: MultiGetObjectsParams): Promise<SuiObjectResponse[]> {
580
- input.ids.forEach((id) => {
581
- if (!id || !isValidSuiObjectId(normalizeSuiObjectId(id))) {
582
- throw new Error(`Invalid Sui Object id ${id}`);
583
- }
584
- });
585
- const hasDuplicates = input.ids.length !== new Set(input.ids).size;
586
- if (hasDuplicates) {
587
- throw new Error(`Duplicate object ids in batch call ${input.ids}`);
588
- }
589
-
590
- return await this.transport.request({
591
- method: 'sui_multiGetObjects',
592
- params: [input.ids, input.options],
593
- signal: input.signal,
594
- });
595
- }
596
-
597
- /**
598
- * Get transaction blocks for a given query criteria
599
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
600
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
601
- */
602
- async queryTransactionBlocks({
603
- filter,
604
- options,
605
- cursor,
606
- limit,
607
- order,
608
- signal,
609
- }: QueryTransactionBlocksParams): Promise<PaginatedTransactionResponse> {
610
- if (filter && 'MoveFunction' in filter && isValidNamedPackage(filter.MoveFunction.package)) {
611
- filter = {
612
- ...filter,
613
- MoveFunction: {
614
- package: (
615
- await this.core.mvr.resolvePackage({
616
- package: filter.MoveFunction.package,
617
- signal,
618
- })
619
- ).package,
620
- },
621
- };
622
- }
623
-
624
- return await this.transport.request({
625
- method: 'suix_queryTransactionBlocks',
626
- params: [
627
- {
628
- filter,
629
- options,
630
- } as SuiTransactionBlockResponseQuery,
631
- cursor,
632
- limit,
633
- (order || 'descending') === 'descending',
634
- ],
635
- signal,
636
- });
637
- }
638
-
639
- /**
640
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
641
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
642
- */
643
- async getTransactionBlock(
644
- input: GetTransactionBlockParams,
645
- ): Promise<SuiTransactionBlockResponse> {
646
- if (!isValidTransactionDigest(input.digest)) {
647
- throw new Error('Invalid Transaction digest');
648
- }
649
- return await this.transport.request({
650
- method: 'sui_getTransactionBlock',
651
- params: [input.digest, input.options],
652
- signal: input.signal,
653
- });
654
- }
655
-
656
- /**
657
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
658
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
659
- */
660
- async multiGetTransactionBlocks(
661
- input: MultiGetTransactionBlocksParams,
662
- ): Promise<SuiTransactionBlockResponse[]> {
663
- input.digests.forEach((d) => {
664
- if (!isValidTransactionDigest(d)) {
665
- throw new Error(`Invalid Transaction digest ${d}`);
666
- }
667
- });
668
-
669
- const hasDuplicates = input.digests.length !== new Set(input.digests).size;
670
- if (hasDuplicates) {
671
- throw new Error(`Duplicate digests in batch call ${input.digests}`);
672
- }
673
-
674
- return await this.transport.request({
675
- method: 'sui_multiGetTransactionBlocks',
676
- params: [input.digests, input.options],
677
- signal: input.signal,
678
- });
679
- }
680
-
681
- /**
682
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
683
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
684
- */
685
- async executeTransactionBlock({
686
- transactionBlock,
687
- signature,
688
- options,
689
- signal,
690
- }: ExecuteTransactionBlockParams): Promise<SuiTransactionBlockResponse> {
691
- const result: SuiTransactionBlockResponse = await this.transport.request({
692
- method: 'sui_executeTransactionBlock',
693
- params: [
694
- typeof transactionBlock === 'string' ? transactionBlock : toBase64(transactionBlock),
695
- Array.isArray(signature) ? signature : [signature],
696
- options,
697
- ],
698
- signal,
699
- });
700
-
701
- return result;
702
- }
703
-
704
- /**
705
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
706
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
707
- */
708
- async signAndExecuteTransaction({
709
- transaction,
710
- signer,
711
- ...input
712
- }: {
713
- transaction: Uint8Array | Transaction;
714
- signer: Signer;
715
- } & Omit<
716
- ExecuteTransactionBlockParams,
717
- 'transactionBlock' | 'signature'
718
- >): Promise<SuiTransactionBlockResponse> {
719
- let transactionBytes;
720
-
721
- if (transaction instanceof Uint8Array) {
722
- transactionBytes = transaction;
723
- } else {
724
- transaction.setSenderIfNotSet(signer.toSuiAddress());
725
- transactionBytes = await transaction.build({ client: this });
726
- }
727
-
728
- const { signature, bytes } = await signer.signTransaction(transactionBytes);
729
-
730
- return this.executeTransactionBlock({
731
- transactionBlock: bytes,
732
- signature,
733
- ...input,
734
- });
735
- }
736
-
737
- /**
738
- * Get total number of transactions
739
- */
740
-
741
- /**
742
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
743
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
744
- */
745
- async getTotalTransactionBlocks({ signal }: { signal?: AbortSignal } = {}): Promise<bigint> {
746
- const resp = await this.transport.request<string>({
747
- method: 'sui_getTotalTransactionBlocks',
748
- params: [],
749
- signal,
750
- });
751
- return BigInt(resp);
752
- }
753
-
754
- /**
755
- * Getting the reference gas price for the network
756
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
757
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
758
- */
759
- async getReferenceGasPrice({ signal }: GetReferenceGasPriceParams = {}): Promise<bigint> {
760
- const resp = await this.transport.request<string>({
761
- method: 'suix_getReferenceGasPrice',
762
- params: [],
763
- signal,
764
- });
765
- return BigInt(resp);
766
- }
767
-
768
- /**
769
- * Return the delegated stakes for an address
770
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
771
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
772
- */
773
- async getStakes(input: GetStakesParams): Promise<DelegatedStake[]> {
774
- if (!input.owner || !isValidSuiAddress(normalizeSuiAddress(input.owner))) {
775
- throw new Error('Invalid Sui address');
776
- }
777
- return await this.transport.request({
778
- method: 'suix_getStakes',
779
- params: [input.owner],
780
- signal: input.signal,
781
- });
782
- }
783
-
784
- /**
785
- * Return the delegated stakes queried by id.
786
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
787
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
788
- */
789
- async getStakesByIds(input: GetStakesByIdsParams): Promise<DelegatedStake[]> {
790
- input.stakedSuiIds.forEach((id) => {
791
- if (!id || !isValidSuiObjectId(normalizeSuiObjectId(id))) {
792
- throw new Error(`Invalid Sui Stake id ${id}`);
793
- }
794
- });
795
- return await this.transport.request({
796
- method: 'suix_getStakesByIds',
797
- params: [input.stakedSuiIds],
798
- signal: input.signal,
799
- });
800
- }
801
-
802
- /**
803
- * Return the latest system state content.
804
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
805
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
806
- */
807
- async getLatestSuiSystemState({
808
- signal,
809
- }: GetLatestSuiSystemStateParams = {}): Promise<SuiSystemStateSummary> {
810
- return await this.transport.request({
811
- method: 'suix_getLatestSuiSystemState',
812
- params: [],
813
- signal,
814
- });
815
- }
816
-
817
- /**
818
- * Get events for a given query criteria
819
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
820
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
821
- */
822
- async queryEvents({
823
- query,
824
- cursor,
825
- limit,
826
- order,
827
- signal,
828
- }: QueryEventsParams): Promise<PaginatedEvents> {
829
- if (query && 'MoveEventType' in query && hasMvrName(query.MoveEventType)) {
830
- query = {
831
- ...query,
832
- MoveEventType: (
833
- await this.core.mvr.resolveType({
834
- type: query.MoveEventType,
835
- signal,
836
- })
837
- ).type,
838
- };
839
- }
840
-
841
- if (query && 'MoveEventModule' in query && isValidNamedPackage(query.MoveEventModule.package)) {
842
- query = {
843
- ...query,
844
- MoveEventModule: {
845
- module: query.MoveEventModule.module,
846
- package: (
847
- await this.core.mvr.resolvePackage({
848
- package: query.MoveEventModule.package,
849
- signal,
850
- })
851
- ).package,
852
- },
853
- };
854
- }
855
-
856
- if ('MoveModule' in query && isValidNamedPackage(query.MoveModule.package)) {
857
- query = {
858
- ...query,
859
- MoveModule: {
860
- module: query.MoveModule.module,
861
- package: (
862
- await this.core.mvr.resolvePackage({
863
- package: query.MoveModule.package,
864
- signal,
865
- })
866
- ).package,
867
- },
868
- };
869
- }
870
-
871
- return await this.transport.request({
872
- method: 'suix_queryEvents',
873
- params: [query, cursor, limit, (order || 'descending') === 'descending'],
874
- signal,
875
- });
876
- }
877
-
878
- /**
879
- * Runs the transaction block in dev-inspect mode. Which allows for nearly any
880
- * transaction (or Move call) with any arguments. Detailed results are
881
- * provided, including both the transaction effects and any return values.
882
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
883
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
884
- */
885
- async devInspectTransactionBlock(
886
- input: DevInspectTransactionBlockParams,
887
- ): Promise<DevInspectResults> {
888
- let devInspectTxBytes;
889
- if (isTransaction(input.transactionBlock)) {
890
- input.transactionBlock.setSenderIfNotSet(input.sender);
891
- devInspectTxBytes = toBase64(
892
- await input.transactionBlock.build({
893
- client: this,
894
- onlyTransactionKind: true,
895
- }),
896
- );
897
- } else if (typeof input.transactionBlock === 'string') {
898
- devInspectTxBytes = input.transactionBlock;
899
- } else if (input.transactionBlock instanceof Uint8Array) {
900
- devInspectTxBytes = toBase64(input.transactionBlock);
901
- } else {
902
- throw new Error('Unknown transaction block format.');
903
- }
904
-
905
- input.signal?.throwIfAborted();
906
-
907
- return await this.transport.request({
908
- method: 'sui_devInspectTransactionBlock',
909
- params: [input.sender, devInspectTxBytes, input.gasPrice?.toString(), input.epoch],
910
- signal: input.signal,
911
- });
912
- }
913
-
914
- /**
915
- * Dry run a transaction block and return the result.
916
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
917
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
918
- */
919
- async dryRunTransactionBlock(
920
- input: DryRunTransactionBlockParams,
921
- ): Promise<DryRunTransactionBlockResponse> {
922
- return await this.transport.request({
923
- method: 'sui_dryRunTransactionBlock',
924
- params: [
925
- typeof input.transactionBlock === 'string'
926
- ? input.transactionBlock
927
- : toBase64(input.transactionBlock),
928
- ],
929
- });
930
- }
931
-
932
- /**
933
- * Return the list of dynamic field objects owned by an object
934
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
935
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
936
- */
937
- async getDynamicFields(input: GetDynamicFieldsParams): Promise<DynamicFieldPage> {
938
- if (!input.parentId || !isValidSuiObjectId(normalizeSuiObjectId(input.parentId))) {
939
- throw new Error('Invalid Sui Object id');
940
- }
941
- return await this.transport.request({
942
- method: 'suix_getDynamicFields',
943
- params: [input.parentId, input.cursor, input.limit],
944
- signal: input.signal,
945
- });
946
- }
947
-
948
- /**
949
- * Return the dynamic field object information for a specified object
950
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
951
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
952
- */
953
- async getDynamicFieldObject(input: GetDynamicFieldObjectParams): Promise<SuiObjectResponse> {
954
- return await this.transport.request({
955
- method: 'suix_getDynamicFieldObject',
956
- params: [input.parentId, input.name],
957
- signal: input.signal,
958
- });
959
- }
960
-
961
- /**
962
- * Get the sequence number of the latest checkpoint that has been executed
963
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
964
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
965
- */
966
- async getLatestCheckpointSequenceNumber({
967
- signal,
968
- }: GetLatestCheckpointSequenceNumberParams = {}): Promise<string> {
969
- const resp = await this.transport.request({
970
- method: 'sui_getLatestCheckpointSequenceNumber',
971
- params: [],
972
- signal,
973
- });
974
- return String(resp);
975
- }
976
-
977
- /**
978
- * Returns information about a given checkpoint
979
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
980
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
981
- */
982
- async getCheckpoint(input: GetCheckpointParams): Promise<Checkpoint> {
983
- return await this.transport.request({
984
- method: 'sui_getCheckpoint',
985
- params: [input.id],
986
- signal: input.signal,
987
- });
988
- }
989
-
990
- /**
991
- * Returns historical checkpoints paginated
992
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
993
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
994
- */
995
- async getCheckpoints(
996
- input: PaginationArguments<CheckpointPage['nextCursor']> & GetCheckpointsParams,
997
- ): Promise<CheckpointPage> {
998
- return await this.transport.request({
999
- method: 'sui_getCheckpoints',
1000
- params: [input.cursor, input?.limit, input.descendingOrder],
1001
- signal: input.signal,
1002
- });
1003
- }
1004
-
1005
- /**
1006
- * Return the committee information for the asked epoch
1007
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
1008
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
1009
- */
1010
- async getCommitteeInfo(input?: GetCommitteeInfoParams): Promise<CommitteeInfo> {
1011
- return await this.transport.request({
1012
- method: 'suix_getCommitteeInfo',
1013
- params: [input?.epoch],
1014
- signal: input?.signal,
1015
- });
1016
- }
1017
-
1018
- /**
1019
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
1020
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
1021
- */
1022
- async getNetworkMetrics({ signal }: { signal?: AbortSignal } = {}): Promise<NetworkMetrics> {
1023
- return await this.transport.request({
1024
- method: 'suix_getNetworkMetrics',
1025
- params: [],
1026
- signal,
1027
- });
1028
- }
1029
-
1030
- /**
1031
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
1032
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
1033
- */
1034
- async getAddressMetrics({ signal }: { signal?: AbortSignal } = {}): Promise<AddressMetrics> {
1035
- return await this.transport.request({
1036
- method: 'suix_getLatestAddressMetrics',
1037
- params: [],
1038
- signal,
1039
- });
1040
- }
1041
-
1042
- /**
1043
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
1044
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
1045
- */
1046
- async getEpochMetrics(
1047
- input?: {
1048
- descendingOrder?: boolean;
1049
- signal?: AbortSignal;
1050
- } & PaginationArguments<EpochMetricsPage['nextCursor']>,
1051
- ): Promise<EpochMetricsPage> {
1052
- return await this.transport.request({
1053
- method: 'suix_getEpochMetrics',
1054
- params: [input?.cursor, input?.limit, input?.descendingOrder],
1055
- signal: input?.signal,
1056
- });
1057
- }
1058
-
1059
- /**
1060
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
1061
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
1062
- */
1063
- async getAllEpochAddressMetrics(input?: {
1064
- descendingOrder?: boolean;
1065
- signal?: AbortSignal;
1066
- }): Promise<AllEpochsAddressMetrics> {
1067
- return await this.transport.request({
1068
- method: 'suix_getAllEpochAddressMetrics',
1069
- params: [input?.descendingOrder],
1070
- signal: input?.signal,
1071
- });
1072
- }
1073
-
1074
- /**
1075
- * Return the committee information for the asked epoch
1076
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
1077
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
1078
- */
1079
- async getEpochs(
1080
- input?: {
1081
- descendingOrder?: boolean;
1082
- signal?: AbortSignal;
1083
- } & PaginationArguments<EpochPage['nextCursor']>,
1084
- ): Promise<EpochPage> {
1085
- return await this.transport.request({
1086
- method: 'suix_getEpochs',
1087
- params: [input?.cursor, input?.limit, input?.descendingOrder],
1088
- signal: input?.signal,
1089
- });
1090
- }
1091
-
1092
- /**
1093
- * Returns list of top move calls by usage
1094
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
1095
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
1096
- */
1097
- async getMoveCallMetrics({ signal }: { signal?: AbortSignal } = {}): Promise<MoveCallMetrics> {
1098
- return await this.transport.request({
1099
- method: 'suix_getMoveCallMetrics',
1100
- params: [],
1101
- signal,
1102
- });
1103
- }
1104
-
1105
- /**
1106
- * Return the committee information for the asked epoch
1107
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
1108
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
1109
- */
1110
- async getCurrentEpoch({ signal }: { signal?: AbortSignal } = {}): Promise<EpochInfo> {
1111
- return await this.transport.request({
1112
- method: 'suix_getCurrentEpoch',
1113
- params: [],
1114
- signal,
1115
- });
1116
- }
1117
-
1118
- /**
1119
- * Return the Validators APYs
1120
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
1121
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
1122
- */
1123
- async getValidatorsApy({ signal }: { signal?: AbortSignal } = {}): Promise<ValidatorsApy> {
1124
- return await this.transport.request({
1125
- method: 'suix_getValidatorsApy',
1126
- params: [],
1127
- signal,
1128
- });
1129
- }
1130
-
1131
- // TODO: Migrate this to `sui_getChainIdentifier` once it is widely available.
1132
- /**
1133
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
1134
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
1135
- */
1136
- async getChainIdentifier({ signal }: { signal?: AbortSignal } = {}): Promise<string> {
1137
- const checkpoint = await this.getCheckpoint({ id: '0', signal });
1138
- const bytes = fromBase58(checkpoint.digest);
1139
- return toHex(bytes.slice(0, 4));
1140
- }
1141
-
1142
- /**
1143
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
1144
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
1145
- */
1146
- async resolveNameServiceAddress(input: ResolveNameServiceAddressParams): Promise<string | null> {
1147
- return await this.transport.request({
1148
- method: 'suix_resolveNameServiceAddress',
1149
- params: [input.name],
1150
- signal: input.signal,
1151
- });
1152
- }
1153
-
1154
- /**
1155
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
1156
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
1157
- */
1158
- async resolveNameServiceNames({
1159
- format = 'dot',
1160
- ...input
1161
- }: ResolveNameServiceNamesParams & {
1162
- format?: 'at' | 'dot';
1163
- }): Promise<ResolvedNameServiceNames> {
1164
- const { nextCursor, hasNextPage, data }: ResolvedNameServiceNames =
1165
- await this.transport.request({
1166
- method: 'suix_resolveNameServiceNames',
1167
- params: [input.address, input.cursor, input.limit],
1168
- signal: input.signal,
1169
- });
1170
-
1171
- return {
1172
- hasNextPage,
1173
- nextCursor,
1174
- data: data.map((name) => normalizeSuiNSName(name, format)),
1175
- };
1176
- }
1177
-
1178
- /**
1179
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
1180
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
1181
- */
1182
- async getProtocolConfig(input?: GetProtocolConfigParams): Promise<ProtocolConfig> {
1183
- return await this.transport.request({
1184
- method: 'sui_getProtocolConfig',
1185
- params: [input?.version],
1186
- signal: input?.signal,
1187
- });
1188
- }
1189
-
1190
- /**
1191
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
1192
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
1193
- */
1194
- async verifyZkLoginSignature(input: VerifyZkLoginSignatureParams): Promise<ZkLoginVerifyResult> {
1195
- return await this.transport.request({
1196
- method: 'sui_verifyZkLoginSignature',
1197
- params: [input.bytes, input.signature, input.intentScope, input.author],
1198
- signal: input.signal,
1199
- });
1200
- }
1201
-
1202
- /**
1203
- * Wait for a transaction block result to be available over the API.
1204
- * This can be used in conjunction with `executeTransactionBlock` to wait for the transaction to
1205
- * be available via the API.
1206
- * This currently polls the `getTransactionBlock` API to check for the transaction.
1207
- * @deprecated JSON-RPC APIs are deprecated in the Sui TypeScript SDK. Use `SuiGrpcClient`
1208
- * from `@mysten/sui/grpc` or `SuiGraphQLClient` from `@mysten/sui/graphql` instead.
1209
- */
1210
- async waitForTransaction({
1211
- signal,
1212
- timeout = 60 * 1000,
1213
- pollInterval = 2 * 1000,
1214
- ...input
1215
- }: {
1216
- /** An optional abort signal that can be used to cancel */
1217
- signal?: AbortSignal;
1218
- /** The amount of time to wait for a transaction block. Defaults to one minute. */
1219
- timeout?: number;
1220
- /** The amount of time to wait between checks for the transaction block. Defaults to 2 seconds. */
1221
- pollInterval?: number;
1222
- } & Parameters<
1223
- SuiJsonRpcClient['getTransactionBlock']
1224
- >[0]): Promise<SuiTransactionBlockResponse> {
1225
- const timeoutSignal = AbortSignal.timeout(timeout);
1226
- const timeoutPromise = new Promise((_, reject) => {
1227
- timeoutSignal.addEventListener('abort', () => reject(timeoutSignal.reason));
1228
- });
1229
-
1230
- timeoutPromise.catch(() => {
1231
- // Swallow unhandled rejections that might be thrown after early return
1232
- });
1233
-
1234
- while (!timeoutSignal.aborted) {
1235
- signal?.throwIfAborted();
1236
- try {
1237
- return await this.getTransactionBlock(input);
1238
- } catch {
1239
- // Wait for either the next poll interval, or the timeout.
1240
- await Promise.race([
1241
- new Promise((resolve) => setTimeout(resolve, pollInterval)),
1242
- timeoutPromise,
1243
- ]);
1244
- }
1245
- }
1246
-
1247
- timeoutSignal.throwIfAborted();
1248
-
1249
- // This should never happen, because the above case should always throw, but just adding it in the event that something goes horribly wrong.
1250
- throw new Error('Unexpected error while waiting for transaction block.');
1251
- }
1252
- }