@haneullabs/haneul 2.5.2 → 2.13.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 (442) hide show
  1. package/CHANGELOG.md +129 -0
  2. package/README.md +36 -36
  3. package/dist/bcs/bcs.d.mts +6 -7
  4. package/dist/bcs/bcs.d.mts.map +1 -1
  5. package/dist/bcs/bcs.mjs.map +1 -1
  6. package/dist/bcs/effects.mjs.map +1 -1
  7. package/dist/bcs/index.d.mts +2 -2
  8. package/dist/bcs/index.d.mts.map +1 -1
  9. package/dist/bcs/index.mjs +2 -2
  10. package/dist/bcs/index.mjs.map +1 -1
  11. package/dist/bcs/pure.d.mts.map +1 -1
  12. package/dist/bcs/type-tag-serializer.d.mts.map +1 -1
  13. package/dist/bcs/types.d.mts +0 -1
  14. package/dist/bcs/types.d.mts.map +1 -1
  15. package/dist/client/cache.d.mts.map +1 -1
  16. package/dist/client/client.d.mts.map +1 -1
  17. package/dist/client/core-resolver.d.mts.map +1 -1
  18. package/dist/client/core-resolver.mjs +87 -68
  19. package/dist/client/core-resolver.mjs.map +1 -1
  20. package/dist/client/core.d.mts +9 -8
  21. package/dist/client/core.d.mts.map +1 -1
  22. package/dist/client/core.mjs +29 -10
  23. package/dist/client/core.mjs.map +1 -1
  24. package/dist/client/errors.d.mts.map +1 -1
  25. package/dist/client/mvr.d.mts +0 -1
  26. package/dist/client/mvr.d.mts.map +1 -1
  27. package/dist/client/types.d.mts +110 -24
  28. package/dist/client/types.d.mts.map +1 -1
  29. package/dist/client/utils.d.mts.map +1 -1
  30. package/dist/client/utils.mjs +7 -7
  31. package/dist/client/utils.mjs.map +1 -1
  32. package/dist/cryptography/index.d.mts +2 -2
  33. package/dist/cryptography/index.mjs +2 -2
  34. package/dist/cryptography/intent.d.mts +2 -2
  35. package/dist/cryptography/intent.d.mts.map +1 -1
  36. package/dist/cryptography/intent.mjs +2 -2
  37. package/dist/cryptography/intent.mjs.map +1 -1
  38. package/dist/cryptography/keypair.d.mts +3 -3
  39. package/dist/cryptography/keypair.d.mts.map +1 -1
  40. package/dist/cryptography/keypair.mjs +3 -3
  41. package/dist/cryptography/keypair.mjs.map +1 -1
  42. package/dist/cryptography/mnemonics.d.mts +5 -5
  43. package/dist/cryptography/mnemonics.d.mts.map +1 -1
  44. package/dist/cryptography/mnemonics.mjs +7 -7
  45. package/dist/cryptography/mnemonics.mjs.map +1 -1
  46. package/dist/cryptography/publickey.d.mts +1 -2
  47. package/dist/cryptography/publickey.d.mts.map +1 -1
  48. package/dist/cryptography/publickey.mjs +7 -7
  49. package/dist/cryptography/publickey.mjs.map +1 -1
  50. package/dist/cryptography/signature-scheme.d.mts.map +1 -1
  51. package/dist/cryptography/signature.d.mts +10 -13
  52. package/dist/cryptography/signature.d.mts.map +1 -1
  53. package/dist/cryptography/signature.mjs +2 -2
  54. package/dist/cryptography/signature.mjs.map +1 -1
  55. package/dist/faucet/faucet.d.mts +2 -2
  56. package/dist/faucet/faucet.d.mts.map +1 -1
  57. package/dist/faucet/faucet.mjs +2 -2
  58. package/dist/faucet/faucet.mjs.map +1 -1
  59. package/dist/faucet/index.d.mts +2 -2
  60. package/dist/faucet/index.mjs +2 -2
  61. package/dist/graphql/client.d.mts +20 -5
  62. package/dist/graphql/client.d.mts.map +1 -1
  63. package/dist/graphql/client.mjs +55 -7
  64. package/dist/graphql/client.mjs.map +1 -1
  65. package/dist/graphql/core.d.mts +6 -5
  66. package/dist/graphql/core.d.mts.map +1 -1
  67. package/dist/graphql/core.mjs +43 -47
  68. package/dist/graphql/core.mjs.map +1 -1
  69. package/dist/graphql/generated/queries.d.mts +0 -1
  70. package/dist/graphql/generated/queries.d.mts.map +1 -1
  71. package/dist/graphql/generated/queries.mjs +46 -10
  72. package/dist/graphql/generated/queries.mjs.map +1 -1
  73. package/dist/graphql/generated/tada-env.d.mts +706 -98
  74. package/dist/graphql/generated/tada-env.d.mts.map +1 -1
  75. package/dist/graphql/index.d.mts +2 -2
  76. package/dist/graphql/index.mjs +2 -2
  77. package/dist/graphql/schema/index.d.mts +0 -1
  78. package/dist/graphql/schema/index.d.mts.map +1 -1
  79. package/dist/graphql/types.d.mts.map +1 -1
  80. package/dist/grpc/client.d.mts +20 -5
  81. package/dist/grpc/client.d.mts.map +1 -1
  82. package/dist/grpc/client.mjs +47 -7
  83. package/dist/grpc/client.mjs.map +1 -1
  84. package/dist/grpc/core.d.mts +6 -5
  85. package/dist/grpc/core.d.mts.map +1 -1
  86. package/dist/grpc/core.mjs +35 -34
  87. package/dist/grpc/core.mjs.map +1 -1
  88. package/dist/grpc/index.d.mts +2 -2
  89. package/dist/grpc/index.mjs +2 -2
  90. package/dist/grpc/proto/google/protobuf/any.d.mts +0 -1
  91. package/dist/grpc/proto/google/protobuf/any.d.mts.map +1 -1
  92. package/dist/grpc/proto/google/protobuf/duration.d.mts +0 -1
  93. package/dist/grpc/proto/google/protobuf/duration.d.mts.map +1 -1
  94. package/dist/grpc/proto/google/protobuf/field_mask.d.mts +0 -1
  95. package/dist/grpc/proto/google/protobuf/field_mask.d.mts.map +1 -1
  96. package/dist/grpc/proto/google/protobuf/struct.d.mts +1 -2
  97. package/dist/grpc/proto/google/protobuf/struct.d.mts.map +1 -1
  98. package/dist/grpc/proto/google/protobuf/timestamp.d.mts +0 -1
  99. package/dist/grpc/proto/google/protobuf/timestamp.d.mts.map +1 -1
  100. package/dist/grpc/proto/google/rpc/status.d.mts +0 -1
  101. package/dist/grpc/proto/google/rpc/status.d.mts.map +1 -1
  102. package/dist/grpc/proto/haneul/rpc/v2/argument.d.mts +1 -2
  103. package/dist/grpc/proto/haneul/rpc/v2/argument.d.mts.map +1 -1
  104. package/dist/grpc/proto/haneul/rpc/v2/balance_change.d.mts +0 -1
  105. package/dist/grpc/proto/haneul/rpc/v2/balance_change.d.mts.map +1 -1
  106. package/dist/grpc/proto/haneul/rpc/v2/bcs.d.mts +1 -2
  107. package/dist/grpc/proto/haneul/rpc/v2/bcs.d.mts.map +1 -1
  108. package/dist/grpc/proto/haneul/rpc/v2/bcs.mjs.map +1 -1
  109. package/dist/grpc/proto/haneul/rpc/v2/checkpoint.d.mts +0 -1
  110. package/dist/grpc/proto/haneul/rpc/v2/checkpoint.d.mts.map +1 -1
  111. package/dist/grpc/proto/haneul/rpc/v2/checkpoint_contents.d.mts +0 -1
  112. package/dist/grpc/proto/haneul/rpc/v2/checkpoint_contents.d.mts.map +1 -1
  113. package/dist/grpc/proto/haneul/rpc/v2/checkpoint_summary.d.mts +1 -2
  114. package/dist/grpc/proto/haneul/rpc/v2/checkpoint_summary.d.mts.map +1 -1
  115. package/dist/grpc/proto/haneul/rpc/v2/effects.d.mts +5 -6
  116. package/dist/grpc/proto/haneul/rpc/v2/effects.d.mts.map +1 -1
  117. package/dist/grpc/proto/haneul/rpc/v2/epoch.d.mts +0 -1
  118. package/dist/grpc/proto/haneul/rpc/v2/epoch.d.mts.map +1 -1
  119. package/dist/grpc/proto/haneul/rpc/v2/error_reason.d.mts +1 -1
  120. package/dist/grpc/proto/haneul/rpc/v2/error_reason.d.mts.map +1 -1
  121. package/dist/grpc/proto/haneul/rpc/v2/event.d.mts +0 -1
  122. package/dist/grpc/proto/haneul/rpc/v2/event.d.mts.map +1 -1
  123. package/dist/grpc/proto/haneul/rpc/v2/executed_transaction.d.mts +0 -1
  124. package/dist/grpc/proto/haneul/rpc/v2/executed_transaction.d.mts.map +1 -1
  125. package/dist/grpc/proto/haneul/rpc/v2/execution_status.d.mts +8 -9
  126. package/dist/grpc/proto/haneul/rpc/v2/execution_status.d.mts.map +1 -1
  127. package/dist/grpc/proto/haneul/rpc/v2/execution_status.mjs +4 -4
  128. package/dist/grpc/proto/haneul/rpc/v2/execution_status.mjs.map +1 -1
  129. package/dist/grpc/proto/haneul/rpc/v2/gas_cost_summary.d.mts +0 -1
  130. package/dist/grpc/proto/haneul/rpc/v2/gas_cost_summary.d.mts.map +1 -1
  131. package/dist/grpc/proto/haneul/rpc/v2/input.d.mts +3 -4
  132. package/dist/grpc/proto/haneul/rpc/v2/input.d.mts.map +1 -1
  133. package/dist/grpc/proto/haneul/rpc/v2/jwk.d.mts +0 -1
  134. package/dist/grpc/proto/haneul/rpc/v2/jwk.d.mts.map +1 -1
  135. package/dist/grpc/proto/haneul/rpc/v2/ledger_service.client.d.mts +4 -5
  136. package/dist/grpc/proto/haneul/rpc/v2/ledger_service.client.d.mts.map +1 -1
  137. package/dist/grpc/proto/haneul/rpc/v2/ledger_service.d.mts +0 -1
  138. package/dist/grpc/proto/haneul/rpc/v2/ledger_service.d.mts.map +1 -1
  139. package/dist/grpc/proto/haneul/rpc/v2/move_package.d.mts +5 -6
  140. package/dist/grpc/proto/haneul/rpc/v2/move_package.d.mts.map +1 -1
  141. package/dist/grpc/proto/haneul/rpc/v2/move_package_service.client.d.mts +4 -5
  142. package/dist/grpc/proto/haneul/rpc/v2/move_package_service.client.d.mts.map +1 -1
  143. package/dist/grpc/proto/haneul/rpc/v2/move_package_service.d.mts +0 -1
  144. package/dist/grpc/proto/haneul/rpc/v2/move_package_service.d.mts.map +1 -1
  145. package/dist/grpc/proto/haneul/rpc/v2/name_service.client.d.mts +4 -5
  146. package/dist/grpc/proto/haneul/rpc/v2/name_service.client.d.mts.map +1 -1
  147. package/dist/grpc/proto/haneul/rpc/v2/name_service.d.mts +0 -1
  148. package/dist/grpc/proto/haneul/rpc/v2/name_service.d.mts.map +1 -1
  149. package/dist/grpc/proto/haneul/rpc/v2/object.d.mts +38 -2
  150. package/dist/grpc/proto/haneul/rpc/v2/object.d.mts.map +1 -1
  151. package/dist/grpc/proto/haneul/rpc/v2/object.mjs +26 -1
  152. package/dist/grpc/proto/haneul/rpc/v2/object.mjs.map +1 -1
  153. package/dist/grpc/proto/haneul/rpc/v2/object_reference.d.mts +0 -1
  154. package/dist/grpc/proto/haneul/rpc/v2/object_reference.d.mts.map +1 -1
  155. package/dist/grpc/proto/haneul/rpc/v2/owner.d.mts +1 -2
  156. package/dist/grpc/proto/haneul/rpc/v2/owner.d.mts.map +1 -1
  157. package/dist/grpc/proto/haneul/rpc/v2/protocol_config.d.mts +0 -1
  158. package/dist/grpc/proto/haneul/rpc/v2/protocol_config.d.mts.map +1 -1
  159. package/dist/grpc/proto/haneul/rpc/v2/signature.d.mts +1 -2
  160. package/dist/grpc/proto/haneul/rpc/v2/signature.d.mts.map +1 -1
  161. package/dist/grpc/proto/haneul/rpc/v2/signature.mjs.map +1 -1
  162. package/dist/grpc/proto/haneul/rpc/v2/signature_scheme.d.mts +2 -2
  163. package/dist/grpc/proto/haneul/rpc/v2/signature_scheme.d.mts.map +1 -1
  164. package/dist/grpc/proto/haneul/rpc/v2/signature_scheme.mjs +1 -1
  165. package/dist/grpc/proto/haneul/rpc/v2/signature_scheme.mjs.map +1 -1
  166. package/dist/grpc/proto/haneul/rpc/v2/signature_verification_service.client.d.mts +0 -1
  167. package/dist/grpc/proto/haneul/rpc/v2/signature_verification_service.client.d.mts.map +1 -1
  168. package/dist/grpc/proto/haneul/rpc/v2/signature_verification_service.d.mts +0 -1
  169. package/dist/grpc/proto/haneul/rpc/v2/signature_verification_service.d.mts.map +1 -1
  170. package/dist/grpc/proto/haneul/rpc/v2/state_service.client.d.mts +4 -5
  171. package/dist/grpc/proto/haneul/rpc/v2/state_service.client.d.mts.map +1 -1
  172. package/dist/grpc/proto/haneul/rpc/v2/state_service.d.mts +4 -5
  173. package/dist/grpc/proto/haneul/rpc/v2/state_service.d.mts.map +1 -1
  174. package/dist/grpc/proto/haneul/rpc/v2/subscription_service.client.d.mts +4 -5
  175. package/dist/grpc/proto/haneul/rpc/v2/subscription_service.client.d.mts.map +1 -1
  176. package/dist/grpc/proto/haneul/rpc/v2/subscription_service.d.mts +0 -1
  177. package/dist/grpc/proto/haneul/rpc/v2/subscription_service.d.mts.map +1 -1
  178. package/dist/grpc/proto/haneul/rpc/v2/system_state.d.mts +3 -4
  179. package/dist/grpc/proto/haneul/rpc/v2/system_state.d.mts.map +1 -1
  180. package/dist/grpc/proto/haneul/rpc/v2/system_state.mjs +1 -1
  181. package/dist/grpc/proto/haneul/rpc/v2/system_state.mjs.map +1 -1
  182. package/dist/grpc/proto/haneul/rpc/v2/transaction.d.mts +4 -5
  183. package/dist/grpc/proto/haneul/rpc/v2/transaction.d.mts.map +1 -1
  184. package/dist/grpc/proto/haneul/rpc/v2/transaction_execution_service.client.d.mts +0 -1
  185. package/dist/grpc/proto/haneul/rpc/v2/transaction_execution_service.client.d.mts.map +1 -1
  186. package/dist/grpc/proto/haneul/rpc/v2/transaction_execution_service.d.mts +9 -2
  187. package/dist/grpc/proto/haneul/rpc/v2/transaction_execution_service.d.mts.map +1 -1
  188. package/dist/grpc/proto/haneul/rpc/v2/transaction_execution_service.mjs +23 -12
  189. package/dist/grpc/proto/haneul/rpc/v2/transaction_execution_service.mjs.map +1 -1
  190. package/dist/grpc/proto/types.d.mts +2 -2
  191. package/dist/grpc/proto/types.d.mts.map +1 -1
  192. package/dist/grpc/proto/types.mjs +2 -1
  193. package/dist/jsonRpc/client.d.mts +4 -7
  194. package/dist/jsonRpc/client.d.mts.map +1 -1
  195. package/dist/jsonRpc/client.mjs +4 -33
  196. package/dist/jsonRpc/client.mjs.map +1 -1
  197. package/dist/jsonRpc/core.d.mts +8 -15
  198. package/dist/jsonRpc/core.d.mts.map +1 -1
  199. package/dist/jsonRpc/core.mjs +81 -34
  200. package/dist/jsonRpc/core.mjs.map +1 -1
  201. package/dist/jsonRpc/errors.d.mts.map +1 -1
  202. package/dist/jsonRpc/http-transport.d.mts +1 -17
  203. package/dist/jsonRpc/http-transport.d.mts.map +1 -1
  204. package/dist/jsonRpc/http-transport.mjs +0 -23
  205. package/dist/jsonRpc/http-transport.mjs.map +1 -1
  206. package/dist/jsonRpc/index.d.mts +3 -3
  207. package/dist/jsonRpc/network.d.mts.map +1 -1
  208. package/dist/jsonRpc/types/chain.d.mts.map +1 -1
  209. package/dist/jsonRpc/types/changes.d.mts.map +1 -1
  210. package/dist/jsonRpc/types/coins.d.mts.map +1 -1
  211. package/dist/jsonRpc/types/common.d.mts +1 -2
  212. package/dist/jsonRpc/types/common.d.mts.map +1 -1
  213. package/dist/jsonRpc/types/generated.d.mts +101 -129
  214. package/dist/jsonRpc/types/generated.d.mts.map +1 -1
  215. package/dist/jsonRpc/types/index.d.mts +1 -1
  216. package/dist/jsonRpc/types/params.d.mts +9 -14
  217. package/dist/jsonRpc/types/params.d.mts.map +1 -1
  218. package/dist/keypairs/ed25519/keypair.d.mts +8 -6
  219. package/dist/keypairs/ed25519/keypair.d.mts.map +1 -1
  220. package/dist/keypairs/ed25519/keypair.mjs +13 -9
  221. package/dist/keypairs/ed25519/keypair.mjs.map +1 -1
  222. package/dist/keypairs/ed25519/publickey.d.mts +0 -1
  223. package/dist/keypairs/ed25519/publickey.d.mts.map +1 -1
  224. package/dist/keypairs/passkey/keypair.d.mts +12 -5
  225. package/dist/keypairs/passkey/keypair.d.mts.map +1 -1
  226. package/dist/keypairs/passkey/keypair.mjs +20 -7
  227. package/dist/keypairs/passkey/keypair.mjs.map +1 -1
  228. package/dist/keypairs/passkey/publickey.d.mts +0 -1
  229. package/dist/keypairs/passkey/publickey.d.mts.map +1 -1
  230. package/dist/keypairs/passkey/types.d.mts.map +1 -1
  231. package/dist/keypairs/secp256k1/keypair.d.mts +3 -3
  232. package/dist/keypairs/secp256k1/keypair.d.mts.map +1 -1
  233. package/dist/keypairs/secp256k1/keypair.mjs +6 -6
  234. package/dist/keypairs/secp256k1/keypair.mjs.map +1 -1
  235. package/dist/keypairs/secp256k1/publickey.d.mts +0 -1
  236. package/dist/keypairs/secp256k1/publickey.d.mts.map +1 -1
  237. package/dist/keypairs/secp256r1/keypair.d.mts +3 -3
  238. package/dist/keypairs/secp256r1/keypair.d.mts.map +1 -1
  239. package/dist/keypairs/secp256r1/keypair.mjs +6 -6
  240. package/dist/keypairs/secp256r1/keypair.mjs.map +1 -1
  241. package/dist/keypairs/secp256r1/publickey.d.mts +0 -1
  242. package/dist/keypairs/secp256r1/publickey.d.mts.map +1 -1
  243. package/dist/multisig/publickey.d.mts +1 -0
  244. package/dist/multisig/publickey.d.mts.map +1 -1
  245. package/dist/multisig/publickey.mjs +7 -7
  246. package/dist/multisig/publickey.mjs.map +1 -1
  247. package/dist/multisig/signer.d.mts.map +1 -1
  248. package/dist/transactions/Arguments.d.mts.map +1 -1
  249. package/dist/transactions/Commands.d.mts +1 -1
  250. package/dist/transactions/Commands.d.mts.map +1 -1
  251. package/dist/transactions/Commands.mjs.map +1 -1
  252. package/dist/transactions/Inputs.d.mts.map +1 -1
  253. package/dist/transactions/ObjectCache.d.mts +3 -3
  254. package/dist/transactions/ObjectCache.d.mts.map +1 -1
  255. package/dist/transactions/Transaction.d.mts +26 -0
  256. package/dist/transactions/Transaction.d.mts.map +1 -1
  257. package/dist/transactions/Transaction.mjs +23 -1
  258. package/dist/transactions/Transaction.mjs.map +1 -1
  259. package/dist/transactions/TransactionData.d.mts.map +1 -1
  260. package/dist/transactions/TransactionData.mjs +8 -8
  261. package/dist/transactions/TransactionData.mjs.map +1 -1
  262. package/dist/transactions/data/internal.d.mts +109 -109
  263. package/dist/transactions/data/internal.d.mts.map +1 -1
  264. package/dist/transactions/data/internal.mjs.map +1 -1
  265. package/dist/transactions/data/v1.d.mts +220 -221
  266. package/dist/transactions/data/v1.d.mts.map +1 -1
  267. package/dist/transactions/data/v2.d.mts.map +1 -1
  268. package/dist/transactions/data/v2.mjs.map +1 -1
  269. package/dist/transactions/executor/caching.mjs +2 -2
  270. package/dist/transactions/executor/caching.mjs.map +1 -1
  271. package/dist/transactions/executor/parallel.d.mts +1 -1
  272. package/dist/transactions/executor/parallel.d.mts.map +1 -1
  273. package/dist/transactions/executor/parallel.mjs +1 -1
  274. package/dist/transactions/executor/parallel.mjs.map +1 -1
  275. package/dist/transactions/executor/serial.d.mts +3 -3
  276. package/dist/transactions/executor/serial.d.mts.map +1 -1
  277. package/dist/transactions/executor/serial.mjs.map +1 -1
  278. package/dist/transactions/intents/CoinWithBalance.d.mts.map +1 -1
  279. package/dist/transactions/intents/CoinWithBalance.mjs +174 -97
  280. package/dist/transactions/intents/CoinWithBalance.mjs.map +1 -1
  281. package/dist/transactions/object.d.mts.map +1 -1
  282. package/dist/transactions/pure.d.mts.map +1 -1
  283. package/dist/transactions/pure.mjs +12 -12
  284. package/dist/transactions/pure.mjs.map +1 -1
  285. package/dist/transactions/resolve.d.mts.map +1 -1
  286. package/dist/transactions/resolve.mjs +3 -3
  287. package/dist/transactions/resolve.mjs.map +1 -1
  288. package/dist/transactions/serializer.d.mts.map +1 -1
  289. package/dist/transactions/serializer.mjs +15 -15
  290. package/dist/transactions/serializer.mjs.map +1 -1
  291. package/dist/transactions/utils.d.mts +0 -1
  292. package/dist/transactions/utils.d.mts.map +1 -1
  293. package/dist/utils/coin-reservation.mjs +67 -0
  294. package/dist/utils/coin-reservation.mjs.map +1 -0
  295. package/dist/utils/constants.d.mts +2 -1
  296. package/dist/utils/constants.d.mts.map +1 -1
  297. package/dist/utils/constants.mjs +2 -1
  298. package/dist/utils/constants.mjs.map +1 -1
  299. package/dist/utils/derived-objects.d.mts +0 -1
  300. package/dist/utils/derived-objects.d.mts.map +1 -1
  301. package/dist/utils/dynamic-fields.d.mts.map +1 -1
  302. package/dist/utils/dynamic-fields.mjs +4 -4
  303. package/dist/utils/dynamic-fields.mjs.map +1 -1
  304. package/dist/utils/format.d.mts.map +1 -1
  305. package/dist/utils/haneul-types.d.mts.map +1 -1
  306. package/dist/utils/haneul-types.mjs +8 -0
  307. package/dist/utils/haneul-types.mjs.map +1 -1
  308. package/dist/utils/haneulns.d.mts.map +1 -1
  309. package/dist/utils/index.d.mts +2 -2
  310. package/dist/utils/index.mjs +2 -2
  311. package/dist/utils/move-registry.d.mts.map +1 -1
  312. package/dist/verify/verify.d.mts.map +1 -1
  313. package/dist/version.mjs +1 -1
  314. package/dist/version.mjs.map +1 -1
  315. package/dist/zklogin/address.d.mts.map +1 -1
  316. package/dist/zklogin/bcs.d.mts +14 -14
  317. package/dist/zklogin/bcs.d.mts.map +1 -1
  318. package/dist/zklogin/jwt-decode.d.mts +0 -1
  319. package/dist/zklogin/jwt-decode.d.mts.map +1 -1
  320. package/dist/zklogin/jwt-utils.d.mts +0 -1
  321. package/dist/zklogin/jwt-utils.d.mts.map +1 -1
  322. package/dist/zklogin/nonce.d.mts.map +1 -1
  323. package/dist/zklogin/poseidon.d.mts.map +1 -1
  324. package/dist/zklogin/publickey.d.mts +0 -1
  325. package/dist/zklogin/publickey.d.mts.map +1 -1
  326. package/dist/zklogin/signature.d.mts.map +1 -1
  327. package/dist/zklogin/utils.d.mts.map +1 -1
  328. package/dist/zklogin/utils.mjs +1 -1
  329. package/dist/zklogin/utils.mjs.map +1 -1
  330. package/docs/bcs.md +132 -0
  331. package/docs/clients/core.md +616 -0
  332. package/docs/clients/graphql.md +99 -0
  333. package/docs/clients/grpc.md +152 -0
  334. package/docs/clients/index.md +93 -0
  335. package/docs/clients/json-rpc.md +235 -0
  336. package/docs/cryptography/keypairs.md +259 -0
  337. package/docs/cryptography/multisig.md +192 -0
  338. package/docs/cryptography/passkey.md +111 -0
  339. package/docs/cryptography/webcrypto-signer.md +81 -0
  340. package/docs/executors.md +148 -0
  341. package/docs/faucet.md +26 -0
  342. package/docs/hello-haneul.md +115 -0
  343. package/docs/index.md +56 -0
  344. package/docs/install.md +61 -0
  345. package/docs/llm-docs.md +32 -0
  346. package/docs/llms-index.md +66 -0
  347. package/docs/migrations/0.38.md +57 -0
  348. package/docs/migrations/haneul-1.0.md +454 -0
  349. package/docs/migrations/haneul-2.0/agent-prompt.md +42 -0
  350. package/docs/migrations/haneul-2.0/dapp-kit.md +350 -0
  351. package/docs/migrations/haneul-2.0/deepbook-v3.md +33 -0
  352. package/docs/migrations/haneul-2.0/haneul.md +341 -0
  353. package/docs/migrations/haneul-2.0/haneulns.md +42 -0
  354. package/docs/migrations/haneul-2.0/index.md +161 -0
  355. package/docs/migrations/haneul-2.0/json-rpc-migration.md +399 -0
  356. package/docs/migrations/haneul-2.0/kiosk.md +120 -0
  357. package/docs/migrations/haneul-2.0/sdk-maintainers.md +91 -0
  358. package/docs/migrations/haneul-2.0/seal.md +14 -0
  359. package/docs/migrations/haneul-2.0/wallet-builders.md +66 -0
  360. package/docs/migrations/haneul-2.0/walrus.md +41 -0
  361. package/docs/migrations/haneul-2.0/zksend.md +94 -0
  362. package/docs/plugins.md +255 -0
  363. package/docs/sdk-building.md +341 -0
  364. package/docs/transaction-building/basics.md +297 -0
  365. package/docs/transaction-building/gas.md +62 -0
  366. package/docs/transaction-building/intents.md +61 -0
  367. package/docs/transaction-building/offline.md +71 -0
  368. package/docs/transaction-building/sponsored-transactions.md +22 -0
  369. package/docs/utils/derived_objects.md +80 -0
  370. package/docs/utils/index.md +53 -0
  371. package/docs/zklogin.md +78 -0
  372. package/package.json +199 -199
  373. package/src/bcs/bcs.ts +13 -13
  374. package/src/bcs/effects.ts +20 -20
  375. package/src/bcs/index.ts +2 -2
  376. package/src/client/core-resolver.ts +150 -100
  377. package/src/client/core.ts +62 -22
  378. package/src/client/types.ts +109 -24
  379. package/src/cryptography/index.ts +2 -2
  380. package/src/cryptography/keypair.ts +2 -2
  381. package/src/cryptography/mnemonics.ts +7 -7
  382. package/src/cryptography/publickey.ts +5 -5
  383. package/src/faucet/faucet.ts +1 -1
  384. package/src/faucet/index.ts +1 -1
  385. package/src/graphql/client.ts +100 -8
  386. package/src/graphql/core.ts +73 -80
  387. package/src/graphql/generated/queries.ts +301 -51
  388. package/src/graphql/generated/schema.graphql +407 -104
  389. package/src/graphql/generated/tada-env.ts +779 -58
  390. package/src/graphql/index.ts +1 -1
  391. package/src/graphql/queries/getAllBalances.graphql +1 -1
  392. package/src/graphql/queries/getBalance.graphql +1 -1
  393. package/src/graphql/queries/getCoins.graphql +2 -2
  394. package/src/graphql/queries/getDynamicFields.graphql +9 -1
  395. package/src/graphql/queries/getMoveFunction.graphql +1 -1
  396. package/src/graphql/queries/getProtocolConfig.graphql +18 -0
  397. package/src/graphql/queries/nameService.graphql +1 -1
  398. package/src/graphql/queries/objects.graphql +11 -1
  399. package/src/graphql/queries/transactions.graphql +1 -3
  400. package/src/graphql/queries/verifyZkLoginSignature.graphql +1 -2
  401. package/src/grpc/client.ts +66 -8
  402. package/src/grpc/core.ts +74 -35
  403. package/src/grpc/index.ts +1 -1
  404. package/src/grpc/proto/haneul/rpc/v2/bcs.ts +1 -1
  405. package/src/grpc/proto/haneul/rpc/v2/execution_status.ts +4 -4
  406. package/src/grpc/proto/haneul/rpc/v2/object.ts +44 -0
  407. package/src/grpc/proto/haneul/rpc/v2/signature.ts +1 -1
  408. package/src/grpc/proto/haneul/rpc/v2/signature_scheme.ts +1 -1
  409. package/src/grpc/proto/haneul/rpc/v2/system_state.ts +4 -4
  410. package/src/grpc/proto/haneul/rpc/v2/transaction_execution_service.ts +16 -0
  411. package/src/jsonRpc/client.ts +5 -23
  412. package/src/jsonRpc/core.ts +114 -41
  413. package/src/jsonRpc/http-transport.ts +0 -52
  414. package/src/jsonRpc/index.ts +0 -1
  415. package/src/jsonRpc/types/common.ts +0 -1
  416. package/src/jsonRpc/types/generated.ts +2 -2
  417. package/src/jsonRpc/types/params.ts +6 -6
  418. package/src/keypairs/ed25519/keypair.ts +14 -10
  419. package/src/keypairs/passkey/keypair.ts +22 -8
  420. package/src/keypairs/secp256k1/keypair.ts +6 -6
  421. package/src/keypairs/secp256r1/keypair.ts +6 -6
  422. package/src/transactions/Commands.ts +1 -1
  423. package/src/transactions/Transaction.ts +38 -1
  424. package/src/transactions/TransactionData.ts +3 -3
  425. package/src/transactions/__tests__/bcs.test.ts +3 -3
  426. package/src/transactions/data/internal.ts +12 -12
  427. package/src/transactions/data/v2.ts +6 -6
  428. package/src/transactions/executor/caching.ts +2 -2
  429. package/src/transactions/executor/parallel.ts +1 -2
  430. package/src/transactions/executor/serial.ts +1 -1
  431. package/src/transactions/intents/CoinWithBalance.ts +247 -121
  432. package/src/utils/coin-reservation.ts +84 -0
  433. package/src/utils/constants.ts +2 -0
  434. package/src/utils/haneul-types.ts +16 -1
  435. package/src/utils/index.ts +1 -0
  436. package/src/version.ts +1 -1
  437. package/src/zklogin/utils.ts +1 -1
  438. package/dist/jsonRpc/rpc-websocket-client.d.mts +0 -26
  439. package/dist/jsonRpc/rpc-websocket-client.d.mts.map +0 -1
  440. package/dist/jsonRpc/rpc-websocket-client.mjs +0 -135
  441. package/dist/jsonRpc/rpc-websocket-client.mjs.map +0 -1
  442. package/src/jsonRpc/rpc-websocket-client.ts +0 -241
@@ -2,7 +2,7 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  import type { InferInput } from 'valibot';
5
- import { bigint, object, parse, string } from 'valibot';
5
+ import { bigint, object, optional, parse, picklist, string } from 'valibot';
6
6
 
7
7
  import { bcs } from '../../bcs/index.js';
8
8
  import { normalizeStructTag } from '../../utils/haneul-types.js';
@@ -15,10 +15,10 @@ import type { TransactionDataBuilder } from '../TransactionData.js';
15
15
  import type { ClientWithCoreApi, HaneulClientTypes } from '../../client/index.js';
16
16
 
17
17
  export const COIN_WITH_BALANCE = 'CoinWithBalance';
18
- const SUI_TYPE = normalizeStructTag('0x2::haneul::HANEUL');
18
+ const HANEUL_TYPE = normalizeStructTag('0x2::haneul::HANEUL');
19
19
 
20
20
  export function coinWithBalance({
21
- type = SUI_TYPE,
21
+ type = HANEUL_TYPE,
22
22
  balance,
23
23
  useGasCoin = true,
24
24
  }: {
@@ -41,8 +41,9 @@ export function coinWithBalance({
41
41
  name: COIN_WITH_BALANCE,
42
42
  inputs: {},
43
43
  data: {
44
- type: coinType === SUI_TYPE && useGasCoin ? 'gas' : coinType,
44
+ type: coinType === HANEUL_TYPE && useGasCoin ? 'gas' : coinType,
45
45
  balance: BigInt(balance),
46
+ outputKind: 'coin',
46
47
  } satisfies InferInput<typeof CoinWithBalanceData>,
47
48
  }),
48
49
  );
@@ -51,9 +52,45 @@ export function coinWithBalance({
51
52
  };
52
53
  }
53
54
 
55
+ export function createBalance({
56
+ type = HANEUL_TYPE,
57
+ balance,
58
+ useGasCoin = true,
59
+ }: {
60
+ balance: bigint | number;
61
+ type?: string;
62
+ useGasCoin?: boolean;
63
+ }): (tx: Transaction) => TransactionResult {
64
+ let balanceResult: TransactionResult | null = null;
65
+
66
+ return (tx: Transaction) => {
67
+ if (balanceResult) {
68
+ return balanceResult;
69
+ }
70
+
71
+ tx.addIntentResolver(COIN_WITH_BALANCE, resolveCoinBalance);
72
+ const coinType = type === 'gas' ? type : normalizeStructTag(type);
73
+
74
+ balanceResult = tx.add(
75
+ TransactionCommands.Intent({
76
+ name: COIN_WITH_BALANCE,
77
+ inputs: {},
78
+ data: {
79
+ type: coinType === HANEUL_TYPE && useGasCoin ? 'gas' : coinType,
80
+ balance: BigInt(balance),
81
+ outputKind: 'balance',
82
+ } satisfies InferInput<typeof CoinWithBalanceData>,
83
+ }),
84
+ );
85
+
86
+ return balanceResult;
87
+ };
88
+ }
89
+
54
90
  const CoinWithBalanceData = object({
55
91
  type: string(),
56
92
  balance: bigint(),
93
+ outputKind: optional(picklist(['coin', 'balance'])),
57
94
  });
58
95
 
59
96
  export async function resolveCoinBalance(
@@ -61,24 +98,48 @@ export async function resolveCoinBalance(
61
98
  buildOptions: BuildTransactionOptions,
62
99
  next: () => Promise<void>,
63
100
  ) {
101
+ type IntentInfo = { balance: bigint; outputKind: 'coin' | 'balance' };
102
+
64
103
  const coinTypes = new Set<string>();
65
104
  const totalByType = new Map<string, bigint>();
105
+ const intentsByType = new Map<string, IntentInfo[]>();
66
106
 
67
107
  if (!transactionData.sender) {
68
108
  throw new Error('Sender must be set to resolve CoinWithBalance');
69
109
  }
70
110
 
71
- for (const command of transactionData.commands) {
72
- if (command.$kind === '$Intent' && command.$Intent.name === COIN_WITH_BALANCE) {
73
- const { type, balance } = parse(CoinWithBalanceData, command.$Intent.data);
111
+ // First pass: scan intents, collect per-type data, and resolve zero-balance intents in place.
112
+ for (const [i, command] of transactionData.commands.entries()) {
113
+ if (command.$kind !== '$Intent' || command.$Intent.name !== COIN_WITH_BALANCE) {
114
+ continue;
115
+ }
74
116
 
75
- if (type !== 'gas' && balance > 0n) {
76
- coinTypes.add(type);
77
- }
117
+ const { type, balance, outputKind } = parse(CoinWithBalanceData, command.$Intent.data);
118
+
119
+ // Zero-balance intents are resolved immediately — no coins or AB needed.
120
+ // This is a 1:1 replacement so indices don't shift.
121
+ if (balance === 0n) {
122
+ const coinType = type === 'gas' ? HANEUL_TYPE : type;
123
+ transactionData.replaceCommand(
124
+ i,
125
+ TransactionCommands.MoveCall({
126
+ target: (outputKind ?? 'coin') === 'balance' ? '0x2::balance::zero' : '0x2::coin::zero',
127
+ typeArguments: [coinType],
128
+ }),
129
+ );
130
+ continue;
131
+ }
78
132
 
79
- totalByType.set(type, (totalByType.get(type) ?? 0n) + balance);
133
+ if (type !== 'gas') {
134
+ coinTypes.add(type);
80
135
  }
136
+
137
+ totalByType.set(type, (totalByType.get(type) ?? 0n) + balance);
138
+
139
+ if (!intentsByType.has(type)) intentsByType.set(type, []);
140
+ intentsByType.get(type)!.push({ balance, outputKind: outputKind ?? 'coin' });
81
141
  }
142
+
82
143
  const usedIds = new Set<string>();
83
144
 
84
145
  for (const input of transactionData.inputs) {
@@ -117,7 +178,7 @@ export async function resolveCoinBalance(
117
178
  ? await client.core
118
179
  .getBalance({
119
180
  owner: transactionData.sender!,
120
- coinType: SUI_TYPE,
181
+ coinType: HANEUL_TYPE,
121
182
  })
122
183
  .then(({ balance }) => {
123
184
  addressBalanceByType.set('gas', BigInt(balance.addressBalance));
@@ -126,9 +187,17 @@ export async function resolveCoinBalance(
126
187
  ]);
127
188
 
128
189
  const mergedCoins = new Map<string, Argument>();
190
+ const exactBalanceByType = new Map<string, boolean>();
191
+
192
+ // Per-type state for Path 2 combined splits
193
+ type TypeState = { results: Argument[]; nextIntent: number };
194
+ const typeState = new Map<string, TypeState>();
129
195
 
130
- for (const [index, transaction] of transactionData.commands.entries()) {
196
+ let index = 0;
197
+ while (index < transactionData.commands.length) {
198
+ const transaction = transactionData.commands[index];
131
199
  if (transaction.$kind !== '$Intent' || transaction.$Intent.name !== COIN_WITH_BALANCE) {
200
+ index++;
132
201
  continue;
133
202
  }
134
203
 
@@ -136,25 +205,23 @@ export async function resolveCoinBalance(
136
205
  type: string;
137
206
  balance: bigint;
138
207
  };
139
-
140
- if (balance === 0n) {
141
- transactionData.replaceCommand(
142
- index,
143
- TransactionCommands.MoveCall({
144
- target: '0x2::coin::zero',
145
- typeArguments: [type === 'gas' ? SUI_TYPE : type],
146
- }),
147
- );
148
- continue;
149
- }
208
+ const coinType = type === 'gas' ? HANEUL_TYPE : type;
209
+ const totalRequired = totalByType.get(type)!;
210
+ const addressBalance = addressBalanceByType.get(type) ?? 0n;
150
211
 
151
212
  const commands = [];
213
+ let intentResult: Argument;
214
+
215
+ const intentsForType = intentsByType.get(type) ?? [];
216
+ const allBalance = intentsForType.every((i) => i.outputKind === 'balance');
152
217
 
153
- if (addressBalanceByType.get(type)! >= totalByType.get(type)!) {
218
+ if (allBalance && addressBalance >= totalRequired) {
219
+ // Path 1: All balance intents and AB sufficient — direct per-intent withdrawal.
220
+ // No coins touched, enables parallel execution.
154
221
  commands.push(
155
222
  TransactionCommands.MoveCall({
156
- target: '0x2::coin::redeem_funds',
157
- typeArguments: [type === 'gas' ? SUI_TYPE : type],
223
+ target: '0x2::balance::redeem_funds',
224
+ typeArguments: [coinType],
158
225
  arguments: [
159
226
  transactionData.addInput(
160
227
  'withdrawal',
@@ -163,106 +230,170 @@ export async function resolveCoinBalance(
163
230
  $kind: 'MaxAmountU64',
164
231
  MaxAmountU64: String(balance),
165
232
  },
166
- typeArg: {
167
- $kind: 'Balance',
168
- Balance: type === 'gas' ? SUI_TYPE : type,
169
- },
170
- withdrawFrom: {
171
- $kind: 'Sender',
172
- Sender: true,
173
- },
233
+ typeArg: { $kind: 'Balance', Balance: coinType },
234
+ withdrawFrom: { $kind: 'Sender', Sender: true },
174
235
  }),
175
236
  ),
176
237
  ],
177
238
  }),
178
239
  );
240
+
241
+ intentResult = {
242
+ $kind: 'NestedResult',
243
+ NestedResult: [index + commands.length - 1, 0],
244
+ };
179
245
  } else {
180
- if (!mergedCoins.has(type)) {
181
- const addressBalance = addressBalanceByType.get(type) ?? 0n;
182
- const coinType = type === 'gas' ? SUI_TYPE : type;
246
+ // Path 2: Merge and Split — build a merged coin, split all intents at once.
183
247
 
184
- let baseCoin: Argument;
185
- let restCoins: Argument[];
248
+ if (!typeState.has(type)) {
249
+ const intents = intentsForType;
250
+
251
+ // Step 1: Build sources and merge
252
+ const sources: Argument[] = [];
186
253
 
187
254
  if (type === 'gas') {
188
- baseCoin = { $kind: 'GasCoin', GasCoin: true };
189
- restCoins = [];
255
+ sources.push({ $kind: 'GasCoin', GasCoin: true });
190
256
  } else {
191
- [baseCoin, ...restCoins] = coinsByType.get(type)!.map((coin) =>
192
- transactionData.addInput(
193
- 'object',
194
- Inputs.ObjectRef({
195
- objectId: coin.objectId,
196
- digest: coin.digest,
197
- version: coin.version,
257
+ const coins = coinsByType.get(type)!;
258
+ const loadedCoinBalance = coins.reduce((sum, c) => sum + BigInt(c.balance), 0n);
259
+ const abNeeded =
260
+ totalRequired > loadedCoinBalance ? totalRequired - loadedCoinBalance : 0n;
261
+
262
+ exactBalanceByType.set(type, loadedCoinBalance + abNeeded === totalRequired);
263
+
264
+ for (const coin of coins) {
265
+ sources.push(
266
+ transactionData.addInput(
267
+ 'object',
268
+ Inputs.ObjectRef({
269
+ objectId: coin.objectId,
270
+ digest: coin.digest,
271
+ version: coin.version,
272
+ }),
273
+ ),
274
+ );
275
+ }
276
+
277
+ if (abNeeded > 0n) {
278
+ commands.push(
279
+ TransactionCommands.MoveCall({
280
+ target: '0x2::coin::redeem_funds',
281
+ typeArguments: [coinType],
282
+ arguments: [
283
+ transactionData.addInput(
284
+ 'withdrawal',
285
+ Inputs.FundsWithdrawal({
286
+ reservation: {
287
+ $kind: 'MaxAmountU64',
288
+ MaxAmountU64: String(abNeeded),
289
+ },
290
+ typeArg: { $kind: 'Balance', Balance: coinType },
291
+ withdrawFrom: { $kind: 'Sender', Sender: true },
292
+ }),
293
+ ),
294
+ ],
198
295
  }),
199
- ),
200
- );
296
+ );
297
+ sources.push({ $kind: 'Result', Result: index + commands.length - 1 });
298
+ }
201
299
  }
202
300
 
203
- if (addressBalance > 0n) {
204
- commands.push(
205
- TransactionCommands.MoveCall({
206
- target: '0x2::coin::redeem_funds',
207
- typeArguments: [coinType],
208
- arguments: [
209
- transactionData.addInput(
210
- 'withdrawal',
211
- Inputs.FundsWithdrawal({
212
- reservation: {
213
- $kind: 'MaxAmountU64',
214
- MaxAmountU64: String(addressBalance),
215
- },
216
- typeArg: {
217
- $kind: 'Balance',
218
- Balance: coinType,
219
- },
220
- withdrawFrom: {
221
- $kind: 'Sender',
222
- Sender: true,
223
- },
224
- }),
225
- ),
226
- ],
227
- }),
228
- );
229
-
230
- commands.push(
231
- TransactionCommands.MergeCoins(baseCoin, [
232
- { $kind: 'Result', Result: index + commands.length - 1 },
233
- ...restCoins,
234
- ]),
235
- );
236
- } else if (restCoins.length > 0) {
237
- commands.push(TransactionCommands.MergeCoins(baseCoin, restCoins));
301
+ const baseCoin = sources[0];
302
+ const rest = sources.slice(1);
303
+ for (let i = 0; i < rest.length; i += 500) {
304
+ commands.push(TransactionCommands.MergeCoins(baseCoin, rest.slice(i, i + 500)));
238
305
  }
239
306
 
240
307
  mergedCoins.set(type, baseCoin);
308
+
309
+ // Step 2: Combined SplitCoins for all intents of this type
310
+ const splitCmdIndex = index + commands.length;
311
+ commands.push(
312
+ TransactionCommands.SplitCoins(
313
+ baseCoin,
314
+ intents.map((i) =>
315
+ transactionData.addInput('pure', Inputs.Pure(bcs.u64().serialize(i.balance))),
316
+ ),
317
+ ),
318
+ );
319
+
320
+ // Build per-intent results, adding into_balance conversions for balance intents
321
+ const results: Argument[] = [];
322
+ for (let i = 0; i < intents.length; i++) {
323
+ const splitResult: Argument = {
324
+ $kind: 'NestedResult',
325
+ NestedResult: [splitCmdIndex, i],
326
+ };
327
+
328
+ if (intents[i].outputKind === 'balance') {
329
+ commands.push(
330
+ TransactionCommands.MoveCall({
331
+ target: '0x2::coin::into_balance',
332
+ typeArguments: [coinType],
333
+ arguments: [splitResult],
334
+ }),
335
+ );
336
+ results.push({
337
+ $kind: 'NestedResult',
338
+ NestedResult: [index + commands.length - 1, 0],
339
+ });
340
+ } else {
341
+ results.push(splitResult);
342
+ }
343
+ }
344
+
345
+ typeState.set(type, { results, nextIntent: 0 });
241
346
  }
242
347
 
243
- commands.push(
244
- TransactionCommands.SplitCoins(mergedCoins.get(type)!, [
245
- transactionData.addInput('pure', Inputs.Pure(bcs.u64().serialize(balance))),
246
- ]),
247
- );
348
+ const state = typeState.get(type)!;
349
+ intentResult = state.results[state.nextIntent++];
248
350
  }
249
351
 
250
- transactionData.replaceCommand(index, commands);
352
+ transactionData.replaceCommand(
353
+ index,
354
+ commands,
355
+ intentResult as { NestedResult: [number, number] },
356
+ );
251
357
 
252
- transactionData.mapArguments((arg, _command, commandIndex) => {
253
- if (commandIndex >= index && commandIndex < index + commands.length) {
254
- return arg;
255
- }
358
+ // Advance past the replacement. When commands is empty (subsequent intents
359
+ // of a combined split), the command was removed and the next command shifted
360
+ // into this position — so we stay at the same index.
361
+ index += commands.length;
362
+ }
256
363
 
257
- if (arg.$kind === 'Result' && arg.Result === index) {
258
- return {
259
- $kind: 'NestedResult',
260
- NestedResult: [index + commands.length - 1, 0],
261
- };
262
- }
364
+ // Step 3: Remainder handling
365
+ for (const [type, mergedCoin] of mergedCoins) {
366
+ if (type === 'gas') continue;
263
367
 
264
- return arg;
265
- });
368
+ const hasBalanceIntent = intentsByType.get(type)?.some((i) => i.outputKind === 'balance');
369
+
370
+ if (hasBalanceIntent) {
371
+ // Balance intents exist: send remainder coin back to sender's address balance.
372
+ // coin::send_funds is gasless-eligible and handles zero amounts.
373
+ transactionData.commands.push(
374
+ TransactionCommands.MoveCall({
375
+ target: '0x2::coin::send_funds',
376
+ typeArguments: [type],
377
+ arguments: [
378
+ mergedCoin,
379
+ transactionData.addInput(
380
+ 'pure',
381
+ Inputs.Pure(bcs.Address.serialize(transactionData.sender!)),
382
+ ),
383
+ ],
384
+ }),
385
+ );
386
+ } else if (exactBalanceByType.get(type)) {
387
+ // Coin-only with exact match: destroy the zero-value dust coin.
388
+ transactionData.commands.push(
389
+ TransactionCommands.MoveCall({
390
+ target: '0x2::coin::destroy_zero',
391
+ typeArguments: [type],
392
+ arguments: [mergedCoin],
393
+ }),
394
+ );
395
+ }
396
+ // Coin-only with surplus: merged coin stays with sender as an owned object
266
397
  }
267
398
 
268
399
  return next();
@@ -324,25 +455,20 @@ async function getCoinsAndBalanceOfType({
324
455
 
325
456
  await balanceRequest;
326
457
 
327
- if (remainingBalance > 0n) {
328
- for (const coin of objects) {
329
- if (usedIds.has(coin.objectId)) {
330
- continue;
331
- }
332
-
333
- const coinBalance = BigInt(coin.balance);
334
-
335
- coins.push(coin);
336
- remainingBalance -= coinBalance;
337
-
338
- if (remainingBalance <= 0) {
339
- break;
340
- }
458
+ // Always load all coins from the page (except already-used ones).
459
+ // This merges all available coins rather than leaving dust.
460
+ for (const coin of objects) {
461
+ if (usedIds.has(coin.objectId)) {
462
+ continue;
341
463
  }
342
464
 
343
- if (hasNextPage) {
344
- return loadMoreCoins(nextCursor);
345
- }
465
+ coins.push(coin);
466
+ remainingBalance -= BigInt(coin.balance);
467
+ }
468
+
469
+ // Only paginate if loaded coins + AB are still insufficient
470
+ if (remainingBalance > 0n && hasNextPage) {
471
+ return loadMoreCoins(nextCursor);
346
472
  }
347
473
 
348
474
  return coins;
@@ -0,0 +1,84 @@
1
+ // Copyright (c) Mysten Labs, Inc.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { fromBase58, fromHex, toBase58, toHex } from '@haneullabs/bcs';
5
+ import { parse } from 'valibot';
6
+
7
+ import { bcs, TypeTagSerializer } from '../bcs/index.js';
8
+ import { ObjectRefSchema } from '../transactions/data/internal.js';
9
+ import { deriveDynamicFieldID } from './dynamic-fields.js';
10
+ import { normalizeHaneulAddress } from './index.js';
11
+
12
+ const HANEUL_ACCUMULATOR_ROOT_OBJECT_ID = normalizeHaneulAddress('0xacc');
13
+ const ACCUMULATOR_KEY_TYPE_TAG = TypeTagSerializer.parseFromStr(
14
+ '0x2::accumulator::Key<0x2::balance::Balance<0x2::haneul::HANEUL>>',
15
+ );
16
+
17
+ export const COIN_RESERVATION_MAGIC = new Uint8Array([
18
+ 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac,
19
+ 0xac, 0xac, 0xac, 0xac,
20
+ ]);
21
+
22
+ export function isCoinReservationDigest(digestBase58: string): boolean {
23
+ const digestBytes = fromBase58(digestBase58);
24
+ const last20Bytes = digestBytes.slice(12, 32);
25
+ return last20Bytes.every((byte, i) => byte === COIN_RESERVATION_MAGIC[i]);
26
+ }
27
+
28
+ export function parseCoinReservationBalance(digestBase58: string): bigint {
29
+ const digestBytes = fromBase58(digestBase58);
30
+ const view = new DataView(digestBytes.buffer, digestBytes.byteOffset, digestBytes.byteLength);
31
+ return view.getBigUint64(0, true);
32
+ }
33
+
34
+ /**
35
+ * Derives the accumulator dynamic field object ID for the given owner,
36
+ * then XORs it with the chain identifier bytes to produce the objectId
37
+ * for the coin reservation ref.
38
+ */
39
+ function deriveReservationObjectId(owner: string, chainIdentifier: string): string {
40
+ const keyBcs = bcs.Address.serialize(owner).toBytes();
41
+ const accumulatorId = deriveDynamicFieldID(
42
+ HANEUL_ACCUMULATOR_ROOT_OBJECT_ID,
43
+ ACCUMULATOR_KEY_TYPE_TAG,
44
+ keyBcs,
45
+ );
46
+
47
+ // XOR the accumulator object ID bytes with the chain identifier bytes
48
+ const accBytes = fromHex(accumulatorId.slice(2));
49
+ const chainBytes = fromBase58(chainIdentifier);
50
+ if (chainBytes.length !== 32) {
51
+ throw new Error(`Invalid chain identifier length: expected 32 bytes, got ${chainBytes.length}`);
52
+ }
53
+ const xored = new Uint8Array(32);
54
+ for (let i = 0; i < 32; i++) {
55
+ xored[i] = accBytes[i] ^ chainBytes[i];
56
+ }
57
+ return `0x${toHex(xored)}`;
58
+ }
59
+
60
+ export function createCoinReservationRef(
61
+ reservedBalance: bigint,
62
+ owner: string,
63
+ chainIdentifier: string,
64
+ epoch: string,
65
+ ) {
66
+ const digestBytes = new Uint8Array(32);
67
+ const view = new DataView(digestBytes.buffer);
68
+ // Bytes 0-7: reserved balance as LE u64
69
+ view.setBigUint64(0, reservedBalance, true);
70
+ // Bytes 8-11: epoch_id as LE u32
71
+ const epochNum = Number(epoch);
72
+ if (!Number.isSafeInteger(epochNum) || epochNum < 0 || epochNum > 0xffffffff) {
73
+ throw new Error(`Epoch ${epoch} out of u32 range for coin reservation digest`);
74
+ }
75
+ view.setUint32(8, epochNum, true);
76
+ // Bytes 12-31: magic bytes
77
+ digestBytes.set(COIN_RESERVATION_MAGIC, 12);
78
+
79
+ return parse(ObjectRefSchema, {
80
+ objectId: deriveReservationObjectId(owner, chainIdentifier),
81
+ version: '0',
82
+ digest: toBase58(digestBytes),
83
+ });
84
+ }
@@ -18,5 +18,7 @@ export const HANEUL_SYSTEM_STATE_OBJECT_ID =
18
18
  '0x0000000000000000000000000000000000000000000000000000000000000005';
19
19
  export const HANEUL_RANDOM_OBJECT_ID =
20
20
  '0x0000000000000000000000000000000000000000000000000000000000000008';
21
+ export const HANEUL_COIN_REGISTRY_OBJECT_ID =
22
+ '0x000000000000000000000000000000000000000000000000000000000000000c';
21
23
  export const HANEUL_DENY_LIST_OBJECT_ID =
22
24
  '0x0000000000000000000000000000000000000000000000000000000000000403';
@@ -19,7 +19,7 @@ export function isValidTransactionDigest(value: string): value is string {
19
19
 
20
20
  // TODO - can we automatically sync this with rust length definition?
21
21
  // Source of truth is
22
- // https://github.com/GeunhwaJeong/haneul/blob/acb2b97ae21f47600e05b0d28127d88d0725561d/crate./haneul-types/src/base_types.rs#L67
22
+ // https://github.com/GeunhwaJeong/haneul/blob/acb2b97ae21f47600e05b0d28127d88d0725561d/crates/haneul-types/src/base_types.rs#L67
23
23
  // which uses the Move account address length
24
24
  // https://github.com/move-language/move/blob/67ec40dc50c66c34fd73512fcc412f3b68d67235/language/move-core/types/src/account_address.rs#L23 .
25
25
 
@@ -97,6 +97,21 @@ export type StructTag = {
97
97
  };
98
98
 
99
99
  function parseTypeTag(type: string): string | StructTag {
100
+ if (type.startsWith('vector<')) {
101
+ if (!type.endsWith('>')) {
102
+ throw new Error(`Invalid type tag: ${type}`);
103
+ }
104
+ const inner = type.slice(7, -1);
105
+ if (!inner) {
106
+ throw new Error(`Invalid type tag: ${type}`);
107
+ }
108
+ const parsed = parseTypeTag(inner);
109
+ if (typeof parsed === 'string') {
110
+ return `vector<${parsed}>`;
111
+ }
112
+ return `vector<${normalizeStructTag(parsed)}>`;
113
+ }
114
+
100
115
  if (!type.includes('::')) return type;
101
116
 
102
117
  return parseStructTag(type);
@@ -28,6 +28,7 @@ export {
28
28
  HANEUL_TYPE_ARG,
29
29
  HANEUL_SYSTEM_STATE_OBJECT_ID,
30
30
  HANEUL_RANDOM_OBJECT_ID,
31
+ HANEUL_COIN_REGISTRY_OBJECT_ID,
31
32
  HANEUL_DENY_LIST_OBJECT_ID,
32
33
  } from './constants.js';
33
34
 
package/src/version.ts CHANGED
@@ -3,5 +3,5 @@
3
3
 
4
4
  // This file is generated by genversion.mjs. Do not edit it directly.
5
5
 
6
- export const PACKAGE_VERSION = '2.5.2';
6
+ export const PACKAGE_VERSION = '2.13.0';
7
7
  export const TARGETED_RPC_VERSION = '1.0.0';
@@ -41,7 +41,7 @@ export function toBigEndianBytes(num: bigint, width: number): Uint8Array {
41
41
  }
42
42
 
43
43
  export function getExtendedEphemeralPublicKey(publicKey: PublicKey) {
44
- return publicKey.toSuiPublicKey();
44
+ return publicKey.toHaneulPublicKey();
45
45
  }
46
46
 
47
47
  /**
@@ -1,26 +0,0 @@
1
- //#region src/jsonRpc/rpc-websocket-client.d.ts
2
-
3
- /**
4
- * Configuration options for the websocket connection
5
- */
6
- type WebsocketClientOptions = {
7
- /**
8
- * Custom WebSocket class to use. Defaults to the global WebSocket class, if available.
9
- */
10
- WebSocketConstructor?: typeof WebSocket;
11
- /**
12
- * Milliseconds before timing out while calling an RPC method
13
- */
14
- callTimeout?: number;
15
- /**
16
- * Milliseconds between attempts to connect
17
- */
18
- reconnectTimeout?: number;
19
- /**
20
- * Maximum number of times to try connecting before giving up
21
- */
22
- maxReconnects?: number;
23
- };
24
- //#endregion
25
- export { WebsocketClientOptions };
26
- //# sourceMappingURL=rpc-websocket-client.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rpc-websocket-client.d.mts","names":[],"sources":["../../src/jsonRpc/rpc-websocket-client.ts"],"sourcesContent":[],"mappings":";;;;;KA8CY,sBAAA;;;;gCAImB"}