@aptos-labs/ts-sdk 1.17.0 → 1.18.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 (425) hide show
  1. package/dist/common/{accountAddress-ccLvlUQe.d.ts → accountAddress-Lv-GSihU.d.ts} +107 -13
  2. package/dist/common/chunk-BHKSQXUZ.js +2 -0
  3. package/dist/common/chunk-BHKSQXUZ.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 +808 -117
  8. package/dist/common/index.js +30 -28
  9. package/dist/common/index.js.map +1 -1
  10. package/dist/esm/account/Account.mjs +1 -1
  11. package/dist/esm/account/Ed25519Account.mjs +1 -1
  12. package/dist/esm/account/EphemeralKeyPair.d.mts +85 -0
  13. package/dist/esm/account/EphemeralKeyPair.mjs +2 -0
  14. package/dist/esm/account/KeylessAccount.d.mts +175 -0
  15. package/dist/esm/account/KeylessAccount.mjs +2 -0
  16. package/dist/esm/account/MultiKeyAccount.d.mts +11 -5
  17. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  18. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  19. package/dist/esm/account/index.d.mts +6 -0
  20. package/dist/esm/account/index.mjs +1 -1
  21. package/dist/esm/api/account.d.mts +2 -2
  22. package/dist/esm/api/account.mjs +1 -1
  23. package/dist/esm/api/ans.d.mts +2 -2
  24. package/dist/esm/api/ans.mjs +1 -1
  25. package/dist/esm/api/aptos.d.mts +9 -1
  26. package/dist/esm/api/aptos.mjs +1 -1
  27. package/dist/esm/api/aptosConfig.d.mts +20 -0
  28. package/dist/esm/api/aptosConfig.mjs +1 -1
  29. package/dist/esm/api/coin.d.mts +2 -2
  30. package/dist/esm/api/coin.mjs +1 -1
  31. package/dist/esm/api/digitalAsset.d.mts +2 -2
  32. package/dist/esm/api/digitalAsset.mjs +1 -1
  33. package/dist/esm/api/event.mjs +1 -1
  34. package/dist/esm/api/faucet.mjs +1 -1
  35. package/dist/esm/api/fungibleAsset.mjs +1 -1
  36. package/dist/esm/api/general.mjs +1 -1
  37. package/dist/esm/api/index.d.mts +7 -0
  38. package/dist/esm/api/index.mjs +1 -1
  39. package/dist/esm/api/keyless.d.mts +104 -0
  40. package/dist/esm/api/keyless.mjs +2 -0
  41. package/dist/esm/api/keyless.mjs.map +1 -0
  42. package/dist/esm/api/staking.mjs +1 -1
  43. package/dist/esm/api/table.mjs +1 -1
  44. package/dist/esm/api/transaction.mjs +1 -1
  45. package/dist/esm/api/transactionSubmission/build.d.mts +2 -2
  46. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  47. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  48. package/dist/esm/api/transactionSubmission/sign.d.mts +2 -2
  49. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  50. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  51. package/dist/esm/api/transactionSubmission/simulate.d.mts +2 -2
  52. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  53. package/dist/esm/api/transactionSubmission/submit.d.mts +2 -2
  54. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  55. package/dist/esm/api/utils.mjs +1 -1
  56. package/dist/esm/bcs/deserializer.d.mts +32 -0
  57. package/dist/esm/bcs/deserializer.mjs +1 -1
  58. package/dist/esm/bcs/index.mjs +1 -1
  59. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  60. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  61. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  62. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  63. package/dist/esm/bcs/serializer.d.mts +42 -0
  64. package/dist/esm/bcs/serializer.mjs +1 -1
  65. package/dist/esm/{chunk-TQLED4KC.mjs → chunk-2DSPX6BX.mjs} +2 -2
  66. package/dist/esm/chunk-2QWQ6RX5.mjs +2 -0
  67. package/dist/esm/chunk-2QWQ6RX5.mjs.map +1 -0
  68. package/dist/esm/chunk-362JBD4O.mjs +2 -0
  69. package/dist/esm/{chunk-SUAMDMAA.mjs.map → chunk-362JBD4O.mjs.map} +1 -1
  70. package/dist/esm/{chunk-RWXHA4QZ.mjs → chunk-3VUSIKCF.mjs} +2 -2
  71. package/dist/esm/chunk-3ZCQQ3L2.mjs +2 -0
  72. package/dist/esm/chunk-3ZCQQ3L2.mjs.map +1 -0
  73. package/dist/esm/chunk-42SZQH5Z.mjs +2 -0
  74. package/dist/esm/chunk-42SZQH5Z.mjs.map +1 -0
  75. package/dist/esm/{chunk-MCRRHBFQ.mjs → chunk-4EPLOSKY.mjs} +2 -2
  76. package/dist/esm/{chunk-BSVNV6SJ.mjs → chunk-4IBJW3PB.mjs} +2 -2
  77. package/dist/esm/{chunk-J6HKAEKY.mjs → chunk-5X2BJDOB.mjs} +2 -2
  78. package/dist/esm/{chunk-5UKBTF7N.mjs → chunk-5YHI7WOB.mjs} +2 -2
  79. package/dist/esm/{chunk-J5I4OZAS.mjs → chunk-6DYDZSEW.mjs} +2 -2
  80. package/dist/esm/{chunk-J4Z6XR5D.mjs → chunk-6JL2U7JB.mjs} +2 -2
  81. package/dist/esm/{chunk-RNL5TAQT.mjs → chunk-6UDHM6YZ.mjs} +2 -2
  82. package/dist/esm/{chunk-2X7A4HUS.mjs → chunk-6ZQWPHLV.mjs} +2 -2
  83. package/dist/esm/{chunk-4NHWV5AI.mjs → chunk-76OH2Z4Q.mjs} +2 -2
  84. package/dist/esm/{chunk-5EN52MUT.mjs → chunk-77NXCSLY.mjs} +2 -2
  85. package/dist/esm/{chunk-ND6OMSQU.mjs → chunk-7Y45UTRL.mjs} +2 -2
  86. package/dist/esm/chunk-7Z6DYLCA.mjs +1 -0
  87. package/dist/esm/chunk-7Z6DYLCA.mjs.map +1 -0
  88. package/dist/esm/{chunk-T2AGN5YT.mjs → chunk-A2Z7I2EY.mjs} +2 -2
  89. package/dist/esm/{chunk-36QXVFR5.mjs → chunk-A63SMUOU.mjs} +2 -2
  90. package/dist/esm/{chunk-36QXVFR5.mjs.map → chunk-A63SMUOU.mjs.map} +1 -1
  91. package/dist/esm/chunk-AQ4I7VVB.mjs +1 -0
  92. package/dist/esm/chunk-AQ4I7VVB.mjs.map +1 -0
  93. package/dist/esm/{chunk-3XFID2N4.mjs → chunk-AVH5SYTL.mjs} +2 -2
  94. package/dist/esm/{chunk-3N6N3KOS.mjs → chunk-AYKZA676.mjs} +2 -2
  95. package/dist/esm/{chunk-QRS4DGP3.mjs → chunk-BF46IXHH.mjs} +2 -2
  96. package/dist/esm/chunk-BLVYB7Y3.mjs +2 -0
  97. package/dist/esm/chunk-BLVYB7Y3.mjs.map +1 -0
  98. package/dist/esm/{chunk-PF57EOJY.mjs → chunk-BOYYQAB4.mjs} +2 -2
  99. package/dist/esm/{chunk-RPND23OR.mjs → chunk-BS7EVBWX.mjs} +2 -2
  100. package/dist/esm/{chunk-JX75UKJX.mjs → chunk-BVB3QII3.mjs} +2 -2
  101. package/dist/esm/{chunk-KZZWY4YI.mjs → chunk-C5V4EBVP.mjs} +2 -2
  102. package/dist/esm/{chunk-3BNA74V5.mjs → chunk-CZ6TC4GO.mjs} +2 -2
  103. package/dist/esm/{chunk-2HF2XEHO.mjs → chunk-DLDGUTFV.mjs} +2 -2
  104. package/dist/esm/{chunk-YR7JRJ25.mjs → chunk-DPO352QL.mjs} +2 -2
  105. package/dist/esm/{chunk-GM56MMNJ.mjs → chunk-DW2KZREM.mjs} +2 -2
  106. package/dist/esm/chunk-DZXM2MQY.mjs +2 -0
  107. package/dist/esm/chunk-DZXM2MQY.mjs.map +1 -0
  108. package/dist/esm/{chunk-6YV3366Z.mjs → chunk-EAW6AWYD.mjs} +2 -2
  109. package/dist/esm/{chunk-NUK6JT5I.mjs → chunk-EYIJYUN7.mjs} +2 -2
  110. package/dist/esm/{chunk-AF5WNJOP.mjs → chunk-F74FF323.mjs} +2 -2
  111. package/dist/esm/chunk-FM6ALU5B.mjs +2 -0
  112. package/dist/esm/chunk-FM6ALU5B.mjs.map +1 -0
  113. package/dist/esm/{chunk-ISIUQQMV.mjs → chunk-FNFQA7NS.mjs} +2 -2
  114. package/dist/esm/chunk-FTIW5GGG.mjs +2 -0
  115. package/dist/esm/{chunk-BRVWHCP3.mjs.map → chunk-FTIW5GGG.mjs.map} +1 -1
  116. package/dist/esm/{chunk-G2XVNF2T.mjs → chunk-FYB7C42X.mjs} +2 -2
  117. package/dist/esm/chunk-GFRNBBTY.mjs +2 -0
  118. package/dist/esm/chunk-GFRNBBTY.mjs.map +1 -0
  119. package/dist/esm/{chunk-CEHCDA3G.mjs → chunk-H6YNXJNF.mjs} +2 -2
  120. package/dist/esm/{chunk-47IIBESV.mjs → chunk-HCN7YJGB.mjs} +2 -2
  121. package/dist/esm/chunk-HHE63GFW.mjs +2 -0
  122. package/dist/esm/chunk-HHE63GFW.mjs.map +1 -0
  123. package/dist/esm/{chunk-S3EDNXZE.mjs → chunk-HIHKTLLM.mjs} +20 -18
  124. package/dist/esm/chunk-HIHKTLLM.mjs.map +1 -0
  125. package/dist/esm/chunk-IVVWQKCF.mjs +2 -0
  126. package/dist/esm/chunk-IVVWQKCF.mjs.map +1 -0
  127. package/dist/esm/{chunk-53INTTOI.mjs → chunk-JPDT6E3B.mjs} +2 -2
  128. package/dist/esm/{chunk-J4VNDDKJ.mjs → chunk-JSWBLHMX.mjs} +2 -2
  129. package/dist/esm/{chunk-73QJNN7O.mjs → chunk-K4CTCBLY.mjs} +2 -2
  130. package/dist/esm/{chunk-AQAH67IV.mjs → chunk-K7DBDI2I.mjs} +2 -2
  131. package/dist/esm/{chunk-PIVZMT5D.mjs → chunk-L22R3OIW.mjs} +2 -2
  132. package/dist/esm/{chunk-4GWNWSZP.mjs → chunk-LVSOUCFD.mjs} +2 -2
  133. package/dist/esm/{chunk-AHW3SKT7.mjs → chunk-M3JHXCGV.mjs} +2 -2
  134. package/dist/esm/{chunk-ZRKXS7XG.mjs → chunk-MHZ64FIW.mjs} +2 -2
  135. package/dist/esm/{chunk-UGPALAPN.mjs → chunk-MLDQ2TY2.mjs} +2 -2
  136. package/dist/esm/chunk-MQGW234H.mjs +2 -0
  137. package/dist/esm/chunk-MQGW234H.mjs.map +1 -0
  138. package/dist/esm/chunk-NCUBVHUW.mjs +2 -0
  139. package/dist/esm/chunk-NCUBVHUW.mjs.map +1 -0
  140. package/dist/esm/chunk-NMD45OTM.mjs +2 -0
  141. package/dist/esm/chunk-NMD45OTM.mjs.map +1 -0
  142. package/dist/esm/{chunk-R5VVKRJ2.mjs → chunk-NNQYSSLH.mjs} +2 -2
  143. package/dist/esm/{chunk-CZOD4SCZ.mjs → chunk-NSQLZBCA.mjs} +2 -2
  144. package/dist/esm/{chunk-KAGLWBIJ.mjs → chunk-OPGMT27G.mjs} +2 -2
  145. package/dist/esm/{chunk-N3U47Y6Y.mjs → chunk-P5V7OZNN.mjs} +2 -2
  146. package/dist/esm/{chunk-337U6Q6K.mjs → chunk-PTA3VHTQ.mjs} +2 -2
  147. package/dist/esm/chunk-Q6LFIZ3L.mjs +2 -0
  148. package/dist/esm/chunk-Q6LFIZ3L.mjs.map +1 -0
  149. package/dist/esm/chunk-QAMV4L3K.mjs +2 -0
  150. package/dist/esm/chunk-QAMV4L3K.mjs.map +1 -0
  151. package/dist/esm/{chunk-BEVXJJJF.mjs → chunk-QL2QFRKV.mjs} +2 -2
  152. package/dist/esm/chunk-QVWBJJRF.mjs +2 -0
  153. package/dist/esm/chunk-QVWBJJRF.mjs.map +1 -0
  154. package/dist/esm/{chunk-U3YYSIIT.mjs → chunk-RFA7BIDN.mjs} +2 -2
  155. package/dist/esm/{chunk-G56GPLTB.mjs → chunk-RJ4RKVVQ.mjs} +2 -2
  156. package/dist/esm/{chunk-BBVIJO6X.mjs → chunk-S32JHML7.mjs} +2 -2
  157. package/dist/esm/chunk-SCHZ67F3.mjs +2 -0
  158. package/dist/esm/chunk-SCHZ67F3.mjs.map +1 -0
  159. package/dist/esm/chunk-SFUTXSDK.mjs +2 -0
  160. package/dist/esm/chunk-SFUTXSDK.mjs.map +1 -0
  161. package/dist/esm/{chunk-3SPIFLBZ.mjs → chunk-SLFAROVZ.mjs} +2 -2
  162. package/dist/esm/{chunk-CT2BQQTZ.mjs → chunk-TG2LLWVU.mjs} +2 -2
  163. package/dist/esm/{chunk-35EWRSDK.mjs → chunk-TY4IEDJD.mjs} +2 -2
  164. package/dist/esm/chunk-U4A56FN2.mjs +2 -0
  165. package/dist/esm/{chunk-7UBKXR37.mjs.map → chunk-U4A56FN2.mjs.map} +1 -1
  166. package/dist/esm/chunk-U6X2FYNI.mjs +2 -0
  167. package/dist/esm/chunk-U6X2FYNI.mjs.map +1 -0
  168. package/dist/esm/{chunk-G2UPF44Z.mjs → chunk-UAZUO75M.mjs} +2 -2
  169. package/dist/esm/{chunk-HLC4HAYY.mjs → chunk-UGVNOSD3.mjs} +2 -2
  170. package/dist/esm/{chunk-LGNSPATO.mjs → chunk-VCMP3MXN.mjs} +2 -2
  171. package/dist/esm/{chunk-PZ4SAXY7.mjs → chunk-VTKPSYKA.mjs} +2 -2
  172. package/dist/esm/chunk-VTKPSYKA.mjs.map +1 -0
  173. package/dist/esm/chunk-WQHW4WQN.mjs +2 -0
  174. package/dist/esm/chunk-WQHW4WQN.mjs.map +1 -0
  175. package/dist/esm/chunk-WV5AD4IE.mjs +2 -0
  176. package/dist/esm/{chunk-CE65OKFI.mjs → chunk-XWVU4G57.mjs} +2 -2
  177. package/dist/esm/{chunk-ZHCSSCC5.mjs → chunk-XYLM277Z.mjs} +2 -2
  178. package/dist/esm/chunk-YE5B2S5L.mjs +2 -0
  179. package/dist/esm/chunk-YE5B2S5L.mjs.map +1 -0
  180. package/dist/esm/{chunk-FAFJKSVZ.mjs → chunk-YMUCYX3B.mjs} +2 -2
  181. package/dist/esm/{chunk-SRDIYE3M.mjs → chunk-YPHH6CAO.mjs} +2 -2
  182. package/dist/esm/chunk-YTQVMLFD.mjs +2 -0
  183. package/dist/esm/chunk-YTQVMLFD.mjs.map +1 -0
  184. package/dist/esm/{chunk-B7X6PSE7.mjs → chunk-YUNDX5I7.mjs} +2 -2
  185. package/dist/esm/chunk-Z4YHE4A5.mjs +2 -0
  186. package/dist/esm/{chunk-4BJA3QUQ.mjs.map → chunk-Z4YHE4A5.mjs.map} +1 -1
  187. package/dist/esm/cli/index.mjs +1 -1
  188. package/dist/esm/cli/localNode.mjs +1 -1
  189. package/dist/esm/cli/move.mjs +1 -1
  190. package/dist/esm/client/core.mjs +1 -1
  191. package/dist/esm/client/get.d.mts +8 -1
  192. package/dist/esm/client/get.mjs +1 -1
  193. package/dist/esm/client/index.d.mts +2 -2
  194. package/dist/esm/client/index.mjs +1 -1
  195. package/dist/esm/client/post.d.mts +9 -1
  196. package/dist/esm/client/post.mjs +1 -1
  197. package/dist/esm/core/account/index.mjs +1 -1
  198. package/dist/esm/core/account/utils/address.mjs +1 -1
  199. package/dist/esm/core/account/utils/index.mjs +1 -1
  200. package/dist/esm/core/accountAddress.mjs +1 -1
  201. package/dist/esm/core/authenticationKey.mjs +1 -1
  202. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  203. package/dist/esm/core/crypto/ephemeral.d.mts +73 -0
  204. package/dist/esm/core/crypto/ephemeral.mjs +2 -0
  205. package/dist/esm/core/crypto/ephemeral.mjs.map +1 -0
  206. package/dist/esm/core/crypto/index.d.mts +6 -0
  207. package/dist/esm/core/crypto/index.mjs +1 -1
  208. package/dist/esm/core/crypto/keyless.d.mts +321 -0
  209. package/dist/esm/core/crypto/keyless.mjs +2 -0
  210. package/dist/esm/core/crypto/keyless.mjs.map +1 -0
  211. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  212. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  213. package/dist/esm/core/crypto/poseidon.d.mts +19 -0
  214. package/dist/esm/core/crypto/poseidon.mjs +2 -0
  215. package/dist/esm/core/crypto/poseidon.mjs.map +1 -0
  216. package/dist/esm/core/crypto/proof.d.mts +21 -0
  217. package/dist/esm/core/crypto/proof.mjs +2 -0
  218. package/dist/esm/core/crypto/proof.mjs.map +1 -0
  219. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  220. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  221. package/dist/esm/core/crypto/signature.mjs +1 -1
  222. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  223. package/dist/esm/core/index.d.mts +6 -0
  224. package/dist/esm/core/index.mjs +1 -1
  225. package/dist/esm/index.d.mts +11 -4
  226. package/dist/esm/index.mjs +1 -1
  227. package/dist/esm/internal/account.mjs +1 -1
  228. package/dist/esm/internal/ans.mjs +1 -1
  229. package/dist/esm/internal/coin.mjs +1 -1
  230. package/dist/esm/internal/digitalAsset.mjs +1 -1
  231. package/dist/esm/internal/event.mjs +1 -1
  232. package/dist/esm/internal/faucet.mjs +1 -1
  233. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  234. package/dist/esm/internal/general.mjs +1 -1
  235. package/dist/esm/internal/keyless.d.mts +72 -0
  236. package/dist/esm/internal/keyless.mjs +2 -0
  237. package/dist/esm/internal/keyless.mjs.map +1 -0
  238. package/dist/esm/internal/staking.mjs +1 -1
  239. package/dist/esm/internal/table.mjs +1 -1
  240. package/dist/esm/internal/transaction.mjs +1 -1
  241. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  242. package/dist/esm/internal/view.mjs +1 -1
  243. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  244. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  245. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  246. package/dist/esm/transactions/index.mjs +1 -1
  247. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  248. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  249. package/dist/esm/transactions/instances/index.mjs +1 -1
  250. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  251. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  252. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  253. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  254. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  255. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  256. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  257. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  258. package/dist/esm/transactions/management/index.mjs +1 -1
  259. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  260. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  261. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  262. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  263. package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +3 -0
  264. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  265. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  266. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  267. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  268. package/dist/esm/types/generated/operations.d.mts +14 -12
  269. package/dist/esm/types/generated/queries.d.mts +4 -4
  270. package/dist/esm/types/generated/queries.mjs +1 -1
  271. package/dist/esm/types/generated/types.d.mts +20 -2
  272. package/dist/esm/types/generated/types.mjs +1 -1
  273. package/dist/esm/types/generated/types.mjs.map +1 -1
  274. package/dist/esm/types/index.d.mts +21 -5
  275. package/dist/esm/types/index.mjs +1 -1
  276. package/dist/esm/types/keyless.d.mts +51 -0
  277. package/dist/esm/types/keyless.mjs +1 -0
  278. package/dist/esm/types/keyless.mjs.map +1 -0
  279. package/dist/esm/utils/apiEndpoints.d.mts +3 -1
  280. package/dist/esm/utils/apiEndpoints.mjs +1 -1
  281. package/dist/esm/utils/const.d.mts +3 -1
  282. package/dist/esm/utils/const.mjs +1 -1
  283. package/dist/esm/utils/helpers.d.mts +4 -1
  284. package/dist/esm/utils/helpers.mjs +1 -1
  285. package/dist/esm/utils/index.d.mts +1 -1
  286. package/dist/esm/utils/index.mjs +1 -1
  287. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  288. package/dist/esm/version.d.mts +1 -1
  289. package/dist/esm/version.mjs +1 -1
  290. package/package.json +9 -3
  291. package/src/account/EphemeralKeyPair.ts +150 -0
  292. package/src/account/KeylessAccount.ts +370 -0
  293. package/src/account/MultiKeyAccount.ts +12 -0
  294. package/src/account/index.ts +2 -0
  295. package/src/api/aptos.ts +6 -0
  296. package/src/api/aptosConfig.ts +46 -1
  297. package/src/api/keyless.ts +78 -0
  298. package/src/bcs/deserializer.ts +40 -0
  299. package/src/bcs/serializer.ts +57 -0
  300. package/src/cli/move.ts +4 -7
  301. package/src/client/core.ts +4 -0
  302. package/src/client/get.ts +12 -0
  303. package/src/client/post.ts +18 -0
  304. package/src/core/crypto/ephemeral.ts +138 -0
  305. package/src/core/crypto/index.ts +2 -0
  306. package/src/core/crypto/keyless.ts +679 -0
  307. package/src/core/crypto/poseidon.ts +144 -0
  308. package/src/core/crypto/proof.ts +16 -0
  309. package/src/core/crypto/singleKey.ts +11 -0
  310. package/src/internal/keyless.ts +129 -0
  311. package/src/internal/queries/getFungibleAssetMetadata.graphql +2 -0
  312. package/src/internal/transactionSubmission.ts +6 -1
  313. package/src/transactions/management/accountSequenceNumber.ts +5 -8
  314. package/src/transactions/transactionBuilder/signingMessage.ts +3 -0
  315. package/src/transactions/transactionBuilder/transactionBuilder.ts +16 -1
  316. package/src/types/generated/operations.ts +14 -12
  317. package/src/types/generated/queries.ts +30 -3
  318. package/src/types/generated/types.ts +20 -2
  319. package/src/types/index.ts +24 -2
  320. package/src/types/keyless.ts +42 -0
  321. package/src/utils/apiEndpoints.ts +16 -0
  322. package/src/utils/const.ts +2 -0
  323. package/src/utils/helpers.ts +22 -0
  324. package/src/version.ts +1 -1
  325. package/dist/common/chunk-KSEUZTKY.js +0 -2
  326. package/dist/common/chunk-KSEUZTKY.js.map +0 -1
  327. package/dist/esm/chunk-3JPVQHOR.mjs +0 -2
  328. package/dist/esm/chunk-3JPVQHOR.mjs.map +0 -1
  329. package/dist/esm/chunk-4BJA3QUQ.mjs +0 -2
  330. package/dist/esm/chunk-6IFMQ5AS.mjs +0 -2
  331. package/dist/esm/chunk-6IFMQ5AS.mjs.map +0 -1
  332. package/dist/esm/chunk-746MU2AB.mjs +0 -2
  333. package/dist/esm/chunk-746MU2AB.mjs.map +0 -1
  334. package/dist/esm/chunk-7UBKXR37.mjs +0 -2
  335. package/dist/esm/chunk-BRVWHCP3.mjs +0 -2
  336. package/dist/esm/chunk-CYNQRMO5.mjs +0 -2
  337. package/dist/esm/chunk-CYNQRMO5.mjs.map +0 -1
  338. package/dist/esm/chunk-D2LNQMKD.mjs +0 -2
  339. package/dist/esm/chunk-D2LNQMKD.mjs.map +0 -1
  340. package/dist/esm/chunk-DLAIJ2UM.mjs +0 -2
  341. package/dist/esm/chunk-DLAIJ2UM.mjs.map +0 -1
  342. package/dist/esm/chunk-HYCGMFC2.mjs +0 -2
  343. package/dist/esm/chunk-HYCGMFC2.mjs.map +0 -1
  344. package/dist/esm/chunk-IENCDVPF.mjs +0 -2
  345. package/dist/esm/chunk-IENCDVPF.mjs.map +0 -1
  346. package/dist/esm/chunk-MM5VMKFE.mjs +0 -2
  347. package/dist/esm/chunk-MM5VMKFE.mjs.map +0 -1
  348. package/dist/esm/chunk-OWW6SIDP.mjs +0 -2
  349. package/dist/esm/chunk-OWW6SIDP.mjs.map +0 -1
  350. package/dist/esm/chunk-PZ4SAXY7.mjs.map +0 -1
  351. package/dist/esm/chunk-ROXFCLDT.mjs +0 -2
  352. package/dist/esm/chunk-RTSWVT2Q.mjs +0 -2
  353. package/dist/esm/chunk-RTSWVT2Q.mjs.map +0 -1
  354. package/dist/esm/chunk-S3EDNXZE.mjs.map +0 -1
  355. package/dist/esm/chunk-SUAMDMAA.mjs +0 -2
  356. package/dist/esm/chunk-UO3NZ5AH.mjs +0 -1
  357. package/dist/esm/chunk-UTKM2WYS.mjs +0 -2
  358. package/dist/esm/chunk-UTKM2WYS.mjs.map +0 -1
  359. package/dist/esm/chunk-UVSRX4SV.mjs +0 -1
  360. package/dist/esm/chunk-W33BZ6IQ.mjs +0 -2
  361. package/dist/esm/chunk-W33BZ6IQ.mjs.map +0 -1
  362. /package/dist/esm/{chunk-UO3NZ5AH.mjs.map → account/EphemeralKeyPair.mjs.map} +0 -0
  363. /package/dist/esm/{chunk-UVSRX4SV.mjs.map → account/KeylessAccount.mjs.map} +0 -0
  364. /package/dist/esm/{chunk-TQLED4KC.mjs.map → chunk-2DSPX6BX.mjs.map} +0 -0
  365. /package/dist/esm/{chunk-RWXHA4QZ.mjs.map → chunk-3VUSIKCF.mjs.map} +0 -0
  366. /package/dist/esm/{chunk-MCRRHBFQ.mjs.map → chunk-4EPLOSKY.mjs.map} +0 -0
  367. /package/dist/esm/{chunk-BSVNV6SJ.mjs.map → chunk-4IBJW3PB.mjs.map} +0 -0
  368. /package/dist/esm/{chunk-J6HKAEKY.mjs.map → chunk-5X2BJDOB.mjs.map} +0 -0
  369. /package/dist/esm/{chunk-5UKBTF7N.mjs.map → chunk-5YHI7WOB.mjs.map} +0 -0
  370. /package/dist/esm/{chunk-J5I4OZAS.mjs.map → chunk-6DYDZSEW.mjs.map} +0 -0
  371. /package/dist/esm/{chunk-J4Z6XR5D.mjs.map → chunk-6JL2U7JB.mjs.map} +0 -0
  372. /package/dist/esm/{chunk-RNL5TAQT.mjs.map → chunk-6UDHM6YZ.mjs.map} +0 -0
  373. /package/dist/esm/{chunk-2X7A4HUS.mjs.map → chunk-6ZQWPHLV.mjs.map} +0 -0
  374. /package/dist/esm/{chunk-4NHWV5AI.mjs.map → chunk-76OH2Z4Q.mjs.map} +0 -0
  375. /package/dist/esm/{chunk-5EN52MUT.mjs.map → chunk-77NXCSLY.mjs.map} +0 -0
  376. /package/dist/esm/{chunk-ND6OMSQU.mjs.map → chunk-7Y45UTRL.mjs.map} +0 -0
  377. /package/dist/esm/{chunk-T2AGN5YT.mjs.map → chunk-A2Z7I2EY.mjs.map} +0 -0
  378. /package/dist/esm/{chunk-3XFID2N4.mjs.map → chunk-AVH5SYTL.mjs.map} +0 -0
  379. /package/dist/esm/{chunk-3N6N3KOS.mjs.map → chunk-AYKZA676.mjs.map} +0 -0
  380. /package/dist/esm/{chunk-QRS4DGP3.mjs.map → chunk-BF46IXHH.mjs.map} +0 -0
  381. /package/dist/esm/{chunk-PF57EOJY.mjs.map → chunk-BOYYQAB4.mjs.map} +0 -0
  382. /package/dist/esm/{chunk-RPND23OR.mjs.map → chunk-BS7EVBWX.mjs.map} +0 -0
  383. /package/dist/esm/{chunk-JX75UKJX.mjs.map → chunk-BVB3QII3.mjs.map} +0 -0
  384. /package/dist/esm/{chunk-KZZWY4YI.mjs.map → chunk-C5V4EBVP.mjs.map} +0 -0
  385. /package/dist/esm/{chunk-3BNA74V5.mjs.map → chunk-CZ6TC4GO.mjs.map} +0 -0
  386. /package/dist/esm/{chunk-2HF2XEHO.mjs.map → chunk-DLDGUTFV.mjs.map} +0 -0
  387. /package/dist/esm/{chunk-YR7JRJ25.mjs.map → chunk-DPO352QL.mjs.map} +0 -0
  388. /package/dist/esm/{chunk-GM56MMNJ.mjs.map → chunk-DW2KZREM.mjs.map} +0 -0
  389. /package/dist/esm/{chunk-6YV3366Z.mjs.map → chunk-EAW6AWYD.mjs.map} +0 -0
  390. /package/dist/esm/{chunk-NUK6JT5I.mjs.map → chunk-EYIJYUN7.mjs.map} +0 -0
  391. /package/dist/esm/{chunk-AF5WNJOP.mjs.map → chunk-F74FF323.mjs.map} +0 -0
  392. /package/dist/esm/{chunk-ISIUQQMV.mjs.map → chunk-FNFQA7NS.mjs.map} +0 -0
  393. /package/dist/esm/{chunk-G2XVNF2T.mjs.map → chunk-FYB7C42X.mjs.map} +0 -0
  394. /package/dist/esm/{chunk-CEHCDA3G.mjs.map → chunk-H6YNXJNF.mjs.map} +0 -0
  395. /package/dist/esm/{chunk-47IIBESV.mjs.map → chunk-HCN7YJGB.mjs.map} +0 -0
  396. /package/dist/esm/{chunk-53INTTOI.mjs.map → chunk-JPDT6E3B.mjs.map} +0 -0
  397. /package/dist/esm/{chunk-J4VNDDKJ.mjs.map → chunk-JSWBLHMX.mjs.map} +0 -0
  398. /package/dist/esm/{chunk-73QJNN7O.mjs.map → chunk-K4CTCBLY.mjs.map} +0 -0
  399. /package/dist/esm/{chunk-AQAH67IV.mjs.map → chunk-K7DBDI2I.mjs.map} +0 -0
  400. /package/dist/esm/{chunk-PIVZMT5D.mjs.map → chunk-L22R3OIW.mjs.map} +0 -0
  401. /package/dist/esm/{chunk-4GWNWSZP.mjs.map → chunk-LVSOUCFD.mjs.map} +0 -0
  402. /package/dist/esm/{chunk-AHW3SKT7.mjs.map → chunk-M3JHXCGV.mjs.map} +0 -0
  403. /package/dist/esm/{chunk-ZRKXS7XG.mjs.map → chunk-MHZ64FIW.mjs.map} +0 -0
  404. /package/dist/esm/{chunk-UGPALAPN.mjs.map → chunk-MLDQ2TY2.mjs.map} +0 -0
  405. /package/dist/esm/{chunk-R5VVKRJ2.mjs.map → chunk-NNQYSSLH.mjs.map} +0 -0
  406. /package/dist/esm/{chunk-CZOD4SCZ.mjs.map → chunk-NSQLZBCA.mjs.map} +0 -0
  407. /package/dist/esm/{chunk-KAGLWBIJ.mjs.map → chunk-OPGMT27G.mjs.map} +0 -0
  408. /package/dist/esm/{chunk-N3U47Y6Y.mjs.map → chunk-P5V7OZNN.mjs.map} +0 -0
  409. /package/dist/esm/{chunk-337U6Q6K.mjs.map → chunk-PTA3VHTQ.mjs.map} +0 -0
  410. /package/dist/esm/{chunk-BEVXJJJF.mjs.map → chunk-QL2QFRKV.mjs.map} +0 -0
  411. /package/dist/esm/{chunk-U3YYSIIT.mjs.map → chunk-RFA7BIDN.mjs.map} +0 -0
  412. /package/dist/esm/{chunk-G56GPLTB.mjs.map → chunk-RJ4RKVVQ.mjs.map} +0 -0
  413. /package/dist/esm/{chunk-BBVIJO6X.mjs.map → chunk-S32JHML7.mjs.map} +0 -0
  414. /package/dist/esm/{chunk-3SPIFLBZ.mjs.map → chunk-SLFAROVZ.mjs.map} +0 -0
  415. /package/dist/esm/{chunk-CT2BQQTZ.mjs.map → chunk-TG2LLWVU.mjs.map} +0 -0
  416. /package/dist/esm/{chunk-35EWRSDK.mjs.map → chunk-TY4IEDJD.mjs.map} +0 -0
  417. /package/dist/esm/{chunk-G2UPF44Z.mjs.map → chunk-UAZUO75M.mjs.map} +0 -0
  418. /package/dist/esm/{chunk-HLC4HAYY.mjs.map → chunk-UGVNOSD3.mjs.map} +0 -0
  419. /package/dist/esm/{chunk-LGNSPATO.mjs.map → chunk-VCMP3MXN.mjs.map} +0 -0
  420. /package/dist/esm/{chunk-ROXFCLDT.mjs.map → chunk-WV5AD4IE.mjs.map} +0 -0
  421. /package/dist/esm/{chunk-CE65OKFI.mjs.map → chunk-XWVU4G57.mjs.map} +0 -0
  422. /package/dist/esm/{chunk-ZHCSSCC5.mjs.map → chunk-XYLM277Z.mjs.map} +0 -0
  423. /package/dist/esm/{chunk-FAFJKSVZ.mjs.map → chunk-YMUCYX3B.mjs.map} +0 -0
  424. /package/dist/esm/{chunk-SRDIYE3M.mjs.map → chunk-YPHH6CAO.mjs.map} +0 -0
  425. /package/dist/esm/{chunk-B7X6PSE7.mjs.map → chunk-YUNDX5I7.mjs.map} +0 -0
@@ -0,0 +1,144 @@
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(
140
+ `Unable to hash input of length ${inputs.length}. Max input length is ${numInputsToPoseidonFunc.length}`,
141
+ );
142
+ }
143
+ return numInputsToPoseidonFunc[inputs.length - 1](inputs);
144
+ }
@@ -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,129 @@
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 { postAptosPepperService, postAptosProvingService } from "../client";
12
+ import {
13
+ EphemeralSignature,
14
+ Groth16Zkp,
15
+ Hex,
16
+ KeylessPublicKey,
17
+ ZeroKnowledgeSig,
18
+ ZkProof,
19
+ getKeylessConfig,
20
+ } from "../core";
21
+ import { HexInput, ZkpVariant } from "../types";
22
+ import { EphemeralKeyPair, KeylessAccount, ProofFetchCallback } from "../account";
23
+ import { PepperFetchRequest, PepperFetchResponse, ProverRequest, ProverResponse } from "../types/keyless";
24
+ import { nowInSeconds } from "../utils/helpers";
25
+ import { lookupOriginalAccountAddress } from "./account";
26
+
27
+ export async function getPepper(args: {
28
+ aptosConfig: AptosConfig;
29
+ jwt: string;
30
+ ephemeralKeyPair: EphemeralKeyPair;
31
+ uidKey?: string;
32
+ derivationPath?: string;
33
+ }): Promise<Uint8Array> {
34
+ const { aptosConfig, jwt, ephemeralKeyPair, uidKey = "sub", derivationPath } = args;
35
+
36
+ const body = {
37
+ jwt_b64: jwt,
38
+ epk: ephemeralKeyPair.getPublicKey().bcsToHex().toStringWithoutPrefix(),
39
+ exp_date_secs: ephemeralKeyPair.expiryDateSecs,
40
+ epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),
41
+ uid_key: uidKey,
42
+ derivation_path: derivationPath,
43
+ };
44
+ const { data } = await postAptosPepperService<PepperFetchRequest, PepperFetchResponse>({
45
+ aptosConfig,
46
+ path: "fetch",
47
+ body,
48
+ originMethod: "getPepper",
49
+ overrides: { WITH_CREDENTIALS: false },
50
+ });
51
+ return Hex.fromHexInput(data.pepper).toUint8Array();
52
+ }
53
+
54
+ export async function getProof(args: {
55
+ aptosConfig: AptosConfig;
56
+ jwt: string;
57
+ ephemeralKeyPair: EphemeralKeyPair;
58
+ pepper?: HexInput;
59
+ uidKey?: string;
60
+ }): Promise<ZeroKnowledgeSig> {
61
+ const { aptosConfig, jwt, ephemeralKeyPair, pepper = await getPepper(args), uidKey = "sub" } = args;
62
+ if (Hex.fromHexInput(pepper).toUint8Array().length !== KeylessAccount.PEPPER_LENGTH) {
63
+ throw new Error(`Pepper needs to be ${KeylessAccount.PEPPER_LENGTH} bytes`);
64
+ }
65
+ const { maxExpHorizonSecs } = await getKeylessConfig({ aptosConfig });
66
+ if (maxExpHorizonSecs < ephemeralKeyPair.expiryDateSecs - nowInSeconds()) {
67
+ throw Error(`The EphemeralKeyPair is too long lived. It's lifespan must be less than ${maxExpHorizonSecs}`);
68
+ }
69
+ const json = {
70
+ jwt_b64: jwt,
71
+ epk: ephemeralKeyPair.getPublicKey().bcsToHex().toStringWithoutPrefix(),
72
+ epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),
73
+ exp_date_secs: ephemeralKeyPair.expiryDateSecs,
74
+ exp_horizon_secs: maxExpHorizonSecs,
75
+ pepper: Hex.fromHexInput(pepper).toStringWithoutPrefix(),
76
+ uid_key: uidKey,
77
+ };
78
+
79
+ const { data } = await postAptosProvingService<ProverRequest, ProverResponse>({
80
+ aptosConfig,
81
+ path: "prove",
82
+ body: json,
83
+ originMethod: "getProof",
84
+ overrides: { WITH_CREDENTIALS: false },
85
+ });
86
+
87
+ const proofPoints = data.proof;
88
+ const groth16Zkp = new Groth16Zkp({
89
+ a: proofPoints.a,
90
+ b: proofPoints.b,
91
+ c: proofPoints.c,
92
+ });
93
+
94
+ const signedProof = new ZeroKnowledgeSig({
95
+ proof: new ZkProof(groth16Zkp, ZkpVariant.Groth16),
96
+ trainingWheelsSignature: EphemeralSignature.fromHex(data.training_wheels_signature),
97
+ expHorizonSecs: maxExpHorizonSecs,
98
+ });
99
+ return signedProof;
100
+ }
101
+
102
+ export async function deriveKeylessAccount(args: {
103
+ aptosConfig: AptosConfig;
104
+ jwt: string;
105
+ ephemeralKeyPair: EphemeralKeyPair;
106
+ uidKey?: string;
107
+ pepper?: HexInput;
108
+ proofFetchCallback?: ProofFetchCallback;
109
+ }): Promise<KeylessAccount> {
110
+ const { aptosConfig, jwt, uidKey, proofFetchCallback, pepper = await getPepper(args) } = args;
111
+ const proofPromise = getProof({ ...args, pepper });
112
+ // If a callback is provided, pass in the proof as a promise to KeylessAccount.create. This will make the proof be fetched in the
113
+ // background and the callback will handle the outcome of the fetch. This allows the developer to not have to block on the proof fetch
114
+ // allowing for faster rendering of UX.
115
+ //
116
+ // If no callback is provided, the just await the proof fetch and continue syncronously.
117
+ const proof = proofFetchCallback ? proofPromise : await proofPromise;
118
+
119
+ // Look up the original address to handle key rotations
120
+ const publicKey = KeylessPublicKey.fromJwtAndPepper({ jwt, pepper, uidKey });
121
+ const address = await lookupOriginalAccountAddress({
122
+ aptosConfig,
123
+ authenticationKey: publicKey.authKey().derivedAddress(),
124
+ });
125
+
126
+ const keylessAccount = KeylessAccount.create({ ...args, address, proof, pepper, proofFetchCallback });
127
+
128
+ return keylessAccount;
129
+ }
@@ -12,5 +12,7 @@ query getFungibleAssetMetadata($where_condition: fungible_asset_metadata_bool_ex
12
12
  name
13
13
  symbol
14
14
  token_standard
15
+ supply_v2
16
+ maximum_v2
15
17
  }
16
18
  }
@@ -8,7 +8,7 @@
8
8
  import { AptosConfig } from "../api/aptosConfig";
9
9
  import { MoveVector, U8 } from "../bcs";
10
10
  import { postAptosFullNode } from "../client";
11
- import { Account } from "../account";
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";
@@ -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,
@@ -26,10 +26,7 @@
26
26
  import { AptosConfig } from "../../api/aptosConfig";
27
27
  import { Account } from "../../account";
28
28
  import { getInfo } from "../../internal/account";
29
- import { sleep } from "../../utils/helpers";
30
-
31
- // returns `now` time in seconds
32
- const now = () => Math.floor(Date.now() / 1000);
29
+ import { nowInSeconds, sleep } from "../../utils/helpers";
33
30
 
34
31
  export class AccountSequenceNumber {
35
32
  readonly aptosConfig: AptosConfig;
@@ -96,10 +93,10 @@ export class AccountSequenceNumber {
96
93
  if (this.currentNumber! - this.lastUncommintedNumber! >= this.maximumInFlight) {
97
94
  await this.update();
98
95
 
99
- const startTime = now();
96
+ const startTime = nowInSeconds();
100
97
  while (this.currentNumber! - this.lastUncommintedNumber! >= this.maximumInFlight) {
101
98
  await sleep(this.sleepTime);
102
- if (now() - startTime > this.maxWaitTime) {
99
+ if (nowInSeconds() - startTime > this.maxWaitTime) {
103
100
  /* eslint-disable no-console */
104
101
  console.warn(
105
102
  `Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`,
@@ -164,9 +161,9 @@ export class AccountSequenceNumber {
164
161
 
165
162
  try {
166
163
  await this.update();
167
- const startTime = now();
164
+ const startTime = nowInSeconds();
168
165
  while (this.lastUncommintedNumber !== this.currentNumber) {
169
- if (now() - startTime > this.maxWaitTime) {
166
+ if (nowInSeconds() - startTime > this.maxWaitTime) {
170
167
  /* eslint-disable no-console */
171
168
  console.warn(
172
169
  `Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`,
@@ -61,6 +61,9 @@ export function generateSigningMessage(bytes: Uint8Array, domainSeparator: strin
61
61
  }
62
62
 
63
63
  /**
64
+ * @deprecated
65
+ * Use CryptoHashable instead by having your class implement it and call hash() to get the signing message.
66
+ *
64
67
  * Generates the 'signing message' form of a serilizable value. It bcs serializes the value and uses the name of
65
68
  * its constructor as the domain separator.
66
69
  *
@@ -9,7 +9,14 @@
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
+ KeylessSignature,
17
+ Secp256k1PublicKey,
18
+ Secp256k1Signature,
19
+ } from "../../core/crypto";
13
20
  import { Ed25519PublicKey, Ed25519Signature } from "../../core/crypto/ed25519";
14
21
  import { getInfo } from "../../internal/account";
15
22
  import { getLedgerInfo } from "../../internal/general";
@@ -445,6 +452,11 @@ export function generateSignedTransactionForSimulation(args: InputSimulateTransa
445
452
  }
446
453
 
447
454
  export function getAuthenticatorForSimulation(publicKey: PublicKey) {
455
+ if (publicKey instanceof KeylessPublicKey || publicKey instanceof Secp256k1PublicKey) {
456
+ // eslint-disable-next-line no-param-reassign
457
+ publicKey = new AnyPublicKey(publicKey);
458
+ }
459
+
448
460
  // TODO add support for AnyMultiKey
449
461
  if (publicKey instanceof AnyPublicKey) {
450
462
  if (publicKey.publicKey instanceof Ed25519PublicKey) {
@@ -453,6 +465,9 @@ export function getAuthenticatorForSimulation(publicKey: PublicKey) {
453
465
  if (publicKey.publicKey instanceof Secp256k1PublicKey) {
454
466
  return new AccountAuthenticatorSingleKey(publicKey, new AnySignature(new Secp256k1Signature(new Uint8Array(64))));
455
467
  }
468
+ if (publicKey.publicKey instanceof KeylessPublicKey) {
469
+ return new AccountAuthenticatorSingleKey(publicKey, new AnySignature(KeylessSignature.getSimulationSignature()));
470
+ }
456
471
  }
457
472
 
458
473
  // legacy code
@@ -49,13 +49,13 @@ export type CurrentTokenOwnershipFieldsFragment = {
49
49
  last_transaction_timestamp: any;
50
50
  last_transaction_version: any;
51
51
  maximum?: any | null;
52
- supply: any;
52
+ supply?: any | null;
53
53
  token_data_id: string;
54
54
  token_name: string;
55
55
  token_properties: any;
56
56
  token_standard: string;
57
57
  token_uri: string;
58
- decimals: any;
58
+ decimals?: any | null;
59
59
  current_collection?: {
60
60
  collection_id: string;
61
61
  collection_name: string;
@@ -206,13 +206,13 @@ export type GetAccountOwnedTokensQuery = {
206
206
  last_transaction_timestamp: any;
207
207
  last_transaction_version: any;
208
208
  maximum?: any | null;
209
- supply: any;
209
+ supply?: any | null;
210
210
  token_data_id: string;
211
211
  token_name: string;
212
212
  token_properties: any;
213
213
  token_standard: string;
214
214
  token_uri: string;
215
- decimals: any;
215
+ decimals?: any | null;
216
216
  current_collection?: {
217
217
  collection_id: string;
218
218
  collection_name: string;
@@ -262,13 +262,13 @@ export type GetAccountOwnedTokensByTokenDataQuery = {
262
262
  last_transaction_timestamp: any;
263
263
  last_transaction_version: any;
264
264
  maximum?: any | null;
265
- supply: any;
265
+ supply?: any | null;
266
266
  token_data_id: string;
267
267
  token_name: string;
268
268
  token_properties: any;
269
269
  token_standard: string;
270
270
  token_uri: string;
271
- decimals: any;
271
+ decimals?: any | null;
272
272
  current_collection?: {
273
273
  collection_id: string;
274
274
  collection_name: string;
@@ -318,13 +318,13 @@ export type GetAccountOwnedTokensFromCollectionQuery = {
318
318
  last_transaction_timestamp: any;
319
319
  last_transaction_version: any;
320
320
  maximum?: any | null;
321
- supply: any;
321
+ supply?: any | null;
322
322
  token_data_id: string;
323
323
  token_name: string;
324
324
  token_properties: any;
325
325
  token_standard: string;
326
326
  token_uri: string;
327
- decimals: any;
327
+ decimals?: any | null;
328
328
  current_collection?: {
329
329
  collection_id: string;
330
330
  collection_name: string;
@@ -496,6 +496,8 @@ export type GetFungibleAssetMetadataQuery = {
496
496
  name: string;
497
497
  symbol: string;
498
498
  token_standard: string;
499
+ supply_v2?: any | null;
500
+ maximum_v2?: any | null;
499
501
  }>;
500
502
  };
501
503
 
@@ -620,13 +622,13 @@ export type GetCurrentTokenOwnershipQuery = {
620
622
  last_transaction_timestamp: any;
621
623
  last_transaction_version: any;
622
624
  maximum?: any | null;
623
- supply: any;
625
+ supply?: any | null;
624
626
  token_data_id: string;
625
627
  token_name: string;
626
628
  token_properties: any;
627
629
  token_standard: string;
628
630
  token_uri: string;
629
- decimals: any;
631
+ decimals?: any | null;
630
632
  current_collection?: {
631
633
  collection_id: string;
632
634
  collection_name: string;
@@ -663,13 +665,13 @@ export type GetTokenDataQuery = {
663
665
  last_transaction_timestamp: any;
664
666
  last_transaction_version: any;
665
667
  maximum?: any | null;
666
- supply: any;
668
+ supply?: any | null;
667
669
  token_data_id: string;
668
670
  token_name: string;
669
671
  token_properties: any;
670
672
  token_standard: string;
671
673
  token_uri: string;
672
- decimals: any;
674
+ decimals?: any | null;
673
675
  current_collection?: {
674
676
  collection_id: string;
675
677
  collection_name: string;