@aptos-labs/ts-sdk 1.35.0-zeta.2 → 1.36.0-zeta.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 (596) hide show
  1. package/dist/common/{accountAddress-Ce4Cv60D.d.ts → accountAddress-C685VEzA.d.ts} +11 -99
  2. package/dist/common/chunk-5GUWOXQG.js +4 -0
  3. package/dist/common/chunk-5GUWOXQG.js.map +1 -0
  4. package/dist/common/cli/index.d.ts +1 -1
  5. package/dist/common/cli/index.js +1 -486
  6. package/dist/common/cli/index.js.map +1 -1
  7. package/dist/common/index.d.ts +9105 -8699
  8. package/dist/common/index.js +436 -18333
  9. package/dist/common/index.js.map +1 -1
  10. package/dist/esm/{Ed25519Account-D4j3_WIS.d.mts → Ed25519Account-6KGApCPu.d.mts} +3 -3
  11. package/dist/esm/account/AbstractKeylessAccount.d.mts +23 -13
  12. package/dist/esm/account/AbstractKeylessAccount.mjs +1 -75
  13. package/dist/esm/account/AbstractedAccount.d.mts +10 -10
  14. package/dist/esm/account/AbstractedAccount.mjs +1 -74
  15. package/dist/esm/account/Account.d.mts +6 -6
  16. package/dist/esm/account/Account.mjs +1 -72
  17. package/dist/esm/account/AccountUtils.d.mts +11 -10
  18. package/dist/esm/account/AccountUtils.mjs +1 -78
  19. package/dist/esm/account/Ed25519Account.d.mts +5 -5
  20. package/dist/esm/account/Ed25519Account.mjs +1 -70
  21. package/dist/esm/account/EphemeralKeyPair.d.mts +3 -1
  22. package/dist/esm/account/EphemeralKeyPair.mjs +1 -50
  23. package/dist/esm/account/FederatedKeylessAccount.d.mts +12 -11
  24. package/dist/esm/account/FederatedKeylessAccount.mjs +1 -72
  25. package/dist/esm/account/KeylessAccount.d.mts +12 -11
  26. package/dist/esm/account/KeylessAccount.mjs +1 -72
  27. package/dist/esm/account/MultiEd25519Account.d.mts +9 -9
  28. package/dist/esm/account/MultiEd25519Account.mjs +1 -70
  29. package/dist/esm/account/MultiKeyAccount.d.mts +34 -12
  30. package/dist/esm/account/MultiKeyAccount.mjs +1 -74
  31. package/dist/esm/account/SingleKeyAccount.d.mts +5 -5
  32. package/dist/esm/account/SingleKeyAccount.mjs +1 -72
  33. package/dist/esm/account/index.d.mts +7 -6
  34. package/dist/esm/account/index.mjs +1 -119
  35. package/dist/esm/account/utils.mjs +1 -54
  36. package/dist/esm/api/account/abstraction.d.mts +9 -9
  37. package/dist/esm/api/account/abstraction.mjs +1 -101
  38. package/dist/esm/api/account.d.mts +4 -20
  39. package/dist/esm/api/account.mjs +1 -105
  40. package/dist/esm/api/ans.d.mts +13 -13
  41. package/dist/esm/api/ans.mjs +1 -101
  42. package/dist/esm/api/aptos.d.mts +6 -5
  43. package/dist/esm/api/aptos.mjs +1 -139
  44. package/dist/esm/api/aptosConfig.mjs +1 -9
  45. package/dist/esm/api/coin.d.mts +9 -9
  46. package/dist/esm/api/coin.mjs +1 -100
  47. package/dist/esm/api/digitalAsset.d.mts +5 -5
  48. package/dist/esm/api/digitalAsset.mjs +1 -101
  49. package/dist/esm/api/event.mjs +1 -59
  50. package/dist/esm/api/experimental.d.mts +7 -7
  51. package/dist/esm/api/experimental.mjs +1 -85
  52. package/dist/esm/api/faucet.mjs +1 -58
  53. package/dist/esm/api/fungibleAsset.d.mts +13 -13
  54. package/dist/esm/api/fungibleAsset.mjs +1 -101
  55. package/dist/esm/api/general.d.mts +7 -7
  56. package/dist/esm/api/general.mjs +1 -85
  57. package/dist/esm/api/index.d.mts +6 -5
  58. package/dist/esm/api/index.mjs +1 -143
  59. package/dist/esm/api/keyless.d.mts +20 -19
  60. package/dist/esm/api/keyless.mjs +1 -102
  61. package/dist/esm/api/object.mjs +1 -59
  62. package/dist/esm/api/staking.mjs +1 -59
  63. package/dist/esm/api/table.mjs +1 -38
  64. package/dist/esm/api/transaction.d.mts +4 -4
  65. package/dist/esm/api/transaction.mjs +1 -110
  66. package/dist/esm/api/transactionSubmission/build.d.mts +9 -9
  67. package/dist/esm/api/transactionSubmission/build.mjs +1 -99
  68. package/dist/esm/api/transactionSubmission/helpers.mjs +1 -9
  69. package/dist/esm/api/transactionSubmission/management.d.mts +8 -8
  70. package/dist/esm/api/transactionSubmission/management.mjs +1 -105
  71. package/dist/esm/api/transactionSubmission/sign.d.mts +3 -3
  72. package/dist/esm/api/transactionSubmission/sign.mjs +1 -218
  73. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  74. package/dist/esm/api/transactionSubmission/simulate.d.mts +9 -9
  75. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -100
  76. package/dist/esm/api/transactionSubmission/submit.d.mts +3 -3
  77. package/dist/esm/api/transactionSubmission/submit.mjs +1 -100
  78. package/dist/esm/api/utils.mjs +1 -36
  79. package/dist/esm/bcs/consts.mjs +1 -17
  80. package/dist/esm/bcs/deserializer.mjs +1 -10
  81. package/dist/esm/bcs/index.mjs +1 -60
  82. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -12
  83. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -11
  84. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -26
  85. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -22
  86. package/dist/esm/bcs/serializer.mjs +1 -18
  87. package/dist/esm/chunk-2V636AYW.mjs +2 -0
  88. package/dist/esm/{chunk-3IWV2Q3K.mjs.map → chunk-2V636AYW.mjs.map} +1 -1
  89. package/dist/esm/chunk-35CO4BP4.mjs +2 -0
  90. package/dist/esm/chunk-35CO4BP4.mjs.map +1 -0
  91. package/dist/esm/chunk-35DKMW7Q.mjs +2 -0
  92. package/dist/esm/{chunk-GUA5YTIK.mjs.map → chunk-35DKMW7Q.mjs.map} +1 -1
  93. package/dist/esm/chunk-3EUHEZND.mjs +2 -0
  94. package/dist/esm/{chunk-G34CJDST.mjs.map → chunk-3EUHEZND.mjs.map} +1 -1
  95. package/dist/esm/chunk-3OLFJ65O.mjs +2 -0
  96. package/dist/esm/{chunk-G4NBRMZ2.mjs.map → chunk-3OLFJ65O.mjs.map} +1 -1
  97. package/dist/esm/chunk-3RVAGHAA.mjs +2 -0
  98. package/dist/esm/{chunk-XQFUKBY7.mjs.map → chunk-3RVAGHAA.mjs.map} +1 -1
  99. package/dist/esm/chunk-4RXKALLC.mjs +2 -0
  100. package/dist/esm/{chunk-SFLQPB72.mjs.map → chunk-4RXKALLC.mjs.map} +1 -1
  101. package/dist/esm/chunk-56CNRT2K.mjs +2 -0
  102. package/dist/esm/{chunk-SBB4YEPT.mjs.map → chunk-56CNRT2K.mjs.map} +1 -1
  103. package/dist/esm/chunk-6KE4JZD6.mjs +2 -0
  104. package/dist/esm/chunk-6KE4JZD6.mjs.map +1 -0
  105. package/dist/esm/chunk-7CRQNXR5.mjs +2 -0
  106. package/dist/esm/{chunk-YU65LNIC.mjs.map → chunk-7CRQNXR5.mjs.map} +1 -1
  107. package/dist/esm/chunk-7YTGBTWH.mjs +2 -0
  108. package/dist/esm/chunk-7YTGBTWH.mjs.map +1 -0
  109. package/dist/esm/chunk-A3VO773Q.mjs +2 -0
  110. package/dist/esm/{chunk-KLUO6XPE.mjs.map → chunk-A3VO773Q.mjs.map} +1 -1
  111. package/dist/esm/chunk-A5L76YP7.mjs +2 -0
  112. package/dist/esm/{chunk-PT2QHUB6.mjs.map → chunk-A5L76YP7.mjs.map} +1 -1
  113. package/dist/esm/chunk-AEGA5N2W.mjs +2 -0
  114. package/dist/esm/{chunk-QJ6CGH7N.mjs.map → chunk-AEGA5N2W.mjs.map} +1 -1
  115. package/dist/esm/chunk-AIPHJFJL.mjs +2 -0
  116. package/dist/esm/{chunk-6I37A76G.mjs.map → chunk-AIPHJFJL.mjs.map} +1 -1
  117. package/dist/esm/chunk-BMPHQ3E7.mjs +2 -0
  118. package/dist/esm/{chunk-MWXBQ6HR.mjs.map → chunk-BMPHQ3E7.mjs.map} +1 -1
  119. package/dist/esm/chunk-C3Q23D22.mjs +2 -0
  120. package/dist/esm/{chunk-F7W7KS5C.mjs.map → chunk-C3Q23D22.mjs.map} +1 -1
  121. package/dist/esm/chunk-CWL7ZA3P.mjs +2 -0
  122. package/dist/esm/{chunk-6T3V5LXK.mjs.map → chunk-CWL7ZA3P.mjs.map} +1 -1
  123. package/dist/esm/chunk-DOVH6HPL.mjs +2 -0
  124. package/dist/esm/{chunk-THWEBWUC.mjs.map → chunk-DOVH6HPL.mjs.map} +1 -1
  125. package/dist/esm/chunk-EODSU3YN.mjs +2 -0
  126. package/dist/esm/{chunk-WXQUBQK4.mjs.map → chunk-EODSU3YN.mjs.map} +1 -1
  127. package/dist/esm/chunk-ERLDXTIY.mjs +2 -0
  128. package/dist/esm/{chunk-6ASWESA2.mjs.map → chunk-ERLDXTIY.mjs.map} +1 -1
  129. package/dist/esm/chunk-GOXRBEIJ.mjs +2 -0
  130. package/dist/esm/{chunk-APM7OSLS.mjs.map → chunk-GOXRBEIJ.mjs.map} +1 -1
  131. package/dist/esm/chunk-HHWJHOFZ.mjs +2 -0
  132. package/dist/esm/{chunk-KSK3XIGF.mjs.map → chunk-HHWJHOFZ.mjs.map} +1 -1
  133. package/dist/esm/chunk-IF4UU2MT.mjs +2 -0
  134. package/dist/esm/{chunk-QPT4BSAB.mjs.map → chunk-IF4UU2MT.mjs.map} +1 -1
  135. package/dist/esm/chunk-IMTC3J2M.mjs +2 -0
  136. package/dist/esm/{chunk-LJRNGZMY.mjs.map → chunk-IMTC3J2M.mjs.map} +1 -1
  137. package/dist/esm/chunk-KDMSOCZY.mjs +2 -0
  138. package/dist/esm/chunk-KSLLV3ZC.mjs +2 -0
  139. package/dist/esm/{chunk-OFUNBTK4.mjs.map → chunk-KSLLV3ZC.mjs.map} +1 -1
  140. package/dist/esm/chunk-KXVD52Y6.mjs +2 -0
  141. package/dist/esm/{chunk-YT7V6AVJ.mjs.map → chunk-KXVD52Y6.mjs.map} +1 -1
  142. package/dist/esm/chunk-LGC2JORV.mjs +2 -0
  143. package/dist/esm/chunk-LGC2JORV.mjs.map +1 -0
  144. package/dist/esm/chunk-LQOSHBB7.mjs +4 -0
  145. package/dist/esm/{chunk-CXLXUSCG.mjs.map → chunk-LQOSHBB7.mjs.map} +1 -1
  146. package/dist/esm/chunk-LS3IDL2N.mjs +2 -0
  147. package/dist/esm/{chunk-MYEYZ7PF.mjs.map → chunk-LS3IDL2N.mjs.map} +1 -1
  148. package/dist/esm/chunk-MIW45ADL.mjs +2 -0
  149. package/dist/esm/chunk-MIW45ADL.mjs.map +1 -0
  150. package/dist/esm/chunk-NFPNWY6Z.mjs +4 -0
  151. package/dist/esm/chunk-NFPNWY6Z.mjs.map +1 -0
  152. package/dist/esm/chunk-PDAWVDI7.mjs +2 -0
  153. package/dist/esm/{chunk-MFFBZ43D.mjs.map → chunk-PDAWVDI7.mjs.map} +1 -1
  154. package/dist/esm/chunk-PSZYS4RG.mjs +2 -0
  155. package/dist/esm/{chunk-YK66QBML.mjs.map → chunk-PSZYS4RG.mjs.map} +1 -1
  156. package/dist/esm/chunk-R6QCPXQG.mjs +2 -0
  157. package/dist/esm/{chunk-SQNS4SFV.mjs.map → chunk-R6QCPXQG.mjs.map} +1 -1
  158. package/dist/esm/chunk-RIINVEZA.mjs +2 -0
  159. package/dist/esm/{chunk-Y3ENAKRC.mjs.map → chunk-RIINVEZA.mjs.map} +1 -1
  160. package/dist/esm/chunk-RJ7F4JDV.mjs +2 -0
  161. package/dist/esm/chunk-RJ7F4JDV.mjs.map +1 -0
  162. package/dist/esm/chunk-RXHER6EA.mjs +2 -0
  163. package/dist/esm/{chunk-C7T6GW5P.mjs.map → chunk-RXHER6EA.mjs.map} +1 -1
  164. package/dist/esm/chunk-RXMLONF7.mjs +2 -0
  165. package/dist/esm/{chunk-BU43ZFDJ.mjs.map → chunk-RXMLONF7.mjs.map} +1 -1
  166. package/dist/esm/chunk-TBY3VMMV.mjs +2 -0
  167. package/dist/esm/chunk-TBY3VMMV.mjs.map +1 -0
  168. package/dist/esm/chunk-TKXEVD7A.mjs +2 -0
  169. package/dist/esm/{chunk-QSYWLSSN.mjs.map → chunk-TKXEVD7A.mjs.map} +1 -1
  170. package/dist/esm/chunk-TNWABITK.mjs +2 -0
  171. package/dist/esm/{chunk-FRLS4GRM.mjs.map → chunk-TNWABITK.mjs.map} +1 -1
  172. package/dist/esm/chunk-TTY5GFMN.mjs +2 -0
  173. package/dist/esm/{chunk-PKUXOBIV.mjs.map → chunk-TTY5GFMN.mjs.map} +1 -1
  174. package/dist/esm/chunk-VHNX2NUR.mjs +473 -0
  175. package/dist/esm/chunk-VHNX2NUR.mjs.map +1 -0
  176. package/dist/esm/chunk-VHY6ZATX.mjs +2 -0
  177. package/dist/esm/{chunk-BDM6FBUO.mjs.map → chunk-VHY6ZATX.mjs.map} +1 -1
  178. package/dist/esm/chunk-W4BSN6SK.mjs +2 -0
  179. package/dist/esm/{chunk-ZWCTF3NQ.mjs.map → chunk-W4BSN6SK.mjs.map} +1 -1
  180. package/dist/esm/chunk-WB26DWOY.mjs +7 -0
  181. package/dist/esm/chunk-WB26DWOY.mjs.map +1 -0
  182. package/dist/esm/chunk-X5YB74NB.mjs +2 -0
  183. package/dist/esm/{chunk-I25AX6PQ.mjs.map → chunk-X5YB74NB.mjs.map} +1 -1
  184. package/dist/esm/chunk-XLDMPCLF.mjs +2 -0
  185. package/dist/esm/{chunk-WLTQHGIJ.mjs.map → chunk-XLDMPCLF.mjs.map} +1 -1
  186. package/dist/esm/chunk-YOZBVVKL.mjs +2 -0
  187. package/dist/esm/{chunk-BEYIOC2H.mjs.map → chunk-YOZBVVKL.mjs.map} +1 -1
  188. package/dist/esm/chunk-ZD2TY5N3.mjs +2 -0
  189. package/dist/esm/{chunk-NUT2VOX2.mjs.map → chunk-ZD2TY5N3.mjs.map} +1 -1
  190. package/dist/esm/chunk-ZELTLAUN.mjs +2 -0
  191. package/dist/esm/chunk-ZELTLAUN.mjs.map +1 -0
  192. package/dist/esm/cli/index.mjs +1 -20
  193. package/dist/esm/cli/localNode.mjs +1 -16
  194. package/dist/esm/cli/move.mjs +1 -7
  195. package/dist/esm/client/core.mjs +1 -34
  196. package/dist/esm/client/get.mjs +1 -41
  197. package/dist/esm/client/index.mjs +1 -69
  198. package/dist/esm/client/post.mjs +1 -43
  199. package/dist/esm/core/account/index.mjs +1 -21
  200. package/dist/esm/core/account/utils/address.mjs +1 -19
  201. package/dist/esm/core/account/utils/index.mjs +1 -20
  202. package/dist/esm/core/accountAddress.mjs +1 -16
  203. package/dist/esm/core/authenticationKey.d.mts +3 -1
  204. package/dist/esm/core/authenticationKey.mjs +1 -15
  205. package/dist/esm/core/common.mjs +1 -7
  206. package/dist/esm/core/crypto/abstraction.d.mts +4 -1
  207. package/dist/esm/core/crypto/abstraction.mjs +1 -26
  208. package/dist/esm/core/crypto/ed25519.d.mts +18 -1
  209. package/dist/esm/core/crypto/ed25519.mjs +1 -33
  210. package/dist/esm/core/crypto/ephemeral.d.mts +8 -1
  211. package/dist/esm/core/crypto/ephemeral.mjs +1 -30
  212. package/dist/esm/core/crypto/federatedKeyless.d.mts +11 -87
  213. package/dist/esm/core/crypto/federatedKeyless.mjs +1 -44
  214. package/dist/esm/core/crypto/hdKey.mjs +1 -25
  215. package/dist/esm/core/crypto/index.d.mts +8 -6
  216. package/dist/esm/core/crypto/index.mjs +1 -173
  217. package/dist/esm/core/crypto/keyless.d.mts +13 -586
  218. package/dist/esm/core/crypto/keyless.mjs +1 -83
  219. package/dist/esm/core/crypto/multiEd25519.d.mts +14 -4
  220. package/dist/esm/core/crypto/multiEd25519.mjs +1 -50
  221. package/dist/esm/core/crypto/multiKey.d.mts +39 -3
  222. package/dist/esm/core/crypto/multiKey.mjs +1 -51
  223. package/dist/esm/core/crypto/poseidon.mjs +1 -15
  224. package/dist/esm/core/crypto/privateKey.d.mts +3 -1
  225. package/dist/esm/core/crypto/privateKey.mjs +1 -12
  226. package/dist/esm/core/crypto/proof.mjs +1 -20
  227. package/dist/esm/core/crypto/publicKey.d.mts +3 -1
  228. package/dist/esm/core/crypto/publicKey.mjs +1 -22
  229. package/dist/esm/core/crypto/secp256k1.d.mts +26 -2
  230. package/dist/esm/core/crypto/secp256k1.mjs +1 -29
  231. package/dist/esm/core/crypto/signature.mjs +1 -20
  232. package/dist/esm/core/crypto/singleKey.d.mts +27 -5
  233. package/dist/esm/core/crypto/singleKey.mjs +1 -48
  234. package/dist/esm/core/crypto/utils.mjs +1 -9
  235. package/dist/esm/core/hex.mjs +1 -12
  236. package/dist/esm/core/index.d.mts +8 -6
  237. package/dist/esm/core/index.mjs +1 -202
  238. package/dist/esm/errors/index.d.mts +10 -2
  239. package/dist/esm/errors/index.mjs +1 -25
  240. package/dist/esm/federatedKeyless-Qe_j8OqV.d.mts +875 -0
  241. package/dist/esm/index.d.mts +11 -10
  242. package/dist/esm/index.mjs +1 -798
  243. package/dist/esm/internal/abstraction.d.mts +9 -9
  244. package/dist/esm/internal/abstraction.mjs +1 -103
  245. package/dist/esm/internal/account.d.mts +7 -24
  246. package/dist/esm/internal/account.mjs +1 -142
  247. package/dist/esm/internal/ans.d.mts +13 -13
  248. package/dist/esm/internal/ans.mjs +1 -138
  249. package/dist/esm/internal/coin.d.mts +7 -7
  250. package/dist/esm/internal/coin.mjs +1 -99
  251. package/dist/esm/internal/digitalAsset.d.mts +2 -2
  252. package/dist/esm/internal/digitalAsset.mjs +1 -145
  253. package/dist/esm/internal/event.mjs +1 -62
  254. package/dist/esm/internal/experimental.d.mts +7 -7
  255. package/dist/esm/internal/experimental.mjs +1 -84
  256. package/dist/esm/internal/faucet.mjs +1 -57
  257. package/dist/esm/internal/fungibleAsset.d.mts +2 -2
  258. package/dist/esm/internal/fungibleAsset.mjs +1 -105
  259. package/dist/esm/internal/general.mjs +1 -43
  260. package/dist/esm/internal/keyless.d.mts +10 -20
  261. package/dist/esm/internal/keyless.mjs +1 -107
  262. package/dist/esm/internal/object.mjs +1 -58
  263. package/dist/esm/internal/staking.mjs +1 -60
  264. package/dist/esm/internal/table.mjs +1 -38
  265. package/dist/esm/internal/transaction.mjs +1 -57
  266. package/dist/esm/internal/transactionSubmission.d.mts +6 -6
  267. package/dist/esm/internal/transactionSubmission.mjs +1 -118
  268. package/dist/esm/internal/utils/index.mjs +1 -38
  269. package/dist/esm/internal/utils/utils.mjs +1 -37
  270. package/dist/esm/internal/view.d.mts +7 -7
  271. package/dist/esm/internal/view.mjs +1 -86
  272. package/dist/esm/{publicKey-BMtGNNLg.d.mts → publicKey-pDHBAZlT.d.mts} +27 -1
  273. package/dist/esm/transactions/authenticator/account.d.mts +3 -1
  274. package/dist/esm/transactions/authenticator/account.mjs +1 -67
  275. package/dist/esm/transactions/authenticator/index.d.mts +3 -1
  276. package/dist/esm/transactions/authenticator/index.mjs +1 -82
  277. package/dist/esm/transactions/authenticator/transaction.d.mts +4 -2
  278. package/dist/esm/transactions/authenticator/transaction.mjs +1 -66
  279. package/dist/esm/transactions/index.d.mts +4 -4
  280. package/dist/esm/transactions/index.mjs +1 -296
  281. package/dist/esm/transactions/instances/chainId.mjs +1 -11
  282. package/dist/esm/transactions/instances/identifier.mjs +1 -11
  283. package/dist/esm/transactions/instances/index.d.mts +4 -2
  284. package/dist/esm/transactions/instances/index.mjs +1 -114
  285. package/dist/esm/transactions/instances/moduleId.mjs +1 -55
  286. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -60
  287. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -65
  288. package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +3 -1
  289. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -21
  290. package/dist/esm/transactions/instances/signedTransaction.d.mts +3 -1
  291. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -63
  292. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -60
  293. package/dist/esm/transactions/instances/transactionArgument.mjs +1 -1
  294. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -73
  295. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +2 -2
  296. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -101
  297. package/dist/esm/transactions/management/asyncQueue.mjs +1 -9
  298. package/dist/esm/transactions/management/index.d.mts +2 -2
  299. package/dist/esm/transactions/management/index.mjs +1 -111
  300. package/dist/esm/transactions/management/transactionWorker.d.mts +3 -3
  301. package/dist/esm/transactions/management/transactionWorker.mjs +1 -107
  302. package/dist/esm/transactions/scriptComposer/index.d.mts +7 -7
  303. package/dist/esm/transactions/scriptComposer/index.mjs +1 -80
  304. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +8 -8
  305. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -92
  306. package/dist/esm/transactions/transactionBuilder/index.d.mts +8 -8
  307. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -166
  308. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +34 -23
  309. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -74
  310. package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +7 -7
  311. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -75
  312. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +8 -8
  313. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -97
  314. package/dist/esm/transactions/typeTag/index.d.mts +16 -0
  315. package/dist/esm/transactions/typeTag/index.mjs +1 -91
  316. package/dist/esm/transactions/typeTag/parser.mjs +1 -60
  317. package/dist/esm/transactions/types.d.mts +5 -5
  318. package/dist/esm/transactions/types.mjs +1 -1
  319. package/dist/esm/types/abstraction.mjs +1 -7
  320. package/dist/esm/types/generated/operations.d.mts +10 -63
  321. package/dist/esm/types/generated/queries.d.mts +2 -10
  322. package/dist/esm/types/generated/queries.mjs +1 -69
  323. package/dist/esm/types/generated/types.d.mts +1054 -824
  324. package/dist/esm/types/generated/types.mjs +1 -774
  325. package/dist/esm/types/generated/types.mjs.map +1 -1
  326. package/dist/esm/types/index.d.mts +2 -2
  327. package/dist/esm/types/index.mjs +1 -82
  328. package/dist/esm/types/indexer.d.mts +2 -14
  329. package/dist/esm/types/indexer.mjs +1 -1
  330. package/dist/esm/types/keyless.d.mts +1 -1
  331. package/dist/esm/types/types.d.mts +3 -58
  332. package/dist/esm/types/types.mjs +1 -77
  333. package/dist/esm/utils/apiEndpoints.mjs +1 -21
  334. package/dist/esm/utils/const.d.mts +1 -1
  335. package/dist/esm/utils/const.mjs +1 -25
  336. package/dist/esm/utils/helpers.d.mts +2 -1
  337. package/dist/esm/utils/helpers.mjs +1 -37
  338. package/dist/esm/utils/index.d.mts +1 -1
  339. package/dist/esm/utils/index.mjs +1 -88
  340. package/dist/esm/utils/memoize.mjs +1 -9
  341. package/dist/esm/utils/normalizeBundle.mjs +1 -20
  342. package/dist/esm/version.d.mts +1 -1
  343. package/dist/esm/version.mjs +1 -7
  344. package/package.json +3 -3
  345. package/src/account/AbstractKeylessAccount.ts +33 -49
  346. package/src/account/MultiKeyAccount.ts +23 -16
  347. package/src/api/account.ts +2 -56
  348. package/src/cli/localNode.ts +6 -15
  349. package/src/core/crypto/abstraction.ts +6 -1
  350. package/src/core/crypto/ed25519.ts +19 -1
  351. package/src/core/crypto/ephemeral.ts +9 -0
  352. package/src/core/crypto/federatedKeyless.ts +40 -4
  353. package/src/core/crypto/index.ts +4 -3
  354. package/src/core/crypto/keyless.ts +577 -17
  355. package/src/core/crypto/multiEd25519.ts +11 -3
  356. package/src/core/crypto/multiKey.ts +74 -4
  357. package/src/core/crypto/publicKey.ts +28 -0
  358. package/src/core/crypto/secp256k1.ts +25 -2
  359. package/src/core/crypto/singleKey.ts +32 -7
  360. package/src/errors/index.ts +50 -0
  361. package/src/internal/account.ts +2 -395
  362. package/src/internal/keyless.ts +9 -17
  363. package/src/transactions/scriptComposer/index.ts +19 -6
  364. package/src/transactions/transactionBuilder/remoteAbi.ts +107 -35
  365. package/src/transactions/typeTag/index.ts +22 -0
  366. package/src/types/codegen.yaml +1 -1
  367. package/src/types/generated/operations.ts +8 -69
  368. package/src/types/generated/queries.ts +0 -111
  369. package/src/types/generated/types.ts +1159 -951
  370. package/src/types/indexer.ts +0 -16
  371. package/src/types/keyless.ts +1 -1
  372. package/src/types/types.ts +3 -62
  373. package/src/utils/const.ts +1 -1
  374. package/src/utils/helpers.ts +11 -0
  375. package/src/version.ts +1 -1
  376. package/dist/common/chunk-JMOQXLED.js +0 -1305
  377. package/dist/common/chunk-JMOQXLED.js.map +0 -1
  378. package/dist/esm/chunk-2FTF6J7F.mjs +0 -97
  379. package/dist/esm/chunk-2FTF6J7F.mjs.map +0 -1
  380. package/dist/esm/chunk-2HL7JEFC.mjs +0 -829
  381. package/dist/esm/chunk-2HL7JEFC.mjs.map +0 -1
  382. package/dist/esm/chunk-2WBJAKBO.mjs +0 -53
  383. package/dist/esm/chunk-2WBJAKBO.mjs.map +0 -1
  384. package/dist/esm/chunk-32UQAST6.mjs +0 -296
  385. package/dist/esm/chunk-32UQAST6.mjs.map +0 -1
  386. package/dist/esm/chunk-3DAVHDK4.mjs +0 -195
  387. package/dist/esm/chunk-3DAVHDK4.mjs.map +0 -1
  388. package/dist/esm/chunk-3IWV2Q3K.mjs +0 -12
  389. package/dist/esm/chunk-3TUV6YMI.mjs +0 -305
  390. package/dist/esm/chunk-3TUV6YMI.mjs.map +0 -1
  391. package/dist/esm/chunk-4NMDYPUD.mjs +0 -1
  392. package/dist/esm/chunk-56UCIGTO.mjs +0 -21
  393. package/dist/esm/chunk-56UCIGTO.mjs.map +0 -1
  394. package/dist/esm/chunk-5ORUQZAR.mjs +0 -100
  395. package/dist/esm/chunk-5ORUQZAR.mjs.map +0 -1
  396. package/dist/esm/chunk-5QHMFYVL.mjs +0 -42
  397. package/dist/esm/chunk-5QHMFYVL.mjs.map +0 -1
  398. package/dist/esm/chunk-62LC4PPC.mjs +0 -128
  399. package/dist/esm/chunk-62LC4PPC.mjs.map +0 -1
  400. package/dist/esm/chunk-6ASWESA2.mjs +0 -77
  401. package/dist/esm/chunk-6I37A76G.mjs +0 -29
  402. package/dist/esm/chunk-6OFCIXWS.mjs +0 -379
  403. package/dist/esm/chunk-6OFCIXWS.mjs.map +0 -1
  404. package/dist/esm/chunk-6SNGKTWE.mjs +0 -91
  405. package/dist/esm/chunk-6SNGKTWE.mjs.map +0 -1
  406. package/dist/esm/chunk-6T3V5LXK.mjs +0 -119
  407. package/dist/esm/chunk-7F32C225.mjs +0 -219
  408. package/dist/esm/chunk-7F32C225.mjs.map +0 -1
  409. package/dist/esm/chunk-7WW735TU.mjs +0 -276
  410. package/dist/esm/chunk-7WW735TU.mjs.map +0 -1
  411. package/dist/esm/chunk-A33OBGVN.mjs +0 -1014
  412. package/dist/esm/chunk-A33OBGVN.mjs.map +0 -1
  413. package/dist/esm/chunk-A7LYGPFL.mjs +0 -208
  414. package/dist/esm/chunk-A7LYGPFL.mjs.map +0 -1
  415. package/dist/esm/chunk-AGKEC2IM.mjs +0 -250
  416. package/dist/esm/chunk-AGKEC2IM.mjs.map +0 -1
  417. package/dist/esm/chunk-AKXCFBYF.mjs +0 -49
  418. package/dist/esm/chunk-AKXCFBYF.mjs.map +0 -1
  419. package/dist/esm/chunk-APM7OSLS.mjs +0 -122
  420. package/dist/esm/chunk-BDM6FBUO.mjs +0 -198
  421. package/dist/esm/chunk-BEYIOC2H.mjs +0 -34
  422. package/dist/esm/chunk-BMM72IIP.mjs +0 -250
  423. package/dist/esm/chunk-BMM72IIP.mjs.map +0 -1
  424. package/dist/esm/chunk-BSCOVLWS.mjs +0 -1
  425. package/dist/esm/chunk-BSCOVLWS.mjs.map +0 -1
  426. package/dist/esm/chunk-BU43ZFDJ.mjs +0 -281
  427. package/dist/esm/chunk-C7EEG6SW.mjs +0 -689
  428. package/dist/esm/chunk-C7EEG6SW.mjs.map +0 -1
  429. package/dist/esm/chunk-C7T6GW5P.mjs +0 -376
  430. package/dist/esm/chunk-CXLXUSCG.mjs +0 -417
  431. package/dist/esm/chunk-D4MW64RH.mjs +0 -188
  432. package/dist/esm/chunk-D4MW64RH.mjs.map +0 -1
  433. package/dist/esm/chunk-D6RXVCE3.mjs +0 -86
  434. package/dist/esm/chunk-D6RXVCE3.mjs.map +0 -1
  435. package/dist/esm/chunk-DDZGHA66.mjs +0 -495
  436. package/dist/esm/chunk-DDZGHA66.mjs.map +0 -1
  437. package/dist/esm/chunk-DGDZNHUJ.mjs +0 -72
  438. package/dist/esm/chunk-DGDZNHUJ.mjs.map +0 -1
  439. package/dist/esm/chunk-DMFRIING.mjs +0 -286
  440. package/dist/esm/chunk-DMFRIING.mjs.map +0 -1
  441. package/dist/esm/chunk-E7FWVXGX.mjs +0 -1
  442. package/dist/esm/chunk-E7FWVXGX.mjs.map +0 -1
  443. package/dist/esm/chunk-EBFKT35C.mjs +0 -66
  444. package/dist/esm/chunk-EBFKT35C.mjs.map +0 -1
  445. package/dist/esm/chunk-ECTX2FGD.mjs +0 -355
  446. package/dist/esm/chunk-ECTX2FGD.mjs.map +0 -1
  447. package/dist/esm/chunk-EPTUAWRA.mjs +0 -895
  448. package/dist/esm/chunk-EPTUAWRA.mjs.map +0 -1
  449. package/dist/esm/chunk-F4VI7BNX.mjs +0 -58
  450. package/dist/esm/chunk-F4VI7BNX.mjs.map +0 -1
  451. package/dist/esm/chunk-F7W7KS5C.mjs +0 -52
  452. package/dist/esm/chunk-FDMI4BUL.mjs +0 -611
  453. package/dist/esm/chunk-FDMI4BUL.mjs.map +0 -1
  454. package/dist/esm/chunk-FMNMYKYH.mjs +0 -71
  455. package/dist/esm/chunk-FMNMYKYH.mjs.map +0 -1
  456. package/dist/esm/chunk-FRLS4GRM.mjs +0 -62
  457. package/dist/esm/chunk-G34CJDST.mjs +0 -139
  458. package/dist/esm/chunk-G4NBRMZ2.mjs +0 -7
  459. package/dist/esm/chunk-G6R77JKO.mjs +0 -121
  460. package/dist/esm/chunk-G6R77JKO.mjs.map +0 -1
  461. package/dist/esm/chunk-G7BB6K4B.mjs +0 -167
  462. package/dist/esm/chunk-G7BB6K4B.mjs.map +0 -1
  463. package/dist/esm/chunk-GCQK2S5Q.mjs +0 -43
  464. package/dist/esm/chunk-GCQK2S5Q.mjs.map +0 -1
  465. package/dist/esm/chunk-GFPEB22G.mjs +0 -1
  466. package/dist/esm/chunk-GFPEB22G.mjs.map +0 -1
  467. package/dist/esm/chunk-GUA5YTIK.mjs +0 -362
  468. package/dist/esm/chunk-HBXBODME.mjs +0 -84
  469. package/dist/esm/chunk-HBXBODME.mjs.map +0 -1
  470. package/dist/esm/chunk-HEZ2ZYZA.mjs +0 -1
  471. package/dist/esm/chunk-HEZ2ZYZA.mjs.map +0 -1
  472. package/dist/esm/chunk-HKQY5GXT.mjs +0 -231
  473. package/dist/esm/chunk-HKQY5GXT.mjs.map +0 -1
  474. package/dist/esm/chunk-HL337SEM.mjs +0 -219
  475. package/dist/esm/chunk-HL337SEM.mjs.map +0 -1
  476. package/dist/esm/chunk-HQDHSKVS.mjs +0 -74
  477. package/dist/esm/chunk-HQDHSKVS.mjs.map +0 -1
  478. package/dist/esm/chunk-I25AX6PQ.mjs +0 -7
  479. package/dist/esm/chunk-I5G7XFGT.mjs +0 -86
  480. package/dist/esm/chunk-I5G7XFGT.mjs.map +0 -1
  481. package/dist/esm/chunk-IHYTP2EW.mjs +0 -1
  482. package/dist/esm/chunk-IHYTP2EW.mjs.map +0 -1
  483. package/dist/esm/chunk-IJ7XCPP3.mjs +0 -480
  484. package/dist/esm/chunk-IJ7XCPP3.mjs.map +0 -1
  485. package/dist/esm/chunk-ILTEOGFF.mjs +0 -407
  486. package/dist/esm/chunk-ILTEOGFF.mjs.map +0 -1
  487. package/dist/esm/chunk-IP7GATDH.mjs +0 -322
  488. package/dist/esm/chunk-IP7GATDH.mjs.map +0 -1
  489. package/dist/esm/chunk-IPUAVRGL.mjs +0 -248
  490. package/dist/esm/chunk-IPUAVRGL.mjs.map +0 -1
  491. package/dist/esm/chunk-IQVHXOD3.mjs +0 -192
  492. package/dist/esm/chunk-IQVHXOD3.mjs.map +0 -1
  493. package/dist/esm/chunk-JAZJE3OR.mjs +0 -45
  494. package/dist/esm/chunk-JAZJE3OR.mjs.map +0 -1
  495. package/dist/esm/chunk-JEVGHYEP.mjs +0 -162
  496. package/dist/esm/chunk-JEVGHYEP.mjs.map +0 -1
  497. package/dist/esm/chunk-JFMFZ2IL.mjs +0 -147
  498. package/dist/esm/chunk-JFMFZ2IL.mjs.map +0 -1
  499. package/dist/esm/chunk-JQIRRM7G.mjs +0 -195
  500. package/dist/esm/chunk-JQIRRM7G.mjs.map +0 -1
  501. package/dist/esm/chunk-JXCZTOYC.mjs +0 -1
  502. package/dist/esm/chunk-JXCZTOYC.mjs.map +0 -1
  503. package/dist/esm/chunk-K5OCDM3W.mjs +0 -207
  504. package/dist/esm/chunk-K5OCDM3W.mjs.map +0 -1
  505. package/dist/esm/chunk-KLUO6XPE.mjs +0 -33
  506. package/dist/esm/chunk-KSK3XIGF.mjs +0 -502
  507. package/dist/esm/chunk-KW64NP2F.mjs +0 -71
  508. package/dist/esm/chunk-KW64NP2F.mjs.map +0 -1
  509. package/dist/esm/chunk-LJRNGZMY.mjs +0 -10
  510. package/dist/esm/chunk-MFFBZ43D.mjs +0 -45
  511. package/dist/esm/chunk-MWXBQ6HR.mjs +0 -15
  512. package/dist/esm/chunk-MYEYZ7PF.mjs +0 -46
  513. package/dist/esm/chunk-NUT2VOX2.mjs +0 -317
  514. package/dist/esm/chunk-OFUNBTK4.mjs +0 -169
  515. package/dist/esm/chunk-ORCQEMJL.mjs +0 -51
  516. package/dist/esm/chunk-ORCQEMJL.mjs.map +0 -1
  517. package/dist/esm/chunk-PGFEUN7K.mjs +0 -129
  518. package/dist/esm/chunk-PGFEUN7K.mjs.map +0 -1
  519. package/dist/esm/chunk-PKUXOBIV.mjs +0 -138
  520. package/dist/esm/chunk-PT2QHUB6.mjs +0 -96
  521. package/dist/esm/chunk-QJ6CGH7N.mjs +0 -71
  522. package/dist/esm/chunk-QPT4BSAB.mjs +0 -20
  523. package/dist/esm/chunk-QSYWLSSN.mjs +0 -216
  524. package/dist/esm/chunk-QYNYDQE3.mjs +0 -288
  525. package/dist/esm/chunk-QYNYDQE3.mjs.map +0 -1
  526. package/dist/esm/chunk-R45SPK6Q.mjs +0 -61
  527. package/dist/esm/chunk-R45SPK6Q.mjs.map +0 -1
  528. package/dist/esm/chunk-R4JTQQBX.mjs +0 -37
  529. package/dist/esm/chunk-R4JTQQBX.mjs.map +0 -1
  530. package/dist/esm/chunk-RCXGTN36.mjs +0 -58
  531. package/dist/esm/chunk-RCXGTN36.mjs.map +0 -1
  532. package/dist/esm/chunk-RMMOF53Q.mjs +0 -1
  533. package/dist/esm/chunk-RMMOF53Q.mjs.map +0 -1
  534. package/dist/esm/chunk-RQS33JAS.mjs +0 -77
  535. package/dist/esm/chunk-RQS33JAS.mjs.map +0 -1
  536. package/dist/esm/chunk-SAWN7RJP.mjs +0 -15
  537. package/dist/esm/chunk-SAWN7RJP.mjs.map +0 -1
  538. package/dist/esm/chunk-SBB4YEPT.mjs +0 -17
  539. package/dist/esm/chunk-SFLQPB72.mjs +0 -63
  540. package/dist/esm/chunk-SPI2HO3E.mjs +0 -177
  541. package/dist/esm/chunk-SPI2HO3E.mjs.map +0 -1
  542. package/dist/esm/chunk-SPVJXZL5.mjs +0 -865
  543. package/dist/esm/chunk-SPVJXZL5.mjs.map +0 -1
  544. package/dist/esm/chunk-SQNS4SFV.mjs +0 -232
  545. package/dist/esm/chunk-SRXIHVZE.mjs +0 -50
  546. package/dist/esm/chunk-SRXIHVZE.mjs.map +0 -1
  547. package/dist/esm/chunk-T4BFWV46.mjs +0 -63
  548. package/dist/esm/chunk-T4BFWV46.mjs.map +0 -1
  549. package/dist/esm/chunk-T573PCIR.mjs +0 -700
  550. package/dist/esm/chunk-T573PCIR.mjs.map +0 -1
  551. package/dist/esm/chunk-TDLL7QX5.mjs +0 -239
  552. package/dist/esm/chunk-TDLL7QX5.mjs.map +0 -1
  553. package/dist/esm/chunk-TFW6N66T.mjs +0 -415
  554. package/dist/esm/chunk-TFW6N66T.mjs.map +0 -1
  555. package/dist/esm/chunk-THWEBWUC.mjs +0 -20
  556. package/dist/esm/chunk-TJDF4CXI.mjs +0 -513
  557. package/dist/esm/chunk-TJDF4CXI.mjs.map +0 -1
  558. package/dist/esm/chunk-TL4Z4KHK.mjs +0 -70
  559. package/dist/esm/chunk-TL4Z4KHK.mjs.map +0 -1
  560. package/dist/esm/chunk-UGFIWCJQ.mjs +0 -130
  561. package/dist/esm/chunk-UGFIWCJQ.mjs.map +0 -1
  562. package/dist/esm/chunk-UGKZQUGE.mjs +0 -367
  563. package/dist/esm/chunk-UGKZQUGE.mjs.map +0 -1
  564. package/dist/esm/chunk-UIRAXHDH.mjs +0 -1
  565. package/dist/esm/chunk-UIRAXHDH.mjs.map +0 -1
  566. package/dist/esm/chunk-UK7SPHIE.mjs +0 -420
  567. package/dist/esm/chunk-UK7SPHIE.mjs.map +0 -1
  568. package/dist/esm/chunk-UOHCJOXI.mjs +0 -150
  569. package/dist/esm/chunk-UOHCJOXI.mjs.map +0 -1
  570. package/dist/esm/chunk-WHSS6I7T.mjs +0 -90
  571. package/dist/esm/chunk-WHSS6I7T.mjs.map +0 -1
  572. package/dist/esm/chunk-WLTQHGIJ.mjs +0 -177
  573. package/dist/esm/chunk-WUM247HF.mjs +0 -125
  574. package/dist/esm/chunk-WUM247HF.mjs.map +0 -1
  575. package/dist/esm/chunk-WXQUBQK4.mjs +0 -19
  576. package/dist/esm/chunk-X4N5BN3S.mjs +0 -40
  577. package/dist/esm/chunk-X4N5BN3S.mjs.map +0 -1
  578. package/dist/esm/chunk-XIBOO3WF.mjs +0 -168
  579. package/dist/esm/chunk-XIBOO3WF.mjs.map +0 -1
  580. package/dist/esm/chunk-XQFUKBY7.mjs +0 -136
  581. package/dist/esm/chunk-XX6C2QGI.mjs +0 -160
  582. package/dist/esm/chunk-XX6C2QGI.mjs.map +0 -1
  583. package/dist/esm/chunk-Y3ENAKRC.mjs +0 -73
  584. package/dist/esm/chunk-Y3M32DIB.mjs +0 -79
  585. package/dist/esm/chunk-Y3M32DIB.mjs.map +0 -1
  586. package/dist/esm/chunk-YK66QBML.mjs +0 -89
  587. package/dist/esm/chunk-YT7V6AVJ.mjs +0 -66
  588. package/dist/esm/chunk-YU65LNIC.mjs +0 -72
  589. package/dist/esm/chunk-ZRBUAZZD.mjs +0 -36
  590. package/dist/esm/chunk-ZRBUAZZD.mjs.map +0 -1
  591. package/dist/esm/chunk-ZWCTF3NQ.mjs +0 -25
  592. package/src/internal/queries/getAccountAddressForAuthKey.graphql +0 -8
  593. package/src/internal/queries/getAuthKeysForPublicKey.graphql +0 -9
  594. package/src/internal/queries/getMultiKeyForAuthKey.graphql +0 -9
  595. package/src/internal/queries/getSignatures.graphql +0 -13
  596. /package/dist/esm/{chunk-4NMDYPUD.mjs.map → chunk-KDMSOCZY.mjs.map} +0 -0
@@ -1,1305 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __decorateClass = (decorators, target, key, kind) => {
4
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
- if (decorator = decorators[i])
7
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
- if (kind && result) __defProp(target, key, result);
9
- return result;
10
- };
11
-
12
- // src/core/common.ts
13
- var ParsingError = class extends Error {
14
- /**
15
- * Creates an instance of the error with a specified message and invalid reason.
16
- *
17
- * @param message The error message that describes the issue.
18
- * @param invalidReason The reason why the input is considered invalid.
19
- * @group Implementation
20
- * @category Serialization
21
- */
22
- constructor(message, invalidReason) {
23
- super(message);
24
- this.invalidReason = invalidReason;
25
- }
26
- };
27
-
28
- // src/core/hex.ts
29
- var _utils = require('@noble/hashes/utils');
30
- var HexInvalidReason = /* @__PURE__ */ ((HexInvalidReason2) => {
31
- HexInvalidReason2["TOO_SHORT"] = "too_short";
32
- HexInvalidReason2["INVALID_LENGTH"] = "invalid_length";
33
- HexInvalidReason2["INVALID_HEX_CHARS"] = "invalid_hex_chars";
34
- return HexInvalidReason2;
35
- })(HexInvalidReason || {});
36
- var Hex = class _Hex {
37
- /**
38
- * Create a new Hex instance from a Uint8Array.
39
- *
40
- * @param data - The Uint8Array containing the data to initialize the Hex instance.
41
- * @group Implementation
42
- * @category Serialization
43
- */
44
- constructor(data) {
45
- this.data = data;
46
- }
47
- // ===
48
- // Methods for representing an instance of Hex as other types.
49
- // ===
50
- /**
51
- * Get the inner hex data as a Uint8Array. The inner data is already a Uint8Array, so no conversion takes place.
52
- *
53
- * @returns Hex data as Uint8Array
54
- * @group Implementation
55
- * @category Serialization
56
- */
57
- toUint8Array() {
58
- return this.data;
59
- }
60
- /**
61
- * Get the hex data as a string without the 0x prefix.
62
- *
63
- * @returns Hex string without 0x prefix
64
- * @group Implementation
65
- * @category Serialization
66
- */
67
- toStringWithoutPrefix() {
68
- return _utils.bytesToHex.call(void 0, this.data);
69
- }
70
- /**
71
- * Get the hex data as a string with the 0x prefix.
72
- *
73
- * @returns Hex string with 0x prefix
74
- * @group Implementation
75
- * @category Serialization
76
- */
77
- toString() {
78
- return `0x${this.toStringWithoutPrefix()}`;
79
- }
80
- // ===
81
- // Methods for creating an instance of Hex from other types.
82
- // ===
83
- /**
84
- * Converts a hex string into a Hex instance, allowing for both prefixed and non-prefixed formats.
85
- *
86
- * @param str - A hex string, with or without the 0x prefix.
87
- *
88
- * @throws ParsingError - If the hex string is too short, has an odd number of characters, or contains invalid hex characters.
89
- *
90
- * @returns Hex - The resulting Hex instance created from the provided string.
91
- * @group Implementation
92
- * @category Serialization
93
- */
94
- static fromHexString(str) {
95
- let input = str;
96
- if (input.startsWith("0x")) {
97
- input = input.slice(2);
98
- }
99
- if (input.length === 0) {
100
- throw new ParsingError(
101
- "Hex string is too short, must be at least 1 char long, excluding the optional leading 0x.",
102
- "too_short" /* TOO_SHORT */
103
- );
104
- }
105
- if (input.length % 2 !== 0) {
106
- throw new ParsingError("Hex string must be an even number of hex characters.", "invalid_length" /* INVALID_LENGTH */);
107
- }
108
- try {
109
- return new _Hex(_utils.hexToBytes.call(void 0, input));
110
- } catch (error) {
111
- throw new ParsingError(
112
- `Hex string contains invalid hex characters: ${_optionalChain([error, 'optionalAccess', _ => _.message])}`,
113
- "invalid_hex_chars" /* INVALID_HEX_CHARS */
114
- );
115
- }
116
- }
117
- /**
118
- * Converts an instance of HexInput, which can be a string or a Uint8Array, into a Hex instance.
119
- * This function is useful for transforming hexadecimal representations into a structured Hex object for further manipulation.
120
- *
121
- * @param hexInput - A HexInput which can be a string or Uint8Array.
122
- * @returns A Hex instance created from the provided hexInput.
123
- * @group Implementation
124
- * @category Serialization
125
- */
126
- static fromHexInput(hexInput) {
127
- if (hexInput instanceof Buffer) return new _Hex(new Uint8Array(hexInput));
128
- if (hexInput instanceof Uint8Array) return new _Hex(hexInput);
129
- if (typeof hexInput === "string") return _Hex.fromHexString(hexInput);
130
- throw new Error(`Invalid hex input type: ${typeof hexInput}`);
131
- }
132
- /**
133
- * Converts an instance of HexInput, which can be a string or a Uint8Array, into a Uint8Array.
134
- *
135
- * @param hexInput - A HexInput which can be a string or Uint8Array.
136
- * @returns A Uint8Array created from the provided hexInput.
137
- */
138
- static hexInputToUint8Array(hexInput) {
139
- if (hexInput instanceof Uint8Array) return hexInput;
140
- return _Hex.fromHexString(hexInput).toUint8Array();
141
- }
142
- /**
143
- * Converts a HexInput (string or Uint8Array) to a hex string with '0x' prefix.
144
- *
145
- * @param hexInput - The input to convert, either a hex string (with/without '0x' prefix) or Uint8Array
146
- * @returns A hex string with '0x' prefix (e.g., "0x1234")
147
- *
148
- * @example
149
- * ```typescript
150
- * Hex.hexInputToString("1234") // returns "0x1234"
151
- * Hex.hexInputToString("0x1234") // returns "0x1234"
152
- * Hex.hexInputToString(new Uint8Array([0x12, 0x34])) // returns "0x1234"
153
- * ```
154
- */
155
- static hexInputToString(hexInput) {
156
- return _Hex.fromHexInput(hexInput).toString();
157
- }
158
- /**
159
- * Converts a HexInput (string or Uint8Array) to a hex string without '0x' prefix.
160
- *
161
- * @param hexInput - The input to convert, either a hex string (with/without '0x' prefix) or Uint8Array
162
- * @returns A hex string without '0x' prefix (e.g., "1234")
163
- *
164
- * @example
165
- * ```typescript
166
- * Hex.hexInputToStringWithoutPrefix("1234") // returns "1234"
167
- * Hex.hexInputToStringWithoutPrefix("0x1234") // returns "1234"
168
- * Hex.hexInputToStringWithoutPrefix(new Uint8Array([0x12, 0x34])) // returns "1234"
169
- * ```
170
- */
171
- static hexInputToStringWithoutPrefix(hexInput) {
172
- return _Hex.fromHexInput(hexInput).toStringWithoutPrefix();
173
- }
174
- // ===
175
- // Methods for checking validity.
176
- // ===
177
- /**
178
- * Check if the provided string is a valid hexadecimal representation.
179
- *
180
- * @param str - A hex string representing byte data.
181
- *
182
- * @returns An object containing:
183
- * - valid: A boolean indicating whether the string is valid.
184
- * - invalidReason: The reason for invalidity if the string is not valid.
185
- * - invalidReasonMessage: A message explaining why the string is invalid.
186
- * @group Implementation
187
- * @category Serialization
188
- */
189
- static isValid(str) {
190
- try {
191
- _Hex.fromHexString(str);
192
- return { valid: true };
193
- } catch (error) {
194
- return {
195
- valid: false,
196
- invalidReason: _optionalChain([error, 'optionalAccess', _2 => _2.invalidReason]),
197
- invalidReasonMessage: _optionalChain([error, 'optionalAccess', _3 => _3.message])
198
- };
199
- }
200
- }
201
- /**
202
- * Determine if two Hex instances are equal by comparing their underlying byte data.
203
- *
204
- * @param other The Hex instance to compare to.
205
- * @returns true if the Hex instances are equal, false if not.
206
- * @group Implementation
207
- * @category Serialization
208
- */
209
- equals(other) {
210
- if (this.data.length !== other.data.length) return false;
211
- return this.data.every((value, index) => value === other.data[index]);
212
- }
213
- };
214
- var hexToAsciiString = (hex) => new TextDecoder().decode(Hex.fromHexInput(hex).toUint8Array());
215
-
216
- // src/bcs/consts.ts
217
- var MAX_U8_NUMBER = 255;
218
- var MAX_U16_NUMBER = 65535;
219
- var MAX_U32_NUMBER = 4294967295;
220
- var MAX_U64_BIG_INT = 18446744073709551615n;
221
- var MAX_U128_BIG_INT = 340282366920938463463374607431768211455n;
222
- var MAX_U256_BIG_INT = 115792089237316195423570985008687907853269984665640564039457584007913129639935n;
223
-
224
- // src/bcs/serializer.ts
225
- var Serializable = class {
226
- /**
227
- * Serializes a `Serializable` value to its BCS representation.
228
- * This function is the TypeScript SDK equivalent of `bcs::to_bytes` in Move.
229
- * @returns the BCS representation of the Serializable instance as a byte buffer.
230
- * @group Implementation
231
- * @category BCS
232
- */
233
- bcsToBytes() {
234
- const serializer = new Serializer();
235
- this.serialize(serializer);
236
- return serializer.toUint8Array();
237
- }
238
- /**
239
- * Converts the BCS-serialized bytes of a value into a Hex instance.
240
- * This function provides a Hex representation of the BCS-serialized data for easier handling and manipulation.
241
- * @returns A Hex instance with the BCS-serialized bytes loaded into its underlying Uint8Array.
242
- * @group Implementation
243
- * @category BCS
244
- */
245
- bcsToHex() {
246
- const bcsBytes = this.bcsToBytes();
247
- return Hex.fromHexInput(bcsBytes);
248
- }
249
- /**
250
- * Returns the hex string representation of the `Serializable` value without the 0x prefix.
251
- * @returns the hex format as a string without `0x` prefix.
252
- */
253
- toStringWithoutPrefix() {
254
- return this.bcsToHex().toStringWithoutPrefix();
255
- }
256
- /**
257
- * Returns the hex string representation of the `Serializable` value with the 0x prefix.
258
- * @returns the hex formatas a string prefixed by `0x`.
259
- */
260
- toString() {
261
- return `0x${this.toStringWithoutPrefix()}`;
262
- }
263
- };
264
- var Serializer = class {
265
- /**
266
- * Constructs a serializer with a buffer of size `length` bytes, 64 bytes by default.
267
- * The `length` must be greater than 0.
268
- *
269
- * @param length - The size of the buffer in bytes.
270
- * @group Implementation
271
- * @category BCS
272
- */
273
- constructor(length = 64) {
274
- if (length <= 0) {
275
- throw new Error("Length needs to be greater than 0");
276
- }
277
- this.buffer = new ArrayBuffer(length);
278
- this.offset = 0;
279
- }
280
- /**
281
- * Ensures that the internal buffer can accommodate the specified number of bytes.
282
- * This function dynamically resizes the buffer if the current size is insufficient.
283
- *
284
- * @param bytes - The number of bytes to ensure the buffer can handle.
285
- * @group Implementation
286
- * @category BCS
287
- */
288
- ensureBufferWillHandleSize(bytes) {
289
- while (this.buffer.byteLength < this.offset + bytes) {
290
- const newBuffer = new ArrayBuffer(this.buffer.byteLength * 2);
291
- new Uint8Array(newBuffer).set(new Uint8Array(this.buffer));
292
- this.buffer = newBuffer;
293
- }
294
- }
295
- /**
296
- * Appends the specified values to the buffer, ensuring that the buffer can accommodate the new data.
297
- *
298
- * @param {Uint8Array} values - The values to be appended to the buffer.
299
- * @group Implementation
300
- * @category BCS
301
- */
302
- appendToBuffer(values) {
303
- this.ensureBufferWillHandleSize(values.length);
304
- new Uint8Array(this.buffer, this.offset).set(values);
305
- this.offset += values.length;
306
- }
307
- /**
308
- * Serializes a value into the buffer using the provided function, ensuring the buffer can accommodate the size.
309
- *
310
- * @param fn - The function to serialize the value, which takes a byte offset, the value to serialize, and an optional little-endian flag.
311
- * @param fn.byteOffset - The byte offset at which to write the value.
312
- * @param fn.value - The numeric value to serialize into the buffer.
313
- * @param fn.littleEndian - Optional flag indicating whether to use little-endian byte order (defaults to true).
314
- * @group Implementation
315
- * @category BCS
316
- */
317
- // TODO: JSDoc bytesLength and value
318
- serializeWithFunction(fn, bytesLength, value) {
319
- this.ensureBufferWillHandleSize(bytesLength);
320
- const dv = new DataView(this.buffer, this.offset);
321
- fn.apply(dv, [0, value, true]);
322
- this.offset += bytesLength;
323
- }
324
- /**
325
- * Serializes a string. UTF8 string is supported.
326
- * The number of bytes in the string content is serialized first, as a uleb128-encoded u32 integer.
327
- * Then the string content is serialized as UTF8 encoded bytes.
328
- *
329
- * BCS layout for "string": string_length | string_content
330
- * where string_length is a u32 integer encoded as a uleb128 integer, equal to the number of bytes in string_content.
331
- *
332
- * @param value - The string to serialize.
333
- *
334
- * @example
335
- * ```typescript
336
- * const serializer = new Serializer();
337
- * serializer.serializeStr("1234abcd");
338
- * assert(serializer.toUint8Array() === new Uint8Array([8, 49, 50, 51, 52, 97, 98, 99, 100]));
339
- * ```
340
- * @group Implementation
341
- * @category BCS
342
- */
343
- serializeStr(value) {
344
- const textEncoder = new TextEncoder();
345
- this.serializeBytes(textEncoder.encode(value));
346
- }
347
- /**
348
- * Serializes an array of bytes.
349
- *
350
- * This function encodes the length of the byte array as a u32 integer in uleb128 format, followed by the byte array itself.
351
- * BCS layout for "bytes": bytes_length | bytes
352
- * where bytes_length is a u32 integer encoded as a uleb128 integer, equal to the length of the bytes array.
353
- * @param value - The byte array to serialize.
354
- * @group Implementation
355
- * @category BCS
356
- */
357
- serializeBytes(value) {
358
- this.serializeU32AsUleb128(value.length);
359
- this.appendToBuffer(value);
360
- }
361
- /**
362
- * Serializes an array of bytes with a known length, allowing for efficient deserialization without needing to serialize the
363
- * length itself.
364
- * When deserializing, the number of bytes to deserialize needs to be passed in.
365
-
366
- * @param value - The Uint8Array to be serialized.
367
- * @group Implementation
368
- * @category BCS
369
- */
370
- serializeFixedBytes(value) {
371
- this.appendToBuffer(value);
372
- }
373
- /**
374
- * Serializes a boolean value into a byte representation.
375
- *
376
- * The BCS layout for a boolean uses one byte, where "0x01" represents true and "0x00" represents false.
377
- *
378
- * @param value - The boolean value to serialize.
379
- * @group Implementation
380
- * @category BCS
381
- */
382
- serializeBool(value) {
383
- ensureBoolean(value);
384
- const byteValue = value ? 1 : 0;
385
- this.appendToBuffer(new Uint8Array([byteValue]));
386
- }
387
- serializeU8(value) {
388
- this.appendToBuffer(new Uint8Array([value]));
389
- }
390
- serializeU16(value) {
391
- this.serializeWithFunction(DataView.prototype.setUint16, 2, value);
392
- }
393
- serializeU32(value) {
394
- this.serializeWithFunction(DataView.prototype.setUint32, 4, value);
395
- }
396
- serializeU64(value) {
397
- const low = BigInt(value) & BigInt(MAX_U32_NUMBER);
398
- const high = BigInt(value) >> BigInt(32);
399
- this.serializeU32(Number(low));
400
- this.serializeU32(Number(high));
401
- }
402
- serializeU128(value) {
403
- const low = BigInt(value) & MAX_U64_BIG_INT;
404
- const high = BigInt(value) >> BigInt(64);
405
- this.serializeU64(low);
406
- this.serializeU64(high);
407
- }
408
- serializeU256(value) {
409
- const low = BigInt(value) & MAX_U128_BIG_INT;
410
- const high = BigInt(value) >> BigInt(128);
411
- this.serializeU128(low);
412
- this.serializeU128(high);
413
- }
414
- serializeU32AsUleb128(val) {
415
- let value = val;
416
- const valueArray = [];
417
- while (value >>> 7 !== 0) {
418
- valueArray.push(value & 127 | 128);
419
- value >>>= 7;
420
- }
421
- valueArray.push(value);
422
- this.appendToBuffer(new Uint8Array(valueArray));
423
- }
424
- /**
425
- * Returns the buffered bytes as a Uint8Array.
426
- *
427
- * This function allows you to retrieve the byte representation of the buffer up to the current offset.
428
- *
429
- * @returns Uint8Array - The byte array representation of the buffer.
430
- * @group Implementation
431
- * @category BCS
432
- */
433
- toUint8Array() {
434
- return new Uint8Array(this.buffer).slice(0, this.offset);
435
- }
436
- /**
437
- * Serializes a `Serializable` value, facilitating composable serialization.
438
- *
439
- * @param value The Serializable value to serialize.
440
- *
441
- * @returns the serializer instance
442
- * @group Implementation
443
- * @category BCS
444
- */
445
- serialize(value) {
446
- value.serialize(this);
447
- }
448
- /**
449
- * Serializes an array of BCS Serializable values to a serializer instance.
450
- * The bytes are added to the serializer instance's byte buffer.
451
- *
452
- * @param values The array of BCS Serializable values
453
- * @example
454
- * const addresses = new Array<AccountAddress>(
455
- * AccountAddress.from("0x1"),
456
- * AccountAddress.from("0x2"),
457
- * AccountAddress.from("0xa"),
458
- * AccountAddress.from("0xb"),
459
- * );
460
- * const serializer = new Serializer();
461
- * serializer.serializeVector(addresses);
462
- * const serializedBytes = serializer.toUint8Array();
463
- * // serializedBytes is now the BCS-serialized bytes
464
- * // The equivalent value in Move would be:
465
- * // `bcs::to_bytes(&vector<address> [@0x1, @0x2, @0xa, @0xb])`;
466
- * @group Implementation
467
- * @category BCS
468
- */
469
- serializeVector(values) {
470
- this.serializeU32AsUleb128(values.length);
471
- values.forEach((item) => {
472
- item.serialize(this);
473
- });
474
- }
475
- /**
476
- * Serializes an optional value which can be a Serializable, string, or Uint8Array.
477
- * For strings and Uint8Arrays, it uses the appropriate serialization method.
478
- *
479
- * @param value The value to serialize (Serializable, string, Uint8Array, or undefined)
480
- * @param len Optional fixed length for Uint8Array serialization. If provided, uses serializeFixedBytes instead of serializeBytes
481
- *
482
- * @example
483
- * ```typescript
484
- * const serializer = new Serializer();
485
- * serializer.serializeOption("hello"); // Serializes optional string
486
- * serializer.serializeOption(new Uint8Array([1, 2, 3])); // Serializes optional bytes
487
- * serializer.serializeOption(new Uint8Array([1, 2, 3]), 3); // Serializes optional fixed-length bytes
488
- * serializer.serializeOption(new AccountAddress(...)); // Serializes optional Serializable
489
- * serializer.serializeOption(undefined); // Serializes none case
490
- * ```
491
- * @group Implementation
492
- * @category BCS
493
- */
494
- serializeOption(value, len) {
495
- const hasValue = value !== void 0;
496
- this.serializeBool(hasValue);
497
- if (hasValue) {
498
- if (typeof value === "string") {
499
- this.serializeStr(value);
500
- } else if (value instanceof Uint8Array) {
501
- if (len !== void 0) {
502
- this.serializeFixedBytes(value);
503
- } else {
504
- this.serializeBytes(value);
505
- }
506
- } else {
507
- value.serialize(this);
508
- }
509
- }
510
- }
511
- /**
512
- * @deprecated use `serializeOption` instead.
513
- * Serializes an optional string, supporting UTF8 encoding.
514
- * The function encodes the existence of the string first, followed by the length and content if it exists.
515
- *
516
- * BCS layout for optional "string": 1 | string_length | string_content
517
- * where string_length is a u32 integer encoded as a uleb128 integer, equal to the number of bytes in string_content.
518
- * BCS layout for undefined: 0
519
- *
520
- * @param value - The optional string to serialize. If undefined, it will serialize as 0.
521
- * @group Implementation
522
- * @category BCS
523
- */
524
- serializeOptionStr(value) {
525
- if (value === void 0) {
526
- this.serializeU32AsUleb128(0);
527
- } else {
528
- this.serializeU32AsUleb128(1);
529
- this.serializeStr(value);
530
- }
531
- }
532
- };
533
- __decorateClass([
534
- checkNumberRange(0, MAX_U8_NUMBER)
535
- ], Serializer.prototype, "serializeU8", 1);
536
- __decorateClass([
537
- checkNumberRange(0, MAX_U16_NUMBER)
538
- ], Serializer.prototype, "serializeU16", 1);
539
- __decorateClass([
540
- checkNumberRange(0, MAX_U32_NUMBER)
541
- ], Serializer.prototype, "serializeU32", 1);
542
- __decorateClass([
543
- checkNumberRange(BigInt(0), MAX_U64_BIG_INT)
544
- ], Serializer.prototype, "serializeU64", 1);
545
- __decorateClass([
546
- checkNumberRange(BigInt(0), MAX_U128_BIG_INT)
547
- ], Serializer.prototype, "serializeU128", 1);
548
- __decorateClass([
549
- checkNumberRange(BigInt(0), MAX_U256_BIG_INT)
550
- ], Serializer.prototype, "serializeU256", 1);
551
- __decorateClass([
552
- checkNumberRange(0, MAX_U32_NUMBER)
553
- ], Serializer.prototype, "serializeU32AsUleb128", 1);
554
- function ensureBoolean(value) {
555
- if (typeof value !== "boolean") {
556
- throw new Error(`${value} is not a boolean value`);
557
- }
558
- }
559
- var outOfRangeErrorMessage = (value, min, max) => `${value} is out of range: [${min}, ${max}]`;
560
- function validateNumberInRange(value, minValue, maxValue) {
561
- const valueBigInt = BigInt(value);
562
- if (valueBigInt > BigInt(maxValue) || valueBigInt < BigInt(minValue)) {
563
- throw new Error(outOfRangeErrorMessage(value, minValue, maxValue));
564
- }
565
- }
566
- function checkNumberRange(minValue, maxValue) {
567
- return (target, propertyKey, descriptor) => {
568
- const childFunction = descriptor.value;
569
- descriptor.value = function deco(value) {
570
- validateNumberInRange(value, minValue, maxValue);
571
- return childFunction.apply(this, [value]);
572
- };
573
- return descriptor;
574
- };
575
- }
576
-
577
- // src/types/types.ts
578
- var MimeType = /* @__PURE__ */ ((MimeType2) => {
579
- MimeType2["JSON"] = "application/json";
580
- MimeType2["BCS"] = "application/x-bcs";
581
- MimeType2["BCS_SIGNED_TRANSACTION"] = "application/x.aptos.signed_transaction+bcs";
582
- MimeType2["BCS_VIEW_FUNCTION"] = "application/x.aptos.view_function+bcs";
583
- return MimeType2;
584
- })(MimeType || {});
585
- var TypeTagVariants = /* @__PURE__ */ ((TypeTagVariants2) => {
586
- TypeTagVariants2[TypeTagVariants2["Bool"] = 0] = "Bool";
587
- TypeTagVariants2[TypeTagVariants2["U8"] = 1] = "U8";
588
- TypeTagVariants2[TypeTagVariants2["U64"] = 2] = "U64";
589
- TypeTagVariants2[TypeTagVariants2["U128"] = 3] = "U128";
590
- TypeTagVariants2[TypeTagVariants2["Address"] = 4] = "Address";
591
- TypeTagVariants2[TypeTagVariants2["Signer"] = 5] = "Signer";
592
- TypeTagVariants2[TypeTagVariants2["Vector"] = 6] = "Vector";
593
- TypeTagVariants2[TypeTagVariants2["Struct"] = 7] = "Struct";
594
- TypeTagVariants2[TypeTagVariants2["U16"] = 8] = "U16";
595
- TypeTagVariants2[TypeTagVariants2["U32"] = 9] = "U32";
596
- TypeTagVariants2[TypeTagVariants2["U256"] = 10] = "U256";
597
- TypeTagVariants2[TypeTagVariants2["Reference"] = 254] = "Reference";
598
- TypeTagVariants2[TypeTagVariants2["Generic"] = 255] = "Generic";
599
- return TypeTagVariants2;
600
- })(TypeTagVariants || {});
601
- var ScriptTransactionArgumentVariants = /* @__PURE__ */ ((ScriptTransactionArgumentVariants2) => {
602
- ScriptTransactionArgumentVariants2[ScriptTransactionArgumentVariants2["U8"] = 0] = "U8";
603
- ScriptTransactionArgumentVariants2[ScriptTransactionArgumentVariants2["U64"] = 1] = "U64";
604
- ScriptTransactionArgumentVariants2[ScriptTransactionArgumentVariants2["U128"] = 2] = "U128";
605
- ScriptTransactionArgumentVariants2[ScriptTransactionArgumentVariants2["Address"] = 3] = "Address";
606
- ScriptTransactionArgumentVariants2[ScriptTransactionArgumentVariants2["U8Vector"] = 4] = "U8Vector";
607
- ScriptTransactionArgumentVariants2[ScriptTransactionArgumentVariants2["Bool"] = 5] = "Bool";
608
- ScriptTransactionArgumentVariants2[ScriptTransactionArgumentVariants2["U16"] = 6] = "U16";
609
- ScriptTransactionArgumentVariants2[ScriptTransactionArgumentVariants2["U32"] = 7] = "U32";
610
- ScriptTransactionArgumentVariants2[ScriptTransactionArgumentVariants2["U256"] = 8] = "U256";
611
- ScriptTransactionArgumentVariants2[ScriptTransactionArgumentVariants2["Serialized"] = 9] = "Serialized";
612
- return ScriptTransactionArgumentVariants2;
613
- })(ScriptTransactionArgumentVariants || {});
614
- var TransactionPayloadVariants = /* @__PURE__ */ ((TransactionPayloadVariants2) => {
615
- TransactionPayloadVariants2[TransactionPayloadVariants2["Script"] = 0] = "Script";
616
- TransactionPayloadVariants2[TransactionPayloadVariants2["EntryFunction"] = 2] = "EntryFunction";
617
- TransactionPayloadVariants2[TransactionPayloadVariants2["Multisig"] = 3] = "Multisig";
618
- return TransactionPayloadVariants2;
619
- })(TransactionPayloadVariants || {});
620
- var TransactionVariants = /* @__PURE__ */ ((TransactionVariants2) => {
621
- TransactionVariants2[TransactionVariants2["MultiAgentTransaction"] = 0] = "MultiAgentTransaction";
622
- TransactionVariants2[TransactionVariants2["FeePayerTransaction"] = 1] = "FeePayerTransaction";
623
- return TransactionVariants2;
624
- })(TransactionVariants || {});
625
- var TransactionAuthenticatorVariant = /* @__PURE__ */ ((TransactionAuthenticatorVariant2) => {
626
- TransactionAuthenticatorVariant2[TransactionAuthenticatorVariant2["Ed25519"] = 0] = "Ed25519";
627
- TransactionAuthenticatorVariant2[TransactionAuthenticatorVariant2["MultiEd25519"] = 1] = "MultiEd25519";
628
- TransactionAuthenticatorVariant2[TransactionAuthenticatorVariant2["MultiAgent"] = 2] = "MultiAgent";
629
- TransactionAuthenticatorVariant2[TransactionAuthenticatorVariant2["FeePayer"] = 3] = "FeePayer";
630
- TransactionAuthenticatorVariant2[TransactionAuthenticatorVariant2["SingleSender"] = 4] = "SingleSender";
631
- return TransactionAuthenticatorVariant2;
632
- })(TransactionAuthenticatorVariant || {});
633
- var AccountAuthenticatorVariant = /* @__PURE__ */ ((AccountAuthenticatorVariant2) => {
634
- AccountAuthenticatorVariant2[AccountAuthenticatorVariant2["Ed25519"] = 0] = "Ed25519";
635
- AccountAuthenticatorVariant2[AccountAuthenticatorVariant2["MultiEd25519"] = 1] = "MultiEd25519";
636
- AccountAuthenticatorVariant2[AccountAuthenticatorVariant2["SingleKey"] = 2] = "SingleKey";
637
- AccountAuthenticatorVariant2[AccountAuthenticatorVariant2["MultiKey"] = 3] = "MultiKey";
638
- AccountAuthenticatorVariant2[AccountAuthenticatorVariant2["NoAccountAuthenticator"] = 4] = "NoAccountAuthenticator";
639
- AccountAuthenticatorVariant2[AccountAuthenticatorVariant2["Abstraction"] = 5] = "Abstraction";
640
- return AccountAuthenticatorVariant2;
641
- })(AccountAuthenticatorVariant || {});
642
- var PrivateKeyVariants = /* @__PURE__ */ ((PrivateKeyVariants2) => {
643
- PrivateKeyVariants2["Ed25519"] = "ed25519";
644
- PrivateKeyVariants2["Secp256k1"] = "secp256k1";
645
- return PrivateKeyVariants2;
646
- })(PrivateKeyVariants || {});
647
- var AnyPublicKeyVariant = /* @__PURE__ */ ((AnyPublicKeyVariant2) => {
648
- AnyPublicKeyVariant2[AnyPublicKeyVariant2["Ed25519"] = 0] = "Ed25519";
649
- AnyPublicKeyVariant2[AnyPublicKeyVariant2["Secp256k1"] = 1] = "Secp256k1";
650
- AnyPublicKeyVariant2[AnyPublicKeyVariant2["Keyless"] = 3] = "Keyless";
651
- AnyPublicKeyVariant2[AnyPublicKeyVariant2["FederatedKeyless"] = 4] = "FederatedKeyless";
652
- return AnyPublicKeyVariant2;
653
- })(AnyPublicKeyVariant || {});
654
- var AnySignatureVariant = /* @__PURE__ */ ((AnySignatureVariant2) => {
655
- AnySignatureVariant2[AnySignatureVariant2["Ed25519"] = 0] = "Ed25519";
656
- AnySignatureVariant2[AnySignatureVariant2["Secp256k1"] = 1] = "Secp256k1";
657
- AnySignatureVariant2[AnySignatureVariant2["Keyless"] = 3] = "Keyless";
658
- return AnySignatureVariant2;
659
- })(AnySignatureVariant || {});
660
- var EphemeralPublicKeyVariant = /* @__PURE__ */ ((EphemeralPublicKeyVariant2) => {
661
- EphemeralPublicKeyVariant2[EphemeralPublicKeyVariant2["Ed25519"] = 0] = "Ed25519";
662
- return EphemeralPublicKeyVariant2;
663
- })(EphemeralPublicKeyVariant || {});
664
- var EphemeralSignatureVariant = /* @__PURE__ */ ((EphemeralSignatureVariant2) => {
665
- EphemeralSignatureVariant2[EphemeralSignatureVariant2["Ed25519"] = 0] = "Ed25519";
666
- return EphemeralSignatureVariant2;
667
- })(EphemeralSignatureVariant || {});
668
- var EphemeralCertificateVariant = /* @__PURE__ */ ((EphemeralCertificateVariant2) => {
669
- EphemeralCertificateVariant2[EphemeralCertificateVariant2["ZkProof"] = 0] = "ZkProof";
670
- return EphemeralCertificateVariant2;
671
- })(EphemeralCertificateVariant || {});
672
- var ZkpVariant = /* @__PURE__ */ ((ZkpVariant2) => {
673
- ZkpVariant2[ZkpVariant2["Groth16"] = 0] = "Groth16";
674
- return ZkpVariant2;
675
- })(ZkpVariant || {});
676
- var TransactionResponseType = /* @__PURE__ */ ((TransactionResponseType2) => {
677
- TransactionResponseType2["Pending"] = "pending_transaction";
678
- TransactionResponseType2["User"] = "user_transaction";
679
- TransactionResponseType2["Genesis"] = "genesis_transaction";
680
- TransactionResponseType2["BlockMetadata"] = "block_metadata_transaction";
681
- TransactionResponseType2["StateCheckpoint"] = "state_checkpoint_transaction";
682
- TransactionResponseType2["Validator"] = "validator_transaction";
683
- TransactionResponseType2["BlockEpilogue"] = "block_epilogue_transaction";
684
- return TransactionResponseType2;
685
- })(TransactionResponseType || {});
686
- function isPendingTransactionResponse(response) {
687
- return response.type === "pending_transaction" /* Pending */;
688
- }
689
- function isUserTransactionResponse(response) {
690
- return response.type === "user_transaction" /* User */;
691
- }
692
- function isGenesisTransactionResponse(response) {
693
- return response.type === "genesis_transaction" /* Genesis */;
694
- }
695
- function isBlockMetadataTransactionResponse(response) {
696
- return response.type === "block_metadata_transaction" /* BlockMetadata */;
697
- }
698
- function isStateCheckpointTransactionResponse(response) {
699
- return response.type === "state_checkpoint_transaction" /* StateCheckpoint */;
700
- }
701
- function isValidatorTransactionResponse(response) {
702
- return response.type === "validator_transaction" /* Validator */;
703
- }
704
- function isBlockEpilogueTransactionResponse(response) {
705
- return response.type === "block_epilogue_transaction" /* BlockEpilogue */;
706
- }
707
- function isEd25519Signature(signature) {
708
- return "signature" in signature && signature.type === "ed25519_signature";
709
- }
710
- function isSecp256k1Signature(signature) {
711
- return "signature" in signature && signature.signature === "secp256k1_ecdsa_signature";
712
- }
713
- function isMultiAgentSignature(signature) {
714
- return signature.type === "multi_agent_signature";
715
- }
716
- function isFeePayerSignature(signature) {
717
- return signature.type === "fee_payer_signature";
718
- }
719
- function isMultiEd25519Signature(signature) {
720
- return signature.type === "multi_ed25519_signature";
721
- }
722
- function isSingleSenderSignature(signature) {
723
- return signature.type === "single_sender";
724
- }
725
- function isSingleSenderSingleKeySignature(signature) {
726
- return signature.type === "single_sender" && !("signatures_required" in signature);
727
- }
728
- function isSingleSenderMultiKeySignature(signature) {
729
- return signature.type === "single_sender" && "signatures_required" in signature;
730
- }
731
- var MoveFunctionVisibility = /* @__PURE__ */ ((MoveFunctionVisibility2) => {
732
- MoveFunctionVisibility2["PRIVATE"] = "private";
733
- MoveFunctionVisibility2["PUBLIC"] = "public";
734
- MoveFunctionVisibility2["FRIEND"] = "friend";
735
- return MoveFunctionVisibility2;
736
- })(MoveFunctionVisibility || {});
737
- var MoveAbility = /* @__PURE__ */ ((MoveAbility2) => {
738
- MoveAbility2["STORE"] = "store";
739
- MoveAbility2["DROP"] = "drop";
740
- MoveAbility2["KEY"] = "key";
741
- MoveAbility2["COPY"] = "copy";
742
- return MoveAbility2;
743
- })(MoveAbility || {});
744
- var RoleType = /* @__PURE__ */ ((RoleType2) => {
745
- RoleType2["VALIDATOR"] = "validator";
746
- RoleType2["FULL_NODE"] = "full_node";
747
- return RoleType2;
748
- })(RoleType || {});
749
- var SigningScheme = /* @__PURE__ */ ((SigningScheme2) => {
750
- SigningScheme2[SigningScheme2["Ed25519"] = 0] = "Ed25519";
751
- SigningScheme2[SigningScheme2["MultiEd25519"] = 1] = "MultiEd25519";
752
- SigningScheme2[SigningScheme2["SingleKey"] = 2] = "SingleKey";
753
- SigningScheme2[SigningScheme2["MultiKey"] = 3] = "MultiKey";
754
- return SigningScheme2;
755
- })(SigningScheme || {});
756
- var SigningSchemeInput = /* @__PURE__ */ ((SigningSchemeInput2) => {
757
- SigningSchemeInput2[SigningSchemeInput2["Ed25519"] = 0] = "Ed25519";
758
- SigningSchemeInput2[SigningSchemeInput2["Secp256k1Ecdsa"] = 2] = "Secp256k1Ecdsa";
759
- return SigningSchemeInput2;
760
- })(SigningSchemeInput || {});
761
- var DeriveScheme = /* @__PURE__ */ ((DeriveScheme2) => {
762
- DeriveScheme2[DeriveScheme2["DeriveAuid"] = 251] = "DeriveAuid";
763
- DeriveScheme2[DeriveScheme2["DeriveObjectAddressFromObject"] = 252] = "DeriveObjectAddressFromObject";
764
- DeriveScheme2[DeriveScheme2["DeriveObjectAddressFromGuid"] = 253] = "DeriveObjectAddressFromGuid";
765
- DeriveScheme2[DeriveScheme2["DeriveObjectAddressFromSeed"] = 254] = "DeriveObjectAddressFromSeed";
766
- DeriveScheme2[DeriveScheme2["DeriveResourceAccountAddress"] = 255] = "DeriveResourceAccountAddress";
767
- return DeriveScheme2;
768
- })(DeriveScheme || {});
769
-
770
- // src/types/index.ts
771
- var _scriptcomposerpack = require('@aptos-labs/script-composer-pack');
772
-
773
- // src/core/accountAddress.ts
774
-
775
- var AddressInvalidReason = /* @__PURE__ */ ((AddressInvalidReason2) => {
776
- AddressInvalidReason2["INCORRECT_NUMBER_OF_BYTES"] = "incorrect_number_of_bytes";
777
- AddressInvalidReason2["INVALID_HEX_CHARS"] = "invalid_hex_chars";
778
- AddressInvalidReason2["TOO_SHORT"] = "too_short";
779
- AddressInvalidReason2["TOO_LONG"] = "too_long";
780
- AddressInvalidReason2["LEADING_ZERO_X_REQUIRED"] = "leading_zero_x_required";
781
- AddressInvalidReason2["LONG_FORM_REQUIRED_UNLESS_SPECIAL"] = "long_form_required_unless_special";
782
- AddressInvalidReason2["INVALID_PADDING_ZEROES"] = "INVALID_PADDING_ZEROES";
783
- AddressInvalidReason2["INVALID_PADDING_STRICTNESS"] = "INVALID_PADDING_STRICTNESS";
784
- return AddressInvalidReason2;
785
- })(AddressInvalidReason || {});
786
- var _AccountAddress = class _AccountAddress extends Serializable {
787
- /**
788
- * Creates an instance of AccountAddress from a Uint8Array.
789
- *
790
- * This function ensures that the input data is exactly 32 bytes long, which is required for a valid account address.
791
- *
792
- * @param input A Uint8Array representing an account address.
793
- * @throws ParsingError if the input length is not equal to 32 bytes.
794
- * @group Implementation
795
- * @category Serialization
796
- */
797
- constructor(input) {
798
- super();
799
- if (input.length !== _AccountAddress.LENGTH) {
800
- throw new ParsingError(
801
- "AccountAddress data should be exactly 32 bytes long",
802
- "incorrect_number_of_bytes" /* INCORRECT_NUMBER_OF_BYTES */
803
- );
804
- }
805
- this.data = input;
806
- }
807
- /**
808
- * Determines if the address is classified as special, which is defined as 0x0 to 0xf inclusive.
809
- * In other words, the last byte of the address must be < 0b10000 (16)
810
- * and every other byte must be zero.
811
- *
812
- * For more information on how special addresses are defined, see AIP-40:
813
- * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
814
- *
815
- * @returns true if the address is special, false otherwise.
816
- * @group Implementation
817
- * @category Serialization
818
- */
819
- isSpecial() {
820
- return this.data.slice(0, this.data.length - 1).every((byte) => byte === 0) && this.data[this.data.length - 1] < 16;
821
- }
822
- // ===
823
- // Methods for representing an instance of AccountAddress as other types.
824
- // ===
825
- /**
826
- * Return the AccountAddress as a string as per AIP-40.
827
- * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
828
- * This representation returns special addresses in SHORT form (0xf)
829
- * and other addresses in LONG form (0x + 64 characters).
830
- *
831
- * @returns AccountAddress as a string conforming to AIP-40.
832
- * @group Implementation
833
- * @category Serialization
834
- */
835
- toString() {
836
- return `0x${this.toStringWithoutPrefix()}`;
837
- }
838
- /**
839
- * Return the AccountAddress as a string conforming to AIP-40 but without the leading 0x.
840
- *
841
- * NOTE: Prefer to use `toString` where possible.
842
- *
843
- * @returns AccountAddress as a string without the leading 0x.
844
- * @group Implementation
845
- * @category Serialization
846
- */
847
- toStringWithoutPrefix() {
848
- let hex = _utils.bytesToHex.call(void 0, this.data);
849
- if (this.isSpecial()) {
850
- hex = hex[hex.length - 1];
851
- }
852
- return hex;
853
- }
854
- /**
855
- * Convert the account address to a string in LONG format, which is always 0x followed by 64 hex characters.
856
- *
857
- * NOTE: Prefer to use `toString` where possible, as it formats special addresses using the SHORT form (no leading 0s).
858
- *
859
- * @returns AccountAddress as a string in LONG form.
860
- * @group Implementation
861
- * @category Serialization
862
- */
863
- toStringLong() {
864
- return `0x${this.toStringLongWithoutPrefix()}`;
865
- }
866
- /**
867
- * Returns the account address as a string in LONG form without a leading 0x.
868
- * This function will include leading zeroes and will produce a string of 64 hex characters.
869
- *
870
- * NOTE: Prefer to use `toString` where possible, as it formats special addresses using the SHORT form (no leading 0s).
871
- *
872
- * @returns {string} The account address in LONG form.
873
- * @group Implementation
874
- * @category Serialization
875
- */
876
- toStringLongWithoutPrefix() {
877
- return _utils.bytesToHex.call(void 0, this.data);
878
- }
879
- /**
880
- * Get the inner data as a Uint8Array.
881
- * The inner data is already a Uint8Array, so no conversion takes place.
882
- *
883
- * @returns Hex data as Uint8Array
884
- * @group Implementation
885
- * @category Serialization
886
- */
887
- toUint8Array() {
888
- return this.data;
889
- }
890
- /**
891
- * Serialize the AccountAddress to a Serializer instance's data buffer.
892
- * @param serializer The serializer to serialize the AccountAddress to.
893
- * @returns void
894
- * @example
895
- * const serializer = new Serializer();
896
- * const address = AccountAddress.fromString("0x1");
897
- * address.serialize(serializer);
898
- * const bytes = serializer.toUint8Array();
899
- * // `bytes` is now the BCS-serialized address.
900
- * @group Implementation
901
- * @category Serialization
902
- */
903
- serialize(serializer) {
904
- serializer.serializeFixedBytes(this.data);
905
- }
906
- /**
907
- * Serializes the current instance into a byte sequence suitable for entry functions.
908
- * This allows for the proper encoding of data when interacting with entry functions in the blockchain.
909
- *
910
- * @param serializer - The serializer instance used to convert the data into bytes.
911
- * @group Implementation
912
- * @category Serialization
913
- */
914
- serializeForEntryFunction(serializer) {
915
- const bcsBytes = this.bcsToBytes();
916
- serializer.serializeBytes(bcsBytes);
917
- }
918
- /**
919
- * Serializes the current instance for use in a script function by encoding it into a byte sequence.
920
- * This process involves serializing the variant index and the instance data, making it suitable for transmission.
921
- *
922
- * @param serializer - The serializer instance used to perform the serialization.
923
- * @group Implementation
924
- * @category Serialization
925
- */
926
- serializeForScriptFunction(serializer) {
927
- serializer.serializeU32AsUleb128(3 /* Address */);
928
- serializer.serialize(this);
929
- }
930
- /**
931
- * Deserialize an AccountAddress from the byte buffer in a Deserializer instance.
932
- * This function allows you to convert a byte representation of an AccountAddress into an instance of AccountAddress.
933
- * @param deserializer The deserializer to deserialize the AccountAddress from.
934
- * @returns An instance of AccountAddress.
935
- * @example
936
- * const bytes = hexToBytes("0x0102030405060708091011121314151617181920212223242526272829303132");
937
- * const deserializer = new Deserializer(bytes);
938
- * const address = AccountAddress.deserialize(deserializer);
939
- * // `address` is now an instance of AccountAddress.
940
- * @group Implementation
941
- * @category Serialization
942
- */
943
- static deserialize(deserializer) {
944
- const bytes = deserializer.deserializeFixedBytes(_AccountAddress.LENGTH);
945
- return new _AccountAddress(bytes);
946
- }
947
- // ===
948
- // Methods for creating an instance of AccountAddress from other types.
949
- // ===
950
- /**
951
- * NOTE: This function has strict parsing behavior. For relaxed behavior, please use
952
- * the `fromString` function.
953
- *
954
- * Creates an instance of AccountAddress from a hex string.
955
- *
956
- * This function allows only the strictest formats defined by AIP-40. In short this
957
- * means only the following formats are accepted:
958
- *
959
- * - LONG
960
- * - SHORT for special addresses
961
- *
962
- * Where:
963
- * - LONG is defined as 0x + 64 hex characters.
964
- * - SHORT for special addresses is 0x0 to 0xf inclusive without padding zeroes.
965
- *
966
- * This means the following are not accepted:
967
- * - SHORT for non-special addresses.
968
- * - Any address without a leading 0x.
969
- *
970
- * @param input - A hex string representing an account address.
971
- *
972
- * @throws {ParsingError} If the hex string does not start with 0x or is not in a valid format.
973
- *
974
- * @remarks
975
- *
976
- * This function has strict parsing behavior. For relaxed behavior, please use the `fromString` function.
977
- *
978
- * @see AIP-40 documentation for more details on address formats:
979
- * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
980
- *
981
- * @returns An instance of AccountAddress.
982
- * @group Implementation
983
- * @category Serialization
984
- */
985
- static fromStringStrict(input) {
986
- if (!input.startsWith("0x")) {
987
- throw new ParsingError("Hex string must start with a leading 0x.", "leading_zero_x_required" /* LEADING_ZERO_X_REQUIRED */);
988
- }
989
- const address = _AccountAddress.fromString(input);
990
- if (input.length !== _AccountAddress.LONG_STRING_LENGTH + 2) {
991
- if (!address.isSpecial()) {
992
- throw new ParsingError(
993
- `The given hex string ${input} is not a special address, it must be represented as 0x + 64 chars.`,
994
- "long_form_required_unless_special" /* LONG_FORM_REQUIRED_UNLESS_SPECIAL */
995
- );
996
- } else if (input.length !== 3) {
997
- throw new ParsingError(
998
- // eslint-disable-next-line max-len
999
- `The given hex string ${input} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,
1000
- "INVALID_PADDING_ZEROES" /* INVALID_PADDING_ZEROES */
1001
- );
1002
- }
1003
- }
1004
- return address;
1005
- }
1006
- /**
1007
- * NOTE: This function has relaxed parsing behavior. For strict behavior, please use
1008
- * the `fromStringStrict` function. Where possible use `fromStringStrict` rather than this
1009
- * function, `fromString`.
1010
- *
1011
- * Creates an instance of AccountAddress from a hex string.
1012
- *
1013
- * This function allows all formats defined by AIP-40. In short this means the
1014
- * following formats are accepted:
1015
- *
1016
- * - LONG, with or without leading 0x
1017
- * - SHORT*, with or without leading 0x
1018
- *
1019
- * Where:
1020
- * - LONG is 64 hex characters.
1021
- * - SHORT* is 1 to 63 hex characters inclusive. The address can have missing values up to `maxMissingChars` before it is padded.
1022
- * - Padding zeroes are allowed, e.g. 0x0123 is valid.
1023
- *
1024
- * Learn more about the different address formats by reading AIP-40:
1025
- * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
1026
- *
1027
- * @param input A hex string representing an account address.
1028
- * @param args.maxMissingChars The number of characters that can be missing in a padded address before it is invalid.
1029
- *
1030
- * @returns An instance of AccountAddress.
1031
- *
1032
- * @throws ParsingError if the hex string is too short, too long, or contains invalid characters.
1033
- * @group Implementation
1034
- * @category Serialization
1035
- */
1036
- static fromString(input, { maxMissingChars = 4 } = {}) {
1037
- let parsedInput = input;
1038
- if (input.startsWith("0x")) {
1039
- parsedInput = input.slice(2);
1040
- }
1041
- if (parsedInput.length === 0) {
1042
- throw new ParsingError(
1043
- "Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.",
1044
- "too_short" /* TOO_SHORT */
1045
- );
1046
- }
1047
- if (parsedInput.length > 64) {
1048
- throw new ParsingError(
1049
- "Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.",
1050
- "too_long" /* TOO_LONG */
1051
- );
1052
- }
1053
- if (maxMissingChars > 63 || maxMissingChars < 0) {
1054
- throw new ParsingError(
1055
- `maxMissingChars must be between or equal to 0 and 63. Received ${maxMissingChars}`,
1056
- "INVALID_PADDING_STRICTNESS" /* INVALID_PADDING_STRICTNESS */
1057
- );
1058
- }
1059
- let addressBytes;
1060
- try {
1061
- addressBytes = _utils.hexToBytes.call(void 0, parsedInput.padStart(64, "0"));
1062
- } catch (error) {
1063
- throw new ParsingError(`Hex characters are invalid: ${_optionalChain([error, 'optionalAccess', _4 => _4.message])}`, "invalid_hex_chars" /* INVALID_HEX_CHARS */);
1064
- }
1065
- const address = new _AccountAddress(addressBytes);
1066
- if (parsedInput.length < 64 - maxMissingChars) {
1067
- if (!address.isSpecial()) {
1068
- throw new ParsingError(
1069
- `Hex string is too short, must be ${64 - maxMissingChars} to 64 chars long, excluding the leading 0x. You may need to fix
1070
- the addresss by padding it with 0s before passing it to \`fromString\` (e.g. <addressString>.padStart(64, '0')).
1071
- Received ${input}`,
1072
- "too_short" /* TOO_SHORT */
1073
- );
1074
- }
1075
- }
1076
- return address;
1077
- }
1078
- /**
1079
- * Convenience method for creating an AccountAddress from various input types.
1080
- * This function accepts a string, Uint8Array, or an existing AccountAddress instance and returns the corresponding
1081
- * AccountAddress.
1082
- *
1083
- * @param input - The input to convert into an AccountAddress. This can be a string representation of an address, a Uint8Array,
1084
- * or an existing AccountAddress.
1085
- * @param args.maxMissingChars The number of characters that can be missing in a padded address before it is invalid.
1086
- * @group Implementation
1087
- * @category Serialization
1088
- */
1089
- static from(input, { maxMissingChars = 4 } = {}) {
1090
- if (typeof input === "string") {
1091
- return _AccountAddress.fromString(input, { maxMissingChars });
1092
- }
1093
- if (input instanceof Uint8Array) {
1094
- return new _AccountAddress(input);
1095
- }
1096
- return input;
1097
- }
1098
- /**
1099
- * Create an AccountAddress from various input types, including strings, Uint8Array, and AccountAddress instances.
1100
- *
1101
- * @param input - The input to convert into an AccountAddress, which can be a string, a Uint8Array, or an AccountAddress.
1102
- * @group Implementation
1103
- * @category Serialization
1104
- */
1105
- static fromStrict(input) {
1106
- if (typeof input === "string") {
1107
- return _AccountAddress.fromStringStrict(input);
1108
- }
1109
- if (input instanceof Uint8Array) {
1110
- return new _AccountAddress(input);
1111
- }
1112
- return input;
1113
- }
1114
- // ===
1115
- // Methods for checking validity.
1116
- // ===
1117
- /**
1118
- * Check if the provided input is a valid AccountAddress.
1119
- *
1120
- * @param args - The arguments for validation.
1121
- * @param args.input - A hex string representing an account address.
1122
- * @param args.strict - If true, use strict parsing behavior; if false, use relaxed parsing behavior.
1123
- *
1124
- * @returns An object indicating whether the address is valid. If valid, valid = true; if not, valid = false with additional details.
1125
- * If the address is invalid, invalidReason will explain why it is invalid, and invalidReasonMessage will provide the error message.
1126
- * @group Implementation
1127
- * @category Serialization
1128
- */
1129
- static isValid(args) {
1130
- try {
1131
- if (args.strict) {
1132
- _AccountAddress.fromStrict(args.input);
1133
- } else {
1134
- _AccountAddress.from(args.input);
1135
- }
1136
- return { valid: true };
1137
- } catch (error) {
1138
- return {
1139
- valid: false,
1140
- invalidReason: _optionalChain([error, 'optionalAccess', _5 => _5.invalidReason]),
1141
- invalidReasonMessage: _optionalChain([error, 'optionalAccess', _6 => _6.message])
1142
- };
1143
- }
1144
- }
1145
- /**
1146
- * Determine if two AccountAddresses are equal based on their underlying byte data.
1147
- *
1148
- * @param other - The AccountAddress to compare to.
1149
- * @returns true if the AccountAddresses are equal, false if not.
1150
- * @group Implementation
1151
- * @category Serialization
1152
- */
1153
- equals(other) {
1154
- if (this.data.length !== other.data.length) return false;
1155
- return this.data.every((value, index) => value === other.data[index]);
1156
- }
1157
- };
1158
- /**
1159
- * The number of bytes that make up an account address.
1160
- * @group Implementation
1161
- * @category Serialization
1162
- */
1163
- _AccountAddress.LENGTH = 32;
1164
- /**
1165
- * The length of an address string in LONG form without a leading 0x.
1166
- * @group Implementation
1167
- * @category Serialization
1168
- */
1169
- _AccountAddress.LONG_STRING_LENGTH = 64;
1170
- _AccountAddress.ZERO = _AccountAddress.from("0x0");
1171
- _AccountAddress.ONE = _AccountAddress.from("0x1");
1172
- _AccountAddress.TWO = _AccountAddress.from("0x2");
1173
- _AccountAddress.THREE = _AccountAddress.from("0x3");
1174
- _AccountAddress.FOUR = _AccountAddress.from("0x4");
1175
- _AccountAddress.A = _AccountAddress.from("0xA");
1176
- var AccountAddress = _AccountAddress;
1177
-
1178
- // src/utils/helpers.ts
1179
- var _jsbase64 = require('js-base64');
1180
- async function sleep(timeMs) {
1181
- return new Promise((resolve) => {
1182
- setTimeout(resolve, timeMs);
1183
- });
1184
- }
1185
- function getErrorMessage(error) {
1186
- return error instanceof Error ? error.message : String(error);
1187
- }
1188
- var nowInSeconds = () => Math.floor(Date.now() / 1e3);
1189
- function floorToWholeHour(timestampInSeconds) {
1190
- const date = new Date(timestampInSeconds * 1e3);
1191
- date.setMinutes(0);
1192
- date.setSeconds(0);
1193
- date.setMilliseconds(0);
1194
- return Math.floor(date.getTime() / 1e3);
1195
- }
1196
- function base64UrlDecode(base64Url) {
1197
- const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
1198
- const paddedBase64 = base64 + "==".substring(0, (3 - base64.length % 3) % 3);
1199
- const decodedString = _jsbase64.decode.call(void 0, paddedBase64);
1200
- return decodedString;
1201
- }
1202
- var convertAmountFromHumanReadableToOnChain = (value, decimal) => value * 10 ** decimal;
1203
- var convertAmountFromOnChainToHumanReadable = (value, decimal) => value / 10 ** decimal;
1204
- var hexToAscii = (hex) => {
1205
- let str = "";
1206
- for (let n = 2; n < hex.length; n += 2) {
1207
- str += String.fromCharCode(parseInt(hex.substring(n, n + 2), 16));
1208
- }
1209
- return str;
1210
- };
1211
- var parseEncodedStruct = (structObj) => {
1212
- const { account_address, module_name, struct_name } = structObj;
1213
- const moduleName = hexToAscii(module_name);
1214
- const structName = hexToAscii(struct_name);
1215
- return `${account_address}::${moduleName}::${structName}`;
1216
- };
1217
- var isEncodedStruct = (structObj) => typeof structObj === "object" && !Array.isArray(structObj) && structObj !== null && "account_address" in structObj && "module_name" in structObj && "struct_name" in structObj && typeof structObj.account_address === "string" && typeof structObj.module_name === "string" && typeof structObj.struct_name === "string";
1218
- function getFunctionParts(functionArg) {
1219
- const funcNameParts = functionArg.split("::");
1220
- if (funcNameParts.length !== 3) {
1221
- throw new Error(`Invalid function ${functionArg}`);
1222
- }
1223
- const moduleAddress = funcNameParts[0];
1224
- const moduleName = funcNameParts[1];
1225
- const functionName = funcNameParts[2];
1226
- return { moduleAddress, moduleName, functionName };
1227
- }
1228
- function isValidFunctionInfo(functionInfo) {
1229
- const parts = functionInfo.split("::");
1230
- return parts.length === 3 && AccountAddress.isValid({ input: parts[0] }).valid;
1231
- }
1232
- function truncateAddress(address, start = 6, end = 5) {
1233
- return `${address.slice(0, start)}...${address.slice(-end)}`;
1234
- }
1235
-
1236
-
1237
-
1238
-
1239
-
1240
-
1241
-
1242
-
1243
-
1244
-
1245
-
1246
-
1247
-
1248
-
1249
-
1250
-
1251
-
1252
-
1253
-
1254
-
1255
-
1256
-
1257
-
1258
-
1259
-
1260
-
1261
-
1262
-
1263
-
1264
-
1265
-
1266
-
1267
-
1268
-
1269
-
1270
-
1271
-
1272
-
1273
-
1274
-
1275
-
1276
-
1277
-
1278
-
1279
-
1280
-
1281
-
1282
-
1283
-
1284
-
1285
-
1286
-
1287
-
1288
-
1289
-
1290
-
1291
-
1292
-
1293
-
1294
-
1295
-
1296
-
1297
-
1298
-
1299
-
1300
-
1301
-
1302
-
1303
-
1304
- exports.__decorateClass = __decorateClass; exports.MAX_U8_NUMBER = MAX_U8_NUMBER; exports.MAX_U16_NUMBER = MAX_U16_NUMBER; exports.MAX_U32_NUMBER = MAX_U32_NUMBER; exports.MAX_U64_BIG_INT = MAX_U64_BIG_INT; exports.MAX_U128_BIG_INT = MAX_U128_BIG_INT; exports.MAX_U256_BIG_INT = MAX_U256_BIG_INT; exports.ParsingError = ParsingError; exports.HexInvalidReason = HexInvalidReason; exports.Hex = Hex; exports.hexToAsciiString = hexToAsciiString; exports.Serializable = Serializable; exports.Serializer = Serializer; exports.ensureBoolean = ensureBoolean; exports.outOfRangeErrorMessage = outOfRangeErrorMessage; exports.validateNumberInRange = validateNumberInRange; exports.MimeType = MimeType; exports.TypeTagVariants = TypeTagVariants; exports.ScriptTransactionArgumentVariants = ScriptTransactionArgumentVariants; exports.TransactionPayloadVariants = TransactionPayloadVariants; exports.TransactionVariants = TransactionVariants; exports.TransactionAuthenticatorVariant = TransactionAuthenticatorVariant; exports.AccountAuthenticatorVariant = AccountAuthenticatorVariant; exports.PrivateKeyVariants = PrivateKeyVariants; exports.AnyPublicKeyVariant = AnyPublicKeyVariant; exports.AnySignatureVariant = AnySignatureVariant; exports.EphemeralPublicKeyVariant = EphemeralPublicKeyVariant; exports.EphemeralSignatureVariant = EphemeralSignatureVariant; exports.EphemeralCertificateVariant = EphemeralCertificateVariant; exports.ZkpVariant = ZkpVariant; exports.TransactionResponseType = TransactionResponseType; exports.isPendingTransactionResponse = isPendingTransactionResponse; exports.isUserTransactionResponse = isUserTransactionResponse; exports.isGenesisTransactionResponse = isGenesisTransactionResponse; exports.isBlockMetadataTransactionResponse = isBlockMetadataTransactionResponse; exports.isStateCheckpointTransactionResponse = isStateCheckpointTransactionResponse; exports.isValidatorTransactionResponse = isValidatorTransactionResponse; exports.isBlockEpilogueTransactionResponse = isBlockEpilogueTransactionResponse; exports.isEd25519Signature = isEd25519Signature; exports.isSecp256k1Signature = isSecp256k1Signature; exports.isMultiAgentSignature = isMultiAgentSignature; exports.isFeePayerSignature = isFeePayerSignature; exports.isMultiEd25519Signature = isMultiEd25519Signature; exports.isSingleSenderSignature = isSingleSenderSignature; exports.isSingleSenderSingleKeySignature = isSingleSenderSingleKeySignature; exports.isSingleSenderMultiKeySignature = isSingleSenderMultiKeySignature; exports.MoveFunctionVisibility = MoveFunctionVisibility; exports.MoveAbility = MoveAbility; exports.RoleType = RoleType; exports.SigningScheme = SigningScheme; exports.SigningSchemeInput = SigningSchemeInput; exports.DeriveScheme = DeriveScheme; exports.CallArgument = _scriptcomposerpack.CallArgument; exports.AddressInvalidReason = AddressInvalidReason; exports.AccountAddress = AccountAddress; exports.sleep = sleep; exports.getErrorMessage = getErrorMessage; exports.nowInSeconds = nowInSeconds; exports.floorToWholeHour = floorToWholeHour; exports.base64UrlDecode = base64UrlDecode; exports.convertAmountFromHumanReadableToOnChain = convertAmountFromHumanReadableToOnChain; exports.convertAmountFromOnChainToHumanReadable = convertAmountFromOnChainToHumanReadable; exports.parseEncodedStruct = parseEncodedStruct; exports.isEncodedStruct = isEncodedStruct; exports.getFunctionParts = getFunctionParts; exports.isValidFunctionInfo = isValidFunctionInfo; exports.truncateAddress = truncateAddress;
1305
- //# sourceMappingURL=chunk-JMOQXLED.js.map