@aptos-labs/ts-sdk 1.30.0 → 1.32.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 (549) hide show
  1. package/README.md +1 -1
  2. package/dist/common/{accountAddress-DnSqjhSl.d.ts → accountAddress-6RqI8Aam.d.ts} +144 -63
  3. package/dist/common/chunk-F43XVDYJ.js +2 -0
  4. package/dist/common/chunk-F43XVDYJ.js.map +1 -0
  5. package/dist/common/cli/index.d.ts +1 -1
  6. package/dist/common/cli/index.js +1 -1
  7. package/dist/common/cli/index.js.map +1 -1
  8. package/dist/common/index.d.ts +546 -112
  9. package/dist/common/index.js +37 -28
  10. package/dist/common/index.js.map +1 -1
  11. package/dist/esm/{Ed25519Account-DpH9qAcg.d.mts → Ed25519Account-B3xHXAQe.d.mts} +2 -2
  12. package/dist/esm/account/AbstractKeylessAccount.d.mts +86 -14
  13. package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
  14. package/dist/esm/account/Account.d.mts +5 -4
  15. package/dist/esm/account/Account.mjs +1 -1
  16. package/dist/esm/account/Ed25519Account.d.mts +5 -4
  17. package/dist/esm/account/Ed25519Account.mjs +1 -1
  18. package/dist/esm/account/EphemeralKeyPair.d.mts +4 -3
  19. package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
  20. package/dist/esm/account/FederatedKeylessAccount.d.mts +57 -8
  21. package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
  22. package/dist/esm/account/KeylessAccount.d.mts +29 -11
  23. package/dist/esm/account/KeylessAccount.mjs +1 -1
  24. package/dist/esm/account/MultiKeyAccount.d.mts +23 -10
  25. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  26. package/dist/esm/account/SingleKeyAccount.d.mts +5 -4
  27. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  28. package/dist/esm/account/index.d.mts +6 -5
  29. package/dist/esm/account/index.mjs +1 -1
  30. package/dist/esm/api/account.d.mts +9 -6
  31. package/dist/esm/api/account.mjs +1 -1
  32. package/dist/esm/api/ans.d.mts +4 -3
  33. package/dist/esm/api/ans.mjs +1 -1
  34. package/dist/esm/api/aptos.d.mts +6 -4
  35. package/dist/esm/api/aptos.mjs +1 -1
  36. package/dist/esm/api/aptosConfig.d.mts +2 -1
  37. package/dist/esm/api/coin.d.mts +6 -5
  38. package/dist/esm/api/coin.mjs +1 -1
  39. package/dist/esm/api/digitalAsset.d.mts +7 -6
  40. package/dist/esm/api/digitalAsset.mjs +1 -1
  41. package/dist/esm/api/event.d.mts +4 -3
  42. package/dist/esm/api/event.mjs +1 -1
  43. package/dist/esm/api/faucet.d.mts +3 -2
  44. package/dist/esm/api/faucet.mjs +1 -1
  45. package/dist/esm/api/fungibleAsset.d.mts +6 -5
  46. package/dist/esm/api/fungibleAsset.mjs +1 -1
  47. package/dist/esm/api/general.d.mts +6 -5
  48. package/dist/esm/api/general.mjs +1 -1
  49. package/dist/esm/api/index.d.mts +6 -4
  50. package/dist/esm/api/index.mjs +1 -1
  51. package/dist/esm/api/keyless.d.mts +11 -9
  52. package/dist/esm/api/keyless.mjs +1 -1
  53. package/dist/esm/api/object.d.mts +5 -4
  54. package/dist/esm/api/object.mjs +1 -1
  55. package/dist/esm/api/staking.d.mts +5 -4
  56. package/dist/esm/api/staking.mjs +1 -1
  57. package/dist/esm/api/table.d.mts +4 -3
  58. package/dist/esm/api/table.mjs +1 -1
  59. package/dist/esm/api/transaction.d.mts +5 -3
  60. package/dist/esm/api/transaction.mjs +1 -1
  61. package/dist/esm/api/transactionSubmission/build.d.mts +69 -3
  62. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  63. package/dist/esm/api/transactionSubmission/management.d.mts +5 -4
  64. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  65. package/dist/esm/api/transactionSubmission/sign.d.mts +5 -4
  66. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  67. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  68. package/dist/esm/api/transactionSubmission/simulate.d.mts +4 -3
  69. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  70. package/dist/esm/api/transactionSubmission/submit.d.mts +4 -3
  71. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  72. package/dist/esm/api/utils.d.mts +3 -2
  73. package/dist/esm/api/utils.mjs +1 -1
  74. package/dist/esm/bcs/consts.d.mts +3 -2
  75. package/dist/esm/bcs/deserializer.d.mts +36 -27
  76. package/dist/esm/bcs/deserializer.mjs +1 -1
  77. package/dist/esm/bcs/index.d.mts +3 -2
  78. package/dist/esm/bcs/index.mjs +1 -1
  79. package/dist/esm/bcs/serializable/entryFunctionBytes.d.mts +3 -2
  80. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  81. package/dist/esm/bcs/serializable/fixedBytes.d.mts +3 -2
  82. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  83. package/dist/esm/bcs/serializable/movePrimitives.d.mts +3 -2
  84. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  85. package/dist/esm/bcs/serializable/moveStructs.d.mts +12 -12
  86. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  87. package/dist/esm/bcs/serializer.d.mts +14 -13
  88. package/dist/esm/bcs/serializer.mjs +1 -1
  89. package/dist/esm/{chunk-OV5UQ75K.mjs → chunk-2NHQQQZK.mjs} +2 -2
  90. package/dist/esm/{chunk-EF2PUPUH.mjs → chunk-2QBCTW67.mjs} +2 -2
  91. package/dist/esm/chunk-2QBCTW67.mjs.map +1 -0
  92. package/dist/esm/{chunk-JY3JJ55D.mjs → chunk-37Y54PJ5.mjs} +2 -2
  93. package/dist/esm/chunk-3DQVGPFE.mjs +2 -0
  94. package/dist/esm/chunk-3DQVGPFE.mjs.map +1 -0
  95. package/dist/esm/{chunk-XHCALZ7X.mjs → chunk-3XCYCFYI.mjs} +2 -2
  96. package/dist/esm/{chunk-6FLHGOKP.mjs → chunk-42H7WETG.mjs} +2 -2
  97. package/dist/esm/{chunk-RNAKZVRN.mjs → chunk-46L6BAJG.mjs} +2 -2
  98. package/dist/esm/{chunk-EN2HDNFE.mjs → chunk-4DNCQM3S.mjs} +2 -2
  99. package/dist/esm/chunk-4O5XDQDO.mjs +2 -0
  100. package/dist/esm/chunk-4PBXTMN3.mjs +2 -0
  101. package/dist/esm/chunk-4PBXTMN3.mjs.map +1 -0
  102. package/dist/esm/chunk-4YEOOZ2N.mjs +4 -0
  103. package/dist/esm/{chunk-KFSVKIFO.mjs.map → chunk-4YEOOZ2N.mjs.map} +1 -1
  104. package/dist/esm/{chunk-D3KBNFZR.mjs → chunk-5AKSORBJ.mjs} +2 -2
  105. package/dist/esm/chunk-5B3SMBXQ.mjs +2 -0
  106. package/dist/esm/{chunk-EKZQ3EYX.mjs → chunk-5NJWJXSS.mjs} +2 -2
  107. package/dist/esm/{chunk-2QRWGJJA.mjs → chunk-6K4TOFCO.mjs} +2 -2
  108. package/dist/esm/{chunk-OLPI7QAH.mjs → chunk-6LLGRGCN.mjs} +2 -2
  109. package/dist/esm/chunk-6LLGRGCN.mjs.map +1 -0
  110. package/dist/esm/{chunk-R3Y6WH2U.mjs → chunk-6PJH53CK.mjs} +2 -2
  111. package/dist/esm/{chunk-PCLU4KLY.mjs → chunk-6ZOVTYLJ.mjs} +2 -2
  112. package/dist/esm/chunk-7ECCT6PK.mjs +1 -0
  113. package/dist/esm/chunk-7WXDXBXK.mjs +2 -0
  114. package/dist/esm/{chunk-UKAXCARD.mjs.map → chunk-7WXDXBXK.mjs.map} +1 -1
  115. package/dist/esm/{chunk-JNHFQTFC.mjs → chunk-AAATWCJT.mjs} +2 -2
  116. package/dist/esm/{chunk-NODYW7DM.mjs → chunk-ACVIE7IE.mjs} +2 -2
  117. package/dist/esm/chunk-AHWZA3GD.mjs +2 -0
  118. package/dist/esm/chunk-AHWZA3GD.mjs.map +1 -0
  119. package/dist/esm/chunk-AITN3DO4.mjs +2 -0
  120. package/dist/esm/chunk-AITN3DO4.mjs.map +1 -0
  121. package/dist/esm/{chunk-QQIVWB6G.mjs → chunk-AJ5JHBAE.mjs} +2 -2
  122. package/dist/esm/{chunk-QQIVWB6G.mjs.map → chunk-AJ5JHBAE.mjs.map} +1 -1
  123. package/dist/esm/{chunk-PRZ7AIGA.mjs → chunk-AKIO3OIT.mjs} +2 -2
  124. package/dist/esm/chunk-AMCJQIOT.mjs +2 -0
  125. package/dist/esm/{chunk-UI3AKMZX.mjs.map → chunk-AMCJQIOT.mjs.map} +1 -1
  126. package/dist/esm/{chunk-KRVLR3L4.mjs → chunk-AOROYJ74.mjs} +2 -2
  127. package/dist/esm/chunk-AVPQOD67.mjs +2 -0
  128. package/dist/esm/chunk-AVPQOD67.mjs.map +1 -0
  129. package/dist/esm/chunk-AVZYJAXR.mjs +2 -0
  130. package/dist/esm/chunk-AVZYJAXR.mjs.map +1 -0
  131. package/dist/esm/{chunk-6AGTDRNM.mjs → chunk-BLLHTGAP.mjs} +2 -2
  132. package/dist/esm/{chunk-JGNMNCQB.mjs → chunk-BRV3RLKW.mjs} +2 -2
  133. package/dist/esm/{chunk-GIQQF2PD.mjs → chunk-CA3Q2X6B.mjs} +2 -2
  134. package/dist/esm/chunk-D52UKPQF.mjs +2 -0
  135. package/dist/esm/chunk-D52UKPQF.mjs.map +1 -0
  136. package/dist/esm/{chunk-FPF4KZ5M.mjs → chunk-DDVOBEJA.mjs} +2 -2
  137. package/dist/esm/chunk-DDVOBEJA.mjs.map +1 -0
  138. package/dist/esm/{chunk-QRTZYRH2.mjs → chunk-DP3YPGIK.mjs} +2 -2
  139. package/dist/esm/{chunk-DXQT55L3.mjs → chunk-DSKAMBBL.mjs} +2 -2
  140. package/dist/esm/{chunk-RAXP3STS.mjs → chunk-E2NYQVP3.mjs} +2 -2
  141. package/dist/esm/chunk-EEB7EZFO.mjs +2 -0
  142. package/dist/esm/chunk-EEB7EZFO.mjs.map +1 -0
  143. package/dist/esm/{chunk-WUCPTRXU.mjs → chunk-F2AIWA7L.mjs} +2 -2
  144. package/dist/esm/chunk-F45G3GP3.mjs +7 -0
  145. package/dist/esm/chunk-F45G3GP3.mjs.map +1 -0
  146. package/dist/esm/{chunk-VQTEGTUQ.mjs → chunk-FXUI3SSD.mjs} +2 -2
  147. package/dist/esm/chunk-G2GN4LH5.mjs +2 -0
  148. package/dist/esm/chunk-G2GN4LH5.mjs.map +1 -0
  149. package/dist/esm/chunk-GBVRCWCD.mjs +2 -0
  150. package/dist/esm/chunk-GBVRCWCD.mjs.map +1 -0
  151. package/dist/esm/chunk-H457BI3I.mjs +2 -0
  152. package/dist/esm/chunk-H457BI3I.mjs.map +1 -0
  153. package/dist/esm/{chunk-5AAFF2PV.mjs → chunk-HEHVWRMO.mjs} +2 -2
  154. package/dist/esm/{chunk-ZUTOMGB7.mjs → chunk-HFWFDS6Y.mjs} +2 -2
  155. package/dist/esm/{chunk-QBWGWHJK.mjs → chunk-HXXELLHN.mjs} +2 -2
  156. package/dist/esm/{chunk-LD5MUWGW.mjs → chunk-IBMZYDAR.mjs} +2 -2
  157. package/dist/esm/{chunk-QBP4XJT5.mjs → chunk-IDNDUJOK.mjs} +2 -2
  158. package/dist/esm/{chunk-HCV3NGLS.mjs → chunk-II654QZU.mjs} +2 -2
  159. package/dist/esm/{chunk-XIY2VORC.mjs → chunk-JDNI5VIJ.mjs} +2 -2
  160. package/dist/esm/{chunk-HAMXSLWF.mjs → chunk-JJUINAQE.mjs} +2 -2
  161. package/dist/esm/{chunk-K6MZXKVV.mjs → chunk-JLD7DLKM.mjs} +2 -2
  162. package/dist/esm/chunk-JNO7KPMG.mjs +4 -0
  163. package/dist/esm/chunk-JNO7KPMG.mjs.map +1 -0
  164. package/dist/esm/chunk-K4TJRYGQ.mjs +2 -0
  165. package/dist/esm/chunk-K4TJRYGQ.mjs.map +1 -0
  166. package/dist/esm/{chunk-NV6DHDM3.mjs → chunk-KA5FX53Q.mjs} +2 -2
  167. package/dist/esm/{chunk-CRL4WGOH.mjs → chunk-KT3DT5GV.mjs} +2 -2
  168. package/dist/esm/chunk-KT3DT5GV.mjs.map +1 -0
  169. package/dist/esm/chunk-KUL55M2H.mjs +2 -0
  170. package/dist/esm/chunk-KUL55M2H.mjs.map +1 -0
  171. package/dist/esm/{chunk-JDYASF3E.mjs → chunk-L2QVUMBV.mjs} +2 -2
  172. package/dist/esm/chunk-L2SDI7PI.mjs +2 -0
  173. package/dist/esm/chunk-L2SDI7PI.mjs.map +1 -0
  174. package/dist/esm/chunk-L56DQ4N3.mjs +2 -0
  175. package/dist/esm/chunk-L56DQ4N3.mjs.map +1 -0
  176. package/dist/esm/{chunk-S3FVA55H.mjs → chunk-LAAFLCDM.mjs} +2 -2
  177. package/dist/esm/{chunk-AGBA3Y7A.mjs → chunk-LGTOOAQI.mjs} +2 -2
  178. package/dist/esm/chunk-MHN6XY4Z.mjs +2 -0
  179. package/dist/esm/{chunk-PHG2IWZW.mjs → chunk-MOGPSSTD.mjs} +2 -2
  180. package/dist/esm/{chunk-KSKQVOBA.mjs → chunk-NARS3JDH.mjs} +2 -2
  181. package/dist/esm/{chunk-KSUZS6EL.mjs → chunk-NHKAQRJB.mjs} +2 -2
  182. package/dist/esm/{chunk-PHP47DI4.mjs → chunk-OIOGOW6I.mjs} +1 -1
  183. package/dist/esm/{chunk-PHP47DI4.mjs.map → chunk-OIOGOW6I.mjs.map} +1 -1
  184. package/dist/esm/{chunk-DCUVV3VY.mjs → chunk-OJBMR5CT.mjs} +2 -2
  185. package/dist/esm/chunk-OJBMR5CT.mjs.map +1 -0
  186. package/dist/esm/{chunk-TIZL5YVP.mjs → chunk-OKE3FXIP.mjs} +2 -2
  187. package/dist/esm/chunk-ONFKJ57C.mjs +2 -0
  188. package/dist/esm/chunk-ONFKJ57C.mjs.map +1 -0
  189. package/dist/esm/{chunk-ZINOJTLU.mjs → chunk-OPO5EYF7.mjs} +2 -2
  190. package/dist/esm/{chunk-HDTKBFRX.mjs → chunk-PW3ISXPN.mjs} +2 -2
  191. package/dist/esm/{chunk-WIXNX7HY.mjs → chunk-QQM47PHZ.mjs} +2 -2
  192. package/dist/esm/{chunk-5XXIIWG7.mjs → chunk-SBCLBDCP.mjs} +2 -2
  193. package/dist/esm/chunk-SPRNSFUV.mjs +2 -0
  194. package/dist/esm/chunk-SPRNSFUV.mjs.map +1 -0
  195. package/dist/esm/{chunk-Z36WHOZV.mjs → chunk-SU2WB34N.mjs} +2 -2
  196. package/dist/esm/{chunk-OTY3NO7Q.mjs → chunk-T6ADNZE5.mjs} +2 -2
  197. package/dist/esm/{chunk-IECDO22V.mjs → chunk-TM7OZT3W.mjs} +2 -2
  198. package/dist/esm/chunk-TM7OZT3W.mjs.map +1 -0
  199. package/dist/esm/chunk-UGTIALNW.mjs +2 -0
  200. package/dist/esm/chunk-UIRAXHDH.mjs +1 -0
  201. package/dist/esm/chunk-UZTJWOLS.mjs +2 -0
  202. package/dist/esm/chunk-V4FKFCBL.mjs +2 -0
  203. package/dist/esm/chunk-V4FKFCBL.mjs.map +1 -0
  204. package/dist/esm/{chunk-7V6RL27I.mjs → chunk-VCY3JGZM.mjs} +2 -2
  205. package/dist/esm/{chunk-XOCRDV2V.mjs → chunk-VQZMI3EZ.mjs} +2 -2
  206. package/dist/esm/chunk-WGIYSLH6.mjs +2 -0
  207. package/dist/esm/chunk-WGIYSLH6.mjs.map +1 -0
  208. package/dist/esm/{chunk-WOOH5MMX.mjs → chunk-WKNX43KN.mjs} +2 -2
  209. package/dist/esm/chunk-WKNX43KN.mjs.map +1 -0
  210. package/dist/esm/chunk-WQF3IOXC.mjs +2 -0
  211. package/dist/esm/chunk-WQF3IOXC.mjs.map +1 -0
  212. package/dist/esm/{chunk-N3OYD6VZ.mjs → chunk-WSFHH3BK.mjs} +2 -2
  213. package/dist/esm/{chunk-7PVIWKGT.mjs → chunk-X3JPX7T6.mjs} +2 -2
  214. package/dist/esm/{chunk-HGVZ7ULA.mjs → chunk-XKOSS5KC.mjs} +2 -2
  215. package/dist/esm/{chunk-TRU3EK64.mjs → chunk-XT5T5LAP.mjs} +2 -2
  216. package/dist/esm/chunk-XUP6VABV.mjs +2 -0
  217. package/dist/esm/chunk-XUP6VABV.mjs.map +1 -0
  218. package/dist/esm/{chunk-FO4F3OJJ.mjs → chunk-YNT7JHMS.mjs} +2 -2
  219. package/dist/esm/{chunk-37UZKMJI.mjs → chunk-YPBNYKOD.mjs} +2 -2
  220. package/dist/esm/{chunk-IFHQSZLK.mjs → chunk-YZ3YPLEU.mjs} +2 -2
  221. package/dist/esm/{chunk-OZN3OOJV.mjs → chunk-ZMBXHMVQ.mjs} +2 -2
  222. package/dist/esm/{chunk-BQXVHY7J.mjs → chunk-ZRWZIAF5.mjs} +2 -2
  223. package/dist/esm/cli/index.d.mts +3 -2
  224. package/dist/esm/cli/index.mjs +1 -1
  225. package/dist/esm/cli/localNode.mjs +1 -1
  226. package/dist/esm/cli/move.d.mts +2 -1
  227. package/dist/esm/cli/move.mjs +1 -1
  228. package/dist/esm/client/core.d.mts +2 -2
  229. package/dist/esm/client/core.mjs +1 -1
  230. package/dist/esm/client/get.d.mts +2 -2
  231. package/dist/esm/client/get.mjs +1 -1
  232. package/dist/esm/client/index.d.mts +3 -3
  233. package/dist/esm/client/index.mjs +1 -1
  234. package/dist/esm/client/post.d.mts +2 -2
  235. package/dist/esm/client/post.mjs +1 -1
  236. package/dist/esm/core/account/index.d.mts +3 -2
  237. package/dist/esm/core/account/index.mjs +1 -1
  238. package/dist/esm/core/account/utils/address.d.mts +3 -2
  239. package/dist/esm/core/account/utils/address.mjs +1 -1
  240. package/dist/esm/core/account/utils/index.d.mts +3 -2
  241. package/dist/esm/core/account/utils/index.mjs +1 -1
  242. package/dist/esm/core/accountAddress.d.mts +20 -10
  243. package/dist/esm/core/accountAddress.mjs +1 -1
  244. package/dist/esm/core/authenticationKey.d.mts +4 -3
  245. package/dist/esm/core/authenticationKey.mjs +1 -1
  246. package/dist/esm/core/crypto/ed25519.d.mts +27 -12
  247. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  248. package/dist/esm/core/crypto/ephemeral.d.mts +4 -3
  249. package/dist/esm/core/crypto/ephemeral.mjs +1 -1
  250. package/dist/esm/core/crypto/federatedKeyless.d.mts +5 -4
  251. package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
  252. package/dist/esm/core/crypto/hdKey.d.mts +0 -1
  253. package/dist/esm/core/crypto/hdKey.mjs +1 -1
  254. package/dist/esm/core/crypto/index.d.mts +5 -4
  255. package/dist/esm/core/crypto/index.mjs +1 -1
  256. package/dist/esm/core/crypto/keyless.d.mts +73 -11
  257. package/dist/esm/core/crypto/keyless.mjs +1 -1
  258. package/dist/esm/core/crypto/multiEd25519.d.mts +4 -3
  259. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  260. package/dist/esm/core/crypto/multiKey.d.mts +4 -3
  261. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  262. package/dist/esm/core/crypto/privateKey.d.mts +38 -10
  263. package/dist/esm/core/crypto/privateKey.mjs +1 -1
  264. package/dist/esm/core/crypto/proof.d.mts +3 -2
  265. package/dist/esm/core/crypto/proof.mjs +1 -1
  266. package/dist/esm/core/crypto/publicKey.d.mts +4 -3
  267. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  268. package/dist/esm/core/crypto/secp256k1.d.mts +24 -9
  269. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  270. package/dist/esm/core/crypto/signature.d.mts +3 -2
  271. package/dist/esm/core/crypto/signature.mjs +1 -1
  272. package/dist/esm/core/crypto/singleKey.d.mts +4 -3
  273. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  274. package/dist/esm/core/crypto/utils.d.mts +3 -2
  275. package/dist/esm/core/crypto/utils.mjs +1 -1
  276. package/dist/esm/core/hex.d.mts +40 -3
  277. package/dist/esm/core/hex.mjs +1 -1
  278. package/dist/esm/core/index.d.mts +6 -5
  279. package/dist/esm/core/index.mjs +1 -1
  280. package/dist/esm/errors/index.d.mts +123 -0
  281. package/dist/esm/errors/index.mjs +2 -0
  282. package/dist/esm/index.d.mts +13 -11
  283. package/dist/esm/index.mjs +1 -1
  284. package/dist/esm/internal/account.d.mts +5 -4
  285. package/dist/esm/internal/account.mjs +1 -1
  286. package/dist/esm/internal/ans.d.mts +5 -4
  287. package/dist/esm/internal/ans.mjs +1 -1
  288. package/dist/esm/internal/coin.d.mts +3 -2
  289. package/dist/esm/internal/coin.mjs +1 -1
  290. package/dist/esm/internal/digitalAsset.d.mts +5 -4
  291. package/dist/esm/internal/digitalAsset.mjs +1 -1
  292. package/dist/esm/internal/event.d.mts +3 -2
  293. package/dist/esm/internal/event.mjs +1 -1
  294. package/dist/esm/internal/faucet.d.mts +2 -1
  295. package/dist/esm/internal/faucet.mjs +1 -1
  296. package/dist/esm/internal/fungibleAsset.d.mts +5 -4
  297. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  298. package/dist/esm/internal/general.d.mts +3 -2
  299. package/dist/esm/internal/general.mjs +1 -1
  300. package/dist/esm/internal/keyless.d.mts +13 -7
  301. package/dist/esm/internal/keyless.mjs +1 -1
  302. package/dist/esm/internal/object.d.mts +3 -2
  303. package/dist/esm/internal/object.mjs +1 -1
  304. package/dist/esm/internal/staking.d.mts +2 -1
  305. package/dist/esm/internal/staking.mjs +1 -1
  306. package/dist/esm/internal/table.d.mts +3 -2
  307. package/dist/esm/internal/table.mjs +1 -1
  308. package/dist/esm/internal/transaction.d.mts +2 -1
  309. package/dist/esm/internal/transaction.mjs +1 -1
  310. package/dist/esm/internal/transactionSubmission.d.mts +4 -3
  311. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  312. package/dist/esm/internal/view.d.mts +4 -3
  313. package/dist/esm/internal/view.mjs +1 -1
  314. package/dist/esm/{publicKey-_tPa99ea.d.mts → publicKey-BVXX1nVl.d.mts} +2 -2
  315. package/dist/esm/transactions/authenticator/account.d.mts +4 -3
  316. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  317. package/dist/esm/transactions/authenticator/index.d.mts +4 -3
  318. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  319. package/dist/esm/transactions/authenticator/transaction.d.mts +10 -4
  320. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  321. package/dist/esm/transactions/index.d.mts +7 -5
  322. package/dist/esm/transactions/index.mjs +1 -1
  323. package/dist/esm/transactions/instances/chainId.d.mts +3 -2
  324. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  325. package/dist/esm/transactions/instances/identifier.d.mts +3 -2
  326. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  327. package/dist/esm/transactions/instances/index.d.mts +4 -3
  328. package/dist/esm/transactions/instances/index.mjs +1 -1
  329. package/dist/esm/transactions/instances/moduleId.d.mts +3 -2
  330. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  331. package/dist/esm/transactions/instances/multiAgentTransaction.d.mts +3 -2
  332. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  333. package/dist/esm/transactions/instances/rawTransaction.d.mts +3 -2
  334. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  335. package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +4 -3
  336. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  337. package/dist/esm/transactions/instances/signedTransaction.d.mts +4 -3
  338. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  339. package/dist/esm/transactions/instances/simpleTransaction.d.mts +3 -2
  340. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  341. package/dist/esm/transactions/instances/transactionArgument.d.mts +3 -2
  342. package/dist/esm/transactions/instances/transactionPayload.d.mts +3 -2
  343. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  344. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +5 -4
  345. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  346. package/dist/esm/transactions/management/index.d.mts +5 -4
  347. package/dist/esm/transactions/management/index.mjs +1 -1
  348. package/dist/esm/transactions/management/transactionWorker.d.mts +5 -4
  349. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  350. package/dist/esm/transactions/script-composer/index.d.mts +44 -0
  351. package/dist/esm/transactions/script-composer/index.mjs +2 -0
  352. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +3 -2
  353. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  354. package/dist/esm/transactions/transactionBuilder/index.d.mts +5 -4
  355. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  356. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +26 -5
  357. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  358. package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +4 -3
  359. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  360. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +4 -3
  361. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  362. package/dist/esm/transactions/typeTag/index.d.mts +3 -2
  363. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  364. package/dist/esm/transactions/typeTag/parser.d.mts +3 -2
  365. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  366. package/dist/esm/transactions/types.d.mts +12 -3
  367. package/dist/esm/types/index.d.mts +4 -1260
  368. package/dist/esm/types/index.mjs +1 -1
  369. package/dist/esm/types/keyless.d.mts +22 -1
  370. package/dist/esm/types/types.d.mts +1290 -0
  371. package/dist/esm/types/types.mjs +2 -0
  372. package/dist/esm/types/types.mjs.map +1 -0
  373. package/dist/esm/utils/helpers.d.mts +11 -3
  374. package/dist/esm/utils/helpers.mjs +1 -1
  375. package/dist/esm/utils/index.d.mts +3 -2
  376. package/dist/esm/utils/index.mjs +1 -1
  377. package/dist/esm/utils/normalizeBundle.d.mts +3 -2
  378. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  379. package/dist/esm/version.d.mts +1 -1
  380. package/dist/esm/version.mjs +1 -1
  381. package/package.json +3 -2
  382. package/src/account/AbstractKeylessAccount.ts +203 -10
  383. package/src/account/FederatedKeylessAccount.ts +83 -35
  384. package/src/account/KeylessAccount.ts +44 -37
  385. package/src/account/MultiKeyAccount.ts +18 -5
  386. package/src/api/account.ts +12 -2
  387. package/src/api/keyless.ts +4 -3
  388. package/src/api/transactionSubmission/build.ts +82 -1
  389. package/src/bcs/deserializer.ts +53 -30
  390. package/src/bcs/serializable/moveStructs.ts +16 -17
  391. package/src/bcs/serializer.ts +22 -12
  392. package/src/cli/move.ts +20 -5
  393. package/src/client/core.ts +2 -2
  394. package/src/client/get.ts +1 -2
  395. package/src/client/index.ts +0 -1
  396. package/src/client/post.ts +1 -2
  397. package/src/core/accountAddress.ts +36 -9
  398. package/src/core/crypto/ed25519.ts +34 -14
  399. package/src/core/crypto/hdKey.ts +0 -1
  400. package/src/core/crypto/keyless.ts +245 -38
  401. package/src/core/crypto/privateKey.ts +81 -5
  402. package/src/core/crypto/secp256k1.ts +31 -11
  403. package/src/core/hex.ts +47 -0
  404. package/src/errors/index.ts +406 -0
  405. package/src/index.ts +1 -0
  406. package/src/internal/account.ts +6 -6
  407. package/src/internal/ans.ts +2 -1
  408. package/src/internal/keyless.ts +50 -20
  409. package/src/internal/transaction.ts +2 -1
  410. package/src/internal/transactionSubmission.ts +36 -18
  411. package/src/transactions/authenticator/transaction.ts +20 -0
  412. package/src/transactions/index.ts +1 -0
  413. package/src/transactions/script-composer/index.ts +76 -0
  414. package/src/transactions/transactionBuilder/remoteAbi.ts +55 -1
  415. package/src/transactions/types.ts +11 -0
  416. package/src/types/index.ts +2 -1483
  417. package/src/types/keyless.ts +19 -0
  418. package/src/types/types.ts +1512 -0
  419. package/src/utils/helpers.ts +10 -0
  420. package/src/version.ts +1 -1
  421. package/dist/common/chunk-7IYTZDXV.js +0 -2
  422. package/dist/common/chunk-7IYTZDXV.js.map +0 -1
  423. package/dist/esm/chunk-2I56E4T2.mjs +0 -2
  424. package/dist/esm/chunk-2I56E4T2.mjs.map +0 -1
  425. package/dist/esm/chunk-4CDDWSKZ.mjs +0 -2
  426. package/dist/esm/chunk-4OV7QU2U.mjs +0 -2
  427. package/dist/esm/chunk-5CCHECTE.mjs +0 -2
  428. package/dist/esm/chunk-5CCHECTE.mjs.map +0 -1
  429. package/dist/esm/chunk-5ZBHIUWG.mjs +0 -2
  430. package/dist/esm/chunk-5ZBHIUWG.mjs.map +0 -1
  431. package/dist/esm/chunk-7D3RY73L.mjs +0 -2
  432. package/dist/esm/chunk-7D3RY73L.mjs.map +0 -1
  433. package/dist/esm/chunk-7XS45O6M.mjs +0 -2
  434. package/dist/esm/chunk-7XS45O6M.mjs.map +0 -1
  435. package/dist/esm/chunk-CRL4WGOH.mjs.map +0 -1
  436. package/dist/esm/chunk-DCUVV3VY.mjs.map +0 -1
  437. package/dist/esm/chunk-DZJXOL64.mjs +0 -2
  438. package/dist/esm/chunk-DZJXOL64.mjs.map +0 -1
  439. package/dist/esm/chunk-EF2PUPUH.mjs.map +0 -1
  440. package/dist/esm/chunk-FPF4KZ5M.mjs.map +0 -1
  441. package/dist/esm/chunk-FY7TSOUU.mjs +0 -2
  442. package/dist/esm/chunk-FY7TSOUU.mjs.map +0 -1
  443. package/dist/esm/chunk-GPZRGLU2.mjs +0 -2
  444. package/dist/esm/chunk-GPZRGLU2.mjs.map +0 -1
  445. package/dist/esm/chunk-GQABU3RQ.mjs +0 -2
  446. package/dist/esm/chunk-GQABU3RQ.mjs.map +0 -1
  447. package/dist/esm/chunk-I5OYNCZS.mjs +0 -1
  448. package/dist/esm/chunk-IBLZ6MZU.mjs +0 -2
  449. package/dist/esm/chunk-IECDO22V.mjs.map +0 -1
  450. package/dist/esm/chunk-KFNDDPOW.mjs +0 -2
  451. package/dist/esm/chunk-KFNDDPOW.mjs.map +0 -1
  452. package/dist/esm/chunk-KFSVKIFO.mjs +0 -2
  453. package/dist/esm/chunk-KIW54KWR.mjs +0 -2
  454. package/dist/esm/chunk-KM6UXNC7.mjs +0 -2
  455. package/dist/esm/chunk-KM6UXNC7.mjs.map +0 -1
  456. package/dist/esm/chunk-KUX6GQ2E.mjs +0 -1
  457. package/dist/esm/chunk-L5I7F3NZ.mjs +0 -2
  458. package/dist/esm/chunk-L5I7F3NZ.mjs.map +0 -1
  459. package/dist/esm/chunk-LEKBJ2EG.mjs +0 -2
  460. package/dist/esm/chunk-LEKBJ2EG.mjs.map +0 -1
  461. package/dist/esm/chunk-LZS7BQ2B.mjs +0 -2
  462. package/dist/esm/chunk-LZS7BQ2B.mjs.map +0 -1
  463. package/dist/esm/chunk-N2FKVZ4D.mjs +0 -1
  464. package/dist/esm/chunk-N47FTRYO.mjs +0 -2
  465. package/dist/esm/chunk-N47FTRYO.mjs.map +0 -1
  466. package/dist/esm/chunk-OLPI7QAH.mjs.map +0 -1
  467. package/dist/esm/chunk-ONBFUPEC.mjs +0 -2
  468. package/dist/esm/chunk-OS2EG6AE.mjs +0 -2
  469. package/dist/esm/chunk-OS2EG6AE.mjs.map +0 -1
  470. package/dist/esm/chunk-PGZWRY7A.mjs +0 -2
  471. package/dist/esm/chunk-PGZWRY7A.mjs.map +0 -1
  472. package/dist/esm/chunk-RUDS7RSB.mjs +0 -2
  473. package/dist/esm/chunk-RUDS7RSB.mjs.map +0 -1
  474. package/dist/esm/chunk-UI3AKMZX.mjs +0 -2
  475. package/dist/esm/chunk-UKAXCARD.mjs +0 -2
  476. package/dist/esm/chunk-WOOH5MMX.mjs.map +0 -1
  477. package/dist/esm/chunk-WSVOJSAC.mjs +0 -2
  478. package/dist/esm/chunk-WSVOJSAC.mjs.map +0 -1
  479. package/dist/esm/chunk-ZS3EWM5A.mjs +0 -2
  480. package/dist/esm/chunk-ZS3EWM5A.mjs.map +0 -1
  481. package/dist/esm/client/types.d.mts +0 -66
  482. package/dist/esm/client/types.mjs +0 -2
  483. package/src/client/types.ts +0 -138
  484. /package/dist/esm/{chunk-OV5UQ75K.mjs.map → chunk-2NHQQQZK.mjs.map} +0 -0
  485. /package/dist/esm/{chunk-JY3JJ55D.mjs.map → chunk-37Y54PJ5.mjs.map} +0 -0
  486. /package/dist/esm/{chunk-XHCALZ7X.mjs.map → chunk-3XCYCFYI.mjs.map} +0 -0
  487. /package/dist/esm/{chunk-6FLHGOKP.mjs.map → chunk-42H7WETG.mjs.map} +0 -0
  488. /package/dist/esm/{chunk-RNAKZVRN.mjs.map → chunk-46L6BAJG.mjs.map} +0 -0
  489. /package/dist/esm/{chunk-EN2HDNFE.mjs.map → chunk-4DNCQM3S.mjs.map} +0 -0
  490. /package/dist/esm/{chunk-IBLZ6MZU.mjs.map → chunk-4O5XDQDO.mjs.map} +0 -0
  491. /package/dist/esm/{chunk-D3KBNFZR.mjs.map → chunk-5AKSORBJ.mjs.map} +0 -0
  492. /package/dist/esm/{chunk-KIW54KWR.mjs.map → chunk-5B3SMBXQ.mjs.map} +0 -0
  493. /package/dist/esm/{chunk-EKZQ3EYX.mjs.map → chunk-5NJWJXSS.mjs.map} +0 -0
  494. /package/dist/esm/{chunk-2QRWGJJA.mjs.map → chunk-6K4TOFCO.mjs.map} +0 -0
  495. /package/dist/esm/{chunk-R3Y6WH2U.mjs.map → chunk-6PJH53CK.mjs.map} +0 -0
  496. /package/dist/esm/{chunk-PCLU4KLY.mjs.map → chunk-6ZOVTYLJ.mjs.map} +0 -0
  497. /package/dist/esm/{chunk-I5OYNCZS.mjs.map → chunk-7ECCT6PK.mjs.map} +0 -0
  498. /package/dist/esm/{chunk-JNHFQTFC.mjs.map → chunk-AAATWCJT.mjs.map} +0 -0
  499. /package/dist/esm/{chunk-NODYW7DM.mjs.map → chunk-ACVIE7IE.mjs.map} +0 -0
  500. /package/dist/esm/{chunk-PRZ7AIGA.mjs.map → chunk-AKIO3OIT.mjs.map} +0 -0
  501. /package/dist/esm/{chunk-KRVLR3L4.mjs.map → chunk-AOROYJ74.mjs.map} +0 -0
  502. /package/dist/esm/{chunk-6AGTDRNM.mjs.map → chunk-BLLHTGAP.mjs.map} +0 -0
  503. /package/dist/esm/{chunk-JGNMNCQB.mjs.map → chunk-BRV3RLKW.mjs.map} +0 -0
  504. /package/dist/esm/{chunk-GIQQF2PD.mjs.map → chunk-CA3Q2X6B.mjs.map} +0 -0
  505. /package/dist/esm/{chunk-QRTZYRH2.mjs.map → chunk-DP3YPGIK.mjs.map} +0 -0
  506. /package/dist/esm/{chunk-DXQT55L3.mjs.map → chunk-DSKAMBBL.mjs.map} +0 -0
  507. /package/dist/esm/{chunk-RAXP3STS.mjs.map → chunk-E2NYQVP3.mjs.map} +0 -0
  508. /package/dist/esm/{chunk-WUCPTRXU.mjs.map → chunk-F2AIWA7L.mjs.map} +0 -0
  509. /package/dist/esm/{chunk-VQTEGTUQ.mjs.map → chunk-FXUI3SSD.mjs.map} +0 -0
  510. /package/dist/esm/{chunk-5AAFF2PV.mjs.map → chunk-HEHVWRMO.mjs.map} +0 -0
  511. /package/dist/esm/{chunk-ZUTOMGB7.mjs.map → chunk-HFWFDS6Y.mjs.map} +0 -0
  512. /package/dist/esm/{chunk-QBWGWHJK.mjs.map → chunk-HXXELLHN.mjs.map} +0 -0
  513. /package/dist/esm/{chunk-LD5MUWGW.mjs.map → chunk-IBMZYDAR.mjs.map} +0 -0
  514. /package/dist/esm/{chunk-QBP4XJT5.mjs.map → chunk-IDNDUJOK.mjs.map} +0 -0
  515. /package/dist/esm/{chunk-HCV3NGLS.mjs.map → chunk-II654QZU.mjs.map} +0 -0
  516. /package/dist/esm/{chunk-XIY2VORC.mjs.map → chunk-JDNI5VIJ.mjs.map} +0 -0
  517. /package/dist/esm/{chunk-HAMXSLWF.mjs.map → chunk-JJUINAQE.mjs.map} +0 -0
  518. /package/dist/esm/{chunk-K6MZXKVV.mjs.map → chunk-JLD7DLKM.mjs.map} +0 -0
  519. /package/dist/esm/{chunk-NV6DHDM3.mjs.map → chunk-KA5FX53Q.mjs.map} +0 -0
  520. /package/dist/esm/{chunk-JDYASF3E.mjs.map → chunk-L2QVUMBV.mjs.map} +0 -0
  521. /package/dist/esm/{chunk-S3FVA55H.mjs.map → chunk-LAAFLCDM.mjs.map} +0 -0
  522. /package/dist/esm/{chunk-AGBA3Y7A.mjs.map → chunk-LGTOOAQI.mjs.map} +0 -0
  523. /package/dist/esm/{chunk-4OV7QU2U.mjs.map → chunk-MHN6XY4Z.mjs.map} +0 -0
  524. /package/dist/esm/{chunk-PHG2IWZW.mjs.map → chunk-MOGPSSTD.mjs.map} +0 -0
  525. /package/dist/esm/{chunk-KSKQVOBA.mjs.map → chunk-NARS3JDH.mjs.map} +0 -0
  526. /package/dist/esm/{chunk-KSUZS6EL.mjs.map → chunk-NHKAQRJB.mjs.map} +0 -0
  527. /package/dist/esm/{chunk-TIZL5YVP.mjs.map → chunk-OKE3FXIP.mjs.map} +0 -0
  528. /package/dist/esm/{chunk-ZINOJTLU.mjs.map → chunk-OPO5EYF7.mjs.map} +0 -0
  529. /package/dist/esm/{chunk-HDTKBFRX.mjs.map → chunk-PW3ISXPN.mjs.map} +0 -0
  530. /package/dist/esm/{chunk-WIXNX7HY.mjs.map → chunk-QQM47PHZ.mjs.map} +0 -0
  531. /package/dist/esm/{chunk-5XXIIWG7.mjs.map → chunk-SBCLBDCP.mjs.map} +0 -0
  532. /package/dist/esm/{chunk-Z36WHOZV.mjs.map → chunk-SU2WB34N.mjs.map} +0 -0
  533. /package/dist/esm/{chunk-OTY3NO7Q.mjs.map → chunk-T6ADNZE5.mjs.map} +0 -0
  534. /package/dist/esm/{chunk-ONBFUPEC.mjs.map → chunk-UGTIALNW.mjs.map} +0 -0
  535. /package/dist/esm/{chunk-KUX6GQ2E.mjs.map → chunk-UIRAXHDH.mjs.map} +0 -0
  536. /package/dist/esm/{chunk-4CDDWSKZ.mjs.map → chunk-UZTJWOLS.mjs.map} +0 -0
  537. /package/dist/esm/{chunk-7V6RL27I.mjs.map → chunk-VCY3JGZM.mjs.map} +0 -0
  538. /package/dist/esm/{chunk-XOCRDV2V.mjs.map → chunk-VQZMI3EZ.mjs.map} +0 -0
  539. /package/dist/esm/{chunk-N3OYD6VZ.mjs.map → chunk-WSFHH3BK.mjs.map} +0 -0
  540. /package/dist/esm/{chunk-7PVIWKGT.mjs.map → chunk-X3JPX7T6.mjs.map} +0 -0
  541. /package/dist/esm/{chunk-HGVZ7ULA.mjs.map → chunk-XKOSS5KC.mjs.map} +0 -0
  542. /package/dist/esm/{chunk-TRU3EK64.mjs.map → chunk-XT5T5LAP.mjs.map} +0 -0
  543. /package/dist/esm/{chunk-FO4F3OJJ.mjs.map → chunk-YNT7JHMS.mjs.map} +0 -0
  544. /package/dist/esm/{chunk-37UZKMJI.mjs.map → chunk-YPBNYKOD.mjs.map} +0 -0
  545. /package/dist/esm/{chunk-IFHQSZLK.mjs.map → chunk-YZ3YPLEU.mjs.map} +0 -0
  546. /package/dist/esm/{chunk-OZN3OOJV.mjs.map → chunk-ZMBXHMVQ.mjs.map} +0 -0
  547. /package/dist/esm/{chunk-BQXVHY7J.mjs.map → chunk-ZRWZIAF5.mjs.map} +0 -0
  548. /package/dist/esm/{chunk-N2FKVZ4D.mjs.map → errors/index.mjs.map} +0 -0
  549. /package/dist/esm/{client/types.mjs.map → transactions/script-composer/index.mjs.map} +0 -0
@@ -1,11 +1,13 @@
1
1
  // Copyright © Aptos Foundation
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
+ // eslint-disable-next-line max-classes-per-file
4
5
  import { JwtPayload, jwtDecode } from "jwt-decode";
6
+ import { sha3_256 } from "@noble/hashes/sha3";
5
7
  import { AccountPublicKey, PublicKey } from "./publicKey";
6
8
  import { Signature } from "./signature";
7
9
  import { Deserializer, Serializable, Serializer } from "../../bcs";
8
- import { Hex } from "../hex";
10
+ import { Hex, hexToAsciiString } from "../hex";
9
11
  import {
10
12
  HexInput,
11
13
  EphemeralCertificateVariant,
@@ -20,11 +22,18 @@ import { bigIntToBytesLE, bytesToBigIntLE, hashStrToField, poseidonHash } from "
20
22
  import { AuthenticationKey } from "../authenticationKey";
21
23
  import { Proof } from "./proof";
22
24
  import { Ed25519PublicKey, Ed25519Signature } from "./ed25519";
23
- import { Groth16VerificationKeyResponse, KeylessConfigurationResponse } from "../../types/keyless";
25
+ import {
26
+ Groth16VerificationKeyResponse,
27
+ KeylessConfigurationResponse,
28
+ MoveAnyStruct,
29
+ PatchedJWKsResponse,
30
+ } from "../../types/keyless";
24
31
  import { AptosConfig } from "../../api/aptosConfig";
25
32
  import { getAptosFullNode } from "../../client";
26
33
  import { memoizeAsync } from "../../utils/memoize";
27
- import { AccountAddress } from "../accountAddress";
34
+ import { AccountAddress, AccountAddressInput } from "../accountAddress";
35
+ import { getErrorMessage } from "../../utils";
36
+ import { KeylessError, KeylessErrorType } from "../../errors";
28
37
 
29
38
  export const EPK_HORIZON_SECS = 10000000;
30
39
  export const MAX_AUD_VAL_BYTES = 120;
@@ -282,6 +291,15 @@ export class KeylessSignature extends Signature {
282
291
  this.ephemeralSignature = ephemeralSignature;
283
292
  }
284
293
 
294
+ /**
295
+ * Get the kid of the JWT used to derive the Keyless Account used to sign.
296
+ *
297
+ * @returns the kid as a string
298
+ */
299
+ getJwkKid(): string {
300
+ return parseJwtHeader(this.jwtHeader).kid;
301
+ }
302
+
285
303
  serialize(serializer: Serializer): void {
286
304
  this.ephemeralCertificate.serialize(serializer);
287
305
  serializer.serializeStr(this.jwtHeader);
@@ -568,16 +586,16 @@ export class ZeroKnowledgeSig extends Signature {
568
586
  serialize(serializer: Serializer): void {
569
587
  this.proof.serialize(serializer);
570
588
  serializer.serializeU64(this.expHorizonSecs);
571
- serializer.serializeOptionStr(this.extraField);
572
- serializer.serializeOptionStr(this.overrideAudVal);
589
+ serializer.serializeOption(this.extraField);
590
+ serializer.serializeOption(this.overrideAudVal);
573
591
  serializer.serializeOption(this.trainingWheelsSignature);
574
592
  }
575
593
 
576
594
  static deserialize(deserializer: Deserializer): ZeroKnowledgeSig {
577
595
  const proof = ZkProof.deserialize(deserializer);
578
596
  const expHorizonSecs = Number(deserializer.deserializeU64());
579
- const extraField = deserializer.deserializeOptionStr();
580
- const overrideAudVal = deserializer.deserializeOptionStr();
597
+ const extraField = deserializer.deserializeOption("string");
598
+ const overrideAudVal = deserializer.deserializeOption("string");
581
599
  const trainingWheelsSignature = deserializer.deserializeOption(EphemeralSignature);
582
600
  return new ZeroKnowledgeSig({ proof, expHorizonSecs, trainingWheelsSignature, extraField, overrideAudVal });
583
601
  }
@@ -594,16 +612,15 @@ export class KeylessConfiguration {
594
612
  /**
595
613
  * The verification key used to verify Groth16 proofs on chain
596
614
  */
597
- // TODO: Rename to verificationKey
598
- readonly verficationKey: Groth16VerificationKey;
615
+ readonly verificationKey: Groth16VerificationKey;
599
616
 
600
617
  /**
601
618
  * The maximum lifespan of an ephemeral key pair. This is configured on chain.
602
619
  */
603
620
  readonly maxExpHorizonSecs: number;
604
621
 
605
- constructor(verficationKey: Groth16VerificationKey, maxExpHorizonSecs: number) {
606
- this.verficationKey = verficationKey;
622
+ constructor(verificationKey: Groth16VerificationKey, maxExpHorizonSecs: number) {
623
+ this.verificationKey = verificationKey;
607
624
  this.maxExpHorizonSecs = maxExpHorizonSecs;
608
625
  }
609
626
 
@@ -624,7 +641,7 @@ export class KeylessConfiguration {
624
641
  /**
625
642
  * Represents the verification key stored on-chain used to verify Groth16 proofs.
626
643
  */
627
- class Groth16VerificationKey {
644
+ export class Groth16VerificationKey {
628
645
  // The docstrings below are borrowed from ark-groth16
629
646
 
630
647
  /**
@@ -645,7 +662,7 @@ class Groth16VerificationKey {
645
662
  /**
646
663
  * The `gamma^{-1} * (beta * a_i + alpha * b_i + c_i) * H`, where H is the generator of G1
647
664
  */
648
- readonly gammaAbcG1: G1Bytes[];
665
+ readonly gammaAbcG1: [G1Bytes, G1Bytes];
649
666
 
650
667
  /**
651
668
  * The `gamma * H`, where `H` is the generator of G2
@@ -667,6 +684,27 @@ class Groth16VerificationKey {
667
684
  this.gammaG2 = new G2Bytes(gammaG2);
668
685
  }
669
686
 
687
+ /**
688
+ * Calculates the hash of the serialized form of the verification key.
689
+ * This is useful for comparing verification keys or using them as unique identifiers.
690
+ *
691
+ * @returns The SHA3-256 hash of the serialized verification key as a Uint8Array
692
+ */
693
+ public hash(): Uint8Array {
694
+ const serializer = new Serializer();
695
+ this.serialize(serializer);
696
+ return sha3_256.create().update(serializer.toUint8Array()).digest();
697
+ }
698
+
699
+ serialize(serializer: Serializer): void {
700
+ this.alphaG1.serialize(serializer);
701
+ this.betaG2.serialize(serializer);
702
+ this.deltaG2.serialize(serializer);
703
+ this.gammaAbcG1[0].serialize(serializer);
704
+ this.gammaAbcG1[1].serialize(serializer);
705
+ this.gammaG2.serialize(serializer);
706
+ }
707
+
670
708
  /**
671
709
  * Converts a Groth16VerificationKeyResponse object into a Groth16VerificationKey instance.
672
710
  *
@@ -704,15 +742,64 @@ export async function getKeylessConfig(args: {
704
742
  options?: LedgerVersionArg;
705
743
  }): Promise<KeylessConfiguration> {
706
744
  const { aptosConfig } = args;
707
- return memoizeAsync(
708
- async () => {
709
- const config = await getKeylessConfigurationResource(args);
710
- const vk = await getGroth16VerificationKeyResource(args);
711
- return KeylessConfiguration.create(vk, Number(config.max_exp_horizon_secs));
712
- },
713
- `keyless-configuration-${aptosConfig.network}`,
714
- 1000 * 60 * 5, // 5 minutes
715
- )();
745
+ try {
746
+ return await memoizeAsync(
747
+ async () => {
748
+ const config = await getKeylessConfigurationResource(args);
749
+ const vk = await getGroth16VerificationKeyResource(args);
750
+ return KeylessConfiguration.create(vk, Number(config.max_exp_horizon_secs));
751
+ },
752
+ `keyless-configuration-${aptosConfig.network}`,
753
+ 1000 * 60 * 5, // 5 minutes
754
+ )();
755
+ } catch (error) {
756
+ if (error instanceof KeylessError) {
757
+ throw error;
758
+ }
759
+ throw KeylessError.fromErrorType({
760
+ type: KeylessErrorType.FULL_NODE_OTHER,
761
+ error,
762
+ });
763
+ }
764
+ }
765
+
766
+ /**
767
+ * Parses a JWT and returns the 'iss', 'aud', and 'uid' values.
768
+ *
769
+ * @param args - The arguments for parsing the JWT.
770
+ * @param args.jwt - The JWT to parse.
771
+ * @param args.uidKey - The key to use for the 'uid' value; defaults to 'sub'.
772
+ * @returns The 'iss', 'aud', and 'uid' values from the JWT.
773
+ */
774
+ export function getIssAudAndUidVal(args: { jwt: string; uidKey?: string }): {
775
+ iss: string;
776
+ aud: string;
777
+ uidVal: string;
778
+ } {
779
+ const { jwt, uidKey = "sub" } = args;
780
+ let jwtPayload: JwtPayload & { [key: string]: string };
781
+ try {
782
+ jwtPayload = jwtDecode<JwtPayload & { [key: string]: string }>(jwt);
783
+ } catch (error) {
784
+ throw KeylessError.fromErrorType({
785
+ type: KeylessErrorType.JWT_PARSING_ERROR,
786
+ details: `Failed to parse JWT - ${getErrorMessage(error)}`,
787
+ });
788
+ }
789
+ if (typeof jwtPayload.iss !== "string") {
790
+ throw KeylessError.fromErrorType({
791
+ type: KeylessErrorType.JWT_PARSING_ERROR,
792
+ details: "JWT is missing 'iss' in the payload. This should never happen.",
793
+ });
794
+ }
795
+ if (typeof jwtPayload.aud !== "string") {
796
+ throw KeylessError.fromErrorType({
797
+ type: KeylessErrorType.JWT_PARSING_ERROR,
798
+ details: "JWT is missing 'aud' in the payload or 'aud' is an array of values.",
799
+ });
800
+ }
801
+ const uidVal = jwtPayload[uidKey];
802
+ return { iss: jwtPayload.iss, aud: jwtPayload.aud, uidVal };
716
803
  }
717
804
 
718
805
  /**
@@ -730,14 +817,20 @@ async function getKeylessConfigurationResource(args: {
730
817
  }): Promise<KeylessConfigurationResponse> {
731
818
  const { aptosConfig, options } = args;
732
819
  const resourceType = "0x1::keyless_account::Configuration";
733
- const { data } = await getAptosFullNode<{}, MoveResource<KeylessConfigurationResponse>>({
734
- aptosConfig,
735
- originMethod: "getKeylessConfigurationResource",
736
- path: `accounts/${AccountAddress.from("0x1").toString()}/resource/${resourceType}`,
737
- params: { ledger_version: options?.ledgerVersion },
738
- });
739
-
740
- return data.data;
820
+ try {
821
+ const { data } = await getAptosFullNode<{}, MoveResource<KeylessConfigurationResponse>>({
822
+ aptosConfig,
823
+ originMethod: "getKeylessConfigurationResource",
824
+ path: `accounts/${AccountAddress.from("0x1").toString()}/resource/${resourceType}`,
825
+ params: { ledger_version: options?.ledgerVersion },
826
+ });
827
+ return data.data;
828
+ } catch (error) {
829
+ throw KeylessError.fromErrorType({
830
+ type: KeylessErrorType.FULL_NODE_CONFIG_LOOKUP_ERROR,
831
+ error,
832
+ });
833
+ }
741
834
  }
742
835
 
743
836
  /**
@@ -755,12 +848,126 @@ async function getGroth16VerificationKeyResource(args: {
755
848
  }): Promise<Groth16VerificationKeyResponse> {
756
849
  const { aptosConfig, options } = args;
757
850
  const resourceType = "0x1::keyless_account::Groth16VerificationKey";
758
- const { data } = await getAptosFullNode<{}, MoveResource<Groth16VerificationKeyResponse>>({
759
- aptosConfig,
760
- originMethod: "getGroth16VerificationKeyResource",
761
- path: `accounts/${AccountAddress.from("0x1").toString()}/resource/${resourceType}`,
762
- params: { ledger_version: options?.ledgerVersion },
763
- });
764
-
765
- return data.data;
851
+ try {
852
+ const { data } = await getAptosFullNode<{}, MoveResource<Groth16VerificationKeyResponse>>({
853
+ aptosConfig,
854
+ originMethod: "getGroth16VerificationKeyResource",
855
+ path: `accounts/${AccountAddress.from("0x1").toString()}/resource/${resourceType}`,
856
+ params: { ledger_version: options?.ledgerVersion },
857
+ });
858
+ return data.data;
859
+ } catch (error) {
860
+ throw KeylessError.fromErrorType({
861
+ type: KeylessErrorType.FULL_NODE_VERIFICATION_KEY_LOOKUP_ERROR,
862
+ error,
863
+ });
864
+ }
865
+ }
866
+
867
+ export async function getKeylessJWKs(args: {
868
+ aptosConfig: AptosConfig;
869
+ jwkAddr?: AccountAddressInput;
870
+ options?: LedgerVersionArg;
871
+ }): Promise<Map<string, MoveJWK[]>> {
872
+ const { aptosConfig, jwkAddr, options } = args;
873
+ let resource: MoveResource<PatchedJWKsResponse>;
874
+ if (!jwkAddr) {
875
+ const resourceType = "0x1::jwks::PatchedJWKs";
876
+ const { data } = await getAptosFullNode<{}, MoveResource<PatchedJWKsResponse>>({
877
+ aptosConfig,
878
+ originMethod: "getKeylessJWKs",
879
+ path: `accounts/0x1/resource/${resourceType}`,
880
+ params: { ledger_version: options?.ledgerVersion },
881
+ });
882
+ resource = data;
883
+ } else {
884
+ const resourceType = "0x1::jwks::FederatedJWKs";
885
+ const { data } = await getAptosFullNode<{}, MoveResource<PatchedJWKsResponse>>({
886
+ aptosConfig,
887
+ originMethod: "getKeylessJWKs",
888
+ path: `accounts/${AccountAddress.from(jwkAddr).toString()}/resource/${resourceType}`,
889
+ params: { ledger_version: options?.ledgerVersion },
890
+ });
891
+ resource = data;
892
+ }
893
+
894
+ // Create a map of issuer to JWK arrays
895
+ const jwkMap = new Map<string, MoveJWK[]>();
896
+ for (const entry of resource.data.jwks.entries) {
897
+ const jwks: MoveJWK[] = [];
898
+ for (const jwkStruct of entry.jwks) {
899
+ const { data: jwkData } = jwkStruct.variant;
900
+ const deserializer = new Deserializer(Hex.fromHexInput(jwkData).toUint8Array());
901
+ const jwk = MoveJWK.deserialize(deserializer);
902
+ jwks.push(jwk);
903
+ }
904
+ jwkMap.set(hexToAsciiString(entry.issuer), jwks);
905
+ }
906
+
907
+ return jwkMap;
908
+ }
909
+
910
+ export class MoveJWK extends Serializable {
911
+ public kid: string;
912
+
913
+ public kty: string;
914
+
915
+ public alg: string;
916
+
917
+ public e: string;
918
+
919
+ public n: string;
920
+
921
+ constructor(args: { kid: string; kty: string; alg: string; e: string; n: string }) {
922
+ super();
923
+ const { kid, kty, alg, e, n } = args;
924
+ this.kid = kid;
925
+ this.kty = kty;
926
+ this.alg = alg;
927
+ this.e = e;
928
+ this.n = n;
929
+ }
930
+
931
+ serialize(serializer: Serializer): void {
932
+ serializer.serializeStr(this.kid);
933
+ serializer.serializeStr(this.kty);
934
+ serializer.serializeStr(this.alg);
935
+ serializer.serializeStr(this.e);
936
+ serializer.serializeStr(this.n);
937
+ }
938
+
939
+ static fromMoveStruct(struct: MoveAnyStruct): MoveJWK {
940
+ const { data } = struct.variant;
941
+ const deserializer = new Deserializer(Hex.fromHexInput(data).toUint8Array());
942
+ return MoveJWK.deserialize(deserializer);
943
+ }
944
+
945
+ static deserialize(deserializer: Deserializer): MoveJWK {
946
+ const kid = deserializer.deserializeStr();
947
+ const kty = deserializer.deserializeStr();
948
+ const alg = deserializer.deserializeStr();
949
+ const n = deserializer.deserializeStr();
950
+ const e = deserializer.deserializeStr();
951
+ return new MoveJWK({ kid, kty, alg, n, e });
952
+ }
953
+ }
954
+
955
+ interface JwtHeader {
956
+ kid: string; // Key ID
957
+ }
958
+ /**
959
+ * Safely parses the JWT header.
960
+ * @param jwtHeader The JWT header string
961
+ * @returns Parsed JWT header as an object.
962
+ */
963
+ export function parseJwtHeader(jwtHeader: string): JwtHeader {
964
+ try {
965
+ const header = JSON.parse(jwtHeader);
966
+ if (header.kid === undefined) {
967
+ throw new Error("JWT header missing kid");
968
+ }
969
+ return header;
970
+ } catch (error) {
971
+ throw new Error("Failed to parse JWT header.");
972
+ }
766
973
  }
@@ -1,13 +1,12 @@
1
- import { HexInput } from "../../types";
1
+ /* eslint-disable max-len */
2
+
3
+ import { HexInput, PrivateKeyVariants } from "../../types";
4
+ import { Hex } from "../hex";
2
5
  import { PublicKey } from "./publicKey";
3
6
  import { Signature } from "./signature";
4
7
 
5
8
  /**
6
9
  * Represents a private key used for signing messages and deriving the associated public key.
7
- *
8
- * @method sign - Signs the given message with the private key.
9
- * @method publicKey - Derives the public key associated with the private key.
10
- * @method toUint8Array - Retrieves the private key in bytes.
11
10
  */
12
11
  export interface PrivateKey {
13
12
  /**
@@ -27,3 +26,80 @@ export interface PrivateKey {
27
26
  */
28
27
  toUint8Array(): Uint8Array;
29
28
  }
29
+
30
+ export class PrivateKey {
31
+ /**
32
+ * The AIP-80 compliant prefixes for each private key type. Append this to a private key's hex representation
33
+ * to get an AIP-80 compliant string.
34
+ *
35
+ * [Read about AIP-80](https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md)
36
+ */
37
+ public static readonly AIP80_PREFIXES = {
38
+ [PrivateKeyVariants.Ed25519]: "ed25519-priv-",
39
+ [PrivateKeyVariants.Secp256k1]: "secp256k1-priv-",
40
+ };
41
+
42
+ /**
43
+ * Format a HexInput to an AIP-80 compliant string.
44
+ *
45
+ * [Read about AIP-80](https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md)
46
+ *
47
+ * @param privateKey - The HexString or Uint8Array format of the private key.
48
+ * @param privateKeyType - The private key type
49
+ */
50
+ public static formatPrivateKey(privateKey: HexInput, type: PrivateKeyVariants): string {
51
+ const aip80Prefix = PrivateKey.AIP80_PREFIXES[type];
52
+ return `${aip80Prefix}${Hex.fromHexInput(privateKey).toString()}`;
53
+ }
54
+
55
+ /**
56
+ * Parse a HexInput that may be a HexString, Uint8Array, or a AIP-80 compliant string to a Hex instance.
57
+ *
58
+ * [Read about AIP-80](https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md)
59
+ *
60
+ * @param value - A HexString, Uint8Array, or a AIP-80 compliant string.
61
+ * @param privateKeyType - The private key type
62
+ * @param strict - If true, the value MUST be compliant with AIP-80.
63
+ */
64
+ public static parseHexInput(value: HexInput, type: PrivateKeyVariants, strict?: boolean): Hex {
65
+ let data: Hex;
66
+
67
+ const aip80Prefix = PrivateKey.AIP80_PREFIXES[type];
68
+ if (typeof value === "string") {
69
+ if (!strict && !value.startsWith(aip80Prefix)) {
70
+ // HexString input
71
+ data = Hex.fromHexInput(value);
72
+ // If the strictness is false, the user has opted into non-AIP-80 compliant private keys.
73
+ if (strict !== false) {
74
+ // eslint-disable-next-line no-console
75
+ console.warn(
76
+ "[Aptos SDK] It is recommended that private keys are AIP-80 compliant (https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md). You can fix the private key by formatting it with `PrivateKey.formatPrivateKey(privateKey: string, type: 'ed25519' | 'secp256k1'): string`.",
77
+ );
78
+ }
79
+ } else if (value.startsWith(aip80Prefix)) {
80
+ // AIP-80 Compliant String input
81
+ data = Hex.fromHexString(value.split("-")[2]);
82
+ } else {
83
+ if (strict) {
84
+ // The value does not start with the AIP-80 prefix, and strict is true.
85
+ throw new Error("Invalid HexString input while parsing private key. Must AIP-80 compliant string.");
86
+ }
87
+
88
+ // This condition should never be reached.
89
+ throw new Error("Invalid HexString input while parsing private key.");
90
+ }
91
+ } else {
92
+ // The value is an Uint8Array
93
+ data = Hex.fromHexInput(value);
94
+ // If the strictness is false, the user has opted into non-AIP-80 compliant private keys.
95
+ if (strict !== false) {
96
+ // eslint-disable-next-line no-console
97
+ console.warn(
98
+ "[Aptos SDK] It is recommended that private keys are parsed as AIP-80 compliant strings instead of Uint8Array (https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md). You can fix the private key by formatting it with `PrivateKey.formatPrivateKey(privateKey: Uint8Array, type: 'ed25519' | 'secp256k1'): string`.",
99
+ );
100
+ }
101
+ }
102
+
103
+ return data;
104
+ }
105
+ }
@@ -6,7 +6,7 @@ import { secp256k1 } from "@noble/curves/secp256k1";
6
6
  import { HDKey } from "@scure/bip32";
7
7
  import { Serializable, Deserializer, Serializer } from "../../bcs";
8
8
  import { Hex } from "../hex";
9
- import { HexInput } from "../../types";
9
+ import { HexInput, PrivateKeyVariants } from "../../types";
10
10
  import { isValidBIP44Path, mnemonicToSeed } from "./hdKey";
11
11
  import { PrivateKey } from "./privateKey";
12
12
  import { PublicKey, VerifySignatureArgs } from "./publicKey";
@@ -17,7 +17,6 @@ import { convertSigningMessage } from "./utils";
17
17
  * Represents a Secp256k1 ECDSA public key.
18
18
  *
19
19
  * @extends PublicKey
20
- * @static
21
20
  * @property LENGTH - The length of the Secp256k1 public key in bytes.
22
21
  */
23
22
  export class Secp256k1PublicKey extends PublicKey {
@@ -148,12 +147,15 @@ export class Secp256k1PrivateKey extends Serializable implements PrivateKey {
148
147
  /**
149
148
  * Create a new PrivateKey instance from a Uint8Array or String.
150
149
  *
150
+ * [Read about AIP-80](https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md)
151
+ *
151
152
  * @param hexInput A HexInput (string or Uint8Array)
153
+ * @param strict If true, private key must AIP-80 compliant.
152
154
  */
153
- constructor(hexInput: HexInput) {
155
+ constructor(hexInput: HexInput, strict?: boolean) {
154
156
  super();
155
157
 
156
- const privateKeyHex = Hex.fromHexInput(hexInput);
158
+ const privateKeyHex = PrivateKey.parseHexInput(hexInput, PrivateKeyVariants.Secp256k1, strict);
157
159
  if (privateKeyHex.toUint8Array().length !== Secp256k1PrivateKey.LENGTH) {
158
160
  throw new Error(`PrivateKey length should be ${Secp256k1PrivateKey.LENGTH}`);
159
161
  }
@@ -168,7 +170,7 @@ export class Secp256k1PrivateKey extends Serializable implements PrivateKey {
168
170
  */
169
171
  static generate(): Secp256k1PrivateKey {
170
172
  const hexInput = secp256k1.utils.randomPrivateKey();
171
- return new Secp256k1PrivateKey(hexInput);
173
+ return new Secp256k1PrivateKey(hexInput, false);
172
174
  }
173
175
 
174
176
  /**
@@ -204,7 +206,7 @@ export class Secp256k1PrivateKey extends Serializable implements PrivateKey {
204
206
  throw new Error("Invalid key");
205
207
  }
206
208
 
207
- return new Secp256k1PrivateKey(privateKey);
209
+ return new Secp256k1PrivateKey(privateKey, false);
208
210
  }
209
211
 
210
212
  // endregion
@@ -251,9 +253,29 @@ export class Secp256k1PrivateKey extends Serializable implements PrivateKey {
251
253
  * @returns string representation of the private key
252
254
  */
253
255
  toString(): string {
256
+ return this.toHexString();
257
+ }
258
+
259
+ /**
260
+ * Get the private key as a hex string with the 0x prefix.
261
+ *
262
+ * @returns string representation of the private key.
263
+ */
264
+ toHexString(): string {
254
265
  return this.key.toString();
255
266
  }
256
267
 
268
+ /**
269
+ * Get the private key as a AIP-80 compliant hex string.
270
+ *
271
+ * [Read about AIP-80](https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md)
272
+ *
273
+ * @returns AIP-80 compliant string representation of the private key.
274
+ */
275
+ toAIP80String(): string {
276
+ return PrivateKey.formatPrivateKey(this.key.toString(), PrivateKeyVariants.Secp256k1);
277
+ }
278
+
257
279
  // endregion
258
280
 
259
281
  // region Serializable
@@ -264,7 +286,7 @@ export class Secp256k1PrivateKey extends Serializable implements PrivateKey {
264
286
 
265
287
  static deserialize(deserializer: Deserializer): Secp256k1PrivateKey {
266
288
  const bytes = deserializer.deserializeBytes();
267
- return new Secp256k1PrivateKey(bytes);
289
+ return new Secp256k1PrivateKey(bytes, false);
268
290
  }
269
291
 
270
292
  // endregion
@@ -284,13 +306,11 @@ export class Secp256k1PrivateKey extends Serializable implements PrivateKey {
284
306
  /**
285
307
  * Represents a signature of a message signed using a Secp256k1 ECDSA private key.
286
308
  *
287
- * @static
288
- * @readonly
289
- * @length The length of Secp256k1 ECDSA signatures, which is 64 bytes.
290
309
  */
291
310
  export class Secp256k1Signature extends Signature {
292
311
  /**
293
- * Secp256k1 ecdsa signatures are 256-bit.
312
+ * Secp256k1 ecdsa signatures are 256-bit or 64 bytes
313
+ * @readonly
294
314
  */
295
315
  static readonly LENGTH = 64;
296
316
 
package/src/core/hex.ts CHANGED
@@ -134,6 +134,51 @@ export class Hex {
134
134
  return Hex.fromHexString(hexInput);
135
135
  }
136
136
 
137
+ /**
138
+ * Converts an instance of HexInput, which can be a string or a Uint8Array, into a Uint8Array.
139
+ *
140
+ * @param hexInput - A HexInput which can be a string or Uint8Array.
141
+ * @returns A Uint8Array created from the provided hexInput.
142
+ */
143
+ static hexInputToUint8Array(hexInput: HexInput): Uint8Array {
144
+ if (hexInput instanceof Uint8Array) return hexInput;
145
+ return Hex.fromHexString(hexInput).toUint8Array();
146
+ }
147
+
148
+ /**
149
+ * Converts a HexInput (string or Uint8Array) to a hex string with '0x' prefix.
150
+ *
151
+ * @param hexInput - The input to convert, either a hex string (with/without '0x' prefix) or Uint8Array
152
+ * @returns A hex string with '0x' prefix (e.g., "0x1234")
153
+ *
154
+ * @example
155
+ * ```typescript
156
+ * Hex.hexInputToString("1234") // returns "0x1234"
157
+ * Hex.hexInputToString("0x1234") // returns "0x1234"
158
+ * Hex.hexInputToString(new Uint8Array([0x12, 0x34])) // returns "0x1234"
159
+ * ```
160
+ */
161
+ static hexInputToString(hexInput: HexInput): string {
162
+ return Hex.fromHexInput(hexInput).toString();
163
+ }
164
+
165
+ /**
166
+ * Converts a HexInput (string or Uint8Array) to a hex string without '0x' prefix.
167
+ *
168
+ * @param hexInput - The input to convert, either a hex string (with/without '0x' prefix) or Uint8Array
169
+ * @returns A hex string without '0x' prefix (e.g., "1234")
170
+ *
171
+ * @example
172
+ * ```typescript
173
+ * Hex.hexInputToStringWithoutPrefix("1234") // returns "1234"
174
+ * Hex.hexInputToStringWithoutPrefix("0x1234") // returns "1234"
175
+ * Hex.hexInputToStringWithoutPrefix(new Uint8Array([0x12, 0x34])) // returns "1234"
176
+ * ```
177
+ */
178
+ static hexInputToStringWithoutPrefix(hexInput: HexInput): string {
179
+ return Hex.fromHexInput(hexInput).toStringWithoutPrefix();
180
+ }
181
+
137
182
  // ===
138
183
  // Methods for checking validity.
139
184
  // ===
@@ -172,3 +217,5 @@ export class Hex {
172
217
  return this.data.every((value, index) => value === other.data[index]);
173
218
  }
174
219
  }
220
+
221
+ export const hexToAsciiString = (hex: string) => new TextDecoder().decode(Hex.fromHexInput(hex).toUint8Array());