@aptos-labs/ts-sdk 1.29.1 → 1.30.0

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 (689) hide show
  1. package/README.md +2 -2
  2. package/dist/common/{accountAddress-DUCC2ffJ.d.ts → accountAddress-DnSqjhSl.d.ts} +700 -245
  3. package/dist/common/{chunk-HBPH2AD3.js → chunk-7IYTZDXV.js} +1 -1
  4. package/dist/common/chunk-7IYTZDXV.js.map +1 -0
  5. package/dist/common/cli/index.d.ts +123 -126
  6. package/dist/common/cli/index.js +1 -1
  7. package/dist/common/cli/index.js.map +1 -1
  8. package/dist/common/index.d.ts +5916 -1627
  9. package/dist/common/index.js +8 -8
  10. package/dist/common/index.js.map +1 -1
  11. package/dist/esm/Ed25519Account-DpH9qAcg.d.mts +470 -0
  12. package/dist/esm/account/AbstractKeylessAccount.d.mts +5 -5
  13. package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
  14. package/dist/esm/account/Account.d.mts +2 -2
  15. package/dist/esm/account/Account.mjs +1 -1
  16. package/dist/esm/account/Ed25519Account.d.mts +2 -2
  17. package/dist/esm/account/Ed25519Account.mjs +1 -1
  18. package/dist/esm/account/EphemeralKeyPair.d.mts +49 -14
  19. package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
  20. package/dist/esm/account/FederatedKeylessAccount.d.mts +3 -3
  21. package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
  22. package/dist/esm/account/KeylessAccount.d.mts +37 -3
  23. package/dist/esm/account/KeylessAccount.mjs +1 -1
  24. package/dist/esm/account/MultiKeyAccount.d.mts +54 -34
  25. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  26. package/dist/esm/account/SingleKeyAccount.d.mts +2 -2
  27. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  28. package/dist/esm/account/index.d.mts +2 -2
  29. package/dist/esm/account/index.mjs +1 -1
  30. package/dist/esm/api/account.d.mts +445 -160
  31. package/dist/esm/api/account.mjs +1 -1
  32. package/dist/esm/api/ans.d.mts +369 -122
  33. package/dist/esm/api/ans.mjs +1 -1
  34. package/dist/esm/api/aptos.d.mts +40 -7
  35. package/dist/esm/api/aptos.mjs +1 -1
  36. package/dist/esm/api/aptosConfig.d.mts +102 -14
  37. package/dist/esm/api/aptosConfig.mjs +1 -1
  38. package/dist/esm/api/coin.d.mts +50 -13
  39. package/dist/esm/api/coin.mjs +1 -1
  40. package/dist/esm/api/digitalAsset.d.mts +708 -298
  41. package/dist/esm/api/digitalAsset.mjs +1 -1
  42. package/dist/esm/api/event.d.mts +128 -25
  43. package/dist/esm/api/event.mjs +1 -1
  44. package/dist/esm/api/faucet.d.mts +44 -7
  45. package/dist/esm/api/faucet.mjs +1 -1
  46. package/dist/esm/api/fungibleAsset.d.mts +151 -48
  47. package/dist/esm/api/fungibleAsset.mjs +1 -1
  48. package/dist/esm/api/general.d.mts +169 -53
  49. package/dist/esm/api/general.mjs +1 -1
  50. package/dist/esm/api/index.d.mts +2 -2
  51. package/dist/esm/api/index.mjs +1 -1
  52. package/dist/esm/api/keyless.d.mts +81 -10
  53. package/dist/esm/api/keyless.mjs +1 -1
  54. package/dist/esm/api/object.d.mts +49 -5
  55. package/dist/esm/api/object.mjs +1 -1
  56. package/dist/esm/api/staking.d.mts +84 -15
  57. package/dist/esm/api/staking.mjs +1 -1
  58. package/dist/esm/api/table.d.mts +117 -37
  59. package/dist/esm/api/table.mjs +1 -1
  60. package/dist/esm/api/transaction.d.mts +440 -109
  61. package/dist/esm/api/transaction.mjs +1 -1
  62. package/dist/esm/api/transactionSubmission/build.d.mts +99 -13
  63. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  64. package/dist/esm/api/transactionSubmission/helpers.d.mts +79 -0
  65. package/dist/esm/api/transactionSubmission/helpers.mjs +1 -1
  66. package/dist/esm/api/transactionSubmission/management.d.mts +111 -12
  67. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  68. package/dist/esm/api/transactionSubmission/sign.d.mts +97 -3
  69. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  70. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  71. package/dist/esm/api/transactionSubmission/simulate.d.mts +140 -15
  72. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  73. package/dist/esm/api/transactionSubmission/submit.d.mts +104 -13
  74. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  75. package/dist/esm/api/utils.d.mts +26 -3
  76. package/dist/esm/api/utils.mjs +1 -1
  77. package/dist/esm/bcs/consts.mjs +1 -1
  78. package/dist/esm/bcs/deserializer.d.mts +82 -32
  79. package/dist/esm/bcs/deserializer.mjs +1 -1
  80. package/dist/esm/bcs/index.mjs +1 -1
  81. package/dist/esm/bcs/serializable/entryFunctionBytes.d.mts +25 -6
  82. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  83. package/dist/esm/bcs/serializable/fixedBytes.d.mts +51 -21
  84. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  85. package/dist/esm/bcs/serializable/movePrimitives.d.mts +79 -0
  86. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  87. package/dist/esm/bcs/serializable/moveStructs.d.mts +119 -32
  88. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  89. package/dist/esm/bcs/serializer.d.mts +111 -76
  90. package/dist/esm/bcs/serializer.mjs +1 -1
  91. package/dist/esm/{chunk-U6Z4FNB7.mjs → chunk-2CJC43CV.mjs} +1 -1
  92. package/dist/esm/chunk-2CJC43CV.mjs.map +1 -0
  93. package/dist/esm/{chunk-WWZ3METZ.mjs → chunk-2I56E4T2.mjs} +2 -2
  94. package/dist/esm/chunk-2I56E4T2.mjs.map +1 -0
  95. package/dist/esm/{chunk-HSPBA2TZ.mjs → chunk-2QRWGJJA.mjs} +2 -2
  96. package/dist/esm/chunk-2QRWGJJA.mjs.map +1 -0
  97. package/dist/esm/chunk-37UZKMJI.mjs +2 -0
  98. package/dist/esm/chunk-37UZKMJI.mjs.map +1 -0
  99. package/dist/esm/chunk-4CDDWSKZ.mjs +2 -0
  100. package/dist/esm/chunk-4CDDWSKZ.mjs.map +1 -0
  101. package/dist/esm/chunk-4OV7QU2U.mjs +2 -0
  102. package/dist/esm/chunk-4OV7QU2U.mjs.map +1 -0
  103. package/dist/esm/{chunk-RNTXQYJQ.mjs → chunk-5AAFF2PV.mjs} +2 -2
  104. package/dist/esm/chunk-5AAFF2PV.mjs.map +1 -0
  105. package/dist/esm/chunk-5CCHECTE.mjs +2 -0
  106. package/dist/esm/chunk-5CCHECTE.mjs.map +1 -0
  107. package/dist/esm/{chunk-CPPBQDHB.mjs → chunk-5XXIIWG7.mjs} +2 -2
  108. package/dist/esm/chunk-5XXIIWG7.mjs.map +1 -0
  109. package/dist/esm/{chunk-K2O24YLZ.mjs → chunk-5ZBHIUWG.mjs} +2 -2
  110. package/dist/esm/chunk-5ZBHIUWG.mjs.map +1 -0
  111. package/dist/esm/chunk-6AGTDRNM.mjs +2 -0
  112. package/dist/esm/chunk-6AGTDRNM.mjs.map +1 -0
  113. package/dist/esm/chunk-6FLHGOKP.mjs +2 -0
  114. package/dist/esm/chunk-6FLHGOKP.mjs.map +1 -0
  115. package/dist/esm/{chunk-LG7RJQ57.mjs → chunk-6Q2O5G3J.mjs} +1 -1
  116. package/dist/esm/chunk-6Q2O5G3J.mjs.map +1 -0
  117. package/dist/esm/chunk-7D3RY73L.mjs +2 -0
  118. package/dist/esm/chunk-7D3RY73L.mjs.map +1 -0
  119. package/dist/esm/{chunk-5655UVIK.mjs → chunk-7PVIWKGT.mjs} +2 -2
  120. package/dist/esm/chunk-7PVIWKGT.mjs.map +1 -0
  121. package/dist/esm/chunk-7V6RL27I.mjs +2 -0
  122. package/dist/esm/chunk-7V6RL27I.mjs.map +1 -0
  123. package/dist/esm/{chunk-44GYWUSH.mjs → chunk-7XS45O6M.mjs} +1 -1
  124. package/dist/esm/chunk-7XS45O6M.mjs.map +1 -0
  125. package/dist/esm/{chunk-E37YRKWK.mjs → chunk-AGBA3Y7A.mjs} +2 -2
  126. package/dist/esm/chunk-AGBA3Y7A.mjs.map +1 -0
  127. package/dist/esm/{chunk-ECWOLU5T.mjs → chunk-BQXVHY7J.mjs} +2 -2
  128. package/dist/esm/chunk-BQXVHY7J.mjs.map +1 -0
  129. package/dist/esm/{chunk-PUZ25PTD.mjs → chunk-CRL4WGOH.mjs} +2 -2
  130. package/dist/esm/chunk-CRL4WGOH.mjs.map +1 -0
  131. package/dist/esm/{chunk-SWHLSREF.mjs → chunk-D3KBNFZR.mjs} +2 -2
  132. package/dist/esm/chunk-D3KBNFZR.mjs.map +1 -0
  133. package/dist/esm/{chunk-SCHZ67F3.mjs → chunk-D3OEQLUE.mjs} +1 -1
  134. package/dist/esm/{chunk-SCHZ67F3.mjs.map → chunk-D3OEQLUE.mjs.map} +1 -1
  135. package/dist/esm/{chunk-MO4IZXLK.mjs → chunk-DCUVV3VY.mjs} +2 -2
  136. package/dist/esm/chunk-DCUVV3VY.mjs.map +1 -0
  137. package/dist/esm/{chunk-AFOPNDOJ.mjs → chunk-DXQT55L3.mjs} +2 -2
  138. package/dist/esm/chunk-DXQT55L3.mjs.map +1 -0
  139. package/dist/esm/chunk-DZJXOL64.mjs +2 -0
  140. package/dist/esm/chunk-DZJXOL64.mjs.map +1 -0
  141. package/dist/esm/{chunk-QCUFTD7K.mjs → chunk-EF2PUPUH.mjs} +2 -2
  142. package/dist/esm/chunk-EF2PUPUH.mjs.map +1 -0
  143. package/dist/esm/{chunk-XXHW3ZT3.mjs → chunk-EKZQ3EYX.mjs} +2 -2
  144. package/dist/esm/chunk-EKZQ3EYX.mjs.map +1 -0
  145. package/dist/esm/{chunk-XH7YKEYR.mjs → chunk-EN2HDNFE.mjs} +2 -2
  146. package/dist/esm/chunk-EN2HDNFE.mjs.map +1 -0
  147. package/dist/esm/{chunk-TL7DR54X.mjs → chunk-FO4F3OJJ.mjs} +2 -2
  148. package/dist/esm/chunk-FO4F3OJJ.mjs.map +1 -0
  149. package/dist/esm/{chunk-7ZLBJUVZ.mjs → chunk-FPF4KZ5M.mjs} +2 -2
  150. package/dist/esm/chunk-FPF4KZ5M.mjs.map +1 -0
  151. package/dist/esm/{chunk-Y7F2V3R6.mjs → chunk-FY7TSOUU.mjs} +2 -2
  152. package/dist/esm/chunk-FY7TSOUU.mjs.map +1 -0
  153. package/dist/esm/{chunk-XK3JFCP3.mjs → chunk-GIQQF2PD.mjs} +2 -2
  154. package/dist/esm/chunk-GIQQF2PD.mjs.map +1 -0
  155. package/dist/esm/{chunk-SRPI2FFA.mjs → chunk-GMKKHGXK.mjs} +1 -1
  156. package/dist/esm/chunk-GMKKHGXK.mjs.map +1 -0
  157. package/dist/esm/chunk-GPZRGLU2.mjs +2 -0
  158. package/dist/esm/chunk-GPZRGLU2.mjs.map +1 -0
  159. package/dist/esm/{chunk-TDGQGILY.mjs → chunk-GQABU3RQ.mjs} +1 -1
  160. package/dist/esm/chunk-GQABU3RQ.mjs.map +1 -0
  161. package/dist/esm/{chunk-BRFHAO2Y.mjs → chunk-HAMXSLWF.mjs} +2 -2
  162. package/dist/esm/chunk-HAMXSLWF.mjs.map +1 -0
  163. package/dist/esm/{chunk-AH44UPM4.mjs → chunk-HBIDHQ2M.mjs} +1 -1
  164. package/dist/esm/chunk-HBIDHQ2M.mjs.map +1 -0
  165. package/dist/esm/{chunk-FRGXKOU5.mjs → chunk-HCV3NGLS.mjs} +2 -2
  166. package/dist/esm/chunk-HCV3NGLS.mjs.map +1 -0
  167. package/dist/esm/{chunk-GFGX3QDP.mjs → chunk-HDTKBFRX.mjs} +2 -2
  168. package/dist/esm/chunk-HDTKBFRX.mjs.map +1 -0
  169. package/dist/esm/chunk-HGVZ7ULA.mjs +2 -0
  170. package/dist/esm/chunk-HGVZ7ULA.mjs.map +1 -0
  171. package/dist/esm/{chunk-6EMN3BOV.mjs → chunk-I2NMCLNW.mjs} +1 -1
  172. package/dist/esm/chunk-I2NMCLNW.mjs.map +1 -0
  173. package/dist/esm/chunk-IBLZ6MZU.mjs +2 -0
  174. package/dist/esm/chunk-IBLZ6MZU.mjs.map +1 -0
  175. package/dist/esm/chunk-IECDO22V.mjs +2 -0
  176. package/dist/esm/chunk-IECDO22V.mjs.map +1 -0
  177. package/dist/esm/{chunk-TMW2HIXC.mjs → chunk-IFHQSZLK.mjs} +2 -2
  178. package/dist/esm/chunk-IFHQSZLK.mjs.map +1 -0
  179. package/dist/esm/{chunk-EXP5STXZ.mjs → chunk-J245N3XF.mjs} +1 -1
  180. package/dist/esm/chunk-J245N3XF.mjs.map +1 -0
  181. package/dist/esm/{chunk-2TQIU7CG.mjs → chunk-JDYASF3E.mjs} +2 -2
  182. package/dist/esm/chunk-JDYASF3E.mjs.map +1 -0
  183. package/dist/esm/{chunk-MS4MRLGA.mjs → chunk-JGNMNCQB.mjs} +2 -2
  184. package/dist/esm/chunk-JGNMNCQB.mjs.map +1 -0
  185. package/dist/esm/{chunk-TS3PYRAT.mjs → chunk-JNHFQTFC.mjs} +2 -2
  186. package/dist/esm/chunk-JNHFQTFC.mjs.map +1 -0
  187. package/dist/esm/{chunk-CVDR5SJR.mjs → chunk-JY3JJ55D.mjs} +2 -2
  188. package/dist/esm/chunk-JY3JJ55D.mjs.map +1 -0
  189. package/dist/esm/{chunk-KYSDF3CA.mjs → chunk-K6MZXKVV.mjs} +2 -2
  190. package/dist/esm/chunk-K6MZXKVV.mjs.map +1 -0
  191. package/dist/esm/{chunk-FVA2OPG4.mjs → chunk-KDMSOCZY.mjs} +1 -1
  192. package/dist/esm/{chunk-BCUSI3N6.mjs → chunk-KFNDDPOW.mjs} +2 -2
  193. package/dist/esm/chunk-KFNDDPOW.mjs.map +1 -0
  194. package/dist/esm/{chunk-DF4WKSTK.mjs → chunk-KFSVKIFO.mjs} +2 -2
  195. package/dist/esm/chunk-KFSVKIFO.mjs.map +1 -0
  196. package/dist/esm/chunk-KIW54KWR.mjs +2 -0
  197. package/dist/esm/{chunk-QPP6BX53.mjs → chunk-KM6UXNC7.mjs} +2 -2
  198. package/dist/esm/chunk-KM6UXNC7.mjs.map +1 -0
  199. package/dist/esm/{chunk-PKXEB7XP.mjs → chunk-KRVLR3L4.mjs} +2 -2
  200. package/dist/esm/chunk-KRVLR3L4.mjs.map +1 -0
  201. package/dist/esm/{chunk-B6M7QBUO.mjs → chunk-KSKQVOBA.mjs} +2 -2
  202. package/dist/esm/chunk-KSKQVOBA.mjs.map +1 -0
  203. package/dist/esm/{chunk-G7MWTE2J.mjs → chunk-KSUZS6EL.mjs} +2 -2
  204. package/dist/esm/{chunk-YHAPZP5A.mjs → chunk-L5I7F3NZ.mjs} +2 -2
  205. package/dist/esm/chunk-L5I7F3NZ.mjs.map +1 -0
  206. package/dist/esm/{chunk-XONG5JZ4.mjs → chunk-LD5MUWGW.mjs} +2 -2
  207. package/dist/esm/chunk-LD5MUWGW.mjs.map +1 -0
  208. package/dist/esm/{chunk-UAL27G6B.mjs → chunk-LEKBJ2EG.mjs} +1 -1
  209. package/dist/esm/chunk-LEKBJ2EG.mjs.map +1 -0
  210. package/dist/esm/{chunk-6RZZIOGH.mjs → chunk-LZS7BQ2B.mjs} +2 -2
  211. package/dist/esm/chunk-LZS7BQ2B.mjs.map +1 -0
  212. package/dist/esm/{chunk-3YKAGVHZ.mjs → chunk-N3OYD6VZ.mjs} +2 -2
  213. package/dist/esm/chunk-N3OYD6VZ.mjs.map +1 -0
  214. package/dist/esm/{chunk-KEYAPEAX.mjs → chunk-N47FTRYO.mjs} +1 -1
  215. package/dist/esm/chunk-N47FTRYO.mjs.map +1 -0
  216. package/dist/esm/{chunk-QIW56MUH.mjs → chunk-NODYW7DM.mjs} +2 -2
  217. package/dist/esm/chunk-NODYW7DM.mjs.map +1 -0
  218. package/dist/esm/{chunk-25TIHDS6.mjs → chunk-NV6DHDM3.mjs} +2 -2
  219. package/dist/esm/chunk-NV6DHDM3.mjs.map +1 -0
  220. package/dist/esm/{chunk-EV2USF7B.mjs → chunk-OLPI7QAH.mjs} +2 -2
  221. package/dist/esm/chunk-OLPI7QAH.mjs.map +1 -0
  222. package/dist/esm/chunk-ONBFUPEC.mjs +2 -0
  223. package/dist/esm/chunk-ONBFUPEC.mjs.map +1 -0
  224. package/dist/esm/{chunk-N5JNKD5F.mjs → chunk-OS2EG6AE.mjs} +2 -2
  225. package/dist/esm/chunk-OS2EG6AE.mjs.map +1 -0
  226. package/dist/esm/chunk-OTY3NO7Q.mjs +2 -0
  227. package/dist/esm/chunk-OTY3NO7Q.mjs.map +1 -0
  228. package/dist/esm/{chunk-25NSCK4Q.mjs → chunk-OV5UQ75K.mjs} +2 -2
  229. package/dist/esm/chunk-OV5UQ75K.mjs.map +1 -0
  230. package/dist/esm/{chunk-YJCZU6PR.mjs → chunk-OZN3OOJV.mjs} +2 -2
  231. package/dist/esm/chunk-OZN3OOJV.mjs.map +1 -0
  232. package/dist/esm/{chunk-WP7WF54Q.mjs → chunk-PCLU4KLY.mjs} +2 -2
  233. package/dist/esm/chunk-PCLU4KLY.mjs.map +1 -0
  234. package/dist/esm/{chunk-SR24OGHJ.mjs → chunk-PGZWRY7A.mjs} +2 -2
  235. package/dist/esm/chunk-PGZWRY7A.mjs.map +1 -0
  236. package/dist/esm/{chunk-SAPUZZEU.mjs → chunk-PHG2IWZW.mjs} +2 -2
  237. package/dist/esm/chunk-PHG2IWZW.mjs.map +1 -0
  238. package/dist/esm/{chunk-LR65XHSF.mjs → chunk-PHP47DI4.mjs} +2 -2
  239. package/dist/esm/chunk-PHP47DI4.mjs.map +1 -0
  240. package/dist/esm/chunk-PRZ7AIGA.mjs +2 -0
  241. package/dist/esm/chunk-PRZ7AIGA.mjs.map +1 -0
  242. package/dist/esm/{chunk-OY2IX7HW.mjs → chunk-QBP4XJT5.mjs} +2 -2
  243. package/dist/esm/chunk-QBP4XJT5.mjs.map +1 -0
  244. package/dist/esm/{chunk-ZGO2SK6F.mjs → chunk-QBWGWHJK.mjs} +2 -2
  245. package/dist/esm/chunk-QBWGWHJK.mjs.map +1 -0
  246. package/dist/esm/chunk-QQIVWB6G.mjs +2 -0
  247. package/dist/esm/chunk-QQIVWB6G.mjs.map +1 -0
  248. package/dist/esm/{chunk-IYQISVDX.mjs → chunk-QRTZYRH2.mjs} +2 -2
  249. package/dist/esm/chunk-QRTZYRH2.mjs.map +1 -0
  250. package/dist/esm/{chunk-NH2S6SB2.mjs → chunk-R3Y6WH2U.mjs} +2 -2
  251. package/dist/esm/chunk-R3Y6WH2U.mjs.map +1 -0
  252. package/dist/esm/{chunk-X4KEZTUQ.mjs → chunk-RAXP3STS.mjs} +2 -2
  253. package/dist/esm/chunk-RAXP3STS.mjs.map +1 -0
  254. package/dist/esm/{chunk-TVFIUUVY.mjs → chunk-RNAKZVRN.mjs} +2 -2
  255. package/dist/esm/chunk-RNAKZVRN.mjs.map +1 -0
  256. package/dist/esm/{chunk-NNRAQP36.mjs → chunk-RUDS7RSB.mjs} +2 -2
  257. package/dist/esm/chunk-RUDS7RSB.mjs.map +1 -0
  258. package/dist/esm/{chunk-U67PFBTL.mjs → chunk-S3FVA55H.mjs} +2 -2
  259. package/dist/esm/chunk-S3FVA55H.mjs.map +1 -0
  260. package/dist/esm/{chunk-LDFTE4MM.mjs → chunk-TIZL5YVP.mjs} +2 -2
  261. package/dist/esm/chunk-TIZL5YVP.mjs.map +1 -0
  262. package/dist/esm/{chunk-EWZ2M5BW.mjs → chunk-TRU3EK64.mjs} +2 -2
  263. package/dist/esm/chunk-TRU3EK64.mjs.map +1 -0
  264. package/dist/esm/chunk-UI3AKMZX.mjs +2 -0
  265. package/dist/esm/{chunk-555I4YHP.mjs.map → chunk-UI3AKMZX.mjs.map} +1 -1
  266. package/dist/esm/{chunk-B2CXRZL5.mjs → chunk-UKAXCARD.mjs} +2 -2
  267. package/dist/esm/chunk-UKAXCARD.mjs.map +1 -0
  268. package/dist/esm/{chunk-NMD45OTM.mjs → chunk-V5NDNR36.mjs} +2 -2
  269. package/dist/esm/chunk-V5NDNR36.mjs.map +1 -0
  270. package/dist/esm/{chunk-KXBIA4KR.mjs → chunk-VQTEGTUQ.mjs} +2 -2
  271. package/dist/esm/chunk-VQTEGTUQ.mjs.map +1 -0
  272. package/dist/esm/{chunk-BD6BJETG.mjs → chunk-WIXNX7HY.mjs} +2 -2
  273. package/dist/esm/chunk-WIXNX7HY.mjs.map +1 -0
  274. package/dist/esm/{chunk-7V6DEA7G.mjs → chunk-WOOH5MMX.mjs} +2 -2
  275. package/dist/esm/chunk-WOOH5MMX.mjs.map +1 -0
  276. package/dist/esm/{chunk-DAJOX4PL.mjs → chunk-WSVOJSAC.mjs} +2 -2
  277. package/dist/esm/chunk-WSVOJSAC.mjs.map +1 -0
  278. package/dist/esm/{chunk-L5NY7TMI.mjs → chunk-WUCPTRXU.mjs} +2 -2
  279. package/dist/esm/chunk-WUCPTRXU.mjs.map +1 -0
  280. package/dist/esm/chunk-XHCALZ7X.mjs +2 -0
  281. package/dist/esm/chunk-XHCALZ7X.mjs.map +1 -0
  282. package/dist/esm/{chunk-DAXKRXRK.mjs → chunk-XIY2VORC.mjs} +2 -2
  283. package/dist/esm/chunk-XIY2VORC.mjs.map +1 -0
  284. package/dist/esm/chunk-XOCRDV2V.mjs +2 -0
  285. package/dist/esm/chunk-XOCRDV2V.mjs.map +1 -0
  286. package/dist/esm/{chunk-STGYDB5E.mjs → chunk-Z36WHOZV.mjs} +2 -2
  287. package/dist/esm/chunk-Z36WHOZV.mjs.map +1 -0
  288. package/dist/esm/{chunk-LXLISEQ4.mjs → chunk-ZINOJTLU.mjs} +2 -2
  289. package/dist/esm/chunk-ZINOJTLU.mjs.map +1 -0
  290. package/dist/esm/{chunk-46D5QX3G.mjs → chunk-ZS3EWM5A.mjs} +2 -2
  291. package/dist/esm/chunk-ZS3EWM5A.mjs.map +1 -0
  292. package/dist/esm/{chunk-QLN2URFX.mjs → chunk-ZUTOMGB7.mjs} +2 -2
  293. package/dist/esm/chunk-ZUTOMGB7.mjs.map +1 -0
  294. package/dist/esm/cli/index.mjs +1 -1
  295. package/dist/esm/cli/localNode.d.mts +26 -10
  296. package/dist/esm/cli/localNode.mjs +1 -1
  297. package/dist/esm/cli/move.d.mts +104 -123
  298. package/dist/esm/cli/move.mjs +1 -1
  299. package/dist/esm/client/core.d.mts +21 -6
  300. package/dist/esm/client/core.mjs +1 -1
  301. package/dist/esm/client/get.d.mts +34 -6
  302. package/dist/esm/client/get.mjs +1 -1
  303. package/dist/esm/client/index.mjs +1 -1
  304. package/dist/esm/client/post.d.mts +63 -6
  305. package/dist/esm/client/post.mjs +1 -1
  306. package/dist/esm/client/types.d.mts +21 -8
  307. package/dist/esm/client/types.mjs +1 -1
  308. package/dist/esm/core/account/index.mjs +1 -1
  309. package/dist/esm/core/account/utils/address.d.mts +1 -1
  310. package/dist/esm/core/account/utils/address.mjs +1 -1
  311. package/dist/esm/core/account/utils/index.mjs +1 -1
  312. package/dist/esm/core/accountAddress.d.mts +63 -48
  313. package/dist/esm/core/accountAddress.mjs +1 -1
  314. package/dist/esm/core/authenticationKey.d.mts +1 -1
  315. package/dist/esm/core/authenticationKey.mjs +1 -1
  316. package/dist/esm/core/common.d.mts +6 -0
  317. package/dist/esm/core/common.mjs +1 -1
  318. package/dist/esm/core/crypto/ed25519.d.mts +77 -26
  319. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  320. package/dist/esm/core/crypto/ephemeral.d.mts +36 -14
  321. package/dist/esm/core/crypto/ephemeral.mjs +1 -1
  322. package/dist/esm/core/crypto/federatedKeyless.d.mts +2 -14
  323. package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
  324. package/dist/esm/core/crypto/hdKey.d.mts +9 -6
  325. package/dist/esm/core/crypto/hdKey.mjs +1 -1
  326. package/dist/esm/core/crypto/index.d.mts +1 -1
  327. package/dist/esm/core/crypto/index.mjs +1 -1
  328. package/dist/esm/core/crypto/keyless.d.mts +126 -45
  329. package/dist/esm/core/crypto/keyless.mjs +1 -1
  330. package/dist/esm/core/crypto/multiEd25519.d.mts +45 -6
  331. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  332. package/dist/esm/core/crypto/multiKey.d.mts +58 -7
  333. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  334. package/dist/esm/core/crypto/poseidon.d.mts +35 -5
  335. package/dist/esm/core/crypto/poseidon.mjs +1 -1
  336. package/dist/esm/core/crypto/privateKey.d.mts +10 -6
  337. package/dist/esm/core/crypto/proof.d.mts +2 -6
  338. package/dist/esm/core/crypto/proof.mjs +1 -1
  339. package/dist/esm/core/crypto/publicKey.d.mts +1 -1
  340. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  341. package/dist/esm/core/crypto/secp256k1.d.mts +72 -27
  342. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  343. package/dist/esm/core/crypto/signature.d.mts +5 -4
  344. package/dist/esm/core/crypto/signature.mjs +1 -1
  345. package/dist/esm/core/crypto/singleKey.d.mts +63 -5
  346. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  347. package/dist/esm/core/crypto/utils.mjs +1 -1
  348. package/dist/esm/core/hex.d.mts +27 -28
  349. package/dist/esm/core/hex.mjs +1 -1
  350. package/dist/esm/core/index.d.mts +1 -1
  351. package/dist/esm/core/index.mjs +1 -1
  352. package/dist/esm/index.d.mts +2 -2
  353. package/dist/esm/index.mjs +1 -1
  354. package/dist/esm/internal/account.d.mts +191 -12
  355. package/dist/esm/internal/account.mjs +1 -1
  356. package/dist/esm/internal/ans.d.mts +206 -14
  357. package/dist/esm/internal/ans.mjs +1 -1
  358. package/dist/esm/internal/coin.d.mts +13 -1
  359. package/dist/esm/internal/coin.mjs +1 -1
  360. package/dist/esm/internal/digitalAsset.d.mts +330 -2
  361. package/dist/esm/internal/digitalAsset.mjs +1 -1
  362. package/dist/esm/internal/event.d.mts +39 -0
  363. package/dist/esm/internal/event.mjs +1 -1
  364. package/dist/esm/internal/faucet.d.mts +14 -0
  365. package/dist/esm/internal/faucet.mjs +1 -1
  366. package/dist/esm/internal/fungibleAsset.d.mts +48 -2
  367. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  368. package/dist/esm/internal/general.d.mts +46 -0
  369. package/dist/esm/internal/general.mjs +1 -1
  370. package/dist/esm/internal/keyless.d.mts +38 -2
  371. package/dist/esm/internal/keyless.mjs +1 -1
  372. package/dist/esm/internal/object.d.mts +21 -0
  373. package/dist/esm/internal/object.mjs +1 -1
  374. package/dist/esm/internal/staking.d.mts +26 -0
  375. package/dist/esm/internal/staking.mjs +1 -1
  376. package/dist/esm/internal/table.d.mts +33 -1
  377. package/dist/esm/internal/table.mjs +1 -1
  378. package/dist/esm/internal/transaction.d.mts +107 -5
  379. package/dist/esm/internal/transaction.mjs +1 -1
  380. package/dist/esm/internal/transactionSubmission.d.mts +72 -29
  381. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  382. package/dist/esm/internal/view.d.mts +1 -1
  383. package/dist/esm/internal/view.mjs +1 -1
  384. package/dist/esm/publicKey-_tPa99ea.d.mts +151 -0
  385. package/dist/esm/transactions/authenticator/account.d.mts +66 -17
  386. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  387. package/dist/esm/transactions/authenticator/index.d.mts +1 -1
  388. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  389. package/dist/esm/transactions/authenticator/transaction.d.mts +53 -20
  390. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  391. package/dist/esm/transactions/index.d.mts +1 -1
  392. package/dist/esm/transactions/index.mjs +1 -1
  393. package/dist/esm/transactions/instances/chainId.d.mts +20 -1
  394. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  395. package/dist/esm/transactions/instances/identifier.d.mts +21 -3
  396. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  397. package/dist/esm/transactions/instances/index.d.mts +1 -1
  398. package/dist/esm/transactions/instances/index.mjs +1 -1
  399. package/dist/esm/transactions/instances/moduleId.d.mts +22 -8
  400. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  401. package/dist/esm/transactions/instances/multiAgentTransaction.d.mts +24 -8
  402. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  403. package/dist/esm/transactions/instances/rawTransaction.d.mts +31 -4
  404. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  405. package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +25 -3
  406. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  407. package/dist/esm/transactions/instances/signedTransaction.d.mts +29 -7
  408. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  409. package/dist/esm/transactions/instances/simpleTransaction.d.mts +23 -8
  410. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  411. package/dist/esm/transactions/instances/transactionArgument.d.mts +23 -0
  412. package/dist/esm/transactions/instances/transactionPayload.d.mts +72 -26
  413. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  414. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +37 -11
  415. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  416. package/dist/esm/transactions/management/asyncQueue.d.mts +22 -19
  417. package/dist/esm/transactions/management/asyncQueue.mjs +1 -1
  418. package/dist/esm/transactions/management/index.d.mts +2 -2
  419. package/dist/esm/transactions/management/index.mjs +1 -1
  420. package/dist/esm/transactions/management/transactionWorker.d.mts +67 -36
  421. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  422. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +74 -4
  423. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  424. package/dist/esm/transactions/transactionBuilder/index.d.mts +1 -1
  425. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  426. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +45 -23
  427. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  428. package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +20 -15
  429. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  430. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +101 -30
  431. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  432. package/dist/esm/transactions/typeTag/index.d.mts +244 -3
  433. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  434. package/dist/esm/transactions/typeTag/parser.d.mts +31 -2
  435. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  436. package/dist/esm/transactions/types.d.mts +82 -34
  437. package/dist/esm/types/generated/queries.mjs +1 -1
  438. package/dist/esm/types/generated/types.mjs +1 -1
  439. package/dist/esm/types/index.d.mts +320 -59
  440. package/dist/esm/types/index.mjs +1 -1
  441. package/dist/esm/types/indexer.d.mts +65 -2
  442. package/dist/esm/types/keyless.d.mts +18 -0
  443. package/dist/esm/utils/apiEndpoints.d.mts +3 -0
  444. package/dist/esm/utils/apiEndpoints.mjs +1 -1
  445. package/dist/esm/utils/const.d.mts +2 -4
  446. package/dist/esm/utils/const.mjs +1 -1
  447. package/dist/esm/utils/helpers.d.mts +25 -10
  448. package/dist/esm/utils/helpers.mjs +1 -1
  449. package/dist/esm/utils/index.mjs +1 -1
  450. package/dist/esm/utils/memoize.d.mts +12 -10
  451. package/dist/esm/utils/memoize.mjs +1 -1
  452. package/dist/esm/utils/normalizeBundle.d.mts +11 -5
  453. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  454. package/dist/esm/version.d.mts +1 -1
  455. package/dist/esm/version.mjs +1 -1
  456. package/package.json +3 -2
  457. package/src/account/AbstractKeylessAccount.ts +4 -3
  458. package/src/account/Account.ts +88 -54
  459. package/src/account/Ed25519Account.ts +56 -21
  460. package/src/account/EphemeralKeyPair.ts +50 -15
  461. package/src/account/FederatedKeylessAccount.ts +1 -1
  462. package/src/account/KeylessAccount.ts +37 -1
  463. package/src/account/MultiKeyAccount.ts +56 -35
  464. package/src/account/SingleKeyAccount.ts +60 -28
  465. package/src/api/account.ts +443 -159
  466. package/src/api/ans.ts +367 -120
  467. package/src/api/aptos.ts +38 -5
  468. package/src/api/aptosConfig.ts +102 -14
  469. package/src/api/coin.ts +49 -12
  470. package/src/api/digitalAsset.ts +707 -296
  471. package/src/api/event.ts +128 -25
  472. package/src/api/faucet.ts +44 -7
  473. package/src/api/fungibleAsset.ts +149 -46
  474. package/src/api/general.ts +168 -52
  475. package/src/api/keyless.ts +117 -21
  476. package/src/api/object.ts +49 -5
  477. package/src/api/staking.ts +84 -15
  478. package/src/api/table.ts +117 -37
  479. package/src/api/transaction.ts +438 -107
  480. package/src/api/transactionSubmission/build.ts +98 -12
  481. package/src/api/transactionSubmission/helpers.ts +79 -0
  482. package/src/api/transactionSubmission/management.ts +110 -10
  483. package/src/api/transactionSubmission/sign.ts +96 -2
  484. package/src/api/transactionSubmission/simulate.ts +139 -14
  485. package/src/api/transactionSubmission/submit.ts +103 -12
  486. package/src/api/utils.ts +26 -3
  487. package/src/bcs/deserializer.ts +82 -32
  488. package/src/bcs/serializable/entryFunctionBytes.ts +27 -6
  489. package/src/bcs/serializable/fixedBytes.ts +55 -25
  490. package/src/bcs/serializable/movePrimitives.ts +91 -0
  491. package/src/bcs/serializable/moveStructs.ts +123 -35
  492. package/src/bcs/serializer.ts +131 -84
  493. package/src/cli/localNode.ts +46 -17
  494. package/src/cli/move.ts +119 -136
  495. package/src/client/core.ts +22 -7
  496. package/src/client/get.ts +34 -6
  497. package/src/client/post.ts +63 -6
  498. package/src/client/types.ts +40 -13
  499. package/src/core/account/utils/address.ts +1 -1
  500. package/src/core/accountAddress.ts +63 -50
  501. package/src/core/authenticationKey.ts +47 -20
  502. package/src/core/common.ts +6 -0
  503. package/src/core/crypto/ed25519.ts +76 -25
  504. package/src/core/crypto/ephemeral.ts +37 -21
  505. package/src/core/crypto/federatedKeyless.ts +1 -20
  506. package/src/core/crypto/hdKey.ts +10 -7
  507. package/src/core/crypto/keyless.ts +140 -63
  508. package/src/core/crypto/multiEd25519.ts +44 -5
  509. package/src/core/crypto/multiKey.ts +66 -19
  510. package/src/core/crypto/poseidon.ts +72 -5
  511. package/src/core/crypto/privateKey.ts +9 -5
  512. package/src/core/crypto/proof.ts +3 -12
  513. package/src/core/crypto/publicKey.ts +15 -5
  514. package/src/core/crypto/secp256k1.ts +76 -26
  515. package/src/core/crypto/signature.ts +7 -4
  516. package/src/core/crypto/singleKey.ts +62 -5
  517. package/src/core/hex.ts +27 -28
  518. package/src/internal/account.ts +248 -12
  519. package/src/internal/ans.ts +219 -15
  520. package/src/internal/coin.ts +12 -0
  521. package/src/internal/digitalAsset.ts +344 -3
  522. package/src/internal/event.ts +51 -0
  523. package/src/internal/faucet.ts +14 -0
  524. package/src/internal/fungibleAsset.ts +46 -0
  525. package/src/internal/general.ts +46 -0
  526. package/src/internal/keyless.ts +37 -1
  527. package/src/internal/object.ts +21 -0
  528. package/src/internal/queries/getTableItemsData.graphql +1 -1
  529. package/src/internal/queries/getTableItemsMetadata.graphql +1 -1
  530. package/src/internal/staking.ts +27 -1
  531. package/src/internal/table.ts +32 -0
  532. package/src/internal/transaction.ts +120 -7
  533. package/src/internal/transactionSubmission.ts +86 -30
  534. package/src/transactions/authenticator/account.ts +65 -16
  535. package/src/transactions/authenticator/transaction.ts +52 -19
  536. package/src/transactions/instances/chainId.ts +20 -1
  537. package/src/transactions/instances/identifier.ts +21 -3
  538. package/src/transactions/instances/moduleId.ts +22 -8
  539. package/src/transactions/instances/multiAgentTransaction.ts +26 -10
  540. package/src/transactions/instances/rawTransaction.ts +31 -4
  541. package/src/transactions/instances/rotationProofChallenge.ts +24 -2
  542. package/src/transactions/instances/signedTransaction.ts +28 -6
  543. package/src/transactions/instances/simpleTransaction.ts +26 -11
  544. package/src/transactions/instances/transactionArgument.ts +26 -0
  545. package/src/transactions/instances/transactionPayload.ts +73 -26
  546. package/src/transactions/management/accountSequenceNumber.ts +38 -11
  547. package/src/transactions/management/asyncQueue.ts +22 -19
  548. package/src/transactions/management/transactionWorker.ts +66 -40
  549. package/src/transactions/transactionBuilder/helpers.ts +130 -3
  550. package/src/transactions/transactionBuilder/remoteAbi.ts +71 -30
  551. package/src/transactions/transactionBuilder/signingMessage.ts +19 -14
  552. package/src/transactions/transactionBuilder/transactionBuilder.ts +153 -40
  553. package/src/transactions/typeTag/index.ts +264 -3
  554. package/src/transactions/typeTag/parser.ts +54 -20
  555. package/src/transactions/types.ts +81 -33
  556. package/src/types/index.ts +338 -61
  557. package/src/types/indexer.ts +82 -2
  558. package/src/types/keyless.ts +21 -0
  559. package/src/utils/apiEndpoints.ts +3 -0
  560. package/src/utils/const.ts +2 -4
  561. package/src/utils/helpers.ts +25 -10
  562. package/src/utils/memoize.ts +12 -10
  563. package/src/utils/normalizeBundle.ts +11 -5
  564. package/src/version.ts +1 -1
  565. package/dist/common/chunk-HBPH2AD3.js.map +0 -1
  566. package/dist/esm/Ed25519Account-B1VMJOY2.d.mts +0 -361
  567. package/dist/esm/chunk-25NSCK4Q.mjs.map +0 -1
  568. package/dist/esm/chunk-25TIHDS6.mjs.map +0 -1
  569. package/dist/esm/chunk-2TQIU7CG.mjs.map +0 -1
  570. package/dist/esm/chunk-3MCYLML2.mjs +0 -2
  571. package/dist/esm/chunk-3MCYLML2.mjs.map +0 -1
  572. package/dist/esm/chunk-3YKAGVHZ.mjs.map +0 -1
  573. package/dist/esm/chunk-44GYWUSH.mjs.map +0 -1
  574. package/dist/esm/chunk-46D5QX3G.mjs.map +0 -1
  575. package/dist/esm/chunk-555I4YHP.mjs +0 -2
  576. package/dist/esm/chunk-5655UVIK.mjs.map +0 -1
  577. package/dist/esm/chunk-6EMN3BOV.mjs.map +0 -1
  578. package/dist/esm/chunk-6QGVRNV6.mjs +0 -2
  579. package/dist/esm/chunk-6QGVRNV6.mjs.map +0 -1
  580. package/dist/esm/chunk-6RZZIOGH.mjs.map +0 -1
  581. package/dist/esm/chunk-7V6DEA7G.mjs.map +0 -1
  582. package/dist/esm/chunk-7ZLBJUVZ.mjs.map +0 -1
  583. package/dist/esm/chunk-AFOPNDOJ.mjs.map +0 -1
  584. package/dist/esm/chunk-AH44UPM4.mjs.map +0 -1
  585. package/dist/esm/chunk-B2CXRZL5.mjs.map +0 -1
  586. package/dist/esm/chunk-B5NYEWNM.mjs +0 -2
  587. package/dist/esm/chunk-B5NYEWNM.mjs.map +0 -1
  588. package/dist/esm/chunk-B6M7QBUO.mjs.map +0 -1
  589. package/dist/esm/chunk-BCUSI3N6.mjs.map +0 -1
  590. package/dist/esm/chunk-BD6BJETG.mjs.map +0 -1
  591. package/dist/esm/chunk-BF4ZE37Q.mjs +0 -2
  592. package/dist/esm/chunk-BF4ZE37Q.mjs.map +0 -1
  593. package/dist/esm/chunk-BKEJMQQ6.mjs +0 -2
  594. package/dist/esm/chunk-BKEJMQQ6.mjs.map +0 -1
  595. package/dist/esm/chunk-BRFHAO2Y.mjs.map +0 -1
  596. package/dist/esm/chunk-BSUYPXRD.mjs +0 -2
  597. package/dist/esm/chunk-BSUYPXRD.mjs.map +0 -1
  598. package/dist/esm/chunk-CCMHWJ3Q.mjs +0 -2
  599. package/dist/esm/chunk-CCMHWJ3Q.mjs.map +0 -1
  600. package/dist/esm/chunk-CPPBQDHB.mjs.map +0 -1
  601. package/dist/esm/chunk-CVDR5SJR.mjs.map +0 -1
  602. package/dist/esm/chunk-DAJOX4PL.mjs.map +0 -1
  603. package/dist/esm/chunk-DAXKRXRK.mjs.map +0 -1
  604. package/dist/esm/chunk-DF4WKSTK.mjs.map +0 -1
  605. package/dist/esm/chunk-E37YRKWK.mjs.map +0 -1
  606. package/dist/esm/chunk-ECWOLU5T.mjs.map +0 -1
  607. package/dist/esm/chunk-EV2USF7B.mjs.map +0 -1
  608. package/dist/esm/chunk-EWZ2M5BW.mjs.map +0 -1
  609. package/dist/esm/chunk-EXP5STXZ.mjs.map +0 -1
  610. package/dist/esm/chunk-FRGXKOU5.mjs.map +0 -1
  611. package/dist/esm/chunk-GFGX3QDP.mjs.map +0 -1
  612. package/dist/esm/chunk-GGR3P2TG.mjs +0 -2
  613. package/dist/esm/chunk-GGR3P2TG.mjs.map +0 -1
  614. package/dist/esm/chunk-HAT5S2XX.mjs +0 -2
  615. package/dist/esm/chunk-HAT5S2XX.mjs.map +0 -1
  616. package/dist/esm/chunk-HPZ2S4FE.mjs +0 -2
  617. package/dist/esm/chunk-HPZ2S4FE.mjs.map +0 -1
  618. package/dist/esm/chunk-HSPBA2TZ.mjs.map +0 -1
  619. package/dist/esm/chunk-IMGLHDIA.mjs +0 -2
  620. package/dist/esm/chunk-IMGLHDIA.mjs.map +0 -1
  621. package/dist/esm/chunk-IYQISVDX.mjs.map +0 -1
  622. package/dist/esm/chunk-K2O24YLZ.mjs.map +0 -1
  623. package/dist/esm/chunk-KA6FZNWP.mjs +0 -2
  624. package/dist/esm/chunk-KA6FZNWP.mjs.map +0 -1
  625. package/dist/esm/chunk-KEYAPEAX.mjs.map +0 -1
  626. package/dist/esm/chunk-KXBIA4KR.mjs.map +0 -1
  627. package/dist/esm/chunk-KYSDF3CA.mjs.map +0 -1
  628. package/dist/esm/chunk-L5NY7TMI.mjs.map +0 -1
  629. package/dist/esm/chunk-LDFTE4MM.mjs.map +0 -1
  630. package/dist/esm/chunk-LG3DAAPD.mjs +0 -2
  631. package/dist/esm/chunk-LG3DAAPD.mjs.map +0 -1
  632. package/dist/esm/chunk-LG7RJQ57.mjs.map +0 -1
  633. package/dist/esm/chunk-LGD5KU56.mjs +0 -2
  634. package/dist/esm/chunk-LGD5KU56.mjs.map +0 -1
  635. package/dist/esm/chunk-LR65XHSF.mjs.map +0 -1
  636. package/dist/esm/chunk-LXLISEQ4.mjs.map +0 -1
  637. package/dist/esm/chunk-M2QV232A.mjs +0 -2
  638. package/dist/esm/chunk-M2QV232A.mjs.map +0 -1
  639. package/dist/esm/chunk-MEWFJJJN.mjs +0 -2
  640. package/dist/esm/chunk-MEWFJJJN.mjs.map +0 -1
  641. package/dist/esm/chunk-MO4IZXLK.mjs.map +0 -1
  642. package/dist/esm/chunk-MS4MRLGA.mjs.map +0 -1
  643. package/dist/esm/chunk-N5JNKD5F.mjs.map +0 -1
  644. package/dist/esm/chunk-NH2S6SB2.mjs.map +0 -1
  645. package/dist/esm/chunk-NMD45OTM.mjs.map +0 -1
  646. package/dist/esm/chunk-NNRAQP36.mjs.map +0 -1
  647. package/dist/esm/chunk-OY2IX7HW.mjs.map +0 -1
  648. package/dist/esm/chunk-PKXEB7XP.mjs.map +0 -1
  649. package/dist/esm/chunk-PNXUYOYI.mjs +0 -2
  650. package/dist/esm/chunk-PNXUYOYI.mjs.map +0 -1
  651. package/dist/esm/chunk-PUZ25PTD.mjs.map +0 -1
  652. package/dist/esm/chunk-Q4XR6QOZ.mjs +0 -2
  653. package/dist/esm/chunk-QCUFTD7K.mjs.map +0 -1
  654. package/dist/esm/chunk-QDIKOQRK.mjs +0 -2
  655. package/dist/esm/chunk-QDIKOQRK.mjs.map +0 -1
  656. package/dist/esm/chunk-QIW56MUH.mjs.map +0 -1
  657. package/dist/esm/chunk-QLN2URFX.mjs.map +0 -1
  658. package/dist/esm/chunk-QPP6BX53.mjs.map +0 -1
  659. package/dist/esm/chunk-RNTXQYJQ.mjs.map +0 -1
  660. package/dist/esm/chunk-SAPUZZEU.mjs.map +0 -1
  661. package/dist/esm/chunk-SR24OGHJ.mjs.map +0 -1
  662. package/dist/esm/chunk-SRPI2FFA.mjs.map +0 -1
  663. package/dist/esm/chunk-STGYDB5E.mjs.map +0 -1
  664. package/dist/esm/chunk-SWHLSREF.mjs.map +0 -1
  665. package/dist/esm/chunk-TDGQGILY.mjs.map +0 -1
  666. package/dist/esm/chunk-TL7DR54X.mjs.map +0 -1
  667. package/dist/esm/chunk-TMW2HIXC.mjs.map +0 -1
  668. package/dist/esm/chunk-TS3PYRAT.mjs.map +0 -1
  669. package/dist/esm/chunk-TVFIUUVY.mjs.map +0 -1
  670. package/dist/esm/chunk-U67PFBTL.mjs.map +0 -1
  671. package/dist/esm/chunk-U6Z4FNB7.mjs.map +0 -1
  672. package/dist/esm/chunk-UAL27G6B.mjs.map +0 -1
  673. package/dist/esm/chunk-WP7WF54Q.mjs.map +0 -1
  674. package/dist/esm/chunk-WS4RPKL6.mjs +0 -2
  675. package/dist/esm/chunk-WS4RPKL6.mjs.map +0 -1
  676. package/dist/esm/chunk-WWZ3METZ.mjs.map +0 -1
  677. package/dist/esm/chunk-X4KEZTUQ.mjs.map +0 -1
  678. package/dist/esm/chunk-XH7YKEYR.mjs.map +0 -1
  679. package/dist/esm/chunk-XK3JFCP3.mjs.map +0 -1
  680. package/dist/esm/chunk-XONG5JZ4.mjs.map +0 -1
  681. package/dist/esm/chunk-XXHW3ZT3.mjs.map +0 -1
  682. package/dist/esm/chunk-Y7F2V3R6.mjs.map +0 -1
  683. package/dist/esm/chunk-YHAPZP5A.mjs.map +0 -1
  684. package/dist/esm/chunk-YJCZU6PR.mjs.map +0 -1
  685. package/dist/esm/chunk-ZGO2SK6F.mjs.map +0 -1
  686. package/dist/esm/publicKey-B3XRNhHO.d.mts +0 -113
  687. /package/dist/esm/{chunk-FVA2OPG4.mjs.map → chunk-KDMSOCZY.mjs.map} +0 -0
  688. /package/dist/esm/{chunk-Q4XR6QOZ.mjs.map → chunk-KIW54KWR.mjs.map} +0 -0
  689. /package/dist/esm/{chunk-G7MWTE2J.mjs.map → chunk-KSUZS6EL.mjs.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/account/EphemeralKeyPair.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { randomBytes } from \"@noble/hashes/utils\";\n\nimport {\n bytesToBigIntLE,\n padAndPackBytesWithLen,\n poseidonHash,\n Ed25519PrivateKey,\n EphemeralPublicKey,\n EphemeralSignature,\n PrivateKey,\n} from \"../core/crypto\";\nimport { Hex } from \"../core/hex\";\nimport { EphemeralPublicKeyVariant, HexInput } from \"../types\";\nimport { Deserializer, Serializable, Serializer } from \"../bcs\";\nimport { floorToWholeHour, nowInSeconds } from \"../utils/helpers\";\n\nconst TWO_WEEKS_IN_SECONDS = 1_209_600;\n\n/**\n * Represents an ephemeral key pair used for signing transactions via the Keyless authentication scheme.\n * This key pair is temporary and includes an expiration time.\n * For more details on how this class is used, refer to the documentation:\n * https://aptos.dev/guides/keyless-accounts/#1-present-the-user-with-a-sign-in-with-idp-button-on-the-ui\n */\nexport class EphemeralKeyPair extends Serializable {\n static readonly BLINDER_LENGTH: number = 31;\n\n /**\n * A byte array of length BLINDER_LENGTH used to obfuscate the public key from the IdP.\n * Used in calculating the nonce passed to the IdP and as a secret witness in proof generation.\n */\n readonly blinder: Uint8Array;\n\n /**\n * A timestamp in seconds indicating when the ephemeral key pair is expired. After expiry, a new\n * EphemeralKeyPair must be generated and a new JWT needs to be created.\n */\n readonly expiryDateSecs: number;\n\n /**\n * The value passed to the IdP when the user authenticates. It consists of a hash of the\n * ephemeral public key, expiry date, and blinder.\n */\n readonly nonce: string;\n\n /**\n * A private key used to sign transactions. This private key is not tied to any account on the chain as it\n * is ephemeral (not permanent) in nature.\n */\n private privateKey: PrivateKey;\n\n /**\n * A public key used to verify transactions. This public key is not tied to any account on the chain as it\n * is ephemeral (not permanent) in nature.\n */\n private publicKey: EphemeralPublicKey;\n\n /**\n * Creates an instance of the class with a specified private key, optional expiry date, and optional blinder.\n * This constructor initializes the public key, sets the expiry date to a default value if not provided,\n * generates a blinder if not supplied, and calculates the nonce based on the public key, expiry date, and blinder.\n *\n * @param args - The parameters for constructing the instance.\n * @param args.privateKey - The private key used for creating the instance.\n * @param args.expiryDateSecs - Optional expiry date in seconds from the current time. Defaults to two weeks from now.\n * @param args.blinder - Optional blinder value. If not provided, a new blinder will be generated.\n */\n constructor(args: { privateKey: PrivateKey; expiryDateSecs?: number; blinder?: HexInput }) {\n super();\n const { privateKey, expiryDateSecs, blinder } = args;\n this.privateKey = privateKey;\n this.publicKey = new EphemeralPublicKey(privateKey.publicKey());\n // By default, we set the expiry date to be two weeks in the future floored to the nearest hour\n this.expiryDateSecs = expiryDateSecs || floorToWholeHour(nowInSeconds() + TWO_WEEKS_IN_SECONDS);\n // Generate the blinder if not provided\n this.blinder = blinder !== undefined ? Hex.fromHexInput(blinder).toUint8Array() : generateBlinder();\n // Calculate the nonce\n const fields = padAndPackBytesWithLen(this.publicKey.bcsToBytes(), 93);\n fields.push(BigInt(this.expiryDateSecs));\n fields.push(bytesToBigIntLE(this.blinder));\n const nonceHash = poseidonHash(fields);\n this.nonce = nonceHash.toString();\n }\n\n /**\n * Returns the public key of the key pair.\n * @return EphemeralPublicKey\n */\n getPublicKey(): EphemeralPublicKey {\n return this.publicKey;\n }\n\n /**\n * Checks if the current time has surpassed the expiry date of the key pair.\n * @return boolean - Returns true if the key pair is expired, otherwise false.\n */\n isExpired(): boolean {\n const currentTimeSecs: number = Math.floor(Date.now() / 1000);\n return currentTimeSecs > this.expiryDateSecs;\n }\n\n /**\n * Serializes the object's properties into a format suitable for transmission or storage.\n * This function is essential for preparing the object data for serialization processes.\n *\n * @param serializer - The serializer instance used to serialize the object's properties.\n */\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(this.publicKey.variant);\n serializer.serializeBytes(this.privateKey.toUint8Array());\n serializer.serializeU64(this.expiryDateSecs);\n serializer.serializeFixedBytes(this.blinder);\n }\n\n /**\n * Deserializes an ephemeral key pair from the provided deserializer.\n * This function helps in reconstructing an ephemeral key pair, which is essential for cryptographic operations.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n */\n static deserialize(deserializer: Deserializer): EphemeralKeyPair {\n const variantIndex = deserializer.deserializeUleb128AsU32();\n let privateKey: PrivateKey;\n switch (variantIndex) {\n case EphemeralPublicKeyVariant.Ed25519:\n privateKey = Ed25519PrivateKey.deserialize(deserializer);\n break;\n default:\n throw new Error(`Unknown variant index for EphemeralPublicKey: ${variantIndex}`);\n }\n const expiryDateSecs = deserializer.deserializeU64();\n const blinder = deserializer.deserializeFixedBytes(31);\n return new EphemeralKeyPair({ privateKey, expiryDateSecs: Number(expiryDateSecs), blinder });\n }\n\n /**\n * Deserialize a byte array into an EphemeralKeyPair object.\n * This function allows you to reconstruct an EphemeralKeyPair from its serialized byte representation.\n *\n * @param bytes - The byte array representing the serialized EphemeralKeyPair.\n */\n static fromBytes(bytes: Uint8Array): EphemeralKeyPair {\n return EphemeralKeyPair.deserialize(new Deserializer(bytes));\n }\n\n /**\n * Generates a new ephemeral key pair with an optional expiry date.\n * This function allows you to create a temporary key pair for secure operations.\n *\n * @param args - Optional parameters for key pair generation.\n * @param args.scheme - The type of key pair to use for the EphemeralKeyPair. Only Ed25519 is supported for now.\n * @param args.expiryDateSecs - The date of expiry for the key pair in seconds.\n * @returns An instance of EphemeralKeyPair containing the generated private key and expiry date.\n */\n static generate(args?: { scheme?: EphemeralPublicKeyVariant; expiryDateSecs?: number }): EphemeralKeyPair {\n let privateKey: PrivateKey;\n\n switch (args?.scheme) {\n case EphemeralPublicKeyVariant.Ed25519:\n default:\n privateKey = Ed25519PrivateKey.generate();\n }\n\n return new EphemeralKeyPair({ privateKey, expiryDateSecs: args?.expiryDateSecs });\n }\n\n /**\n * Sign the given data using the private key, returning an ephemeral signature.\n * This function is essential for creating a secure signature that can be used for authentication or verification purposes.\n *\n * @param data - The data to be signed, provided in HexInput format.\n * @returns EphemeralSignature - The resulting ephemeral signature.\n * @throws Error - Throws an error if the EphemeralKeyPair has expired.\n */\n sign(data: HexInput): EphemeralSignature {\n if (this.isExpired()) {\n throw new Error(\"EphemeralKeyPair has expired\");\n }\n return new EphemeralSignature(this.privateKey.sign(data));\n }\n}\n\n/**\n * Generates a random byte array of length EphemeralKeyPair.BLINDER_LENGTH.\n * @returns Uint8Array A random byte array used for blinding.\n */\nfunction generateBlinder(): Uint8Array {\n return randomBytes(EphemeralKeyPair.BLINDER_LENGTH);\n}\n"],"mappings":"sTAGA,OAAS,eAAAA,MAAmB,sBAgB5B,IAAMC,EAAuB,QAQhBC,EAAN,MAAMA,UAAyBC,CAAa,CA2CjD,YAAYC,EAA+E,CACzF,MAAM,EACN,GAAM,CAAE,WAAAC,EAAY,eAAAC,EAAgB,QAAAC,CAAQ,EAAIH,EAChD,KAAK,WAAaC,EAClB,KAAK,UAAY,IAAIG,EAAmBH,EAAW,UAAU,CAAC,EAE9D,KAAK,eAAiBC,GAAkBG,EAAiBC,EAAa,EAAIT,CAAoB,EAE9F,KAAK,QAAUM,IAAY,OAAYI,EAAI,aAAaJ,CAAO,EAAE,aAAa,EAAIK,EAAgB,EAElG,IAAMC,EAASC,EAAuB,KAAK,UAAU,WAAW,EAAG,EAAE,EACrED,EAAO,KAAK,OAAO,KAAK,cAAc,CAAC,EACvCA,EAAO,KAAKE,EAAgB,KAAK,OAAO,CAAC,EACzC,IAAMC,EAAYC,EAAaJ,CAAM,EACrC,KAAK,MAAQG,EAAU,SAAS,CAClC,CAMA,cAAmC,CACjC,OAAO,KAAK,SACd,CAMA,WAAqB,CAEnB,OADgC,KAAK,MAAM,KAAK,IAAI,EAAI,GAAI,EACnC,KAAK,cAChC,CAQA,UAAUE,EAA8B,CACtCA,EAAW,sBAAsB,KAAK,UAAU,OAAO,EACvDA,EAAW,eAAe,KAAK,WAAW,aAAa,CAAC,EACxDA,EAAW,aAAa,KAAK,cAAc,EAC3CA,EAAW,oBAAoB,KAAK,OAAO,CAC7C,CAQA,OAAO,YAAYC,EAA8C,CAC/D,IAAMC,EAAeD,EAAa,wBAAwB,EACtDd,EACJ,OAAQe,EAAc,CACpB,OACEf,EAAagB,EAAkB,YAAYF,CAAY,EACvD,MACF,QACE,MAAM,IAAI,MAAM,iDAAiDC,CAAY,EAAE,CACnF,CACA,IAAMd,EAAiBa,EAAa,eAAe,EAC7CZ,EAAUY,EAAa,sBAAsB,EAAE,EACrD,OAAO,IAAIjB,EAAiB,CAAE,WAAAG,EAAY,eAAgB,OAAOC,CAAc,EAAG,QAAAC,CAAQ,CAAC,CAC7F,CAQA,OAAO,UAAUe,EAAqC,CACpD,OAAOpB,EAAiB,YAAY,IAAIqB,EAAaD,CAAK,CAAC,CAC7D,CAWA,OAAO,SAASlB,EAA0F,CACxG,IAAIC,EAEJ,OAAQD,GAAM,OAAQ,CACpB,OACA,QACEC,EAAagB,EAAkB,SAAS,CAC5C,CAEA,OAAO,IAAInB,EAAiB,CAAE,WAAAG,EAAY,eAAgBD,GAAM,cAAe,CAAC,CAClF,CAUA,KAAKoB,EAAoC,CACvC,GAAI,KAAK,UAAU,EACjB,MAAM,IAAI,MAAM,8BAA8B,EAEhD,OAAO,IAAIC,EAAmB,KAAK,WAAW,KAAKD,CAAI,CAAC,CAC1D,CACF,EA5JatB,EACK,eAAyB,GADpC,IAAMwB,EAANxB,EAkKP,SAASU,GAA8B,CACrC,OAAOe,EAAYD,EAAiB,cAAc,CACpD","names":["randomBytes","TWO_WEEKS_IN_SECONDS","_EphemeralKeyPair","Serializable","args","privateKey","expiryDateSecs","blinder","EphemeralPublicKey","floorToWholeHour","nowInSeconds","Hex","generateBlinder","fields","padAndPackBytesWithLen","bytesToBigIntLE","nonceHash","poseidonHash","serializer","deserializer","variantIndex","Ed25519PrivateKey","bytes","Deserializer","data","EphemeralSignature","EphemeralKeyPair","randomBytes"]}
@@ -1,2 +1,2 @@
1
- import{a as t,b as n,c as i,d as r,e as o}from"./chunk-SCHZ67F3.mjs";import f from"@aptos-labs/aptos-client";var l=class{constructor(e){this.network=e?.network??"devnet",this.fullnode=e?.fullnode,this.faucet=e?.faucet,this.pepper=e?.pepper,this.prover=e?.prover,this.indexer=e?.indexer,this.client=e?.client??{provider:f},this.clientConfig=e?.clientConfig??{},this.fullnodeConfig=e?.fullnodeConfig??{},this.indexerConfig=e?.indexerConfig??{},this.faucetConfig=e?.faucetConfig??{}}getRequestUrl(e){switch(e){case"Fullnode":if(this.fullnode!==void 0)return this.fullnode;if(this.network==="custom")throw new Error("Please provide a custom full node url");return n[this.network];case"Faucet":if(this.faucet!==void 0)return this.faucet;if(this.network==="custom")throw new Error("Please provide a custom faucet url");return i[this.network];case"Indexer":if(this.indexer!==void 0)return this.indexer;if(this.network==="custom")throw new Error("Please provide a custom indexer url");return t[this.network];case"Pepper":if(this.pepper!==void 0)return this.pepper;if(this.network==="custom")throw new Error("Please provide a custom pepper service url");return r[this.network];case"Prover":if(this.prover!==void 0)return this.prover;if(this.network==="custom")throw new Error("Please provide a custom prover service url");return o[this.network];default:throw Error(`apiType ${e} is not supported`)}}isPepperServiceRequest(e){return r[this.network]===e}isProverServiceRequest(e){return o[this.network]===e}};export{l as a};
2
- //# sourceMappingURL=chunk-NMD45OTM.mjs.map
1
+ import{a as t,b as n,c as i,d as r,e as o}from"./chunk-D3OEQLUE.mjs";import f from"@aptos-labs/aptos-client";var l=class{constructor(e){this.network=e?.network??"devnet",this.fullnode=e?.fullnode,this.faucet=e?.faucet,this.pepper=e?.pepper,this.prover=e?.prover,this.indexer=e?.indexer,this.client=e?.client??{provider:f},this.clientConfig=e?.clientConfig??{},this.fullnodeConfig=e?.fullnodeConfig??{},this.indexerConfig=e?.indexerConfig??{},this.faucetConfig=e?.faucetConfig??{}}getRequestUrl(e){switch(e){case"Fullnode":if(this.fullnode!==void 0)return this.fullnode;if(this.network==="custom")throw new Error("Please provide a custom full node url");return n[this.network];case"Faucet":if(this.faucet!==void 0)return this.faucet;if(this.network==="custom")throw new Error("Please provide a custom faucet url");return i[this.network];case"Indexer":if(this.indexer!==void 0)return this.indexer;if(this.network==="custom")throw new Error("Please provide a custom indexer url");return t[this.network];case"Pepper":if(this.pepper!==void 0)return this.pepper;if(this.network==="custom")throw new Error("Please provide a custom pepper service url");return r[this.network];case"Prover":if(this.prover!==void 0)return this.prover;if(this.network==="custom")throw new Error("Please provide a custom prover service url");return o[this.network];default:throw Error(`apiType ${e} is not supported`)}}isPepperServiceRequest(e){return r[this.network]===e}isProverServiceRequest(e){return o[this.network]===e}};export{l as a};
2
+ //# sourceMappingURL=chunk-V5NDNR36.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/aptosConfig.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport aptosClient from \"@aptos-labs/aptos-client\";\nimport { AptosSettings, ClientConfig, Client, FullNodeConfig, IndexerConfig, FaucetConfig } from \"../types\";\nimport {\n NetworkToNodeAPI,\n NetworkToFaucetAPI,\n NetworkToIndexerAPI,\n Network,\n NetworkToPepperAPI,\n NetworkToProverAPI,\n} from \"../utils/apiEndpoints\";\nimport { AptosApiType } from \"../utils/const\";\n\n/**\n * Represents the configuration settings for an Aptos SDK client instance.\n * This class allows customization of various endpoints and client settings.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * async function runExample() {\n * // Create a configuration for connecting to the Aptos testnet\n * const config = new AptosConfig({ network: Network.TESTNET });\n *\n * // Initialize the Aptos client with the configuration\n * const aptos = new Aptos(config);\n *\n * console.log(\"Aptos client initialized:\", aptos);\n * }\n * runExample().catch(console.error);\n * ```\n */\nexport class AptosConfig {\n /**\n * The Network that this SDK is associated with. Defaults to DEVNET\n */\n readonly network: Network;\n\n /**\n * The client instance the SDK uses. Defaults to `@aptos-labs/aptos-client\n */\n readonly client: Client;\n\n /**\n * The optional hardcoded fullnode URL to send requests to instead of using the network\n */\n readonly fullnode?: string;\n\n /**\n * The optional hardcoded faucet URL to send requests to instead of using the network\n */\n readonly faucet?: string;\n\n /**\n * The optional hardcoded pepper service URL to send requests to instead of using the network\n */\n readonly pepper?: string;\n\n /**\n * The optional hardcoded prover service URL to send requests to instead of using the network\n */\n readonly prover?: string;\n\n /**\n * The optional hardcoded indexer URL to send requests to instead of using the network\n */\n readonly indexer?: string;\n\n /**\n * Optional client configurations\n */\n readonly clientConfig?: ClientConfig;\n\n /**\n * Optional specific Fullnode configurations\n */\n readonly fullnodeConfig?: FullNodeConfig;\n\n /**\n * Optional specific Indexer configurations\n */\n readonly indexerConfig?: IndexerConfig;\n\n /**\n * Optional specific Faucet configurations\n */\n readonly faucetConfig?: FaucetConfig;\n\n /**\n * Initializes an instance of the Aptos client with the specified settings.\n * This allows users to configure various aspects of the client, such as network and endpoints.\n *\n * @param settings - Optional configuration settings for the Aptos client.\n * @param settings.network - The network to connect to, defaults to `Network.DEVNET`.\n * @param settings.fullnode - The fullnode endpoint to use for requests.\n * @param settings.faucet - The faucet endpoint for obtaining test tokens.\n * @param settings.pepper - The pepper used for transaction signing.\n * @param settings.prover - The prover endpoint for transaction verification.\n * @param settings.indexer - The indexer endpoint for querying blockchain data.\n * @param settings.client - Custom client settings, defaults to a standard Aptos client.\n * @param settings.clientConfig - Additional configuration for the client.\n * @param settings.fullnodeConfig - Additional configuration for the fullnode.\n * @param settings.indexerConfig - Additional configuration for the indexer.\n * @param settings.faucetConfig - Additional configuration for the faucet.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * async function runExample() {\n * // Create a new Aptos client with default settings\n * const config = new AptosConfig({ network: Network.TESTNET }); // Specify the network\n * const aptos = new Aptos(config);\n *\n * console.log(\"Aptos client initialized:\", aptos);\n * }\n * runExample().catch(console.error);\n * ```\n */\n constructor(settings?: AptosSettings) {\n this.network = settings?.network ?? Network.DEVNET;\n this.fullnode = settings?.fullnode;\n this.faucet = settings?.faucet;\n this.pepper = settings?.pepper;\n this.prover = settings?.prover;\n this.indexer = settings?.indexer;\n this.client = settings?.client ?? { provider: aptosClient };\n this.clientConfig = settings?.clientConfig ?? {};\n this.fullnodeConfig = settings?.fullnodeConfig ?? {};\n this.indexerConfig = settings?.indexerConfig ?? {};\n this.faucetConfig = settings?.faucetConfig ?? {};\n }\n\n /**\n * Returns the URL endpoint to send the request to based on the specified API type.\n * If a custom URL was provided in the configuration, that URL is returned. Otherwise, the URL endpoint is derived from the network.\n *\n * @param apiType - The type of Aptos API to get the URL for. This can be one of the following: FULLNODE, FAUCET, INDEXER, PEPPER, PROVER.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network, AptosApiType } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Getting the request URL for the FULLNODE API\n * const url = config.getRequestUrl(AptosApiType.FULLNODE);\n * console.log(\"Request URL for FULLNODE:\", url);\n * }\n * runExample().catch(console.error);\n * ```\n */\n getRequestUrl(apiType: AptosApiType): string {\n switch (apiType) {\n case AptosApiType.FULLNODE:\n if (this.fullnode !== undefined) return this.fullnode;\n if (this.network === Network.CUSTOM) throw new Error(\"Please provide a custom full node url\");\n return NetworkToNodeAPI[this.network];\n case AptosApiType.FAUCET:\n if (this.faucet !== undefined) return this.faucet;\n if (this.network === Network.CUSTOM) throw new Error(\"Please provide a custom faucet url\");\n return NetworkToFaucetAPI[this.network];\n case AptosApiType.INDEXER:\n if (this.indexer !== undefined) return this.indexer;\n if (this.network === Network.CUSTOM) throw new Error(\"Please provide a custom indexer url\");\n return NetworkToIndexerAPI[this.network];\n case AptosApiType.PEPPER:\n if (this.pepper !== undefined) return this.pepper;\n if (this.network === Network.CUSTOM) throw new Error(\"Please provide a custom pepper service url\");\n return NetworkToPepperAPI[this.network];\n case AptosApiType.PROVER:\n if (this.prover !== undefined) return this.prover;\n if (this.network === Network.CUSTOM) throw new Error(\"Please provide a custom prover service url\");\n return NetworkToProverAPI[this.network];\n default:\n throw Error(`apiType ${apiType} is not supported`);\n }\n }\n\n /**\n * Checks if the provided URL is a known pepper service endpoint.\n *\n * @param url - The URL to check against the known pepper service endpoints.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * const url = \"https://example.pepper.service\"; // replace with a real pepper service URL\n *\n * // Check if the URL is a known pepper service endpoint\n * const isPepperService = config.isPepperServiceRequest(url);\n *\n * console.log(`Is the URL a known pepper service? ${isPepperService}`);\n * }\n * runExample().catch(console.error);\n * ```\n */\n isPepperServiceRequest(url: string): boolean {\n return NetworkToPepperAPI[this.network] === url;\n }\n\n /**\n * Checks if the provided URL is a known prover service endpoint.\n *\n * @param url - The URL to check against known prover service endpoints.\n * @returns A boolean indicating whether the URL is a known prover service endpoint.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * // Check if the URL is a known prover service endpoint\n * const url = \"https://prover.testnet.aptos.dev\"; // replace with a real URL if needed\n * const isProver = config.isProverServiceRequest(url);\n *\n * console.log(`Is the URL a known prover service? ${isProver}`);\n * ```\n */\n isProverServiceRequest(url: string): boolean {\n return NetworkToProverAPI[this.network] === url;\n }\n}\n"],"mappings":"qEAGA,OAAOA,MAAiB,2BAgCjB,IAAMC,EAAN,KAAkB,CAuFvB,YAAYC,EAA0B,CACpC,KAAK,QAAUA,GAAU,SAAW,SACpC,KAAK,SAAWA,GAAU,SAC1B,KAAK,OAASA,GAAU,OACxB,KAAK,OAASA,GAAU,OACxB,KAAK,OAASA,GAAU,OACxB,KAAK,QAAUA,GAAU,QACzB,KAAK,OAASA,GAAU,QAAU,CAAE,SAAUC,CAAY,EAC1D,KAAK,aAAeD,GAAU,cAAgB,CAAC,EAC/C,KAAK,eAAiBA,GAAU,gBAAkB,CAAC,EACnD,KAAK,cAAgBA,GAAU,eAAiB,CAAC,EACjD,KAAK,aAAeA,GAAU,cAAgB,CAAC,CACjD,CAuBA,cAAcE,EAA+B,CAC3C,OAAQA,EAAS,CACf,eACE,GAAI,KAAK,WAAa,OAAW,OAAO,KAAK,SAC7C,GAAI,KAAK,UAAY,SAAgB,MAAM,IAAI,MAAM,uCAAuC,EAC5F,OAAOC,EAAiB,KAAK,OAAO,EACtC,aACE,GAAI,KAAK,SAAW,OAAW,OAAO,KAAK,OAC3C,GAAI,KAAK,UAAY,SAAgB,MAAM,IAAI,MAAM,oCAAoC,EACzF,OAAOC,EAAmB,KAAK,OAAO,EACxC,cACE,GAAI,KAAK,UAAY,OAAW,OAAO,KAAK,QAC5C,GAAI,KAAK,UAAY,SAAgB,MAAM,IAAI,MAAM,qCAAqC,EAC1F,OAAOC,EAAoB,KAAK,OAAO,EACzC,aACE,GAAI,KAAK,SAAW,OAAW,OAAO,KAAK,OAC3C,GAAI,KAAK,UAAY,SAAgB,MAAM,IAAI,MAAM,4CAA4C,EACjG,OAAOC,EAAmB,KAAK,OAAO,EACxC,aACE,GAAI,KAAK,SAAW,OAAW,OAAO,KAAK,OAC3C,GAAI,KAAK,UAAY,SAAgB,MAAM,IAAI,MAAM,4CAA4C,EACjG,OAAOC,EAAmB,KAAK,OAAO,EACxC,QACE,MAAM,MAAM,WAAWL,CAAO,mBAAmB,CACrD,CACF,CAyBA,uBAAuBM,EAAsB,CAC3C,OAAOF,EAAmB,KAAK,OAAO,IAAME,CAC9C,CAsBA,uBAAuBA,EAAsB,CAC3C,OAAOD,EAAmB,KAAK,OAAO,IAAMC,CAC9C,CACF","names":["aptosClient","AptosConfig","settings","aptosClient","apiType","NetworkToNodeAPI","NetworkToFaucetAPI","NetworkToIndexerAPI","NetworkToPepperAPI","NetworkToProverAPI","url"]}
@@ -1,2 +1,2 @@
1
- import{c as T,d as c}from"./chunk-5655UVIK.mjs";import{g as A,h as a}from"./chunk-EXP5STXZ.mjs";import{sha3_256 as y}from"@noble/hashes/sha3";function d(e){return e.feePayerAddress?new c(e.rawTransaction,e.secondarySignerAddresses??[],e.feePayerAddress):e.secondarySignerAddresses?new T(e.rawTransaction,e.secondarySignerAddresses):e.rawTransaction}function n(e,r){let i=y.create();if(!r.startsWith("APTOS::"))throw new Error(`Domain separator needs to start with 'APTOS::'. Provided - ${r}`);i.update(r);let s=i.digest(),o=e,t=new Uint8Array(s.length+o.length);return t.set(s),t.set(o,s.length),t}function u(e){return n(e.bcsToBytes(),`APTOS::${e.constructor.name}`)}function S(e){let r=d(e);return e.feePayerAddress?n(r.bcsToBytes(),a):e.secondarySignerAddresses?n(r.bcsToBytes(),a):n(r.bcsToBytes(),A)}export{d as a,n as b,u as c,S as d};
2
- //# sourceMappingURL=chunk-KXBIA4KR.mjs.map
1
+ import{c as T,d as c}from"./chunk-7PVIWKGT.mjs";import{g as A,h as a}from"./chunk-J245N3XF.mjs";import{sha3_256 as y}from"@noble/hashes/sha3";function d(e){return e.feePayerAddress?new c(e.rawTransaction,e.secondarySignerAddresses??[],e.feePayerAddress):e.secondarySignerAddresses?new T(e.rawTransaction,e.secondarySignerAddresses):e.rawTransaction}function n(e,r){let i=y.create();if(!r.startsWith("APTOS::"))throw new Error(`Domain separator needs to start with 'APTOS::'. Provided - ${r}`);i.update(r);let s=i.digest(),o=e,t=new Uint8Array(s.length+o.length);return t.set(s),t.set(o,s.length),t}function u(e){return n(e.bcsToBytes(),`APTOS::${e.constructor.name}`)}function S(e){let r=d(e);return e.feePayerAddress?n(r.bcsToBytes(),a):e.secondarySignerAddresses?n(r.bcsToBytes(),a):n(r.bcsToBytes(),A)}export{d as a,n as b,u as c,S as d};
2
+ //# sourceMappingURL=chunk-VQTEGTUQ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/transactions/transactionBuilder/signingMessage.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file handles the generation of the signing message.\n */\nimport { sha3_256 as sha3Hash } from \"@noble/hashes/sha3\";\nimport { RAW_TRANSACTION_SALT, RAW_TRANSACTION_WITH_DATA_SALT } from \"../../utils/const\";\nimport { FeePayerRawTransaction, MultiAgentRawTransaction } from \"../instances\";\nimport { AnyRawTransaction, AnyRawTransactionInstance } from \"../types\";\nimport { Serializable } from \"../../bcs\";\n\n/**\n * Derives the appropriate raw transaction type based on the provided transaction details.\n * This function helps in identifying whether the transaction is a FeePayerRawTransaction,\n * MultiAgentRawTransaction, or a standard RawTransaction.\n *\n * @param transaction - An object representing an Aptos transaction, which may include:\n * - feePayerAddress - The address of the fee payer (optional).\n * - secondarySignerAddresses - An array of secondary signer addresses (optional).\n * - rawTransaction - The raw transaction data.\n *\n * @returns FeePayerRawTransaction | MultiAgentRawTransaction | RawTransaction\n */\nexport function deriveTransactionType(transaction: AnyRawTransaction): AnyRawTransactionInstance {\n if (transaction.feePayerAddress) {\n return new FeePayerRawTransaction(\n transaction.rawTransaction,\n transaction.secondarySignerAddresses ?? [],\n transaction.feePayerAddress,\n );\n }\n if (transaction.secondarySignerAddresses) {\n return new MultiAgentRawTransaction(transaction.rawTransaction, transaction.secondarySignerAddresses);\n }\n\n return transaction.rawTransaction;\n}\n\n/**\n * Generates the 'signing message' form of a message to be signed.\n * This function combines a domain separator with the byte representation of the message to create a signing message.\n *\n * @param bytes - The byte representation of the message to be signed and sent to the chain.\n * @param domainSeparator - A domain separator that starts with 'APTOS::'.\n *\n * @returns The Uint8Array of the signing message.\n */\nexport function generateSigningMessage(bytes: Uint8Array, domainSeparator: string): Uint8Array {\n const hash = sha3Hash.create();\n\n if (!domainSeparator.startsWith(\"APTOS::\")) {\n throw new Error(`Domain separator needs to start with 'APTOS::'. Provided - ${domainSeparator}`);\n }\n\n hash.update(domainSeparator);\n\n const prefix = hash.digest();\n\n const body = bytes;\n\n const mergedArray = new Uint8Array(prefix.length + body.length);\n mergedArray.set(prefix);\n mergedArray.set(body, prefix.length);\n\n return mergedArray;\n}\n\n/**\n * @deprecated\n * Use CryptoHashable instead by having your class implement it and call hash() to get the signing message.\n *\n * Generates the 'signing message' form of a serializable value by serializing it and using the constructor name as the domain\n * separator.\n *\n * @param serializable - An object that has a BCS serialized form.\n *\n * @returns The Uint8Array of the signing message.\n */\nexport function generateSigningMessageForSerializable(serializable: Serializable): Uint8Array {\n return generateSigningMessage(serializable.bcsToBytes(), `APTOS::${serializable.constructor.name}`);\n}\n\n/**\n * Generates the 'signing message' form of a transaction by deriving the type of transaction and applying the appropriate domain\n * separator based on the presence of a fee payer or secondary signers.\n *\n * @param transaction - A transaction that is to be signed, which can include a fee payer address or secondary signer addresses.\n *\n * @returns The Uint8Array of the signing message.\n */\nexport function generateSigningMessageForTransaction(transaction: AnyRawTransaction): Uint8Array {\n const rawTxn = deriveTransactionType(transaction);\n if (transaction.feePayerAddress) {\n return generateSigningMessage(rawTxn.bcsToBytes(), RAW_TRANSACTION_WITH_DATA_SALT);\n }\n if (transaction.secondarySignerAddresses) {\n return generateSigningMessage(rawTxn.bcsToBytes(), RAW_TRANSACTION_WITH_DATA_SALT);\n }\n return generateSigningMessage(rawTxn.bcsToBytes(), RAW_TRANSACTION_SALT);\n}\n"],"mappings":"gGAMA,OAAS,YAAYA,MAAgB,qBAkB9B,SAASC,EAAsBC,EAA2D,CAC/F,OAAIA,EAAY,gBACP,IAAIC,EACTD,EAAY,eACZA,EAAY,0BAA4B,CAAC,EACzCA,EAAY,eACd,EAEEA,EAAY,yBACP,IAAIE,EAAyBF,EAAY,eAAgBA,EAAY,wBAAwB,EAG/FA,EAAY,cACrB,CAWO,SAASG,EAAuBC,EAAmBC,EAAqC,CAC7F,IAAMC,EAAOC,EAAS,OAAO,EAE7B,GAAI,CAACF,EAAgB,WAAW,SAAS,EACvC,MAAM,IAAI,MAAM,+DAA+DA,CAAe,EAAE,EAGlGC,EAAK,OAAOD,CAAe,EAE3B,IAAMG,EAASF,EAAK,OAAO,EAErBG,EAAOL,EAEPM,EAAc,IAAI,WAAWF,EAAO,OAASC,EAAK,MAAM,EAC9D,OAAAC,EAAY,IAAIF,CAAM,EACtBE,EAAY,IAAID,EAAMD,EAAO,MAAM,EAE5BE,CACT,CAaO,SAASC,EAAsCC,EAAwC,CAC5F,OAAOT,EAAuBS,EAAa,WAAW,EAAG,UAAUA,EAAa,YAAY,IAAI,EAAE,CACpG,CAUO,SAASC,EAAqCb,EAA4C,CAC/F,IAAMc,EAASf,EAAsBC,CAAW,EAChD,OAAIA,EAAY,gBACPG,EAAuBW,EAAO,WAAW,EAAGC,CAA8B,EAE/Ef,EAAY,yBACPG,EAAuBW,EAAO,WAAW,EAAGC,CAA8B,EAE5EZ,EAAuBW,EAAO,WAAW,EAAGE,CAAoB,CACzE","names":["sha3Hash","deriveTransactionType","transaction","FeePayerRawTransaction","MultiAgentRawTransaction","generateSigningMessage","bytes","domainSeparator","hash","sha3Hash","prefix","body","mergedArray","generateSigningMessageForSerializable","serializable","generateSigningMessageForTransaction","rawTxn","RAW_TRANSACTION_WITH_DATA_SALT","RAW_TRANSACTION_SALT"]}
@@ -1,2 +1,2 @@
1
- import{b as h,d as l}from"./chunk-DAJOX4PL.mjs";import{b as E}from"./chunk-IMGLHDIA.mjs";import{a as p}from"./chunk-BF4ZE37Q.mjs";import{a as g}from"./chunk-KA6FZNWP.mjs";var o=class o extends E{constructor(r){super();let{publicKeys:e,threshold:t}=r;if(e.length>o.MAX_KEYS||e.length<o.MIN_KEYS)throw new Error(`Must have between ${o.MIN_KEYS} and ${o.MAX_KEYS} public keys, inclusive`);if(t<o.MIN_THRESHOLD||t>e.length)throw new Error(`Threshold must be between ${o.MIN_THRESHOLD} and ${e.length}, inclusive`);this.publicKeys=e,this.threshold=t}verifySignature(r){let{message:e,signature:t}=r;if(!(t instanceof y))return!1;let s=[];for(let i=0;i<4;i+=1)for(let n=0;n<8;n+=1)if((t.bitmap[i]&1<<7-n)!==0){let u=i*8+n;s.push(u)}if(s.length!==t.signatures.length)throw new Error("Bitmap and signatures length mismatch");if(s.length<this.threshold)throw new Error("Not enough signatures");for(let i=0;i<s.length;i+=1)if(!this.publicKeys[s[i]].verifySignature({message:e,signature:t.signatures[i]}))return!1;return!0}authKey(){return g.fromSchemeAndBytes({scheme:1,input:this.toUint8Array()})}toUint8Array(){let r=new Uint8Array(this.publicKeys.length*h.LENGTH+1);return this.publicKeys.forEach((e,t)=>{r.set(e.toUint8Array(),t*h.LENGTH)}),r[this.publicKeys.length*h.LENGTH]=this.threshold,r}serialize(r){r.serializeBytes(this.toUint8Array())}static deserialize(r){let e=r.deserializeBytes(),t=e[e.length-1],s=[];for(let i=0;i<e.length-1;i+=h.LENGTH){let n=i;s.push(new h(e.subarray(n,n+h.LENGTH)))}return new o({publicKeys:s,threshold:t})}};o.MAX_KEYS=32,o.MIN_KEYS=2,o.MIN_THRESHOLD=1;var d=o,a=class a extends p{constructor(r){super();let{signatures:e,bitmap:t}=r;if(e.length>a.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${a.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=e,!(t instanceof Uint8Array))this.bitmap=a.createBitmap({bits:t});else{if(t.length!==a.BITMAP_LEN)throw new Error(`"bitmap" length should be ${a.BITMAP_LEN}`);this.bitmap=t}}toUint8Array(){let r=new Uint8Array(this.signatures.length*l.LENGTH+a.BITMAP_LEN);return this.signatures.forEach((e,t)=>{r.set(e.toUint8Array(),t*l.LENGTH)}),r.set(this.bitmap,this.signatures.length*l.LENGTH),r}serialize(r){r.serializeBytes(this.toUint8Array())}static deserialize(r){let e=r.deserializeBytes(),t=e.subarray(e.length-4),s=[];for(let i=0;i<e.length-t.length;i+=l.LENGTH){let n=i;s.push(new l(e.subarray(n,n+l.LENGTH)))}return new a({signatures:s,bitmap:t})}static createBitmap(r){let{bits:e}=r,t=128,s=new Uint8Array([0,0,0,0]),i=new Set;return e.forEach((n,c)=>{if(n>=a.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${a.MAX_SIGNATURES_SUPPORTED-1}.`);if(i.has(n))throw new Error("Duplicate bits detected.");if(c>0&&n<=e[c-1])throw new Error("The bits need to be sorted in ascending order.");i.add(n);let u=Math.floor(n/8),b=s[u];b|=t>>n%8,s[u]=b}),s}};a.MAX_SIGNATURES_SUPPORTED=32,a.BITMAP_LEN=4;var y=a;export{d as a,y as b};
2
- //# sourceMappingURL=chunk-BD6BJETG.mjs.map
1
+ import{b as h,d as l}from"./chunk-WSVOJSAC.mjs";import{b as E}from"./chunk-4OV7QU2U.mjs";import{a as p}from"./chunk-IBLZ6MZU.mjs";import{a as g}from"./chunk-PRZ7AIGA.mjs";var o=class o extends E{constructor(r){super();let{publicKeys:e,threshold:t}=r;if(e.length>o.MAX_KEYS||e.length<o.MIN_KEYS)throw new Error(`Must have between ${o.MIN_KEYS} and ${o.MAX_KEYS} public keys, inclusive`);if(t<o.MIN_THRESHOLD||t>e.length)throw new Error(`Threshold must be between ${o.MIN_THRESHOLD} and ${e.length}, inclusive`);this.publicKeys=e,this.threshold=t}verifySignature(r){let{message:e,signature:t}=r;if(!(t instanceof y))return!1;let s=[];for(let i=0;i<4;i+=1)for(let n=0;n<8;n+=1)if((t.bitmap[i]&1<<7-n)!==0){let u=i*8+n;s.push(u)}if(s.length!==t.signatures.length)throw new Error("Bitmap and signatures length mismatch");if(s.length<this.threshold)throw new Error("Not enough signatures");for(let i=0;i<s.length;i+=1)if(!this.publicKeys[s[i]].verifySignature({message:e,signature:t.signatures[i]}))return!1;return!0}authKey(){return g.fromSchemeAndBytes({scheme:1,input:this.toUint8Array()})}toUint8Array(){let r=new Uint8Array(this.publicKeys.length*h.LENGTH+1);return this.publicKeys.forEach((e,t)=>{r.set(e.toUint8Array(),t*h.LENGTH)}),r[this.publicKeys.length*h.LENGTH]=this.threshold,r}serialize(r){r.serializeBytes(this.toUint8Array())}static deserialize(r){let e=r.deserializeBytes(),t=e[e.length-1],s=[];for(let i=0;i<e.length-1;i+=h.LENGTH){let n=i;s.push(new h(e.subarray(n,n+h.LENGTH)))}return new o({publicKeys:s,threshold:t})}};o.MAX_KEYS=32,o.MIN_KEYS=2,o.MIN_THRESHOLD=1;var d=o,a=class a extends p{constructor(r){super();let{signatures:e,bitmap:t}=r;if(e.length>a.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${a.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=e,!(t instanceof Uint8Array))this.bitmap=a.createBitmap({bits:t});else{if(t.length!==a.BITMAP_LEN)throw new Error(`"bitmap" length should be ${a.BITMAP_LEN}`);this.bitmap=t}}toUint8Array(){let r=new Uint8Array(this.signatures.length*l.LENGTH+a.BITMAP_LEN);return this.signatures.forEach((e,t)=>{r.set(e.toUint8Array(),t*l.LENGTH)}),r.set(this.bitmap,this.signatures.length*l.LENGTH),r}serialize(r){r.serializeBytes(this.toUint8Array())}static deserialize(r){let e=r.deserializeBytes(),t=e.subarray(e.length-4),s=[];for(let i=0;i<e.length-t.length;i+=l.LENGTH){let n=i;s.push(new l(e.subarray(n,n+l.LENGTH)))}return new a({signatures:s,bitmap:t})}static createBitmap(r){let{bits:e}=r,t=128,s=new Uint8Array([0,0,0,0]),i=new Set;return e.forEach((n,c)=>{if(n>=a.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${a.MAX_SIGNATURES_SUPPORTED-1}.`);if(i.has(n))throw new Error("Duplicate bits detected.");if(c>0&&n<=e[c-1])throw new Error("The bits need to be sorted in ascending order.");i.add(n);let u=Math.floor(n/8),b=s[u];b|=t>>n%8,s[u]=b}),s}};a.MAX_SIGNATURES_SUPPORTED=32,a.BITMAP_LEN=4;var y=a;export{d as a,y as b};
2
+ //# sourceMappingURL=chunk-WIXNX7HY.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/core/crypto/multiEd25519.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Deserializer, Serializer } from \"../../bcs\";\nimport { SigningScheme as AuthenticationKeyScheme } from \"../../types\";\nimport { AuthenticationKey } from \"../authenticationKey\";\nimport { Ed25519PublicKey, Ed25519Signature } from \"./ed25519\";\nimport { AccountPublicKey, VerifySignatureArgs } from \"./publicKey\";\nimport { Signature } from \"./signature\";\n\n/**\n * Represents the public key of a K-of-N Ed25519 multi-sig transaction.\n *\n * A K-of-N multi-sig transaction requires at least K out of N authorized signers to sign the transaction\n * for it to be executed. This class encapsulates the logic for managing the public keys and the threshold\n * for valid signatures.\n *\n * @see {@link https://aptos.dev/integration/creating-a-signed-transaction/ | Creating a Signed Transaction}\n */\nexport class MultiEd25519PublicKey extends AccountPublicKey {\n /**\n * Maximum number of public keys supported\n */\n static readonly MAX_KEYS = 32;\n\n /**\n * Minimum number of public keys needed\n */\n static readonly MIN_KEYS = 2;\n\n /**\n * Minimum threshold for the number of valid signatures required\n */\n static readonly MIN_THRESHOLD = 1;\n\n /**\n * List of Ed25519 public keys for this LegacyMultiEd25519PublicKey\n */\n public readonly publicKeys: Ed25519PublicKey[];\n\n /**\n * The minimum number of valid signatures required, for the number of public keys specified\n */\n public readonly threshold: number;\n\n /**\n * Public key for a K-of-N multi-sig transaction. A K-of-N multi-sig transaction means that for such a\n * transaction to be executed, at least K out of the N authorized signers have signed the transaction\n * and passed the check conducted by the chain.\n *\n * @see {@link\n * https://aptos.dev/integration/creating-a-signed-transaction/ | Creating a Signed Transaction}\n * @param args - A wrapper to let you choose the param order.\n * @param args.publicKeys A list of public keys\n * @param args.threshold At least \"threshold\" signatures must be valid\n */\n constructor(args: { publicKeys: Ed25519PublicKey[]; threshold: number }) {\n super();\n const { publicKeys, threshold } = args;\n\n // Validate number of public keys\n if (publicKeys.length > MultiEd25519PublicKey.MAX_KEYS || publicKeys.length < MultiEd25519PublicKey.MIN_KEYS) {\n throw new Error(\n `Must have between ${MultiEd25519PublicKey.MIN_KEYS} and ` +\n `${MultiEd25519PublicKey.MAX_KEYS} public keys, inclusive`,\n );\n }\n\n // Validate threshold: must be between 1 and the number of public keys, inclusive\n if (threshold < MultiEd25519PublicKey.MIN_THRESHOLD || threshold > publicKeys.length) {\n throw new Error(\n `Threshold must be between ${MultiEd25519PublicKey.MIN_THRESHOLD} and ${publicKeys.length}, inclusive`,\n );\n }\n\n this.publicKeys = publicKeys;\n this.threshold = threshold;\n }\n\n // region AccountPublicKey\n\n /**\n * Verifies a multi-signature against a given message.\n * This function ensures that the provided signatures meet the required threshold and are valid for the given message.\n *\n * @param args - The arguments for verifying the signature.\n * @param args.message - The message that was signed.\n * @param args.signature - The multi-signature containing multiple signatures and a bitmap indicating which signatures are valid.\n * @returns True if the signature is valid; otherwise, false.\n * @throws Error if the bitmap and signatures length mismatch or if there are not enough valid signatures.\n */\n verifySignature(args: VerifySignatureArgs): boolean {\n const { message, signature } = args;\n if (!(signature instanceof MultiEd25519Signature)) {\n return false;\n }\n\n const indices: number[] = [];\n for (let i = 0; i < 4; i += 1) {\n for (let j = 0; j < 8; j += 1) {\n // eslint-disable-next-line no-bitwise\n const bitIsSet = (signature.bitmap[i] & (1 << (7 - j))) !== 0;\n if (bitIsSet) {\n const index = i * 8 + j;\n indices.push(index);\n }\n }\n }\n\n if (indices.length !== signature.signatures.length) {\n throw new Error(\"Bitmap and signatures length mismatch\");\n }\n\n if (indices.length < this.threshold) {\n throw new Error(\"Not enough signatures\");\n }\n\n for (let i = 0; i < indices.length; i += 1) {\n const publicKey = this.publicKeys[indices[i]];\n if (!publicKey.verifySignature({ message, signature: signature.signatures[i] })) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Generates an authentication key based on the current instance's byte representation.\n * This function is essential for creating a secure authentication key that can be used for various cryptographic operations.\n *\n * @returns {AuthenticationKey} The generated authentication key.\n */\n authKey(): AuthenticationKey {\n return AuthenticationKey.fromSchemeAndBytes({\n scheme: AuthenticationKeyScheme.MultiEd25519,\n input: this.toUint8Array(),\n });\n }\n\n /**\n * Converts a PublicKeys into Uint8Array (bytes) with: bytes = p1_bytes | ... | pn_bytes | threshold\n */\n toUint8Array(): Uint8Array {\n const bytes = new Uint8Array(this.publicKeys.length * Ed25519PublicKey.LENGTH + 1);\n this.publicKeys.forEach((k: Ed25519PublicKey, i: number) => {\n bytes.set(k.toUint8Array(), i * Ed25519PublicKey.LENGTH);\n });\n\n bytes[this.publicKeys.length * Ed25519PublicKey.LENGTH] = this.threshold;\n\n return bytes;\n }\n\n // endregion\n\n // region Serializable\n\n /**\n * Serializes the current instance into bytes using the provided serializer.\n * This allows for the conversion of the instance's data into a format suitable for transmission or storage.\n *\n * @param serializer - The serializer used to convert the instance into bytes.\n */\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.toUint8Array());\n }\n\n /**\n * Deserializes a MultiEd25519Signature from the provided deserializer.\n * This function helps in reconstructing a MultiEd25519Signature object from its serialized byte representation.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n */\n static deserialize(deserializer: Deserializer): MultiEd25519PublicKey {\n const bytes = deserializer.deserializeBytes();\n const threshold = bytes[bytes.length - 1];\n\n const keys: Ed25519PublicKey[] = [];\n\n for (let i = 0; i < bytes.length - 1; i += Ed25519PublicKey.LENGTH) {\n const begin = i;\n keys.push(new Ed25519PublicKey(bytes.subarray(begin, begin + Ed25519PublicKey.LENGTH)));\n }\n return new MultiEd25519PublicKey({ publicKeys: keys, threshold });\n }\n\n // endregion\n}\n\n/**\n * Represents the signature of a K-of-N Ed25519 multi-sig transaction.\n *\n * @see {@link https://aptos.dev/integration/creating-a-signed-transaction/#multisignature-transactions | Creating a Signed Transaction}\n */\nexport class MultiEd25519Signature extends Signature {\n /**\n * Maximum number of Ed25519 signatures supported\n */\n static MAX_SIGNATURES_SUPPORTED = 32;\n\n /**\n * Number of bytes in the bitmap representing who signed the transaction (32-bits)\n */\n static BITMAP_LEN: number = 4;\n\n /**\n * The list of underlying Ed25519 signatures\n */\n public readonly signatures: Ed25519Signature[];\n\n /**\n * 32-bit Bitmap representing who signed the transaction\n *\n * This is represented where each public key can be masked to determine whether the message was signed by that key.\n */\n public readonly bitmap: Uint8Array;\n\n /**\n * Signature for a K-of-N multi-sig transaction.\n *\n * @see {@link\n * https://aptos.dev/integration/creating-a-signed-transaction/#multisignature-transactions | Creating a Signed Transaction}\n *\n * @param args.signatures A list of signatures\n * @param args.bitmap 4 bytes, at most 32 signatures are supported. If Nth bit value is `1`, the Nth\n * signature should be provided in `signatures`. Bits are read from left to right.\n * Alternatively, you can specify an array of bitmap positions.\n * Valid position should range between 0 and 31.\n * @see MultiEd25519Signature.createBitmap\n */\n constructor(args: { signatures: Ed25519Signature[]; bitmap: Uint8Array | number[] }) {\n super();\n const { signatures, bitmap } = args;\n\n if (signatures.length > MultiEd25519Signature.MAX_SIGNATURES_SUPPORTED) {\n throw new Error(\n `The number of signatures cannot be greater than ${MultiEd25519Signature.MAX_SIGNATURES_SUPPORTED}`,\n );\n }\n this.signatures = signatures;\n\n if (!(bitmap instanceof Uint8Array)) {\n this.bitmap = MultiEd25519Signature.createBitmap({ bits: bitmap });\n } else if (bitmap.length !== MultiEd25519Signature.BITMAP_LEN) {\n throw new Error(`\"bitmap\" length should be ${MultiEd25519Signature.BITMAP_LEN}`);\n } else {\n this.bitmap = bitmap;\n }\n }\n\n // region AccountSignature\n\n /**\n * Converts a MultiSignature into Uint8Array (bytes) with `bytes = s1_bytes | ... | sn_bytes | bitmap`\n */\n toUint8Array(): Uint8Array {\n const bytes = new Uint8Array(this.signatures.length * Ed25519Signature.LENGTH + MultiEd25519Signature.BITMAP_LEN);\n this.signatures.forEach((k: Ed25519Signature, i: number) => {\n bytes.set(k.toUint8Array(), i * Ed25519Signature.LENGTH);\n });\n\n bytes.set(this.bitmap, this.signatures.length * Ed25519Signature.LENGTH);\n\n return bytes;\n }\n\n // endregion\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.toUint8Array());\n }\n\n static deserialize(deserializer: Deserializer): MultiEd25519Signature {\n const bytes = deserializer.deserializeBytes();\n const bitmap = bytes.subarray(bytes.length - 4);\n\n const signatures: Ed25519Signature[] = [];\n\n for (let i = 0; i < bytes.length - bitmap.length; i += Ed25519Signature.LENGTH) {\n const begin = i;\n signatures.push(new Ed25519Signature(bytes.subarray(begin, begin + Ed25519Signature.LENGTH)));\n }\n return new MultiEd25519Signature({ signatures, bitmap });\n }\n\n // endregion\n\n /**\n * Helper method to create a bitmap out of the specified bit positions.\n * This function allows you to set specific bits in a 32-bit long bitmap based on the provided positions.\n *\n * @param args The arguments for creating the bitmap.\n * @param args.bits The bitmap positions that should be set. A position starts at index 0. Valid positions should range between 0 and 31.\n *\n * @example\n * Here's an example of valid `bits`\n * ```\n * [0, 2, 31]\n * ```\n * `[0, 2, 31]` means the 1st, 3rd and 32nd bits should be set in the bitmap.\n * The result bitmap should be 0b1010000000000000000000000000001\n *\n * @returns bitmap that is 32 bits long.\n */\n static createBitmap(args: { bits: number[] }): Uint8Array {\n const { bits } = args;\n // Bits are read from left to right. e.g. 0b10000000 represents the first bit is set in one byte.\n // The decimal value of 0b10000000 is 128.\n const firstBitInByte = 128;\n const bitmap = new Uint8Array([0, 0, 0, 0]);\n\n // Check if duplicates exist in bits\n const dupCheckSet = new Set();\n\n bits.forEach((bit: number, index) => {\n if (bit >= MultiEd25519Signature.MAX_SIGNATURES_SUPPORTED) {\n throw new Error(`Cannot have a signature larger than ${MultiEd25519Signature.MAX_SIGNATURES_SUPPORTED - 1}.`);\n }\n\n if (dupCheckSet.has(bit)) {\n throw new Error(\"Duplicate bits detected.\");\n }\n\n if (index > 0 && bit <= bits[index - 1]) {\n throw new Error(\"The bits need to be sorted in ascending order.\");\n }\n\n dupCheckSet.add(bit);\n\n const byteOffset = Math.floor(bit / 8);\n\n let byte = bitmap[byteOffset];\n\n // eslint-disable-next-line no-bitwise\n byte |= firstBitInByte >> bit % 8;\n\n bitmap[byteOffset] = byte;\n });\n\n return bitmap;\n }\n}\n"],"mappings":"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","names":["_MultiEd25519PublicKey","AccountPublicKey","args","publicKeys","threshold","message","signature","MultiEd25519Signature","indices","j","index","AuthenticationKey","bytes","Ed25519PublicKey","k","i","serializer","deserializer","keys","begin","MultiEd25519PublicKey","_MultiEd25519Signature","Signature","signatures","bitmap","Ed25519Signature","bits","firstBitInByte","dupCheckSet","bit","byteOffset","byte"]}
@@ -1,2 +1,2 @@
1
- import{b as p}from"./chunk-PUZ25PTD.mjs";async function o(e){let{type:t,originMethod:s,path:i,body:r,acceptType:R,contentType:f,params:c,aptosConfig:n,overrides:A}=e,d=n.getRequestUrl(t);return p({url:d,method:"POST",originMethod:s,path:i,body:r,contentType:f,acceptType:R,params:c,overrides:A},n,e.type)}async function q(e){let{aptosConfig:t}=e;return o({...e,type:"Fullnode",overrides:{...t.clientConfig,...t.fullnodeConfig,...e.overrides,HEADERS:{...t.clientConfig?.HEADERS,...t.fullnodeConfig?.HEADERS}}})}async function C(e){let{aptosConfig:t}=e;return o({...e,type:"Indexer",overrides:{...t.clientConfig,...t.indexerConfig,...e.overrides,HEADERS:{...t.clientConfig?.HEADERS,...t.indexerConfig?.HEADERS}}})}async function m(e){let{aptosConfig:t}=e,s={...t,clientConfig:{...t.clientConfig}};return delete s?.clientConfig?.API_KEY,o({...e,type:"Faucet",overrides:{...s.clientConfig,...s.faucetConfig,...e.overrides,HEADERS:{...s.clientConfig?.HEADERS,...s.faucetConfig?.HEADERS}}})}async function E(e){return o({...e,type:"Pepper"})}async function a(e){return o({...e,type:"Prover"})}export{o as a,q as b,C as c,m as d,E as e,a as f};
2
- //# sourceMappingURL=chunk-7V6DEA7G.mjs.map
1
+ import{b as p}from"./chunk-CRL4WGOH.mjs";async function o(e){let{type:t,originMethod:s,path:i,body:r,acceptType:R,contentType:f,params:c,aptosConfig:n,overrides:A}=e,d=n.getRequestUrl(t);return p({url:d,method:"POST",originMethod:s,path:i,body:r,contentType:f,acceptType:R,params:c,overrides:A},n,e.type)}async function q(e){let{aptosConfig:t}=e;return o({...e,type:"Fullnode",overrides:{...t.clientConfig,...t.fullnodeConfig,...e.overrides,HEADERS:{...t.clientConfig?.HEADERS,...t.fullnodeConfig?.HEADERS}}})}async function C(e){let{aptosConfig:t}=e;return o({...e,type:"Indexer",overrides:{...t.clientConfig,...t.indexerConfig,...e.overrides,HEADERS:{...t.clientConfig?.HEADERS,...t.indexerConfig?.HEADERS}}})}async function m(e){let{aptosConfig:t}=e,s={...t,clientConfig:{...t.clientConfig}};return delete s?.clientConfig?.API_KEY,o({...e,type:"Faucet",overrides:{...s.clientConfig,...s.faucetConfig,...e.overrides,HEADERS:{...s.clientConfig?.HEADERS,...s.faucetConfig?.HEADERS}}})}async function E(e){return o({...e,type:"Pepper"})}async function a(e){return o({...e,type:"Prover"})}export{o as a,q as b,C as c,m as d,E as e,a as f};
2
+ //# sourceMappingURL=chunk-WOOH5MMX.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/client/post.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { aptosRequest } from \"./core\";\nimport { AptosResponse } from \"./types\";\nimport { AnyNumber, ClientConfig, MimeType } from \"../types\";\nimport { AptosApiType } from \"../utils/const\";\n\n/**\n * Options for making a POST request, including the API client configuration.\n */\nexport type PostRequestOptions = {\n /**\n * The config for the API client\n */\n aptosConfig: AptosConfig;\n /**\n * The type of API endpoint to call e.g. fullnode, indexer, etc\n */\n type: AptosApiType;\n /**\n * The name of the API method\n */\n originMethod: string;\n /**\n * The URL path to the API method\n */\n path: string;\n /**\n * The content type of the request body\n */\n contentType?: MimeType;\n /**\n * The accepted content type of the response of the API\n */\n acceptType?: MimeType;\n /**\n * The query parameters for the request\n */\n params?: Record<string, string | AnyNumber | boolean | undefined>;\n /**\n * The body of the request, should match the content type of the request\n */\n body?: any;\n /**\n * Specific client overrides for this request to override aptosConfig\n */\n overrides?: ClientConfig;\n};\n\n/**\n * Options for posting a request to Aptos, excluding the type field.\n */\nexport type PostAptosRequestOptions = Omit<PostRequestOptions, \"type\">;\n\n/**\n * Executes a POST request to the specified URL with the provided options.\n *\n * @param options - The options for the POST request.\n * @param options.type - The type of the request.\n * @param options.originMethod - The original method that initiated the request.\n * @param options.path - The path for the request.\n * @param options.body - The body content to be sent with the request.\n * @param options.acceptType - The type of response expected from the server.\n * @param options.contentType - The content type of the request body.\n * @param options.params - Additional parameters to include in the request.\n * @param options.aptosConfig - Configuration settings for the Aptos request.\n * @param options.overrides - Any overrides for the default request behavior.\n * @returns The response from the POST request.\n */\nexport async function post<Req extends {}, Res extends {}>(\n options: PostRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { type, originMethod, path, body, acceptType, contentType, params, aptosConfig, overrides } = options;\n const url = aptosConfig.getRequestUrl(type);\n\n return aptosRequest<Req, Res>(\n {\n url,\n method: \"POST\",\n originMethod,\n path,\n body,\n contentType,\n acceptType,\n params,\n overrides,\n },\n aptosConfig,\n options.type,\n );\n}\n\n/**\n * Sends a request to the Aptos full node using the specified options.\n * This function allows you to interact with the Aptos blockchain by sending requests to the full node.\n *\n * @param options - The options for the request.\n * @param options.aptosConfig - Configuration settings for the Aptos client.\n * @param options.aptosConfig.clientConfig - Client-specific configuration settings.\n * @param options.aptosConfig.fullnodeConfig - Full node-specific configuration settings.\n * @param options.overrides - Additional overrides for the request.\n */\nexport async function postAptosFullNode<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { aptosConfig } = options;\n\n return post<Req, Res>({\n ...options,\n type: AptosApiType.FULLNODE,\n overrides: {\n ...aptosConfig.clientConfig,\n ...aptosConfig.fullnodeConfig,\n ...options.overrides,\n HEADERS: { ...aptosConfig.clientConfig?.HEADERS, ...aptosConfig.fullnodeConfig?.HEADERS },\n },\n });\n}\n\n/**\n * Sends a request to the Aptos indexer with the specified options.\n * This function allows you to interact with the Aptos indexer and customize the request using various configurations.\n *\n * @param options - The options for the request to the Aptos indexer.\n * @param options.aptosConfig - Configuration settings specific to the Aptos client and indexer.\n * @param options.aptosConfig.clientConfig - The client configuration settings.\n * @param options.aptosConfig.indexerConfig - The indexer configuration settings.\n * @param options.overrides - Additional overrides for the request.\n * @param options.overrides.HEADERS - Custom headers to include in the request.\n */\nexport async function postAptosIndexer<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { aptosConfig } = options;\n\n return post<Req, Res>({\n ...options,\n type: AptosApiType.INDEXER,\n overrides: {\n ...aptosConfig.clientConfig,\n ...aptosConfig.indexerConfig,\n ...options.overrides,\n HEADERS: { ...aptosConfig.clientConfig?.HEADERS, ...aptosConfig.indexerConfig?.HEADERS },\n },\n });\n}\n\n/**\n * Sends a request to the Aptos faucet to obtain test tokens.\n * This function modifies the provided configuration to ensure that the API_KEY is not included in the request.\n *\n * @param options - The options for the request.\n * @param options.aptosConfig - The configuration settings for the Aptos client.\n * @param options.aptosConfig.clientConfig - The client-specific configuration settings.\n * @param options.aptosConfig.clientConfig.HEADERS - Optional headers to include in the request.\n * @param options.aptosConfig.faucetConfig - The configuration settings specific to the faucet.\n * @param options.overrides - Additional overrides for the request configuration.\n */\nexport async function postAptosFaucet<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { aptosConfig } = options;\n // Faucet does not support API_KEY\n // Create a new object with the desired modification\n const modifiedAptosConfig = {\n ...aptosConfig,\n clientConfig: { ...aptosConfig.clientConfig },\n };\n // Delete API_KEY config\n delete modifiedAptosConfig?.clientConfig?.API_KEY;\n\n return post<Req, Res>({\n ...options,\n type: AptosApiType.FAUCET,\n overrides: {\n ...modifiedAptosConfig.clientConfig,\n ...modifiedAptosConfig.faucetConfig,\n ...options.overrides,\n HEADERS: { ...modifiedAptosConfig.clientConfig?.HEADERS, ...modifiedAptosConfig.faucetConfig?.HEADERS },\n },\n });\n}\n\n/**\n * Makes a post request to the pepper service.\n *\n * @param options - The options for the request.\n * @param options.url - The URL to which the request is sent.\n * @param options.headers - The headers to include in the request.\n * @param options.body - The body of the request.\n * @returns A promise that resolves to the response from the pepper service.\n */\nexport async function postAptosPepperService<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n return post<Req, Res>({ ...options, type: AptosApiType.PEPPER });\n}\n\n/**\n * Sends a request to the Aptos proving service with the specified options.\n *\n * @param options - The options for the request to the Aptos proving service.\n * @param options.type - The type of the request, which should be set to AptosApiType.PROVER.\n * @param options.data - The data to be included in the request.\n */\nexport async function postAptosProvingService<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n return post<Req, Res>({ ...options, type: AptosApiType.PROVER });\n}\n"],"mappings":"yCAuEA,eAAsBA,EACpBC,EACkC,CAClC,GAAM,CAAE,KAAAC,EAAM,aAAAC,EAAc,KAAAC,EAAM,KAAAC,EAAM,WAAAC,EAAY,YAAAC,EAAa,OAAAC,EAAQ,YAAAC,EAAa,UAAAC,CAAU,EAAIT,EAC9FU,EAAMF,EAAY,cAAcP,CAAI,EAE1C,OAAOU,EACL,CACE,IAAAD,EACA,OAAQ,OACR,aAAAR,EACA,KAAAC,EACA,KAAAC,EACA,YAAAE,EACA,WAAAD,EACA,OAAAE,EACA,UAAAE,CACF,EACAD,EACAR,EAAQ,IACV,CACF,CAYA,eAAsBY,EACpBZ,EACkC,CAClC,GAAM,CAAE,YAAAQ,CAAY,EAAIR,EAExB,OAAOD,EAAe,CACpB,GAAGC,EACH,gBACA,UAAW,CACT,GAAGQ,EAAY,aACf,GAAGA,EAAY,eACf,GAAGR,EAAQ,UACX,QAAS,CAAE,GAAGQ,EAAY,cAAc,QAAS,GAAGA,EAAY,gBAAgB,OAAQ,CAC1F,CACF,CAAC,CACH,CAaA,eAAsBK,EACpBb,EACkC,CAClC,GAAM,CAAE,YAAAQ,CAAY,EAAIR,EAExB,OAAOD,EAAe,CACpB,GAAGC,EACH,eACA,UAAW,CACT,GAAGQ,EAAY,aACf,GAAGA,EAAY,cACf,GAAGR,EAAQ,UACX,QAAS,CAAE,GAAGQ,EAAY,cAAc,QAAS,GAAGA,EAAY,eAAe,OAAQ,CACzF,CACF,CAAC,CACH,CAaA,eAAsBM,EACpBd,EACkC,CAClC,GAAM,CAAE,YAAAQ,CAAY,EAAIR,EAGlBe,EAAsB,CAC1B,GAAGP,EACH,aAAc,CAAE,GAAGA,EAAY,YAAa,CAC9C,EAEA,cAAOO,GAAqB,cAAc,QAEnChB,EAAe,CACpB,GAAGC,EACH,cACA,UAAW,CACT,GAAGe,EAAoB,aACvB,GAAGA,EAAoB,aACvB,GAAGf,EAAQ,UACX,QAAS,CAAE,GAAGe,EAAoB,cAAc,QAAS,GAAGA,EAAoB,cAAc,OAAQ,CACxG,CACF,CAAC,CACH,CAWA,eAAsBC,EACpBhB,EACkC,CAClC,OAAOD,EAAe,CAAE,GAAGC,EAAS,aAA0B,CAAC,CACjE,CASA,eAAsBiB,EACpBjB,EACkC,CAClC,OAAOD,EAAe,CAAE,GAAGC,EAAS,aAA0B,CAAC,CACjE","names":["post","options","type","originMethod","path","body","acceptType","contentType","params","aptosConfig","overrides","url","aptosRequest","postAptosFullNode","postAptosIndexer","postAptosFaucet","modifiedAptosConfig","postAptosPepperService","postAptosProvingService"]}
@@ -1,2 +1,2 @@
1
- import{b as S}from"./chunk-IMGLHDIA.mjs";import{a as b}from"./chunk-BF4ZE37Q.mjs";import{a as g}from"./chunk-Q4XR6QOZ.mjs";import{d as K,f as A,g as v,h as E,i as H,j as P}from"./chunk-LR65XHSF.mjs";import{a as p}from"./chunk-KA6FZNWP.mjs";import{a as f}from"./chunk-HPZ2S4FE.mjs";import{b as s}from"./chunk-BCUSI3N6.mjs";import{ed25519 as y}from"@noble/curves/ed25519";var d=[237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16];function w(z){let e=z.toUint8Array().slice(32);for(let t=d.length-1;t>=0;t-=1){if(e[t]<d[t])return!0;if(e[t]>d[t])return!1}return!1}var i=class i extends S{constructor(e){super();let t=s.fromHexInput(e);if(t.toUint8Array().length!==i.LENGTH)throw new Error(`PublicKey length should be ${i.LENGTH}`);this.key=t}verifySignature(e){let{message:t,signature:n}=e;if(!w(n))return!1;let o=g(t),c=s.fromHexInput(o).toUint8Array(),u=n.toUint8Array(),l=this.key.toUint8Array();return y.verify(u,c,l)}authKey(){return p.fromSchemeAndBytes({scheme:0,input:this.toUint8Array()})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new i(t)}static isPublicKey(e){return e instanceof i}static isInstance(e){return"key"in e&&e.key?.data?.length===i.LENGTH}};i.LENGTH=32;var m=i,r=class r extends f{constructor(e){super();let t=s.fromHexInput(e);if(t.toUint8Array().length!==r.LENGTH)throw new Error(`PrivateKey length should be ${r.LENGTH}`);this.signingKey=t}static generate(){let e=y.utils.randomPrivateKey();return new r(e)}static fromDerivationPath(e,t){if(!A(e))throw new Error(`Invalid derivation path ${e}`);return r.fromDerivationPathInner(e,P(t))}static fromDerivationPathInner(e,t,n=K){let{key:o,chainCode:c}=v(r.SLIP_0010_SEED,t),u=H(e).map(x=>parseInt(x,10)),{key:l}=u.reduce((x,I)=>E(x,I+n),{key:o,chainCode:c});return new r(l)}publicKey(){let e=y.getPublicKey(this.signingKey.toUint8Array());return new m(e)}sign(e){let t=g(e),n=s.fromHexInput(t).toUint8Array(),o=y.sign(n,this.signingKey.toUint8Array());return new h(o)}toUint8Array(){return this.signingKey.toUint8Array()}toString(){return this.signingKey.toString()}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new r(t)}static isPrivateKey(e){return e instanceof r}};r.LENGTH=32,r.SLIP_0010_SEED="ed25519 seed";var U=r,a=class a extends b{constructor(e){super();let t=s.fromHexInput(e);if(t.toUint8Array().length!==a.LENGTH)throw new Error(`Signature length should be ${a.LENGTH}`);this.data=t}toUint8Array(){return this.data.toUint8Array()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new a(t)}};a.LENGTH=64;var h=a;export{w as a,m as b,U as c,h as d};
2
- //# sourceMappingURL=chunk-DAJOX4PL.mjs.map
1
+ import{b as S}from"./chunk-4OV7QU2U.mjs";import{a as b}from"./chunk-IBLZ6MZU.mjs";import{a as g}from"./chunk-KIW54KWR.mjs";import{d as K,f as A,g as v,h as E,i as H,j as P}from"./chunk-PHP47DI4.mjs";import{a as p}from"./chunk-PRZ7AIGA.mjs";import{a as f}from"./chunk-QQIVWB6G.mjs";import{b as s}from"./chunk-KFNDDPOW.mjs";import{ed25519 as y}from"@noble/curves/ed25519";var d=[237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16];function w(z){let e=z.toUint8Array().slice(32);for(let t=d.length-1;t>=0;t-=1){if(e[t]<d[t])return!0;if(e[t]>d[t])return!1}return!1}var i=class i extends S{constructor(e){super();let t=s.fromHexInput(e);if(t.toUint8Array().length!==i.LENGTH)throw new Error(`PublicKey length should be ${i.LENGTH}`);this.key=t}verifySignature(e){let{message:t,signature:n}=e;if(!w(n))return!1;let o=g(t),c=s.fromHexInput(o).toUint8Array(),u=n.toUint8Array(),l=this.key.toUint8Array();return y.verify(u,c,l)}authKey(){return p.fromSchemeAndBytes({scheme:0,input:this.toUint8Array()})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new i(t)}static isPublicKey(e){return e instanceof i}static isInstance(e){return"key"in e&&e.key?.data?.length===i.LENGTH}};i.LENGTH=32;var m=i,r=class r extends f{constructor(e){super();let t=s.fromHexInput(e);if(t.toUint8Array().length!==r.LENGTH)throw new Error(`PrivateKey length should be ${r.LENGTH}`);this.signingKey=t}static generate(){let e=y.utils.randomPrivateKey();return new r(e)}static fromDerivationPath(e,t){if(!A(e))throw new Error(`Invalid derivation path ${e}`);return r.fromDerivationPathInner(e,P(t))}static fromDerivationPathInner(e,t,n=K){let{key:o,chainCode:c}=v(r.SLIP_0010_SEED,t),u=H(e).map(x=>parseInt(x,10)),{key:l}=u.reduce((x,I)=>E(x,I+n),{key:o,chainCode:c});return new r(l)}publicKey(){let e=y.getPublicKey(this.signingKey.toUint8Array());return new m(e)}sign(e){let t=g(e),n=s.fromHexInput(t).toUint8Array(),o=y.sign(n,this.signingKey.toUint8Array());return new h(o)}toUint8Array(){return this.signingKey.toUint8Array()}toString(){return this.signingKey.toString()}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new r(t)}static isPrivateKey(e){return e instanceof r}};r.LENGTH=32,r.SLIP_0010_SEED="ed25519 seed";var U=r,a=class a extends b{constructor(e){super();let t=s.fromHexInput(e);if(t.toUint8Array().length!==a.LENGTH)throw new Error(`Signature length should be ${a.LENGTH}`);this.data=t}toUint8Array(){return this.data.toUint8Array()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new a(t)}};a.LENGTH=64;var h=a;export{w as a,m as b,U as c,h as d};
2
+ //# sourceMappingURL=chunk-WSVOJSAC.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/core/crypto/ed25519.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { ed25519 } from \"@noble/curves/ed25519\";\nimport { Deserializer } from \"../../bcs/deserializer\";\nimport { Serializable, Serializer } from \"../../bcs/serializer\";\nimport { AuthenticationKey } from \"../authenticationKey\";\nimport { Hex } from \"../hex\";\nimport { HexInput, SigningScheme as AuthenticationKeyScheme } from \"../../types\";\nimport { CKDPriv, deriveKey, HARDENED_OFFSET, isValidHardenedPath, mnemonicToSeed, splitPath } from \"./hdKey\";\nimport { PrivateKey } from \"./privateKey\";\nimport { AccountPublicKey, PublicKey, VerifySignatureArgs } from \"./publicKey\";\nimport { Signature } from \"./signature\";\nimport { convertSigningMessage } from \"./utils\";\n\n/**\n * L is the value that greater than or equal to will produce a non-canonical signature, and must be rejected\n */\nconst L: number[] = [\n 0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,\n];\n\n/**\n * Checks if an ED25519 signature is non-canonical.\n * This function helps determine the validity of a signature by verifying its canonical form.\n *\n * @param signature - The signature to be checked for canonicality.\n * @returns A boolean indicating whether the signature is non-canonical.\n *\n * Comes from Aptos Core\n * https://github.com/aptos-labs/aptos-core/blob/main/crates/aptos-crypto/src/ed25519/ed25519_sigs.rs#L47-L85\n */\nexport function isCanonicalEd25519Signature(signature: Signature): boolean {\n const s = signature.toUint8Array().slice(32);\n for (let i = L.length - 1; i >= 0; i -= 1) {\n if (s[i] < L[i]) {\n return true;\n }\n if (s[i] > L[i]) {\n return false;\n }\n }\n // As this stage S == L which implies a non-canonical S.\n return false;\n}\n\n/**\n * Represents the public key of an Ed25519 key pair.\n *\n * Since [AIP-55](https://github.com/aptos-foundation/AIPs/pull/263) Aptos supports\n * `Legacy` and `Unified` authentication keys.\n *\n * Ed25519 scheme is represented in the SDK as `Legacy authentication key` and also\n * as `AnyPublicKey` that represents any `Unified authentication key`.\n */\nexport class Ed25519PublicKey extends AccountPublicKey {\n /**\n * Length of an Ed25519 public key\n */\n static readonly LENGTH: number = 32;\n\n /**\n * Bytes of the public key\n * @private\n */\n private readonly key: Hex;\n\n /**\n * Creates an instance of the Ed25519Signature class from a hex input.\n * This constructor validates the length of the signature to ensure it meets the required specifications.\n *\n * @param hexInput - The hex input representing the Ed25519 signature.\n * @throws Error if the signature length is not equal to Ed25519Signature.LENGTH.\n */\n constructor(hexInput: HexInput) {\n super();\n\n const hex = Hex.fromHexInput(hexInput);\n if (hex.toUint8Array().length !== Ed25519PublicKey.LENGTH) {\n throw new Error(`PublicKey length should be ${Ed25519PublicKey.LENGTH}`);\n }\n this.key = hex;\n }\n\n // region AccountPublicKey\n\n /**\n * Verifies a signed message using a public key.\n *\n * @param args - The arguments for verification.\n * @param args.message - A signed message as a Hex string or Uint8Array.\n * @param args.signature - The signature of the message.\n */\n verifySignature(args: VerifySignatureArgs): boolean {\n const { message, signature } = args;\n // Verify malleability\n if (!isCanonicalEd25519Signature(signature)) {\n return false;\n }\n\n const messageToVerify = convertSigningMessage(message);\n const messageBytes = Hex.fromHexInput(messageToVerify).toUint8Array();\n const signatureBytes = signature.toUint8Array();\n const publicKeyBytes = this.key.toUint8Array();\n return ed25519.verify(signatureBytes, messageBytes, publicKeyBytes);\n }\n\n /**\n * Generates an authentication key from the public key using the Ed25519 scheme.\n * This function is essential for creating a secure authentication key that can be used for further cryptographic operations.\n *\n * @returns {AuthenticationKey} The generated authentication key.\n */\n authKey(): AuthenticationKey {\n return AuthenticationKey.fromSchemeAndBytes({\n scheme: AuthenticationKeyScheme.Ed25519,\n input: this.toUint8Array(),\n });\n }\n\n /**\n * Convert the internal data representation to a Uint8Array.\n *\n * @returns Uint8Array representation of the data.\n */\n toUint8Array(): Uint8Array {\n return this.key.toUint8Array();\n }\n\n // endregion\n\n // region Serializable\n\n /**\n * Serializes the data into a byte array using the provided serializer.\n * This allows for the conversion of data into a format suitable for transmission or storage.\n *\n * @param serializer - The serializer instance used to perform the serialization.\n */\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.key.toUint8Array());\n }\n\n /**\n * Deserialize bytes into an Ed25519Signature object.\n * This function is used to convert serialized byte data into a usable Ed25519Signature instance.\n *\n * @param deserializer - The deserializer instance used to read the byte data.\n */\n static deserialize(deserializer: Deserializer): Ed25519PublicKey {\n const bytes = deserializer.deserializeBytes();\n return new Ed25519PublicKey(bytes);\n }\n\n // endregion\n\n /**\n * Determine if the provided public key is an instance of Ed25519PublicKey.\n *\n * @param publicKey - The public key to check.\n * @returns True if the public key is an instance of Ed25519PublicKey, otherwise false.\n * @deprecated use `instanceof Ed25519PublicKey` instead.\n */\n static isPublicKey(publicKey: AccountPublicKey): publicKey is Ed25519PublicKey {\n return publicKey instanceof Ed25519PublicKey;\n }\n\n /**\n * Determines if the provided public key is a valid Ed25519 public key.\n * This function checks for the presence of the \"key\" property and verifies that its data length matches the expected length\n * for Ed25519 public keys.\n *\n * @param publicKey - The public key to validate.\n * @returns A boolean indicating whether the public key is a valid Ed25519 public key.\n */\n static isInstance(publicKey: PublicKey): publicKey is Ed25519PublicKey {\n return \"key\" in publicKey && (publicKey.key as any)?.data?.length === Ed25519PublicKey.LENGTH;\n }\n}\n\n/**\n * Represents the private key of an Ed25519 key pair.\n *\n * @static\n * @readonly LENGTH - Length of an Ed25519 private key.\n * @static\n * @readonly SLIP_0010_SEED - The Ed25519 key seed to use for BIP-32 compatibility.\n */\nexport class Ed25519PrivateKey extends Serializable implements PrivateKey {\n /**\n * Length of an Ed25519 private key\n */\n static readonly LENGTH: number = 32;\n\n /**\n * The Ed25519 key seed to use for BIP-32 compatibility\n * See more {@link https://github.com/satoshilabs/slips/blob/master/slip-0010.md}\n */\n static readonly SLIP_0010_SEED = \"ed25519 seed\";\n\n /**\n * The Ed25519 signing key\n * @private\n */\n private readonly signingKey: Hex;\n\n // region Constructors\n\n /**\n * Create a new PrivateKey instance from a Uint8Array or String.\n *\n * @param hexInput HexInput (string or Uint8Array)\n */\n constructor(hexInput: HexInput) {\n super();\n\n const privateKeyHex = Hex.fromHexInput(hexInput);\n if (privateKeyHex.toUint8Array().length !== Ed25519PrivateKey.LENGTH) {\n throw new Error(`PrivateKey length should be ${Ed25519PrivateKey.LENGTH}`);\n }\n\n // Create keyPair from Private key in Uint8Array format\n this.signingKey = privateKeyHex;\n }\n\n /**\n * Generate a new random private key.\n *\n * @returns Ed25519PrivateKey A newly generated Ed25519 private key.\n */\n static generate(): Ed25519PrivateKey {\n const keyPair = ed25519.utils.randomPrivateKey();\n return new Ed25519PrivateKey(keyPair);\n }\n\n /**\n * Derives a private key from a mnemonic seed phrase using a specified BIP44 path.\n * To derive multiple keys from the same phrase, change the path\n *\n * IMPORTANT: Ed25519 supports hardened derivation only, as it lacks a key homomorphism, making non-hardened derivation impossible.\n *\n * @param path - The BIP44 path used for key derivation.\n * @param mnemonics - The mnemonic seed phrase from which the key will be derived.\n * @throws Error if the provided path is not a valid hardened path.\n */\n static fromDerivationPath(path: string, mnemonics: string): Ed25519PrivateKey {\n if (!isValidHardenedPath(path)) {\n throw new Error(`Invalid derivation path ${path}`);\n }\n return Ed25519PrivateKey.fromDerivationPathInner(path, mnemonicToSeed(mnemonics));\n }\n\n /**\n * Derives a child private key from a given BIP44 path and seed.\n * A private inner function so we can separate from the main fromDerivationPath() method\n * to add tests to verify we create the keys correctly.\n *\n * @param path - The BIP44 path used for key derivation.\n * @param seed - The seed phrase created by the mnemonics, represented as a Uint8Array.\n * @param offset - The offset used for key derivation, defaults to HARDENED_OFFSET.\n * @returns An instance of Ed25519PrivateKey derived from the specified path and seed.\n */\n private static fromDerivationPathInner(path: string, seed: Uint8Array, offset = HARDENED_OFFSET): Ed25519PrivateKey {\n const { key, chainCode } = deriveKey(Ed25519PrivateKey.SLIP_0010_SEED, seed);\n\n const segments = splitPath(path).map((el) => parseInt(el, 10));\n\n // Derive the child key based on the path\n const { key: privateKey } = segments.reduce((parentKeys, segment) => CKDPriv(parentKeys, segment + offset), {\n key,\n chainCode,\n });\n return new Ed25519PrivateKey(privateKey);\n }\n\n // endregion\n\n // region PrivateKey\n\n /**\n * Derive the Ed25519PublicKey for this private key.\n *\n * @returns Ed25519PublicKey - The derived public key corresponding to the private key.\n */\n publicKey(): Ed25519PublicKey {\n const bytes = ed25519.getPublicKey(this.signingKey.toUint8Array());\n return new Ed25519PublicKey(bytes);\n }\n\n /**\n * Sign the given message with the private key.\n * This function generates a digital signature for the specified message, ensuring its authenticity and integrity.\n *\n * @param message - A message as a string or Uint8Array in HexInput format.\n * @returns A digital signature for the provided message.\n */\n sign(message: HexInput): Ed25519Signature {\n const messageToSign = convertSigningMessage(message);\n const messageBytes = Hex.fromHexInput(messageToSign).toUint8Array();\n const signatureBytes = ed25519.sign(messageBytes, this.signingKey.toUint8Array());\n return new Ed25519Signature(signatureBytes);\n }\n\n /**\n * Get the private key in bytes (Uint8Array).\n *\n * @returns Uint8Array representation of the private key\n */\n toUint8Array(): Uint8Array {\n return this.signingKey.toUint8Array();\n }\n\n /**\n * Get the private key as a hex string with the 0x prefix.\n *\n * @returns string representation of the private key.\n */\n toString(): string {\n return this.signingKey.toString();\n }\n\n // endregion\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.toUint8Array());\n }\n\n static deserialize(deserializer: Deserializer): Ed25519PrivateKey {\n const bytes = deserializer.deserializeBytes();\n return new Ed25519PrivateKey(bytes);\n }\n\n // endregion\n\n /**\n * Determines if the provided private key is an instance of Ed25519PrivateKey.\n *\n * @param privateKey - The private key to check.\n * @returns A boolean indicating whether the private key is an Ed25519PrivateKey.\n *\n * @deprecated Use `instanceof Ed25519PrivateKey` instead.\n */\n static isPrivateKey(privateKey: PrivateKey): privateKey is Ed25519PrivateKey {\n return privateKey instanceof Ed25519PrivateKey;\n }\n}\n\n/**\n * Represents a signature of a message signed using an Ed25519 private key.\n *\n * @static LENGTH - Length of an Ed25519 signature, which is 64 bytes.\n */\nexport class Ed25519Signature extends Signature {\n /**\n * Length of an Ed25519 signature\n */\n static readonly LENGTH = 64;\n\n /**\n * The signature bytes\n * @private\n */\n private readonly data: Hex;\n\n // region Constructors\n\n constructor(hexInput: HexInput) {\n super();\n const data = Hex.fromHexInput(hexInput);\n if (data.toUint8Array().length !== Ed25519Signature.LENGTH) {\n throw new Error(`Signature length should be ${Ed25519Signature.LENGTH}`);\n }\n this.data = data;\n }\n\n // endregion\n\n // region Signature\n\n toUint8Array(): Uint8Array {\n return this.data.toUint8Array();\n }\n\n // endregion\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.data.toUint8Array());\n }\n\n static deserialize(deserializer: Deserializer): Ed25519Signature {\n const bytes = deserializer.deserializeBytes();\n return new Ed25519Signature(bytes);\n }\n\n // endregion\n}\n"],"mappings":"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","names":["ed25519","L","isCanonicalEd25519Signature","signature","s","i","_Ed25519PublicKey","AccountPublicKey","hexInput","hex","Hex","args","message","messageToVerify","convertSigningMessage","messageBytes","signatureBytes","publicKeyBytes","ed25519","AuthenticationKey","serializer","deserializer","bytes","publicKey","Ed25519PublicKey","_Ed25519PrivateKey","Serializable","privateKeyHex","keyPair","path","mnemonics","isValidHardenedPath","mnemonicToSeed","seed","offset","HARDENED_OFFSET","key","chainCode","deriveKey","segments","splitPath","el","privateKey","parentKeys","segment","CKDPriv","messageToSign","Ed25519Signature","Ed25519PrivateKey","_Ed25519Signature","Signature","data"]}
@@ -1,2 +1,2 @@
1
- import{a as l}from"./chunk-WS4RPKL6.mjs";import{a as o,b as c}from"./chunk-U6Z4FNB7.mjs";import{a as h,i as d}from"./chunk-WWZ3METZ.mjs";import{g as u}from"./chunk-MO4IZXLK.mjs";import g from"eventemitter3";var m="fulfilled",f=(n=>(n.TransactionSent="transactionSent",n.TransactionSendFailed="transactionSendFailed",n.TransactionExecuted="transactionExecuted",n.TransactionExecutionFailed="transactionExecutionFailed",n.ExecutionFinish="executionFinish",n))(f||{}),p=class extends g{constructor(t,e,a=30,n=100,i=10){super();this.taskQueue=new o;this.transactionsQueue=new o;this.outstandingTransactions=new o;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=t,this.account=e,this.started=!1,this.accountSequnceNumber=new l(t,e,a,n,i)}async submitNextTransaction(){try{for(;;){let t=await this.accountSequnceNumber.nextSequenceNumber();if(t===null)return;let e=await this.generateNextTransaction(this.account,t);if(!e)return;let a=d({aptosConfig:this.aptosConfig,transaction:e,signer:this.account});await this.outstandingTransactions.enqueue([a,t])}}catch(t){if(t instanceof c)return;throw new Error(`Submit transaction failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async processTransactions(){try{for(;;){let t=[],e=[],[a,n]=await this.outstandingTransactions.dequeue();for(t.push(a),e.push(n);!this.outstandingTransactions.isEmpty();)[a,n]=await this.outstandingTransactions.dequeue(),t.push(a),e.push(n);let i=await Promise.allSettled(t);for(let s=0;s<i.length&&s<e.length;s+=1){let r=i[s];n=e[s],r.status===m?(this.sentTransactions.push([r.value.hash,n,null]),this.emit("transactionSent",{message:`transaction hash ${r.value.hash} has been committed to chain`,transactionHash:r.value.hash}),await this.checkTransaction(r,n)):(this.sentTransactions.push([r.status,n,r.reason]),this.emit("transactionSendFailed",{message:`failed to commit transaction ${this.sentTransactions.length} with error ${r.reason}`,error:r.reason}))}this.emit("executionFinish",{message:`execute ${i.length} transactions finished`})}}catch(t){if(t instanceof c)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async checkTransaction(t,e){try{let a=[];a.push(u({aptosConfig:this.aptosConfig,transactionHash:t.value.hash}));let n=await Promise.allSettled(a);for(let i=0;i<n.length;i+=1){let s=n[i];s.status===m?(this.executedTransactions.push([s.value.hash,e,null]),this.emit("transactionExecuted",{message:`transaction hash ${s.value.hash} has been executed on chain`,transactionHash:t.value.hash})):(this.executedTransactions.push([s.status,e,s.reason]),this.emit("transactionExecutionFailed",{message:`failed to execute transaction ${this.executedTransactions.length} with error ${s.reason}`,error:s.reason}))}}catch(a){throw new Error(`Check transaction failed for ${this.account.accountAddress.toString()} with error ${a}`)}}async push(t,e){this.transactionsQueue.enqueue([t,e])}async generateNextTransaction(t,e){if(this.transactionsQueue.isEmpty())return;let[a,n]=await this.transactionsQueue.dequeue();return h({aptosConfig:this.aptosConfig,sender:t.accountAddress,data:a,options:{...n,accountSequenceNumber:e}})}async run(){try{for(;!this.taskQueue.isCancelled();)await(await this.taskQueue.dequeue())()}catch(t){throw new Error(`Unable to start transaction batching: ${t}`)}}start(){if(this.started)throw new Error("worker has already started");this.started=!0,this.taskQueue.enqueue(()=>this.submitNextTransaction()),this.taskQueue.enqueue(()=>this.processTransactions()),this.run()}stop(){if(this.taskQueue.isCancelled())throw new Error("worker has already stopped");this.started=!1,this.taskQueue.cancel()}};export{m as a,f as b,p as c};
2
- //# sourceMappingURL=chunk-L5NY7TMI.mjs.map
1
+ import{a as o,b as c}from"./chunk-2CJC43CV.mjs";import{a as l}from"./chunk-7V6RL27I.mjs";import{a as h,i as d}from"./chunk-2I56E4T2.mjs";import{g as u}from"./chunk-DCUVV3VY.mjs";import g from"eventemitter3";var m="fulfilled",f=(n=>(n.TransactionSent="transactionSent",n.TransactionSendFailed="transactionSendFailed",n.TransactionExecuted="transactionExecuted",n.TransactionExecutionFailed="transactionExecutionFailed",n.ExecutionFinish="executionFinish",n))(f||{}),p=class extends g{constructor(t,e,a=30,n=100,i=10){super();this.taskQueue=new o;this.transactionsQueue=new o;this.outstandingTransactions=new o;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=t,this.account=e,this.started=!1,this.accountSequnceNumber=new l(t,e,a,n,i)}async submitNextTransaction(){try{for(;;){let t=await this.accountSequnceNumber.nextSequenceNumber();if(t===null)return;let e=await this.generateNextTransaction(this.account,t);if(!e)return;let a=d({aptosConfig:this.aptosConfig,transaction:e,signer:this.account});await this.outstandingTransactions.enqueue([a,t])}}catch(t){if(t instanceof c)return;throw new Error(`Submit transaction failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async processTransactions(){try{for(;;){let t=[],e=[],[a,n]=await this.outstandingTransactions.dequeue();for(t.push(a),e.push(n);!this.outstandingTransactions.isEmpty();)[a,n]=await this.outstandingTransactions.dequeue(),t.push(a),e.push(n);let i=await Promise.allSettled(t);for(let s=0;s<i.length&&s<e.length;s+=1){let r=i[s];n=e[s],r.status===m?(this.sentTransactions.push([r.value.hash,n,null]),this.emit("transactionSent",{message:`transaction hash ${r.value.hash} has been committed to chain`,transactionHash:r.value.hash}),await this.checkTransaction(r,n)):(this.sentTransactions.push([r.status,n,r.reason]),this.emit("transactionSendFailed",{message:`failed to commit transaction ${this.sentTransactions.length} with error ${r.reason}`,error:r.reason}))}this.emit("executionFinish",{message:`execute ${i.length} transactions finished`})}}catch(t){if(t instanceof c)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async checkTransaction(t,e){try{let a=[];a.push(u({aptosConfig:this.aptosConfig,transactionHash:t.value.hash}));let n=await Promise.allSettled(a);for(let i=0;i<n.length;i+=1){let s=n[i];s.status===m?(this.executedTransactions.push([s.value.hash,e,null]),this.emit("transactionExecuted",{message:`transaction hash ${s.value.hash} has been executed on chain`,transactionHash:t.value.hash})):(this.executedTransactions.push([s.status,e,s.reason]),this.emit("transactionExecutionFailed",{message:`failed to execute transaction ${this.executedTransactions.length} with error ${s.reason}`,error:s.reason}))}}catch(a){throw new Error(`Check transaction failed for ${this.account.accountAddress.toString()} with error ${a}`)}}async push(t,e){this.transactionsQueue.enqueue([t,e])}async generateNextTransaction(t,e){if(this.transactionsQueue.isEmpty())return;let[a,n]=await this.transactionsQueue.dequeue();return h({aptosConfig:this.aptosConfig,sender:t.accountAddress,data:a,options:{...n,accountSequenceNumber:e}})}async run(){try{for(;!this.taskQueue.isCancelled();)await(await this.taskQueue.dequeue())()}catch(t){throw new Error(`Unable to start transaction batching: ${t}`)}}start(){if(this.started)throw new Error("worker has already started");this.started=!0,this.taskQueue.enqueue(()=>this.submitNextTransaction()),this.taskQueue.enqueue(()=>this.processTransactions()),this.run()}stop(){if(this.taskQueue.isCancelled())throw new Error("worker has already stopped");this.started=!1,this.taskQueue.cancel()}};export{m as a,f as b,p as c};
2
+ //# sourceMappingURL=chunk-WUCPTRXU.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/transactions/management/transactionWorker.ts"],"sourcesContent":["/* eslint-disable no-await-in-loop */\n\nimport EventEmitter from \"eventemitter3\";\nimport { AptosConfig } from \"../../api/aptosConfig\";\nimport { Account } from \"../../account\";\nimport { waitForTransaction } from \"../../internal/transaction\";\nimport { generateTransaction, signAndSubmitTransaction } from \"../../internal/transactionSubmission\";\nimport { PendingTransactionResponse, TransactionResponse } from \"../../types\";\nimport { InputGenerateTransactionOptions, InputGenerateTransactionPayloadData } from \"../types\";\nimport { AccountSequenceNumber } from \"./accountSequenceNumber\";\nimport { AsyncQueue, AsyncQueueCancelledError } from \"./asyncQueue\";\nimport { SimpleTransaction } from \"../instances/simpleTransaction\";\n\nexport const promiseFulfilledStatus = \"fulfilled\";\n\n/**\n * Events emitted by the transaction worker during its operation, allowing the dapp to respond to various transaction states.\n */\nexport enum TransactionWorkerEventsEnum {\n // fired after a transaction gets sent to the chain\n TransactionSent = \"transactionSent\",\n // fired if there is an error sending the transaction to the chain\n TransactionSendFailed = \"transactionSendFailed\",\n // fired when a single transaction has executed successfully\n TransactionExecuted = \"transactionExecuted\",\n // fired if a single transaction fails in execution\n TransactionExecutionFailed = \"transactionExecutionFailed\",\n // fired when the worker has finished its job / when the queue has been emptied\n ExecutionFinish = \"executionFinish\",\n}\n\n/**\n * Defines the events emitted by the transaction worker during various stages of transaction processing. *\n * @event transactionSent - Emitted when a transaction is successfully sent.\n * @event transactionSendFailed - Emitted when sending a transaction fails.\n * @event transactionExecuted - Emitted when a transaction is successfully executed.\n * @event transactionExecutionFailed - Emitted when executing a transaction fails.\n * @event executionFinish - Emitted when the execution process is finished.\n */\nexport interface TransactionWorkerEvents {\n transactionSent: (data: SuccessEventData) => void;\n transactionSendFailed: (data: FailureEventData) => void;\n transactionExecuted: (data: SuccessEventData) => void;\n transactionExecutionFailed: (data: FailureEventData) => void;\n executionFinish: (data: ExecutionFinishEventData) => void;\n}\n\n/**\n * The payload for when the worker has finished its job.\n */\nexport type ExecutionFinishEventData = {\n message: string;\n};\n\n/**\n * The payload for a success event.\n */\nexport type SuccessEventData = {\n message: string;\n transactionHash: string;\n};\n\n/**\n * The payload for a failure event.\n */\nexport type FailureEventData = {\n message: string;\n error: string;\n};\n\n/**\n * TransactionWorker provides a simple framework for receiving payloads to be processed.\n *\n * Once one `start()` the process and pushes a new transaction, the worker acquires\n * the current account's next sequence number (by using the AccountSequenceNumber class),\n * generates a signed transaction and pushes an async submission process into the `outstandingTransactions` queue.\n * At the same time, the worker processes transactions by reading the `outstandingTransactions` queue\n * and submits the next transaction to chain, it\n * 1) waits for resolution of the submission process or get pre-execution validation error\n * and 2) waits for the resolution of the execution process or get an execution error.\n * The worker fires events for any submission and/or execution success and/or failure.\n */\nexport class TransactionWorker extends EventEmitter<TransactionWorkerEvents> {\n readonly aptosConfig: AptosConfig;\n\n readonly account: Account;\n\n // current account sequence number\n // TODO: Rename Sequnce -> Sequence\n readonly accountSequnceNumber: AccountSequenceNumber;\n\n readonly taskQueue: AsyncQueue<() => Promise<void>> = new AsyncQueue<() => Promise<void>>();\n\n // process has started\n started: boolean;\n\n /**\n * transactions payloads waiting to be generated and signed\n *\n * TODO support entry function payload from ABI builder\n */\n transactionsQueue = new AsyncQueue<\n [InputGenerateTransactionPayloadData, InputGenerateTransactionOptions | undefined]\n >();\n\n /**\n * signed transactions waiting to be submitted\n */\n outstandingTransactions = new AsyncQueue<[Promise<PendingTransactionResponse>, bigint]>();\n\n /**\n * transactions that have been submitted to chain\n */\n sentTransactions: Array<[string, bigint, any]> = [];\n\n /**\n * transactions that have been committed to chain\n */\n executedTransactions: Array<[string, bigint, any]> = [];\n\n /**\n * Initializes a new instance of the class, providing a framework for receiving payloads to be processed.\n *\n * @param aptosConfig - A configuration object for Aptos.\n * @param account - The account that will be used for sending transactions.\n * @param maxWaitTime - The maximum wait time to wait before re-syncing the sequence number to the current on-chain state,\n * default is 30 seconds.\n * @param maximumInFlight - The maximum number of transactions that can be submitted per account, default is 100.\n * @param sleepTime - The time to wait in seconds before re-evaluating if the maximum number of transactions are in flight,\n * default is 10 seconds.\n */\n constructor(\n aptosConfig: AptosConfig,\n account: Account,\n maxWaitTime: number = 30,\n maximumInFlight: number = 100,\n sleepTime: number = 10,\n ) {\n super();\n this.aptosConfig = aptosConfig;\n this.account = account;\n this.started = false;\n this.accountSequnceNumber = new AccountSequenceNumber(\n aptosConfig,\n account,\n maxWaitTime,\n maximumInFlight,\n sleepTime,\n );\n }\n\n /**\n * Submits the next transaction for the account by generating it with the current sequence number\n * and adding it to the outstanding transaction queue for processing.\n * This function continues to submit transactions until there are no more to process.\n *\n * @throws {Error} Throws an error if the transaction submission fails.\n */\n async submitNextTransaction() {\n try {\n /* eslint-disable no-constant-condition */\n while (true) {\n const sequenceNumber = await this.accountSequnceNumber.nextSequenceNumber();\n if (sequenceNumber === null) return;\n const transaction = await this.generateNextTransaction(this.account, sequenceNumber);\n if (!transaction) return;\n const pendingTransaction = signAndSubmitTransaction({\n aptosConfig: this.aptosConfig,\n transaction,\n signer: this.account,\n });\n await this.outstandingTransactions.enqueue([pendingTransaction, sequenceNumber]);\n }\n } catch (error: any) {\n if (error instanceof AsyncQueueCancelledError) {\n return;\n }\n throw new Error(`Submit transaction failed for ${this.account.accountAddress.toString()} with error ${error}`);\n }\n }\n\n /**\n * Reads the outstanding transaction queue and submits the transactions to the chain.\n * This function processes each transaction, checking their status and emitting events based on whether they were successfully\n * sent or failed.\n *\n * @throws {Error} Throws an error if the process execution fails.\n * @event TransactionWorkerEventsEnum.TransactionSent - Emitted when a transaction has been successfully committed to the chain.\n * @event TransactionWorkerEventsEnum.TransactionSendFailed - Emitted when a transaction fails to commit, along with the error\n * reason.\n * @event TransactionWorkerEventsEnum.ExecutionFinish - Emitted when the execution of transactions is complete.\n */\n async processTransactions() {\n try {\n /* eslint-disable no-constant-condition */\n while (true) {\n const awaitingTransactions = [];\n const sequenceNumbers = [];\n let [pendingTransaction, sequenceNumber] = await this.outstandingTransactions.dequeue();\n\n awaitingTransactions.push(pendingTransaction);\n sequenceNumbers.push(sequenceNumber);\n\n while (!this.outstandingTransactions.isEmpty()) {\n [pendingTransaction, sequenceNumber] = await this.outstandingTransactions.dequeue();\n\n awaitingTransactions.push(pendingTransaction);\n sequenceNumbers.push(sequenceNumber);\n }\n // send awaiting transactions to chain\n const sentTransactions = await Promise.allSettled(awaitingTransactions);\n for (let i = 0; i < sentTransactions.length && i < sequenceNumbers.length; i += 1) {\n // check sent transaction status\n const sentTransaction = sentTransactions[i];\n sequenceNumber = sequenceNumbers[i];\n if (sentTransaction.status === promiseFulfilledStatus) {\n // transaction sent to chain\n this.sentTransactions.push([sentTransaction.value.hash, sequenceNumber, null]);\n // check sent transaction execution\n this.emit(TransactionWorkerEventsEnum.TransactionSent, {\n message: `transaction hash ${sentTransaction.value.hash} has been committed to chain`,\n transactionHash: sentTransaction.value.hash,\n });\n await this.checkTransaction(sentTransaction, sequenceNumber);\n } else {\n // send transaction failed\n this.sentTransactions.push([sentTransaction.status, sequenceNumber, sentTransaction.reason]);\n this.emit(TransactionWorkerEventsEnum.TransactionSendFailed, {\n message: `failed to commit transaction ${this.sentTransactions.length} with error ${sentTransaction.reason}`,\n error: sentTransaction.reason,\n });\n }\n }\n this.emit(TransactionWorkerEventsEnum.ExecutionFinish, {\n message: `execute ${sentTransactions.length} transactions finished`,\n });\n }\n } catch (error: any) {\n if (error instanceof AsyncQueueCancelledError) {\n return;\n }\n throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${error}`);\n }\n }\n\n /**\n * Once a transaction has been sent to the chain, this function checks for its execution status.\n * @param sentTransaction - The transaction that was sent to the chain and is now waiting to be executed.\n * @param sequenceNumber - The account's sequence number that was sent with the transaction.\n */\n async checkTransaction(sentTransaction: PromiseFulfilledResult<PendingTransactionResponse>, sequenceNumber: bigint) {\n try {\n const waitFor: Array<Promise<TransactionResponse>> = [];\n waitFor.push(waitForTransaction({ aptosConfig: this.aptosConfig, transactionHash: sentTransaction.value.hash }));\n const sentTransactions = await Promise.allSettled(waitFor);\n\n for (let i = 0; i < sentTransactions.length; i += 1) {\n const executedTransaction = sentTransactions[i];\n if (executedTransaction.status === promiseFulfilledStatus) {\n // transaction executed to chain\n this.executedTransactions.push([executedTransaction.value.hash, sequenceNumber, null]);\n this.emit(TransactionWorkerEventsEnum.TransactionExecuted, {\n message: `transaction hash ${executedTransaction.value.hash} has been executed on chain`,\n transactionHash: sentTransaction.value.hash,\n });\n } else {\n // transaction execution failed\n this.executedTransactions.push([executedTransaction.status, sequenceNumber, executedTransaction.reason]);\n this.emit(TransactionWorkerEventsEnum.TransactionExecutionFailed, {\n message: `failed to execute transaction ${this.executedTransactions.length} with error ${executedTransaction.reason}`,\n error: executedTransaction.reason,\n });\n }\n }\n } catch (error: any) {\n throw new Error(`Check transaction failed for ${this.account.accountAddress.toString()} with error ${error}`);\n }\n }\n\n /**\n * Pushes a transaction to the transactions queue for processing.\n *\n * @param transactionData - The transaction payload containing necessary details.\n * @param transactionData.abi - For all entry function payloads, the ABI to skip remote ABI lookups.\n * @param options - Optional parameters for transaction configuration.\n * @param options.maxGasAmount - Maximum gas amount for the transaction.\n * @param options.gasUnitPrice - Gas unit price for the transaction.\n * @param options.expireTimestamp - Expiration timestamp on the transaction.\n * @param options.accountSequenceNumber - The sequence number for the transaction.\n */\n async push(\n transactionData: InputGenerateTransactionPayloadData,\n options?: InputGenerateTransactionOptions,\n ): Promise<void> {\n this.transactionsQueue.enqueue([transactionData, options]);\n }\n\n /**\n * Generates a signed transaction that can be submitted to the chain.\n *\n * @param account - An Aptos account used as the sender of the transaction.\n * @param sequenceNumber - A sequence number the transaction will be generated with.\n * @returns A signed transaction object or undefined if the transaction queue is empty.\n */\n async generateNextTransaction(account: Account, sequenceNumber: bigint): Promise<SimpleTransaction | undefined> {\n if (this.transactionsQueue.isEmpty()) return undefined;\n const [transactionData, options] = await this.transactionsQueue.dequeue();\n return generateTransaction({\n aptosConfig: this.aptosConfig,\n sender: account.accountAddress,\n data: transactionData,\n options: { ...options, accountSequenceNumber: sequenceNumber },\n });\n }\n\n /**\n * Starts transaction submission and processing by executing tasks from the queue until it is cancelled.\n *\n * @throws {Error} Throws an error if unable to start transaction batching.\n */\n async run() {\n try {\n while (!this.taskQueue.isCancelled()) {\n const task = await this.taskQueue.dequeue();\n await task();\n }\n } catch (error: any) {\n throw new Error(`Unable to start transaction batching: ${error}`);\n }\n }\n\n /**\n * Starts the transaction management process.\n *\n * @throws {Error} Throws an error if the worker has already started.\n */\n start() {\n if (this.started) {\n throw new Error(\"worker has already started\");\n }\n this.started = true;\n this.taskQueue.enqueue(() => this.submitNextTransaction());\n this.taskQueue.enqueue(() => this.processTransactions());\n this.run();\n }\n\n /**\n * Stops the transaction management process.\n *\n * @throws {Error} Throws an error if the worker has already stopped.\n */\n stop() {\n if (this.taskQueue.isCancelled()) {\n throw new Error(\"worker has already stopped\");\n }\n this.started = false;\n this.taskQueue.cancel();\n }\n}\n"],"mappings":"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","names":["EventEmitter","promiseFulfilledStatus","TransactionWorkerEventsEnum","TransactionWorker","EventEmitter","aptosConfig","account","maxWaitTime","maximumInFlight","sleepTime","AsyncQueue","AccountSequenceNumber","sequenceNumber","transaction","pendingTransaction","signAndSubmitTransaction","error","AsyncQueueCancelledError","awaitingTransactions","sequenceNumbers","sentTransactions","i","sentTransaction","waitFor","waitForTransaction","executedTransaction","transactionData","options","generateTransaction"]}
@@ -0,0 +1,2 @@
1
+ import{b as t,d as a}from"./chunk-WSVOJSAC.mjs";import{a as l}from"./chunk-4OV7QU2U.mjs";import{a as u}from"./chunk-IBLZ6MZU.mjs";import{a as s}from"./chunk-N47FTRYO.mjs";import{b as o}from"./chunk-KFNDDPOW.mjs";var c=class i extends l{constructor(e){super();let r=e.constructor.name;switch(r){case t.name:this.publicKey=e,this.variant=0;break;default:throw new Error(`Unsupported key for EphemeralPublicKey - ${r}`)}}verifySignature(e){let{message:r,signature:n}=e;return this.publicKey.verifySignature({message:r,signature:n.signature})}serialize(e){if(this.publicKey instanceof t)e.serializeU32AsUleb128(0),this.publicKey.serialize(e);else throw new Error("Unknown public key type")}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new i(t.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${r}`)}}static isPublicKey(e){return e instanceof i}},p=class i extends u{constructor(e){super();let r=e.constructor.name;switch(r){case a.name:this.signature=e;break;default:throw new Error(`Unsupported signature for EphemeralSignature - ${r}`)}}static fromHex(e){let r=o.fromHexInput(e),n=new s(r.toUint8Array());return i.deserialize(n)}serialize(e){if(this.signature instanceof a)e.serializeU32AsUleb128(0),this.signature.serialize(e);else throw new Error("Unknown signature type")}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new i(a.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralSignature: ${r}`)}}};export{c as a,p as b};
2
+ //# sourceMappingURL=chunk-XHCALZ7X.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/core/crypto/ephemeral.ts"],"sourcesContent":["import { Serializer, Deserializer } from \"../../bcs\";\nimport { EphemeralPublicKeyVariant, EphemeralSignatureVariant, HexInput } from \"../../types\";\nimport { PublicKey } from \"./publicKey\";\nimport { Signature } from \"./signature\";\nimport { Ed25519PublicKey, Ed25519Signature } from \"./ed25519\";\nimport { Hex } from \"../hex\";\n\n/**\n * Represents ephemeral public keys for Aptos Keyless accounts.\n *\n * These keys are used only temporarily within Keyless accounts and are not utilized as public keys for account identification.\n */\nexport class EphemeralPublicKey extends PublicKey {\n /**\n * The public key itself\n */\n public readonly publicKey: PublicKey;\n\n /**\n * An enum indicating the scheme of the ephemeral public key\n */\n public readonly variant: EphemeralPublicKeyVariant;\n\n /**\n * Creates an instance of EphemeralPublicKey using the provided public key.\n * This constructor ensures that only supported signature types are accepted.\n *\n * @param publicKey - The public key to be used for the ephemeral public key.\n * @throws Error if the signature type is unsupported.\n */\n constructor(publicKey: PublicKey) {\n super();\n const publicKeyType = publicKey.constructor.name;\n switch (publicKeyType) {\n case Ed25519PublicKey.name:\n this.publicKey = publicKey;\n this.variant = EphemeralPublicKeyVariant.Ed25519;\n break;\n default:\n throw new Error(`Unsupported key for EphemeralPublicKey - ${publicKeyType}`);\n }\n }\n\n /**\n * Verifies a signed message using the ephemeral public key.\n *\n * @param args - The arguments for the verification.\n * @param args.message - The message that was signed.\n * @param args.signature - The signature that was signed by the private key of the ephemeral public key.\n * @returns true if the signature is valid, otherwise false.\n */\n verifySignature(args: { message: HexInput; signature: EphemeralSignature }): boolean {\n const { message, signature } = args;\n return this.publicKey.verifySignature({ message, signature: signature.signature });\n }\n\n /**\n * Serializes the current instance, specifically handling the Ed25519 signature type.\n * This function ensures that the signature is properly serialized using the provided serializer.\n *\n * @param serializer - The serializer instance used to serialize the signature.\n * @throws Error if the signature type is unknown.\n */\n serialize(serializer: Serializer): void {\n if (this.publicKey instanceof Ed25519PublicKey) {\n serializer.serializeU32AsUleb128(EphemeralPublicKeyVariant.Ed25519);\n this.publicKey.serialize(serializer);\n } else {\n throw new Error(\"Unknown public key type\");\n }\n }\n\n /**\n * Deserializes an EphemeralSignature from the provided deserializer.\n * This function allows you to retrieve an EphemeralSignature based on the deserialized data.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n */\n static deserialize(deserializer: Deserializer): EphemeralPublicKey {\n const index = deserializer.deserializeUleb128AsU32();\n switch (index) {\n case EphemeralPublicKeyVariant.Ed25519:\n return new EphemeralPublicKey(Ed25519PublicKey.deserialize(deserializer));\n default:\n throw new Error(`Unknown variant index for EphemeralPublicKey: ${index}`);\n }\n }\n\n /**\n * Determines if the provided public key is an instance of `EphemeralPublicKey`.\n *\n * @param publicKey - The public key to check.\n * @returns A boolean indicating whether the public key is an ephemeral type.\n */\n static isPublicKey(publicKey: PublicKey): publicKey is EphemeralPublicKey {\n return publicKey instanceof EphemeralPublicKey;\n }\n}\n\n/**\n * Represents ephemeral signatures used in Aptos Keyless accounts.\n *\n * These signatures are utilized within the KeylessSignature framework.\n */\nexport class EphemeralSignature extends Signature {\n /**\n * The signature signed by the private key of an EphemeralKeyPair\n */\n public readonly signature: Signature;\n\n constructor(signature: Signature) {\n super();\n const signatureType = signature.constructor.name;\n switch (signatureType) {\n case Ed25519Signature.name:\n this.signature = signature;\n break;\n default:\n throw new Error(`Unsupported signature for EphemeralSignature - ${signatureType}`);\n }\n }\n\n /**\n * Deserializes an ephemeral signature from a hexadecimal input.\n * This function allows you to convert a hexadecimal representation of an ephemeral signature into its deserialized form for\n * further processing.\n *\n * @param hexInput - The hexadecimal input representing the ephemeral signature.\n */\n static fromHex(hexInput: HexInput): EphemeralSignature {\n const data = Hex.fromHexInput(hexInput);\n const deserializer = new Deserializer(data.toUint8Array());\n return EphemeralSignature.deserialize(deserializer);\n }\n\n serialize(serializer: Serializer): void {\n if (this.signature instanceof Ed25519Signature) {\n serializer.serializeU32AsUleb128(EphemeralSignatureVariant.Ed25519);\n this.signature.serialize(serializer);\n } else {\n throw new Error(\"Unknown signature type\");\n }\n }\n\n static deserialize(deserializer: Deserializer): EphemeralSignature {\n const index = deserializer.deserializeUleb128AsU32();\n switch (index) {\n case EphemeralSignatureVariant.Ed25519:\n return new EphemeralSignature(Ed25519Signature.deserialize(deserializer));\n default:\n throw new Error(`Unknown variant index for EphemeralSignature: ${index}`);\n }\n }\n}\n"],"mappings":"oNAYO,IAAMA,EAAN,MAAMC,UAA2BC,CAAU,CAkBhD,YAAYC,EAAsB,CAChC,MAAM,EACN,IAAMC,EAAgBD,EAAU,YAAY,KAC5C,OAAQC,EAAe,CACrB,KAAKC,EAAiB,KACpB,KAAK,UAAYF,EACjB,KAAK,QAAU,EACf,MACF,QACE,MAAM,IAAI,MAAM,4CAA4CC,CAAa,EAAE,CAC/E,CACF,CAUA,gBAAgBE,EAAqE,CACnF,GAAM,CAAE,QAAAC,EAAS,UAAAC,CAAU,EAAIF,EAC/B,OAAO,KAAK,UAAU,gBAAgB,CAAE,QAAAC,EAAS,UAAWC,EAAU,SAAU,CAAC,CACnF,CASA,UAAUC,EAA8B,CACtC,GAAI,KAAK,qBAAqBJ,EAC5BI,EAAW,uBAAuD,EAClE,KAAK,UAAU,UAAUA,CAAU,MAEnC,OAAM,IAAI,MAAM,yBAAyB,CAE7C,CAQA,OAAO,YAAYC,EAAgD,CACjE,IAAMC,EAAQD,EAAa,wBAAwB,EACnD,OAAQC,EAAO,CACb,OACE,OAAO,IAAIV,EAAmBI,EAAiB,YAAYK,CAAY,CAAC,EAC1E,QACE,MAAM,IAAI,MAAM,iDAAiDC,CAAK,EAAE,CAC5E,CACF,CAQA,OAAO,YAAYR,EAAuD,CACxE,OAAOA,aAAqBF,CAC9B,CACF,EAOaW,EAAN,MAAMC,UAA2BC,CAAU,CAMhD,YAAYN,EAAsB,CAChC,MAAM,EACN,IAAMO,EAAgBP,EAAU,YAAY,KAC5C,OAAQO,EAAe,CACrB,KAAKC,EAAiB,KACpB,KAAK,UAAYR,EACjB,MACF,QACE,MAAM,IAAI,MAAM,kDAAkDO,CAAa,EAAE,CACrF,CACF,CASA,OAAO,QAAQE,EAAwC,CACrD,IAAMC,EAAOC,EAAI,aAAaF,CAAQ,EAChCP,EAAe,IAAIU,EAAaF,EAAK,aAAa,CAAC,EACzD,OAAOL,EAAmB,YAAYH,CAAY,CACpD,CAEA,UAAUD,EAA8B,CACtC,GAAI,KAAK,qBAAqBO,EAC5BP,EAAW,uBAAuD,EAClE,KAAK,UAAU,UAAUA,CAAU,MAEnC,OAAM,IAAI,MAAM,wBAAwB,CAE5C,CAEA,OAAO,YAAYC,EAAgD,CACjE,IAAMC,EAAQD,EAAa,wBAAwB,EACnD,OAAQC,EAAO,CACb,OACE,OAAO,IAAIE,EAAmBG,EAAiB,YAAYN,CAAY,CAAC,EAC1E,QACE,MAAM,IAAI,MAAM,iDAAiDC,CAAK,EAAE,CAC5E,CACF,CACF","names":["EphemeralPublicKey","_EphemeralPublicKey","PublicKey","publicKey","publicKeyType","Ed25519PublicKey","args","message","signature","serializer","deserializer","index","EphemeralSignature","_EphemeralSignature","Signature","signatureType","Ed25519Signature","hexInput","data","Hex","Deserializer"]}
@@ -1,2 +1,2 @@
1
- import{a as t}from"./chunk-EWZ2M5BW.mjs";import{a as o,b as r,c as s}from"./chunk-STGYDB5E.mjs";var a=class{constructor(e){this.config=e}async getTableItem(e){return o({aptosConfig:this.config,...e})}async getTableItemsData(e){return await t({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),r({aptosConfig:this.config,...e})}async getTableItemsMetadata(e){return await t({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),s({aptosConfig:this.config,...e})}};export{a};
2
- //# sourceMappingURL=chunk-DAXKRXRK.mjs.map
1
+ import{a as t}from"./chunk-TRU3EK64.mjs";import{a as o,b as r,c as s}from"./chunk-Z36WHOZV.mjs";var a=class{constructor(e){this.config=e}async getTableItem(e){return o({aptosConfig:this.config,...e})}async getTableItemsData(e){return await t({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),r({aptosConfig:this.config,...e})}async getTableItemsMetadata(e){return await t({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),s({aptosConfig:this.config,...e})}};export{a};
2
+ //# sourceMappingURL=chunk-XIY2VORC.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/table.ts"],"sourcesContent":["import { getTableItem, getTableItemsData, getTableItemsMetadata } from \"../internal/table\";\nimport {\n TableItemRequest,\n LedgerVersionArg,\n AnyNumber,\n PaginationArgs,\n WhereArg,\n OrderByArg,\n GetTableItemsDataResponse,\n GetTableItemsMetadataResponse,\n} from \"../types\";\nimport { TableItemsBoolExp, TableMetadatasBoolExp } from \"../types/generated/types\";\nimport { ProcessorType } from \"../utils\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { waitForIndexerOnVersion } from \"./utils\";\n\n/**\n * A class to query all `Table` Aptos related queries.\n */\nexport class Table {\n readonly config: AptosConfig;\n\n /**\n * Initializes a new instance of the Aptos client with the specified configuration.\n * This allows you to interact with the Aptos blockchain using the provided settings.\n *\n * @param config - The configuration settings for the Aptos client.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * async function runExample() {\n * // Create a new Aptos client with testnet configuration\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * console.log(\"Aptos client initialized:\", aptos);\n * }\n * runExample().catch(console.error);\n * ```\n */\n constructor(config: AptosConfig) {\n this.config = config;\n }\n\n /**\n * Queries for a specific item in a table identified by the handle and the key for the item.\n * This function allows you to retrieve structured data from a table in the Aptos blockchain.\n *\n * @param args.handle A pointer to where that table is stored.\n * @param args.data Object that describes the table item, including key and value types.\n * @param args.data.key_type The Move type of the table key.\n * @param args.data.value_type The Move type of the table value.\n * @param args.data.key The value of the table key.\n * @param args.options.ledgerVersion The ledger version to query; if not provided, it will get the latest version.\n *\n * @returns Table item value rendered in JSON.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Retrieve a table item from the Aptos blockchain\n * const tableItem = await aptos.getTableItem({\n * handle: \"0x1b854694ae746cdbd8d44186ca4929b2b337df21d1c74633be19b2710552fdca\",\n * data: {\n * key_type: \"address\", // Move type of table key\n * value_type: \"u128\", // Move type of table value\n * key: \"0x619dc29a0aac8fa146714058e8dd6d2d0f3bdf5f6331907bf91f3acd81e6935\" // Value of table key\n * },\n * });\n *\n * console.log(tableItem);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async getTableItem<T>(args: { handle: string; data: TableItemRequest; options?: LedgerVersionArg }): Promise<T> {\n return getTableItem<T>({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for table items data with optional filtering and pagination.\n * This function allows you to retrieve specific data from a table based on provided criteria.\n *\n * @param args - The arguments for querying table items data.\n * @param args.minimumLedgerVersion - Optional minimum ledger version to wait for before querying.\n * @param args.options - Optional parameters for pagination and filtering.\n * @param args.options.where - Conditions to filter the response.\n * @param args.options.offset - The number of items to skip before starting to collect the result set.\n * @param args.options.limit - The maximum number of items to return.\n * @param args.options.orderBy - The criteria to order the results.\n *\n * Note: This query calls the indexer server.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Retrieve table items data with specific filtering options\n * const data = await aptos.getTableItemsData({\n * minimumLedgerVersion: 1, // specify your own minimum ledger version if needed\n * options: {\n * where: {\n * table_handle: { _eq: \"0x1b854694ae746cdbd8d44186ca4929b2b337df21d1c74633be19b2710552fdca\" },\n * transaction_version: { _eq: \"0\" }\n * },\n * limit: 10, // specify your own limit if needed\n * },\n * });\n *\n * console.log(data);\n * }\n * runExample().catch(console.error);\n * ```\n *\n * @returns GetTableItemsDataResponse\n */\n async getTableItemsData(args: {\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & WhereArg<TableItemsBoolExp> & OrderByArg<GetTableItemsDataResponse[0]>;\n }): Promise<GetTableItemsDataResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.DEFAULT,\n });\n return getTableItemsData({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for the metadata of table items, allowing for filtering and pagination.\n *\n * @param args - The parameters for the query.\n * @param args.minimumLedgerVersion - Optional minimum ledger version to wait for before querying.\n * @param args.options - Optional parameters for pagination and filtering.\n * @param args.options.where - Conditions to filter the response.\n * @param args.options.offset - The offset for pagination.\n * @param args.options.limit - The maximum number of items to return.\n * @param args.options.orderBy - The order in which to return the items.\n *\n * Note that this query calls the indexer server.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Fetching table items metadata with a filter condition\n * const data = await aptos.getTableItemsMetadata({\n * minimumLedgerVersion: 1, // specify your own minimum ledger version if needed\n * options: {\n * where: { handle: { _eq: \"0x1b854694ae746cdbd8d44186ca4929b2b337df21d1c74633be19b2710552fdca\" } },\n * limit: 10, // specify your own limit if needed\n * },\n * });\n *\n * console.log(data);\n * }\n * runExample().catch(console.error);\n * ```\n *\n * @returns GetTableItemsMetadataResponse\n */\n async getTableItemsMetadata(args: {\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & WhereArg<TableMetadatasBoolExp> & OrderByArg<GetTableItemsMetadataResponse[0]>;\n }): Promise<GetTableItemsMetadataResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.DEFAULT,\n });\n return getTableItemsMetadata({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"gGAmBO,IAAMA,EAAN,KAAY,CAuBjB,YAAYC,EAAqB,CAC/B,KAAK,OAASA,CAChB,CAsCA,MAAM,aAAgBC,EAA0F,CAC9G,OAAOC,EAAgB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CAC9D,CA2CA,MAAM,kBAAkBA,EAGe,CACrC,aAAME,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBF,EAAK,qBAC3B,iCACF,CAAC,EACMG,EAAkB,CAAE,YAAa,KAAK,OAAQ,GAAGH,CAAK,CAAC,CAChE,CAuCA,MAAM,sBAAsBA,EAGe,CACzC,aAAME,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBF,EAAK,qBAC3B,iCACF,CAAC,EACMI,EAAsB,CAAE,YAAa,KAAK,OAAQ,GAAGJ,CAAK,CAAC,CACpE,CACF","names":["Table","config","args","getTableItem","waitForIndexerOnVersion","getTableItemsData","getTableItemsMetadata"]}
@@ -0,0 +1,2 @@
1
+ import{a as i}from"./chunk-LEKBJ2EG.mjs";import{spawn as n}from"child_process";import l from"tree-kill";import{platform as h}from"os";var c=class{constructor(t){this.MAXIMUM_WAIT_TIME_SEC=75;this.READINESS_ENDPOINT="http://127.0.0.1:8070/";this.showStdout=!0;this.process=null;this.showStdout=t?.showStdout??!0}async stop(){await new Promise((t,s)=>{this.process?.pid&&l(this.process.pid,o=>{o?s(o):t(!0)})})}async run(){await this.checkIfProcessIsUp()||(this.start(),await this.waitUntilProcessIsUp())}start(){let t="npx",s=["aptos","node","run-localnet","--force-restart","--assume-yes","--with-indexer-api"],o=h(),r;o==="win32"?r=n(t,s,{shell:!0}):r=n(t,s),this.process=r,r.stderr?.on("data",e=>{let a=e.toString();console.log(a)}),r.stdout?.on("data",e=>{let a=e.toString();this.showStdout&&console.log(a)})}async waitUntilProcessIsUp(){let t=await this.checkIfProcessIsUp(),s=Date.now()/1e3,o=s;for(;!t&&s+this.MAXIMUM_WAIT_TIME_SEC>o;)await i(1e3),t=await this.checkIfProcessIsUp(),o=Date.now()/1e3;if(!t)throw new Error("Process failed to start");return!0}async checkIfProcessIsUp(){try{return(await fetch(this.READINESS_ENDPOINT)).status===200}catch{return!1}}};export{c as a};
2
+ //# sourceMappingURL=chunk-XOCRDV2V.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/cli/localNode.ts"],"sourcesContent":["/* eslint-disable no-console */\n\nimport { ChildProcessWithoutNullStreams, spawn } from \"child_process\";\nimport kill from \"tree-kill\";\nimport { platform } from \"os\";\n\nimport { sleep } from \"../utils/helpers\";\n\n/**\n * Represents a local node for running a testnet environment.\n * This class provides methods to start, stop, and check the status of the local testnet process.\n * It manages the lifecycle of the node process and ensures that it is operational before executing tests.\n */\nexport class LocalNode {\n readonly MAXIMUM_WAIT_TIME_SEC = 75;\n\n readonly READINESS_ENDPOINT = \"http://127.0.0.1:8070/\";\n\n showStdout: boolean = true;\n\n process: ChildProcessWithoutNullStreams | null = null;\n\n constructor(args?: { showStdout?: boolean }) {\n this.showStdout = args?.showStdout ?? true;\n }\n\n /**\n * Kills the current process and all its descendant processes.\n *\n * @returns {Promise<void>} A promise that resolves to true if the process was successfully killed.\n * @throws {Error} If there is an error while attempting to kill the process.\n */\n async stop(): Promise<void> {\n await new Promise((resolve, reject) => {\n if (!this.process?.pid) return;\n\n /**\n * Terminates the process associated with the given process ID.\n *\n * @param pid - The process ID of the process to be terminated.\n * @param callback - A function that is called after the termination attempt is complete.\n * @param callback.err - An error object if the termination failed; otherwise, null.\n * @param callback.resolve - A boolean indicating whether the termination was successful.\n */\n kill(this.process.pid, (err) => {\n if (err) {\n reject(err);\n } else {\n resolve(true);\n }\n });\n });\n }\n\n /**\n * Runs a local testnet and waits for the process to be up.\n * If the local node process is already running, it returns without starting the process.\n *\n * @returns {Promise<void>} A promise that resolves when the process is up.\n */\n async run(): Promise<void> {\n const nodeIsUp = await this.checkIfProcessIsUp();\n if (nodeIsUp) {\n return;\n }\n this.start();\n await this.waitUntilProcessIsUp();\n }\n\n /**\n * Starts the local testnet by running the Aptos node with the specified command-line arguments.\n *\n * @returns {void}\n *\n * @throws {Error} If there is an issue starting the local testnet.\n */\n start(): void {\n const cliCommand = \"npx\";\n const cliArgs = [\"aptos\", \"node\", \"run-localnet\", \"--force-restart\", \"--assume-yes\", \"--with-indexer-api\"];\n\n const currentPlatform = platform();\n let childProcess;\n // Check if current OS is windows\n if (currentPlatform === \"win32\") {\n childProcess = spawn(cliCommand, cliArgs, { shell: true });\n } else {\n childProcess = spawn(cliCommand, cliArgs);\n }\n\n this.process = childProcess;\n\n childProcess.stderr?.on(\"data\", (data: any) => {\n const str = data.toString();\n // Print local node output error log\n console.log(str);\n });\n\n childProcess.stdout?.on(\"data\", (data: any) => {\n const str = data.toString();\n // Print local node output log\n if (this.showStdout) {\n console.log(str);\n }\n });\n }\n\n /**\n * Waits for the local testnet process to be operational within a specified maximum wait time.\n * This function continuously checks if the process is up and will throw an error if it fails to start.\n *\n * @returns Promise<boolean> - Resolves to true if the process is up, otherwise throws an error.\n */\n async waitUntilProcessIsUp(): Promise<boolean> {\n let operational = await this.checkIfProcessIsUp();\n const start = Date.now() / 1000;\n let last = start;\n\n while (!operational && start + this.MAXIMUM_WAIT_TIME_SEC > last) {\n // eslint-disable-next-line no-await-in-loop\n await sleep(1000);\n // eslint-disable-next-line no-await-in-loop\n operational = await this.checkIfProcessIsUp();\n last = Date.now() / 1000;\n }\n\n // If we are here it means something blocks the process to start.\n // Might worth checking if another process is running on port 8080\n if (!operational) {\n throw new Error(\"Process failed to start\");\n }\n\n return true;\n }\n\n /**\n * Checks if the local testnet is up by querying the readiness endpoint.\n *\n * @returns Promise<boolean> - A promise that resolves to true if the testnet is up, otherwise false.\n */\n async checkIfProcessIsUp(): Promise<boolean> {\n try {\n // Query readiness endpoint\n const data = await fetch(this.READINESS_ENDPOINT);\n if (data.status === 200) {\n return true;\n }\n return false;\n } catch (err: any) {\n return false;\n }\n }\n}\n"],"mappings":"yCAEA,OAAyC,SAAAA,MAAa,gBACtD,OAAOC,MAAU,YACjB,OAAS,YAAAC,MAAgB,KASlB,IAAMC,EAAN,KAAgB,CASrB,YAAYC,EAAiC,CAR7C,KAAS,sBAAwB,GAEjC,KAAS,mBAAqB,yBAE9B,gBAAsB,GAEtB,aAAiD,KAG/C,KAAK,WAAaA,GAAM,YAAc,EACxC,CAQA,MAAM,MAAsB,CAC1B,MAAM,IAAI,QAAQ,CAACC,EAASC,IAAW,CAChC,KAAK,SAAS,KAUnBC,EAAK,KAAK,QAAQ,IAAMC,GAAQ,CAC1BA,EACFF,EAAOE,CAAG,EAEVH,EAAQ,EAAI,CAEhB,CAAC,CACH,CAAC,CACH,CAQA,MAAM,KAAqB,CACR,MAAM,KAAK,mBAAmB,IAI/C,KAAK,MAAM,EACX,MAAM,KAAK,qBAAqB,EAClC,CASA,OAAc,CACZ,IAAMI,EAAa,MACbC,EAAU,CAAC,QAAS,OAAQ,eAAgB,kBAAmB,eAAgB,oBAAoB,EAEnGC,EAAkBC,EAAS,EAC7BC,EAEAF,IAAoB,QACtBE,EAAeC,EAAML,EAAYC,EAAS,CAAE,MAAO,EAAK,CAAC,EAEzDG,EAAeC,EAAML,EAAYC,CAAO,EAG1C,KAAK,QAAUG,EAEfA,EAAa,QAAQ,GAAG,OAASE,GAAc,CAC7C,IAAMC,EAAMD,EAAK,SAAS,EAE1B,QAAQ,IAAIC,CAAG,CACjB,CAAC,EAEDH,EAAa,QAAQ,GAAG,OAASE,GAAc,CAC7C,IAAMC,EAAMD,EAAK,SAAS,EAEtB,KAAK,YACP,QAAQ,IAAIC,CAAG,CAEnB,CAAC,CACH,CAQA,MAAM,sBAAyC,CAC7C,IAAIC,EAAc,MAAM,KAAK,mBAAmB,EAC1CC,EAAQ,KAAK,IAAI,EAAI,IACvBC,EAAOD,EAEX,KAAO,CAACD,GAAeC,EAAQ,KAAK,sBAAwBC,GAE1D,MAAMC,EAAM,GAAI,EAEhBH,EAAc,MAAM,KAAK,mBAAmB,EAC5CE,EAAO,KAAK,IAAI,EAAI,IAKtB,GAAI,CAACF,EACH,MAAM,IAAI,MAAM,yBAAyB,EAG3C,MAAO,EACT,CAOA,MAAM,oBAAuC,CAC3C,GAAI,CAGF,OADa,MAAM,MAAM,KAAK,kBAAkB,GACvC,SAAW,GAItB,MAAmB,CACjB,MAAO,EACT,CACF,CACF","names":["spawn","kill","platform","LocalNode","args","resolve","reject","kill","err","cliCommand","cliArgs","currentPlatform","platform","childProcess","spawn","data","str","operational","start","last","sleep"]}
@@ -1,2 +1,2 @@
1
- import{c as s}from"./chunk-GFGX3QDP.mjs";import{w as i,x as m}from"./chunk-VHNX2NUR.mjs";import{b as n}from"./chunk-7V6DEA7G.mjs";async function b(t){let{aptosConfig:a,handle:e,data:o,options:r}=t;return(await n({aptosConfig:a,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:r?.ledgerVersion},body:o})).data}async function f(t){let{aptosConfig:a,options:e}=t,o={query:i,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await s({aptosConfig:a,query:o,originMethod:"getTableItemsData"})).table_items}async function T(t){let{aptosConfig:a,options:e}=t,o={query:m,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await s({aptosConfig:a,query:o,originMethod:"getTableItemsMetadata"})).table_metadatas}export{b as a,f as b,T as c};
2
- //# sourceMappingURL=chunk-STGYDB5E.mjs.map
1
+ import{c as s}from"./chunk-HDTKBFRX.mjs";import{w as i,x as m}from"./chunk-VHNX2NUR.mjs";import{b as n}from"./chunk-WOOH5MMX.mjs";async function b(t){let{aptosConfig:a,handle:e,data:o,options:r}=t;return(await n({aptosConfig:a,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:r?.ledgerVersion},body:o})).data}async function f(t){let{aptosConfig:a,options:e}=t,o={query:i,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await s({aptosConfig:a,query:o,originMethod:"getTableItemsData"})).table_items}async function T(t){let{aptosConfig:a,options:e}=t,o={query:m,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await s({aptosConfig:a,query:o,originMethod:"getTableItemsMetadata"})).table_metadatas}export{b as a,f as b,T as c};
2
+ //# sourceMappingURL=chunk-Z36WHOZV.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/internal/table.ts"],"sourcesContent":["import { AptosConfig } from \"../api/aptosConfig\";\nimport { postAptosFullNode } from \"../client\";\nimport {\n TableItemRequest,\n LedgerVersionArg,\n PaginationArgs,\n WhereArg,\n OrderByArg,\n GetTableItemsDataResponse,\n GetTableItemsMetadataResponse,\n} from \"../types\";\nimport { GetTableItemsDataQuery, GetTableItemsMetadataQuery } from \"../types/generated/operations\";\nimport { GetTableItemsData, GetTableItemsMetadata } from \"../types/generated/queries\";\nimport { TableItemsBoolExp, TableMetadatasBoolExp } from \"../types/generated/types\";\nimport { queryIndexer } from \"./general\";\n\n/**\n * Retrieves a specific item from a table in the Aptos blockchain.\n *\n * @param args - The arguments for retrieving the table item.\n * @param args.aptosConfig - The configuration for connecting to the Aptos blockchain.\n * @param args.handle - The identifier for the table from which to retrieve the item.\n * @param args.data - The request data for the table item.\n * @param args.options - Optional parameters for the request, including ledger version.\n */\nexport async function getTableItem<T>(args: {\n aptosConfig: AptosConfig;\n handle: string;\n data: TableItemRequest;\n options?: LedgerVersionArg;\n}): Promise<T> {\n const { aptosConfig, handle, data, options } = args;\n const response = await postAptosFullNode<TableItemRequest, any>({\n aptosConfig,\n originMethod: \"getTableItem\",\n path: `tables/${handle}/item`,\n params: { ledger_version: options?.ledgerVersion },\n body: data,\n });\n return response.data as T;\n}\n\n/**\n * Retrieves table items data based on specified conditions and pagination options.\n *\n * @param args - The arguments for retrieving table items data.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.options - Optional parameters for pagination and filtering.\n * @param args.options.offset - The number of items to skip before starting to collect the result set.\n * @param args.options.limit - The maximum number of items to return.\n * @param args.options.where - Conditions to filter the table items.\n * @param args.options.orderBy - The criteria to sort the results.\n */\nexport async function getTableItemsData(args: {\n aptosConfig: AptosConfig;\n options?: PaginationArgs & WhereArg<TableItemsBoolExp> & OrderByArg<GetTableItemsDataResponse[0]>;\n}) {\n const { aptosConfig, options } = args;\n\n const graphqlQuery = {\n query: GetTableItemsData,\n variables: {\n where_condition: options?.where,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetTableItemsDataQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getTableItemsData\",\n });\n\n return data.table_items;\n}\n\n/**\n * Retrieves metadata for table items based on specified options.\n *\n * @param args - The arguments for retrieving table items metadata.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.options - Optional parameters for pagination and filtering.\n * @param args.options.offset - The number of items to skip before starting to collect the result set.\n * @param args.options.limit - The maximum number of items to return.\n * @param args.options.where - Conditions to filter the results.\n * @param args.options.orderBy - The order in which to return the results.\n * @returns A promise that resolves to an array of table metadata.\n */\nexport async function getTableItemsMetadata(args: {\n aptosConfig: AptosConfig;\n options?: PaginationArgs & WhereArg<TableMetadatasBoolExp> & OrderByArg<GetTableItemsMetadataResponse[0]>;\n}): Promise<GetTableItemsMetadataResponse> {\n const { aptosConfig, options } = args;\n\n const graphqlQuery = {\n query: GetTableItemsMetadata,\n variables: {\n where_condition: options?.where,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetTableItemsMetadataQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getTableItemsMetadata\",\n });\n\n return data.table_metadatas;\n}\n"],"mappings":"kIAyBA,eAAsBA,EAAgBC,EAKvB,CACb,GAAM,CAAE,YAAAC,EAAa,OAAAC,EAAQ,KAAAC,EAAM,QAAAC,CAAQ,EAAIJ,EAQ/C,OAPiB,MAAMK,EAAyC,CAC9D,YAAAJ,EACA,aAAc,eACd,KAAM,UAAUC,CAAM,QACtB,OAAQ,CAAE,eAAgBE,GAAS,aAAc,EACjD,KAAMD,CACR,CAAC,GACe,IAClB,CAaA,eAAsBG,EAAkBN,EAGrC,CACD,GAAM,CAAE,YAAAC,EAAa,QAAAG,CAAQ,EAAIJ,EAE3BO,EAAe,CACnB,MAAOC,EACP,UAAW,CACT,gBAAiBJ,GAAS,MAC1B,OAAQA,GAAS,OACjB,MAAOA,GAAS,MAChB,SAAUA,GAAS,OACrB,CACF,EAQA,OANa,MAAMK,EAAqC,CACtD,YAAAR,EACA,MAAOM,EACP,aAAc,mBAChB,CAAC,GAEW,WACd,CAcA,eAAsBG,EAAsBV,EAGD,CACzC,GAAM,CAAE,YAAAC,EAAa,QAAAG,CAAQ,EAAIJ,EAE3BO,EAAe,CACnB,MAAOI,EACP,UAAW,CACT,gBAAiBP,GAAS,MAC1B,OAAQA,GAAS,OACjB,MAAOA,GAAS,MAChB,SAAUA,GAAS,OACrB,CACF,EAQA,OANa,MAAMK,EAAyC,CAC1D,YAAAR,EACA,MAAOM,EACP,aAAc,uBAChB,CAAC,GAEW,eACd","names":["getTableItem","args","aptosConfig","handle","data","options","postAptosFullNode","getTableItemsData","graphqlQuery","GetTableItemsData","queryIndexer","getTableItemsMetadata","GetTableItemsMetadata"]}
@@ -1,2 +1,2 @@
1
- import{a as i}from"./chunk-HPZ2S4FE.mjs";var r=class a extends i{constructor(e){super(),this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let s=e.deserializeU8();return new a(s)}};export{r as a};
2
- //# sourceMappingURL=chunk-LXLISEQ4.mjs.map
1
+ import{a as i}from"./chunk-QQIVWB6G.mjs";var r=class a extends i{constructor(e){super(),this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let s=e.deserializeU8();return new a(s)}};export{r as a};
2
+ //# sourceMappingURL=chunk-ZINOJTLU.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/transactions/instances/chainId.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Serializer, Serializable } from \"../../bcs/serializer\";\nimport { Deserializer } from \"../../bcs/deserializer\";\n\n/**\n * Represents a ChainId that can be serialized and deserialized.\n *\n * @extends Serializable\n */\nexport class ChainId extends Serializable {\n public readonly chainId: number;\n\n /**\n * Initializes a new instance of the class with the specified chain ID.\n *\n * @param chainId - The ID of the blockchain network to be used.\n */\n constructor(chainId: number) {\n super();\n this.chainId = chainId;\n }\n\n /**\n * Serializes the current object using the provided serializer.\n * This function helps in converting the object into a format suitable for transmission or storage.\n *\n * @param serializer - The serializer instance used to perform the serialization.\n */\n serialize(serializer: Serializer): void {\n serializer.serializeU8(this.chainId);\n }\n\n /**\n * Deserializes a ChainId from the provided deserializer.\n * This function allows you to reconstruct a ChainId object from serialized data.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n */\n static deserialize(deserializer: Deserializer): ChainId {\n const chainId = deserializer.deserializeU8();\n return new ChainId(chainId);\n }\n}\n"],"mappings":"yCAWO,IAAMA,EAAN,MAAMC,UAAgBC,CAAa,CAQxC,YAAYC,EAAiB,CAC3B,MAAM,EACN,KAAK,QAAUA,CACjB,CAQA,UAAUC,EAA8B,CACtCA,EAAW,YAAY,KAAK,OAAO,CACrC,CAQA,OAAO,YAAYC,EAAqC,CACtD,IAAMF,EAAUE,EAAa,cAAc,EAC3C,OAAO,IAAIJ,EAAQE,CAAO,CAC5B,CACF","names":["ChainId","_ChainId","Serializable","chainId","serializer","deserializer"]}
@@ -1,2 +1,2 @@
1
- import{a as p}from"./chunk-K2O24YLZ.mjs";import{e as a}from"./chunk-TMW2HIXC.mjs";import{a as l,b as o}from"./chunk-GGR3P2TG.mjs";import{b as y}from"./chunk-QPP6BX53.mjs";var m=class g{constructor(i){let{multiKey:t,signers:e,address:c}=i;this.publicKey=t,this.signingScheme=3,this.accountAddress=c?y.from(c):this.publicKey.authKey().derivedAddress();let s=[];for(let n of e)s.push(this.publicKey.getIndex(n.publicKey));let r=e.map((n,u)=>[n,s[u]]);r.sort((n,u)=>n[1]-u[1]),this.signers=r.map(n=>n[0]),this.signerIndicies=r.map(n=>n[1]),this.signaturesBitmap=this.publicKey.createBitmap({bits:s})}static fromPublicKeysAndSigners(i){let{publicKeys:t,signaturesRequired:e,signers:c}=i,s=new l({publicKeys:t,signaturesRequired:e});return new g({multiKey:s,signers:c})}static isMultiKeySigner(i){return i instanceof g}signWithAuthenticator(i){return new a(this.publicKey,this.sign(i))}signTransactionWithAuthenticator(i){return new a(this.publicKey,this.signTransaction(i))}async waitForProofFetch(){let t=this.signers.filter(e=>e instanceof p).map(async e=>e.waitForProofFetch());await Promise.all(t)}sign(i){let t=[];for(let e of this.signers)t.push(e.sign(i));return new o({signatures:t,bitmap:this.signaturesBitmap})}signTransaction(i){let t=[];for(let e of this.signers)t.push(e.signTransaction(i));return new o({signatures:t,bitmap:this.signaturesBitmap})}verifySignature(i){let{message:t,signature:e}=i;if(!this.signerIndicies.every((s,r)=>r===0||s>=this.signerIndicies[r-1]))return!1;for(let s=0;s<e.signatures.length;s+=1){let r=e.signatures[s];if(!this.publicKey.publicKeys[this.signerIndicies[s]].verifySignature({message:t,signature:r}))return!1}return!0}};export{m as a};
2
- //# sourceMappingURL=chunk-46D5QX3G.mjs.map
1
+ import{a as m}from"./chunk-5ZBHIUWG.mjs";import{e as a}from"./chunk-IFHQSZLK.mjs";import{a as l,b as o}from"./chunk-6AGTDRNM.mjs";import{b as y}from"./chunk-KM6UXNC7.mjs";var p=class g{constructor(i){let{multiKey:t,signers:e,address:c}=i;this.publicKey=t,this.signingScheme=3,this.accountAddress=c?y.from(c):this.publicKey.authKey().derivedAddress();let s=[];for(let n of e)s.push(this.publicKey.getIndex(n.publicKey));let r=e.map((n,u)=>[n,s[u]]);r.sort((n,u)=>n[1]-u[1]),this.signers=r.map(n=>n[0]),this.signerIndicies=r.map(n=>n[1]),this.signaturesBitmap=this.publicKey.createBitmap({bits:s})}static fromPublicKeysAndSigners(i){let{publicKeys:t,signaturesRequired:e,signers:c}=i,s=new l({publicKeys:t,signaturesRequired:e});return new g({multiKey:s,signers:c})}static isMultiKeySigner(i){return i instanceof g}signWithAuthenticator(i){return new a(this.publicKey,this.sign(i))}signTransactionWithAuthenticator(i){return new a(this.publicKey,this.signTransaction(i))}async waitForProofFetch(){let t=this.signers.filter(e=>e instanceof m).map(async e=>e.waitForProofFetch());await Promise.all(t)}sign(i){let t=[];for(let e of this.signers)t.push(e.sign(i));return new o({signatures:t,bitmap:this.signaturesBitmap})}signTransaction(i){let t=[];for(let e of this.signers)t.push(e.signTransaction(i));return new o({signatures:t,bitmap:this.signaturesBitmap})}verifySignature(i){let{message:t,signature:e}=i;if(!this.signerIndicies.every((s,r)=>r===0||s>=this.signerIndicies[r-1]))return!1;for(let s=0;s<e.signatures.length;s+=1){let r=e.signatures[s];if(!this.publicKey.publicKeys[this.signerIndicies[s]].verifySignature({message:t,signature:r}))return!1}return!0}};export{p as a};
2
+ //# sourceMappingURL=chunk-ZS3EWM5A.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/account/MultiKeyAccount.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Account } from \"./Account\";\nimport { MultiKey, MultiKeySignature, PublicKey } from \"../core/crypto\";\nimport { AccountAddress, AccountAddressInput } from \"../core/accountAddress\";\nimport { HexInput, SigningScheme } from \"../types\";\nimport { AccountAuthenticatorMultiKey } from \"../transactions/authenticator/account\";\nimport { AnyRawTransaction } from \"../transactions/types\";\nimport { AbstractKeylessAccount } from \"./AbstractKeylessAccount\";\n\n/**\n * Arguments required to verify a multi-key signature against a given message.\n *\n * @param message - The original message that was signed.\n * @param signature - The multi-key signature to be verified.\n */\nexport interface VerifyMultiKeySignatureArgs {\n message: HexInput;\n signature: MultiKeySignature;\n}\n\n/**\n * Signer implementation for the MultiKey authentication scheme.\n *\n * This account utilizes an M of N signing scheme, where M and N are specified in the {@link MultiKey}.\n * It signs messages using an array of M accounts, each corresponding to a public key in the {@link MultiKey}.\n *\n * Note: Generating a signer instance does not create the account on-chain.\n */\nexport class MultiKeyAccount implements Account {\n /**\n * Public key associated with the account\n */\n readonly publicKey: MultiKey;\n\n /**\n * Account address associated with the account\n */\n readonly accountAddress: AccountAddress;\n\n /**\n * Signing scheme used to sign transactions\n */\n readonly signingScheme: SigningScheme;\n\n /**\n * The signers used to sign messages. These signers should correspond to public keys in the\n * MultiKeyAccount's public key. The number of signers should be equal or greater\n * than this.publicKey.signaturesRequired\n */\n readonly signers: Account[];\n\n /**\n * An array of indices where for signer[i], signerIndicies[i] is the index of the corresponding public key in\n * publicKey.publicKeys. Used to derive the right public key to use for verification.\n */\n // TODO: Rename Indicies to Indices\n readonly signerIndicies: number[];\n\n readonly signaturesBitmap: Uint8Array;\n\n /**\n * Constructs a MultiKeyAccount instance, which requires multiple signatures for transactions.\n *\n * @param args - The arguments for creating a MultiKeyAccount.\n * @param args.multiKey - The multikey of the account consisting of N public keys and a number M representing the required signatures.\n * @param args.signers - An array of M signers that will be used to sign the transaction.\n * @param args.address - An optional account address input. If not provided, the derived address from the public key will be used.\n */\n constructor(args: { multiKey: MultiKey; signers: Account[]; address?: AccountAddressInput }) {\n const { multiKey, signers, address } = args;\n\n this.publicKey = multiKey;\n this.signingScheme = SigningScheme.MultiKey;\n\n this.accountAddress = address ? AccountAddress.from(address) : this.publicKey.authKey().derivedAddress();\n\n // Get the index of each respective signer in the bitmap\n const bitPositions: number[] = [];\n for (const signer of signers) {\n bitPositions.push(this.publicKey.getIndex(signer.publicKey));\n }\n // Zip signers and bit positions and sort signers by bit positions in order\n // to ensure the signature is signed in ascending order according to the bitmap.\n // Authentication on chain will fail otherwise.\n const signersAndBitPosition: [Account, number][] = signers.map((signer, index) => [signer, bitPositions[index]]);\n signersAndBitPosition.sort((a, b) => a[1] - b[1]);\n this.signers = signersAndBitPosition.map((value) => value[0]);\n this.signerIndicies = signersAndBitPosition.map((value) => value[1]);\n this.signaturesBitmap = this.publicKey.createBitmap({ bits: bitPositions });\n }\n\n /**\n * Static constructor to create a MultiKeyAccount using the provided public keys and signers.\n *\n * @param args - The arguments for creating a MultiKeyAccount.\n * @param args.publicKeys - The N public keys of the MultiKeyAccount.\n * @param args.signaturesRequired - The number of signatures required to authorize a transaction.\n * @param args.signers - An array of M signers that will be used to sign the transaction.\n * @returns MultiKeyAccount - The newly created MultiKeyAccount.\n */\n static fromPublicKeysAndSigners(args: {\n publicKeys: PublicKey[];\n signaturesRequired: number;\n signers: Account[];\n }): MultiKeyAccount {\n const { publicKeys, signaturesRequired, signers } = args;\n const multiKey = new MultiKey({ publicKeys, signaturesRequired });\n return new MultiKeyAccount({ multiKey, signers });\n }\n\n /**\n * Determines if the provided account is a multi-key account.\n *\n * @param account - The account to check.\n * @returns A boolean indicating whether the account is a multi-key account.\n */\n static isMultiKeySigner(account: Account): account is MultiKeyAccount {\n return account instanceof MultiKeyAccount;\n }\n\n /**\n * Sign a message using the account's signers and return an AccountAuthenticator containing the signature along with the\n * account's public key.\n * @param message - The signing message, represented as binary input in hexadecimal format.\n * @returns An instance of AccountAuthenticatorMultiKey that includes the signature and the public key.\n */\n signWithAuthenticator(message: HexInput): AccountAuthenticatorMultiKey {\n return new AccountAuthenticatorMultiKey(this.publicKey, this.sign(message));\n }\n\n /**\n * Sign a transaction using the account's signers, returning an AccountAuthenticator that contains the signature and the\n * account's public key.\n * @param transaction - The raw transaction to be signed.\n * @returns An AccountAuthenticatorMultiKey containing the signature of the transaction along with the account's public key.\n */\n signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorMultiKey {\n return new AccountAuthenticatorMultiKey(this.publicKey, this.signTransaction(transaction));\n }\n\n /**\n * Waits for any proofs on KeylessAccount signers to be fetched. This ensures that signing with the KeylessAccount does not\n * fail due to missing proofs.\n * @return {Promise<void>} A promise that resolves when all proofs have been fetched.\n */\n async waitForProofFetch(): Promise<void> {\n const keylessSigners = this.signers.filter(\n (signer) => signer instanceof AbstractKeylessAccount,\n ) as AbstractKeylessAccount[];\n const promises = keylessSigners.map(async (signer) => signer.waitForProofFetch());\n await Promise.all(promises);\n }\n\n /**\n * Sign the given data using the MultiKeyAccount's signers.\n * @param data - The data to be signed in HexInput format.\n * @returns MultiKeySignature - The resulting multi-key signature.\n */\n sign(data: HexInput): MultiKeySignature {\n const signatures = [];\n for (const signer of this.signers) {\n signatures.push(signer.sign(data));\n }\n return new MultiKeySignature({ signatures, bitmap: this.signaturesBitmap });\n }\n\n /**\n * Sign the given transaction using the MultiKeyAccount's signers.\n * This function aggregates signatures from all signers associated with the MultiKeyAccount.\n *\n * @param transaction - The transaction to be signed.\n * @returns MultiKeySignature - An object containing the aggregated signatures and a bitmap of the signatures.\n */\n signTransaction(transaction: AnyRawTransaction): MultiKeySignature {\n const signatures = [];\n for (const signer of this.signers) {\n signatures.push(signer.signTransaction(transaction));\n }\n return new MultiKeySignature({ signatures, bitmap: this.signaturesBitmap });\n }\n\n /**\n * Verify the given message and signature with the public keys.\n *\n * This function checks if the provided signatures are valid for the given message using the corresponding public keys.\n *\n * @param args - The arguments for verifying the signature.\n * @param args.message - The raw message data in HexInput format.\n * @param args.signature - The signed message MultiKeySignature containing multiple signatures.\n * @returns A boolean indicating whether the signatures are valid for the message.\n */\n verifySignature(args: VerifyMultiKeySignatureArgs): boolean {\n const { message, signature } = args;\n const isSignerIndicesSorted = this.signerIndicies.every(\n (value, i) => i === 0 || value >= this.signerIndicies[i - 1],\n );\n if (!isSignerIndicesSorted) {\n return false;\n }\n for (let i = 0; i < signature.signatures.length; i += 1) {\n const singleSignature = signature.signatures[i];\n const publicKey = this.publicKey.publicKeys[this.signerIndicies[i]];\n if (!publicKey.verifySignature({ message, signature: singleSignature })) {\n return false;\n }\n }\n return true;\n }\n}\n"],"mappings":"2KA8BO,IAAMA,EAAN,MAAMC,CAAmC,CAwC9C,YAAYC,EAAiF,CAC3F,GAAM,CAAE,SAAAC,EAAU,QAAAC,EAAS,QAAAC,CAAQ,EAAIH,EAEvC,KAAK,UAAYC,EACjB,KAAK,cAAgB,EAErB,KAAK,eAAiBE,EAAUC,EAAe,KAAKD,CAAO,EAAI,KAAK,UAAU,QAAQ,EAAE,eAAe,EAGvG,IAAME,EAAyB,CAAC,EAChC,QAAWC,KAAUJ,EACnBG,EAAa,KAAK,KAAK,UAAU,SAASC,EAAO,SAAS,CAAC,EAK7D,IAAMC,EAA6CL,EAAQ,IAAI,CAACI,EAAQE,IAAU,CAACF,EAAQD,EAAaG,CAAK,CAAC,CAAC,EAC/GD,EAAsB,KAAK,CAACE,EAAGC,IAAMD,EAAE,CAAC,EAAIC,EAAE,CAAC,CAAC,EAChD,KAAK,QAAUH,EAAsB,IAAKI,GAAUA,EAAM,CAAC,CAAC,EAC5D,KAAK,eAAiBJ,EAAsB,IAAKI,GAAUA,EAAM,CAAC,CAAC,EACnE,KAAK,iBAAmB,KAAK,UAAU,aAAa,CAAE,KAAMN,CAAa,CAAC,CAC5E,CAWA,OAAO,yBAAyBL,EAIZ,CAClB,GAAM,CAAE,WAAAY,EAAY,mBAAAC,EAAoB,QAAAX,CAAQ,EAAIF,EAC9CC,EAAW,IAAIa,EAAS,CAAE,WAAAF,EAAY,mBAAAC,CAAmB,CAAC,EAChE,OAAO,IAAId,EAAgB,CAAE,SAAAE,EAAU,QAAAC,CAAQ,CAAC,CAClD,CAQA,OAAO,iBAAiBa,EAA8C,CACpE,OAAOA,aAAmBhB,CAC5B,CAQA,sBAAsBiB,EAAiD,CACrE,OAAO,IAAIC,EAA6B,KAAK,UAAW,KAAK,KAAKD,CAAO,CAAC,CAC5E,CAQA,iCAAiCE,EAA8D,CAC7F,OAAO,IAAID,EAA6B,KAAK,UAAW,KAAK,gBAAgBC,CAAW,CAAC,CAC3F,CAOA,MAAM,mBAAmC,CAIvC,IAAMC,EAHiB,KAAK,QAAQ,OACjCb,GAAWA,aAAkBc,CAChC,EACgC,IAAI,MAAOd,GAAWA,EAAO,kBAAkB,CAAC,EAChF,MAAM,QAAQ,IAAIa,CAAQ,CAC5B,CAOA,KAAKE,EAAmC,CACtC,IAAMC,EAAa,CAAC,EACpB,QAAWhB,KAAU,KAAK,QACxBgB,EAAW,KAAKhB,EAAO,KAAKe,CAAI,CAAC,EAEnC,OAAO,IAAIE,EAAkB,CAAE,WAAAD,EAAY,OAAQ,KAAK,gBAAiB,CAAC,CAC5E,CASA,gBAAgBJ,EAAmD,CACjE,IAAMI,EAAa,CAAC,EACpB,QAAWhB,KAAU,KAAK,QACxBgB,EAAW,KAAKhB,EAAO,gBAAgBY,CAAW,CAAC,EAErD,OAAO,IAAIK,EAAkB,CAAE,WAAAD,EAAY,OAAQ,KAAK,gBAAiB,CAAC,CAC5E,CAYA,gBAAgBtB,EAA4C,CAC1D,GAAM,CAAE,QAAAgB,EAAS,UAAAQ,CAAU,EAAIxB,EAI/B,GAAI,CAH0B,KAAK,eAAe,MAChD,CAACW,EAAOc,IAAMA,IAAM,GAAKd,GAAS,KAAK,eAAec,EAAI,CAAC,CAC7D,EAEE,MAAO,GAET,QAASA,EAAI,EAAGA,EAAID,EAAU,WAAW,OAAQC,GAAK,EAAG,CACvD,IAAMC,EAAkBF,EAAU,WAAWC,CAAC,EAE9C,GAAI,CADc,KAAK,UAAU,WAAW,KAAK,eAAeA,CAAC,CAAC,EACnD,gBAAgB,CAAE,QAAAT,EAAS,UAAWU,CAAgB,CAAC,EACpE,MAAO,EAEX,CACA,MAAO,EACT,CACF","names":["MultiKeyAccount","_MultiKeyAccount","args","multiKey","signers","address","AccountAddress","bitPositions","signer","signersAndBitPosition","index","a","b","value","publicKeys","signaturesRequired","MultiKey","account","message","AccountAuthenticatorMultiKey","transaction","promises","AbstractKeylessAccount","data","signatures","MultiKeySignature","signature","i","singleSignature"]}
@@ -1,2 +1,2 @@
1
- import{b as o}from"./chunk-XH7YKEYR.mjs";import{a as r}from"./chunk-EWZ2M5BW.mjs";var t=class{constructor(e){this.config=e}async getObjectDataByObjectAddress(e){return await r({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"objects_processor"}),o({aptosConfig:this.config,...e})}};export{t as a};
2
- //# sourceMappingURL=chunk-QLN2URFX.mjs.map
1
+ import{b as o}from"./chunk-EN2HDNFE.mjs";import{a as r}from"./chunk-TRU3EK64.mjs";var t=class{constructor(e){this.config=e}async getObjectDataByObjectAddress(e){return await r({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"objects_processor"}),o({aptosConfig:this.config,...e})}};export{t as a};
2
+ //# sourceMappingURL=chunk-ZUTOMGB7.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/object.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AnyNumber, GetObjectDataQueryResponse, OrderByArg, PaginationArgs } from \"../types\";\nimport { AccountAddressInput } from \"../core\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { ProcessorType } from \"../utils\";\nimport { waitForIndexerOnVersion } from \"./utils\";\nimport { getObjectDataByObjectAddress } from \"../internal/object\";\n\n/**\n * A class to query all `Object` related queries on Aptos.\n */\nexport class AptosObject {\n /**\n * Creates an instance of the Aptos client with the provided configuration.\n * This allows interaction with the Aptos blockchain using the specified settings.\n *\n * @param config - The configuration settings for the Aptos client.\n * @param config.network - The network to connect to (e.g., mainnet, testnet).\n * @param config.nodeUrl - The URL of the Aptos node to connect to.\n * @param config.faucetUrl - The URL of the faucet for funding accounts (optional).\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * async function runExample() {\n * // Create a configuration for the Aptos client\n * const config = new AptosConfig({\n * network: Network.TESTNET, // Specify the desired network\n * nodeUrl: \"https://testnet.aptos.dev\", // Replace with your node URL\n * });\n *\n * // Create an instance of the Aptos client\n * const aptos = new Aptos(config);\n *\n * console.log(\"Aptos client created successfully\", aptos);\n * }\n * runExample().catch(console.error);\n * ```\n */\n constructor(readonly config: AptosConfig) {}\n\n /**\n * Fetches the object data based on the specified object address.\n *\n * @param args.objectAddress - The object address to retrieve data for.\n * @param args.minimumLedgerVersion - Optional minimum ledger version to wait for.\n * @param args.options - Optional configuration options for pagination and ordering.\n *\n * @returns The object data corresponding to the provided address.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Fetching object data by object address\n * const objectData = await aptos.getObjectDataByObjectAddress({\n * objectAddress: \"0x1\", // replace with a real object address\n * });\n *\n * console.log(objectData);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async getObjectDataByObjectAddress(args: {\n objectAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & OrderByArg<GetObjectDataQueryResponse[0]>;\n }): Promise<GetObjectDataQueryResponse[0]> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.OBJECT_PROCESSOR,\n });\n return getObjectDataByObjectAddress({\n aptosConfig: this.config,\n ...args,\n });\n }\n}\n"],"mappings":"kFAaO,IAAMA,EAAN,KAAkB,CA6BvB,YAAqBC,EAAqB,CAArB,YAAAA,CAAsB,CA6B3C,MAAM,6BAA6BC,EAIQ,CACzC,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,EAAK,qBAC3B,iCACF,CAAC,EACME,EAA6B,CAClC,YAAa,KAAK,OAClB,GAAGF,CACL,CAAC,CACH,CACF","names":["AptosObject","config","args","waitForIndexerOnVersion","getObjectDataByObjectAddress"]}
@@ -1,2 +1,2 @@
1
- import{a as r}from"../chunk-HAT5S2XX.mjs";import{a as o}from"../chunk-B5NYEWNM.mjs";import"../chunk-UAL27G6B.mjs";import"../chunk-FVA2OPG4.mjs";export{o as LocalNode,r as Move};
1
+ import{a as o}from"../chunk-XOCRDV2V.mjs";import{a as r}from"../chunk-GPZRGLU2.mjs";import"../chunk-LEKBJ2EG.mjs";import"../chunk-KDMSOCZY.mjs";export{o as LocalNode,r as Move};
2
2
  //# sourceMappingURL=index.mjs.map