@aptos-labs/ts-sdk 1.13.2 → 1.13.3-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 (474) hide show
  1. package/dist/common/index.d.ts +1800 -1346
  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 +47 -0
  10. package/dist/esm/account/EphemeralKeyPair.mjs +2 -0
  11. package/dist/esm/account/KeylessAccount.d.mts +106 -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 +40 -0
  18. package/dist/esm/account/index.mjs +2 -0
  19. package/dist/esm/api/account.d.mts +13 -1
  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 +1 -1
  30. package/dist/esm/api/digitalAsset.mjs +1 -1
  31. package/dist/esm/api/event.mjs +1 -1
  32. package/dist/esm/api/faucet.mjs +1 -1
  33. package/dist/esm/api/fungibleAsset.d.mts +5 -5
  34. package/dist/esm/api/fungibleAsset.mjs +1 -1
  35. package/dist/esm/api/general.d.mts +7 -7
  36. package/dist/esm/api/general.mjs +1 -1
  37. package/dist/esm/api/index.d.mts +13 -8
  38. package/dist/esm/api/index.mjs +1 -1
  39. package/dist/esm/api/keyless.d.mts +67 -0
  40. package/dist/esm/api/keyless.mjs +2 -0
  41. package/dist/esm/api/staking.mjs +1 -1
  42. package/dist/esm/api/transaction.d.mts +1 -1
  43. package/dist/esm/api/transaction.mjs +1 -1
  44. package/dist/esm/api/transactionSubmission/build.d.mts +3 -3
  45. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  46. package/dist/esm/api/transactionSubmission/management.d.mts +8 -8
  47. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  48. package/dist/esm/api/transactionSubmission/sign.d.mts +1 -1
  49. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  50. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  51. package/dist/esm/api/transactionSubmission/simulate.d.mts +6 -6
  52. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  53. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  54. package/dist/esm/api/utils.mjs +1 -1
  55. package/dist/esm/bcs/index.mjs +1 -1
  56. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  57. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  58. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  59. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  60. package/dist/esm/bcs/serializer.d.mts +2 -0
  61. package/dist/esm/bcs/serializer.mjs +1 -1
  62. package/dist/esm/chunk-2Q6K4CLJ.mjs +2 -0
  63. package/dist/esm/chunk-2Q6K4CLJ.mjs.map +1 -0
  64. package/dist/esm/chunk-2YDIOWRJ.mjs +2 -0
  65. package/dist/esm/chunk-2YDIOWRJ.mjs.map +1 -0
  66. package/dist/esm/{chunk-2PFN7LYP.mjs → chunk-33WBJV5U.mjs} +2 -2
  67. package/dist/esm/{chunk-PIOHC246.mjs → chunk-37CYBCWS.mjs} +2 -2
  68. package/dist/esm/chunk-37CYBCWS.mjs.map +1 -0
  69. package/dist/esm/{chunk-TBMAJ6AW.mjs → chunk-3FVRXELT.mjs} +2 -2
  70. package/dist/esm/{chunk-GS5J57UA.mjs → chunk-3QHRPREO.mjs} +2 -2
  71. package/dist/esm/chunk-3QHRPREO.mjs.map +1 -0
  72. package/dist/esm/{chunk-DMKUAQB7.mjs → chunk-3VGX3TXH.mjs} +2 -2
  73. package/dist/esm/{chunk-PJLCPRYJ.mjs → chunk-3YNRBMPS.mjs} +2 -2
  74. package/dist/esm/chunk-4NMDYPUD.mjs +1 -0
  75. package/dist/esm/chunk-4NMDYPUD.mjs.map +1 -0
  76. package/dist/esm/chunk-4XB3D2ZD.mjs +2 -0
  77. package/dist/esm/chunk-4XB3D2ZD.mjs.map +1 -0
  78. package/dist/esm/chunk-5QBTBH64.mjs +2 -0
  79. package/dist/esm/chunk-5VSMDXZ6.mjs +2 -0
  80. package/dist/esm/chunk-5VSMDXZ6.mjs.map +1 -0
  81. package/dist/esm/{chunk-A556OVZY.mjs → chunk-6CQH7JPF.mjs} +2 -2
  82. package/dist/esm/chunk-6GQAHQGW.mjs +2 -0
  83. package/dist/esm/chunk-6GQAHQGW.mjs.map +1 -0
  84. package/dist/esm/chunk-6J3CB3DN.mjs +2 -0
  85. package/dist/esm/chunk-6J3CB3DN.mjs.map +1 -0
  86. package/dist/esm/chunk-6M6XXPQQ.mjs +2 -0
  87. package/dist/esm/chunk-6M6XXPQQ.mjs.map +1 -0
  88. package/dist/esm/{chunk-QIAHBEEW.mjs → chunk-6RBUXB5I.mjs} +2 -2
  89. package/dist/esm/{chunk-FXNFWLQC.mjs → chunk-7H3HRFVM.mjs} +2 -2
  90. package/dist/esm/chunk-7JNPSNL6.mjs +2 -0
  91. package/dist/esm/chunk-7JNPSNL6.mjs.map +1 -0
  92. package/dist/esm/{chunk-NPFNYP75.mjs → chunk-7STYQ5ZE.mjs} +2 -2
  93. package/dist/esm/chunk-7Z6DYLCA.mjs +1 -0
  94. package/dist/esm/chunk-7Z6DYLCA.mjs.map +1 -0
  95. package/dist/esm/{chunk-4LMAVPA4.mjs → chunk-A7L2Z5DW.mjs} +2 -2
  96. package/dist/esm/chunk-AQ4I7VVB.mjs +1 -0
  97. package/dist/esm/chunk-AQ4I7VVB.mjs.map +1 -0
  98. package/dist/esm/{chunk-ZYYK3UXP.mjs → chunk-C3L4ETUF.mjs} +2 -2
  99. package/dist/esm/chunk-CHQ6IKE3.mjs +2 -0
  100. package/dist/esm/{chunk-MNBYKY5P.mjs.map → chunk-CHQ6IKE3.mjs.map} +1 -1
  101. package/dist/esm/{chunk-WFZDFFBM.mjs → chunk-COW5IGYC.mjs} +2 -2
  102. package/dist/esm/{chunk-RQEWIZ67.mjs → chunk-DIBNAYZ2.mjs} +2 -2
  103. package/dist/esm/chunk-DMKFITUM.mjs +2 -0
  104. package/dist/esm/chunk-DMKFITUM.mjs.map +1 -0
  105. package/dist/esm/{chunk-TORRTLWV.mjs → chunk-DOCYCNXV.mjs} +2 -2
  106. package/dist/esm/chunk-DOCYCNXV.mjs.map +1 -0
  107. package/dist/esm/{chunk-TGG7SWBO.mjs → chunk-DX62SMGM.mjs} +2 -2
  108. package/dist/esm/chunk-DX62SMGM.mjs.map +1 -0
  109. package/dist/esm/{chunk-FS3NSGBF.mjs → chunk-EB7AI4B4.mjs} +2 -2
  110. package/dist/esm/chunk-EFRNRARV.mjs +2 -0
  111. package/dist/esm/chunk-EFRNRARV.mjs.map +1 -0
  112. package/dist/esm/chunk-EKOIHFAW.mjs +2 -0
  113. package/dist/esm/{chunk-B252RJCU.mjs.map → chunk-EKOIHFAW.mjs.map} +1 -1
  114. package/dist/esm/chunk-FLYEALDB.mjs +2 -0
  115. package/dist/esm/chunk-FLYEALDB.mjs.map +1 -0
  116. package/dist/esm/{chunk-YKVKSNH4.mjs → chunk-GI52SX32.mjs} +2 -2
  117. package/dist/esm/{chunk-3RUY5FQK.mjs → chunk-GKCO5PQJ.mjs} +2 -2
  118. package/dist/esm/chunk-GKCO5PQJ.mjs.map +1 -0
  119. package/dist/esm/{chunk-UML2VQZT.mjs → chunk-HGZGTBA4.mjs} +2 -2
  120. package/dist/esm/chunk-HJULFJXF.mjs +2 -0
  121. package/dist/esm/chunk-HJULFJXF.mjs.map +1 -0
  122. package/dist/esm/{chunk-TGXZVNR5.mjs → chunk-IEZO4PIG.mjs} +2 -2
  123. package/dist/esm/{chunk-UMFJDDYI.mjs → chunk-IM32PZOD.mjs} +2 -2
  124. package/dist/esm/chunk-IM32PZOD.mjs.map +1 -0
  125. package/dist/esm/chunk-IOVRZ2CA.mjs +2 -0
  126. package/dist/esm/chunk-IOVRZ2CA.mjs.map +1 -0
  127. package/dist/esm/chunk-ITEV72BZ.mjs +2 -0
  128. package/dist/esm/chunk-ITEV72BZ.mjs.map +1 -0
  129. package/dist/esm/chunk-JXCZTOYC.mjs +1 -0
  130. package/dist/esm/chunk-JXCZTOYC.mjs.map +1 -0
  131. package/dist/esm/{chunk-KDCHX7BI.mjs → chunk-KFJMLLOA.mjs} +2 -2
  132. package/dist/esm/chunk-KGJITNRZ.mjs +2 -0
  133. package/dist/esm/chunk-KGJITNRZ.mjs.map +1 -0
  134. package/dist/esm/chunk-KOCKKI4F.mjs +2 -0
  135. package/dist/esm/{chunk-YBEF3UR3.mjs → chunk-LV7OW245.mjs} +2 -2
  136. package/dist/esm/{chunk-DSTKXJMA.mjs → chunk-MGOHPDX4.mjs} +2 -2
  137. package/dist/esm/{chunk-BBU2EE6D.mjs → chunk-MJGZJL3W.mjs} +2 -2
  138. package/dist/esm/{chunk-UPIN5AIO.mjs → chunk-MKUAW7KW.mjs} +2 -2
  139. package/dist/esm/{chunk-BWFJHFBQ.mjs → chunk-MWUJCP27.mjs} +2 -2
  140. package/dist/esm/{chunk-QTRYMRYK.mjs → chunk-NC5HHEEM.mjs} +2 -2
  141. package/dist/esm/{chunk-6MG4JAYB.mjs → chunk-NPNAKSCR.mjs} +2 -2
  142. package/dist/esm/chunk-NWLZDI2I.mjs +2 -0
  143. package/dist/esm/chunk-NWLZDI2I.mjs.map +1 -0
  144. package/dist/esm/{chunk-6IGEUEER.mjs → chunk-ODTNF2YP.mjs} +2 -2
  145. package/dist/esm/{chunk-LV2V23Z6.mjs → chunk-OKG6X5TX.mjs} +2 -2
  146. package/dist/esm/chunk-OKG6X5TX.mjs.map +1 -0
  147. package/dist/esm/chunk-OKRUEVF3.mjs +2 -0
  148. package/dist/esm/chunk-OKRUEVF3.mjs.map +1 -0
  149. package/dist/esm/chunk-OYTLWUQT.mjs +2 -0
  150. package/dist/esm/chunk-OYTLWUQT.mjs.map +1 -0
  151. package/dist/esm/chunk-P5VCS2F5.mjs +2 -0
  152. package/dist/esm/chunk-P5VCS2F5.mjs.map +1 -0
  153. package/dist/esm/{chunk-U43IJHQN.mjs → chunk-PFFAQZHT.mjs} +2 -2
  154. package/dist/esm/{chunk-3HV2C4SS.mjs → chunk-PTIZKRON.mjs} +2 -2
  155. package/dist/esm/chunk-R4UIPTBH.mjs +2 -0
  156. package/dist/esm/chunk-R4UIPTBH.mjs.map +1 -0
  157. package/dist/esm/chunk-R7BAM2G6.mjs +2 -0
  158. package/dist/esm/chunk-R7BAM2G6.mjs.map +1 -0
  159. package/dist/esm/{chunk-GXYS45Y5.mjs → chunk-RDNPWCZ4.mjs} +2 -2
  160. package/dist/esm/chunk-RFSO3JRG.mjs +1 -0
  161. package/dist/esm/chunk-RFSO3JRG.mjs.map +1 -0
  162. package/dist/esm/chunk-S5HG2QUD.mjs +2 -0
  163. package/dist/esm/chunk-S5HG2QUD.mjs.map +1 -0
  164. package/dist/esm/chunk-SA7MZPM3.mjs +2 -0
  165. package/dist/esm/chunk-SA7MZPM3.mjs.map +1 -0
  166. package/dist/esm/{chunk-R5QUBEH6.mjs → chunk-STYDBDYL.mjs} +2 -2
  167. package/dist/esm/{chunk-IOSQVDZI.mjs → chunk-T23OVRNF.mjs} +2 -2
  168. package/dist/esm/{chunk-BRQYARQ3.mjs → chunk-T7JIGO3O.mjs} +2 -2
  169. package/dist/esm/{chunk-4DNVCOW7.mjs → chunk-TFJCMFKE.mjs} +2 -2
  170. package/dist/esm/chunk-TFJCMFKE.mjs.map +1 -0
  171. package/dist/esm/{chunk-3QBZU5ZD.mjs → chunk-TV64AINP.mjs} +2 -2
  172. package/dist/esm/chunk-TV64AINP.mjs.map +1 -0
  173. package/dist/esm/{chunk-52C73T26.mjs → chunk-TVRJ3M7B.mjs} +2 -2
  174. package/dist/esm/{chunk-52C73T26.mjs.map → chunk-TVRJ3M7B.mjs.map} +1 -1
  175. package/dist/esm/{chunk-GRT5PHL6.mjs → chunk-UKJUHLZW.mjs} +2 -2
  176. package/dist/esm/chunk-VTX77UM3.mjs +2 -0
  177. package/dist/esm/chunk-VTX77UM3.mjs.map +1 -0
  178. package/dist/esm/{chunk-BAV4XY7C.mjs → chunk-W637YAND.mjs} +2 -2
  179. package/dist/esm/chunk-WPVBC4JS.mjs +2 -0
  180. package/dist/esm/chunk-WPVBC4JS.mjs.map +1 -0
  181. package/dist/esm/chunk-WTVN3XGK.mjs +2 -0
  182. package/dist/esm/chunk-WTVN3XGK.mjs.map +1 -0
  183. package/dist/esm/chunk-X7GVXVT4.mjs +2 -0
  184. package/dist/esm/{chunk-IZT6OX3R.mjs.map → chunk-X7GVXVT4.mjs.map} +1 -1
  185. package/dist/esm/{chunk-XLPVG4XR.mjs → chunk-XHPLLMR5.mjs} +2 -2
  186. package/dist/esm/chunk-YE5B2S5L.mjs +2 -0
  187. package/dist/esm/chunk-YE5B2S5L.mjs.map +1 -0
  188. package/dist/esm/{chunk-QWRH22H4.mjs → chunk-YGB7MEH3.mjs} +2 -2
  189. package/dist/esm/chunk-YH6UKGIX.mjs +2 -0
  190. package/dist/esm/chunk-YH6UKGIX.mjs.map +1 -0
  191. package/dist/esm/{chunk-EJCKCYYI.mjs → chunk-YI7FZPIK.mjs} +2 -2
  192. package/dist/esm/{chunk-OGHE4AQA.mjs → chunk-Z2ZR4PTF.mjs} +2 -2
  193. package/dist/esm/{chunk-TC3VVMPY.mjs → chunk-ZGTJMNZG.mjs} +2 -2
  194. package/dist/esm/{chunk-RHBCVCOS.mjs → chunk-ZNEBMSNC.mjs} +2 -2
  195. package/dist/esm/client/core.mjs +1 -1
  196. package/dist/esm/client/get.d.mts +2 -1
  197. package/dist/esm/client/get.mjs +1 -1
  198. package/dist/esm/client/index.d.mts +2 -2
  199. package/dist/esm/client/index.mjs +1 -1
  200. package/dist/esm/client/post.d.mts +3 -1
  201. package/dist/esm/client/post.mjs +1 -1
  202. package/dist/esm/core/account/index.d.mts +5 -14
  203. package/dist/esm/core/account/index.mjs +1 -1
  204. package/dist/esm/core/account/utils/address.mjs +1 -1
  205. package/dist/esm/core/account/utils/index.mjs +1 -1
  206. package/dist/esm/core/accountAddress.mjs +1 -1
  207. package/dist/esm/core/authenticationKey.mjs +1 -1
  208. package/dist/esm/core/crypto/ed25519.d.mts +0 -10
  209. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  210. package/dist/esm/core/crypto/ephemeral.d.mts +77 -0
  211. package/dist/esm/core/crypto/ephemeral.mjs +2 -0
  212. package/dist/esm/core/crypto/ephemeral.mjs.map +1 -0
  213. package/dist/esm/core/crypto/hdKey.d.mts +15 -1
  214. package/dist/esm/core/crypto/hdKey.mjs +1 -1
  215. package/dist/esm/core/crypto/index.d.mts +7 -5
  216. package/dist/esm/core/crypto/index.mjs +1 -1
  217. package/dist/esm/core/crypto/keyless.d.mts +217 -0
  218. package/dist/esm/core/crypto/keyless.mjs +2 -0
  219. package/dist/esm/core/crypto/keyless.mjs.map +1 -0
  220. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  221. package/dist/esm/core/crypto/multiKey.d.mts +4 -3
  222. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  223. package/dist/esm/core/crypto/poseidon.d.mts +7 -0
  224. package/dist/esm/core/crypto/poseidon.mjs +2 -0
  225. package/dist/esm/core/crypto/poseidon.mjs.map +1 -0
  226. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  227. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  228. package/dist/esm/core/crypto/signature.mjs +1 -1
  229. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  230. package/dist/esm/core/index.d.mts +6 -7
  231. package/dist/esm/core/index.mjs +1 -1
  232. package/dist/esm/index.d.mts +17 -11
  233. package/dist/esm/index.mjs +1 -1
  234. package/dist/esm/internal/account.d.mts +14 -2
  235. package/dist/esm/internal/account.mjs +1 -1
  236. package/dist/esm/internal/ans.d.mts +1 -1
  237. package/dist/esm/internal/ans.mjs +1 -1
  238. package/dist/esm/internal/coin.d.mts +7 -7
  239. package/dist/esm/internal/coin.mjs +1 -1
  240. package/dist/esm/internal/digitalAsset.d.mts +2 -2
  241. package/dist/esm/internal/digitalAsset.mjs +1 -1
  242. package/dist/esm/internal/event.d.mts +1 -1
  243. package/dist/esm/internal/event.mjs +1 -1
  244. package/dist/esm/internal/faucet.d.mts +1 -1
  245. package/dist/esm/internal/faucet.mjs +1 -1
  246. package/dist/esm/internal/fungibleAsset.d.mts +5 -5
  247. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  248. package/dist/esm/internal/general.mjs +1 -1
  249. package/dist/esm/internal/keyless.d.mts +67 -0
  250. package/dist/esm/internal/keyless.mjs +2 -0
  251. package/dist/esm/internal/keyless.mjs.map +1 -0
  252. package/dist/esm/internal/staking.d.mts +1 -1
  253. package/dist/esm/internal/staking.mjs +1 -1
  254. package/dist/esm/internal/transaction.mjs +1 -1
  255. package/dist/esm/internal/transactionSubmission.d.mts +1 -1
  256. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  257. package/dist/esm/internal/view.d.mts +7 -7
  258. package/dist/esm/internal/view.mjs +1 -1
  259. package/dist/esm/transactions/authenticator/account.d.mts +3 -4
  260. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  261. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  262. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  263. package/dist/esm/transactions/index.d.mts +3 -3
  264. package/dist/esm/transactions/index.mjs +1 -1
  265. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  266. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  267. package/dist/esm/transactions/instances/index.d.mts +1 -0
  268. package/dist/esm/transactions/instances/index.mjs +1 -1
  269. package/dist/esm/transactions/instances/moduleId.d.mts +1 -1
  270. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  271. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  272. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  273. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  274. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  275. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  276. package/dist/esm/transactions/instances/transactionPayload.d.mts +1 -1
  277. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  278. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +13 -1
  279. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  280. package/dist/esm/transactions/management/index.d.mts +2 -2
  281. package/dist/esm/transactions/management/index.mjs +1 -1
  282. package/dist/esm/transactions/management/transactionWorker.d.mts +1 -1
  283. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  284. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +9 -9
  285. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  286. package/dist/esm/transactions/transactionBuilder/index.d.mts +9 -9
  287. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  288. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +6 -6
  289. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  290. package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +47 -0
  291. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +2 -0
  292. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs.map +1 -0
  293. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +13 -25
  294. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  295. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  296. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  297. package/dist/esm/transactions/types.d.mts +7 -7
  298. package/dist/esm/types/index.d.mts +17 -3
  299. package/dist/esm/types/index.mjs +1 -1
  300. package/dist/esm/types/keyless.d.mts +14 -0
  301. package/dist/esm/types/keyless.mjs +1 -0
  302. package/dist/esm/types/keyless.mjs.map +1 -0
  303. package/dist/esm/utils/apiEndpoints.d.mts +3 -1
  304. package/dist/esm/utils/apiEndpoints.mjs +1 -1
  305. package/dist/esm/utils/const.d.mts +3 -1
  306. package/dist/esm/utils/const.mjs +1 -1
  307. package/dist/esm/utils/index.d.mts +1 -1
  308. package/dist/esm/utils/index.mjs +1 -1
  309. package/dist/esm/utils/normalizeBundle.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 +123 -0
  316. package/src/account/KeylessAccount.ts +299 -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 +35 -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 +188 -0
  350. package/src/internal/transactionSubmission.ts +8 -7
  351. package/src/transactions/authenticator/account.ts +6 -11
  352. package/src/transactions/instances/index.ts +1 -0
  353. package/src/transactions/management/accountSequenceNumber.ts +1 -1
  354. package/src/transactions/management/transactionWorker.ts +8 -2
  355. package/src/transactions/transactionBuilder/index.ts +1 -0
  356. package/src/transactions/transactionBuilder/signingMessage.ts +70 -0
  357. package/src/transactions/transactionBuilder/transactionBuilder.ts +41 -70
  358. package/src/types/index.ts +19 -0
  359. package/src/types/keyless.ts +6 -0
  360. package/src/utils/apiEndpoints.ts +14 -0
  361. package/src/utils/const.ts +2 -0
  362. package/src/version.ts +1 -1
  363. package/dist/esm/chunk-3426VLAZ.mjs +0 -2
  364. package/dist/esm/chunk-3426VLAZ.mjs.map +0 -1
  365. package/dist/esm/chunk-3OCTOB2E.mjs +0 -2
  366. package/dist/esm/chunk-3OCTOB2E.mjs.map +0 -1
  367. package/dist/esm/chunk-3QBZU5ZD.mjs.map +0 -1
  368. package/dist/esm/chunk-3RUY5FQK.mjs.map +0 -1
  369. package/dist/esm/chunk-4DNVCOW7.mjs.map +0 -1
  370. package/dist/esm/chunk-5HALZ6JC.mjs +0 -2
  371. package/dist/esm/chunk-5HALZ6JC.mjs.map +0 -1
  372. package/dist/esm/chunk-5OM4V4DR.mjs +0 -2
  373. package/dist/esm/chunk-5TMLAKSH.mjs +0 -2
  374. package/dist/esm/chunk-5TMLAKSH.mjs.map +0 -1
  375. package/dist/esm/chunk-B252RJCU.mjs +0 -2
  376. package/dist/esm/chunk-CYNQRMO5.mjs +0 -2
  377. package/dist/esm/chunk-CYNQRMO5.mjs.map +0 -1
  378. package/dist/esm/chunk-E7FWVXGX.mjs +0 -1
  379. package/dist/esm/chunk-FO6ZKE7A.mjs +0 -2
  380. package/dist/esm/chunk-FO6ZKE7A.mjs.map +0 -1
  381. package/dist/esm/chunk-GMQQSSEO.mjs +0 -2
  382. package/dist/esm/chunk-GMQQSSEO.mjs.map +0 -1
  383. package/dist/esm/chunk-GNQXMS53.mjs +0 -2
  384. package/dist/esm/chunk-GNQXMS53.mjs.map +0 -1
  385. package/dist/esm/chunk-GS5J57UA.mjs.map +0 -1
  386. package/dist/esm/chunk-HLVMEUWD.mjs +0 -2
  387. package/dist/esm/chunk-HLVMEUWD.mjs.map +0 -1
  388. package/dist/esm/chunk-HQSLBTW5.mjs +0 -2
  389. package/dist/esm/chunk-HQSLBTW5.mjs.map +0 -1
  390. package/dist/esm/chunk-ICXA3DZH.mjs +0 -1
  391. package/dist/esm/chunk-IZT6OX3R.mjs +0 -2
  392. package/dist/esm/chunk-KHOHRD2B.mjs +0 -2
  393. package/dist/esm/chunk-KHOHRD2B.mjs.map +0 -1
  394. package/dist/esm/chunk-L6PGWGFF.mjs +0 -2
  395. package/dist/esm/chunk-LR65XHSF.mjs +0 -2
  396. package/dist/esm/chunk-LR65XHSF.mjs.map +0 -1
  397. package/dist/esm/chunk-LV2V23Z6.mjs.map +0 -1
  398. package/dist/esm/chunk-MLWIHWNH.mjs +0 -1
  399. package/dist/esm/chunk-MNBYKY5P.mjs +0 -2
  400. package/dist/esm/chunk-OVJQWQ2N.mjs +0 -2
  401. package/dist/esm/chunk-OVJQWQ2N.mjs.map +0 -1
  402. package/dist/esm/chunk-OWW6SIDP.mjs +0 -2
  403. package/dist/esm/chunk-OWW6SIDP.mjs.map +0 -1
  404. package/dist/esm/chunk-PIOHC246.mjs.map +0 -1
  405. package/dist/esm/chunk-R7G3CLRI.mjs +0 -1
  406. package/dist/esm/chunk-TGG7SWBO.mjs.map +0 -1
  407. package/dist/esm/chunk-TORRTLWV.mjs.map +0 -1
  408. package/dist/esm/chunk-TQR7M73S.mjs +0 -2
  409. package/dist/esm/chunk-TQR7M73S.mjs.map +0 -1
  410. package/dist/esm/chunk-UMFJDDYI.mjs.map +0 -1
  411. package/dist/esm/chunk-UVSRX4SV.mjs +0 -1
  412. package/dist/esm/chunk-VNO4VHJN.mjs +0 -2
  413. package/dist/esm/chunk-VNO4VHJN.mjs.map +0 -1
  414. package/dist/esm/chunk-WBOLHLPX.mjs +0 -2
  415. package/dist/esm/chunk-WBOLHLPX.mjs.map +0 -1
  416. package/dist/esm/chunk-XDGQTMDV.mjs +0 -2
  417. package/dist/esm/chunk-XDGQTMDV.mjs.map +0 -1
  418. package/dist/esm/chunk-YVSU6GOA.mjs +0 -2
  419. package/dist/esm/chunk-YVSU6GOA.mjs.map +0 -1
  420. package/dist/esm/core/account/Account.d.mts +0 -20
  421. package/dist/esm/core/account/Account.mjs +0 -2
  422. package/dist/esm/core/account/Ed25519Account.d.mts +0 -20
  423. package/dist/esm/core/account/Ed25519Account.mjs +0 -2
  424. package/dist/esm/core/account/SingleKeyAccount.d.mts +0 -20
  425. package/dist/esm/core/account/SingleKeyAccount.mjs +0 -2
  426. /package/dist/esm/{core/account → account}/Account.mjs.map +0 -0
  427. /package/dist/esm/{core/account → account}/Ed25519Account.mjs.map +0 -0
  428. /package/dist/esm/{chunk-E7FWVXGX.mjs.map → account/EphemeralKeyPair.mjs.map} +0 -0
  429. /package/dist/esm/{chunk-ICXA3DZH.mjs.map → account/KeylessAccount.mjs.map} +0 -0
  430. /package/dist/esm/{chunk-MLWIHWNH.mjs.map → account/MultiKeyAccount.mjs.map} +0 -0
  431. /package/dist/esm/{core/account → account}/SingleKeyAccount.mjs.map +0 -0
  432. /package/dist/esm/{chunk-R7G3CLRI.mjs.map → account/index.mjs.map} +0 -0
  433. /package/dist/esm/{chunk-UVSRX4SV.mjs.map → api/keyless.mjs.map} +0 -0
  434. /package/dist/esm/{chunk-2PFN7LYP.mjs.map → chunk-33WBJV5U.mjs.map} +0 -0
  435. /package/dist/esm/{chunk-TBMAJ6AW.mjs.map → chunk-3FVRXELT.mjs.map} +0 -0
  436. /package/dist/esm/{chunk-DMKUAQB7.mjs.map → chunk-3VGX3TXH.mjs.map} +0 -0
  437. /package/dist/esm/{chunk-PJLCPRYJ.mjs.map → chunk-3YNRBMPS.mjs.map} +0 -0
  438. /package/dist/esm/{chunk-5OM4V4DR.mjs.map → chunk-5QBTBH64.mjs.map} +0 -0
  439. /package/dist/esm/{chunk-A556OVZY.mjs.map → chunk-6CQH7JPF.mjs.map} +0 -0
  440. /package/dist/esm/{chunk-QIAHBEEW.mjs.map → chunk-6RBUXB5I.mjs.map} +0 -0
  441. /package/dist/esm/{chunk-FXNFWLQC.mjs.map → chunk-7H3HRFVM.mjs.map} +0 -0
  442. /package/dist/esm/{chunk-NPFNYP75.mjs.map → chunk-7STYQ5ZE.mjs.map} +0 -0
  443. /package/dist/esm/{chunk-4LMAVPA4.mjs.map → chunk-A7L2Z5DW.mjs.map} +0 -0
  444. /package/dist/esm/{chunk-ZYYK3UXP.mjs.map → chunk-C3L4ETUF.mjs.map} +0 -0
  445. /package/dist/esm/{chunk-WFZDFFBM.mjs.map → chunk-COW5IGYC.mjs.map} +0 -0
  446. /package/dist/esm/{chunk-RQEWIZ67.mjs.map → chunk-DIBNAYZ2.mjs.map} +0 -0
  447. /package/dist/esm/{chunk-FS3NSGBF.mjs.map → chunk-EB7AI4B4.mjs.map} +0 -0
  448. /package/dist/esm/{chunk-YKVKSNH4.mjs.map → chunk-GI52SX32.mjs.map} +0 -0
  449. /package/dist/esm/{chunk-UML2VQZT.mjs.map → chunk-HGZGTBA4.mjs.map} +0 -0
  450. /package/dist/esm/{chunk-TGXZVNR5.mjs.map → chunk-IEZO4PIG.mjs.map} +0 -0
  451. /package/dist/esm/{chunk-KDCHX7BI.mjs.map → chunk-KFJMLLOA.mjs.map} +0 -0
  452. /package/dist/esm/{chunk-L6PGWGFF.mjs.map → chunk-KOCKKI4F.mjs.map} +0 -0
  453. /package/dist/esm/{chunk-YBEF3UR3.mjs.map → chunk-LV7OW245.mjs.map} +0 -0
  454. /package/dist/esm/{chunk-DSTKXJMA.mjs.map → chunk-MGOHPDX4.mjs.map} +0 -0
  455. /package/dist/esm/{chunk-BBU2EE6D.mjs.map → chunk-MJGZJL3W.mjs.map} +0 -0
  456. /package/dist/esm/{chunk-UPIN5AIO.mjs.map → chunk-MKUAW7KW.mjs.map} +0 -0
  457. /package/dist/esm/{chunk-BWFJHFBQ.mjs.map → chunk-MWUJCP27.mjs.map} +0 -0
  458. /package/dist/esm/{chunk-QTRYMRYK.mjs.map → chunk-NC5HHEEM.mjs.map} +0 -0
  459. /package/dist/esm/{chunk-6MG4JAYB.mjs.map → chunk-NPNAKSCR.mjs.map} +0 -0
  460. /package/dist/esm/{chunk-6IGEUEER.mjs.map → chunk-ODTNF2YP.mjs.map} +0 -0
  461. /package/dist/esm/{chunk-U43IJHQN.mjs.map → chunk-PFFAQZHT.mjs.map} +0 -0
  462. /package/dist/esm/{chunk-3HV2C4SS.mjs.map → chunk-PTIZKRON.mjs.map} +0 -0
  463. /package/dist/esm/{chunk-GXYS45Y5.mjs.map → chunk-RDNPWCZ4.mjs.map} +0 -0
  464. /package/dist/esm/{chunk-R5QUBEH6.mjs.map → chunk-STYDBDYL.mjs.map} +0 -0
  465. /package/dist/esm/{chunk-IOSQVDZI.mjs.map → chunk-T23OVRNF.mjs.map} +0 -0
  466. /package/dist/esm/{chunk-BRQYARQ3.mjs.map → chunk-T7JIGO3O.mjs.map} +0 -0
  467. /package/dist/esm/{chunk-GRT5PHL6.mjs.map → chunk-UKJUHLZW.mjs.map} +0 -0
  468. /package/dist/esm/{chunk-BAV4XY7C.mjs.map → chunk-W637YAND.mjs.map} +0 -0
  469. /package/dist/esm/{chunk-XLPVG4XR.mjs.map → chunk-XHPLLMR5.mjs.map} +0 -0
  470. /package/dist/esm/{chunk-QWRH22H4.mjs.map → chunk-YGB7MEH3.mjs.map} +0 -0
  471. /package/dist/esm/{chunk-EJCKCYYI.mjs.map → chunk-YI7FZPIK.mjs.map} +0 -0
  472. /package/dist/esm/{chunk-OGHE4AQA.mjs.map → chunk-Z2ZR4PTF.mjs.map} +0 -0
  473. /package/dist/esm/{chunk-TC3VVMPY.mjs.map → chunk-ZGTJMNZG.mjs.map} +0 -0
  474. /package/dist/esm/{chunk-RHBCVCOS.mjs.map → chunk-ZNEBMSNC.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,188 @@
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, ProofFetchCallback } 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.getPublicKey().bcsToHex().toStringWithoutPrefix(),
83
+ exp_date_secs: Number(ephemeralKeyPair.expiryDateSecs),
84
+ epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),
85
+ uid_key: uidKey,
86
+ };
87
+ const { data } = await postAptosPepperService<any, PepperFetchResponse>({
88
+ aptosConfig,
89
+ path: "fetch",
90
+ body,
91
+ originMethod: "getPepper",
92
+ overrides: { WITH_CREDENTIALS: false },
93
+ });
94
+ const pepperBase = Hex.fromHexInput(data.signature).toUint8Array();
95
+
96
+ if (verify) {
97
+ const pepperVerified = verifyPepperBase({ aptosConfig, pepperBase, pepperInput: getPepperInput(args) });
98
+ if (!pepperVerified) {
99
+ throw new Error("Unable to verify");
100
+ }
101
+ }
102
+ // 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).
103
+ // 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.
104
+ const newPepperBase = bls.pairing(
105
+ bls.G1.ProjectivePoint.fromHex(pepperBase),
106
+ bls.G2.ProjectivePoint.fromAffine(PINKAS_VUF_SECRET_KEY_BASE_AFFINE),
107
+ );
108
+
109
+ if (derivationPath === undefined) {
110
+ derivationPath = APTOS_BIP44_DEFAULT_DERIVATION_PATH;
111
+ }
112
+ const pepper = KeylessAccount.fromDerivationPath(derivationPath, bls.fields.Fp12.toBytes(newPepperBase));
113
+ return pepper.slice(0, 31);
114
+ }
115
+
116
+ export async function getProof(args: {
117
+ aptosConfig: AptosConfig;
118
+ jwt: string;
119
+ ephemeralKeyPair: EphemeralKeyPair;
120
+ pepper: HexInput;
121
+ uidKey?: string;
122
+ extraFieldKey?: string;
123
+ }): Promise<SignedGroth16Signature> {
124
+ const { aptosConfig, jwt, ephemeralKeyPair, pepper, uidKey, extraFieldKey } = args;
125
+ const jwtPayload = jwtDecode<{ [key: string]: string }>(jwt);
126
+ let extraField;
127
+ if (extraFieldKey) {
128
+ const extraFieldVal = jwtPayload[extraFieldKey];
129
+ extraField = `"${extraFieldKey}":"${extraFieldVal}",`;
130
+ }
131
+ const json = {
132
+ jwt_b64: jwt,
133
+ epk: ephemeralKeyPair.getPublicKey().bcsToHex().toStringWithoutPrefix(),
134
+ epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),
135
+ exp_date_secs: Number(ephemeralKeyPair.expiryDateSecs),
136
+ exp_horizon_secs: EPK_HORIZON_SECS,
137
+ pepper: Hex.fromHexInput(pepper).toStringWithoutPrefix(),
138
+ extra_field: extraFieldKey,
139
+ uid_key: uidKey || "sub",
140
+ };
141
+
142
+ const { data } = await postAptosProvingService<any, ProverResponse>({
143
+ aptosConfig,
144
+ path: "prove",
145
+ body: json,
146
+ originMethod: "getProof",
147
+ overrides: { WITH_CREDENTIALS: false },
148
+ });
149
+
150
+ const proofPoints = data.proof;
151
+ const proof = new Groth16Zkp({
152
+ a: proofPoints.a,
153
+ b: proofPoints.b,
154
+ c: proofPoints.c,
155
+ });
156
+
157
+ const signedProof = new SignedGroth16Signature({
158
+ proof,
159
+ extraField,
160
+ trainingWheelsSignature: EphemeralSignature.fromHex(data.training_wheels_signature),
161
+ });
162
+ return signedProof;
163
+ }
164
+
165
+ export async function deriveKeylessAccount(args: {
166
+ aptosConfig: AptosConfig;
167
+ jwt: string;
168
+ ephemeralKeyPair: EphemeralKeyPair;
169
+ uidKey?: string;
170
+ pepper?: HexInput;
171
+ extraFieldKey?: string;
172
+ proofFetchCallback?: ProofFetchCallback;
173
+ }): Promise<KeylessAccount> {
174
+ const { proofFetchCallback } = args;
175
+ let { pepper } = args;
176
+ if (pepper === undefined) {
177
+ pepper = await getPepper(args);
178
+ } else if (Hex.fromHexInput(pepper).toUint8Array().length !== 31) {
179
+ throw new Error("Pepper needs to be 31 bytes");
180
+ }
181
+
182
+ const proofPromise = getProof({ ...args, pepper });
183
+ const proof = proofFetchCallback ? proofPromise : await proofPromise;
184
+
185
+ const keylessAccount = KeylessAccount.fromJWTAndProof({ ...args, proof, pepper, proofFetchCallback });
186
+
187
+ return keylessAccount;
188
+ }
@@ -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
 
@@ -185,7 +183,7 @@ function isMultiAgentTransactionInput(
185
183
  */
186
184
  export function getSigningMessage(args: { transaction: AnyRawTransaction }): Uint8Array {
187
185
  const { transaction } = args;
188
- return generateSigningMessage(transaction);
186
+ return generateSigningMessageForTransaction(transaction);
189
187
  }
190
188
 
191
189
  /**
@@ -204,8 +202,8 @@ export function getSigningMessage(args: { transaction: AnyRawTransaction }): Uin
204
202
  * @return The signer AccountAuthenticator
205
203
  */
206
204
  export function signTransaction(args: { signer: Account; transaction: AnyRawTransaction }): AccountAuthenticator {
207
- const accountAuthenticator = sign({ ...args });
208
- return accountAuthenticator;
205
+ const { signer, transaction } = args;
206
+ return signer.signWithAuthenticator(transaction);
209
207
  }
210
208
 
211
209
  /**
@@ -277,6 +275,9 @@ export async function signAndSubmitTransaction(args: {
277
275
  transaction: AnyRawTransaction;
278
276
  }): Promise<PendingTransactionResponse> {
279
277
  const { aptosConfig, signer, transaction } = args;
278
+ if (signer instanceof KeylessAccount || signer instanceof MultiKeyAccount) {
279
+ await signer.waitForProofFetch();
280
+ }
280
281
  const authenticator = signTransaction({ signer, transaction });
281
282
  return submitTransaction({
282
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
  }
@@ -10,3 +10,4 @@ export * from "./signedTransaction";
10
10
  export * from "./transactionArgument";
11
11
  export * from "./transactionPayload";
12
12
  export * from "./simpleTransaction";
13
+ export * from "./multiAgentTransaction";
@@ -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
+ }