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

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 (335) hide show
  1. package/dist/common/{accountAddress-OUd5ov6z.d.ts → accountAddress-YfW6h4Ja.d.ts} +1 -1
  2. package/dist/common/{chunk-VLEH6QBR.js → chunk-HPZUSDYP.js} +1 -1
  3. package/dist/common/{chunk-VLEH6QBR.js.map → chunk-HPZUSDYP.js.map} +1 -1
  4. package/dist/common/cli/index.d.ts +1 -1
  5. package/dist/common/cli/index.js +1 -1
  6. package/dist/common/index.d.ts +77 -68
  7. package/dist/common/index.js +12 -12
  8. package/dist/common/index.js.map +1 -1
  9. package/dist/esm/account/Account.mjs +1 -1
  10. package/dist/esm/account/Ed25519Account.mjs +1 -1
  11. package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
  12. package/dist/esm/account/KeylessAccount.d.mts +2 -15
  13. package/dist/esm/account/KeylessAccount.mjs +1 -1
  14. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  15. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  16. package/dist/esm/account/index.d.mts +1 -2
  17. package/dist/esm/account/index.mjs +1 -1
  18. package/dist/esm/api/account.mjs +1 -1
  19. package/dist/esm/api/ans.mjs +1 -1
  20. package/dist/esm/api/aptos.d.mts +3 -4
  21. package/dist/esm/api/aptos.mjs +1 -1
  22. package/dist/esm/api/coin.mjs +1 -1
  23. package/dist/esm/api/digitalAsset.mjs +1 -1
  24. package/dist/esm/api/event.mjs +1 -1
  25. package/dist/esm/api/faucet.mjs +1 -1
  26. package/dist/esm/api/fungibleAsset.mjs +1 -1
  27. package/dist/esm/api/general.mjs +1 -1
  28. package/dist/esm/api/index.d.mts +3 -4
  29. package/dist/esm/api/index.mjs +1 -1
  30. package/dist/esm/api/keyless.d.mts +6 -14
  31. package/dist/esm/api/keyless.mjs +1 -1
  32. package/dist/esm/api/staking.mjs +1 -1
  33. package/dist/esm/api/table.mjs +1 -1
  34. package/dist/esm/api/transaction.mjs +1 -1
  35. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  36. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  37. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  38. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  39. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  40. package/dist/esm/api/utils.mjs +1 -1
  41. package/dist/esm/bcs/deserializer.mjs +1 -1
  42. package/dist/esm/bcs/index.mjs +1 -1
  43. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  44. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  45. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  46. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  47. package/dist/esm/bcs/serializer.mjs +1 -1
  48. package/dist/esm/{chunk-CEGCSC3T.mjs → chunk-2BDKITTE.mjs} +2 -2
  49. package/dist/esm/{chunk-3J53BCEQ.mjs → chunk-2DESIV2P.mjs} +2 -2
  50. package/dist/esm/{chunk-WSVJNBSJ.mjs → chunk-2SJENNM4.mjs} +2 -2
  51. package/dist/esm/{chunk-RAHMGSBW.mjs → chunk-2Y7GVUQQ.mjs} +2 -2
  52. package/dist/esm/{chunk-SZ6KR73C.mjs → chunk-37FFZSIM.mjs} +2 -2
  53. package/dist/esm/{chunk-WXLSJF4A.mjs → chunk-3IFR6T3V.mjs} +1 -1
  54. package/dist/esm/chunk-3IFR6T3V.mjs.map +1 -0
  55. package/dist/esm/chunk-3RJZNUCQ.mjs +2 -0
  56. package/dist/esm/{chunk-ULW5LX5H.mjs → chunk-3TIXNBXM.mjs} +2 -2
  57. package/dist/esm/{chunk-3DP4R3FI.mjs → chunk-472OGHMG.mjs} +2 -2
  58. package/dist/esm/{chunk-PG7KSUMN.mjs → chunk-4AWM7GGV.mjs} +2 -2
  59. package/dist/esm/{chunk-J577ODDM.mjs → chunk-4VPCPASN.mjs} +2 -2
  60. package/dist/esm/{chunk-D76FE35G.mjs → chunk-572AE4D7.mjs} +2 -2
  61. package/dist/esm/{chunk-NUBYALZP.mjs → chunk-5SGAX4VT.mjs} +2 -2
  62. package/dist/esm/{chunk-J534ICWA.mjs → chunk-66G6MKI6.mjs} +2 -2
  63. package/dist/esm/{chunk-RKHPXZM6.mjs → chunk-6FBKUTGF.mjs} +2 -2
  64. package/dist/esm/{chunk-RKHPXZM6.mjs.map → chunk-6FBKUTGF.mjs.map} +1 -1
  65. package/dist/esm/{chunk-NH466YFP.mjs → chunk-6OQBDCDK.mjs} +2 -2
  66. package/dist/esm/{chunk-SCHMTP4N.mjs → chunk-7BW2N4IE.mjs} +2 -2
  67. package/dist/esm/chunk-7FUZE7F4.mjs +2 -0
  68. package/dist/esm/chunk-7FUZE7F4.mjs.map +1 -0
  69. package/dist/esm/chunk-7GU3E2FJ.mjs +2 -0
  70. package/dist/esm/chunk-7GU3E2FJ.mjs.map +1 -0
  71. package/dist/esm/{chunk-ISXBJPLD.mjs → chunk-7SOLAI6Q.mjs} +2 -2
  72. package/dist/esm/{chunk-EJURLI4L.mjs → chunk-AEWSL7BS.mjs} +2 -2
  73. package/dist/esm/{chunk-45ESRYGP.mjs → chunk-ARHEUGVT.mjs} +2 -2
  74. package/dist/esm/{chunk-6F3HFDL3.mjs → chunk-AXR47GFL.mjs} +2 -2
  75. package/dist/esm/{chunk-LLRWILVZ.mjs → chunk-B74ZAMWR.mjs} +2 -2
  76. package/dist/esm/{chunk-AVWAYKNS.mjs → chunk-BO44HPGU.mjs} +2 -2
  77. package/dist/esm/{chunk-HOX6Q6ZP.mjs → chunk-CCIY5VLR.mjs} +2 -2
  78. package/dist/esm/{chunk-R4HLV32L.mjs → chunk-CI64RKDE.mjs} +2 -2
  79. package/dist/esm/{chunk-PGP2XMDE.mjs → chunk-DPWEHSHH.mjs} +2 -2
  80. package/dist/esm/{chunk-QOOHLRRJ.mjs → chunk-E62NBNHE.mjs} +2 -2
  81. package/dist/esm/{chunk-NGTNMV6Q.mjs → chunk-EFMAZTIM.mjs} +2 -2
  82. package/dist/esm/{chunk-UFMIMN7W.mjs → chunk-EJA532W4.mjs} +2 -2
  83. package/dist/esm/{chunk-OOYRJQPD.mjs → chunk-EJQ2EYJ7.mjs} +2 -2
  84. package/dist/esm/{chunk-WJIICWOB.mjs → chunk-ERPUZQVK.mjs} +2 -2
  85. package/dist/esm/{chunk-WHSN42R2.mjs → chunk-F3ZVWLDH.mjs} +2 -2
  86. package/dist/esm/chunk-F7XWXQHU.mjs +2 -0
  87. package/dist/esm/{chunk-JBTLE33X.mjs.map → chunk-F7XWXQHU.mjs.map} +1 -1
  88. package/dist/esm/{chunk-GS5Z3HO7.mjs → chunk-FGGRPEQ3.mjs} +2 -2
  89. package/dist/esm/{chunk-EJ7ODMDA.mjs → chunk-FIG65OJD.mjs} +2 -2
  90. package/dist/esm/{chunk-MSGHGK52.mjs → chunk-GRHLQDHF.mjs} +2 -2
  91. package/dist/esm/{chunk-VMVSUH2K.mjs → chunk-GSCM444Z.mjs} +2 -2
  92. package/dist/esm/{chunk-QJIMZI32.mjs → chunk-GTXZNAYI.mjs} +2 -2
  93. package/dist/esm/{chunk-ZV5P2GSJ.mjs → chunk-IBN7ETCB.mjs} +2 -2
  94. package/dist/esm/{chunk-DSVNXD5A.mjs → chunk-IPI3VB62.mjs} +2 -2
  95. package/dist/esm/{chunk-ZAXWW7VW.mjs → chunk-IVVWQKCF.mjs} +1 -1
  96. package/dist/esm/chunk-IVVWQKCF.mjs.map +1 -0
  97. package/dist/esm/{chunk-XQ7I34AL.mjs → chunk-IXFYYWAC.mjs} +2 -2
  98. package/dist/esm/{chunk-HGRU3HWY.mjs → chunk-J63BIFB7.mjs} +2 -2
  99. package/dist/esm/{chunk-Y24BMR2W.mjs → chunk-JBX3JBIW.mjs} +2 -2
  100. package/dist/esm/{chunk-SSDWEOF7.mjs → chunk-JEE2OXOZ.mjs} +2 -2
  101. package/dist/esm/{chunk-6MDYCC7P.mjs → chunk-JV6JCXCH.mjs} +2 -2
  102. package/dist/esm/{chunk-OZ3GSAFK.mjs → chunk-KGHBTSDR.mjs} +2 -2
  103. package/dist/esm/{chunk-3SXTTG2X.mjs → chunk-L5CPAOUM.mjs} +2 -2
  104. package/dist/esm/chunk-LA67NWMV.mjs +2 -0
  105. package/dist/esm/chunk-LA67NWMV.mjs.map +1 -0
  106. package/dist/esm/chunk-LYOUEPDG.mjs +2 -0
  107. package/dist/esm/{chunk-5VLCYHNJ.mjs.map → chunk-LYOUEPDG.mjs.map} +1 -1
  108. package/dist/esm/{chunk-VBODXPT3.mjs → chunk-MLX6DFMR.mjs} +2 -2
  109. package/dist/esm/{chunk-SNBE5YAC.mjs → chunk-MMM5NTKW.mjs} +2 -2
  110. package/dist/esm/{chunk-OFC75EWS.mjs → chunk-MPTKOK27.mjs} +2 -2
  111. package/dist/esm/chunk-NTQLNAKS.mjs +2 -0
  112. package/dist/esm/chunk-NTQLNAKS.mjs.map +1 -0
  113. package/dist/esm/{chunk-4VAYXBD2.mjs → chunk-NW3WUTTD.mjs} +2 -2
  114. package/dist/esm/{chunk-AUV4VAXK.mjs → chunk-NZBZV7RP.mjs} +2 -2
  115. package/dist/esm/{chunk-QYEJOEWB.mjs → chunk-O3BRX56F.mjs} +2 -2
  116. package/dist/esm/chunk-OAX7LYUZ.mjs +2 -0
  117. package/dist/esm/chunk-OAX7LYUZ.mjs.map +1 -0
  118. package/dist/esm/{chunk-QLE5JL4X.mjs → chunk-OJ6AF4YT.mjs} +2 -2
  119. package/dist/esm/{chunk-5SGIYAB7.mjs → chunk-OR27VDOE.mjs} +2 -2
  120. package/dist/esm/{chunk-M4Q4XDVR.mjs → chunk-PAJXNH6J.mjs} +2 -2
  121. package/dist/esm/{chunk-JCDZ2WXX.mjs → chunk-QHB5A5YP.mjs} +1 -1
  122. package/dist/esm/chunk-QHB5A5YP.mjs.map +1 -0
  123. package/dist/esm/{chunk-THURV6CN.mjs → chunk-QMYYNCC2.mjs} +2 -2
  124. package/dist/esm/chunk-QNDR3S5U.mjs +2 -0
  125. package/dist/esm/chunk-QNDR3S5U.mjs.map +1 -0
  126. package/dist/esm/{chunk-RWYPGTNL.mjs → chunk-SNDFJWYM.mjs} +2 -2
  127. package/dist/esm/{chunk-3YIUOKWW.mjs → chunk-T5YEMU53.mjs} +2 -2
  128. package/dist/esm/{chunk-34WI7I3Z.mjs → chunk-TDDJZLWB.mjs} +2 -2
  129. package/dist/esm/{chunk-IMVC2JKU.mjs → chunk-TEGJAM44.mjs} +2 -2
  130. package/dist/esm/{chunk-IMVC2JKU.mjs.map → chunk-TEGJAM44.mjs.map} +1 -1
  131. package/dist/esm/{chunk-MLQT5I6K.mjs → chunk-TUCCV62K.mjs} +2 -2
  132. package/dist/esm/{chunk-YLQJBXUF.mjs → chunk-TV7RXL3V.mjs} +2 -2
  133. package/dist/esm/{chunk-7QGIAVW4.mjs → chunk-UBON2G6Y.mjs} +2 -2
  134. package/dist/esm/chunk-UKKHWC4Y.mjs +2 -0
  135. package/dist/esm/chunk-UKKHWC4Y.mjs.map +1 -0
  136. package/dist/esm/{chunk-272NA6H5.mjs → chunk-UMLUOYFK.mjs} +1 -1
  137. package/dist/esm/{chunk-272NA6H5.mjs.map → chunk-UMLUOYFK.mjs.map} +1 -1
  138. package/dist/esm/chunk-VRO3J43Z.mjs +2 -0
  139. package/dist/esm/chunk-VRO3J43Z.mjs.map +1 -0
  140. package/dist/esm/{chunk-AUAL3H36.mjs → chunk-WA2NTBYY.mjs} +2 -2
  141. package/dist/esm/{chunk-IWKIZLFW.mjs → chunk-WT5HOIK6.mjs} +2 -2
  142. package/dist/esm/{chunk-V6M7FGQT.mjs → chunk-X2VUS374.mjs} +2 -2
  143. package/dist/esm/{chunk-PENBUSGL.mjs → chunk-XH33BXEY.mjs} +2 -2
  144. package/dist/esm/{chunk-WOLLRMXR.mjs → chunk-XVZBWW46.mjs} +2 -2
  145. package/dist/esm/{chunk-IU6REVKX.mjs → chunk-YDNOKWV3.mjs} +2 -2
  146. package/dist/esm/{chunk-CZOUSIAD.mjs → chunk-YDSBZMZB.mjs} +2 -2
  147. package/dist/esm/{chunk-GHHIUWPP.mjs → chunk-YRUF6N3U.mjs} +2 -2
  148. package/dist/esm/{chunk-SCRIQQV3.mjs → chunk-Z6FMMNAL.mjs} +2 -2
  149. package/dist/esm/{chunk-TU6VKYDC.mjs → chunk-ZNPEUH4I.mjs} +2 -2
  150. package/dist/esm/cli/index.mjs +1 -1
  151. package/dist/esm/cli/localNode.mjs +1 -1
  152. package/dist/esm/client/core.mjs +1 -1
  153. package/dist/esm/client/get.mjs +1 -1
  154. package/dist/esm/client/index.mjs +1 -1
  155. package/dist/esm/client/post.mjs +1 -1
  156. package/dist/esm/client/types.d.mts +1 -5
  157. package/dist/esm/client/types.mjs +1 -1
  158. package/dist/esm/core/account/index.mjs +1 -1
  159. package/dist/esm/core/account/utils/address.mjs +1 -1
  160. package/dist/esm/core/account/utils/index.mjs +1 -1
  161. package/dist/esm/core/accountAddress.mjs +1 -1
  162. package/dist/esm/core/authenticationKey.mjs +1 -1
  163. package/dist/esm/core/crypto/cryptoHasher.mjs +1 -1
  164. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  165. package/dist/esm/core/crypto/ephemeral.mjs +1 -1
  166. package/dist/esm/core/crypto/index.mjs +1 -1
  167. package/dist/esm/core/crypto/keyless.d.mts +34 -2
  168. package/dist/esm/core/crypto/keyless.mjs +1 -1
  169. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  170. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  171. package/dist/esm/core/crypto/poseidon.mjs +1 -1
  172. package/dist/esm/core/crypto/proof.mjs +1 -1
  173. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  174. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  175. package/dist/esm/core/crypto/signature.mjs +1 -1
  176. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  177. package/dist/esm/core/index.mjs +1 -1
  178. package/dist/esm/index.d.mts +1 -1
  179. package/dist/esm/index.mjs +1 -1
  180. package/dist/esm/internal/account.mjs +1 -1
  181. package/dist/esm/internal/ans.mjs +1 -1
  182. package/dist/esm/internal/coin.mjs +1 -1
  183. package/dist/esm/internal/digitalAsset.mjs +1 -1
  184. package/dist/esm/internal/event.mjs +1 -1
  185. package/dist/esm/internal/faucet.mjs +1 -1
  186. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  187. package/dist/esm/internal/general.d.mts +2 -16
  188. package/dist/esm/internal/general.mjs +1 -1
  189. package/dist/esm/internal/keyless.d.mts +3 -8
  190. package/dist/esm/internal/keyless.mjs +1 -1
  191. package/dist/esm/internal/staking.mjs +1 -1
  192. package/dist/esm/internal/table.mjs +1 -1
  193. package/dist/esm/internal/transaction.d.mts +16 -2
  194. package/dist/esm/internal/transaction.mjs +1 -1
  195. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  196. package/dist/esm/internal/view.mjs +1 -1
  197. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  198. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  199. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  200. package/dist/esm/transactions/index.mjs +1 -1
  201. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  202. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  203. package/dist/esm/transactions/instances/index.mjs +1 -1
  204. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  205. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  206. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  207. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  208. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  209. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  210. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  211. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  212. package/dist/esm/transactions/management/index.mjs +1 -1
  213. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  214. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  215. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  216. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  217. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  218. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  219. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  220. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  221. package/dist/esm/utils/helpers.mjs +1 -1
  222. package/dist/esm/utils/index.mjs +1 -1
  223. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  224. package/dist/esm/version.d.mts +1 -1
  225. package/dist/esm/version.mjs +1 -1
  226. package/package.json +1 -2
  227. package/src/account/KeylessAccount.ts +11 -44
  228. package/src/api/general.ts +1 -2
  229. package/src/api/keyless.ts +2 -15
  230. package/src/bcs/deserializer.ts +4 -4
  231. package/src/bcs/serializer.ts +2 -2
  232. package/src/client/core.ts +1 -2
  233. package/src/client/types.ts +1 -1
  234. package/src/core/crypto/cryptoHasher.ts +1 -1
  235. package/src/core/crypto/keyless.ts +97 -64
  236. package/src/core/crypto/poseidon.ts +5 -3
  237. package/src/internal/general.ts +1 -38
  238. package/src/internal/keyless.ts +31 -12
  239. package/src/internal/transaction.ts +92 -0
  240. package/src/internal/transactionSubmission.ts +2 -2
  241. package/src/types/keyless.ts +22 -22
  242. package/src/utils/helpers.ts +6 -1
  243. package/src/version.ts +1 -1
  244. package/dist/esm/chunk-4RXGVY2H.mjs +0 -2
  245. package/dist/esm/chunk-4RXGVY2H.mjs.map +0 -1
  246. package/dist/esm/chunk-5VLCYHNJ.mjs +0 -2
  247. package/dist/esm/chunk-7CJAEAQZ.mjs +0 -2
  248. package/dist/esm/chunk-7CJAEAQZ.mjs.map +0 -1
  249. package/dist/esm/chunk-7Y6AWDBZ.mjs +0 -2
  250. package/dist/esm/chunk-7Y6AWDBZ.mjs.map +0 -1
  251. package/dist/esm/chunk-BNA3SGG6.mjs +0 -2
  252. package/dist/esm/chunk-BNA3SGG6.mjs.map +0 -1
  253. package/dist/esm/chunk-CIPPNT3W.mjs +0 -2
  254. package/dist/esm/chunk-CIPPNT3W.mjs.map +0 -1
  255. package/dist/esm/chunk-FUQDDIKQ.mjs +0 -2
  256. package/dist/esm/chunk-FUQDDIKQ.mjs.map +0 -1
  257. package/dist/esm/chunk-FWTJQHJR.mjs +0 -2
  258. package/dist/esm/chunk-FWTJQHJR.mjs.map +0 -1
  259. package/dist/esm/chunk-HQK6MF3G.mjs +0 -2
  260. package/dist/esm/chunk-JBTLE33X.mjs +0 -2
  261. package/dist/esm/chunk-JCDZ2WXX.mjs.map +0 -1
  262. package/dist/esm/chunk-MEOBWD6V.mjs +0 -2
  263. package/dist/esm/chunk-MEOBWD6V.mjs.map +0 -1
  264. package/dist/esm/chunk-WXLSJF4A.mjs.map +0 -1
  265. package/dist/esm/chunk-ZAXWW7VW.mjs.map +0 -1
  266. /package/dist/esm/{chunk-CEGCSC3T.mjs.map → chunk-2BDKITTE.mjs.map} +0 -0
  267. /package/dist/esm/{chunk-3J53BCEQ.mjs.map → chunk-2DESIV2P.mjs.map} +0 -0
  268. /package/dist/esm/{chunk-WSVJNBSJ.mjs.map → chunk-2SJENNM4.mjs.map} +0 -0
  269. /package/dist/esm/{chunk-RAHMGSBW.mjs.map → chunk-2Y7GVUQQ.mjs.map} +0 -0
  270. /package/dist/esm/{chunk-SZ6KR73C.mjs.map → chunk-37FFZSIM.mjs.map} +0 -0
  271. /package/dist/esm/{chunk-HQK6MF3G.mjs.map → chunk-3RJZNUCQ.mjs.map} +0 -0
  272. /package/dist/esm/{chunk-ULW5LX5H.mjs.map → chunk-3TIXNBXM.mjs.map} +0 -0
  273. /package/dist/esm/{chunk-3DP4R3FI.mjs.map → chunk-472OGHMG.mjs.map} +0 -0
  274. /package/dist/esm/{chunk-PG7KSUMN.mjs.map → chunk-4AWM7GGV.mjs.map} +0 -0
  275. /package/dist/esm/{chunk-J577ODDM.mjs.map → chunk-4VPCPASN.mjs.map} +0 -0
  276. /package/dist/esm/{chunk-D76FE35G.mjs.map → chunk-572AE4D7.mjs.map} +0 -0
  277. /package/dist/esm/{chunk-NUBYALZP.mjs.map → chunk-5SGAX4VT.mjs.map} +0 -0
  278. /package/dist/esm/{chunk-J534ICWA.mjs.map → chunk-66G6MKI6.mjs.map} +0 -0
  279. /package/dist/esm/{chunk-NH466YFP.mjs.map → chunk-6OQBDCDK.mjs.map} +0 -0
  280. /package/dist/esm/{chunk-SCHMTP4N.mjs.map → chunk-7BW2N4IE.mjs.map} +0 -0
  281. /package/dist/esm/{chunk-ISXBJPLD.mjs.map → chunk-7SOLAI6Q.mjs.map} +0 -0
  282. /package/dist/esm/{chunk-EJURLI4L.mjs.map → chunk-AEWSL7BS.mjs.map} +0 -0
  283. /package/dist/esm/{chunk-45ESRYGP.mjs.map → chunk-ARHEUGVT.mjs.map} +0 -0
  284. /package/dist/esm/{chunk-6F3HFDL3.mjs.map → chunk-AXR47GFL.mjs.map} +0 -0
  285. /package/dist/esm/{chunk-LLRWILVZ.mjs.map → chunk-B74ZAMWR.mjs.map} +0 -0
  286. /package/dist/esm/{chunk-AVWAYKNS.mjs.map → chunk-BO44HPGU.mjs.map} +0 -0
  287. /package/dist/esm/{chunk-HOX6Q6ZP.mjs.map → chunk-CCIY5VLR.mjs.map} +0 -0
  288. /package/dist/esm/{chunk-R4HLV32L.mjs.map → chunk-CI64RKDE.mjs.map} +0 -0
  289. /package/dist/esm/{chunk-PGP2XMDE.mjs.map → chunk-DPWEHSHH.mjs.map} +0 -0
  290. /package/dist/esm/{chunk-QOOHLRRJ.mjs.map → chunk-E62NBNHE.mjs.map} +0 -0
  291. /package/dist/esm/{chunk-NGTNMV6Q.mjs.map → chunk-EFMAZTIM.mjs.map} +0 -0
  292. /package/dist/esm/{chunk-UFMIMN7W.mjs.map → chunk-EJA532W4.mjs.map} +0 -0
  293. /package/dist/esm/{chunk-OOYRJQPD.mjs.map → chunk-EJQ2EYJ7.mjs.map} +0 -0
  294. /package/dist/esm/{chunk-WJIICWOB.mjs.map → chunk-ERPUZQVK.mjs.map} +0 -0
  295. /package/dist/esm/{chunk-WHSN42R2.mjs.map → chunk-F3ZVWLDH.mjs.map} +0 -0
  296. /package/dist/esm/{chunk-GS5Z3HO7.mjs.map → chunk-FGGRPEQ3.mjs.map} +0 -0
  297. /package/dist/esm/{chunk-EJ7ODMDA.mjs.map → chunk-FIG65OJD.mjs.map} +0 -0
  298. /package/dist/esm/{chunk-MSGHGK52.mjs.map → chunk-GRHLQDHF.mjs.map} +0 -0
  299. /package/dist/esm/{chunk-VMVSUH2K.mjs.map → chunk-GSCM444Z.mjs.map} +0 -0
  300. /package/dist/esm/{chunk-QJIMZI32.mjs.map → chunk-GTXZNAYI.mjs.map} +0 -0
  301. /package/dist/esm/{chunk-ZV5P2GSJ.mjs.map → chunk-IBN7ETCB.mjs.map} +0 -0
  302. /package/dist/esm/{chunk-DSVNXD5A.mjs.map → chunk-IPI3VB62.mjs.map} +0 -0
  303. /package/dist/esm/{chunk-XQ7I34AL.mjs.map → chunk-IXFYYWAC.mjs.map} +0 -0
  304. /package/dist/esm/{chunk-HGRU3HWY.mjs.map → chunk-J63BIFB7.mjs.map} +0 -0
  305. /package/dist/esm/{chunk-Y24BMR2W.mjs.map → chunk-JBX3JBIW.mjs.map} +0 -0
  306. /package/dist/esm/{chunk-SSDWEOF7.mjs.map → chunk-JEE2OXOZ.mjs.map} +0 -0
  307. /package/dist/esm/{chunk-6MDYCC7P.mjs.map → chunk-JV6JCXCH.mjs.map} +0 -0
  308. /package/dist/esm/{chunk-OZ3GSAFK.mjs.map → chunk-KGHBTSDR.mjs.map} +0 -0
  309. /package/dist/esm/{chunk-3SXTTG2X.mjs.map → chunk-L5CPAOUM.mjs.map} +0 -0
  310. /package/dist/esm/{chunk-VBODXPT3.mjs.map → chunk-MLX6DFMR.mjs.map} +0 -0
  311. /package/dist/esm/{chunk-SNBE5YAC.mjs.map → chunk-MMM5NTKW.mjs.map} +0 -0
  312. /package/dist/esm/{chunk-OFC75EWS.mjs.map → chunk-MPTKOK27.mjs.map} +0 -0
  313. /package/dist/esm/{chunk-4VAYXBD2.mjs.map → chunk-NW3WUTTD.mjs.map} +0 -0
  314. /package/dist/esm/{chunk-AUV4VAXK.mjs.map → chunk-NZBZV7RP.mjs.map} +0 -0
  315. /package/dist/esm/{chunk-QYEJOEWB.mjs.map → chunk-O3BRX56F.mjs.map} +0 -0
  316. /package/dist/esm/{chunk-QLE5JL4X.mjs.map → chunk-OJ6AF4YT.mjs.map} +0 -0
  317. /package/dist/esm/{chunk-5SGIYAB7.mjs.map → chunk-OR27VDOE.mjs.map} +0 -0
  318. /package/dist/esm/{chunk-M4Q4XDVR.mjs.map → chunk-PAJXNH6J.mjs.map} +0 -0
  319. /package/dist/esm/{chunk-THURV6CN.mjs.map → chunk-QMYYNCC2.mjs.map} +0 -0
  320. /package/dist/esm/{chunk-RWYPGTNL.mjs.map → chunk-SNDFJWYM.mjs.map} +0 -0
  321. /package/dist/esm/{chunk-3YIUOKWW.mjs.map → chunk-T5YEMU53.mjs.map} +0 -0
  322. /package/dist/esm/{chunk-34WI7I3Z.mjs.map → chunk-TDDJZLWB.mjs.map} +0 -0
  323. /package/dist/esm/{chunk-MLQT5I6K.mjs.map → chunk-TUCCV62K.mjs.map} +0 -0
  324. /package/dist/esm/{chunk-YLQJBXUF.mjs.map → chunk-TV7RXL3V.mjs.map} +0 -0
  325. /package/dist/esm/{chunk-7QGIAVW4.mjs.map → chunk-UBON2G6Y.mjs.map} +0 -0
  326. /package/dist/esm/{chunk-AUAL3H36.mjs.map → chunk-WA2NTBYY.mjs.map} +0 -0
  327. /package/dist/esm/{chunk-IWKIZLFW.mjs.map → chunk-WT5HOIK6.mjs.map} +0 -0
  328. /package/dist/esm/{chunk-V6M7FGQT.mjs.map → chunk-X2VUS374.mjs.map} +0 -0
  329. /package/dist/esm/{chunk-PENBUSGL.mjs.map → chunk-XH33BXEY.mjs.map} +0 -0
  330. /package/dist/esm/{chunk-WOLLRMXR.mjs.map → chunk-XVZBWW46.mjs.map} +0 -0
  331. /package/dist/esm/{chunk-IU6REVKX.mjs.map → chunk-YDNOKWV3.mjs.map} +0 -0
  332. /package/dist/esm/{chunk-CZOUSIAD.mjs.map → chunk-YDSBZMZB.mjs.map} +0 -0
  333. /package/dist/esm/{chunk-GHHIUWPP.mjs.map → chunk-YRUF6N3U.mjs.map} +0 -0
  334. /package/dist/esm/{chunk-SCRIQQV3.mjs.map → chunk-Z6FMMNAL.mjs.map} +0 -0
  335. /package/dist/esm/{chunk-TU6VKYDC.mjs.map → chunk-ZNPEUH4I.mjs.map} +0 -0
@@ -1,6 +1,7 @@
1
1
  // Copyright © Aptos Foundation
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
+ import { JwtPayload, jwtDecode } from "jwt-decode";
4
5
  import { AccountPublicKey, PublicKey } from "./publicKey";
5
6
  import { Signature } from "./signature";
6
7
  import { Deserializer, Serializable, Serializer } from "../../bcs";
@@ -37,7 +38,7 @@ export class KeylessPublicKey extends AccountPublicKey {
37
38
 
38
39
  /**
39
40
  * A value representing a cryptographic commitment to a user identity.
40
- *
41
+ *
41
42
  * It is calculated from the aud, uidKey, uidVal, pepper.
42
43
  */
43
44
  readonly idCommitment: Uint8Array;
@@ -138,6 +139,18 @@ export class KeylessPublicKey extends AccountPublicKey {
138
139
  computeIdCommitment(args);
139
140
  return new KeylessPublicKey(args.iss, computeIdCommitment(args));
140
141
  }
142
+
143
+ static fromJWTAndPepper(args: { jwt: string; pepper: HexInput; uidKey?: string }): KeylessPublicKey {
144
+ const { jwt, pepper, uidKey = "sub" } = args;
145
+ const jwtPayload = jwtDecode<JwtPayload & { [key: string]: string }>(jwt);
146
+ const iss = jwtPayload.iss!;
147
+ if (typeof jwtPayload.aud !== "string") {
148
+ throw new Error("aud was not found or an array of values");
149
+ }
150
+ const aud = jwtPayload.aud!;
151
+ const uidVal = jwtPayload[uidKey];
152
+ return KeylessPublicKey.create({ iss, uidKey, uidVal, aud, pepper });
153
+ }
141
154
  }
142
155
 
143
156
  function computeIdCommitment(args: { uidKey: string; uidVal: string; aud: string; pepper: HexInput }): Uint8Array {
@@ -254,6 +267,7 @@ export class KeylessSignature extends Signature {
254
267
  new Groth16Zkp({ a: new Uint8Array(32), b: new Uint8Array(64), c: new Uint8Array(32) }),
255
268
  ZkpVariant.Groth16,
256
269
  ),
270
+ expHorizonSecs: 0,
257
271
  }),
258
272
  EphemeralCertificateVariant.ZkProof,
259
273
  ),
@@ -322,7 +336,7 @@ class G1Bytes extends Serializable {
322
336
  }
323
337
 
324
338
  serialize(serializer: Serializer): void {
325
- serializer.serializeFixedBytes(this.data);
339
+ serializer.serializeFixedBytes(this.data);
326
340
  }
327
341
 
328
342
  static deserialize(deserializer: Deserializer): G1Bytes {
@@ -343,7 +357,7 @@ class G2Bytes extends Serializable {
343
357
  }
344
358
 
345
359
  serialize(serializer: Serializer): void {
346
- serializer.serializeFixedBytes(this.data);
360
+ serializer.serializeFixedBytes(this.data);
347
361
  }
348
362
 
349
363
  static deserialize(deserializer: Deserializer): G2Bytes {
@@ -374,9 +388,9 @@ export class Groth16Zkp extends Proof {
374
388
  constructor(args: { a: HexInput; b: HexInput; c: HexInput }) {
375
389
  super();
376
390
  const { a, b, c } = args;
377
- this.a = new G1Bytes(a)
378
- this.b = new G2Bytes(b)
379
- this.c = new G1Bytes(c)
391
+ this.a = new G1Bytes(a);
392
+ this.b = new G2Bytes(b);
393
+ this.c = new G1Bytes(c);
380
394
  }
381
395
 
382
396
  serialize(serializer: Serializer): void {
@@ -438,7 +452,7 @@ export class ZeroKnowledgeSig extends Signature {
438
452
  /**
439
453
  * The max lifespan of the proof
440
454
  */
441
- readonly expHorizonSecs: bigint;
455
+ readonly expHorizonSecs: number;
442
456
 
443
457
  /**
444
458
  * A key value pair on the JWT token that can be specified on the signature which would reveal the value on chain.
@@ -458,19 +472,13 @@ export class ZeroKnowledgeSig extends Signature {
458
472
 
459
473
  constructor(args: {
460
474
  proof: ZkProof;
461
- expHorizonSecs?: bigint;
475
+ expHorizonSecs: number;
462
476
  extraField?: string;
463
477
  overrideAudVal?: string;
464
478
  trainingWheelsSignature?: EphemeralSignature;
465
479
  }) {
466
480
  super();
467
- const {
468
- proof,
469
- expHorizonSecs = BigInt(EPK_HORIZON_SECS),
470
- trainingWheelsSignature,
471
- extraField,
472
- overrideAudVal,
473
- } = args;
481
+ const { proof, expHorizonSecs, trainingWheelsSignature, extraField, overrideAudVal } = args;
474
482
  this.proof = proof;
475
483
  this.expHorizonSecs = expHorizonSecs;
476
484
  this.trainingWheelsSignature = trainingWheelsSignature;
@@ -506,7 +514,7 @@ export class ZeroKnowledgeSig extends Signature {
506
514
 
507
515
  static deserialize(deserializer: Deserializer): ZeroKnowledgeSig {
508
516
  const proof = ZkProof.deserialize(deserializer);
509
- const expHorizonSecs = deserializer.deserializeU64();
517
+ const expHorizonSecs = Number(deserializer.deserializeU64());
510
518
  const extraField = deserializer.deserializeOptionStr();
511
519
  const overrideAudVal = deserializer.deserializeOptionStr();
512
520
  const trainingWheelsSignature = deserializer.deserializeOption(EphemeralSignature);
@@ -515,7 +523,7 @@ export class ZeroKnowledgeSig extends Signature {
515
523
 
516
524
  static load(deserializer: Deserializer): ZeroKnowledgeSig {
517
525
  const proof = ZkProof.deserialize(deserializer);
518
- const expHorizonSecs = deserializer.deserializeU64();
526
+ const expHorizonSecs = Number(deserializer.deserializeU64());
519
527
  const extraField = deserializer.deserializeOptionStr();
520
528
  const overrideAudVal = deserializer.deserializeOptionStr();
521
529
  const trainingWheelsSignature = deserializer.deserializeOption(EphemeralSignature);
@@ -523,9 +531,18 @@ export class ZeroKnowledgeSig extends Signature {
523
531
  }
524
532
  }
525
533
 
534
+ /**
535
+ * A class which represents the on-chain configuration for how Keyless accounts work
536
+ */
526
537
  export class KeylessConfiguration {
538
+ /**
539
+ * The verification key used to verify Groth16 proofs on chain
540
+ */
527
541
  readonly verficationKey: Groth16VerificationKey;
528
542
 
543
+ /**
544
+ * The maximum lifespan of an ephemeral key pair. This is configured on chain.
545
+ */
529
546
  readonly maxExpHorizonSecs: number;
530
547
 
531
548
  constructor(verficationKey: Groth16VerificationKey, maxExpHorizonSecs: number) {
@@ -534,56 +551,72 @@ export class KeylessConfiguration {
534
551
  }
535
552
 
536
553
  static create(res: Groth16VerificationKeyResponse, maxExpHorizonSecs: number): KeylessConfiguration {
537
- return new KeylessConfiguration(new Groth16VerificationKey({
554
+ return new KeylessConfiguration(
555
+ new Groth16VerificationKey({
556
+ alphaG1: res.alpha_g1,
557
+ betaG2: res.beta_g2,
558
+ deltaG2: res.delta_g2,
559
+ gammaAbcG1: res.gamma_abc_g1,
560
+ gammaG2: res.gamma_g2,
561
+ }),
562
+ maxExpHorizonSecs,
563
+ );
564
+ }
565
+ }
566
+
567
+ /**
568
+ * A representation of the verification key stored on chain used to verify Groth16 proofs
569
+ */
570
+ class Groth16VerificationKey {
571
+ // The docstrings below are borrowed from ark-groth16
572
+
573
+ /**
574
+ * The `alpha * G`, where `G` is the generator of G1
575
+ */
576
+ readonly alphaG1: G1Bytes;
577
+
578
+ /**
579
+ * The `alpha * H`, where `H` is the generator of G2
580
+ */
581
+ readonly betaG2: G2Bytes;
582
+
583
+ /**
584
+ * The `delta * H`, where `H` is the generator of G2
585
+ */
586
+ readonly deltaG2: G2Bytes;
587
+
588
+ /**
589
+ * The `gamma^{-1} * (beta * a_i + alpha * b_i + c_i) * H`, where H is the generator of G1
590
+ */
591
+ readonly gammaAbcG1: G1Bytes[];
592
+
593
+ /**
594
+ * The `gamma * H`, where `H` is the generator of G2
595
+ */
596
+ readonly gammaG2: G2Bytes;
597
+
598
+ constructor(args: {
599
+ alphaG1: HexInput;
600
+ betaG2: HexInput;
601
+ deltaG2: HexInput;
602
+ gammaAbcG1: [HexInput, HexInput];
603
+ gammaG2: HexInput;
604
+ }) {
605
+ const { alphaG1, betaG2, deltaG2, gammaAbcG1, gammaG2 } = args;
606
+ this.alphaG1 = new G1Bytes(alphaG1);
607
+ this.betaG2 = new G2Bytes(betaG2);
608
+ this.deltaG2 = new G2Bytes(deltaG2);
609
+ this.gammaAbcG1 = [new G1Bytes(gammaAbcG1[0]), new G1Bytes(gammaAbcG1[1])];
610
+ this.gammaG2 = new G2Bytes(gammaG2);
611
+ }
612
+
613
+ static fromGroth16VerificationKeyResponse(res: Groth16VerificationKeyResponse): Groth16VerificationKey {
614
+ return new Groth16VerificationKey({
538
615
  alphaG1: res.alpha_g1,
539
616
  betaG2: res.beta_g2,
540
617
  deltaG2: res.delta_g2,
541
618
  gammaAbcG1: res.gamma_abc_g1,
542
- gammaG2: res.gamma_g2
543
- }), maxExpHorizonSecs)
619
+ gammaG2: res.gamma_g2,
620
+ });
544
621
  }
545
-
546
622
  }
547
-
548
- class Groth16VerificationKey {
549
- readonly alphaG1: G1Bytes;
550
-
551
- readonly betaG2: G2Bytes;
552
-
553
- readonly deltaG2: G2Bytes;
554
-
555
- readonly gammaAbcG1: G1Bytes[];
556
-
557
- readonly gammaG2: G2Bytes;
558
-
559
- constructor(args: {
560
- alphaG1: HexInput;
561
- betaG2: HexInput;
562
- deltaG2: HexInput;
563
- gammaAbcG1: [HexInput, HexInput];
564
- gammaG2: HexInput;
565
- }) {
566
- const {
567
- alphaG1,
568
- betaG2,
569
- deltaG2,
570
- gammaAbcG1,
571
- gammaG2,
572
- } = args;
573
- this.alphaG1 = new G1Bytes(alphaG1)
574
- this.betaG2 = new G2Bytes(betaG2)
575
- this.deltaG2 = new G2Bytes(deltaG2)
576
- this.gammaAbcG1 = [new G1Bytes(gammaAbcG1[0]), new G1Bytes(gammaAbcG1[1])]
577
- this.gammaG2 =new G2Bytes(gammaG2)
578
- }
579
-
580
- static fromGroth16VerificationKeyResponse(res: Groth16VerificationKeyResponse): Groth16VerificationKey {
581
- return new Groth16VerificationKey({
582
- alphaG1: res.alpha_g1,
583
- betaG2: res.beta_g2,
584
- deltaG2: res.delta_g2,
585
- gammaAbcG1: res.gamma_abc_g1,
586
- gammaG2: res.gamma_g2
587
- })
588
- }
589
- }
@@ -43,7 +43,7 @@ const MAX_NUM_INPUT_BYTES = (MAX_NUM_INPUT_SCALARS - 1) * BYTES_PACKED_PER_SCALA
43
43
 
44
44
  /**
45
45
  * Hashes a string to a field element via poseidon
46
- *
46
+ *
47
47
  * @returns bigint result of the hash
48
48
  */
49
49
  export function hashStrToField(str: string, maxSizeBytes: number): bigint {
@@ -129,14 +129,16 @@ function padUint8ArrayWithZeros(inputArray: Uint8Array, paddedSize: number): Uin
129
129
 
130
130
  /**
131
131
  * Hashes up to 16 scalar elements via the poseidon hashing algorithm.
132
- *
132
+ *
133
133
  * Each element must be scalar fields of the BN254 elliptic curve group.
134
134
  *
135
135
  * @returns bigint result of the hash
136
136
  */
137
137
  export function poseidonHash(inputs: (number | bigint | string)[]): bigint {
138
138
  if (inputs.length > numInputsToPoseidonFunc.length) {
139
- throw new Error(`Unable to hash input of length ${inputs.length}. Max input length is ${numInputsToPoseidonFunc.length}`);
139
+ throw new Error(
140
+ `Unable to hash input of length ${inputs.length}. Max input length is ${numInputsToPoseidonFunc.length}`,
141
+ );
140
142
  }
141
143
  return numInputsToPoseidonFunc[inputs.length - 1](inputs);
142
144
  }
@@ -10,14 +10,7 @@
10
10
 
11
11
  import { AptosConfig } from "../api/aptosConfig";
12
12
  import { getAptosFullNode, postAptosIndexer } from "../client";
13
- import {
14
- AnyNumber,
15
- Block,
16
- GetChainTopUserTransactionsResponse,
17
- GetProcessorStatusResponse,
18
- GraphqlQuery,
19
- LedgerInfo,
20
- } from "../types";
13
+ import { GetChainTopUserTransactionsResponse, GetProcessorStatusResponse, GraphqlQuery, LedgerInfo } from "../types";
21
14
  import { GetChainTopUserTransactionsQuery, GetProcessorStatusQuery } from "../types/generated/operations";
22
15
  import { GetChainTopUserTransactions, GetProcessorStatus } from "../types/generated/queries";
23
16
  import { ProcessorType } from "../utils/const";
@@ -32,36 +25,6 @@ export async function getLedgerInfo(args: { aptosConfig: AptosConfig }): Promise
32
25
  return data;
33
26
  }
34
27
 
35
- export async function getBlockByVersion(args: {
36
- aptosConfig: AptosConfig;
37
- ledgerVersion: AnyNumber;
38
- options?: { withTransactions?: boolean };
39
- }): Promise<Block> {
40
- const { aptosConfig, ledgerVersion, options } = args;
41
- const { data } = await getAptosFullNode<{}, Block>({
42
- aptosConfig,
43
- originMethod: "getBlockByVersion",
44
- path: `blocks/by_version/${ledgerVersion}`,
45
- params: { with_transactions: options?.withTransactions },
46
- });
47
- return data;
48
- }
49
-
50
- export async function getBlockByHeight(args: {
51
- aptosConfig: AptosConfig;
52
- blockHeight: AnyNumber;
53
- options?: { withTransactions?: boolean };
54
- }): Promise<Block> {
55
- const { aptosConfig, blockHeight, options } = args;
56
- const { data } = await getAptosFullNode<{}, Block>({
57
- aptosConfig,
58
- originMethod: "getBlockByHeight",
59
- path: `blocks/by_height/${blockHeight}`,
60
- params: { with_transactions: options?.withTransactions },
61
- });
62
- return data;
63
- }
64
-
65
28
  export async function getChainTopUserTransactions(args: {
66
29
  aptosConfig: AptosConfig;
67
30
  limit: number;
@@ -11,7 +11,6 @@ import { AptosConfig } from "../api/aptosConfig";
11
11
  import { getAptosFullNode, postAptosPepperService, postAptosProvingService } from "../client";
12
12
  import {
13
13
  AccountAddress,
14
- EPK_HORIZON_SECS,
15
14
  EphemeralSignature,
16
15
  Groth16Zkp,
17
16
  Hex,
@@ -31,15 +30,21 @@ import {
31
30
  } from "../types/keyless";
32
31
  import { memoizeAsync } from "../utils/memoize";
33
32
 
34
- export async function getKeylessConfig(args: {
33
+ /**
34
+ * Gets the parameters of how Keyless Accounts are configured on chain including the verifying key and the max expiry horizon
35
+ *
36
+ * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version
37
+ * @returns KeylessConfiguration
38
+ */
39
+ async function getKeylessConfig(args: {
35
40
  aptosConfig: AptosConfig;
36
41
  options?: LedgerVersionArg;
37
42
  }): Promise<KeylessConfiguration> {
38
43
  const { aptosConfig } = args;
39
44
  return memoizeAsync(
40
45
  async () => {
41
- const config = await getKeylessConfiguration(args);
42
- const vk = await getGroth16VerificationKey(args);
46
+ const config = await getKeylessConfigurationResource(args);
47
+ const vk = await getGroth16VerificationKeyResource(args);
43
48
  return KeylessConfiguration.create(vk, Number(config.max_exp_horizon_secs));
44
49
  },
45
50
  `keyless-configuration-${aptosConfig.network}`,
@@ -47,7 +52,13 @@ export async function getKeylessConfig(args: {
47
52
  )();
48
53
  }
49
54
 
50
- async function getKeylessConfiguration(args: {
55
+ /**
56
+ * Gets the KeylessConfiguration set on chain
57
+ *
58
+ * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version
59
+ * @returns KeylessConfigurationResponse
60
+ */
61
+ async function getKeylessConfigurationResource(args: {
51
62
  aptosConfig: AptosConfig;
52
63
  options?: LedgerVersionArg;
53
64
  }): Promise<KeylessConfigurationResponse> {
@@ -63,7 +74,13 @@ async function getKeylessConfiguration(args: {
63
74
  return data.data;
64
75
  }
65
76
 
66
- async function getGroth16VerificationKey(args: {
77
+ /**
78
+ * Gets the Groth16VerificationKey set on chain
79
+ *
80
+ * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version
81
+ * @returns Groth16VerificationKeyResponse
82
+ */
83
+ async function getGroth16VerificationKeyResource(args: {
67
84
  aptosConfig: AptosConfig;
68
85
  options?: LedgerVersionArg;
69
86
  }): Promise<Groth16VerificationKeyResponse> {
@@ -86,14 +103,14 @@ export async function getPepper(args: {
86
103
  uidKey?: string;
87
104
  derivationPath?: string;
88
105
  }): Promise<Uint8Array> {
89
- const { aptosConfig, jwt, ephemeralKeyPair, uidKey, derivationPath } = args;
106
+ const { aptosConfig, jwt, ephemeralKeyPair, uidKey = "sub", derivationPath } = args;
90
107
 
91
108
  const body = {
92
109
  jwt_b64: jwt,
93
110
  epk: ephemeralKeyPair.getPublicKey().bcsToHex().toStringWithoutPrefix(),
94
111
  exp_date_secs: ephemeralKeyPair.expiryDateSecs,
95
112
  epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),
96
- uid_key: uidKey || "sub",
113
+ uid_key: uidKey,
97
114
  derivation_path: derivationPath,
98
115
  };
99
116
  const { data } = await postAptosPepperService<PepperFetchRequest, PepperFetchResponse>({
@@ -113,15 +130,16 @@ export async function getProof(args: {
113
130
  pepper: HexInput;
114
131
  uidKey?: string;
115
132
  }): Promise<ZeroKnowledgeSig> {
116
- const { aptosConfig, jwt, ephemeralKeyPair, pepper, uidKey } = args;
133
+ const { aptosConfig, jwt, ephemeralKeyPair, pepper, uidKey = "sub" } = args;
134
+ const { maxExpHorizonSecs } = await getKeylessConfig({ aptosConfig });
117
135
  const json = {
118
136
  jwt_b64: jwt,
119
137
  epk: ephemeralKeyPair.getPublicKey().bcsToHex().toStringWithoutPrefix(),
120
138
  epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),
121
139
  exp_date_secs: ephemeralKeyPair.expiryDateSecs,
122
- exp_horizon_secs: EPK_HORIZON_SECS,
140
+ exp_horizon_secs: maxExpHorizonSecs,
123
141
  pepper: Hex.fromHexInput(pepper).toStringWithoutPrefix(),
124
- uid_key: uidKey || "sub",
142
+ uid_key: uidKey,
125
143
  };
126
144
 
127
145
  const { data } = await postAptosProvingService<ProverRequest, ProverResponse>({
@@ -142,6 +160,7 @@ export async function getProof(args: {
142
160
  const signedProof = new ZeroKnowledgeSig({
143
161
  proof: new ZkProof(groth16Zkp, ZkpVariant.Groth16),
144
162
  trainingWheelsSignature: EphemeralSignature.fromHex(data.training_wheels_signature),
163
+ expHorizonSecs: maxExpHorizonSecs,
145
164
  });
146
165
  return signedProof;
147
166
  }
@@ -169,7 +188,7 @@ export async function deriveKeylessAccount(args: {
169
188
  const proofPromise = getProof({ ...args, pepper });
170
189
  const proof = proofFetchCallback ? proofPromise : await proofPromise;
171
190
 
172
- const keylessAccount = KeylessAccount.fromJWTAndProof({ ...args, proof, pepper, proofFetchCallback });
191
+ const keylessAccount = KeylessAccount.create({ ...args, proof, pepper, proofFetchCallback });
173
192
 
174
193
  return keylessAccount;
175
194
  }
@@ -19,6 +19,7 @@ import {
19
19
  type TransactionResponse,
20
20
  WaitForTransactionOptions,
21
21
  CommittedTransactionResponse,
22
+ Block,
22
23
  } from "../types";
23
24
  import { DEFAULT_TXN_TIMEOUT_SEC, ProcessorType } from "../utils/const";
24
25
  import { sleep } from "../utils/helpers";
@@ -279,3 +280,94 @@ export class FailedTransactionError extends Error {
279
280
  this.transaction = transaction;
280
281
  }
281
282
  }
283
+
284
+ export async function getBlockByVersion(args: {
285
+ aptosConfig: AptosConfig;
286
+ ledgerVersion: AnyNumber;
287
+ options?: { withTransactions?: boolean };
288
+ }): Promise<Block> {
289
+ const { aptosConfig, ledgerVersion, options } = args;
290
+ const { data: block } = await getAptosFullNode<{}, Block>({
291
+ aptosConfig,
292
+ originMethod: "getBlockByVersion",
293
+ path: `blocks/by_version/${ledgerVersion}`,
294
+ params: { with_transactions: options?.withTransactions },
295
+ });
296
+
297
+ return fillBlockTransactions({ block, ...args });
298
+ }
299
+
300
+ export async function getBlockByHeight(args: {
301
+ aptosConfig: AptosConfig;
302
+ blockHeight: AnyNumber;
303
+ options?: { withTransactions?: boolean };
304
+ }): Promise<Block> {
305
+ const { aptosConfig, blockHeight, options } = args;
306
+ const { data: block } = await getAptosFullNode<{}, Block>({
307
+ aptosConfig,
308
+ originMethod: "getBlockByHeight",
309
+ path: `blocks/by_height/${blockHeight}`,
310
+ params: { with_transactions: options?.withTransactions },
311
+ });
312
+ return fillBlockTransactions({ block, ...args });
313
+ }
314
+
315
+ /**
316
+ * Fills in the block with transactions if not enough were returned
317
+ * @param args
318
+ */
319
+ async function fillBlockTransactions(args: {
320
+ aptosConfig: AptosConfig;
321
+ block: Block;
322
+ options?: { withTransactions?: boolean };
323
+ }) {
324
+ const { aptosConfig, block, options } = args;
325
+ if (options?.withTransactions) {
326
+ // Transactions should be filled, but this ensures it
327
+ block.transactions = block.transactions ?? [];
328
+
329
+ const lastTxn = block.transactions[block.transactions.length - 1];
330
+ const firstVersion = BigInt(block.first_version);
331
+ const lastVersion = BigInt(block.last_version);
332
+
333
+ // Convert the transaction to the type
334
+ const curVersion: string | undefined = (lastTxn as any)?.version;
335
+ let latestVersion;
336
+
337
+ // This time, if we don't have any transactions, we will try once with the start of the block
338
+ if (curVersion === undefined) {
339
+ latestVersion = firstVersion - 1n;
340
+ } else {
341
+ latestVersion = BigInt(curVersion);
342
+ }
343
+
344
+ // If we have all the transactions in the block, we can skip out, otherwise we need to fill the transactions
345
+ if (latestVersion === lastVersion) {
346
+ return block;
347
+ }
348
+
349
+ // For now, we will grab all the transactions in groups of 100, but we can make this more efficient by trying larger
350
+ // amounts
351
+ const fetchFutures = [];
352
+ const pageSize = 100n;
353
+ for (let i = latestVersion + 1n; i < lastVersion; i += BigInt(100)) {
354
+ fetchFutures.push(
355
+ getTransactions({
356
+ aptosConfig,
357
+ options: {
358
+ offset: i,
359
+ limit: Math.min(Number(pageSize), Number(lastVersion - i + 1n)),
360
+ },
361
+ }),
362
+ );
363
+ }
364
+
365
+ // Combine all the futures
366
+ const responses = await Promise.all(fetchFutures);
367
+ for (const txns of responses) {
368
+ block.transactions.push(...txns);
369
+ }
370
+ }
371
+
372
+ return block;
373
+ }
@@ -7,8 +7,8 @@
7
7
 
8
8
  import { AptosConfig } from "../api/aptosConfig";
9
9
  import { MoveVector, U8 } from "../bcs";
10
- import { AptosApiError, postAptosFullNode } from "../client";
11
- import { Account, KeylessAccount, KeylessError, MultiKeyAccount } from "../account";
10
+ import { postAptosFullNode } from "../client";
11
+ import { Account, KeylessAccount, 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";
@@ -1,11 +1,11 @@
1
1
  export type ProverRequest = {
2
- jwt_b64: string,
3
- epk: string,
4
- exp_date_secs: number,
5
- exp_horizon_secs: number,
6
- epk_blinder: string,
7
- uid_key: string,
8
- pepper: string,
2
+ jwt_b64: string;
3
+ epk: string;
4
+ exp_date_secs: number;
5
+ exp_horizon_secs: number;
6
+ epk_blinder: string;
7
+ uid_key: string;
8
+ pepper: string;
9
9
  };
10
10
  export type ProverResponse = {
11
11
  proof: { a: string; b: string; c: string };
@@ -13,25 +13,25 @@ export type ProverResponse = {
13
13
  training_wheels_signature: string;
14
14
  };
15
15
  export type PepperFetchRequest = {
16
- jwt_b64: number,
17
- epk: string,
18
- exp_date_secs: number,
19
- epk_blinder: string,
20
- uid_key: string,
21
- derivation_path: string,
16
+ jwt_b64: number;
17
+ epk: string;
18
+ exp_date_secs: number;
19
+ epk_blinder: string;
20
+ uid_key: string;
21
+ derivation_path: string;
22
22
  };
23
23
  export type PepperFetchResponse = { signature: string; pepper: string; address: string };
24
24
 
25
25
  export type KeylessConfigurationResponse = {
26
- max_commited_epk_bytes: number,
27
- max_exp_horizon_secs: string,
28
- max_extra_field_bytes: number,
29
- max_iss_val_bytes: number,
30
- max_jwt_header_b64_bytes: number,
31
- max_signatures_per_txn: number,
32
- override_aud_vals: string[],
33
- training_wheels_pubkey: { vec: string[] }
34
- }
26
+ max_commited_epk_bytes: number;
27
+ max_exp_horizon_secs: string;
28
+ max_extra_field_bytes: number;
29
+ max_iss_val_bytes: number;
30
+ max_jwt_header_b64_bytes: number;
31
+ max_signatures_per_txn: number;
32
+ override_aud_vals: string[];
33
+ training_wheels_pubkey: { vec: string[] };
34
+ };
35
35
 
36
36
  export type Groth16VerificationKeyResponse = {
37
37
  alpha_g1: string;
@@ -13,7 +13,6 @@ export async function sleep(timeMs: number): Promise<null> {
13
13
  });
14
14
  }
15
15
 
16
-
17
16
  export function currentTimeInSeconds(): number {
18
17
  return Math.floor(new Date().getTime() / 1000);
19
18
  }
@@ -27,6 +26,12 @@ export function floorToWholeHour(timestampInSeconds: number): number {
27
26
  return Math.floor(date.getTime() / 1000);
28
27
  }
29
28
 
29
+ export function ceilingToWholeHour(timestampInSeconds: number): number {
30
+ const date = new Date(timestampInSeconds * 1000);
31
+ date.setHours(date.getHours() + 1);
32
+ return floorToWholeHour(date.getTime() / 1000)
33
+ }
34
+
30
35
  export function base64UrlDecode(base64Url: string): string {
31
36
  // Replace base64url-specific characters
32
37
  const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
package/src/version.ts CHANGED
@@ -6,4 +6,4 @@
6
6
  *
7
7
  * hardcoded for now, we would want to have it injected dynamically
8
8
  */
9
- export const VERSION = "1.16.0-zeta.1";
9
+ export const VERSION = "1.16.0-zeta.3";
@@ -1,2 +0,0 @@
1
- import{a as g,f as d,g as b,i as S}from"./chunk-RAHMGSBW.mjs";import{a as C}from"./chunk-3J53BCEQ.mjs";import{b as f}from"./chunk-WSVJNBSJ.mjs";import{a as P}from"./chunk-PG7KSUMN.mjs";import{a as w}from"./chunk-SSDWEOF7.mjs";import{d as I}from"./chunk-MEOBWD6V.mjs";import{c as l}from"./chunk-OZ3GSAFK.mjs";import{c as y,m as s}from"./chunk-VBODXPT3.mjs";import{a as T}from"./chunk-XQ7I34AL.mjs";import{b as p}from"./chunk-WHSN42R2.mjs";import{a as r}from"./chunk-GS5Z3HO7.mjs";import{b as A}from"./chunk-ZV5P2GSJ.mjs";async function h(t){let a=await K(t);return D(t,a)}async function K(t){let{aptosConfig:a,data:n}=t,e,o;return"bytecode"in n?o=await g(n):"multisigAddress"in n?(e={aptosConfig:a,multisigAddress:n.multisigAddress,function:n.function,functionArguments:n.functionArguments,typeArguments:n.typeArguments,abi:n.abi},o=await g(e)):(e={aptosConfig:a,function:n.function,functionArguments:n.functionArguments,typeArguments:n.typeArguments,abi:n.abi},o=await g(e)),o}async function D(t,a){let{aptosConfig:n,sender:e,options:o}=t,i;if(G(t)&&(i=p.ZERO.toString()),U(t)){let{secondarySignerAddresses:c}=t;return d({aptosConfig:n,sender:e,payload:a,options:o,secondarySignerAddresses:c,feePayerAddress:i})}return d({aptosConfig:n,sender:e,payload:a,options:o,feePayerAddress:i})}function G(t){return t.withFeePayer===!0}function U(t){return"secondarySignerAddresses"in t}function nn(t){let{transaction:a}=t;return l(a)}function _(t){let{signer:a,transaction:n}=t;return a.signTransactionWithAuthenticator(n)}async function tn(t){let{aptosConfig:a,transaction:n,signerPublicKey:e,secondarySignersPublicKeys:o,feePayerPublicKey:i,options:c}=t,u=b({transaction:n,signerPublicKey:e,secondarySignersPublicKeys:o,feePayerPublicKey:i,options:c}),{data:m}=await f({aptosConfig:a,body:u,path:"transactions/simulate",params:{estimate_gas_unit_price:t.options?.estimateGasUnitPrice??!1,estimate_max_gas_amount:t.options?.estimateMaxGasAmount??!1,estimate_prioritized_gas_unit_price:t.options?.estimatePrioritizedGasUnitPrice??!1},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return m}async function B(t){let{aptosConfig:a}=t,n=S({...t}),{data:e}=await f({aptosConfig:a,body:n,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return e}async function M(t){let{aptosConfig:a,signer:n,transaction:e}=t;(n instanceof I||n instanceof w)&&await n.waitForProofFetch();let o=_({signer:n,transaction:e});return B({aptosConfig:a,transaction:e,senderAuthenticator:o})}var N={typeParameters:[],parameters:[s.u8(),new s(s.u8())]};async function an(t){let{aptosConfig:a,account:n,metadataBytes:e,moduleBytecode:o,options:i}=t,c=o.map(u=>r.U8(u));return h({aptosConfig:a,sender:p.from(n),data:{function:"0x1::code::publish_package_txn",functionArguments:[r.U8(e),new r(c)],abi:N},options:i})}var F={typeParameters:[],parameters:[new y,s.u8(),new y,s.u8(),s.u8(),s.u8()]};async function en(t){let{aptosConfig:a,fromAccount:n,toNewPrivateKey:e}=t,o=await C({aptosConfig:a,accountAddress:n.accountAddress}),i=P.fromPrivateKey({privateKey:e,legacy:!0}),u=new T({sequenceNumber:BigInt(o.sequence_number),originator:n.accountAddress,currentAuthKey:p.from(o.authentication_key),newPublicKey:i.publicKey}).bcsToBytes(),m=n.sign(u),R=i.sign(u),x=await h({aptosConfig:a,sender:n.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new A(n.signingScheme),r.U8(n.publicKey.toUint8Array()),new A(i.signingScheme),r.U8(i.publicKey.toUint8Array()),r.U8(m.toUint8Array()),r.U8(R.toUint8Array())],abi:F}});return M({aptosConfig:a,signer:n,transaction:x})}export{h as a,K as b,D as c,nn as d,_ as e,tn as f,B as g,M as h,an as i,en as j};
2
- //# sourceMappingURL=chunk-4RXGVY2H.mjs.map