@aptos-labs/ts-sdk 1.15.0 → 1.16.0-zeta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (495) hide show
  1. package/dist/common/{accountAddress-ccLvlUQe.d.ts → accountAddress-OUd5ov6z.d.ts} +97 -5
  2. package/dist/common/chunk-VLEH6QBR.js +2 -0
  3. package/dist/common/chunk-VLEH6QBR.js.map +1 -0
  4. package/dist/common/cli/index.d.ts +1 -1
  5. package/dist/common/cli/index.js +1 -1
  6. package/dist/common/cli/index.js.map +1 -1
  7. package/dist/common/index.d.ts +757 -58
  8. package/dist/common/index.js +28 -28
  9. package/dist/common/index.js.map +1 -1
  10. package/dist/esm/{Ed25519Account-B1VMJOY2.d.mts → Ed25519Account-9zBaZEnp.d.mts} +1 -1
  11. package/dist/esm/account/Account.d.mts +2 -2
  12. package/dist/esm/account/Account.mjs +1 -1
  13. package/dist/esm/account/Ed25519Account.d.mts +2 -2
  14. package/dist/esm/account/Ed25519Account.mjs +1 -1
  15. package/dist/esm/account/EphemeralKeyPair.d.mts +85 -0
  16. package/dist/esm/account/EphemeralKeyPair.mjs +2 -0
  17. package/dist/esm/account/KeylessAccount.d.mts +225 -0
  18. package/dist/esm/account/KeylessAccount.mjs +2 -0
  19. package/dist/esm/account/MultiKeyAccount.d.mts +13 -7
  20. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  21. package/dist/esm/account/SingleKeyAccount.d.mts +2 -2
  22. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  23. package/dist/esm/account/index.d.mts +10 -2
  24. package/dist/esm/account/index.mjs +1 -1
  25. package/dist/esm/api/account.d.mts +2 -2
  26. package/dist/esm/api/account.mjs +1 -1
  27. package/dist/esm/api/ans.d.mts +2 -2
  28. package/dist/esm/api/ans.mjs +1 -1
  29. package/dist/esm/api/aptos.d.mts +13 -3
  30. package/dist/esm/api/aptos.mjs +1 -1
  31. package/dist/esm/api/aptosConfig.d.mts +20 -0
  32. package/dist/esm/api/aptosConfig.mjs +1 -1
  33. package/dist/esm/api/coin.d.mts +1 -1
  34. package/dist/esm/api/coin.mjs +1 -1
  35. package/dist/esm/api/digitalAsset.d.mts +2 -2
  36. package/dist/esm/api/digitalAsset.mjs +1 -1
  37. package/dist/esm/api/event.mjs +1 -1
  38. package/dist/esm/api/faucet.mjs +1 -1
  39. package/dist/esm/api/fungibleAsset.d.mts +2 -2
  40. package/dist/esm/api/fungibleAsset.mjs +1 -1
  41. package/dist/esm/api/general.d.mts +1 -1
  42. package/dist/esm/api/general.mjs +1 -1
  43. package/dist/esm/api/index.d.mts +11 -2
  44. package/dist/esm/api/index.mjs +1 -1
  45. package/dist/esm/api/keyless.d.mts +88 -0
  46. package/dist/esm/api/keyless.mjs +2 -0
  47. package/dist/esm/api/keyless.mjs.map +1 -0
  48. package/dist/esm/api/staking.mjs +1 -1
  49. package/dist/esm/api/table.mjs +1 -1
  50. package/dist/esm/api/transaction.d.mts +2 -2
  51. package/dist/esm/api/transaction.mjs +1 -1
  52. package/dist/esm/api/transactionSubmission/build.d.mts +1 -1
  53. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  54. package/dist/esm/api/transactionSubmission/management.d.mts +2 -2
  55. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  56. package/dist/esm/api/transactionSubmission/sign.d.mts +2 -2
  57. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  58. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  59. package/dist/esm/api/transactionSubmission/simulate.d.mts +1 -1
  60. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  61. package/dist/esm/api/transactionSubmission/submit.d.mts +1 -1
  62. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  63. package/dist/esm/api/utils.mjs +1 -1
  64. package/dist/esm/bcs/deserializer.d.mts +32 -0
  65. package/dist/esm/bcs/deserializer.mjs +1 -1
  66. package/dist/esm/bcs/index.mjs +1 -1
  67. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  68. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  69. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  70. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  71. package/dist/esm/bcs/serializer.d.mts +42 -0
  72. package/dist/esm/bcs/serializer.mjs +1 -1
  73. package/dist/esm/{chunk-36QXVFR5.mjs → chunk-272NA6H5.mjs} +2 -2
  74. package/dist/esm/{chunk-36QXVFR5.mjs.map → chunk-272NA6H5.mjs.map} +1 -1
  75. package/dist/esm/{chunk-R5ST36VJ.mjs → chunk-34WI7I3Z.mjs} +2 -2
  76. package/dist/esm/chunk-3DP4R3FI.mjs +2 -0
  77. package/dist/esm/{chunk-FFGY7Z4B.mjs → chunk-3J53BCEQ.mjs} +2 -2
  78. package/dist/esm/chunk-3SXTTG2X.mjs +2 -0
  79. package/dist/esm/chunk-3SXTTG2X.mjs.map +1 -0
  80. package/dist/esm/{chunk-4GWNWSZP.mjs → chunk-3YIUOKWW.mjs} +2 -2
  81. package/dist/esm/{chunk-EA2DKJPX.mjs → chunk-45ESRYGP.mjs} +2 -2
  82. package/dist/esm/chunk-4RXGVY2H.mjs +2 -0
  83. package/dist/esm/chunk-4RXGVY2H.mjs.map +1 -0
  84. package/dist/esm/chunk-4VAYXBD2.mjs +2 -0
  85. package/dist/esm/chunk-5SGIYAB7.mjs +2 -0
  86. package/dist/esm/chunk-5SGIYAB7.mjs.map +1 -0
  87. package/dist/esm/chunk-5VLCYHNJ.mjs +2 -0
  88. package/dist/esm/chunk-5VLCYHNJ.mjs.map +1 -0
  89. package/dist/esm/{chunk-JGSOTNJ5.mjs → chunk-6F3HFDL3.mjs} +2 -2
  90. package/dist/esm/{chunk-BN22EYXR.mjs → chunk-6MDYCC7P.mjs} +2 -2
  91. package/dist/esm/{chunk-F7NLNWHN.mjs → chunk-7CJAEAQZ.mjs} +2 -2
  92. package/dist/esm/chunk-7QGIAVW4.mjs +2 -0
  93. package/dist/esm/chunk-7QGIAVW4.mjs.map +1 -0
  94. package/dist/esm/chunk-7UBKXR37.mjs +2 -0
  95. package/dist/esm/chunk-7UBKXR37.mjs.map +1 -0
  96. package/dist/esm/{chunk-JQIGQMNZ.mjs → chunk-7Y6AWDBZ.mjs} +2 -2
  97. package/dist/esm/chunk-7Z6DYLCA.mjs +1 -0
  98. package/dist/esm/chunk-7Z6DYLCA.mjs.map +1 -0
  99. package/dist/esm/{chunk-BCUSI3N6.mjs → chunk-AOCNYMMX.mjs} +2 -2
  100. package/dist/esm/chunk-AQ4I7VVB.mjs +1 -0
  101. package/dist/esm/chunk-AQ4I7VVB.mjs.map +1 -0
  102. package/dist/esm/chunk-AUAL3H36.mjs +2 -0
  103. package/dist/esm/{chunk-I5T6PHDV.mjs → chunk-AUV4VAXK.mjs} +2 -2
  104. package/dist/esm/{chunk-2X7A4HUS.mjs → chunk-AVWAYKNS.mjs} +2 -2
  105. package/dist/esm/{chunk-EZPUVLME.mjs → chunk-BNA3SGG6.mjs} +2 -2
  106. package/dist/esm/chunk-CEGCSC3T.mjs +2 -0
  107. package/dist/esm/chunk-CIPPNT3W.mjs +2 -0
  108. package/dist/esm/chunk-CIPPNT3W.mjs.map +1 -0
  109. package/dist/esm/{chunk-F4GDEXZ6.mjs → chunk-CZOUSIAD.mjs} +2 -2
  110. package/dist/esm/chunk-D76FE35G.mjs +2 -0
  111. package/dist/esm/chunk-D76FE35G.mjs.map +1 -0
  112. package/dist/esm/{chunk-A4JUQZXI.mjs → chunk-DSVNXD5A.mjs} +2 -2
  113. package/dist/esm/chunk-EJ7ODMDA.mjs +2 -0
  114. package/dist/esm/{chunk-UR3JTLIT.mjs → chunk-EJURLI4L.mjs} +2 -2
  115. package/dist/esm/chunk-FBPNHF54.mjs +2 -0
  116. package/dist/esm/chunk-FUQDDIKQ.mjs +2 -0
  117. package/dist/esm/chunk-FUQDDIKQ.mjs.map +1 -0
  118. package/dist/esm/chunk-FWTJQHJR.mjs +2 -0
  119. package/dist/esm/chunk-FWTJQHJR.mjs.map +1 -0
  120. package/dist/esm/{chunk-AHW3SKT7.mjs → chunk-GHHIUWPP.mjs} +2 -2
  121. package/dist/esm/{chunk-G56GPLTB.mjs → chunk-GS5Z3HO7.mjs} +2 -2
  122. package/dist/esm/chunk-HGRU3HWY.mjs +2 -0
  123. package/dist/esm/{chunk-P5TZBE3L.mjs.map → chunk-HGRU3HWY.mjs.map} +1 -1
  124. package/dist/esm/{chunk-XFSDV3ND.mjs → chunk-HOX6Q6ZP.mjs} +2 -2
  125. package/dist/esm/chunk-HQK6MF3G.mjs +2 -0
  126. package/dist/esm/chunk-IMVC2JKU.mjs +2 -0
  127. package/dist/esm/{chunk-2XK53QFA.mjs.map → chunk-IMVC2JKU.mjs.map} +1 -1
  128. package/dist/esm/chunk-ISXBJPLD.mjs +2 -0
  129. package/dist/esm/{chunk-JX75UKJX.mjs → chunk-IU6REVKX.mjs} +2 -2
  130. package/dist/esm/{chunk-ERIPXWXJ.mjs → chunk-IWKIZLFW.mjs} +2 -2
  131. package/dist/esm/{chunk-PIVZMT5D.mjs → chunk-J534ICWA.mjs} +2 -2
  132. package/dist/esm/chunk-J577ODDM.mjs +2 -0
  133. package/dist/esm/chunk-JBTLE33X.mjs +2 -0
  134. package/dist/esm/{chunk-CJDEPZ4J.mjs.map → chunk-JBTLE33X.mjs.map} +1 -1
  135. package/dist/esm/chunk-JCDZ2WXX.mjs +2 -0
  136. package/dist/esm/chunk-JCDZ2WXX.mjs.map +1 -0
  137. package/dist/esm/{chunk-YK63A5T6.mjs → chunk-LLRWILVZ.mjs} +2 -2
  138. package/dist/esm/chunk-M4Q4XDVR.mjs +2 -0
  139. package/dist/esm/chunk-M4Q4XDVR.mjs.map +1 -0
  140. package/dist/esm/chunk-MEOBWD6V.mjs +2 -0
  141. package/dist/esm/chunk-MEOBWD6V.mjs.map +1 -0
  142. package/dist/esm/{chunk-35EWRSDK.mjs → chunk-MLQT5I6K.mjs} +2 -2
  143. package/dist/esm/chunk-MSGHGK52.mjs +2 -0
  144. package/dist/esm/{chunk-5EN52MUT.mjs → chunk-NGTNMV6Q.mjs} +2 -2
  145. package/dist/esm/{chunk-P46OPJB4.mjs → chunk-NH466YFP.mjs} +2 -2
  146. package/dist/esm/chunk-NMD45OTM.mjs +2 -0
  147. package/dist/esm/chunk-NMD45OTM.mjs.map +1 -0
  148. package/dist/esm/{chunk-ZM33M6QO.mjs → chunk-NUBYALZP.mjs} +2 -2
  149. package/dist/esm/{chunk-CHWE77CR.mjs → chunk-OFC75EWS.mjs} +2 -2
  150. package/dist/esm/{chunk-H6FEXRTK.mjs → chunk-OOYRJQPD.mjs} +2 -2
  151. package/dist/esm/chunk-OZ3GSAFK.mjs +2 -0
  152. package/dist/esm/chunk-OZ3GSAFK.mjs.map +1 -0
  153. package/dist/esm/chunk-PENBUSGL.mjs +2 -0
  154. package/dist/esm/chunk-PENBUSGL.mjs.map +1 -0
  155. package/dist/esm/{chunk-WN3JL7ZT.mjs → chunk-PG7KSUMN.mjs} +2 -2
  156. package/dist/esm/{chunk-KAGLWBIJ.mjs → chunk-PGP2XMDE.mjs} +2 -2
  157. package/dist/esm/chunk-Q6LFIZ3L.mjs +2 -0
  158. package/dist/esm/chunk-Q6LFIZ3L.mjs.map +1 -0
  159. package/dist/esm/{chunk-CYTRYBWN.mjs → chunk-QJIMZI32.mjs} +2 -2
  160. package/dist/esm/{chunk-E56MTU2U.mjs → chunk-QLE5JL4X.mjs} +2 -2
  161. package/dist/esm/{chunk-WNPL4SEJ.mjs → chunk-QOOHLRRJ.mjs} +2 -2
  162. package/dist/esm/chunk-QYEJOEWB.mjs +2 -0
  163. package/dist/esm/chunk-QYEJOEWB.mjs.map +1 -0
  164. package/dist/esm/{chunk-TM7NDDT3.mjs → chunk-R4HLV32L.mjs} +2 -2
  165. package/dist/esm/chunk-RAHMGSBW.mjs +2 -0
  166. package/dist/esm/chunk-RAHMGSBW.mjs.map +1 -0
  167. package/dist/esm/{chunk-GHYE26Q5.mjs → chunk-RKHPXZM6.mjs} +2 -2
  168. package/dist/esm/{chunk-GHYE26Q5.mjs.map → chunk-RKHPXZM6.mjs.map} +1 -1
  169. package/dist/esm/{chunk-MCRRHBFQ.mjs → chunk-RWYPGTNL.mjs} +2 -2
  170. package/dist/esm/chunk-SCHMTP4N.mjs +2 -0
  171. package/dist/esm/chunk-SCHZ67F3.mjs +2 -0
  172. package/dist/esm/chunk-SCHZ67F3.mjs.map +1 -0
  173. package/dist/esm/{chunk-GP6Z47HM.mjs → chunk-SCRIQQV3.mjs} +2 -2
  174. package/dist/esm/{chunk-NGQR5UQ3.mjs → chunk-SNBE5YAC.mjs} +2 -2
  175. package/dist/esm/chunk-SSDWEOF7.mjs +2 -0
  176. package/dist/esm/chunk-SSDWEOF7.mjs.map +1 -0
  177. package/dist/esm/chunk-SZ6KR73C.mjs +2 -0
  178. package/dist/esm/chunk-SZ6KR73C.mjs.map +1 -0
  179. package/dist/esm/{chunk-UW2FPXYA.mjs → chunk-THURV6CN.mjs} +2 -2
  180. package/dist/esm/chunk-TJDC5PWD.mjs +2 -0
  181. package/dist/esm/{chunk-GUALXVFI.mjs → chunk-TU6VKYDC.mjs} +2 -2
  182. package/dist/esm/{chunk-DZSDCUP2.mjs → chunk-UFMIMN7W.mjs} +2 -2
  183. package/dist/esm/{chunk-3Y46WJUR.mjs → chunk-ULW5LX5H.mjs} +2 -2
  184. package/dist/esm/chunk-V6M7FGQT.mjs +2 -0
  185. package/dist/esm/chunk-V6M7FGQT.mjs.map +1 -0
  186. package/dist/esm/{chunk-U3YYSIIT.mjs → chunk-VBODXPT3.mjs} +2 -2
  187. package/dist/esm/chunk-VMVSUH2K.mjs +2 -0
  188. package/dist/esm/{chunk-QRS4DGP3.mjs → chunk-WHSN42R2.mjs} +2 -2
  189. package/dist/esm/{chunk-QRS4DGP3.mjs.map → chunk-WHSN42R2.mjs.map} +1 -1
  190. package/dist/esm/{chunk-ZCG6WBLE.mjs → chunk-WJIICWOB.mjs} +2 -2
  191. package/dist/esm/{chunk-T2AGN5YT.mjs → chunk-WOLLRMXR.mjs} +2 -2
  192. package/dist/esm/chunk-WSVJNBSJ.mjs +2 -0
  193. package/dist/esm/{chunk-YMB2XW2O.mjs.map → chunk-WSVJNBSJ.mjs.map} +1 -1
  194. package/dist/esm/chunk-WXLSJF4A.mjs +2 -0
  195. package/dist/esm/chunk-WXLSJF4A.mjs.map +1 -0
  196. package/dist/esm/{chunk-GM56MMNJ.mjs → chunk-XQ7I34AL.mjs} +2 -2
  197. package/dist/esm/{chunk-RT6LEYHZ.mjs → chunk-Y24BMR2W.mjs} +2 -2
  198. package/dist/esm/chunk-YE5B2S5L.mjs +2 -0
  199. package/dist/esm/chunk-YE5B2S5L.mjs.map +1 -0
  200. package/dist/esm/{chunk-HSJTQLI2.mjs → chunk-YLQJBXUF.mjs} +2 -2
  201. package/dist/esm/chunk-ZAXWW7VW.mjs +2 -0
  202. package/dist/esm/chunk-ZAXWW7VW.mjs.map +1 -0
  203. package/dist/esm/chunk-ZV5P2GSJ.mjs +2 -0
  204. package/dist/esm/{chunk-SRDIYE3M.mjs.map → chunk-ZV5P2GSJ.mjs.map} +1 -1
  205. package/dist/esm/cli/index.mjs +1 -1
  206. package/dist/esm/cli/localNode.mjs +1 -1
  207. package/dist/esm/cli/move.mjs +1 -1
  208. package/dist/esm/client/core.mjs +1 -1
  209. package/dist/esm/client/get.d.mts +8 -1
  210. package/dist/esm/client/get.mjs +1 -1
  211. package/dist/esm/client/index.d.mts +2 -2
  212. package/dist/esm/client/index.mjs +1 -1
  213. package/dist/esm/client/post.d.mts +9 -1
  214. package/dist/esm/client/post.mjs +1 -1
  215. package/dist/esm/client/types.d.mts +5 -1
  216. package/dist/esm/client/types.mjs +1 -1
  217. package/dist/esm/core/account/index.mjs +1 -1
  218. package/dist/esm/core/account/utils/address.mjs +1 -1
  219. package/dist/esm/core/account/utils/index.mjs +1 -1
  220. package/dist/esm/core/accountAddress.mjs +1 -1
  221. package/dist/esm/core/authenticationKey.d.mts +1 -1
  222. package/dist/esm/core/authenticationKey.mjs +1 -1
  223. package/dist/esm/core/common.mjs +1 -1
  224. package/dist/esm/core/crypto/cryptoHasher.d.mts +21 -0
  225. package/dist/esm/core/crypto/cryptoHasher.mjs +2 -0
  226. package/dist/esm/core/crypto/cryptoHasher.mjs.map +1 -0
  227. package/dist/esm/core/crypto/ed25519.d.mts +1 -1
  228. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  229. package/dist/esm/core/crypto/ephemeral.d.mts +73 -0
  230. package/dist/esm/core/crypto/ephemeral.mjs +2 -0
  231. package/dist/esm/core/crypto/ephemeral.mjs.map +1 -0
  232. package/dist/esm/core/crypto/index.d.mts +5 -1
  233. package/dist/esm/core/crypto/index.mjs +1 -1
  234. package/dist/esm/core/crypto/keyless.d.mts +276 -0
  235. package/dist/esm/core/crypto/keyless.mjs +2 -0
  236. package/dist/esm/core/crypto/keyless.mjs.map +1 -0
  237. package/dist/esm/core/crypto/multiEd25519.d.mts +1 -1
  238. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  239. package/dist/esm/core/crypto/multiKey.d.mts +1 -1
  240. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  241. package/dist/esm/core/crypto/poseidon.d.mts +19 -0
  242. package/dist/esm/core/crypto/poseidon.mjs +2 -0
  243. package/dist/esm/core/crypto/poseidon.mjs.map +1 -0
  244. package/dist/esm/core/crypto/privateKey.d.mts +1 -1
  245. package/dist/esm/core/crypto/proof.d.mts +21 -0
  246. package/dist/esm/core/crypto/proof.mjs +2 -0
  247. package/dist/esm/core/crypto/proof.mjs.map +1 -0
  248. package/dist/esm/core/crypto/publicKey.d.mts +1 -1
  249. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  250. package/dist/esm/core/crypto/secp256k1.d.mts +1 -1
  251. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  252. package/dist/esm/core/crypto/signature.mjs +1 -1
  253. package/dist/esm/core/crypto/singleKey.d.mts +1 -1
  254. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  255. package/dist/esm/core/crypto/utils.mjs +1 -1
  256. package/dist/esm/core/hex.mjs +1 -1
  257. package/dist/esm/core/index.d.mts +5 -1
  258. package/dist/esm/core/index.mjs +1 -1
  259. package/dist/esm/index.d.mts +16 -8
  260. package/dist/esm/index.mjs +1 -1
  261. package/dist/esm/internal/account.d.mts +2 -2
  262. package/dist/esm/internal/account.mjs +1 -1
  263. package/dist/esm/internal/ans.d.mts +2 -2
  264. package/dist/esm/internal/ans.mjs +1 -1
  265. package/dist/esm/internal/coin.d.mts +1 -1
  266. package/dist/esm/internal/coin.mjs +1 -1
  267. package/dist/esm/internal/digitalAsset.d.mts +2 -2
  268. package/dist/esm/internal/digitalAsset.mjs +1 -1
  269. package/dist/esm/internal/event.mjs +1 -1
  270. package/dist/esm/internal/faucet.mjs +1 -1
  271. package/dist/esm/internal/fungibleAsset.d.mts +2 -2
  272. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  273. package/dist/esm/internal/general.mjs +1 -1
  274. package/dist/esm/internal/keyless.d.mts +78 -0
  275. package/dist/esm/internal/keyless.mjs +2 -0
  276. package/dist/esm/internal/keyless.mjs.map +1 -0
  277. package/dist/esm/internal/staking.mjs +1 -1
  278. package/dist/esm/internal/table.mjs +1 -1
  279. package/dist/esm/internal/transaction.mjs +1 -1
  280. package/dist/esm/internal/transactionSubmission.d.mts +2 -2
  281. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  282. package/dist/esm/internal/view.d.mts +1 -1
  283. package/dist/esm/internal/view.mjs +1 -1
  284. package/dist/esm/transactions/authenticator/account.d.mts +1 -1
  285. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  286. package/dist/esm/transactions/authenticator/index.d.mts +1 -1
  287. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  288. package/dist/esm/transactions/authenticator/transaction.d.mts +1 -1
  289. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  290. package/dist/esm/transactions/index.d.mts +3 -3
  291. package/dist/esm/transactions/index.mjs +1 -1
  292. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  293. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  294. package/dist/esm/transactions/instances/index.d.mts +1 -1
  295. package/dist/esm/transactions/instances/index.mjs +1 -1
  296. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  297. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  298. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  299. package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +1 -1
  300. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  301. package/dist/esm/transactions/instances/signedTransaction.d.mts +1 -1
  302. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  303. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  304. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  305. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +2 -2
  306. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  307. package/dist/esm/transactions/management/index.d.mts +2 -2
  308. package/dist/esm/transactions/management/index.mjs +1 -1
  309. package/dist/esm/transactions/management/transactionWorker.d.mts +2 -2
  310. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  311. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +1 -1
  312. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  313. package/dist/esm/transactions/transactionBuilder/index.d.mts +2 -2
  314. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  315. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +3 -3
  316. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  317. package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +4 -13
  318. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  319. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +1 -1
  320. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  321. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  322. package/dist/esm/transactions/typeTag/parser.d.mts +3 -1
  323. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  324. package/dist/esm/transactions/types.d.mts +23 -5
  325. package/dist/esm/types/index.d.mts +21 -5
  326. package/dist/esm/types/index.mjs +1 -1
  327. package/dist/esm/types/keyless.d.mts +52 -0
  328. package/dist/esm/types/keyless.mjs +1 -0
  329. package/dist/esm/types/keyless.mjs.map +1 -0
  330. package/dist/esm/utils/apiEndpoints.d.mts +3 -1
  331. package/dist/esm/utils/apiEndpoints.mjs +1 -1
  332. package/dist/esm/utils/const.d.mts +3 -1
  333. package/dist/esm/utils/const.mjs +1 -1
  334. package/dist/esm/utils/helpers.d.mts +4 -1
  335. package/dist/esm/utils/helpers.mjs +1 -1
  336. package/dist/esm/utils/index.d.mts +1 -1
  337. package/dist/esm/utils/index.mjs +1 -1
  338. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  339. package/dist/esm/version.d.mts +1 -1
  340. package/dist/esm/version.mjs +1 -1
  341. package/package.json +11 -3
  342. package/src/account/EphemeralKeyPair.ts +157 -0
  343. package/src/account/KeylessAccount.ts +404 -0
  344. package/src/account/MultiKeyAccount.ts +11 -0
  345. package/src/account/index.ts +2 -0
  346. package/src/api/aptos.ts +6 -0
  347. package/src/api/aptosConfig.ts +46 -1
  348. package/src/api/keyless.ts +59 -0
  349. package/src/bcs/deserializer.ts +46 -0
  350. package/src/bcs/serializer.ts +58 -0
  351. package/src/cli/localNode.ts +11 -1
  352. package/src/cli/move.ts +11 -1
  353. package/src/client/core.ts +5 -0
  354. package/src/client/get.ts +12 -0
  355. package/src/client/post.ts +18 -0
  356. package/src/client/types.ts +1 -1
  357. package/src/core/crypto/cryptoHasher.ts +16 -0
  358. package/src/core/crypto/ephemeral.ts +138 -0
  359. package/src/core/crypto/index.ts +2 -0
  360. package/src/core/crypto/keyless.ts +589 -0
  361. package/src/core/crypto/poseidon.ts +142 -0
  362. package/src/core/crypto/proof.ts +16 -0
  363. package/src/core/crypto/singleKey.ts +11 -0
  364. package/src/internal/keyless.ts +175 -0
  365. package/src/internal/transactionSubmission.ts +7 -2
  366. package/src/transactions/transactionBuilder/remoteAbi.ts +16 -2
  367. package/src/transactions/transactionBuilder/signingMessage.ts +0 -13
  368. package/src/transactions/transactionBuilder/transactionBuilder.ts +22 -2
  369. package/src/transactions/typeTag/parser.ts +98 -52
  370. package/src/transactions/types.ts +22 -3
  371. package/src/types/index.ts +24 -2
  372. package/src/types/keyless.ts +42 -0
  373. package/src/utils/apiEndpoints.ts +16 -0
  374. package/src/utils/const.ts +2 -0
  375. package/src/utils/helpers.ts +25 -0
  376. package/src/version.ts +1 -1
  377. package/dist/common/chunk-KSEUZTKY.js +0 -2
  378. package/dist/common/chunk-KSEUZTKY.js.map +0 -1
  379. package/dist/esm/chunk-2XK53QFA.mjs +0 -2
  380. package/dist/esm/chunk-3JPVQHOR.mjs +0 -2
  381. package/dist/esm/chunk-3JPVQHOR.mjs.map +0 -1
  382. package/dist/esm/chunk-4NHWV5AI.mjs +0 -2
  383. package/dist/esm/chunk-53INTTOI.mjs +0 -2
  384. package/dist/esm/chunk-6IFMQ5AS.mjs +0 -2
  385. package/dist/esm/chunk-6IFMQ5AS.mjs.map +0 -1
  386. package/dist/esm/chunk-AF5WNJOP.mjs +0 -2
  387. package/dist/esm/chunk-B7X6PSE7.mjs +0 -2
  388. package/dist/esm/chunk-BBKE2QJU.mjs +0 -2
  389. package/dist/esm/chunk-BBKE2QJU.mjs.map +0 -1
  390. package/dist/esm/chunk-CEHCDA3G.mjs +0 -2
  391. package/dist/esm/chunk-CJDEPZ4J.mjs +0 -2
  392. package/dist/esm/chunk-CYNQRMO5.mjs +0 -2
  393. package/dist/esm/chunk-CYNQRMO5.mjs.map +0 -1
  394. package/dist/esm/chunk-F7EMGK4M.mjs +0 -2
  395. package/dist/esm/chunk-GPEM3JVU.mjs +0 -2
  396. package/dist/esm/chunk-HYCGMFC2.mjs +0 -2
  397. package/dist/esm/chunk-HYCGMFC2.mjs.map +0 -1
  398. package/dist/esm/chunk-IENCDVPF.mjs +0 -2
  399. package/dist/esm/chunk-IENCDVPF.mjs.map +0 -1
  400. package/dist/esm/chunk-L54P6EGN.mjs +0 -2
  401. package/dist/esm/chunk-L54P6EGN.mjs.map +0 -1
  402. package/dist/esm/chunk-LDQ6JFEF.mjs +0 -2
  403. package/dist/esm/chunk-LDQ6JFEF.mjs.map +0 -1
  404. package/dist/esm/chunk-LG7RJQ57.mjs +0 -2
  405. package/dist/esm/chunk-LQNPI3IR.mjs +0 -2
  406. package/dist/esm/chunk-LQNPI3IR.mjs.map +0 -1
  407. package/dist/esm/chunk-MJPUASSD.mjs +0 -2
  408. package/dist/esm/chunk-MJPUASSD.mjs.map +0 -1
  409. package/dist/esm/chunk-N3U47Y6Y.mjs +0 -2
  410. package/dist/esm/chunk-O2K7RZWM.mjs +0 -2
  411. package/dist/esm/chunk-O2K7RZWM.mjs.map +0 -1
  412. package/dist/esm/chunk-O4WVPLUX.mjs +0 -2
  413. package/dist/esm/chunk-OWW6SIDP.mjs +0 -2
  414. package/dist/esm/chunk-OWW6SIDP.mjs.map +0 -1
  415. package/dist/esm/chunk-P5TZBE3L.mjs +0 -2
  416. package/dist/esm/chunk-PF57EOJY.mjs +0 -2
  417. package/dist/esm/chunk-PZ4SAXY7.mjs +0 -2
  418. package/dist/esm/chunk-PZ4SAXY7.mjs.map +0 -1
  419. package/dist/esm/chunk-RFZ5LTGP.mjs +0 -2
  420. package/dist/esm/chunk-RFZ5LTGP.mjs.map +0 -1
  421. package/dist/esm/chunk-ROXFCLDT.mjs +0 -2
  422. package/dist/esm/chunk-RTSWVT2Q.mjs +0 -2
  423. package/dist/esm/chunk-RTSWVT2Q.mjs.map +0 -1
  424. package/dist/esm/chunk-S2VSJJRJ.mjs +0 -2
  425. package/dist/esm/chunk-S2VSJJRJ.mjs.map +0 -1
  426. package/dist/esm/chunk-SRDIYE3M.mjs +0 -2
  427. package/dist/esm/chunk-UGPALAPN.mjs +0 -2
  428. package/dist/esm/chunk-UO3NZ5AH.mjs +0 -1
  429. package/dist/esm/chunk-UVSRX4SV.mjs +0 -1
  430. package/dist/esm/chunk-YCC6HN74.mjs +0 -2
  431. package/dist/esm/chunk-YCC6HN74.mjs.map +0 -1
  432. package/dist/esm/chunk-YMB2XW2O.mjs +0 -2
  433. /package/dist/esm/{chunk-UO3NZ5AH.mjs.map → account/EphemeralKeyPair.mjs.map} +0 -0
  434. /package/dist/esm/{chunk-UVSRX4SV.mjs.map → account/KeylessAccount.mjs.map} +0 -0
  435. /package/dist/esm/{chunk-R5ST36VJ.mjs.map → chunk-34WI7I3Z.mjs.map} +0 -0
  436. /package/dist/esm/{chunk-53INTTOI.mjs.map → chunk-3DP4R3FI.mjs.map} +0 -0
  437. /package/dist/esm/{chunk-FFGY7Z4B.mjs.map → chunk-3J53BCEQ.mjs.map} +0 -0
  438. /package/dist/esm/{chunk-4GWNWSZP.mjs.map → chunk-3YIUOKWW.mjs.map} +0 -0
  439. /package/dist/esm/{chunk-EA2DKJPX.mjs.map → chunk-45ESRYGP.mjs.map} +0 -0
  440. /package/dist/esm/{chunk-PF57EOJY.mjs.map → chunk-4VAYXBD2.mjs.map} +0 -0
  441. /package/dist/esm/{chunk-JGSOTNJ5.mjs.map → chunk-6F3HFDL3.mjs.map} +0 -0
  442. /package/dist/esm/{chunk-BN22EYXR.mjs.map → chunk-6MDYCC7P.mjs.map} +0 -0
  443. /package/dist/esm/{chunk-F7NLNWHN.mjs.map → chunk-7CJAEAQZ.mjs.map} +0 -0
  444. /package/dist/esm/{chunk-JQIGQMNZ.mjs.map → chunk-7Y6AWDBZ.mjs.map} +0 -0
  445. /package/dist/esm/{chunk-BCUSI3N6.mjs.map → chunk-AOCNYMMX.mjs.map} +0 -0
  446. /package/dist/esm/{chunk-4NHWV5AI.mjs.map → chunk-AUAL3H36.mjs.map} +0 -0
  447. /package/dist/esm/{chunk-I5T6PHDV.mjs.map → chunk-AUV4VAXK.mjs.map} +0 -0
  448. /package/dist/esm/{chunk-2X7A4HUS.mjs.map → chunk-AVWAYKNS.mjs.map} +0 -0
  449. /package/dist/esm/{chunk-EZPUVLME.mjs.map → chunk-BNA3SGG6.mjs.map} +0 -0
  450. /package/dist/esm/{chunk-GPEM3JVU.mjs.map → chunk-CEGCSC3T.mjs.map} +0 -0
  451. /package/dist/esm/{chunk-F4GDEXZ6.mjs.map → chunk-CZOUSIAD.mjs.map} +0 -0
  452. /package/dist/esm/{chunk-A4JUQZXI.mjs.map → chunk-DSVNXD5A.mjs.map} +0 -0
  453. /package/dist/esm/{chunk-AF5WNJOP.mjs.map → chunk-EJ7ODMDA.mjs.map} +0 -0
  454. /package/dist/esm/{chunk-UR3JTLIT.mjs.map → chunk-EJURLI4L.mjs.map} +0 -0
  455. /package/dist/esm/{chunk-LG7RJQ57.mjs.map → chunk-FBPNHF54.mjs.map} +0 -0
  456. /package/dist/esm/{chunk-AHW3SKT7.mjs.map → chunk-GHHIUWPP.mjs.map} +0 -0
  457. /package/dist/esm/{chunk-G56GPLTB.mjs.map → chunk-GS5Z3HO7.mjs.map} +0 -0
  458. /package/dist/esm/{chunk-XFSDV3ND.mjs.map → chunk-HOX6Q6ZP.mjs.map} +0 -0
  459. /package/dist/esm/{chunk-ROXFCLDT.mjs.map → chunk-HQK6MF3G.mjs.map} +0 -0
  460. /package/dist/esm/{chunk-O4WVPLUX.mjs.map → chunk-ISXBJPLD.mjs.map} +0 -0
  461. /package/dist/esm/{chunk-JX75UKJX.mjs.map → chunk-IU6REVKX.mjs.map} +0 -0
  462. /package/dist/esm/{chunk-ERIPXWXJ.mjs.map → chunk-IWKIZLFW.mjs.map} +0 -0
  463. /package/dist/esm/{chunk-PIVZMT5D.mjs.map → chunk-J534ICWA.mjs.map} +0 -0
  464. /package/dist/esm/{chunk-UGPALAPN.mjs.map → chunk-J577ODDM.mjs.map} +0 -0
  465. /package/dist/esm/{chunk-YK63A5T6.mjs.map → chunk-LLRWILVZ.mjs.map} +0 -0
  466. /package/dist/esm/{chunk-35EWRSDK.mjs.map → chunk-MLQT5I6K.mjs.map} +0 -0
  467. /package/dist/esm/{chunk-N3U47Y6Y.mjs.map → chunk-MSGHGK52.mjs.map} +0 -0
  468. /package/dist/esm/{chunk-5EN52MUT.mjs.map → chunk-NGTNMV6Q.mjs.map} +0 -0
  469. /package/dist/esm/{chunk-P46OPJB4.mjs.map → chunk-NH466YFP.mjs.map} +0 -0
  470. /package/dist/esm/{chunk-ZM33M6QO.mjs.map → chunk-NUBYALZP.mjs.map} +0 -0
  471. /package/dist/esm/{chunk-CHWE77CR.mjs.map → chunk-OFC75EWS.mjs.map} +0 -0
  472. /package/dist/esm/{chunk-H6FEXRTK.mjs.map → chunk-OOYRJQPD.mjs.map} +0 -0
  473. /package/dist/esm/{chunk-WN3JL7ZT.mjs.map → chunk-PG7KSUMN.mjs.map} +0 -0
  474. /package/dist/esm/{chunk-KAGLWBIJ.mjs.map → chunk-PGP2XMDE.mjs.map} +0 -0
  475. /package/dist/esm/{chunk-CYTRYBWN.mjs.map → chunk-QJIMZI32.mjs.map} +0 -0
  476. /package/dist/esm/{chunk-E56MTU2U.mjs.map → chunk-QLE5JL4X.mjs.map} +0 -0
  477. /package/dist/esm/{chunk-WNPL4SEJ.mjs.map → chunk-QOOHLRRJ.mjs.map} +0 -0
  478. /package/dist/esm/{chunk-TM7NDDT3.mjs.map → chunk-R4HLV32L.mjs.map} +0 -0
  479. /package/dist/esm/{chunk-MCRRHBFQ.mjs.map → chunk-RWYPGTNL.mjs.map} +0 -0
  480. /package/dist/esm/{chunk-CEHCDA3G.mjs.map → chunk-SCHMTP4N.mjs.map} +0 -0
  481. /package/dist/esm/{chunk-GP6Z47HM.mjs.map → chunk-SCRIQQV3.mjs.map} +0 -0
  482. /package/dist/esm/{chunk-NGQR5UQ3.mjs.map → chunk-SNBE5YAC.mjs.map} +0 -0
  483. /package/dist/esm/{chunk-UW2FPXYA.mjs.map → chunk-THURV6CN.mjs.map} +0 -0
  484. /package/dist/esm/{chunk-F7EMGK4M.mjs.map → chunk-TJDC5PWD.mjs.map} +0 -0
  485. /package/dist/esm/{chunk-GUALXVFI.mjs.map → chunk-TU6VKYDC.mjs.map} +0 -0
  486. /package/dist/esm/{chunk-DZSDCUP2.mjs.map → chunk-UFMIMN7W.mjs.map} +0 -0
  487. /package/dist/esm/{chunk-3Y46WJUR.mjs.map → chunk-ULW5LX5H.mjs.map} +0 -0
  488. /package/dist/esm/{chunk-U3YYSIIT.mjs.map → chunk-VBODXPT3.mjs.map} +0 -0
  489. /package/dist/esm/{chunk-B7X6PSE7.mjs.map → chunk-VMVSUH2K.mjs.map} +0 -0
  490. /package/dist/esm/{chunk-ZCG6WBLE.mjs.map → chunk-WJIICWOB.mjs.map} +0 -0
  491. /package/dist/esm/{chunk-T2AGN5YT.mjs.map → chunk-WOLLRMXR.mjs.map} +0 -0
  492. /package/dist/esm/{chunk-GM56MMNJ.mjs.map → chunk-XQ7I34AL.mjs.map} +0 -0
  493. /package/dist/esm/{chunk-RT6LEYHZ.mjs.map → chunk-Y24BMR2W.mjs.map} +0 -0
  494. /package/dist/esm/{chunk-HSJTQLI2.mjs.map → chunk-YLQJBXUF.mjs.map} +0 -0
  495. /package/dist/esm/{publicKey-B3XRNhHO.d.mts → publicKey-lq5djCIY.d.mts} +0 -0
@@ -0,0 +1,142 @@
1
+ /* eslint-disable no-bitwise */
2
+ import {
3
+ poseidon1,
4
+ poseidon2,
5
+ poseidon3,
6
+ poseidon4,
7
+ poseidon5,
8
+ poseidon6,
9
+ poseidon7,
10
+ poseidon8,
11
+ poseidon9,
12
+ poseidon10,
13
+ poseidon11,
14
+ poseidon12,
15
+ poseidon13,
16
+ poseidon14,
17
+ poseidon15,
18
+ poseidon16,
19
+ } from "poseidon-lite";
20
+
21
+ const numInputsToPoseidonFunc = [
22
+ poseidon1,
23
+ poseidon2,
24
+ poseidon3,
25
+ poseidon4,
26
+ poseidon5,
27
+ poseidon6,
28
+ poseidon7,
29
+ poseidon8,
30
+ poseidon9,
31
+ poseidon10,
32
+ poseidon11,
33
+ poseidon12,
34
+ poseidon13,
35
+ poseidon14,
36
+ poseidon15,
37
+ poseidon16,
38
+ ];
39
+
40
+ const BYTES_PACKED_PER_SCALAR = 31;
41
+ const MAX_NUM_INPUT_SCALARS = 16;
42
+ const MAX_NUM_INPUT_BYTES = (MAX_NUM_INPUT_SCALARS - 1) * BYTES_PACKED_PER_SCALAR;
43
+
44
+ /**
45
+ * Hashes a string to a field element via poseidon
46
+ *
47
+ * @returns bigint result of the hash
48
+ */
49
+ export function hashStrToField(str: string, maxSizeBytes: number): bigint {
50
+ const textEncoder = new TextEncoder();
51
+ const strBytes = textEncoder.encode(str);
52
+ return hashBytesWithLen(strBytes, maxSizeBytes);
53
+ }
54
+
55
+ function hashBytesWithLen(bytes: Uint8Array, maxSizeBytes: number): bigint {
56
+ if (bytes.length > maxSizeBytes) {
57
+ throw new Error(`Inputted bytes of length ${bytes} is longer than ${maxSizeBytes}`);
58
+ }
59
+ const packed = padAndPackBytesWithLen(bytes, maxSizeBytes);
60
+ return poseidonHash(packed);
61
+ }
62
+
63
+ function padAndPackBytesNoLen(bytes: Uint8Array, maxSizeBytes: number): bigint[] {
64
+ if (bytes.length > maxSizeBytes) {
65
+ throw new Error(`Input bytes of length ${bytes} is longer than ${maxSizeBytes}`);
66
+ }
67
+ const paddedStrBytes = padUint8ArrayWithZeros(bytes, maxSizeBytes);
68
+ return packBytes(paddedStrBytes);
69
+ }
70
+
71
+ export function padAndPackBytesWithLen(bytes: Uint8Array, maxSizeBytes: number): bigint[] {
72
+ if (bytes.length > maxSizeBytes) {
73
+ throw new Error(`Input bytes of length ${bytes} is longer than ${maxSizeBytes}`);
74
+ }
75
+ return padAndPackBytesNoLen(bytes, maxSizeBytes).concat([BigInt(bytes.length)]);
76
+ }
77
+
78
+ function packBytes(bytes: Uint8Array): bigint[] {
79
+ if (bytes.length > MAX_NUM_INPUT_BYTES) {
80
+ throw new Error(`Can't pack more than ${MAX_NUM_INPUT_BYTES}. Was given ${bytes.length} bytes`);
81
+ }
82
+ return chunkUint8Array(bytes, BYTES_PACKED_PER_SCALAR).map((chunk) => bytesToBigIntLE(chunk));
83
+ }
84
+
85
+ function chunkUint8Array(array: Uint8Array, chunkSize: number): Uint8Array[] {
86
+ const result: Uint8Array[] = [];
87
+ for (let i = 0; i < array.length; i += chunkSize) {
88
+ result.push(array.subarray(i, i + chunkSize));
89
+ }
90
+ return result;
91
+ }
92
+
93
+ export function bytesToBigIntLE(bytes: Uint8Array): bigint {
94
+ let result = BigInt(0);
95
+ for (let i = bytes.length - 1; i >= 0; i -= 1) {
96
+ result = (result << BigInt(8)) | BigInt(bytes[i]);
97
+ }
98
+ return result;
99
+ }
100
+
101
+ export function bigIntToBytesLE(value: bigint, length: number): Uint8Array {
102
+ const bytes = new Uint8Array(length);
103
+ for (let i = 0; i < length; i += 1) {
104
+ bytes[i] = Number(value & BigInt(0xff));
105
+ // eslint-disable-next-line no-param-reassign
106
+ value >>= BigInt(8);
107
+ }
108
+ return bytes;
109
+ }
110
+
111
+ function padUint8ArrayWithZeros(inputArray: Uint8Array, paddedSize: number): Uint8Array {
112
+ if (paddedSize < inputArray.length) {
113
+ throw new Error("Padded size must be greater than or equal to the input array size.");
114
+ }
115
+
116
+ // Create a new Uint8Array with the padded size
117
+ const paddedArray = new Uint8Array(paddedSize);
118
+
119
+ // Copy the content of the input array to the new array
120
+ paddedArray.set(inputArray);
121
+
122
+ // Fill the remaining space with zeros
123
+ for (let i = inputArray.length; i < paddedSize; i += 1) {
124
+ paddedArray[i] = 0;
125
+ }
126
+
127
+ return paddedArray;
128
+ }
129
+
130
+ /**
131
+ * Hashes up to 16 scalar elements via the poseidon hashing algorithm.
132
+ *
133
+ * Each element must be scalar fields of the BN254 elliptic curve group.
134
+ *
135
+ * @returns bigint result of the hash
136
+ */
137
+ export function poseidonHash(inputs: (number | bigint | string)[]): bigint {
138
+ if (inputs.length > numInputsToPoseidonFunc.length) {
139
+ throw new Error(`Unable to hash input of length ${inputs.length}. Max input length is ${numInputsToPoseidonFunc.length}`);
140
+ }
141
+ return numInputsToPoseidonFunc[inputs.length - 1](inputs);
142
+ }
@@ -0,0 +1,16 @@
1
+ import { Serializable } from "../../bcs";
2
+ import { Hex } from "../hex";
3
+
4
+ /**
5
+ * An abstract representation of a crypto proof.
6
+ * associated to a specific zero knowledge proof schemes e.g. Groth16, PLONK
7
+ */
8
+ export abstract class Proof extends Serializable {
9
+ /**
10
+ * Get the proof as a hex string with a 0x prefix e.g. 0x123456...
11
+ */
12
+ toString(): string {
13
+ const bytes = this.bcsToBytes();
14
+ return Hex.fromHexInput(bytes).toString();
15
+ }
16
+ }
@@ -4,6 +4,7 @@ import { AuthenticationKey } from "../authenticationKey";
4
4
  import { Ed25519PublicKey, Ed25519Signature } from "./ed25519";
5
5
  import { AccountPublicKey, PublicKey, VerifySignatureArgs } from "./publicKey";
6
6
  import { Secp256k1PublicKey, Secp256k1Signature } from "./secp256k1";
7
+ import { KeylessPublicKey, KeylessSignature } from "./keyless";
7
8
  import { Signature } from "./signature";
8
9
 
9
10
  /**
@@ -34,6 +35,8 @@ export class AnyPublicKey extends AccountPublicKey {
34
35
  this.variant = AnyPublicKeyVariant.Ed25519;
35
36
  } else if (publicKey instanceof Secp256k1PublicKey) {
36
37
  this.variant = AnyPublicKeyVariant.Secp256k1;
38
+ } else if (publicKey instanceof KeylessPublicKey) {
39
+ this.variant = AnyPublicKeyVariant.Keyless;
37
40
  } else {
38
41
  throw new Error("Unsupported public key type");
39
42
  }
@@ -85,6 +88,9 @@ export class AnyPublicKey extends AccountPublicKey {
85
88
  case AnyPublicKeyVariant.Secp256k1:
86
89
  publicKey = Secp256k1PublicKey.deserialize(deserializer);
87
90
  break;
91
+ case AnyPublicKeyVariant.Keyless:
92
+ publicKey = KeylessPublicKey.deserialize(deserializer);
93
+ break;
88
94
  default:
89
95
  throw new Error(`Unknown variant index for AnyPublicKey: ${variantIndex}`);
90
96
  }
@@ -138,6 +144,8 @@ export class AnySignature extends Signature {
138
144
  this.variant = AnySignatureVariant.Ed25519;
139
145
  } else if (signature instanceof Secp256k1Signature) {
140
146
  this.variant = AnySignatureVariant.Secp256k1;
147
+ } else if (signature instanceof KeylessSignature) {
148
+ this.variant = AnySignatureVariant.Keyless;
141
149
  } else {
142
150
  throw new Error("Unsupported signature type");
143
151
  }
@@ -170,6 +178,9 @@ export class AnySignature extends Signature {
170
178
  case AnySignatureVariant.Secp256k1:
171
179
  signature = Secp256k1Signature.deserialize(deserializer);
172
180
  break;
181
+ case AnySignatureVariant.Keyless:
182
+ signature = KeylessSignature.deserialize(deserializer);
183
+ break;
173
184
  default:
174
185
  throw new Error(`Unknown variant index for AnySignature: ${variantIndex}`);
175
186
  }
@@ -0,0 +1,175 @@
1
+ // Copyright © Aptos Foundation
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ /**
5
+ * This file contains the underlying implementations for exposed API surface in
6
+ * the {@link api/keyless}. By moving the methods out into a separate file,
7
+ * other namespaces and processes can access these methods without depending on the entire
8
+ * keyless namespace and without having a dependency cycle error.
9
+ */
10
+ import { AptosConfig } from "../api/aptosConfig";
11
+ import { getAptosFullNode, postAptosPepperService, postAptosProvingService } from "../client";
12
+ import {
13
+ AccountAddress,
14
+ EPK_HORIZON_SECS,
15
+ EphemeralSignature,
16
+ Groth16Zkp,
17
+ Hex,
18
+ KeylessConfiguration,
19
+ ZeroKnowledgeSig,
20
+ ZkProof,
21
+ } from "../core";
22
+ import { HexInput, LedgerVersionArg, MoveResource, ZkpVariant } from "../types";
23
+ import { EphemeralKeyPair, KeylessAccount, ProofFetchCallback } from "../account";
24
+ import {
25
+ Groth16VerificationKeyResponse,
26
+ KeylessConfigurationResponse,
27
+ PepperFetchRequest,
28
+ PepperFetchResponse,
29
+ ProverRequest,
30
+ ProverResponse,
31
+ } from "../types/keyless";
32
+ import { memoizeAsync } from "../utils/memoize";
33
+
34
+ export async function getKeylessConfig(args: {
35
+ aptosConfig: AptosConfig;
36
+ options?: LedgerVersionArg;
37
+ }): Promise<KeylessConfiguration> {
38
+ const { aptosConfig } = args;
39
+ return memoizeAsync(
40
+ async () => {
41
+ const config = await getKeylessConfiguration(args);
42
+ const vk = await getGroth16VerificationKey(args);
43
+ return KeylessConfiguration.create(vk, Number(config.max_exp_horizon_secs));
44
+ },
45
+ `keyless-configuration-${aptosConfig.network}`,
46
+ 1000 * 60 * 5, // 5 minutes
47
+ )();
48
+ }
49
+
50
+ async function getKeylessConfiguration(args: {
51
+ aptosConfig: AptosConfig;
52
+ options?: LedgerVersionArg;
53
+ }): Promise<KeylessConfigurationResponse> {
54
+ const { aptosConfig, options } = args;
55
+ const resourceType = "0x1::keyless_account::Configuration";
56
+ const { data } = await getAptosFullNode<{}, MoveResource<KeylessConfigurationResponse>>({
57
+ aptosConfig,
58
+ originMethod: "getKeylessConfiguration",
59
+ path: `accounts/${AccountAddress.from("0x1").toString()}/resource/${resourceType}`,
60
+ params: { ledger_version: options?.ledgerVersion },
61
+ });
62
+
63
+ return data.data;
64
+ }
65
+
66
+ async function getGroth16VerificationKey(args: {
67
+ aptosConfig: AptosConfig;
68
+ options?: LedgerVersionArg;
69
+ }): Promise<Groth16VerificationKeyResponse> {
70
+ const { aptosConfig, options } = args;
71
+ const resourceType = "0x1::keyless_account::Groth16VerificationKey";
72
+ const { data } = await getAptosFullNode<{}, MoveResource<Groth16VerificationKeyResponse>>({
73
+ aptosConfig,
74
+ originMethod: "getGroth16VerificationKey",
75
+ path: `accounts/${AccountAddress.from("0x1").toString()}/resource/${resourceType}`,
76
+ params: { ledger_version: options?.ledgerVersion },
77
+ });
78
+
79
+ return data.data;
80
+ }
81
+
82
+ export async function getPepper(args: {
83
+ aptosConfig: AptosConfig;
84
+ jwt: string;
85
+ ephemeralKeyPair: EphemeralKeyPair;
86
+ uidKey?: string;
87
+ derivationPath?: string;
88
+ }): Promise<Uint8Array> {
89
+ const { aptosConfig, jwt, ephemeralKeyPair, uidKey, derivationPath } = args;
90
+
91
+ const body = {
92
+ jwt_b64: jwt,
93
+ epk: ephemeralKeyPair.getPublicKey().bcsToHex().toStringWithoutPrefix(),
94
+ exp_date_secs: ephemeralKeyPair.expiryDateSecs,
95
+ epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),
96
+ uid_key: uidKey || "sub",
97
+ derivation_path: derivationPath,
98
+ };
99
+ const { data } = await postAptosPepperService<PepperFetchRequest, PepperFetchResponse>({
100
+ aptosConfig,
101
+ path: "fetch",
102
+ body,
103
+ originMethod: "getPepper",
104
+ overrides: { WITH_CREDENTIALS: false },
105
+ });
106
+ return Hex.fromHexInput(data.pepper).toUint8Array();
107
+ }
108
+
109
+ export async function getProof(args: {
110
+ aptosConfig: AptosConfig;
111
+ jwt: string;
112
+ ephemeralKeyPair: EphemeralKeyPair;
113
+ pepper: HexInput;
114
+ uidKey?: string;
115
+ }): Promise<ZeroKnowledgeSig> {
116
+ const { aptosConfig, jwt, ephemeralKeyPair, pepper, uidKey } = args;
117
+ const json = {
118
+ jwt_b64: jwt,
119
+ epk: ephemeralKeyPair.getPublicKey().bcsToHex().toStringWithoutPrefix(),
120
+ epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),
121
+ exp_date_secs: ephemeralKeyPair.expiryDateSecs,
122
+ exp_horizon_secs: EPK_HORIZON_SECS,
123
+ pepper: Hex.fromHexInput(pepper).toStringWithoutPrefix(),
124
+ uid_key: uidKey || "sub",
125
+ };
126
+
127
+ const { data } = await postAptosProvingService<ProverRequest, ProverResponse>({
128
+ aptosConfig,
129
+ path: "prove",
130
+ body: json,
131
+ originMethod: "getProof",
132
+ overrides: { WITH_CREDENTIALS: false },
133
+ });
134
+
135
+ const proofPoints = data.proof;
136
+ const groth16Zkp = new Groth16Zkp({
137
+ a: proofPoints.a,
138
+ b: proofPoints.b,
139
+ c: proofPoints.c,
140
+ });
141
+
142
+ const signedProof = new ZeroKnowledgeSig({
143
+ proof: new ZkProof(groth16Zkp, ZkpVariant.Groth16),
144
+ trainingWheelsSignature: EphemeralSignature.fromHex(data.training_wheels_signature),
145
+ });
146
+ return signedProof;
147
+ }
148
+
149
+ export async function deriveKeylessAccount(args: {
150
+ aptosConfig: AptosConfig;
151
+ jwt: string;
152
+ ephemeralKeyPair: EphemeralKeyPair;
153
+ uidKey?: string;
154
+ pepper?: HexInput;
155
+ proofFetchCallback?: ProofFetchCallback;
156
+ }): Promise<KeylessAccount> {
157
+ const { proofFetchCallback } = args;
158
+ let { pepper } = args;
159
+ if (pepper === undefined) {
160
+ pepper = await getPepper(args);
161
+ } else {
162
+ pepper = Hex.fromHexInput(pepper).toUint8Array();
163
+ }
164
+
165
+ if (pepper.length !== KeylessAccount.PEPPER_LENGTH) {
166
+ throw new Error(`Pepper needs to be ${KeylessAccount.PEPPER_LENGTH} bytes`);
167
+ }
168
+
169
+ const proofPromise = getProof({ ...args, pepper });
170
+ const proof = proofFetchCallback ? proofPromise : await proofPromise;
171
+
172
+ const keylessAccount = KeylessAccount.fromJWTAndProof({ ...args, proof, pepper, proofFetchCallback });
173
+
174
+ return keylessAccount;
175
+ }
@@ -7,8 +7,8 @@
7
7
 
8
8
  import { AptosConfig } from "../api/aptosConfig";
9
9
  import { MoveVector, U8 } from "../bcs";
10
- import { postAptosFullNode } from "../client";
11
- import { Account } from "../account";
10
+ import { AptosApiError, postAptosFullNode } from "../client";
11
+ import { Account, KeylessAccount, KeylessError, MultiKeyAccount } from "../account";
12
12
  import { AccountAddress, AccountAddressInput } from "../core/accountAddress";
13
13
  import { PrivateKey } from "../core/crypto";
14
14
  import { AccountAuthenticator } from "../transactions/authenticator/account";
@@ -275,6 +275,11 @@ export async function signAndSubmitTransaction(args: {
275
275
  transaction: AnyRawTransaction;
276
276
  }): Promise<PendingTransactionResponse> {
277
277
  const { aptosConfig, signer, transaction } = args;
278
+ // If the signer contains a KeylessAccount, await proof fetching in case the proof
279
+ // was fetched asyncronously.
280
+ if (signer instanceof KeylessAccount || signer instanceof MultiKeyAccount) {
281
+ await signer.waitForProofFetch();
282
+ }
278
283
  const authenticator = signTransaction({ signer, transaction });
279
284
  return submitTransaction({
280
285
  aptosConfig,
@@ -10,6 +10,7 @@ import {
10
10
  EntryFunctionABI,
11
11
  ViewFunctionABI,
12
12
  FunctionABI,
13
+ TypeArgument,
13
14
  } from "../types";
14
15
  import { Bool, MoveOption, MoveString, MoveVector, U128, U16, U256, U32, U64, U8 } from "../../bcs";
15
16
  import { AccountAddress } from "../../core";
@@ -40,9 +41,9 @@ const TEXT_ENCODER = new TextEncoder();
40
41
  /**
41
42
  * Convert type arguments to only type tags, allowing for string representations of type tags
42
43
  */
43
- export function standardizeTypeTags(typeArguments?: Array<TypeTag | string>): Array<TypeTag> {
44
+ export function standardizeTypeTags(typeArguments?: Array<TypeArgument>): Array<TypeTag> {
44
45
  return (
45
- typeArguments?.map((typeArg: string | TypeTag): TypeTag => {
46
+ typeArguments?.map((typeArg: TypeArgument): TypeTag => {
46
47
  // Convert to TypeTag if it's a string representation
47
48
  if (isString(typeArg)) {
48
49
  return parseTypeTag(typeArg);
@@ -217,6 +218,10 @@ function parseArg(
217
218
  if (isBool(arg)) {
218
219
  return new Bool(arg);
219
220
  }
221
+ if (isString(arg)) {
222
+ if (arg === "true") return new Bool(true);
223
+ if (arg === "false") return new Bool(false);
224
+ }
220
225
  throwTypeMismatch("boolean", position);
221
226
  }
222
227
  // TODO: support uint8array?
@@ -230,18 +235,27 @@ function parseArg(
230
235
  if (isNumber(arg)) {
231
236
  return new U8(arg);
232
237
  }
238
+ if (isString(arg)) {
239
+ return new U8(Number.parseInt(arg, 10));
240
+ }
233
241
  throwTypeMismatch("number", position);
234
242
  }
235
243
  if (param.isU16()) {
236
244
  if (isNumber(arg)) {
237
245
  return new U16(arg);
238
246
  }
247
+ if (isString(arg)) {
248
+ return new U16(Number.parseInt(arg, 10));
249
+ }
239
250
  throwTypeMismatch("number", position);
240
251
  }
241
252
  if (param.isU32()) {
242
253
  if (isNumber(arg)) {
243
254
  return new U32(arg);
244
255
  }
256
+ if (isString(arg)) {
257
+ return new U32(Number.parseInt(arg, 10));
258
+ }
245
259
  throwTypeMismatch("number", position);
246
260
  }
247
261
  if (param.isU64()) {
@@ -8,7 +8,6 @@ import { sha3_256 as sha3Hash } from "@noble/hashes/sha3";
8
8
  import { RAW_TRANSACTION_SALT, RAW_TRANSACTION_WITH_DATA_SALT } from "../../utils/const";
9
9
  import { FeePayerRawTransaction, MultiAgentRawTransaction } from "../instances";
10
10
  import { AnyRawTransaction, AnyRawTransactionInstance } from "../types";
11
- import { Serializable } from "../../bcs";
12
11
 
13
12
  /**
14
13
  * Derive the raw transaction type - FeePayerRawTransaction or MultiAgentRawTransaction or RawTransaction
@@ -60,18 +59,6 @@ export function generateSigningMessage(bytes: Uint8Array, domainSeparator: strin
60
59
  return mergedArray;
61
60
  }
62
61
 
63
- /**
64
- * Generates the 'signing message' form of a serilizable value. It bcs serializes the value and uses the name of
65
- * its constructor as the domain separator.
66
- *
67
- * @param serializable An object that has a bcs serialized form
68
- *
69
- * @returns The Uint8Array of the signing message
70
- */
71
- export function generateSigningMessageForSerializable(serializable: Serializable): Uint8Array {
72
- return generateSigningMessage(serializable.bcsToBytes(), `APTOS::${serializable.constructor.name}`);
73
- }
74
-
75
62
  /**
76
63
  * Generates the 'signing message' form of a transaction. It derives the type of transaction and
77
64
  * applies the appropriate domain separator based on if there is extra data such as a fee payer or
@@ -9,7 +9,13 @@
9
9
  import { sha3_256 as sha3Hash } from "@noble/hashes/sha3";
10
10
  import { AptosConfig } from "../../api/aptosConfig";
11
11
  import { AccountAddress, AccountAddressInput, Hex, PublicKey } from "../../core";
12
- import { AnyPublicKey, AnySignature, Secp256k1PublicKey, Secp256k1Signature } from "../../core/crypto";
12
+ import {
13
+ AnyPublicKey,
14
+ AnySignature,
15
+ KeylessPublicKey,
16
+ Secp256k1PublicKey,
17
+ Secp256k1Signature,
18
+ } from "../../core/crypto";
13
19
  import { Ed25519PublicKey, Ed25519Signature } from "../../core/crypto/ed25519";
14
20
  import { getInfo } from "../../internal/account";
15
21
  import { getLedgerInfo } from "../../internal/general";
@@ -216,7 +222,11 @@ export function generateViewFunctionPayloadWithABI(args: InputViewFunctionDataWi
216
222
 
217
223
  function generateTransactionPayloadScript(args: InputScriptData) {
218
224
  return new TransactionPayloadScript(
219
- new Script(Hex.fromHexInput(args.bytecode).toUint8Array(), args.typeArguments ?? [], args.functionArguments),
225
+ new Script(
226
+ Hex.fromHexInput(args.bytecode).toUint8Array(),
227
+ standardizeTypeTags(args.typeArguments),
228
+ args.functionArguments,
229
+ ),
220
230
  );
221
231
  }
222
232
 
@@ -441,6 +451,11 @@ export function generateSignedTransactionForSimulation(args: InputSimulateTransa
441
451
  }
442
452
 
443
453
  export function getAuthenticatorForSimulation(publicKey: PublicKey) {
454
+ if (publicKey instanceof KeylessPublicKey || publicKey instanceof Secp256k1PublicKey) {
455
+ // eslint-disable-next-line no-param-reassign
456
+ publicKey = new AnyPublicKey(publicKey);
457
+ }
458
+
444
459
  // TODO add support for AnyMultiKey
445
460
  if (publicKey instanceof AnyPublicKey) {
446
461
  if (publicKey.publicKey instanceof Ed25519PublicKey) {
@@ -449,6 +464,11 @@ export function getAuthenticatorForSimulation(publicKey: PublicKey) {
449
464
  if (publicKey.publicKey instanceof Secp256k1PublicKey) {
450
465
  return new AccountAuthenticatorSingleKey(publicKey, new AnySignature(new Secp256k1Signature(new Uint8Array(64))));
451
466
  }
467
+ if (publicKey.publicKey instanceof KeylessPublicKey) {
468
+ // TODO: Replace with the line below one simulation works properly for Keyless
469
+ // return new AccountAuthenticatorSingleKey(publicKey, new AnySignature(KeylessSignature.getSimulationSignature()));
470
+ return new AccountAuthenticatorSingleKey(publicKey, new AnySignature(new Ed25519Signature(new Uint8Array(64))));
471
+ }
452
472
  }
453
473
 
454
474
  // legacy code