@aptos-labs/ts-sdk 1.13.0 → 1.13.1-zeta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (473) hide show
  1. package/dist/common/index.d.ts +1775 -1351
  2. package/dist/common/index.js +26 -26
  3. package/dist/common/index.js.map +1 -1
  4. package/dist/esm/{Ed25519Account--qjfup2u.d.mts → Ed25519Account-8gJF5t3F.d.mts} +10 -12
  5. package/dist/esm/account/Account.d.mts +34 -0
  6. package/dist/esm/account/Account.mjs +2 -0
  7. package/dist/esm/account/Ed25519Account.d.mts +34 -0
  8. package/dist/esm/account/Ed25519Account.mjs +2 -0
  9. package/dist/esm/account/EphemeralKeyPair.d.mts +44 -0
  10. package/dist/esm/account/EphemeralKeyPair.mjs +2 -0
  11. package/dist/esm/account/KeylessAccount.d.mts +87 -0
  12. package/dist/esm/account/KeylessAccount.mjs +2 -0
  13. package/dist/esm/account/MultiKeyAccount.d.mts +99 -0
  14. package/dist/esm/account/MultiKeyAccount.mjs +2 -0
  15. package/dist/esm/account/SingleKeyAccount.d.mts +34 -0
  16. package/dist/esm/account/SingleKeyAccount.mjs +2 -0
  17. package/dist/esm/account/index.d.mts +39 -0
  18. package/dist/esm/account/index.mjs +2 -0
  19. package/dist/esm/api/account.d.mts +14 -2
  20. package/dist/esm/api/account.mjs +1 -1
  21. package/dist/esm/api/ans.d.mts +2 -2
  22. package/dist/esm/api/ans.mjs +1 -1
  23. package/dist/esm/api/aptos.d.mts +14 -8
  24. package/dist/esm/api/aptos.mjs +1 -1
  25. package/dist/esm/api/aptosConfig.d.mts +20 -0
  26. package/dist/esm/api/aptosConfig.mjs +1 -1
  27. package/dist/esm/api/coin.d.mts +7 -7
  28. package/dist/esm/api/coin.mjs +1 -1
  29. package/dist/esm/api/digitalAsset.d.mts +3 -3
  30. package/dist/esm/api/digitalAsset.mjs +1 -1
  31. package/dist/esm/api/event.d.mts +1 -1
  32. package/dist/esm/api/event.mjs +1 -1
  33. package/dist/esm/api/faucet.mjs +1 -1
  34. package/dist/esm/api/fungibleAsset.d.mts +6 -6
  35. package/dist/esm/api/fungibleAsset.mjs +1 -1
  36. package/dist/esm/api/general.d.mts +9 -9
  37. package/dist/esm/api/general.mjs +1 -1
  38. package/dist/esm/api/index.d.mts +13 -8
  39. package/dist/esm/api/index.mjs +1 -1
  40. package/dist/esm/api/keyless.d.mts +67 -0
  41. package/dist/esm/api/keyless.mjs +2 -0
  42. package/dist/esm/api/keyless.mjs.map +1 -0
  43. package/dist/esm/api/staking.d.mts +2 -2
  44. package/dist/esm/api/staking.mjs +1 -1
  45. package/dist/esm/api/transaction.d.mts +2 -2
  46. package/dist/esm/api/transaction.mjs +1 -1
  47. package/dist/esm/api/transactionSubmission/build.d.mts +2 -2
  48. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  49. package/dist/esm/api/transactionSubmission/management.d.mts +8 -8
  50. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  51. package/dist/esm/api/transactionSubmission/sign.d.mts +1 -1
  52. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  53. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  54. package/dist/esm/api/transactionSubmission/simulate.d.mts +6 -6
  55. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  56. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  57. package/dist/esm/api/utils.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 +2 -0
  64. package/dist/esm/bcs/serializer.mjs +1 -1
  65. package/dist/esm/{chunk-HB6T27S2.mjs → chunk-2OTMSEHI.mjs} +2 -2
  66. package/dist/esm/{chunk-FS3NSGBF.mjs → chunk-35ZI4WOQ.mjs} +2 -2
  67. package/dist/esm/{chunk-ONDQ4MK7.mjs → chunk-3FL3NLZ6.mjs} +2 -2
  68. package/dist/esm/chunk-3OA7CG6N.mjs +2 -0
  69. package/dist/esm/chunk-3OA7CG6N.mjs.map +1 -0
  70. package/dist/esm/{chunk-52C73T26.mjs → chunk-52DBSOFA.mjs} +2 -2
  71. package/dist/esm/{chunk-52C73T26.mjs.map → chunk-52DBSOFA.mjs.map} +1 -1
  72. package/dist/esm/{chunk-A7MSW6OL.mjs → chunk-534GCQ37.mjs} +2 -2
  73. package/dist/esm/chunk-5GIWRESN.mjs +2 -0
  74. package/dist/esm/{chunk-KUOIRTNL.mjs → chunk-5TNUDFLP.mjs} +2 -2
  75. package/dist/esm/{chunk-V4YBGBCN.mjs → chunk-6DA64TSG.mjs} +2 -2
  76. package/dist/esm/{chunk-H4UVHJ3M.mjs → chunk-6YDD6LGX.mjs} +2 -2
  77. package/dist/esm/chunk-6YDD6LGX.mjs.map +1 -0
  78. package/dist/esm/{chunk-TBMAJ6AW.mjs → chunk-7EQOLMEJ.mjs} +2 -2
  79. package/dist/esm/chunk-7YMBWSKN.mjs +2 -0
  80. package/dist/esm/chunk-7YMBWSKN.mjs.map +1 -0
  81. package/dist/esm/chunk-7Z6DYLCA.mjs +1 -0
  82. package/dist/esm/chunk-7Z6DYLCA.mjs.map +1 -0
  83. package/dist/esm/chunk-AE7X4LVG.mjs +2 -0
  84. package/dist/esm/chunk-AE7X4LVG.mjs.map +1 -0
  85. package/dist/esm/chunk-AQ4I7VVB.mjs +1 -0
  86. package/dist/esm/chunk-AQ4I7VVB.mjs.map +1 -0
  87. package/dist/esm/chunk-ASRAJ24P.mjs +2 -0
  88. package/dist/esm/{chunk-OKCU4GHN.mjs → chunk-B645DPPF.mjs} +2 -2
  89. package/dist/esm/chunk-BIU5KNPT.mjs +2 -0
  90. package/dist/esm/chunk-C2HDZYYQ.mjs +2 -0
  91. package/dist/esm/chunk-C2HDZYYQ.mjs.map +1 -0
  92. package/dist/esm/chunk-CFJEOZMV.mjs +2 -0
  93. package/dist/esm/{chunk-WEZXFWPR.mjs.map → chunk-CFJEOZMV.mjs.map} +1 -1
  94. package/dist/esm/chunk-COLCWAPL.mjs +2 -0
  95. package/dist/esm/chunk-COLCWAPL.mjs.map +1 -0
  96. package/dist/esm/chunk-CW7JVCSV.mjs +2 -0
  97. package/dist/esm/chunk-CW7JVCSV.mjs.map +1 -0
  98. package/dist/esm/chunk-D2DIZHP3.mjs +2 -0
  99. package/dist/esm/chunk-D2DIZHP3.mjs.map +1 -0
  100. package/dist/esm/{chunk-L4Q2XTHT.mjs → chunk-ED6PYTNG.mjs} +2 -2
  101. package/dist/esm/chunk-EGTGR3R4.mjs +2 -0
  102. package/dist/esm/{chunk-KVIVMWN5.mjs → chunk-FB6T6ZQP.mjs} +2 -2
  103. package/dist/esm/chunk-FLYEALDB.mjs +2 -0
  104. package/dist/esm/chunk-FLYEALDB.mjs.map +1 -0
  105. package/dist/esm/{chunk-SDUIZ3FY.mjs → chunk-G4QU37E6.mjs} +2 -2
  106. package/dist/esm/chunk-G4QU37E6.mjs.map +1 -0
  107. package/dist/esm/{chunk-QW3VNZJ7.mjs → chunk-GVZZTEYV.mjs} +2 -2
  108. package/dist/esm/{chunk-WFZDFFBM.mjs → chunk-HZC6A3QL.mjs} +2 -2
  109. package/dist/esm/{chunk-IA6XM7QE.mjs → chunk-HZFOKUQZ.mjs} +2 -2
  110. package/dist/esm/chunk-HZFOKUQZ.mjs.map +1 -0
  111. package/dist/esm/{chunk-647IOEXV.mjs → chunk-I657KZIO.mjs} +2 -2
  112. package/dist/esm/chunk-IO2NZ5PR.mjs +2 -0
  113. package/dist/esm/chunk-IO2NZ5PR.mjs.map +1 -0
  114. package/dist/esm/{chunk-U43IJHQN.mjs → chunk-IVBYTTN7.mjs} +2 -2
  115. package/dist/esm/chunk-JP6UNRLO.mjs +2 -0
  116. package/dist/esm/{chunk-TLKV4NHK.mjs.map → chunk-JP6UNRLO.mjs.map} +1 -1
  117. package/dist/esm/chunk-JXCZTOYC.mjs +1 -0
  118. package/dist/esm/chunk-JXCZTOYC.mjs.map +1 -0
  119. package/dist/esm/{chunk-NPFNYP75.mjs → chunk-JYFKKB34.mjs} +2 -2
  120. package/dist/esm/{chunk-2M6OT6DU.mjs → chunk-KFKE46CF.mjs} +2 -2
  121. package/dist/esm/{chunk-R5QUBEH6.mjs → chunk-KX5ESZO7.mjs} +2 -2
  122. package/dist/esm/{chunk-7PYFGGHM.mjs → chunk-LB4KMZNQ.mjs} +2 -2
  123. package/dist/esm/chunk-LB4KMZNQ.mjs.map +1 -0
  124. package/dist/esm/chunk-M3VGAYMW.mjs +2 -0
  125. package/dist/esm/chunk-M3VGAYMW.mjs.map +1 -0
  126. package/dist/esm/{chunk-BWFJHFBQ.mjs → chunk-MRCVSUJQ.mjs} +2 -2
  127. package/dist/esm/{chunk-HXN2WRUX.mjs → chunk-MUEDPI2Z.mjs} +2 -2
  128. package/dist/esm/{chunk-3F6EYD5O.mjs → chunk-N35ARFH3.mjs} +2 -2
  129. package/dist/esm/chunk-N35ARFH3.mjs.map +1 -0
  130. package/dist/esm/chunk-ND5A52N4.mjs +2 -0
  131. package/dist/esm/chunk-ND5A52N4.mjs.map +1 -0
  132. package/dist/esm/{chunk-XYLYHSEI.mjs → chunk-NKSAU5OX.mjs} +2 -2
  133. package/dist/esm/chunk-NKSAU5OX.mjs.map +1 -0
  134. package/dist/esm/chunk-NMYQ2LMC.mjs +2 -0
  135. package/dist/esm/chunk-NMYQ2LMC.mjs.map +1 -0
  136. package/dist/esm/chunk-OF256KD5.mjs +2 -0
  137. package/dist/esm/chunk-OF256KD5.mjs.map +1 -0
  138. package/dist/esm/chunk-OKRUEVF3.mjs +2 -0
  139. package/dist/esm/chunk-OKRUEVF3.mjs.map +1 -0
  140. package/dist/esm/{chunk-7CAEMK4R.mjs → chunk-OQKD5SSG.mjs} +2 -2
  141. package/dist/esm/chunk-ORMDVSRG.mjs +2 -0
  142. package/dist/esm/chunk-ORMDVSRG.mjs.map +1 -0
  143. package/dist/esm/{chunk-IS3OLRMB.mjs → chunk-P2JP6PSD.mjs} +2 -2
  144. package/dist/esm/{chunk-TR2YS7DT.mjs → chunk-PCLBZIT4.mjs} +2 -2
  145. package/dist/esm/chunk-PSTPEDI3.mjs +2 -0
  146. package/dist/esm/chunk-PSTPEDI3.mjs.map +1 -0
  147. package/dist/esm/{chunk-DMKUAQB7.mjs → chunk-Q225PZMV.mjs} +2 -2
  148. package/dist/esm/{chunk-6CBPMYW5.mjs → chunk-QBWI223M.mjs} +2 -2
  149. package/dist/esm/chunk-QEKSGA7S.mjs +2 -0
  150. package/dist/esm/chunk-QEKSGA7S.mjs.map +1 -0
  151. package/dist/esm/{chunk-VBTJVPAM.mjs → chunk-QFK75K2K.mjs} +2 -2
  152. package/dist/esm/{chunk-TGLSJGFO.mjs → chunk-RBDX3YWC.mjs} +2 -2
  153. package/dist/esm/chunk-RFSO3JRG.mjs +1 -0
  154. package/dist/esm/chunk-RFSO3JRG.mjs.map +1 -0
  155. package/dist/esm/{chunk-DSTKXJMA.mjs → chunk-RM7D2ITN.mjs} +2 -2
  156. package/dist/esm/chunk-S5HG2QUD.mjs +2 -0
  157. package/dist/esm/chunk-S5HG2QUD.mjs.map +1 -0
  158. package/dist/esm/chunk-S5YUB2BI.mjs +2 -0
  159. package/dist/esm/chunk-S5YUB2BI.mjs.map +1 -0
  160. package/dist/esm/{chunk-MIEV7J74.mjs → chunk-SC7NXRMV.mjs} +2 -2
  161. package/dist/esm/chunk-SC7NXRMV.mjs.map +1 -0
  162. package/dist/esm/chunk-SQNDWIVJ.mjs +2 -0
  163. package/dist/esm/chunk-SQNDWIVJ.mjs.map +1 -0
  164. package/dist/esm/chunk-T7TIIAWK.mjs +2 -0
  165. package/dist/esm/{chunk-KOAUBVO6.mjs.map → chunk-T7TIIAWK.mjs.map} +1 -1
  166. package/dist/esm/chunk-TCMSBGBS.mjs +2 -0
  167. package/dist/esm/chunk-TCMSBGBS.mjs.map +1 -0
  168. package/dist/esm/{chunk-IOSQVDZI.mjs → chunk-U7EZI5D5.mjs} +2 -2
  169. package/dist/esm/chunk-UAFAZSOH.mjs +2 -0
  170. package/dist/esm/chunk-UAFAZSOH.mjs.map +1 -0
  171. package/dist/esm/chunk-UMFYNNCG.mjs +2 -0
  172. package/dist/esm/{chunk-YWQLLV2R.mjs.map → chunk-UMFYNNCG.mjs.map} +1 -1
  173. package/dist/esm/{chunk-ZYYK3UXP.mjs → chunk-UZHVGPGH.mjs} +2 -2
  174. package/dist/esm/chunk-VG2J3UTS.mjs +2 -0
  175. package/dist/esm/chunk-VG2J3UTS.mjs.map +1 -0
  176. package/dist/esm/chunk-VSPQRNEG.mjs +2 -0
  177. package/dist/esm/chunk-VSPQRNEG.mjs.map +1 -0
  178. package/dist/esm/chunk-VSWIMQAB.mjs +2 -0
  179. package/dist/esm/chunk-VSWIMQAB.mjs.map +1 -0
  180. package/dist/esm/{chunk-QIAHBEEW.mjs → chunk-VVJEWB26.mjs} +2 -2
  181. package/dist/esm/chunk-W2MKEIHI.mjs +2 -0
  182. package/dist/esm/chunk-W2MKEIHI.mjs.map +1 -0
  183. package/dist/esm/{chunk-Y5M5DD64.mjs → chunk-WAWBXQ6B.mjs} +2 -2
  184. package/dist/esm/{chunk-TBFLWWV4.mjs → chunk-WR5L4STD.mjs} +2 -2
  185. package/dist/esm/{chunk-RHBCVCOS.mjs → chunk-WZCUABDL.mjs} +2 -2
  186. package/dist/esm/{chunk-UML2VQZT.mjs → chunk-XI4LX4EC.mjs} +2 -2
  187. package/dist/esm/chunk-Y4VKIX2V.mjs +2 -0
  188. package/dist/esm/chunk-Y4VKIX2V.mjs.map +1 -0
  189. package/dist/esm/{chunk-I7YI22IW.mjs → chunk-Y5DMKMLF.mjs} +2 -2
  190. package/dist/esm/chunk-YE5B2S5L.mjs +2 -0
  191. package/dist/esm/chunk-YE5B2S5L.mjs.map +1 -0
  192. package/dist/esm/{chunk-ZKNM27TR.mjs → chunk-YGWIVUJP.mjs} +2 -2
  193. package/dist/esm/chunk-YGWIVUJP.mjs.map +1 -0
  194. package/dist/esm/{chunk-QVKMFPAV.mjs → chunk-YIIDPNGQ.mjs} +2 -2
  195. package/dist/esm/{chunk-G2QII3AT.mjs → chunk-YMVFNEBO.mjs} +2 -2
  196. package/dist/esm/chunk-YMVFNEBO.mjs.map +1 -0
  197. package/dist/esm/client/core.mjs +1 -1
  198. package/dist/esm/client/get.d.mts +2 -1
  199. package/dist/esm/client/get.mjs +1 -1
  200. package/dist/esm/client/index.d.mts +2 -2
  201. package/dist/esm/client/index.mjs +1 -1
  202. package/dist/esm/client/post.d.mts +3 -1
  203. package/dist/esm/client/post.mjs +1 -1
  204. package/dist/esm/core/account/index.d.mts +5 -14
  205. package/dist/esm/core/account/index.mjs +1 -1
  206. package/dist/esm/core/account/utils/address.mjs +1 -1
  207. package/dist/esm/core/account/utils/index.mjs +1 -1
  208. package/dist/esm/core/accountAddress.mjs +1 -1
  209. package/dist/esm/core/authenticationKey.mjs +1 -1
  210. package/dist/esm/core/crypto/ed25519.d.mts +0 -10
  211. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  212. package/dist/esm/core/crypto/ephemeral.d.mts +77 -0
  213. package/dist/esm/core/crypto/ephemeral.mjs +2 -0
  214. package/dist/esm/core/crypto/ephemeral.mjs.map +1 -0
  215. package/dist/esm/core/crypto/hdKey.d.mts +15 -1
  216. package/dist/esm/core/crypto/hdKey.mjs +1 -1
  217. package/dist/esm/core/crypto/index.d.mts +7 -5
  218. package/dist/esm/core/crypto/index.mjs +1 -1
  219. package/dist/esm/core/crypto/keyless.d.mts +217 -0
  220. package/dist/esm/core/crypto/keyless.mjs +2 -0
  221. package/dist/esm/core/crypto/keyless.mjs.map +1 -0
  222. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  223. package/dist/esm/core/crypto/multiKey.d.mts +4 -3
  224. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  225. package/dist/esm/core/crypto/poseidon.d.mts +7 -0
  226. package/dist/esm/core/crypto/poseidon.mjs +2 -0
  227. package/dist/esm/core/crypto/poseidon.mjs.map +1 -0
  228. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  229. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  230. package/dist/esm/core/crypto/signature.mjs +1 -1
  231. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  232. package/dist/esm/core/index.d.mts +6 -7
  233. package/dist/esm/core/index.mjs +1 -1
  234. package/dist/esm/index.d.mts +15 -9
  235. package/dist/esm/index.mjs +1 -1
  236. package/dist/esm/internal/account.d.mts +14 -2
  237. package/dist/esm/internal/account.mjs +1 -1
  238. package/dist/esm/internal/ans.d.mts +1 -1
  239. package/dist/esm/internal/ans.mjs +1 -1
  240. package/dist/esm/internal/coin.d.mts +7 -7
  241. package/dist/esm/internal/coin.mjs +1 -1
  242. package/dist/esm/internal/digitalAsset.d.mts +2 -2
  243. package/dist/esm/internal/digitalAsset.mjs +1 -1
  244. package/dist/esm/internal/event.d.mts +2 -2
  245. package/dist/esm/internal/event.mjs +1 -1
  246. package/dist/esm/internal/faucet.d.mts +1 -1
  247. package/dist/esm/internal/faucet.mjs +1 -1
  248. package/dist/esm/internal/fungibleAsset.d.mts +6 -6
  249. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  250. package/dist/esm/internal/general.mjs +1 -1
  251. package/dist/esm/internal/keyless.d.mts +66 -0
  252. package/dist/esm/internal/keyless.mjs +2 -0
  253. package/dist/esm/internal/keyless.mjs.map +1 -0
  254. package/dist/esm/internal/staking.d.mts +3 -3
  255. package/dist/esm/internal/staking.mjs +1 -1
  256. package/dist/esm/internal/transaction.mjs +1 -1
  257. package/dist/esm/internal/transactionSubmission.d.mts +5 -5
  258. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  259. package/dist/esm/internal/view.d.mts +7 -7
  260. package/dist/esm/internal/view.mjs +1 -1
  261. package/dist/esm/transactions/authenticator/account.d.mts +3 -4
  262. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  263. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  264. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  265. package/dist/esm/transactions/index.d.mts +2 -2
  266. package/dist/esm/transactions/index.mjs +1 -1
  267. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  268. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  269. package/dist/esm/transactions/instances/index.mjs +1 -1
  270. package/dist/esm/transactions/instances/moduleId.d.mts +1 -1
  271. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  272. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  273. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  274. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  275. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  276. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  277. package/dist/esm/transactions/instances/transactionPayload.d.mts +1 -1
  278. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  279. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +13 -1
  280. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  281. package/dist/esm/transactions/management/index.d.mts +2 -2
  282. package/dist/esm/transactions/management/index.mjs +1 -1
  283. package/dist/esm/transactions/management/transactionWorker.d.mts +1 -1
  284. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  285. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +9 -9
  286. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  287. package/dist/esm/transactions/transactionBuilder/index.d.mts +9 -9
  288. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  289. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +6 -6
  290. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  291. package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +47 -0
  292. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +2 -0
  293. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs.map +1 -0
  294. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +6 -28
  295. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  296. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  297. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  298. package/dist/esm/transactions/types.d.mts +6 -6
  299. package/dist/esm/types/index.d.mts +17 -3
  300. package/dist/esm/types/index.mjs +1 -1
  301. package/dist/esm/types/keyless.d.mts +14 -0
  302. package/dist/esm/types/keyless.mjs +1 -0
  303. package/dist/esm/types/keyless.mjs.map +1 -0
  304. package/dist/esm/utils/apiEndpoints.d.mts +3 -1
  305. package/dist/esm/utils/apiEndpoints.mjs +1 -1
  306. package/dist/esm/utils/const.d.mts +3 -1
  307. package/dist/esm/utils/const.mjs +1 -1
  308. package/dist/esm/utils/index.d.mts +1 -1
  309. package/dist/esm/utils/index.mjs +1 -1
  310. package/dist/esm/version.d.mts +1 -1
  311. package/dist/esm/version.mjs +1 -1
  312. package/package.json +7 -2
  313. package/src/{core/account → account}/Account.ts +12 -16
  314. package/src/{core/account → account}/Ed25519Account.ts +13 -7
  315. package/src/account/EphemeralKeyPair.ts +107 -0
  316. package/src/account/KeylessAccount.ts +250 -0
  317. package/src/account/MultiKeyAccount.ts +119 -0
  318. package/src/{core/account → account}/SingleKeyAccount.ts +13 -8
  319. package/src/account/index.ts +6 -0
  320. package/src/api/account.ts +2 -1
  321. package/src/api/ans.ts +2 -1
  322. package/src/api/aptos.ts +6 -0
  323. package/src/api/aptosConfig.ts +46 -1
  324. package/src/api/digitalAsset.ts +2 -1
  325. package/src/api/fungibleAsset.ts +2 -1
  326. package/src/api/keyless.ts +36 -0
  327. package/src/api/transaction.ts +2 -1
  328. package/src/api/transactionSubmission/management.ts +1 -1
  329. package/src/api/transactionSubmission/sign.ts +1 -1
  330. package/src/bcs/serializer.ts +18 -0
  331. package/src/client/core.ts +8 -0
  332. package/src/client/get.ts +6 -0
  333. package/src/client/post.ts +12 -0
  334. package/src/core/account/index.ts +1 -3
  335. package/src/core/crypto/ed25519.ts +4 -24
  336. package/src/core/crypto/ephemeral.ts +149 -0
  337. package/src/core/crypto/hdKey.ts +31 -0
  338. package/src/core/crypto/index.ts +2 -0
  339. package/src/core/crypto/keyless.ts +508 -0
  340. package/src/core/crypto/multiKey.ts +21 -11
  341. package/src/core/crypto/poseidon.ts +134 -0
  342. package/src/core/crypto/singleKey.ts +11 -0
  343. package/src/core/index.ts +0 -1
  344. package/src/index.ts +1 -0
  345. package/src/internal/account.ts +1 -1
  346. package/src/internal/ans.ts +2 -1
  347. package/src/internal/digitalAsset.ts +2 -1
  348. package/src/internal/fungibleAsset.ts +2 -1
  349. package/src/internal/keyless.ts +189 -0
  350. package/src/internal/transactionSubmission.ts +11 -8
  351. package/src/transactions/authenticator/account.ts +6 -11
  352. package/src/transactions/management/accountSequenceNumber.ts +1 -1
  353. package/src/transactions/management/transactionWorker.ts +8 -2
  354. package/src/transactions/transactionBuilder/index.ts +1 -0
  355. package/src/transactions/transactionBuilder/signingMessage.ts +70 -0
  356. package/src/transactions/transactionBuilder/transactionBuilder.ts +51 -117
  357. package/src/types/index.ts +19 -0
  358. package/src/types/keyless.ts +6 -0
  359. package/src/utils/apiEndpoints.ts +15 -0
  360. package/src/utils/const.ts +2 -0
  361. package/src/version.ts +1 -1
  362. package/dist/esm/chunk-3CLYWZYZ.mjs +0 -2
  363. package/dist/esm/chunk-3F6EYD5O.mjs.map +0 -1
  364. package/dist/esm/chunk-54BANKLA.mjs +0 -2
  365. package/dist/esm/chunk-54BANKLA.mjs.map +0 -1
  366. package/dist/esm/chunk-5AQEETAC.mjs +0 -2
  367. package/dist/esm/chunk-5AQEETAC.mjs.map +0 -1
  368. package/dist/esm/chunk-63AIRYJX.mjs +0 -2
  369. package/dist/esm/chunk-7PYFGGHM.mjs.map +0 -1
  370. package/dist/esm/chunk-AP7UZTPZ.mjs +0 -2
  371. package/dist/esm/chunk-AP7UZTPZ.mjs.map +0 -1
  372. package/dist/esm/chunk-BMKDEIRL.mjs +0 -2
  373. package/dist/esm/chunk-BMKDEIRL.mjs.map +0 -1
  374. package/dist/esm/chunk-BSEQPVD6.mjs +0 -2
  375. package/dist/esm/chunk-BSEQPVD6.mjs.map +0 -1
  376. package/dist/esm/chunk-C67BKZND.mjs +0 -2
  377. package/dist/esm/chunk-C67BKZND.mjs.map +0 -1
  378. package/dist/esm/chunk-CYNQRMO5.mjs +0 -2
  379. package/dist/esm/chunk-CYNQRMO5.mjs.map +0 -1
  380. package/dist/esm/chunk-E7FWVXGX.mjs +0 -1
  381. package/dist/esm/chunk-G2QII3AT.mjs.map +0 -1
  382. package/dist/esm/chunk-GMVVQD72.mjs +0 -2
  383. package/dist/esm/chunk-GMVVQD72.mjs.map +0 -1
  384. package/dist/esm/chunk-GXVUN32G.mjs +0 -2
  385. package/dist/esm/chunk-GXVUN32G.mjs.map +0 -1
  386. package/dist/esm/chunk-H4UVHJ3M.mjs.map +0 -1
  387. package/dist/esm/chunk-IA6XM7QE.mjs.map +0 -1
  388. package/dist/esm/chunk-KL6VJ3UK.mjs +0 -2
  389. package/dist/esm/chunk-KL6VJ3UK.mjs.map +0 -1
  390. package/dist/esm/chunk-KOAUBVO6.mjs +0 -2
  391. package/dist/esm/chunk-LR65XHSF.mjs +0 -2
  392. package/dist/esm/chunk-LR65XHSF.mjs.map +0 -1
  393. package/dist/esm/chunk-MIEV7J74.mjs.map +0 -1
  394. package/dist/esm/chunk-MLWIHWNH.mjs +0 -1
  395. package/dist/esm/chunk-OWW6SIDP.mjs +0 -2
  396. package/dist/esm/chunk-OWW6SIDP.mjs.map +0 -1
  397. package/dist/esm/chunk-QK4P26SH.mjs +0 -2
  398. package/dist/esm/chunk-QTSECE7R.mjs +0 -2
  399. package/dist/esm/chunk-QTSECE7R.mjs.map +0 -1
  400. package/dist/esm/chunk-R7G3CLRI.mjs +0 -1
  401. package/dist/esm/chunk-RAYJRFIG.mjs +0 -2
  402. package/dist/esm/chunk-RAYJRFIG.mjs.map +0 -1
  403. package/dist/esm/chunk-SDUIZ3FY.mjs.map +0 -1
  404. package/dist/esm/chunk-TLKV4NHK.mjs +0 -2
  405. package/dist/esm/chunk-UVSRX4SV.mjs +0 -1
  406. package/dist/esm/chunk-V6SPPOWX.mjs +0 -2
  407. package/dist/esm/chunk-VM3EJYJU.mjs +0 -2
  408. package/dist/esm/chunk-VM3EJYJU.mjs.map +0 -1
  409. package/dist/esm/chunk-VX6LTXGB.mjs +0 -2
  410. package/dist/esm/chunk-VX6LTXGB.mjs.map +0 -1
  411. package/dist/esm/chunk-WEZXFWPR.mjs +0 -2
  412. package/dist/esm/chunk-XYLYHSEI.mjs.map +0 -1
  413. package/dist/esm/chunk-Y2VA7F5D.mjs +0 -2
  414. package/dist/esm/chunk-Y2VA7F5D.mjs.map +0 -1
  415. package/dist/esm/chunk-YWQLLV2R.mjs +0 -2
  416. package/dist/esm/chunk-ZEXZ4CX5.mjs +0 -2
  417. package/dist/esm/chunk-ZEXZ4CX5.mjs.map +0 -1
  418. package/dist/esm/chunk-ZKNM27TR.mjs.map +0 -1
  419. package/dist/esm/chunk-ZPNCA4C7.mjs +0 -2
  420. package/dist/esm/chunk-ZPNCA4C7.mjs.map +0 -1
  421. package/dist/esm/core/account/Account.d.mts +0 -20
  422. package/dist/esm/core/account/Account.mjs +0 -2
  423. package/dist/esm/core/account/Ed25519Account.d.mts +0 -20
  424. package/dist/esm/core/account/Ed25519Account.mjs +0 -2
  425. package/dist/esm/core/account/SingleKeyAccount.d.mts +0 -20
  426. package/dist/esm/core/account/SingleKeyAccount.mjs +0 -2
  427. /package/dist/esm/{core/account → account}/Account.mjs.map +0 -0
  428. /package/dist/esm/{core/account → account}/Ed25519Account.mjs.map +0 -0
  429. /package/dist/esm/{chunk-E7FWVXGX.mjs.map → account/EphemeralKeyPair.mjs.map} +0 -0
  430. /package/dist/esm/{chunk-MLWIHWNH.mjs.map → account/KeylessAccount.mjs.map} +0 -0
  431. /package/dist/esm/{chunk-R7G3CLRI.mjs.map → account/MultiKeyAccount.mjs.map} +0 -0
  432. /package/dist/esm/{core/account → account}/SingleKeyAccount.mjs.map +0 -0
  433. /package/dist/esm/{chunk-UVSRX4SV.mjs.map → account/index.mjs.map} +0 -0
  434. /package/dist/esm/{chunk-HB6T27S2.mjs.map → chunk-2OTMSEHI.mjs.map} +0 -0
  435. /package/dist/esm/{chunk-FS3NSGBF.mjs.map → chunk-35ZI4WOQ.mjs.map} +0 -0
  436. /package/dist/esm/{chunk-ONDQ4MK7.mjs.map → chunk-3FL3NLZ6.mjs.map} +0 -0
  437. /package/dist/esm/{chunk-A7MSW6OL.mjs.map → chunk-534GCQ37.mjs.map} +0 -0
  438. /package/dist/esm/{chunk-V6SPPOWX.mjs.map → chunk-5GIWRESN.mjs.map} +0 -0
  439. /package/dist/esm/{chunk-KUOIRTNL.mjs.map → chunk-5TNUDFLP.mjs.map} +0 -0
  440. /package/dist/esm/{chunk-V4YBGBCN.mjs.map → chunk-6DA64TSG.mjs.map} +0 -0
  441. /package/dist/esm/{chunk-TBMAJ6AW.mjs.map → chunk-7EQOLMEJ.mjs.map} +0 -0
  442. /package/dist/esm/{chunk-63AIRYJX.mjs.map → chunk-ASRAJ24P.mjs.map} +0 -0
  443. /package/dist/esm/{chunk-OKCU4GHN.mjs.map → chunk-B645DPPF.mjs.map} +0 -0
  444. /package/dist/esm/{chunk-QK4P26SH.mjs.map → chunk-BIU5KNPT.mjs.map} +0 -0
  445. /package/dist/esm/{chunk-L4Q2XTHT.mjs.map → chunk-ED6PYTNG.mjs.map} +0 -0
  446. /package/dist/esm/{chunk-3CLYWZYZ.mjs.map → chunk-EGTGR3R4.mjs.map} +0 -0
  447. /package/dist/esm/{chunk-KVIVMWN5.mjs.map → chunk-FB6T6ZQP.mjs.map} +0 -0
  448. /package/dist/esm/{chunk-QW3VNZJ7.mjs.map → chunk-GVZZTEYV.mjs.map} +0 -0
  449. /package/dist/esm/{chunk-WFZDFFBM.mjs.map → chunk-HZC6A3QL.mjs.map} +0 -0
  450. /package/dist/esm/{chunk-647IOEXV.mjs.map → chunk-I657KZIO.mjs.map} +0 -0
  451. /package/dist/esm/{chunk-U43IJHQN.mjs.map → chunk-IVBYTTN7.mjs.map} +0 -0
  452. /package/dist/esm/{chunk-NPFNYP75.mjs.map → chunk-JYFKKB34.mjs.map} +0 -0
  453. /package/dist/esm/{chunk-2M6OT6DU.mjs.map → chunk-KFKE46CF.mjs.map} +0 -0
  454. /package/dist/esm/{chunk-R5QUBEH6.mjs.map → chunk-KX5ESZO7.mjs.map} +0 -0
  455. /package/dist/esm/{chunk-BWFJHFBQ.mjs.map → chunk-MRCVSUJQ.mjs.map} +0 -0
  456. /package/dist/esm/{chunk-HXN2WRUX.mjs.map → chunk-MUEDPI2Z.mjs.map} +0 -0
  457. /package/dist/esm/{chunk-7CAEMK4R.mjs.map → chunk-OQKD5SSG.mjs.map} +0 -0
  458. /package/dist/esm/{chunk-IS3OLRMB.mjs.map → chunk-P2JP6PSD.mjs.map} +0 -0
  459. /package/dist/esm/{chunk-TR2YS7DT.mjs.map → chunk-PCLBZIT4.mjs.map} +0 -0
  460. /package/dist/esm/{chunk-DMKUAQB7.mjs.map → chunk-Q225PZMV.mjs.map} +0 -0
  461. /package/dist/esm/{chunk-6CBPMYW5.mjs.map → chunk-QBWI223M.mjs.map} +0 -0
  462. /package/dist/esm/{chunk-VBTJVPAM.mjs.map → chunk-QFK75K2K.mjs.map} +0 -0
  463. /package/dist/esm/{chunk-TGLSJGFO.mjs.map → chunk-RBDX3YWC.mjs.map} +0 -0
  464. /package/dist/esm/{chunk-DSTKXJMA.mjs.map → chunk-RM7D2ITN.mjs.map} +0 -0
  465. /package/dist/esm/{chunk-IOSQVDZI.mjs.map → chunk-U7EZI5D5.mjs.map} +0 -0
  466. /package/dist/esm/{chunk-ZYYK3UXP.mjs.map → chunk-UZHVGPGH.mjs.map} +0 -0
  467. /package/dist/esm/{chunk-QIAHBEEW.mjs.map → chunk-VVJEWB26.mjs.map} +0 -0
  468. /package/dist/esm/{chunk-Y5M5DD64.mjs.map → chunk-WAWBXQ6B.mjs.map} +0 -0
  469. /package/dist/esm/{chunk-TBFLWWV4.mjs.map → chunk-WR5L4STD.mjs.map} +0 -0
  470. /package/dist/esm/{chunk-RHBCVCOS.mjs.map → chunk-WZCUABDL.mjs.map} +0 -0
  471. /package/dist/esm/{chunk-UML2VQZT.mjs.map → chunk-XI4LX4EC.mjs.map} +0 -0
  472. /package/dist/esm/{chunk-I7YI22IW.mjs.map → chunk-Y5DMKMLF.mjs.map} +0 -0
  473. /package/dist/esm/{chunk-QVKMFPAV.mjs.map → chunk-YIIDPNGQ.mjs.map} +0 -0
@@ -0,0 +1,134 @@
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
+ // hashes an ASCII string to a field element
45
+ export function hashASCIIStrToField(str: string, maxSizeBytes: number) {
46
+ const textEncoder = new TextEncoder();
47
+ const strBytes = textEncoder.encode(str);
48
+ return hashBytesWithLen(strBytes, maxSizeBytes);
49
+ }
50
+
51
+ function hashBytesWithLen(bytes: Uint8Array, maxSizeBytes: number) {
52
+ if (bytes.length > maxSizeBytes) {
53
+ throw new Error(`Inputted bytes of length ${bytes} is longer than ${maxSizeBytes}`);
54
+ }
55
+ const packed = padAndPackBytesWithLen(bytes, maxSizeBytes);
56
+ return poseidonHash(packed);
57
+ }
58
+
59
+ function padAndPackBytesNoLen(bytes: Uint8Array, maxSizeBytes: number): bigint[] {
60
+ if (bytes.length > maxSizeBytes) {
61
+ throw new Error(`Input bytes of length ${bytes} is longer than ${maxSizeBytes}`);
62
+ }
63
+ const paddedStrBytes = padUint8ArrayWithZeros(bytes, maxSizeBytes);
64
+ return packBytes(paddedStrBytes);
65
+ }
66
+
67
+ export function padAndPackBytesWithLen(bytes: Uint8Array, maxSizeBytes: number): bigint[] {
68
+ if (bytes.length > maxSizeBytes) {
69
+ throw new Error(`Input bytes of length ${bytes} is longer than ${maxSizeBytes}`);
70
+ }
71
+ return padAndPackBytesNoLen(bytes, maxSizeBytes).concat([BigInt(bytes.length)]);
72
+ }
73
+
74
+ function packBytes(bytes: Uint8Array): bigint[] {
75
+ if (bytes.length > MAX_NUM_INPUT_BYTES) {
76
+ throw new Error(`Can't pack more than ${MAX_NUM_INPUT_BYTES}. Was given ${bytes.length} bytes`);
77
+ }
78
+ return chunkUint8Array(bytes, BYTES_PACKED_PER_SCALAR).map((chunk) => bytesToBigIntLE(chunk));
79
+ }
80
+
81
+ function chunkUint8Array(array: Uint8Array, chunkSize: number): Uint8Array[] {
82
+ const result: Uint8Array[] = [];
83
+ for (let i = 0; i < array.length; i += chunkSize) {
84
+ result.push(array.subarray(i, i + chunkSize));
85
+ }
86
+ return result;
87
+ }
88
+
89
+ export function bytesToBigIntLE(bytes: Uint8Array): bigint {
90
+ let result = BigInt(0);
91
+ for (let i = bytes.length - 1; i >= 0; i -= 1) {
92
+ result = (result << BigInt(8)) | BigInt(bytes[i]);
93
+ }
94
+ return result;
95
+ }
96
+
97
+ export function bigIntToBytesLE(value: bigint, length: number): Uint8Array {
98
+ const bytes = new Uint8Array(length);
99
+ for (let i = 0; i < length; i += 1) {
100
+ bytes[i] = Number(value & BigInt(0xff));
101
+ // eslint-disable-next-line no-param-reassign
102
+ value >>= BigInt(8);
103
+ }
104
+ return bytes;
105
+ }
106
+
107
+ // From chatGPT
108
+ function padUint8ArrayWithZeros(inputArray: Uint8Array, paddedSize: number): Uint8Array {
109
+ if (paddedSize < inputArray.length) {
110
+ throw new Error("Padded size must be greater than or equal to the input array size.");
111
+ }
112
+
113
+ // Create a new Uint8Array with the padded size
114
+ const paddedArray = new Uint8Array(paddedSize);
115
+
116
+ // Copy the content of the input array to the new array
117
+ paddedArray.set(inputArray);
118
+
119
+ // Fill the remaining space with zeros
120
+ for (let i = inputArray.length; i < paddedSize; i += 1) {
121
+ paddedArray[i] = 0;
122
+ }
123
+
124
+ return paddedArray;
125
+ }
126
+
127
+ export function poseidonHash(inputs: (number | bigint | string)[]): bigint {
128
+ const poseidonFixedHash = numInputsToPoseidonFunc[inputs.length - 1];
129
+
130
+ if (poseidonFixedHash) {
131
+ return poseidonFixedHash(inputs);
132
+ }
133
+ throw new Error(`Unable to hash input of length ${inputs.length}`);
134
+ }
@@ -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
  }
package/src/core/index.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  // Copyright © Aptos Foundation
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- export * from "./account";
5
4
  export * from "./accountAddress";
6
5
  export * from "./authenticationKey";
7
6
  export * from "./common";
package/src/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  // Copyright © Aptos Foundation
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
+ export * from "./account";
4
5
  export * from "./api";
5
6
  export * from "./bcs";
6
7
  export * from "./client";
@@ -11,7 +11,7 @@
11
11
  import { AptosConfig } from "../api/aptosConfig";
12
12
  import { AptosApiError, getAptosFullNode, paginateWithCursor } from "../client";
13
13
  import { AccountAddress, AccountAddressInput } from "../core/accountAddress";
14
- import { Account } from "../core/account";
14
+ import { Account } from "../account";
15
15
  import { AnyPublicKey, Ed25519PublicKey, PrivateKey } from "../core/crypto";
16
16
  import { getTableItem, queryIndexer } from "./general";
17
17
  import {
@@ -9,7 +9,8 @@
9
9
  */
10
10
 
11
11
  import { AptosConfig } from "../api/aptosConfig";
12
- import { Account, AccountAddress, AccountAddressInput } from "../core";
12
+ import { Account } from "../account";
13
+ import { AccountAddress, AccountAddressInput } from "../core";
13
14
  import { InputGenerateTransactionOptions } from "../transactions/types";
14
15
  import { GetANSNameResponse, MoveAddressType, OrderByArg, PaginationArgs, WhereArg } from "../types";
15
16
  import { GetNamesQuery } from "../types/generated/operations";
@@ -10,7 +10,8 @@
10
10
 
11
11
  import { AptosConfig } from "../api/aptosConfig";
12
12
  import { Bool, MoveString, MoveVector, U64 } from "../bcs";
13
- import { Account, AccountAddress, AccountAddressInput } from "../core";
13
+ import { AccountAddress, AccountAddressInput } from "../core";
14
+ import { Account } from "../account";
14
15
  import { EntryFunctionABI, InputGenerateTransactionOptions } from "../transactions/types";
15
16
  import {
16
17
  AnyNumber,
@@ -33,7 +33,8 @@ import {
33
33
  FungibleAssetActivitiesBoolExp,
34
34
  FungibleAssetMetadataBoolExp,
35
35
  } from "../types/generated/types";
36
- import { Account, AccountAddressInput } from "../core";
36
+ import { AccountAddressInput } from "../core";
37
+ import { Account } from "../account";
37
38
  import {
38
39
  EntryFunctionABI,
39
40
  InputGenerateTransactionOptions,
@@ -0,0 +1,189 @@
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/oidb}. By moving the methods out into a separate file,
7
+ * other namespaces and processes can access these methods without depending on the entire
8
+ * faucet namespace and without having a dependency cycle error.
9
+ */
10
+ import { jwtDecode } from "jwt-decode";
11
+ import { bls12_381 as bls } from "@noble/curves/bls12-381";
12
+ import { ProjPointType } from "@noble/curves/abstract/weierstrass";
13
+ import { AptosConfig } from "../api/aptosConfig";
14
+ import { getAptosPepperService, postAptosPepperService, postAptosProvingService } from "../client";
15
+ import {
16
+ APTOS_BIP44_DEFAULT_DERIVATION_PATH,
17
+ EPK_HORIZON_SECS,
18
+ EphemeralSignature,
19
+ Groth16Zkp,
20
+ Hex,
21
+ SignedGroth16Signature,
22
+ } from "../core";
23
+ import { HexInput } from "../types";
24
+ import { Serializer } from "../bcs";
25
+ import { EphemeralKeyPair, KeylessAccount } from "../account";
26
+ import { PepperFetchResponse, ProverResponse } from "../types/keyless";
27
+
28
+ const APTOS_KEYLESS_PEPPER_PINKAS_VUF_DST = "APTOS_KEYLESS_PEPPER_PINKAS_VUF_DST";
29
+
30
+ function stringToUint8Array(str: string): Uint8Array {
31
+ const encoder = new TextEncoder();
32
+ return encoder.encode(str);
33
+ }
34
+
35
+ const PINKAS_VUF_SECRET_KEY_BASE_AFFINE = bls.G2.hashToCurve(
36
+ stringToUint8Array("APTOS_KEYLESS_PEPPER_PINKAS_VUF_SECRET_KEY_BASE"),
37
+ { DST: APTOS_KEYLESS_PEPPER_PINKAS_VUF_DST },
38
+ ).toAffine();
39
+
40
+ function getPepperInput(args: { jwt: string; uidKey?: string }): ProjPointType<bigint> {
41
+ const { jwt, uidKey } = args;
42
+ const jwtPayload = jwtDecode<{ [key: string]: string }>(jwt);
43
+ const serializer = new Serializer();
44
+ serializer.serializeStr(jwtPayload.iss);
45
+ serializer.serializeStr(jwtPayload.aud);
46
+ serializer.serializeStr(jwtPayload[uidKey || "sub"]);
47
+ serializer.serializeStr(uidKey || "sub");
48
+ const serial = serializer.toUint8Array();
49
+ const msg = bls.G1.hashToCurve(serial, { DST: "APTOS_PEPPER_SERVICE_BLS12381_VUF_DST" }).toAffine();
50
+ const pp = bls.G1.ProjectivePoint.fromAffine(msg);
51
+ return pp;
52
+ }
53
+
54
+ async function verifyPepperBase(args: {
55
+ aptosConfig: AptosConfig;
56
+ pepperInput: ProjPointType<bigint>;
57
+ pepperBase: Uint8Array;
58
+ }): Promise<boolean> {
59
+ const { aptosConfig, pepperInput, pepperBase } = args;
60
+ const { data: pubKeyResponse } = await getAptosPepperService<any, { vrf_public_key_hex_string: string }>({
61
+ aptosConfig,
62
+ path: "vrf-pub-key",
63
+ originMethod: "getPepper",
64
+ });
65
+ const publicKeyFromService = bls.G2.ProjectivePoint.fromHex(pubKeyResponse.vrf_public_key_hex_string);
66
+ return bls.verifyShortSignature(pepperBase, pepperInput, publicKeyFromService);
67
+ }
68
+
69
+ export async function getPepper(args: {
70
+ aptosConfig: AptosConfig;
71
+ jwt: string;
72
+ ephemeralKeyPair: EphemeralKeyPair;
73
+ uidKey?: string;
74
+ derivationPath?: string;
75
+ verify?: boolean;
76
+ }): Promise<Uint8Array> {
77
+ const { aptosConfig, jwt, ephemeralKeyPair, uidKey, verify } = args;
78
+ let { derivationPath } = args;
79
+
80
+ const body = {
81
+ jwt_b64: jwt,
82
+ epk: ephemeralKeyPair.publicKey.bcsToHex().toStringWithoutPrefix(),
83
+ exp_date_secs: Number(ephemeralKeyPair.expiryDateSecs),
84
+ epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),
85
+ uid_key: uidKey,
86
+ };
87
+ // console.log(JSON.stringify(body));
88
+ const { data } = await postAptosPepperService<any, PepperFetchResponse>({
89
+ aptosConfig,
90
+ path: "fetch",
91
+ body,
92
+ originMethod: "getPepper",
93
+ overrides: { WITH_CREDENTIALS: false },
94
+ });
95
+ const pepperBase = Hex.fromHexInput(data.signature).toUint8Array();
96
+
97
+ if (verify) {
98
+ const pepperVerified = verifyPepperBase({ aptosConfig, pepperBase, pepperInput: getPepperInput(args) });
99
+ if (!pepperVerified) {
100
+ throw new Error("Unable to verify");
101
+ }
102
+ }
103
+ // This takes the BLS VUF H(m)^sk and transforms it into a Pinkas VUF e(H(m), g_3^sk), where g_3 is the base of the secret key (computed pseudo-randomly via hash-to-curve).
104
+ // This gives us the freedom of either decentralizing the pepper service as a BLS-based MPC or on top of the validators, by reusing the Pinkas WVUF-based randomness infrastructure.
105
+ const newPepperBase = bls.pairing(
106
+ bls.G1.ProjectivePoint.fromHex(pepperBase),
107
+ bls.G2.ProjectivePoint.fromAffine(PINKAS_VUF_SECRET_KEY_BASE_AFFINE),
108
+ );
109
+
110
+ if (derivationPath === undefined) {
111
+ derivationPath = APTOS_BIP44_DEFAULT_DERIVATION_PATH;
112
+ }
113
+ const pepper = KeylessAccount.fromDerivationPath(derivationPath, bls.fields.Fp12.toBytes(newPepperBase));
114
+ return pepper.slice(0, 31);
115
+ }
116
+
117
+ export async function getProof(args: {
118
+ aptosConfig: AptosConfig;
119
+ jwt: string;
120
+ ephemeralKeyPair: EphemeralKeyPair;
121
+ pepper: HexInput;
122
+ uidKey?: string;
123
+ extraFieldKey?: string;
124
+ }): Promise<SignedGroth16Signature> {
125
+ const { aptosConfig, jwt, ephemeralKeyPair, pepper, uidKey, extraFieldKey } = args;
126
+ const jwtPayload = jwtDecode<{ [key: string]: string }>(jwt);
127
+ let extraField;
128
+ if (extraFieldKey) {
129
+ const extraFieldVal = jwtPayload[extraFieldKey];
130
+ extraField = `"${extraFieldKey}":"${extraFieldVal}",`;
131
+ }
132
+ const json = {
133
+ jwt_b64: jwt,
134
+ epk: ephemeralKeyPair.publicKey.bcsToHex().toStringWithoutPrefix(),
135
+ epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),
136
+ exp_date_secs: Number(ephemeralKeyPair.expiryDateSecs),
137
+ exp_horizon_secs: EPK_HORIZON_SECS,
138
+ pepper: Hex.fromHexInput(pepper).toStringWithoutPrefix(),
139
+ extra_field: extraFieldKey,
140
+ uid_key: uidKey || "sub",
141
+ };
142
+
143
+ const { data } = await postAptosProvingService<any, ProverResponse>({
144
+ aptosConfig,
145
+ path: "prove",
146
+ body: json,
147
+ originMethod: "getProof",
148
+ overrides: { WITH_CREDENTIALS: false },
149
+ });
150
+
151
+ const proofPoints = data.proof;
152
+ const proof = new Groth16Zkp({
153
+ a: proofPoints.a,
154
+ b: proofPoints.b,
155
+ c: proofPoints.c,
156
+ });
157
+
158
+ const signedProof = new SignedGroth16Signature({
159
+ proof,
160
+ extraField,
161
+ trainingWheelsSignature: EphemeralSignature.fromHex(data.training_wheels_signature),
162
+ });
163
+ return signedProof;
164
+ }
165
+
166
+ export async function deriveKeylessAccount(args: {
167
+ aptosConfig: AptosConfig;
168
+ jwt: string;
169
+ ephemeralKeyPair: EphemeralKeyPair;
170
+ uidKey?: string;
171
+ pepper?: HexInput;
172
+ extraFieldKey?: string;
173
+ fetchProofAsync?: boolean;
174
+ }): Promise<KeylessAccount> {
175
+ const { fetchProofAsync } = args;
176
+ let { pepper } = args;
177
+ if (pepper === undefined) {
178
+ pepper = await getPepper(args);
179
+ } else if (Hex.fromHexInput(pepper).toUint8Array().length !== 31) {
180
+ throw new Error("Pepper needs to be 31 bytes");
181
+ }
182
+
183
+ const proofPromise = getProof({ ...args, pepper });
184
+ const proof = fetchProofAsync ? proofPromise : await proofPromise;
185
+
186
+ const keylessAccount = KeylessAccount.fromJWTAndProof({ ...args, proofFetcherOrData: proof, pepper });
187
+
188
+ return keylessAccount;
189
+ }
@@ -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 "../core/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";
@@ -18,8 +18,6 @@ import {
18
18
  generateTransactionPayload,
19
19
  generateSignedTransactionForSimulation,
20
20
  generateSignedTransaction,
21
- sign,
22
- generateSigningMessage,
23
21
  } from "../transactions/transactionBuilder/transactionBuilder";
24
22
  import {
25
23
  InputGenerateTransactionData,
@@ -35,7 +33,7 @@ import {
35
33
  } from "../transactions/types";
36
34
  import { getInfo } from "./account";
37
35
  import { UserTransactionResponse, PendingTransactionResponse, MimeType, HexInput, TransactionResponse } from "../types";
38
- import { TypeTagU8, TypeTagVector } from "../transactions";
36
+ import { TypeTagU8, TypeTagVector, generateSigningMessageForTransaction } from "../transactions";
39
37
  import { SimpleTransaction } from "../transactions/instances/simpleTransaction";
40
38
  import { MultiAgentTransaction } from "../transactions/instances/multiAgentTransaction";
41
39
 
@@ -102,10 +100,10 @@ export async function buildTransactionPayload(
102
100
  args: { aptosConfig: AptosConfig } & InputGenerateTransactionData,
103
101
  ): Promise<AnyTransactionPayloadInstance> {
104
102
  const { aptosConfig, data } = args;
105
-
106
103
  // Merge in aptosConfig for remote ABI on non-script payloads
107
104
  let generateTransactionPayloadData: InputGenerateTransactionPayloadDataWithRemoteABI;
108
105
  let payload: AnyTransactionPayloadInstance;
106
+
109
107
  if ("bytecode" in data) {
110
108
  // TODO: Add ABI checking later
111
109
  payload = await generateTransactionPayload(data);
@@ -116,6 +114,7 @@ export async function buildTransactionPayload(
116
114
  function: data.function,
117
115
  functionArguments: data.functionArguments,
118
116
  typeArguments: data.typeArguments,
117
+ abi: data.abi,
119
118
  };
120
119
  payload = await generateTransactionPayload(generateTransactionPayloadData);
121
120
  } else {
@@ -124,6 +123,7 @@ export async function buildTransactionPayload(
124
123
  function: data.function,
125
124
  functionArguments: data.functionArguments,
126
125
  typeArguments: data.typeArguments,
126
+ abi: data.abi,
127
127
  };
128
128
  payload = await generateTransactionPayload(generateTransactionPayloadData);
129
129
  }
@@ -183,7 +183,7 @@ function isMultiAgentTransactionInput(
183
183
  */
184
184
  export function getSigningMessage(args: { transaction: AnyRawTransaction }): Uint8Array {
185
185
  const { transaction } = args;
186
- return generateSigningMessage(transaction);
186
+ return generateSigningMessageForTransaction(transaction);
187
187
  }
188
188
 
189
189
  /**
@@ -202,8 +202,8 @@ export function getSigningMessage(args: { transaction: AnyRawTransaction }): Uin
202
202
  * @return The signer AccountAuthenticator
203
203
  */
204
204
  export function signTransaction(args: { signer: Account; transaction: AnyRawTransaction }): AccountAuthenticator {
205
- const accountAuthenticator = sign({ ...args });
206
- return accountAuthenticator;
205
+ const { signer, transaction } = args;
206
+ return signer.signWithAuthenticator(transaction);
207
207
  }
208
208
 
209
209
  /**
@@ -275,6 +275,9 @@ export async function signAndSubmitTransaction(args: {
275
275
  transaction: AnyRawTransaction;
276
276
  }): Promise<PendingTransactionResponse> {
277
277
  const { aptosConfig, signer, transaction } = args;
278
+ if (signer instanceof KeylessAccount || signer instanceof MultiKeyAccount) {
279
+ await signer.waitForProofFetch();
280
+ }
278
281
  const authenticator = signTransaction({ signer, transaction });
279
282
  return submitTransaction({
280
283
  aptosConfig,
@@ -7,7 +7,7 @@ import { Serializer, Deserializer, Serializable } from "../../bcs";
7
7
  import { AnyPublicKey, AnySignature } from "../../core/crypto";
8
8
  import { Ed25519PublicKey, Ed25519Signature } from "../../core/crypto/ed25519";
9
9
  import { MultiEd25519PublicKey, MultiEd25519Signature } from "../../core/crypto/multiEd25519";
10
- import { MultiKey } from "../../core/crypto/multiKey";
10
+ import { MultiKey, MultiSignature } from "../../core/crypto/multiKey";
11
11
  import { AccountAuthenticatorVariant } from "../../types";
12
12
 
13
13
  export abstract class AccountAuthenticator extends Serializable {
@@ -149,28 +149,23 @@ export class AccountAuthenticatorSingleKey extends AccountAuthenticator {
149
149
  export class AccountAuthenticatorMultiKey extends AccountAuthenticator {
150
150
  public readonly public_keys: MultiKey;
151
151
 
152
- public readonly signatures: Array<AnySignature>;
152
+ public readonly signatures: MultiSignature;
153
153
 
154
- public readonly signatures_bitmap: Uint8Array;
155
-
156
- constructor(public_keys: MultiKey, signatures: Array<AnySignature>, signatures_bitmap: Uint8Array) {
154
+ constructor(public_keys: MultiKey, signatures: MultiSignature) {
157
155
  super();
158
156
  this.public_keys = public_keys;
159
157
  this.signatures = signatures;
160
- this.signatures_bitmap = signatures_bitmap;
161
158
  }
162
159
 
163
160
  serialize(serializer: Serializer): void {
164
161
  serializer.serializeU32AsUleb128(AccountAuthenticatorVariant.MultiKey);
165
162
  this.public_keys.serialize(serializer);
166
- serializer.serializeVector<AnySignature>(this.signatures);
167
- serializer.serializeBytes(this.signatures_bitmap);
163
+ this.signatures.serialize(serializer);
168
164
  }
169
165
 
170
166
  static load(deserializer: Deserializer): AccountAuthenticatorMultiKey {
171
167
  const public_keys = MultiKey.deserialize(deserializer);
172
- const signatures = deserializer.deserializeVector(AnySignature);
173
- const signatures_bitmap = deserializer.deserializeBytes();
174
- return new AccountAuthenticatorMultiKey(public_keys, signatures, signatures_bitmap);
168
+ const signatures = MultiSignature.deserialize(deserializer);
169
+ return new AccountAuthenticatorMultiKey(public_keys, signatures);
175
170
  }
176
171
  }
@@ -24,7 +24,7 @@
24
24
  */
25
25
 
26
26
  import { AptosConfig } from "../../api/aptosConfig";
27
- import { Account } from "../../core";
27
+ import { Account } from "../../account";
28
28
  import { getInfo } from "../../internal/account";
29
29
  import { sleep } from "../../utils/helpers";
30
30
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  import EventEmitter from "eventemitter3";
4
4
  import { AptosConfig } from "../../api/aptosConfig";
5
- import { Account } from "../../core";
5
+ import { Account } from "../../account";
6
6
  import { waitForTransaction } from "../../internal/transaction";
7
7
  import { generateTransaction, signAndSubmitTransaction } from "../../internal/transactionSubmission";
8
8
  import { PendingTransactionResponse, TransactionResponse } from "../../types";
@@ -233,7 +233,13 @@ export class TransactionWorker extends EventEmitter<TransactionWorkerEvents> {
233
233
  async checkTransaction(sentTransaction: PromiseFulfilledResult<PendingTransactionResponse>, sequenceNumber: bigint) {
234
234
  try {
235
235
  const waitFor: Array<Promise<TransactionResponse>> = [];
236
- waitFor.push(waitForTransaction({ aptosConfig: this.aptosConfig, transactionHash: sentTransaction.value.hash }));
236
+ waitFor.push(
237
+ waitForTransaction({
238
+ aptosConfig: this.aptosConfig,
239
+ transactionHash: sentTransaction.value.hash,
240
+ options: { timeoutSecs: 3 },
241
+ }),
242
+ );
237
243
  const sentTransactions = await Promise.allSettled(waitFor);
238
244
 
239
245
  for (let i = 0; i < sentTransactions.length; i += 1) {
@@ -4,3 +4,4 @@
4
4
  export * from "./helpers";
5
5
  export * from "./transactionBuilder";
6
6
  export * from "./remoteAbi";
7
+ export * from "./signingMessage";
@@ -0,0 +1,70 @@
1
+ // Copyright © Aptos Foundation
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ /**
5
+ * This file handles the transaction creation lifecycle.
6
+ * It holds different operations to generate a transaction payload, a raw transaction,
7
+ * and a signed transaction that can be simulated, signed and submitted to chain.
8
+ */
9
+ import { sha3_256 as sha3Hash } from "@noble/hashes/sha3";
10
+ import { RAW_TRANSACTION_SALT, RAW_TRANSACTION_WITH_DATA_SALT } from "../../utils/const";
11
+ import { FeePayerRawTransaction, MultiAgentRawTransaction, RawTransaction } from "../instances";
12
+ import { AnyRawTransaction, AnyRawTransactionInstance } from "../types";
13
+ import { Serializable } from "../../bcs";
14
+
15
+ /**
16
+ * Derive the raw transaction type - FeePayerRawTransaction or MultiAgentRawTransaction or RawTransaction
17
+ *
18
+ * @param transaction A aptos transaction type
19
+ *
20
+ * @returns FeePayerRawTransaction | MultiAgentRawTransaction | RawTransaction
21
+ */
22
+ export function deriveTransactionType(transaction: AnyRawTransaction): AnyRawTransactionInstance {
23
+ if (transaction.feePayerAddress) {
24
+ return new FeePayerRawTransaction(
25
+ transaction.rawTransaction,
26
+ transaction.secondarySignerAddresses ?? [],
27
+ transaction.feePayerAddress,
28
+ );
29
+ }
30
+ if (transaction.secondarySignerAddresses) {
31
+ return new MultiAgentRawTransaction(transaction.rawTransaction, transaction.secondarySignerAddresses);
32
+ }
33
+
34
+ return transaction.rawTransaction;
35
+ }
36
+
37
+ export function generateSigningMessage(bytes: Uint8Array, domainSeparator: string): Uint8Array {
38
+ const hash = sha3Hash.create();
39
+
40
+ if (!domainSeparator.startsWith("APTOS::")) {
41
+ throw new Error(`Domain separator needs to start with 'APTOS::'. Provided - ${domainSeparator}`);
42
+ }
43
+
44
+ hash.update(domainSeparator);
45
+
46
+ const prefix = hash.digest();
47
+
48
+ const body = bytes;
49
+
50
+ const mergedArray = new Uint8Array(prefix.length + body.length);
51
+ mergedArray.set(prefix);
52
+ mergedArray.set(body, prefix.length);
53
+
54
+ return mergedArray;
55
+ }
56
+
57
+ export function generateSigningMessageForSerializable(obj: Serializable): Uint8Array {
58
+ return generateSigningMessage(obj.bcsToBytes(), obj.constructor.name);
59
+ }
60
+
61
+ export function generateSigningMessageForTransaction(transaction: AnyRawTransaction): Uint8Array {
62
+ const rawTxn = deriveTransactionType(transaction);
63
+ if (rawTxn instanceof RawTransaction) {
64
+ return generateSigningMessage(rawTxn.bcsToBytes(), RAW_TRANSACTION_SALT);
65
+ }
66
+ if (rawTxn instanceof MultiAgentRawTransaction || rawTxn instanceof FeePayerRawTransaction) {
67
+ return generateSigningMessage(rawTxn.bcsToBytes(), RAW_TRANSACTION_WITH_DATA_SALT);
68
+ }
69
+ throw new Error(`Unknown transaction type to sign on: ${rawTxn}`);
70
+ }