@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
@@ -3,7 +3,14 @@
3
3
 
4
4
  import aptosClient from "@aptos-labs/aptos-client";
5
5
  import { AptosSettings, ClientConfig, Client, FullNodeConfig, IndexerConfig, FaucetConfig } from "../types";
6
- import { NetworkToNodeAPI, NetworkToFaucetAPI, NetworkToIndexerAPI, Network } from "../utils/apiEndpoints";
6
+ import {
7
+ NetworkToNodeAPI,
8
+ NetworkToFaucetAPI,
9
+ NetworkToIndexerAPI,
10
+ Network,
11
+ NetworkToPepperAPI,
12
+ NetworkToProverAPI,
13
+ } from "../utils/apiEndpoints";
7
14
  import { AptosApiType } from "../utils/const";
8
15
 
9
16
  /**
@@ -34,6 +41,16 @@ export class AptosConfig {
34
41
  */
35
42
  readonly faucet?: string;
36
43
 
44
+ /**
45
+ * The optional hardcoded pepper service URL to send requests to instead of using the network
46
+ */
47
+ readonly pepper?: string;
48
+
49
+ /**
50
+ * The optional hardcoded prover service URL to send requests to instead of using the network
51
+ */
52
+ readonly prover?: string;
53
+
37
54
  /**
38
55
  * The optional hardcoded indexer URL to send requests to instead of using the network
39
56
  */
@@ -63,6 +80,8 @@ export class AptosConfig {
63
80
  this.network = settings?.network ?? Network.DEVNET;
64
81
  this.fullnode = settings?.fullnode;
65
82
  this.faucet = settings?.faucet;
83
+ this.pepper = settings?.pepper;
84
+ this.prover = settings?.prover;
66
85
  this.indexer = settings?.indexer;
67
86
  this.client = settings?.client ?? { provider: aptosClient };
68
87
  this.clientConfig = settings?.clientConfig ?? {};
@@ -95,8 +114,34 @@ export class AptosConfig {
95
114
  if (this.indexer !== undefined) return this.indexer;
96
115
  if (this.network === Network.CUSTOM) throw new Error("Please provide a custom indexer url");
97
116
  return NetworkToIndexerAPI[this.network];
117
+ case AptosApiType.PEPPER:
118
+ if (this.pepper !== undefined) return this.pepper;
119
+ if (this.network === Network.CUSTOM) throw new Error("Please provide a custom pepper service url");
120
+ return NetworkToPepperAPI[this.network];
121
+ case AptosApiType.PROVER:
122
+ if (this.prover !== undefined) return this.prover;
123
+ if (this.network === Network.CUSTOM) throw new Error("Please provide a custom prover service url");
124
+ return NetworkToProverAPI[this.network];
98
125
  default:
99
126
  throw Error(`apiType ${apiType} is not supported`);
100
127
  }
101
128
  }
129
+
130
+ /**
131
+ * Checks if the URL is a known pepper service endpoint
132
+ *
133
+ * @internal
134
+ * */
135
+ isPepperServiceRequest(url: string): boolean {
136
+ return NetworkToPepperAPI[this.network] === url;
137
+ }
138
+
139
+ /**
140
+ * Checks if the URL is a known prover service endpoint
141
+ *
142
+ * @internal
143
+ * */
144
+ isProverServiceRequest(url: string): boolean {
145
+ return NetworkToProverAPI[this.network] === url;
146
+ }
102
147
  }
@@ -13,7 +13,8 @@ import {
13
13
  PaginationArgs,
14
14
  TokenStandardArg,
15
15
  } from "../types";
16
- import { Account, AccountAddress, AccountAddressInput } from "../core";
16
+ import { AccountAddress, AccountAddressInput } from "../core";
17
+ import { Account } from "../account";
17
18
  import { InputGenerateTransactionOptions } from "../transactions/types";
18
19
  import {
19
20
  addDigitalAssetPropertyTransaction,
@@ -23,7 +23,8 @@ import {
23
23
  import { ProcessorType } from "../utils/const";
24
24
  import { AptosConfig } from "./aptosConfig";
25
25
  import { waitForIndexerOnVersion } from "./utils";
26
- import { Account, AccountAddressInput } from "../core";
26
+ import { Account } from "../account";
27
+ import { AccountAddressInput } from "../core";
27
28
  import { InputGenerateTransactionOptions } from "../transactions";
28
29
  import { SimpleTransaction } from "../transactions/instances/simpleTransaction";
29
30
 
@@ -0,0 +1,36 @@
1
+ // Copyright © Aptos Foundation
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { EphemeralKeyPair, KeylessAccount } from "../account";
5
+ import { deriveKeylessAccount, getPepper } from "../internal/keyless";
6
+ import { HexInput } from "../types";
7
+ import { AptosConfig } from "./aptosConfig";
8
+
9
+ /**
10
+ * A class to query all `OIDB` related queries on Aptos.
11
+ */
12
+ export class Keyless {
13
+ constructor(readonly config: AptosConfig) {}
14
+
15
+ /**
16
+ * TODO
17
+ *
18
+ * @param args.jwt jwt token
19
+ * @returns The pepper
20
+ */
21
+ async getPepper(args: { jwt: string; ephemeralKeyPair: EphemeralKeyPair }): Promise<Uint8Array> {
22
+ return getPepper({ aptosConfig: this.config, ...args });
23
+ }
24
+
25
+ async deriveKeylessAccount(args: {
26
+ jwt: string;
27
+ ephemeralKeyPair: EphemeralKeyPair;
28
+ uidKey?: string;
29
+ pepper?: HexInput;
30
+ extraFieldKey?: string;
31
+ disableConnect?: boolean;
32
+ fetchProofAsync?: boolean;
33
+ }): Promise<KeylessAccount> {
34
+ return deriveKeylessAccount({ aptosConfig: this.config, ...args });
35
+ }
36
+ }
@@ -33,7 +33,8 @@ import {
33
33
  InputGenerateTransactionOptions,
34
34
  InputGenerateTransactionPayloadData,
35
35
  } from "../transactions";
36
- import { AccountAddressInput, Account, PrivateKey } from "../core";
36
+ import { AccountAddressInput, PrivateKey } from "../core";
37
+ import { Account } from "../account";
37
38
  import { Build } from "./transactionSubmission/build";
38
39
  import { Simulate } from "./transactionSubmission/simulate";
39
40
  import { Submit } from "./transactionSubmission/submit";
@@ -2,7 +2,7 @@ import EventEmitter from "eventemitter3";
2
2
  import { TransactionWorkerEvents, TransactionWorker, TransactionWorkerEventsEnum } from "../../transactions/management";
3
3
  import { InputGenerateTransactionPayloadData, InputGenerateTransactionOptions } from "../../transactions";
4
4
  import { AptosConfig } from "../aptosConfig";
5
- import { Account } from "../../core";
5
+ import { Account } from "../../account";
6
6
 
7
7
  export class TransactionManagement extends EventEmitter<TransactionWorkerEvents> {
8
8
  account!: Account;
@@ -1,7 +1,7 @@
1
1
  // Copyright © Aptos Foundation
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { Account } from "../../core";
4
+ import { Account } from "../../account";
5
5
  import { signTransaction } from "../../internal/transactionSubmission";
6
6
  import { AccountAuthenticator, AnyRawTransaction } from "../../transactions";
7
7
  import { AptosConfig } from "../aptosConfig";
@@ -316,6 +316,24 @@ export class Serializer {
316
316
  item.serialize(this);
317
317
  });
318
318
  }
319
+
320
+ serializeOption<T extends Serializable>(value?: T): void {
321
+ if (value === undefined) {
322
+ this.serializeU32AsUleb128(0);
323
+ } else {
324
+ this.serializeU32AsUleb128(1);
325
+ value.serialize(this);
326
+ }
327
+ }
328
+
329
+ serializeOptionStr(value?: string): void {
330
+ if (value === undefined) {
331
+ this.serializeU32AsUleb128(0);
332
+ } else {
333
+ this.serializeU32AsUleb128(1);
334
+ this.serializeStr(value);
335
+ }
336
+ }
319
337
  }
320
338
 
321
339
  export function ensureBoolean(value: unknown): asserts value is boolean {
@@ -106,6 +106,14 @@ export async function aptosRequest<Req extends {}, Res extends {}>(
106
106
  return result;
107
107
  }
108
108
 
109
+ if (result.status >= 500) {
110
+ throw new AptosApiError(options, result, `${response.data}`);
111
+ }
112
+
113
+ if (aptosConfig.isPepperServiceRequest(url)) {
114
+ throw new AptosApiError(options, result, `${response.data}`);
115
+ }
116
+
109
117
  let errorMessage: string;
110
118
 
111
119
  if (result && result.data && "message" in result.data && "error_code" in result.data) {
package/src/client/get.ts CHANGED
@@ -89,6 +89,12 @@ export async function getAptosFullNode<Req extends {}, Res extends {}>(
89
89
  });
90
90
  }
91
91
 
92
+ export async function getAptosPepperService<Req extends {}, Res extends {}>(
93
+ options: GetAptosRequestOptions,
94
+ ): Promise<AptosResponse<Req, Res>> {
95
+ return get<Req, Res>({ ...options, type: AptosApiType.PEPPER });
96
+ }
97
+
92
98
  /// This function is a helper for paginating using a function wrapping an API
93
99
  export async function paginateWithCursor<Req extends Record<string, any>, Res extends Array<{}>>(
94
100
  options: GetAptosRequestOptions,
@@ -135,3 +135,15 @@ export async function postAptosFaucet<Req extends {}, Res extends {}>(
135
135
  },
136
136
  });
137
137
  }
138
+
139
+ export async function postAptosPepperService<Req extends {}, Res extends {}>(
140
+ options: PostAptosRequestOptions,
141
+ ): Promise<AptosResponse<Req, Res>> {
142
+ return post<Req, Res>({ ...options, type: AptosApiType.PEPPER });
143
+ }
144
+
145
+ export async function postAptosProvingService<Req extends {}, Res extends {}>(
146
+ options: PostAptosRequestOptions,
147
+ ): Promise<AptosResponse<Req, Res>> {
148
+ return post<Req, Res>({ ...options, type: AptosApiType.PROVER });
149
+ }
@@ -1,4 +1,2 @@
1
- export * from "./Ed25519Account";
2
- export * from "./Account";
3
- export * from "./SingleKeyAccount";
4
1
  export * from "./utils";
2
+
@@ -7,7 +7,7 @@ import { Serializable, Serializer } from "../../bcs/serializer";
7
7
  import { AuthenticationKey } from "../authenticationKey";
8
8
  import { Hex } from "../hex";
9
9
  import { HexInput, SigningScheme as AuthenticationKeyScheme } from "../../types";
10
- import { CKDPriv, deriveKey, HARDENED_OFFSET, isValidHardenedPath, mnemonicToSeed, splitPath } from "./hdKey";
10
+ import { isValidHardenedPath, fromDerivationPath as fromDerivationPathInner, mnemonicToSeed } from "./hdKey";
11
11
  import { PrivateKey } from "./privateKey";
12
12
  import { AccountPublicKey, VerifySignatureArgs } from "./publicKey";
13
13
  import { Signature } from "./signature";
@@ -185,29 +185,9 @@ export class Ed25519PrivateKey extends Serializable implements PrivateKey {
185
185
  if (!isValidHardenedPath(path)) {
186
186
  throw new Error(`Invalid derivation path ${path}`);
187
187
  }
188
- return Ed25519PrivateKey.fromDerivationPathInner(path, mnemonicToSeed(mnemonics));
189
- }
190
-
191
- /**
192
- * A private inner function so we can separate from the main fromDerivationPath() method
193
- * to add tests to verify we create the keys correctly.
194
- *
195
- * @param path the BIP44 path
196
- * @param seed the seed phrase created by the mnemonics
197
- * @param offset the offset used for key derivation, defaults to 0x80000000
198
- * @returns
199
- */
200
- private static fromDerivationPathInner(path: string, seed: Uint8Array, offset = HARDENED_OFFSET): Ed25519PrivateKey {
201
- const { key, chainCode } = deriveKey(Ed25519PrivateKey.SLIP_0010_SEED, seed);
202
-
203
- const segments = splitPath(path).map((el) => parseInt(el, 10));
204
-
205
- // Derive the child key based on the path
206
- const { key: privateKey } = segments.reduce((parentKeys, segment) => CKDPriv(parentKeys, segment + offset), {
207
- key,
208
- chainCode,
209
- });
210
- return new Ed25519PrivateKey(privateKey);
188
+ return new Ed25519PrivateKey(
189
+ fromDerivationPathInner(path, Ed25519PrivateKey.SLIP_0010_SEED, mnemonicToSeed(mnemonics)),
190
+ );
211
191
  }
212
192
 
213
193
  // endregion
@@ -0,0 +1,149 @@
1
+ import { Serializer, Deserializer } from "../../bcs";
2
+ import { EphemeralPublicKeyVariant, EphemeralSignatureVariant, HexInput } from "../../types";
3
+ import { PublicKey } from "./publicKey";
4
+ import { Signature } from "./signature";
5
+ import { Ed25519PublicKey, Ed25519Signature } from "./ed25519";
6
+ import { Hex } from "../hex";
7
+
8
+ /**
9
+ * Represents ephemeral keys and signatures for Aptos Keyless accounts.
10
+ *
11
+ * TODO
12
+ */
13
+ export class EphemeralPublicKey extends PublicKey {
14
+ /**
15
+ * Reference to the inner public key
16
+ */
17
+ public readonly publicKey: PublicKey;
18
+
19
+ public readonly variant: EphemeralPublicKeyVariant;
20
+
21
+ constructor(publicKey: PublicKey) {
22
+ super();
23
+ const publicKeyType = publicKey.constructor.name;
24
+ switch (publicKeyType) {
25
+ case Ed25519PublicKey.name:
26
+ this.publicKey = publicKey;
27
+ this.variant = EphemeralPublicKeyVariant.Ed25519;
28
+ break;
29
+ default:
30
+ throw new Error(`Unsupported key for EphemeralPublicKey - ${publicKeyType}`);
31
+ }
32
+ }
33
+
34
+ /**
35
+ * Get the public key in bytes (Uint8Array).
36
+ *
37
+ * @returns Uint8Array representation of the public key
38
+ */
39
+ toUint8Array(): Uint8Array {
40
+ return this.bcsToBytes();
41
+ }
42
+
43
+ /**
44
+ * Get the public key as a hex string with the 0x prefix.
45
+ *
46
+ * @returns string representation of the public key
47
+ */
48
+ toString(): string {
49
+ return this.bcsToHex().toString();
50
+ }
51
+
52
+ /**
53
+ * Verifies a signed data with a public key
54
+ *
55
+ * @param args.message message
56
+ * @param args.signature The signature
57
+ * @returns true if the signature is valid
58
+ */
59
+ verifySignature(args: { message: HexInput; signature: EphemeralSignature }): boolean {
60
+ const { message, signature } = args;
61
+ return this.publicKey.verifySignature({ message, signature });
62
+ }
63
+
64
+ serialize(serializer: Serializer): void {
65
+ if (this.publicKey instanceof Ed25519PublicKey) {
66
+ serializer.serializeU32AsUleb128(EphemeralPublicKeyVariant.Ed25519);
67
+ this.publicKey.serialize(serializer);
68
+ } else {
69
+ throw new Error("Unknown public key type");
70
+ }
71
+ }
72
+
73
+ static deserialize(deserializer: Deserializer): EphemeralPublicKey {
74
+ const index = deserializer.deserializeUleb128AsU32();
75
+ switch (index) {
76
+ case EphemeralPublicKeyVariant.Ed25519:
77
+ return new EphemeralPublicKey(Ed25519PublicKey.deserialize(deserializer));
78
+ default:
79
+ throw new Error(`Unknown variant index for EphemeralPublicKey: ${index}`);
80
+ }
81
+ }
82
+
83
+ static isPublicKey(publicKey: PublicKey): publicKey is EphemeralPublicKey {
84
+ return publicKey instanceof EphemeralPublicKey;
85
+ }
86
+
87
+ isEd25519(): this is Ed25519PublicKey {
88
+ return this.publicKey instanceof Ed25519PublicKey;
89
+ }
90
+ }
91
+
92
+ export class EphemeralSignature extends Signature {
93
+ public readonly signature: Signature;
94
+
95
+ constructor(signature: Signature) {
96
+ super();
97
+ const signatureType = signature.constructor.name;
98
+ switch (signatureType) {
99
+ case Ed25519Signature.name:
100
+ this.signature = signature;
101
+ break;
102
+ default:
103
+ throw new Error(`Unsupported signature for EphemeralSignature - ${signatureType}`);
104
+ }
105
+ }
106
+
107
+ /**
108
+ * Get the public key in bytes (Uint8Array).
109
+ *
110
+ * @returns Uint8Array representation of the public key
111
+ */
112
+ toUint8Array(): Uint8Array {
113
+ return this.signature.toUint8Array();
114
+ }
115
+
116
+ /**
117
+ * Get the public key as a hex string with the 0x prefix.
118
+ *
119
+ * @returns string representation of the public key
120
+ */
121
+ toString(): string {
122
+ return this.signature.toString();
123
+ }
124
+
125
+ static fromHex(hexInput: HexInput): EphemeralSignature {
126
+ const data = Hex.fromHexInput(hexInput);
127
+ const deserializer = new Deserializer(data.toUint8Array());
128
+ return EphemeralSignature.deserialize(deserializer);
129
+ }
130
+
131
+ serialize(serializer: Serializer): void {
132
+ if (this.signature instanceof Ed25519Signature) {
133
+ serializer.serializeU32AsUleb128(EphemeralSignatureVariant.Ed25519);
134
+ this.signature.serialize(serializer);
135
+ } else {
136
+ throw new Error("Unknown signature type");
137
+ }
138
+ }
139
+
140
+ static deserialize(deserializer: Deserializer): EphemeralSignature {
141
+ const index = deserializer.deserializeUleb128AsU32();
142
+ switch (index) {
143
+ case EphemeralSignatureVariant.Ed25519:
144
+ return new EphemeralSignature(Ed25519Signature.deserialize(deserializer));
145
+ default:
146
+ throw new Error(`Unknown variant index for EphemeralSignature: ${index}`);
147
+ }
148
+ }
149
+ }
@@ -4,6 +4,7 @@
4
4
  import { hmac } from "@noble/hashes/hmac";
5
5
  import { sha512 } from "@noble/hashes/sha512";
6
6
  import * as bip39 from "@scure/bip39";
7
+ import { HexInput } from "../../types";
7
8
 
8
9
  export type DerivedKeys = {
9
10
  key: Uint8Array;
@@ -15,6 +16,7 @@ export type DerivedKeys = {
15
16
  */
16
17
  export const APTOS_HARDENED_REGEX = /^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/;
17
18
  export const APTOS_BIP44_REGEX = /^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/;
19
+ export const APTOS_BIP44_DEFAULT_DERIVATION_PATH = "m/44'/637'/0'/0'/0'";
18
20
 
19
21
  /**
20
22
  * A list of supported key types and associated seeds
@@ -91,6 +93,35 @@ const removeApostrophes = (val: string): string => val.replace("'", "");
91
93
  */
92
94
  export const splitPath = (path: string): Array<string> => path.split("/").slice(1).map(removeApostrophes);
93
95
 
96
+ /**
97
+ * @param path the BIP44 path
98
+ * @param seed the seed phrase created by the mnemonics
99
+ * @param offset the offset used for key derivation, defaults to 0x80000000
100
+ * @returns
101
+ */
102
+ export function fromDerivationPath(
103
+ path: string,
104
+ hashSeed: HexInput,
105
+ seed: Uint8Array,
106
+ offset = HARDENED_OFFSET,
107
+ ): Uint8Array {
108
+ if (offset === HARDENED_OFFSET && !isValidHardenedPath(path)) {
109
+ throw new Error(`Invalid hardened derivation path ${path}`);
110
+ } else if (offset !== HARDENED_OFFSET && !isValidBIP44Path(path)) {
111
+ throw new Error(`Invalid derivation path ${path}`);
112
+ }
113
+ const { key, chainCode } = deriveKey(hashSeed, seed);
114
+
115
+ const segments = splitPath(path).map((el) => parseInt(el, 10));
116
+
117
+ // Derive the child key based on the path
118
+ const { key: privateKey } = segments.reduce((parentKeys, segment) => CKDPriv(parentKeys, segment + offset), {
119
+ key,
120
+ chainCode,
121
+ });
122
+ return privateKey;
123
+ }
124
+
94
125
  /**
95
126
  * Normalizes the mnemonic by removing extra whitespace and making it lowercase
96
127
  * @param mnemonic the mnemonic seed phrase
@@ -5,6 +5,8 @@ export * from "./ed25519";
5
5
  export * from "./hdKey";
6
6
  export * from "./multiEd25519";
7
7
  export * from "./multiKey";
8
+ export * from "./ephemeral";
9
+ export * from "./keyless";
8
10
  export * from "./privateKey";
9
11
  export * from "./publicKey";
10
12
  export * from "./secp256k1";