@aptos-labs/ts-sdk 1.27.1 → 1.28.0-zeta.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 (466) hide show
  1. package/dist/common/{accountAddress-LOYE4_sG.d.ts → accountAddress-0OnKb1b9.d.ts} +5 -3
  2. package/dist/common/chunk-HBPH2AD3.js +2 -0
  3. package/dist/common/chunk-HBPH2AD3.js.map +1 -0
  4. package/dist/common/cli/index.d.ts +1 -1
  5. package/dist/common/cli/index.js +1 -1
  6. package/dist/common/cli/index.js.map +1 -1
  7. package/dist/common/index.d.ts +252 -41
  8. package/dist/common/index.js +28 -28
  9. package/dist/common/index.js.map +1 -1
  10. package/dist/esm/{Ed25519Account-B1VMJOY2.d.mts → Ed25519Account-9zBaZEnp.d.mts} +1 -1
  11. package/dist/esm/account/Account.d.mts +2 -2
  12. package/dist/esm/account/Account.mjs +1 -1
  13. package/dist/esm/account/Ed25519Account.d.mts +2 -2
  14. package/dist/esm/account/Ed25519Account.mjs +1 -1
  15. package/dist/esm/account/EphemeralKeyPair.d.mts +1 -1
  16. package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
  17. package/dist/esm/account/FederatedKeylessAccount.d.mts +75 -0
  18. package/dist/esm/account/FederatedKeylessAccount.mjs +2 -0
  19. package/dist/esm/account/KeylessAccount.d.mts +13 -130
  20. package/dist/esm/account/KeylessAccount.mjs +1 -1
  21. package/dist/esm/account/KeylessAccountCommon.d.mts +207 -0
  22. package/dist/esm/account/KeylessAccountCommon.mjs +2 -0
  23. package/dist/esm/account/MultiKeyAccount.d.mts +4 -3
  24. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  25. package/dist/esm/account/SingleKeyAccount.d.mts +2 -2
  26. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  27. package/dist/esm/account/index.d.mts +6 -3
  28. package/dist/esm/account/index.mjs +1 -1
  29. package/dist/esm/api/account.d.mts +4 -3
  30. package/dist/esm/api/account.mjs +1 -1
  31. package/dist/esm/api/ans.d.mts +2 -2
  32. package/dist/esm/api/ans.mjs +1 -1
  33. package/dist/esm/api/aptos.d.mts +5 -2
  34. package/dist/esm/api/aptos.mjs +1 -1
  35. package/dist/esm/api/aptosConfig.mjs +1 -1
  36. package/dist/esm/api/coin.d.mts +1 -1
  37. package/dist/esm/api/coin.mjs +1 -1
  38. package/dist/esm/api/digitalAsset.d.mts +2 -2
  39. package/dist/esm/api/digitalAsset.mjs +1 -1
  40. package/dist/esm/api/event.mjs +1 -1
  41. package/dist/esm/api/faucet.mjs +1 -1
  42. package/dist/esm/api/fungibleAsset.d.mts +2 -2
  43. package/dist/esm/api/fungibleAsset.mjs +1 -1
  44. package/dist/esm/api/general.d.mts +1 -1
  45. package/dist/esm/api/general.mjs +1 -1
  46. package/dist/esm/api/index.d.mts +5 -2
  47. package/dist/esm/api/index.mjs +1 -1
  48. package/dist/esm/api/keyless.d.mts +35 -21
  49. package/dist/esm/api/keyless.mjs +1 -1
  50. package/dist/esm/api/object.mjs +1 -1
  51. package/dist/esm/api/staking.mjs +1 -1
  52. package/dist/esm/api/table.mjs +1 -1
  53. package/dist/esm/api/transaction.d.mts +2 -2
  54. package/dist/esm/api/transaction.mjs +1 -1
  55. package/dist/esm/api/transactionSubmission/build.d.mts +1 -1
  56. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  57. package/dist/esm/api/transactionSubmission/management.d.mts +2 -2
  58. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  59. package/dist/esm/api/transactionSubmission/sign.d.mts +2 -2
  60. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  61. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  62. package/dist/esm/api/transactionSubmission/simulate.d.mts +1 -1
  63. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  64. package/dist/esm/api/transactionSubmission/submit.d.mts +1 -1
  65. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  66. package/dist/esm/api/utils.mjs +1 -1
  67. package/dist/esm/bcs/index.d.mts +1 -1
  68. package/dist/esm/bcs/index.mjs +1 -1
  69. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  70. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  71. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  72. package/dist/esm/bcs/serializable/moveStructs.d.mts +10 -1
  73. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  74. package/dist/esm/bcs/serializer.mjs +1 -1
  75. package/dist/esm/chunk-23J256KA.mjs +2 -0
  76. package/dist/esm/chunk-23J256KA.mjs.map +1 -0
  77. package/dist/esm/{chunk-KEN2VRIM.mjs → chunk-2KLLSBBN.mjs} +2 -2
  78. package/dist/esm/{chunk-WFOYGJS5.mjs → chunk-2X3YDREK.mjs} +2 -2
  79. package/dist/esm/{chunk-PO33LVUF.mjs → chunk-35LCHJIH.mjs} +2 -2
  80. package/dist/esm/{chunk-G5MGSV7Y.mjs → chunk-3CE63FFN.mjs} +2 -2
  81. package/dist/esm/chunk-3TSO6PDV.mjs +2 -0
  82. package/dist/esm/{chunk-QE5OL6KN.mjs → chunk-3XXBKVEX.mjs} +2 -2
  83. package/dist/esm/{chunk-ZXYTLPP6.mjs → chunk-4I6IUAHQ.mjs} +2 -2
  84. package/dist/esm/chunk-4LHVEO7T.mjs +2 -0
  85. package/dist/esm/chunk-4LHVEO7T.mjs.map +1 -0
  86. package/dist/esm/{chunk-NCWD4NA3.mjs → chunk-4X4ODN6K.mjs} +2 -2
  87. package/dist/esm/{chunk-SUJLWCRN.mjs → chunk-5FPWLBZT.mjs} +2 -2
  88. package/dist/esm/chunk-5HI4R3A2.mjs +2 -0
  89. package/dist/esm/{chunk-AYX5JMB4.mjs → chunk-5HWJ3SN4.mjs} +2 -2
  90. package/dist/esm/{chunk-PY4TS34X.mjs → chunk-5MZJD6SA.mjs} +2 -2
  91. package/dist/esm/{chunk-3SPU4V2B.mjs → chunk-5RNKD3GW.mjs} +2 -2
  92. package/dist/esm/{chunk-SCHZ67F3.mjs → chunk-5VQK4F5X.mjs} +2 -2
  93. package/dist/esm/{chunk-SCHZ67F3.mjs.map → chunk-5VQK4F5X.mjs.map} +1 -1
  94. package/dist/esm/{chunk-F7NVDHR2.mjs → chunk-72S2NOM5.mjs} +2 -2
  95. package/dist/esm/chunk-72S2NOM5.mjs.map +1 -0
  96. package/dist/esm/{chunk-76HTG7Z7.mjs → chunk-7BPKOPP7.mjs} +2 -2
  97. package/dist/esm/chunk-7NQHLM3Y.mjs +2 -0
  98. package/dist/esm/chunk-7NQHLM3Y.mjs.map +1 -0
  99. package/dist/esm/{chunk-NRRADUK4.mjs → chunk-7T4PLPI7.mjs} +2 -2
  100. package/dist/esm/chunk-7T5CUI2H.mjs +2 -0
  101. package/dist/esm/{chunk-Q7MD4V7H.mjs.map → chunk-7T5CUI2H.mjs.map} +1 -1
  102. package/dist/esm/{chunk-UV7M72QD.mjs → chunk-AGFN3VVA.mjs} +2 -2
  103. package/dist/esm/{chunk-UO52TECC.mjs → chunk-AGTINH7K.mjs} +2 -2
  104. package/dist/esm/{chunk-BCUSI3N6.mjs → chunk-AOCNYMMX.mjs} +2 -2
  105. package/dist/esm/{chunk-GHKMF253.mjs → chunk-ASQ2YBOR.mjs} +2 -2
  106. package/dist/esm/chunk-ASQIKTEF.mjs +2 -0
  107. package/dist/esm/chunk-ASQIKTEF.mjs.map +1 -0
  108. package/dist/esm/{chunk-GNFEBKFV.mjs → chunk-AT2A7OZD.mjs} +2 -2
  109. package/dist/esm/{chunk-A4T373F3.mjs → chunk-AWQNX3RT.mjs} +2 -2
  110. package/dist/esm/{chunk-NWOMSL6K.mjs → chunk-AZ642ORV.mjs} +2 -2
  111. package/dist/esm/{chunk-52KPINA4.mjs → chunk-B5NYEWNM.mjs} +2 -2
  112. package/dist/esm/chunk-BC5BEOKM.mjs +2 -0
  113. package/dist/esm/{chunk-G7UNU5GI.mjs → chunk-BQPQLOIW.mjs} +2 -2
  114. package/dist/esm/chunk-CDIKSNSU.mjs +2 -0
  115. package/dist/esm/chunk-CUDIVR4U.mjs +2 -0
  116. package/dist/esm/chunk-CUDIVR4U.mjs.map +1 -0
  117. package/dist/esm/chunk-DAIOG6HU.mjs +2 -0
  118. package/dist/esm/chunk-DAIOG6HU.mjs.map +1 -0
  119. package/dist/esm/chunk-DFMC56WX.mjs +2 -0
  120. package/dist/esm/chunk-DFMC56WX.mjs.map +1 -0
  121. package/dist/esm/chunk-DYMN66K5.mjs +2 -0
  122. package/dist/esm/{chunk-4ZMI5G5L.mjs.map → chunk-DYMN66K5.mjs.map} +1 -1
  123. package/dist/esm/{chunk-3NRBTP3S.mjs → chunk-E2WOZVJX.mjs} +2 -2
  124. package/dist/esm/chunk-E7VSBBQM.mjs +2 -0
  125. package/dist/esm/{chunk-YPHH6CAO.mjs.map → chunk-E7VSBBQM.mjs.map} +1 -1
  126. package/dist/esm/{chunk-OHRL766V.mjs → chunk-EDVGFSB5.mjs} +2 -2
  127. package/dist/esm/{chunk-OHRL766V.mjs.map → chunk-EDVGFSB5.mjs.map} +1 -1
  128. package/dist/esm/chunk-EXP5STXZ.mjs +2 -0
  129. package/dist/esm/chunk-EXP5STXZ.mjs.map +1 -0
  130. package/dist/esm/chunk-FBPNHF54.mjs +2 -0
  131. package/dist/esm/{chunk-UWPO7WWS.mjs → chunk-FDD6WNN6.mjs} +2 -2
  132. package/dist/esm/{chunk-6ERHGCK2.mjs → chunk-FDTLBR6D.mjs} +2 -2
  133. package/dist/esm/{chunk-FOHGSNYZ.mjs → chunk-FLNLQ7K5.mjs} +2 -2
  134. package/dist/esm/chunk-FOLCONSQ.mjs +2 -0
  135. package/dist/esm/{chunk-5IUXBOS5.mjs → chunk-FTBXTZM2.mjs} +2 -2
  136. package/dist/esm/chunk-GAEAYY44.mjs +1 -0
  137. package/dist/esm/chunk-GAEAYY44.mjs.map +1 -0
  138. package/dist/esm/{chunk-ZXPBRVOA.mjs → chunk-GKRIMGKW.mjs} +2 -2
  139. package/dist/esm/{chunk-MEKXPGK7.mjs → chunk-GX2II7H4.mjs} +2 -2
  140. package/dist/esm/{chunk-I5XQKNOK.mjs → chunk-H3TJNBHX.mjs} +2 -2
  141. package/dist/esm/{chunk-MLL54PYO.mjs → chunk-HAT5S2XX.mjs} +2 -2
  142. package/dist/esm/{chunk-MLL54PYO.mjs.map → chunk-HAT5S2XX.mjs.map} +1 -1
  143. package/dist/esm/{chunk-ECKJI2TV.mjs → chunk-HOQCND6F.mjs} +2 -2
  144. package/dist/esm/chunk-IA4RELOH.mjs +1 -0
  145. package/dist/esm/chunk-IA4RELOH.mjs.map +1 -0
  146. package/dist/esm/chunk-IEH7ILF3.mjs +2 -0
  147. package/dist/esm/chunk-IEH7ILF3.mjs.map +1 -0
  148. package/dist/esm/{chunk-ORXEFE6X.mjs → chunk-ILI5TDXD.mjs} +2 -2
  149. package/dist/esm/{chunk-SONTIUAM.mjs → chunk-J45FMNYT.mjs} +2 -2
  150. package/dist/esm/{chunk-HHU7UCFI.mjs → chunk-K7ZPRL7C.mjs} +2 -2
  151. package/dist/esm/chunk-K7ZPRL7C.mjs.map +1 -0
  152. package/dist/esm/{chunk-7AIKM3UF.mjs → chunk-KRRHWHTG.mjs} +2 -2
  153. package/dist/esm/{chunk-USOIC4HO.mjs → chunk-LKN324IO.mjs} +2 -2
  154. package/dist/esm/chunk-MYF2VRVN.mjs +2 -0
  155. package/dist/esm/chunk-MYF2VRVN.mjs.map +1 -0
  156. package/dist/esm/chunk-N6EC72OZ.mjs +2 -0
  157. package/dist/esm/chunk-ND23H3AK.mjs +2 -0
  158. package/dist/esm/{chunk-JKNTGRSQ.mjs → chunk-NGIPNL7N.mjs} +2 -2
  159. package/dist/esm/{chunk-ZQFFRZJ4.mjs → chunk-NLV3PTOE.mjs} +2 -2
  160. package/dist/esm/{chunk-ZZRSKHWS.mjs → chunk-NOVJ2ROD.mjs} +2 -2
  161. package/dist/esm/{chunk-FNT3VLRD.mjs → chunk-NWTMTPPX.mjs} +2 -2
  162. package/dist/esm/chunk-OOVNFKA6.mjs +2 -0
  163. package/dist/esm/{chunk-CTJX4CUF.mjs → chunk-PDY3AFVI.mjs} +2 -2
  164. package/dist/esm/{chunk-T2NJUIOQ.mjs → chunk-QKVID52D.mjs} +2 -2
  165. package/dist/esm/{chunk-7Y3MRBG6.mjs → chunk-QOE5WJMC.mjs} +2 -2
  166. package/dist/esm/chunk-QP2A5ISX.mjs +2 -0
  167. package/dist/esm/{chunk-O4BBULNE.mjs → chunk-QTTDBQAJ.mjs} +2 -2
  168. package/dist/esm/{chunk-H33YIMTU.mjs → chunk-R2RMAWDH.mjs} +2 -2
  169. package/dist/esm/{chunk-5L3PLK3W.mjs → chunk-S3I4THN5.mjs} +2 -2
  170. package/dist/esm/{chunk-HRIYZBXY.mjs → chunk-S6TRBKP5.mjs} +2 -2
  171. package/dist/esm/{chunk-WRRQ7L5K.mjs → chunk-SHOPSMRK.mjs} +2 -2
  172. package/dist/esm/{chunk-YDZBU2DJ.mjs → chunk-SP4PT77Z.mjs} +2 -2
  173. package/dist/esm/chunk-SVO6PVAX.mjs +2 -0
  174. package/dist/esm/chunk-SVO6PVAX.mjs.map +1 -0
  175. package/dist/esm/chunk-TJDC5PWD.mjs +2 -0
  176. package/dist/esm/chunk-TKQEC2WD.mjs +2 -0
  177. package/dist/esm/chunk-TKQEC2WD.mjs.map +1 -0
  178. package/dist/esm/chunk-TVWAYKEP.mjs +2 -0
  179. package/dist/esm/chunk-UAL27G6B.mjs +2 -0
  180. package/dist/esm/chunk-UAL27G6B.mjs.map +1 -0
  181. package/dist/esm/chunk-UW5TIZFE.mjs +2 -0
  182. package/dist/esm/{chunk-2N2VEGT6.mjs → chunk-VNIBQXNX.mjs} +2 -2
  183. package/dist/esm/{chunk-NMD45OTM.mjs → chunk-VTEOS4PS.mjs} +2 -2
  184. package/dist/esm/{chunk-6BYVG7H4.mjs → chunk-VZKENIJR.mjs} +2 -2
  185. package/dist/esm/{chunk-OEOUZFHD.mjs → chunk-X26OHQZO.mjs} +2 -2
  186. package/dist/esm/{chunk-HKMG3LZX.mjs → chunk-YACGA3YS.mjs} +2 -2
  187. package/dist/esm/chunk-YELQZVBK.mjs +2 -0
  188. package/dist/esm/chunk-YELQZVBK.mjs.map +1 -0
  189. package/dist/esm/{chunk-2CC67KW5.mjs → chunk-YSVXROOO.mjs} +2 -2
  190. package/dist/esm/{chunk-74YFNJ7A.mjs → chunk-YTOQGCAM.mjs} +2 -2
  191. package/dist/esm/chunk-Z56T4OGM.mjs +2 -0
  192. package/dist/esm/chunk-Z56T4OGM.mjs.map +1 -0
  193. package/dist/esm/chunk-ZAHUEAGT.mjs +2 -0
  194. package/dist/esm/chunk-ZAHUEAGT.mjs.map +1 -0
  195. package/dist/esm/chunk-ZASN3QQQ.mjs +2 -0
  196. package/dist/esm/chunk-ZXVQ2OBJ.mjs +2 -0
  197. package/dist/esm/{chunk-ZEYOFDIO.mjs.map → chunk-ZXVQ2OBJ.mjs.map} +1 -1
  198. package/dist/esm/{chunk-A63SMUOU.mjs → chunk-ZZIMFLVT.mjs} +2 -2
  199. package/dist/esm/cli/index.mjs +1 -1
  200. package/dist/esm/cli/localNode.mjs +1 -1
  201. package/dist/esm/cli/move.mjs +1 -1
  202. package/dist/esm/client/core.mjs +1 -1
  203. package/dist/esm/client/get.mjs +1 -1
  204. package/dist/esm/client/index.mjs +1 -1
  205. package/dist/esm/client/post.mjs +1 -1
  206. package/dist/esm/client/types.mjs +1 -1
  207. package/dist/esm/core/account/index.mjs +1 -1
  208. package/dist/esm/core/account/utils/address.mjs +1 -1
  209. package/dist/esm/core/account/utils/index.mjs +1 -1
  210. package/dist/esm/core/accountAddress.mjs +1 -1
  211. package/dist/esm/core/authenticationKey.d.mts +1 -1
  212. package/dist/esm/core/authenticationKey.mjs +1 -1
  213. package/dist/esm/core/common.mjs +1 -1
  214. package/dist/esm/core/crypto/ed25519.d.mts +1 -1
  215. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  216. package/dist/esm/core/crypto/ephemeral.d.mts +1 -1
  217. package/dist/esm/core/crypto/ephemeral.mjs +1 -1
  218. package/dist/esm/core/crypto/federatedKeyless.d.mts +97 -0
  219. package/dist/esm/core/crypto/federatedKeyless.mjs +2 -0
  220. package/dist/esm/core/crypto/federatedKeyless.mjs.map +1 -0
  221. package/dist/esm/core/crypto/index.d.mts +4 -3
  222. package/dist/esm/core/crypto/index.mjs +1 -1
  223. package/dist/esm/core/crypto/keyless.d.mts +1 -1
  224. package/dist/esm/core/crypto/keyless.mjs +1 -1
  225. package/dist/esm/core/crypto/multiEd25519.d.mts +1 -1
  226. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  227. package/dist/esm/core/crypto/multiKey.d.mts +1 -1
  228. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  229. package/dist/esm/core/crypto/privateKey.d.mts +1 -1
  230. package/dist/esm/core/crypto/proof.mjs +1 -1
  231. package/dist/esm/core/crypto/publicKey.d.mts +1 -1
  232. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  233. package/dist/esm/core/crypto/secp256k1.d.mts +1 -1
  234. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  235. package/dist/esm/core/crypto/signature.mjs +1 -1
  236. package/dist/esm/core/crypto/singleKey.d.mts +1 -1
  237. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  238. package/dist/esm/core/crypto/utils.mjs +1 -1
  239. package/dist/esm/core/hex.mjs +1 -1
  240. package/dist/esm/core/index.d.mts +2 -1
  241. package/dist/esm/core/index.mjs +1 -1
  242. package/dist/esm/index.d.mts +9 -6
  243. package/dist/esm/index.mjs +1 -1
  244. package/dist/esm/internal/account.d.mts +2 -2
  245. package/dist/esm/internal/account.mjs +1 -1
  246. package/dist/esm/internal/ans.d.mts +2 -2
  247. package/dist/esm/internal/ans.mjs +1 -1
  248. package/dist/esm/internal/coin.d.mts +1 -1
  249. package/dist/esm/internal/coin.mjs +1 -1
  250. package/dist/esm/internal/digitalAsset.d.mts +2 -2
  251. package/dist/esm/internal/digitalAsset.mjs +1 -1
  252. package/dist/esm/internal/event.mjs +1 -1
  253. package/dist/esm/internal/faucet.mjs +1 -1
  254. package/dist/esm/internal/fungibleAsset.d.mts +2 -2
  255. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  256. package/dist/esm/internal/general.mjs +1 -1
  257. package/dist/esm/internal/keyless.d.mts +25 -14
  258. package/dist/esm/internal/keyless.mjs +1 -1
  259. package/dist/esm/internal/object.mjs +1 -1
  260. package/dist/esm/internal/staking.mjs +1 -1
  261. package/dist/esm/internal/table.mjs +1 -1
  262. package/dist/esm/internal/transaction.mjs +1 -1
  263. package/dist/esm/internal/transactionSubmission.d.mts +2 -2
  264. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  265. package/dist/esm/internal/view.d.mts +1 -1
  266. package/dist/esm/internal/view.mjs +1 -1
  267. package/dist/esm/transactions/authenticator/account.d.mts +1 -1
  268. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  269. package/dist/esm/transactions/authenticator/index.d.mts +1 -1
  270. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  271. package/dist/esm/transactions/authenticator/transaction.d.mts +1 -1
  272. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  273. package/dist/esm/transactions/index.d.mts +1 -1
  274. package/dist/esm/transactions/index.mjs +1 -1
  275. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  276. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  277. package/dist/esm/transactions/instances/index.d.mts +1 -1
  278. package/dist/esm/transactions/instances/index.mjs +1 -1
  279. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  280. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  281. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  282. package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +1 -1
  283. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  284. package/dist/esm/transactions/instances/signedTransaction.d.mts +1 -1
  285. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  286. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  287. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  288. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +2 -2
  289. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  290. package/dist/esm/transactions/management/index.d.mts +2 -2
  291. package/dist/esm/transactions/management/index.mjs +1 -1
  292. package/dist/esm/transactions/management/transactionWorker.d.mts +2 -2
  293. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  294. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +1 -1
  295. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  296. package/dist/esm/transactions/transactionBuilder/index.d.mts +1 -1
  297. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  298. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +1 -1
  299. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  300. package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +1 -1
  301. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  302. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +1 -1
  303. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  304. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  305. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  306. package/dist/esm/transactions/types.d.mts +3 -3
  307. package/dist/esm/types/index.d.mts +4 -2
  308. package/dist/esm/types/index.mjs +1 -1
  309. package/dist/esm/utils/apiEndpoints.mjs +1 -1
  310. package/dist/esm/utils/const.d.mts +2 -1
  311. package/dist/esm/utils/const.mjs +1 -1
  312. package/dist/esm/utils/helpers.d.mts +41 -1
  313. package/dist/esm/utils/helpers.mjs +1 -1
  314. package/dist/esm/utils/index.d.mts +2 -2
  315. package/dist/esm/utils/index.mjs +1 -1
  316. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  317. package/dist/esm/version.d.mts +1 -1
  318. package/dist/esm/version.mjs +1 -1
  319. package/package.json +1 -1
  320. package/src/account/FederatedKeylessAccount.ts +115 -0
  321. package/src/account/KeylessAccount.ts +6 -291
  322. package/src/account/KeylessAccountCommon.ts +329 -0
  323. package/src/account/MultiKeyAccount.ts +4 -4
  324. package/src/account/index.ts +2 -0
  325. package/src/api/account.ts +31 -4
  326. package/src/api/keyless.ts +50 -4
  327. package/src/bcs/serializable/moveStructs.ts +41 -8
  328. package/src/cli/move.ts +1 -1
  329. package/src/core/crypto/federatedKeyless.ts +134 -0
  330. package/src/core/crypto/index.ts +1 -0
  331. package/src/core/crypto/singleKey.ts +6 -0
  332. package/src/internal/account.ts +6 -5
  333. package/src/internal/event.ts +10 -3
  334. package/src/internal/keyless.ts +82 -8
  335. package/src/internal/transactionSubmission.ts +2 -2
  336. package/src/transactions/instances/transactionPayload.ts +3 -1
  337. package/src/transactions/transactionBuilder/transactionBuilder.ts +25 -14
  338. package/src/transactions/types.ts +4 -2
  339. package/src/types/index.ts +2 -0
  340. package/src/utils/apiEndpoints.ts +2 -2
  341. package/src/utils/const.ts +1 -0
  342. package/src/utils/helpers.ts +70 -0
  343. package/src/version.ts +1 -1
  344. package/dist/common/chunk-J4IUXT5W.js +0 -2
  345. package/dist/common/chunk-J4IUXT5W.js.map +0 -1
  346. package/dist/esm/chunk-4SDUQ7AS.mjs +0 -2
  347. package/dist/esm/chunk-4SDUQ7AS.mjs.map +0 -1
  348. package/dist/esm/chunk-4ZMI5G5L.mjs +0 -2
  349. package/dist/esm/chunk-76OH2Z4Q.mjs +0 -2
  350. package/dist/esm/chunk-7Z6DYLCA.mjs +0 -1
  351. package/dist/esm/chunk-AQ4I7VVB.mjs +0 -1
  352. package/dist/esm/chunk-BOYYQAB4.mjs +0 -2
  353. package/dist/esm/chunk-EZIF26UH.mjs +0 -2
  354. package/dist/esm/chunk-EZIF26UH.mjs.map +0 -1
  355. package/dist/esm/chunk-F7EMGK4M.mjs +0 -2
  356. package/dist/esm/chunk-F7NVDHR2.mjs.map +0 -1
  357. package/dist/esm/chunk-GXTEJ7NO.mjs +0 -2
  358. package/dist/esm/chunk-H6YNXJNF.mjs +0 -2
  359. package/dist/esm/chunk-HHU7UCFI.mjs.map +0 -1
  360. package/dist/esm/chunk-KMJ6TF6Y.mjs +0 -2
  361. package/dist/esm/chunk-KMJ6TF6Y.mjs.map +0 -1
  362. package/dist/esm/chunk-L36ZHC7J.mjs +0 -2
  363. package/dist/esm/chunk-L36ZHC7J.mjs.map +0 -1
  364. package/dist/esm/chunk-LDTF3ABK.mjs +0 -2
  365. package/dist/esm/chunk-LDTF3ABK.mjs.map +0 -1
  366. package/dist/esm/chunk-LG7RJQ57.mjs +0 -2
  367. package/dist/esm/chunk-MLDQ2TY2.mjs +0 -2
  368. package/dist/esm/chunk-MQGW234H.mjs +0 -2
  369. package/dist/esm/chunk-NU55IEL4.mjs +0 -2
  370. package/dist/esm/chunk-NU55IEL4.mjs.map +0 -1
  371. package/dist/esm/chunk-P5V7OZNN.mjs +0 -2
  372. package/dist/esm/chunk-Q67DUNMI.mjs +0 -2
  373. package/dist/esm/chunk-Q7MD4V7H.mjs +0 -2
  374. package/dist/esm/chunk-QV6EZL2G.mjs +0 -2
  375. package/dist/esm/chunk-RA3YPQG2.mjs +0 -2
  376. package/dist/esm/chunk-RA3YPQG2.mjs.map +0 -1
  377. package/dist/esm/chunk-TDGQGILY.mjs +0 -2
  378. package/dist/esm/chunk-THRXIXIO.mjs +0 -2
  379. package/dist/esm/chunk-THRXIXIO.mjs.map +0 -1
  380. package/dist/esm/chunk-WABFFJGI.mjs +0 -2
  381. package/dist/esm/chunk-WABFFJGI.mjs.map +0 -1
  382. package/dist/esm/chunk-WHW4Z7TK.mjs +0 -2
  383. package/dist/esm/chunk-WHW4Z7TK.mjs.map +0 -1
  384. package/dist/esm/chunk-Y3HLYCF3.mjs +0 -2
  385. package/dist/esm/chunk-YPHH6CAO.mjs +0 -2
  386. package/dist/esm/chunk-YUNDX5I7.mjs +0 -2
  387. package/dist/esm/chunk-YXITAP46.mjs +0 -2
  388. package/dist/esm/chunk-YXITAP46.mjs.map +0 -1
  389. package/dist/esm/chunk-YY2XW5R4.mjs +0 -2
  390. package/dist/esm/chunk-YY2XW5R4.mjs.map +0 -1
  391. package/dist/esm/chunk-ZEYOFDIO.mjs +0 -2
  392. package/dist/esm/chunk-ZOMXBB6Z.mjs +0 -2
  393. package/dist/esm/chunk-ZOMXBB6Z.mjs.map +0 -1
  394. /package/dist/esm/{chunk-7Z6DYLCA.mjs.map → account/FederatedKeylessAccount.mjs.map} +0 -0
  395. /package/dist/esm/{chunk-AQ4I7VVB.mjs.map → account/KeylessAccountCommon.mjs.map} +0 -0
  396. /package/dist/esm/{chunk-KEN2VRIM.mjs.map → chunk-2KLLSBBN.mjs.map} +0 -0
  397. /package/dist/esm/{chunk-WFOYGJS5.mjs.map → chunk-2X3YDREK.mjs.map} +0 -0
  398. /package/dist/esm/{chunk-PO33LVUF.mjs.map → chunk-35LCHJIH.mjs.map} +0 -0
  399. /package/dist/esm/{chunk-G5MGSV7Y.mjs.map → chunk-3CE63FFN.mjs.map} +0 -0
  400. /package/dist/esm/{chunk-TDGQGILY.mjs.map → chunk-3TSO6PDV.mjs.map} +0 -0
  401. /package/dist/esm/{chunk-QE5OL6KN.mjs.map → chunk-3XXBKVEX.mjs.map} +0 -0
  402. /package/dist/esm/{chunk-ZXYTLPP6.mjs.map → chunk-4I6IUAHQ.mjs.map} +0 -0
  403. /package/dist/esm/{chunk-NCWD4NA3.mjs.map → chunk-4X4ODN6K.mjs.map} +0 -0
  404. /package/dist/esm/{chunk-SUJLWCRN.mjs.map → chunk-5FPWLBZT.mjs.map} +0 -0
  405. /package/dist/esm/{chunk-YUNDX5I7.mjs.map → chunk-5HI4R3A2.mjs.map} +0 -0
  406. /package/dist/esm/{chunk-AYX5JMB4.mjs.map → chunk-5HWJ3SN4.mjs.map} +0 -0
  407. /package/dist/esm/{chunk-PY4TS34X.mjs.map → chunk-5MZJD6SA.mjs.map} +0 -0
  408. /package/dist/esm/{chunk-3SPU4V2B.mjs.map → chunk-5RNKD3GW.mjs.map} +0 -0
  409. /package/dist/esm/{chunk-76HTG7Z7.mjs.map → chunk-7BPKOPP7.mjs.map} +0 -0
  410. /package/dist/esm/{chunk-NRRADUK4.mjs.map → chunk-7T4PLPI7.mjs.map} +0 -0
  411. /package/dist/esm/{chunk-UV7M72QD.mjs.map → chunk-AGFN3VVA.mjs.map} +0 -0
  412. /package/dist/esm/{chunk-UO52TECC.mjs.map → chunk-AGTINH7K.mjs.map} +0 -0
  413. /package/dist/esm/{chunk-BCUSI3N6.mjs.map → chunk-AOCNYMMX.mjs.map} +0 -0
  414. /package/dist/esm/{chunk-GHKMF253.mjs.map → chunk-ASQ2YBOR.mjs.map} +0 -0
  415. /package/dist/esm/{chunk-GNFEBKFV.mjs.map → chunk-AT2A7OZD.mjs.map} +0 -0
  416. /package/dist/esm/{chunk-A4T373F3.mjs.map → chunk-AWQNX3RT.mjs.map} +0 -0
  417. /package/dist/esm/{chunk-NWOMSL6K.mjs.map → chunk-AZ642ORV.mjs.map} +0 -0
  418. /package/dist/esm/{chunk-52KPINA4.mjs.map → chunk-B5NYEWNM.mjs.map} +0 -0
  419. /package/dist/esm/{chunk-Q67DUNMI.mjs.map → chunk-BC5BEOKM.mjs.map} +0 -0
  420. /package/dist/esm/{chunk-G7UNU5GI.mjs.map → chunk-BQPQLOIW.mjs.map} +0 -0
  421. /package/dist/esm/{chunk-P5V7OZNN.mjs.map → chunk-CDIKSNSU.mjs.map} +0 -0
  422. /package/dist/esm/{chunk-3NRBTP3S.mjs.map → chunk-E2WOZVJX.mjs.map} +0 -0
  423. /package/dist/esm/{chunk-LG7RJQ57.mjs.map → chunk-FBPNHF54.mjs.map} +0 -0
  424. /package/dist/esm/{chunk-UWPO7WWS.mjs.map → chunk-FDD6WNN6.mjs.map} +0 -0
  425. /package/dist/esm/{chunk-6ERHGCK2.mjs.map → chunk-FDTLBR6D.mjs.map} +0 -0
  426. /package/dist/esm/{chunk-FOHGSNYZ.mjs.map → chunk-FLNLQ7K5.mjs.map} +0 -0
  427. /package/dist/esm/{chunk-76OH2Z4Q.mjs.map → chunk-FOLCONSQ.mjs.map} +0 -0
  428. /package/dist/esm/{chunk-5IUXBOS5.mjs.map → chunk-FTBXTZM2.mjs.map} +0 -0
  429. /package/dist/esm/{chunk-ZXPBRVOA.mjs.map → chunk-GKRIMGKW.mjs.map} +0 -0
  430. /package/dist/esm/{chunk-MEKXPGK7.mjs.map → chunk-GX2II7H4.mjs.map} +0 -0
  431. /package/dist/esm/{chunk-I5XQKNOK.mjs.map → chunk-H3TJNBHX.mjs.map} +0 -0
  432. /package/dist/esm/{chunk-ECKJI2TV.mjs.map → chunk-HOQCND6F.mjs.map} +0 -0
  433. /package/dist/esm/{chunk-ORXEFE6X.mjs.map → chunk-ILI5TDXD.mjs.map} +0 -0
  434. /package/dist/esm/{chunk-SONTIUAM.mjs.map → chunk-J45FMNYT.mjs.map} +0 -0
  435. /package/dist/esm/{chunk-7AIKM3UF.mjs.map → chunk-KRRHWHTG.mjs.map} +0 -0
  436. /package/dist/esm/{chunk-USOIC4HO.mjs.map → chunk-LKN324IO.mjs.map} +0 -0
  437. /package/dist/esm/{chunk-MQGW234H.mjs.map → chunk-N6EC72OZ.mjs.map} +0 -0
  438. /package/dist/esm/{chunk-GXTEJ7NO.mjs.map → chunk-ND23H3AK.mjs.map} +0 -0
  439. /package/dist/esm/{chunk-JKNTGRSQ.mjs.map → chunk-NGIPNL7N.mjs.map} +0 -0
  440. /package/dist/esm/{chunk-ZQFFRZJ4.mjs.map → chunk-NLV3PTOE.mjs.map} +0 -0
  441. /package/dist/esm/{chunk-ZZRSKHWS.mjs.map → chunk-NOVJ2ROD.mjs.map} +0 -0
  442. /package/dist/esm/{chunk-FNT3VLRD.mjs.map → chunk-NWTMTPPX.mjs.map} +0 -0
  443. /package/dist/esm/{chunk-QV6EZL2G.mjs.map → chunk-OOVNFKA6.mjs.map} +0 -0
  444. /package/dist/esm/{chunk-CTJX4CUF.mjs.map → chunk-PDY3AFVI.mjs.map} +0 -0
  445. /package/dist/esm/{chunk-T2NJUIOQ.mjs.map → chunk-QKVID52D.mjs.map} +0 -0
  446. /package/dist/esm/{chunk-7Y3MRBG6.mjs.map → chunk-QOE5WJMC.mjs.map} +0 -0
  447. /package/dist/esm/{chunk-MLDQ2TY2.mjs.map → chunk-QP2A5ISX.mjs.map} +0 -0
  448. /package/dist/esm/{chunk-O4BBULNE.mjs.map → chunk-QTTDBQAJ.mjs.map} +0 -0
  449. /package/dist/esm/{chunk-H33YIMTU.mjs.map → chunk-R2RMAWDH.mjs.map} +0 -0
  450. /package/dist/esm/{chunk-5L3PLK3W.mjs.map → chunk-S3I4THN5.mjs.map} +0 -0
  451. /package/dist/esm/{chunk-HRIYZBXY.mjs.map → chunk-S6TRBKP5.mjs.map} +0 -0
  452. /package/dist/esm/{chunk-WRRQ7L5K.mjs.map → chunk-SHOPSMRK.mjs.map} +0 -0
  453. /package/dist/esm/{chunk-YDZBU2DJ.mjs.map → chunk-SP4PT77Z.mjs.map} +0 -0
  454. /package/dist/esm/{chunk-F7EMGK4M.mjs.map → chunk-TJDC5PWD.mjs.map} +0 -0
  455. /package/dist/esm/{chunk-H6YNXJNF.mjs.map → chunk-TVWAYKEP.mjs.map} +0 -0
  456. /package/dist/esm/{chunk-BOYYQAB4.mjs.map → chunk-UW5TIZFE.mjs.map} +0 -0
  457. /package/dist/esm/{chunk-2N2VEGT6.mjs.map → chunk-VNIBQXNX.mjs.map} +0 -0
  458. /package/dist/esm/{chunk-NMD45OTM.mjs.map → chunk-VTEOS4PS.mjs.map} +0 -0
  459. /package/dist/esm/{chunk-6BYVG7H4.mjs.map → chunk-VZKENIJR.mjs.map} +0 -0
  460. /package/dist/esm/{chunk-OEOUZFHD.mjs.map → chunk-X26OHQZO.mjs.map} +0 -0
  461. /package/dist/esm/{chunk-HKMG3LZX.mjs.map → chunk-YACGA3YS.mjs.map} +0 -0
  462. /package/dist/esm/{chunk-2CC67KW5.mjs.map → chunk-YSVXROOO.mjs.map} +0 -0
  463. /package/dist/esm/{chunk-74YFNJ7A.mjs.map → chunk-YTOQGCAM.mjs.map} +0 -0
  464. /package/dist/esm/{chunk-Y3HLYCF3.mjs.map → chunk-ZASN3QQQ.mjs.map} +0 -0
  465. /package/dist/esm/{chunk-A63SMUOU.mjs.map → chunk-ZZIMFLVT.mjs.map} +0 -0
  466. /package/dist/esm/{publicKey-B3XRNhHO.d.mts → publicKey-lq5djCIY.d.mts} +0 -0
@@ -9,7 +9,14 @@
9
9
  import { sha3_256 as sha3Hash } from "@noble/hashes/sha3";
10
10
  import { AptosConfig } from "../../api/aptosConfig";
11
11
  import { AccountAddress, AccountAddressInput, Hex, PublicKey } from "../../core";
12
- import { AnyPublicKey, AnySignature, KeylessPublicKey, KeylessSignature, Secp256k1PublicKey } from "../../core/crypto";
12
+ import {
13
+ AnyPublicKey,
14
+ AnySignature,
15
+ KeylessPublicKey,
16
+ KeylessSignature,
17
+ Secp256k1PublicKey,
18
+ FederatedKeylessPublicKey,
19
+ } from "../../core/crypto";
13
20
  import { Ed25519PublicKey, Ed25519Signature } from "../../core/crypto/ed25519";
14
21
  import { getInfo } from "../../internal/account";
15
22
  import { getLedgerInfo } from "../../internal/general";
@@ -445,25 +452,29 @@ export function generateSignedTransactionForSimulation(args: InputSimulateTransa
445
452
  }
446
453
 
447
454
  export function getAuthenticatorForSimulation(publicKey: PublicKey) {
455
+ // Wrap the public key types below with AnyPublicKey as they are only support through single sender.
456
+ // Learn more about AnyPublicKey here - https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-55.md
457
+ const convertToAnyPublicKey =
458
+ KeylessPublicKey.isInstance(publicKey) ||
459
+ FederatedKeylessPublicKey.isInstance(publicKey) ||
460
+ Secp256k1PublicKey.isInstance(publicKey);
461
+ const accountPublicKey = convertToAnyPublicKey ? new AnyPublicKey(publicKey) : publicKey;
462
+
448
463
  // No need to for the signature to be matching in scheme. All that matters for simulations is that it's not valid
449
464
  const invalidSignature = new Ed25519Signature(new Uint8Array(64));
450
465
 
451
- if (Ed25519PublicKey.isInstance(publicKey)) {
452
- return new AccountAuthenticatorEd25519(publicKey, invalidSignature);
466
+ if (Ed25519PublicKey.isInstance(accountPublicKey)) {
467
+ return new AccountAuthenticatorEd25519(accountPublicKey, invalidSignature);
453
468
  }
454
469
 
455
- if (AnyPublicKey.isInstance(publicKey)) {
456
- if (KeylessPublicKey.isInstance(publicKey.publicKey)) {
457
- return new AccountAuthenticatorSingleKey(publicKey, new AnySignature(KeylessSignature.getSimulationSignature()));
470
+ if (AnyPublicKey.isInstance(accountPublicKey)) {
471
+ if (KeylessPublicKey.isInstance(accountPublicKey.publicKey)) {
472
+ return new AccountAuthenticatorSingleKey(
473
+ accountPublicKey,
474
+ new AnySignature(KeylessSignature.getSimulationSignature()),
475
+ );
458
476
  }
459
- return new AccountAuthenticatorSingleKey(publicKey, new AnySignature(invalidSignature));
460
- }
461
-
462
- // TODO: remove this, non-account public keys should never make it here
463
- if (KeylessPublicKey.isInstance(publicKey) || Secp256k1PublicKey.isInstance(publicKey)) {
464
- // eslint-disable-next-line no-console
465
- console.warn("Expected AccountPublicKey, but got PublicKey. Please wrap your public key with AnyPublicKey.");
466
- return new AccountAuthenticatorSingleKey(new AnyPublicKey(publicKey), new AnySignature(invalidSignature));
477
+ return new AccountAuthenticatorSingleKey(accountPublicKey, new AnySignature(invalidSignature));
467
478
  }
468
479
 
469
480
  // TODO add support for AnyMultiKey
@@ -20,6 +20,7 @@ import { TypeTag } from "./typeTag";
20
20
  import { AccountAuthenticator } from "./authenticator/account";
21
21
  import { SimpleTransaction } from "./instances/simpleTransaction";
22
22
  import { MultiAgentTransaction } from "./instances/multiAgentTransaction";
23
+ import { Serialized } from "../bcs";
23
24
 
24
25
  /**
25
26
  * Entry function arguments to be used when building a raw transaction using remote ABI
@@ -64,9 +65,10 @@ export type ScriptFunctionArgumentTypes =
64
65
  | U128
65
66
  | U256
66
67
  | AccountAddress
67
- | MoveVector<U8>
68
+ | MoveVector<ScriptFunctionArgumentTypes>
68
69
  | MoveString
69
- | FixedBytes;
70
+ | FixedBytes
71
+ | Serialized;
70
72
 
71
73
  /**
72
74
  * TypeArgument inputs for Entry functions, view functions, and scripts
@@ -61,6 +61,7 @@ export enum ScriptTransactionArgumentVariants {
61
61
  U16 = 6,
62
62
  U32 = 7,
63
63
  U256 = 8,
64
+ Serialized = 9,
64
65
  }
65
66
 
66
67
  /**
@@ -109,6 +110,7 @@ export enum AnyPublicKeyVariant {
109
110
  Ed25519 = 0,
110
111
  Secp256k1 = 1,
111
112
  Keyless = 3,
113
+ FederatedKeyless = 4,
112
114
  }
113
115
 
114
116
  export enum AnySignatureVariant {
@@ -32,8 +32,8 @@ export const NetworkToPepperAPI: Record<string, string> = {
32
32
 
33
33
  export const NetworkToProverAPI: Record<string, string> = {
34
34
  mainnet: "https://api.mainnet.aptoslabs.com/keyless/prover/v0",
35
- testnet: "https://api.testnet.aptoslabs.com/keyless/prover/v0",
36
- devnet: "https://api.devnet.aptoslabs.com/keyless/prover/v0",
35
+ testnet: "https://prover.keyless.testnet.aptoslabs.com/v0",
36
+ devnet: "https://prover.keyless.devnet.aptoslabs.com/v0",
37
37
  // Use the devnet service for local environment
38
38
  local: "https://api.devnet.aptoslabs.com/keyless/prover/v0",
39
39
  };
@@ -44,6 +44,7 @@ export const DEFAULT_TXN_TIMEOUT_SEC = 20;
44
44
  * The default gas currency for the network.
45
45
  */
46
46
  export const APTOS_COIN = "0x1::aptos_coin::AptosCoin";
47
+ export const APTOS_FA = "0x000000000000000000000000000000000000000000000000000000000000000a";
47
48
 
48
49
  export const RAW_TRANSACTION_SALT = "APTOS::RawTransaction";
49
50
  export const RAW_TRANSACTION_WITH_DATA_SALT = "APTOS::RawTransactionWithData";
@@ -2,6 +2,7 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  import { decode } from "js-base64";
5
+ import { MoveStructId } from "../types";
5
6
 
6
7
  /**
7
8
  * Sleep the current thread for the given amount of time
@@ -58,3 +59,72 @@ export const convertAmountFromHumanReadableToOnChain = (value: number, decimal:
58
59
  * @returns The value is smallest units
59
60
  */
60
61
  export const convertAmountFromOnChainToHumanReadable = (value: number, decimal: number) => value / 10 ** decimal;
62
+
63
+ /**
64
+ * Convert a hex string to an ascii string with the `0x` prefix.
65
+ *
66
+ * `0x6170746f735f636f696e` --> `aptos_coin`
67
+ *
68
+ * @param hex The hex string to convert (e.g. `0x6170746f735f636f696e`)
69
+ * @returns The ascii string
70
+ */
71
+ const hexToAscii = (hex: string) => {
72
+ let str = "";
73
+ for (let n = 2; n < hex.length; n += 2) {
74
+ str += String.fromCharCode(parseInt(hex.substring(n, n + 2), 16));
75
+ }
76
+ return str;
77
+ };
78
+
79
+ /**
80
+ * Convert an encoded struct to a MoveStructId.
81
+ *
82
+ * @example
83
+ * const structObj = {
84
+ * account_address: "0x1",
85
+ * module_name: "0x6170746f735f636f696e",
86
+ * struct_name: "0x4170746f73436f696e",
87
+ * };
88
+ * // structId is "0x1::aptos_coin::AptosCoin"
89
+ * const structId = parseEncodedStruct(structObj);
90
+ *
91
+ * @param structObj The struct with account_address, module_name, and struct_name properties
92
+ * @returns The MoveStructId
93
+ */
94
+ export const parseEncodedStruct = (structObj: {
95
+ account_address: string;
96
+ module_name: string;
97
+ struct_name: string;
98
+ }): MoveStructId => {
99
+ // eslint-disable-next-line @typescript-eslint/naming-convention
100
+ const { account_address, module_name, struct_name } = structObj;
101
+ const moduleName = hexToAscii(module_name);
102
+ const structName = hexToAscii(struct_name);
103
+ return `${account_address}::${moduleName}::${structName}`;
104
+ };
105
+
106
+ /**
107
+ * Determines whether the given object is an encoded struct type with the following properties:
108
+ * - account_address: string
109
+ * - module_name: string
110
+ * - struct_name: string
111
+ *
112
+ * @param structObj The object to check
113
+ * @returns Whether the object is an encoded struct type
114
+ */
115
+ export const isEncodedStruct = (
116
+ structObj: any,
117
+ ): structObj is {
118
+ account_address: string;
119
+ module_name: string;
120
+ struct_name: string;
121
+ } =>
122
+ typeof structObj === "object" &&
123
+ !Array.isArray(structObj) &&
124
+ structObj !== null &&
125
+ "account_address" in structObj &&
126
+ "module_name" in structObj &&
127
+ "struct_name" in structObj &&
128
+ typeof structObj.account_address === "string" &&
129
+ typeof structObj.module_name === "string" &&
130
+ typeof structObj.struct_name === "string";
package/src/version.ts CHANGED
@@ -6,4 +6,4 @@
6
6
  *
7
7
  * hardcoded for now, we would want to have it injected dynamically
8
8
  */
9
- export const VERSION = "1.27.1";
9
+ export const VERSION = "1.28.0";
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var u=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var d=(n,e,t,r)=>{for(var o=r>1?void 0:r?a(e,t):e,s=n.length-1,c;s>=0;s--)(c=n[s])&&(o=(r?c(e,t,o):c(o))||o);return r&&o&&u(e,t,o),o};var _jsbase64 = require('js-base64');async function b(n){return new Promise(e=>{setTimeout(e,n)})}var p=()=>Math.floor(Date.now()/1e3);function g(n){let e=new Date(n*1e3);return e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),Math.floor(e.getTime()/1e3)}function f(n){let e=n.replace(/-/g,"+").replace(/_/g,"/"),t=e+"==".substring(0,(3-e.length%3)%3);return _jsbase64.decode.call(void 0, t)}var h=(n,e)=>n*10**e,x= exports.g =(n,e)=>n/10**e;exports.a = d; exports.b = b; exports.c = p; exports.d = g; exports.e = f; exports.f = h; exports.g = x;
2
- //# sourceMappingURL=chunk-J4IUXT5W.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/helpers.ts"],"names":["decode","sleep","timeMs","resolve","nowInSeconds","floorToWholeHour","timestampInSeconds","date","base64UrlDecode","base64Url","base64","paddedBase64","convertAmountFromHumanReadableToOnChain","value","decimal","convertAmountFromOnChainToHumanReadable"],"mappings":"wMAGA,OAAS,UAAAA,MAAc,YAMvB,eAAsBC,EAAMC,EAA+B,CACzD,OAAO,IAAI,QAASC,GAAY,CAC9B,WAAWA,EAASD,CAAM,CAC5B,CAAC,CACH,CAEO,IAAME,EAAe,IAAM,KAAK,MAAM,KAAK,IAAI,EAAI,GAAI,EAEvD,SAASC,EAAiBC,EAAoC,CACnE,IAAMC,EAAO,IAAI,KAAKD,EAAqB,GAAI,EAE/C,OAAAC,EAAK,WAAW,CAAC,EACjBA,EAAK,WAAW,CAAC,EACjBA,EAAK,gBAAgB,CAAC,EACf,KAAK,MAAMA,EAAK,QAAQ,EAAI,GAAI,CACzC,CAEO,SAASC,EAAgBC,EAA2B,CAEzD,IAAMC,EAASD,EAAU,QAAQ,KAAM,GAAG,EAAE,QAAQ,KAAM,GAAG,EAEvDE,EAAeD,EAAS,KAAK,UAAU,GAAI,EAAKA,EAAO,OAAS,GAAM,CAAC,EAE7E,OADsBV,EAAOW,CAAY,CAE3C,CAaO,IAAMC,EAA0C,CAACC,EAAeC,IAAoBD,EAAQ,IAAMC,EAa5FC,EAA0C,CAACF,EAAeC,IAAoBD,EAAQ,IAAMC","sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { decode } from \"js-base64\";\n\n/**\n * Sleep the current thread for the given amount of time\n * @param timeMs time in milliseconds to sleep\n */\nexport async function sleep(timeMs: number): Promise<null> {\n return new Promise((resolve) => {\n setTimeout(resolve, timeMs);\n });\n}\n\nexport const nowInSeconds = () => Math.floor(Date.now() / 1000);\n\nexport function floorToWholeHour(timestampInSeconds: number): number {\n const date = new Date(timestampInSeconds * 1000);\n // Reset minutes and seconds to zero\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n return Math.floor(date.getTime() / 1000);\n}\n\nexport function base64UrlDecode(base64Url: string): string {\n // Replace base64url-specific characters\n const base64 = base64Url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n // Pad the string with '=' characters if needed\n const paddedBase64 = base64 + \"==\".substring(0, (3 - (base64.length % 3)) % 3);\n const decodedString = decode(paddedBase64);\n return decodedString;\n}\n\n/**\n * Amount is represented in the smallest unit format on chain, this function converts\n * a human readable amount format to the smallest unit format\n * @example\n * human readable amount format: 500\n * on chain amount format when decimal is 8: 50000000000\n *\n * @param value The value in human readable format\n * @param decimal The token decimal\n * @returns The value is smallest units\n */\nexport const convertAmountFromHumanReadableToOnChain = (value: number, decimal: number) => value * 10 ** decimal;\n\n/**\n * Amount is represented in the smallest unit format on chain, this function converts\n * the smallest unit format to a human readable amount format\n * @example\n * human readable amount format: 500\n * on chain amount format when decimal is 8: 50000000000\n *\n * @param value The value in human readable format\n * @param decimal The token decimal\n * @returns The value is smallest units\n */\nexport const convertAmountFromOnChainToHumanReadable = (value: number, decimal: number) => value / 10 ** decimal;\n"]}
@@ -1,2 +0,0 @@
1
- import{a as n}from"./chunk-PY4TS34X.mjs";import{a as s,b as t,c as r,d as i,e as c,f as u,g as d,h as A,i as g,j as m,k as a,l as p,m as f,n as y,o as C,p as T,q as O}from"./chunk-HHU7UCFI.mjs";import{e as o}from"./chunk-L36ZHC7J.mjs";var l=class{constructor(e){this.config=e}async getAccountInfo(e){return s({aptosConfig:this.config,...e})}async getAccountModules(e){return t({aptosConfig:this.config,...e})}async getAccountModule(e){return r({aptosConfig:this.config,...e})}async getAccountTransactions(e){return i({aptosConfig:this.config,...e})}async getAccountResources(e){return c({aptosConfig:this.config,...e})}async getAccountResource(e){return u({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return d({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),A({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),g({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),m({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),a({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),p({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),y({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),C({aptosConfig:this.config,...e})}async getAccountAPTAmount(e){return this.getAccountCoinAmount({coinType:o,...e})}async getAccountCoinAmount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),f({aptosConfig:this.config,...e})}async getAccountOwnedObjects(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),T({aptosConfig:this.config,...e})}async deriveAccountFromPrivateKey(e){return O({aptosConfig:this.config,...e})}};export{l as a};
2
- //# sourceMappingURL=chunk-4SDUQ7AS.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/api/account.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Account as AccountModule } from \"../account\";\nimport { AccountAddress, PrivateKey, AccountAddressInput } from \"../core\";\nimport {\n AccountData,\n AnyNumber,\n GetAccountCoinsDataResponse,\n GetAccountCollectionsWithOwnedTokenResponse,\n GetAccountOwnedTokensFromCollectionResponse,\n GetAccountOwnedTokensQueryResponse,\n GetObjectDataQueryResponse,\n LedgerVersionArg,\n MoveModuleBytecode,\n MoveResource,\n MoveStructId,\n OrderByArg,\n PaginationArgs,\n TokenStandardArg,\n TransactionResponse,\n WhereArg,\n} from \"../types\";\nimport {\n deriveAccountFromPrivateKey,\n getAccountCoinAmount,\n getAccountCoinsCount,\n getAccountCoinsData,\n getAccountCollectionsWithOwnedTokens,\n getAccountOwnedObjects,\n getAccountOwnedTokens,\n getAccountOwnedTokensFromCollectionAddress,\n getAccountTokensCount,\n getAccountTransactionsCount,\n getInfo,\n getModule,\n getModules,\n getResource,\n getResources,\n getTransactions,\n lookupOriginalAccountAddress,\n} from \"../internal/account\";\nimport { APTOS_COIN, ProcessorType } from \"../utils/const\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { waitForIndexerOnVersion } from \"./utils\";\nimport { CurrentFungibleAssetBalancesBoolExp } from \"../types/generated/types\";\n\n/**\n * A class to query all `Account` related queries on Aptos.\n */\nexport class Account {\n constructor(readonly config: AptosConfig) {}\n\n /**\n * Queries the current state for an Aptos account given its account address\n *\n * @param args.accountAddress Aptos account address\n *\n * @returns The account data\n *\n * @example An example of the returned account\n * ```\n * {\n * sequence_number: \"1\",\n * authentication_key: \"0x5307b5f4bc67829097a8ba9b43dba3b88261eeccd1f709d9bde240fc100fbb69\"\n * }\n * ```\n */\n async getAccountInfo(args: { accountAddress: AccountAddressInput }): Promise<AccountData> {\n return getInfo({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for all modules in an account given an account address\n *\n * Note: In order to get all account modules, this function may call the API\n * multiple times as it auto paginates.\n *\n * @param args.accountAddress Aptos account address\n * @param args.options.offset The number module to start returning results from\n * @param args.options.limit The number of results to return\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n *\n * @returns Account modules\n */\n\n async getAccountModules(args: {\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & LedgerVersionArg;\n }): Promise<MoveModuleBytecode[]> {\n return getModules({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for a specific account module given account address and module name\n *\n * @param args.accountAddress Aptos account address\n * @param args.moduleName The name of the module\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n *\n * @returns Account module\n *\n * @example\n * const module = await aptos.getAccountModule({accountAddress:\"0x456\"})\n * // An example of an account module response\n * ```\n * {\n * bytecode: \"0xa11ceb0b0600000006010002030206050807070f0d081c200\",\n * abi: { address: \"0x1\" }\n * }\n * ```\n */\n async getAccountModule(args: {\n accountAddress: AccountAddressInput;\n moduleName: string;\n options?: LedgerVersionArg;\n }): Promise<MoveModuleBytecode> {\n return getModule({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries account transactions given an account address\n *\n * Note: In order to get all account transactions, this function may call the API\n * multiple times as it auto paginates.\n *\n * @example\n * const transactions = await aptos.getAccountTransactions({accountAddress:\"0x456\"})\n *\n * @param args.accountAddress Aptos account address\n * @param args.options.offset The number transaction to start returning results from\n * @param args.options.limit The number of results to return\n *\n * @returns The account transactions\n */\n async getAccountTransactions(args: {\n accountAddress: AccountAddressInput;\n options?: PaginationArgs;\n }): Promise<TransactionResponse[]> {\n return getTransactions({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries all account resources given an account address\n *\n * Note: In order to get all account resources, this function may call the API\n * multiple times as it auto paginates.\n *\n * @example\n * const resources = await aptos.getAccountResources({accountAddress:\"0x456\"})\n *\n * @param args.accountAddress Aptos account address\n * @param args.options.offset The number resource to start returning results from\n * @param args.options.limit The number of results to return\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n * @returns Account resources\n */\n async getAccountResources(args: {\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & LedgerVersionArg;\n }): Promise<MoveResource[]> {\n return getResources({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries a specific account resource given account address and resource type. Note that the default is `any` in order\n * to allow for ease of accessing properties of the object.\n *\n * @type The typed output of the resource\n * @param args.accountAddress Aptos account address\n * @param args.resourceType String representation of an on-chain Move struct type, i.e \"0x1::aptos_coin::AptosCoin\"\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n *\n * @returns Account resource\n *\n * @example\n * const resource = await aptos.getAccountResource({accountAddress:\"0x456\"})\n *\n */\n async getAccountResource<T extends {} = any>(args: {\n accountAddress: AccountAddressInput;\n resourceType: MoveStructId;\n options?: LedgerVersionArg;\n }): Promise<T> {\n return getResource<T>({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Looks up the account address for a given authentication key\n *\n * This handles both if the account's authentication key has been rotated or not.\n *\n * @example\n * const accountAddress = await aptos.lookupOriginalAccountAddress({authenticationKey:account.accountAddress})\n *\n * @param args.authenticationKey The authentication key\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n * @returns Promise<AccountAddress> The accountAddress associated with the authentication key\n */\n async lookupOriginalAccountAddress(args: {\n authenticationKey: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: LedgerVersionArg;\n }): Promise<AccountAddress> {\n return lookupOriginalAccountAddress({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries the current count of tokens owned by an account\n *\n * @example\n * const tokensCount = await aptos.getAccountTokensCount({accountAddress:\"0x456\"})\n *\n * @param args.accountAddress The account address\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @returns Current count of tokens owned by the account\n */\n async getAccountTokensCount(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.ACCOUNT_TRANSACTION_PROCESSOR,\n });\n return getAccountTokensCount({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries the account's current owned tokens.\n *\n * This query returns all tokens (v1 and v2 standards) an account owns, including NFTs, fungible, soulbound, etc.\n * If you want to get only the token from a specific standard, you can pass an optional tokenStandard param\n *\n * @example\n * const accountOwnedTokens = await aptos.getAccountOwnedTokens({accountAddress:\"0x456\"})\n *\n * @param args.accountAddress The account address we want to get the tokens for\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.options.tokenStandard The NFT standard to query for\n * @param args.options.offset The number token to start returning results from\n * @param args.options.limit The number of results to return\n * @param args.options.orderBy The order to sort the tokens by\n * @returns Tokens array with the token data\n */\n async getAccountOwnedTokens(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensQueryResponse[0]>;\n }): Promise<GetAccountOwnedTokensQueryResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getAccountOwnedTokens({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries all current tokens of a specific collection that an account owns by the collection address\n *\n * This query returns all tokens (v1 and v2 standards) an account owns, including NFTs, fungible, soulbound, etc.\n * If you want to get only the token from a specific standard, you can pass an optional tokenStandard param\n *\n * @example\n * const accountOwnedTokens = await aptos.getAccountOwnedTokensFromCollectionAddress({accountAddress:\"0x123\", collectionAddress:\"0x456\"})\n *\n * @param args.accountAddress The account address we want to get the tokens for\n * @param args.collectionAddress The address of the collection being queried\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.options.tokenStandard The NFT standard to query for\n * @param args.options.offset The number token to start returning results from\n * @param args.options.limit The number of results to return\n * @param args.options.orderBy The order to sort the tokens by\n * @returns Tokens array with the token data\n */\n async getAccountOwnedTokensFromCollectionAddress(args: {\n accountAddress: AccountAddressInput;\n collectionAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensFromCollectionResponse[0]>;\n }): Promise<GetAccountOwnedTokensFromCollectionResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getAccountOwnedTokensFromCollectionAddress({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries for all collections that an account currently has tokens for.\n *\n * This query returns all tokens (v1 and v2 standards) an account owns, including NFTs, fungible, soulbound, etc.\n * If you want to get only the token from a specific standard, you can pass an optional tokenStandard param\n *\n * @example\n * const accountCollectionsWithOwnedTokens = await aptos.getAccountCollectionsWithOwnedTokens({accountAddress:\"0x123\"})\n *\n * @param args.accountAddress The account address we want to get the collections for\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.options.tokenStandard The NFT standard to query for\n * @param args.options.offset The number collection to start returning results from\n * @param args.options.limit The number of results to return\n * @param args.options.orderBy The order to sort the tokens by\n * @returns Collections array with the collections data\n */\n async getAccountCollectionsWithOwnedTokens(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountCollectionsWithOwnedTokenResponse[0]>;\n }): Promise<GetAccountCollectionsWithOwnedTokenResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getAccountCollectionsWithOwnedTokens({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries the current count of transactions submitted by an account\n *\n * @example\n * const accountTransactionsCount = await aptos.getAccountTransactionsCount({accountAddress:\"0x123\"})\n *\n * @param args.accountAddress The account address we want to get the total count for\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @returns Current count of transactions made by an account\n */\n async getAccountTransactionsCount(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.ACCOUNT_TRANSACTION_PROCESSOR,\n });\n return getAccountTransactionsCount({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries an account's coins data\n *\n * @example\n * const accountCoinsData = await aptos.getAccountCoinsData({accountAddress:\"0x123\"})\n *\n * @param args.accountAddress The account address we want to get the coins data for\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.options.offset optional. The number coin to start returning results from\n * @param args.options.limit optional. The number of results to return\n * @param args.options.orderBy optional. The order to sort the coins by\n * @param args.options.where optional. Filter the results by\n * @returns Array with the coins data\n */\n async getAccountCoinsData(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs &\n OrderByArg<GetAccountCoinsDataResponse[0]> &\n WhereArg<CurrentFungibleAssetBalancesBoolExp>;\n }): Promise<GetAccountCoinsDataResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.FUNGIBLE_ASSET_PROCESSOR,\n });\n return getAccountCoinsData({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries the current count of an account's coins aggregated\n *\n * @example\n * const accountCoinsCount = await aptos.getAccountCoinsCount({accountAddress:\"0x123\"})\n *\n * @param args.accountAddress The account address we want to get the total count for\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @returns Current count of the aggregated count of all account's coins\n */\n async getAccountCoinsCount(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.FUNGIBLE_ASSET_PROCESSOR,\n });\n return getAccountCoinsCount({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries the account's APT amount\n *\n * @example\n * const accountAPTAmount = await aptos.getAccountAPTAmount({accountAddress:\"0x123\"})\n *\n * @param args.accountAddress The account address we want to get the total count for\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @returns Current amount of account's APT\n */\n async getAccountAPTAmount(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n return this.getAccountCoinAmount({ coinType: APTOS_COIN, ...args });\n }\n\n /**\n * Queries the account's coin amount by the coin type\n *\n * @example\n * const accountCoinAmount = await aptos.getAccountCoinAmount({accountAddress:\"0x123\", coinType:\"0x1::aptos_coin::AptosCoin\"})\n *\n * @param args.accountAddress The account address we want to get the total count for\n * @param args.coinType The coin type to query\n * @param args.faMetadataAddress The fungible asset metadata address to query.\n * Note: coinType will automatically fill this in if not provided when migrated to fungible assets\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @returns Current amount of account's coin\n */\n async getAccountCoinAmount(args: {\n accountAddress: AccountAddressInput;\n coinType?: MoveStructId;\n faMetadataAddress?: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.FUNGIBLE_ASSET_PROCESSOR,\n });\n return getAccountCoinAmount({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries an account's owned objects\n *\n * @example\n * const accountOwnedObjects = await aptos.getAccountOwnedObjects({accountAddress:\"0x123\"})\n *\n * @param args.accountAddress The account address we want to get the objects for\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.options.offset The starting position to start returning results from\n * @param args.options.limit The number of results to return\n * @param args.options.orderBy The order to sort the objects by\n * @returns Objects array with the object data\n */\n async getAccountOwnedObjects(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & OrderByArg<GetObjectDataQueryResponse[0]>;\n }): Promise<GetObjectDataQueryResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.DEFAULT,\n });\n return getAccountOwnedObjects({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Derives an account by providing a private key.\n * This functions resolves the provided private key type and derives the public key from it.\n *\n * If the privateKey is a Secp256k1 type, it derives the account using the derived public key and\n * auth key using the SingleKey scheme locally.\n *\n * If the privateKey is a ED25519 type, it looks up the authentication key on chain, and uses it to resolve\n * whether it is a Legacy ED25519 key or a Unified ED25519 key. It then derives the account based\n * on that.\n *\n * @example\n * const account = await aptos.deriveAccountFromPrivateKey({privateKey:new Ed25519PrivateKey(\"0x123\")})\n *\n * @param args.privateKey An account private key\n * @returns Account type\n */\n async deriveAccountFromPrivateKey(args: { privateKey: PrivateKey }): Promise<AccountModule> {\n return deriveAccountFromPrivateKey({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"2OAkDO,IAAMA,EAAN,KAAc,CACnB,YAAqBC,EAAqB,CAArB,YAAAA,CAAsB,CAiB3C,MAAM,eAAeC,EAAqE,CACxF,OAAOC,EAAQ,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CACtD,CAgBA,MAAM,kBAAkBA,EAGU,CAChC,OAAOE,EAAW,CAAE,YAAa,KAAK,OAAQ,GAAGF,CAAK,CAAC,CACzD,CAqBA,MAAM,iBAAiBA,EAIS,CAC9B,OAAOG,EAAU,CAAE,YAAa,KAAK,OAAQ,GAAGH,CAAK,CAAC,CACxD,CAiBA,MAAM,uBAAuBA,EAGM,CACjC,OAAOI,EAAgB,CACrB,YAAa,KAAK,OAClB,GAAGJ,CACL,CAAC,CACH,CAiBA,MAAM,oBAAoBA,EAGE,CAC1B,OAAOK,EAAa,CAAE,YAAa,KAAK,OAAQ,GAAGL,CAAK,CAAC,CAC3D,CAiBA,MAAM,mBAAuCA,EAI9B,CACb,OAAOM,EAAe,CAAE,YAAa,KAAK,OAAQ,GAAGN,CAAK,CAAC,CAC7D,CAeA,MAAM,6BAA6BA,EAIP,CAC1B,OAAOO,EAA6B,CAAE,YAAa,KAAK,OAAQ,GAAGP,CAAK,CAAC,CAC3E,CAYA,MAAM,sBAAsBA,EAGR,CAClB,aAAMQ,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBR,EAAK,qBAC3B,8C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A,EAKP,CAClB,aAAMQ,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBR,EAAK,qBAC3B,wCACF,CAAC,EACMiB,EAAqB,CAAE,YAAa,KAAK,OAAQ,GAAGjB,CAAK,CAAC,CACnE,CAeA,MAAM,uBAAuBA,EAIW,CACtC,aAAMQ,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBR,EAAK,qBAC3B,iCACF,CAAC,EACMkB,EAAuB,CAC5B,YAAa,KAAK,OAClB,GAAGlB,CACL,CAAC,CACH,CAmBA,MAAM,4BAA4BA,EAA0D,CAC1F,OAAOmB,EAA4B,CAAE,YAAa,KAAK,OAAQ,GAAGnB,CAAK,CAAC,CAC1E,CACF","names":["Account","config","args","getInfo","getModules","getModule","getTransactions","getResources","getResource","lookupOriginalAccountAddress","waitForIndexerOnVersion","getAccountTokensCount","getAccountOwnedTokens","getAccountOwnedTokensFromCollectionAddress","getAccountCollectionsWithOwnedTokens","getAccountTransactionsCount","getAccountCoinsData","getAccountCoinsCount","APTOS_COIN","getAccountCoinAmount","getAccountOwnedObjects","deriveAccountFromPrivateKey"]}
@@ -1,2 +0,0 @@
1
- import{a as m,c as P,d as V,e as v}from"./chunk-IVVWQKCF.mjs";import{a as B}from"./chunk-MQGW234H.mjs";import{a as b,b as y}from"./chunk-ZXYTLPP6.mjs";import{b as C,d as I}from"./chunk-Q7MD4V7H.mjs";import{b as U}from"./chunk-76OH2Z4Q.mjs";import{a as d}from"./chunk-MLDQ2TY2.mjs";import{a as H}from"./chunk-G5MGSV7Y.mjs";import{b as x}from"./chunk-OHRL766V.mjs";import{a as T}from"./chunk-AH44UPM4.mjs";import{b as w}from"./chunk-I5XQKNOK.mjs";import{a as G}from"./chunk-KEYAPEAX.mjs";import{a as p,b as E}from"./chunk-A63SMUOU.mjs";import{b as u}from"./chunk-BCUSI3N6.mjs";import{jwtDecode as k}from"jwt-decode";var he=1e7,F=120,L=30,N=330,ge=120,fe=350,Se=300,xe=93,o=class o extends U{constructor(e,t){super();let i=u.fromHexInput(t).toUint8Array();if(i.length!==o.ID_COMMITMENT_LENGTH)throw new Error(`Id Commitment length in bytes should be ${o.ID_COMMITMENT_LENGTH}`);this.iss=e,this.idCommitment=i}authKey(){let e=new E;return e.serializeU32AsUleb128(3),e.serializeFixedBytes(this.bcsToBytes()),H.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}toString(){return u.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("Not yet implemented")}serialize(e){e.serializeStr(this.iss),e.serializeBytes(this.idCommitment)}static deserialize(e){let t=e.deserializeStr(),i=e.deserializeBytes();return new o(t,i)}static load(e){let t=e.deserializeStr(),i=e.deserializeBytes();return new o(t,i)}static isPublicKey(e){return e instanceof o}static create(e){return _(e),new o(e.iss,_(e))}static fromJwtAndPepper(e){let{jwt:t,pepper:i,uidKey:a="sub"}=e,n=k(t),s=n.iss;if(typeof n.aud!="string")throw new Error("aud was not found or an array of values");let M=n.aud,R=n[a];return o.create({iss:s,uidKey:a,uidVal:R,aud:M,pepper:i})}static isInstance(e){return"iss"in e&&typeof e.iss=="string"&&"idCommitment"in e&&e.idCommitment instanceof Uint8Array}};o.ID_COMMITMENT_LENGTH=32;var A=o;function _(r){let{uidKey:e,uidVal:t,aud:i,pepper:a}=r,n=[P(u.fromHexInput(a).toUint8Array()),m(i,F),m(t,N),m(e,L)];return V(v(n),A.ID_COMMITMENT_LENGTH)}var D=class r extends d{constructor(e){super();let{jwtHeader:t,ephemeralCertificate:i,expiryDateSecs:a,ephemeralPublicKey:n,ephemeralSignature:s}=e;this.jwtHeader=t,this.ephemeralCertificate=i,this.expiryDateSecs=a,this.ephemeralPublicKey=n,this.ephemeralSignature=s}toUint8Array(){return this.bcsToBytes()}serialize(e){this.ephemeralCertificate.serialize(e),e.serializeStr(this.jwtHeader),e.serializeU64(this.expiryDateSecs),this.ephemeralPublicKey.serialize(e),this.ephemeralSignature.serialize(e)}static deserialize(e){let t=h.deserialize(e),i=e.deserializeStr(),a=e.deserializeU64(),n=b.deserialize(e),s=y.deserialize(e);return new r({jwtHeader:i,expiryDateSecs:Number(a),ephemeralCertificate:t,ephemeralPublicKey:n,ephemeralSignature:s})}static getSimulationSignature(){return new r({jwtHeader:"{}",ephemeralCertificate:new h(new S({proof:new f(new g({a:new Uint8Array(32),b:new Uint8Array(64),c:new Uint8Array(32)}),0),expHorizonSecs:0}),0),expiryDateSecs:0,ephemeralPublicKey:new b(new C(new Uint8Array(32))),ephemeralSignature:new y(new I(new Uint8Array(64)))})}static isSignature(e){return e instanceof r}},h=class r extends d{constructor(e,t){super(),this.signature=e,this.variant=t}toUint8Array(){return this.signature.toUint8Array()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new r(S.deserialize(e),t);default:throw new Error(`Unknown variant index for EphemeralCertificate: ${t}`)}}},c=class r extends p{constructor(e){if(super(),this.data=u.fromHexInput(e).toUint8Array(),this.data.length!==32)throw new Error("Input needs to be 32 bytes")}serialize(e){e.serializeFixedBytes(this.data)}static deserialize(e){let t=e.deserializeFixedBytes(32);return new r(t)}},l=class r extends p{constructor(e){if(super(),this.data=u.fromHexInput(e).toUint8Array(),this.data.length!==64)throw new Error("Input needs to be 64 bytes")}serialize(e){e.serializeFixedBytes(this.data)}static deserialize(e){let t=e.deserializeFixedBytes(64);return new r(t)}},g=class r extends B{constructor(e){super();let{a:t,b:i,c:a}=e;this.a=new c(t),this.b=new l(i),this.c=new c(a)}serialize(e){this.a.serialize(e),this.b.serialize(e),this.c.serialize(e)}static deserialize(e){let t=c.deserialize(e).bcsToBytes(),i=l.deserialize(e).bcsToBytes(),a=c.deserialize(e).bcsToBytes();return new r({a:t,b:i,c:a})}},f=class r extends p{constructor(e,t){super(),this.proof=e,this.variant=t}serialize(e){e.serializeU32AsUleb128(this.variant),this.proof.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new r(g.deserialize(e),t);default:throw new Error(`Unknown variant index for ZkProof: ${t}`)}}},S=class r extends d{constructor(e){super();let{proof:t,expHorizonSecs:i,trainingWheelsSignature:a,extraField:n,overrideAudVal:s}=e;this.proof=t,this.expHorizonSecs=i,this.trainingWheelsSignature=a,this.extraField=n,this.overrideAudVal=s}toUint8Array(){return this.bcsToBytes()}static fromBytes(e){return r.deserialize(new G(e))}serialize(e){this.proof.serialize(e),e.serializeU64(this.expHorizonSecs),e.serializeOptionStr(this.extraField),e.serializeOptionStr(this.overrideAudVal),e.serializeOption(this.trainingWheelsSignature)}static deserialize(e){let t=f.deserialize(e),i=Number(e.deserializeU64()),a=e.deserializeOptionStr(),n=e.deserializeOptionStr(),s=e.deserializeOption(y);return new r({proof:t,expHorizonSecs:i,trainingWheelsSignature:s,extraField:a,overrideAudVal:n})}},z=class r{constructor(e,t){this.verficationKey=e,this.maxExpHorizonSecs=t}static create(e,t){return new r(new K({alphaG1:e.alpha_g1,betaG2:e.beta_g2,deltaG2:e.delta_g2,gammaAbcG1:e.gamma_abc_g1,gammaG2:e.gamma_g2}),t)}},K=class r{constructor(e){let{alphaG1:t,betaG2:i,deltaG2:a,gammaAbcG1:n,gammaG2:s}=e;this.alphaG1=new c(t),this.betaG2=new l(i),this.deltaG2=new l(a),this.gammaAbcG1=[new c(n[0]),new c(n[1])],this.gammaG2=new l(s)}static fromGroth16VerificationKeyResponse(e){return new r({alphaG1:e.alpha_g1,betaG2:e.beta_g2,deltaG2:e.delta_g2,gammaAbcG1:e.gamma_abc_g1,gammaG2:e.gamma_g2})}};async function be(r){let{aptosConfig:e}=r;return T(async()=>{let t=await O(r),i=await j(r);return z.create(i,Number(t.max_exp_horizon_secs))},`keyless-configuration-${e.network}`,1e3*60*5)()}async function O(r){let{aptosConfig:e,options:t}=r,i="0x1::keyless_account::Configuration",{data:a}=await w({aptosConfig:e,originMethod:"getKeylessConfigurationResource",path:`accounts/${x.from("0x1").toString()}/resource/${i}`,params:{ledger_version:t?.ledgerVersion}});return a.data}async function j(r){let{aptosConfig:e,options:t}=r,i="0x1::keyless_account::Groth16VerificationKey",{data:a}=await w({aptosConfig:e,originMethod:"getGroth16VerificationKeyResource",path:`accounts/${x.from("0x1").toString()}/resource/${i}`,params:{ledger_version:t?.ledgerVersion}});return a.data}export{he as a,F as b,L as c,N as d,ge as e,fe as f,Se as g,xe as h,A as i,D as j,h as k,g as l,f as m,S as n,z as o,be as p};
2
- //# sourceMappingURL=chunk-4ZMI5G5L.mjs.map
@@ -1,2 +0,0 @@
1
- import{a as e}from"./chunk-A63SMUOU.mjs";import{b as r}from"./chunk-BCUSI3N6.mjs";var t=class extends e{toString(){let n=this.toUint8Array();return r.fromHexInput(n).toString()}},a=class extends t{};export{t as a,a as b};
2
- //# sourceMappingURL=chunk-76OH2Z4Q.mjs.map
@@ -1 +0,0 @@
1
- //# sourceMappingURL=chunk-7Z6DYLCA.mjs.map
@@ -1 +0,0 @@
1
- //# sourceMappingURL=chunk-AQ4I7VVB.mjs.map
@@ -1,2 +0,0 @@
1
- import{a as i}from"./chunk-A63SMUOU.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-BOYYQAB4.mjs.map
@@ -1,2 +0,0 @@
1
- import{a as y}from"./chunk-RA3YPQG2.mjs";import{e as o}from"./chunk-Q67DUNMI.mjs";import{a as g,b as u}from"./chunk-6ERHGCK2.mjs";var l=class a{constructor(i){let{multiKey:s,signers:e}=i;this.publicKey=s,this.signingScheme=3,this.accountAddress=this.publicKey.authKey().derivedAddress();let r=[];for(let t of e)r.push(this.publicKey.getIndex(t.publicKey));let n=e.map((t,c)=>[t,r[c]]);n.sort((t,c)=>t[1]-c[1]),this.signers=n.map(t=>t[0]),this.signerIndicies=n.map(t=>t[1]),this.signaturesBitmap=this.publicKey.createBitmap({bits:r})}static fromPublicKeysAndSigners(i){let{publicKeys:s,signaturesRequired:e,signers:r}=i,n=new g({publicKeys:s,signaturesRequired:e});return new a({multiKey:n,signers:r})}static isMultiKeySigner(i){return i instanceof a}signWithAuthenticator(i){return new o(this.publicKey,this.sign(i))}signTransactionWithAuthenticator(i){return new o(this.publicKey,this.signTransaction(i))}async waitForProofFetch(){let s=this.signers.filter(e=>e instanceof y).map(async e=>e.waitForProofFetch());await Promise.all(s)}sign(i){let s=[];for(let e of this.signers)s.push(e.sign(i));return new u({signatures:s,bitmap:this.signaturesBitmap})}signTransaction(i){let s=[];for(let e of this.signers)s.push(e.signTransaction(i));return new u({signatures:s,bitmap:this.signaturesBitmap})}verifySignature(i){let{message:s,signature:e}=i;if(!this.signerIndicies.every((n,t)=>t===0||n>=this.signerIndicies[t-1]))return!1;for(let n=0;n<e.signatures.length;n+=1){let t=e.signatures[n];if(!this.publicKey.publicKeys[this.signerIndicies[n]].verifySignature({message:s,signature:t}))return!1}return!0}};export{l as a};
2
- //# sourceMappingURL=chunk-EZIF26UH.mjs.map
@@ -1 +0,0 @@
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 } from \"../core/accountAddress\";\nimport { HexInput, SigningScheme } from \"../types\";\nimport { AccountAuthenticatorMultiKey } from \"../transactions/authenticator/account\";\nimport { AnyRawTransaction } from \"../transactions/types\";\nimport { KeylessAccount } from \"./KeylessAccount\";\n\nexport interface VerifyMultiKeySignatureArgs {\n message: HexInput;\n signature: MultiKeySignature;\n}\n\n/**\n * Signer implementation for the MultiKey authentication scheme.\n *\n * This accounts to use a M of N signing scheme. M and N are specified in the {@link MultiKey}\n * It signs messages via the array of M number of Accounts that individually correspond 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 indicies 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 readonly signerIndicies: number[];\n\n readonly signaturesBitmap: Uint8Array;\n\n /**\n * constructor for MultiKeyAccount\n *\n * @param args.multiKey the multikey of the account which consists of N public keys and a number M which is\n * the number of required signatures.\n * @param args.signers an array of M signers that will be used to sign the transaction\n * @returns MultiKeyAccount\n */\n constructor(args: { multiKey: MultiKey; signers: Account[] }) {\n const { multiKey, signers } = args;\n\n this.publicKey = multiKey;\n this.signingScheme = SigningScheme.MultiKey;\n\n this.accountAddress = 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 for MultiKeyAccount\n *\n * @param args.publicKeys the N public keys of the MultiKeyAccount\n * @param args.signaturesRequired the number of signatures required\n * @param args.signers an array of M signers that will be used to sign the transaction\n * @returns 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 static isMultiKeySigner(account: Account): account is MultiKeyAccount {\n return account instanceof MultiKeyAccount;\n }\n\n /**\n * Sign a message using the account's signers.\n * @param message the signing message, as binary input\n * @return the AccountAuthenticator containing the signature, together with the account's 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.\n * @param transaction the raw transaction\n * @return the AccountAuthenticator containing the signature of the transaction, together 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 any KeylessAccount signers to be fetched. If the proof is fetched a syncronously, call this\n * to ensure signing with the KeylessAccount does not fail as the proof must be ready.\n * @return\n */\n async waitForProofFetch() {\n const keylessSigners = this.signers.filter((signer) => signer instanceof KeylessAccount) as KeylessAccount[];\n const promises = keylessSigners.map(async (signer) => signer.waitForProofFetch());\n await Promise.all(promises);\n }\n\n /**\n * Sign the given message using the MultiKeyAccount's signers\n * @param message in HexInput format\n * @returns MultiKeySignature\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 * @param transaction the transaction to be signed\n * @returns MultiKeySignature\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 key.\n *\n * @param args.message raw message data in HexInput format\n * @param args.signatures signed message MultiKeySignature\n * @returns boolean\n */\n verifySignature(args: VerifyMultiKeySignatureArgs): boolean {\n const { message, signature } = args;\n const isSignerIndiciesSorted = this.signerIndicies.every(\n (value, i) => i === 0 || value >= this.signerIndicies[i - 1],\n );\n if (!isSignerIndiciesSorted) {\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":"kIAwBO,IAAMA,EAAN,MAAMC,CAAmC,CAuC9C,YAAYC,EAAkD,CAC5D,GAAM,CAAE,SAAAC,EAAU,QAAAC,CAAQ,EAAIF,EAE9B,KAAK,UAAYC,EACjB,KAAK,cAAgB,EAErB,KAAK,eAAiB,KAAK,UAAU,QAAQ,EAAE,eAAe,EAG9D,IAAME,EAAyB,CAAC,EAChC,QAAWC,KAAUF,EACnBC,EAAa,KAAK,KAAK,UAAU,SAASC,EAAO,SAAS,CAAC,EAK7D,IAAMC,EAA6CH,EAAQ,IAAI,CAACE,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,CAUA,OAAO,yBAAyBH,EAIZ,CAClB,GAAM,CAAE,WAAAU,EAAY,mBAAAC,EAAoB,QAAAT,CAAQ,EAAIF,EAC9CC,EAAW,IAAIW,EAAS,CAAE,WAAAF,EAAY,mBAAAC,CAA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K,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","bitPositions","signer","signersAndBitPosition","index","a","b","value","publicKeys","signaturesRequired","MultiKey","account","message","AccountAuthenticatorMultiKey","transaction","promises","KeylessAccount","data","signatures","MultiKeySignature","signature","i","singleSignature"]}
@@ -1,2 +0,0 @@
1
- import{b as t}from"./chunk-BCUSI3N6.mjs";var o=r=>typeof r=="string"?t.isValid(r).valid?r:Buffer.from(r,"utf8"):r;export{o as a};
2
- //# sourceMappingURL=chunk-F7EMGK4M.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/internal/transactionSubmission.ts"],"sourcesContent":["/**\n * This file contains the underlying implementations for exposed submission API surface in\n * the {@link api/transaction}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * transaction namespace and without having a dependency cycle error.\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { MoveVector, U8 } from \"../bcs\";\nimport { postAptosFullNode } from \"../client\";\nimport { Account, KeylessAccount, MultiKeyAccount } from \"../account\";\nimport { AccountAddress, AccountAddressInput } from \"../core/accountAddress\";\nimport { PrivateKey } from \"../core/crypto\";\nimport { AccountAuthenticator } from \"../transactions/authenticator/account\";\nimport { RotationProofChallenge } from \"../transactions/instances/rotationProofChallenge\";\nimport {\n buildTransaction,\n generateTransactionPayload,\n generateSignedTransactionForSimulation,\n generateSignedTransaction,\n} from \"../transactions/transactionBuilder/transactionBuilder\";\nimport {\n InputGenerateTransactionData,\n AnyRawTransaction,\n InputSimulateTransactionData,\n InputGenerateTransactionOptions,\n InputGenerateTransactionPayloadDataWithRemoteABI,\n InputSubmitTransactionData,\n InputGenerateMultiAgentRawTransactionData,\n InputGenerateSingleSignerRawTransactionData,\n AnyTransactionPayloadInstance,\n EntryFunctionABI,\n} from \"../transactions/types\";\nimport { getInfo } from \"./account\";\nimport { UserTransactionResponse, PendingTransactionResponse, MimeType, HexInput, TransactionResponse } from \"../types\";\nimport { TypeTagU8, TypeTagVector, generateSigningMessageForTransaction } from \"../transactions\";\nimport { SimpleTransaction } from \"../transactions/instances/simpleTransaction\";\nimport { MultiAgentTransaction } from \"../transactions/instances/multiAgentTransaction\";\n\n/**\n * We are defining function signatures, each with its specific input and output.\n * These are the possible function signature for `generateTransaction` function.\n * When we call `generateTransaction` function with the relevant type properties,\n * Typescript can infer the return type based on the appropriate function overload.\n */\nexport async function generateTransaction(\n args: { aptosConfig: AptosConfig } & InputGenerateSingleSignerRawTransactionData,\n): Promise<SimpleTransaction>;\nexport async function generateTransaction(\n args: { aptosConfig: AptosConfig } & InputGenerateMultiAgentRawTransactionData,\n): Promise<MultiAgentTransaction>;\n/**\n * Generates any transaction by passing in the required arguments\n *\n * @param args.sender The transaction sender's account address as a AccountAddressInput\n * @param args.data EntryFunctionData | ScriptData | MultiSigData\n * @param args.feePayerAddress optional. For a fee payer (aka sponsored) transaction\n * @param args.secondarySignerAddresses optional. For a multi-agent or fee payer (aka sponsored) transactions\n * @param args.options optional. GenerateTransactionOptions type\n *\n * @example\n * For a single signer entry function\n * move function name, move function type arguments, move function arguments\n * `\n * data: {\n * function:\"0x1::aptos_account::transfer\",\n * typeArguments:[]\n * functionArguments :[receiverAddress,10]\n * }\n * `\n *\n * @example\n * For a single signer script function\n * module bytecode, move function type arguments, move function arguments\n * ```\n * data: {\n * bytecode:\"0x001234567\",\n * typeArguments:[],\n * functionArguments :[receiverAddress,10]\n * }\n * ```\n *\n * @return An instance of a RawTransaction, plus optional secondary/fee payer addresses\n * ```\n * {\n * rawTransaction: RawTransaction,\n * secondarySignerAddresses? : Array<AccountAddress>,\n * feePayerAddress?: AccountAddress\n * }\n * ```\n */\nexport async function generateTransaction(\n args: { aptosConfig: AptosConfig } & InputGenerateTransactionData,\n): Promise<AnyRawTransaction> {\n const payload = await buildTransactionPayload(args);\n return buildRawTransaction(args, payload);\n}\n\nexport async function buildTransactionPayload(\n args: { aptosConfig: AptosConfig } & InputGenerateTransactionData,\n): Promise<AnyTransactionPayloadInstance> {\n const { aptosConfig, data } = args;\n // Merge in aptosConfig for remote ABI on non-script payloads\n let generateTransactionPayloadData: InputGenerateTransactionPayloadDataWithRemoteABI;\n let payload: AnyTransactionPayloadInstance;\n\n if (\"bytecode\" in data) {\n // TODO: Add ABI checking later\n payload = await generateTransactionPayload(data);\n } else if (\"multisigAddress\" in data) {\n generateTransactionPayloadData = {\n aptosConfig,\n multisigAddress: data.multisigAddress,\n function: data.function,\n functionArguments: data.functionArguments,\n typeArguments: data.typeArguments,\n abi: data.abi,\n };\n payload = await generateTransactionPayload(generateTransactionPayloadData);\n } else {\n generateTransactionPayloadData = {\n aptosConfig,\n function: data.function,\n functionArguments: data.functionArguments,\n typeArguments: data.typeArguments,\n abi: data.abi,\n };\n payload = await generateTransactionPayload(generateTransactionPayloadData);\n }\n return payload;\n}\n\nexport async function buildRawTransaction(\n args: { aptosConfig: AptosConfig } & InputGenerateTransactionData,\n payload: AnyTransactionPayloadInstance,\n): Promise<AnyRawTransaction> {\n const { aptosConfig, sender, options } = args;\n\n let feePayerAddress;\n if (isFeePayerTransactionInput(args)) {\n feePayerAddress = AccountAddress.ZERO.toString();\n }\n\n if (isMultiAgentTransactionInput(args)) {\n const { secondarySignerAddresses } = args;\n return buildTransaction({\n aptosConfig,\n sender,\n payload,\n options,\n secondarySignerAddresses,\n feePayerAddress,\n });\n }\n\n return buildTransaction({\n aptosConfig,\n sender,\n payload,\n options,\n feePayerAddress,\n });\n}\n\nfunction isFeePayerTransactionInput(data: InputGenerateTransactionData): boolean {\n return data.withFeePayer === true;\n}\n\nfunction isMultiAgentTransactionInput(\n data: InputGenerateTransactionData,\n): data is InputGenerateMultiAgentRawTransactionData {\n return \"secondarySignerAddresses\" in data;\n}\n\n/**\n * Builds a signing message that can be signed by external signers\n *\n * Note: Please prefer using `signTransaction` unless signing outside the SDK\n *\n * @param args.transaction AnyRawTransaction, as generated by `generateTransaction()`\n *\n * @return The message to be signed\n */\nexport function getSigningMessage(args: { transaction: AnyRawTransaction }): Uint8Array {\n const { transaction } = args;\n return generateSigningMessageForTransaction(transaction);\n}\n\n/**\n * Sign a transaction that can later be submitted to chain\n *\n * @param args.signer The signer account to sign the transaction\n * @param args.transaction An instance of a RawTransaction, plus optional secondary/fee payer addresses\n * ```\n * {\n * rawTransaction: RawTransaction,\n * secondarySignerAddresses? : Array<AccountAddress>,\n * feePayerAddress?: AccountAddress\n * }\n * ```\n *\n * @return The signer AccountAuthenticator\n */\nexport function signTransaction(args: { signer: Account; transaction: AnyRawTransaction }): AccountAuthenticator {\n const { signer, transaction } = args;\n return signer.signTransactionWithAuthenticator(transaction);\n}\n\n/**\n * Simulates a transaction before singing it.\n *\n * @param args.signerPublicKey The signer public key\n * @param args.transaction The raw transaction to simulate\n * @param args.secondarySignersPublicKeys optional. For when the transaction is a multi signers transaction\n * @param args.feePayerPublicKey optional. For when the transaction is a fee payer (aka sponsored) transaction\n * @param args.options optional. A config to simulate the transaction with\n */\nexport async function simulateTransaction(\n args: { aptosConfig: AptosConfig } & InputSimulateTransactionData,\n): Promise<Array<UserTransactionResponse>> {\n const { aptosConfig, transaction, signerPublicKey, secondarySignersPublicKeys, feePayerPublicKey, options } = args;\n\n const signedTransaction = generateSignedTransactionForSimulation({\n transaction,\n signerPublicKey,\n secondarySignersPublicKeys,\n feePayerPublicKey,\n options,\n });\n\n const { data } = await postAptosFullNode<Uint8Array, Array<UserTransactionResponse>>({\n aptosConfig,\n body: signedTransaction,\n path: \"transactions/simulate\",\n params: {\n estimate_gas_unit_price: args.options?.estimateGasUnitPrice ?? false,\n estimate_max_gas_amount: args.options?.estimateMaxGasAmount ?? false,\n estimate_prioritized_gas_unit_price: args.options?.estimatePrioritizedGasUnitPrice ?? false,\n },\n originMethod: \"simulateTransaction\",\n contentType: MimeType.BCS_SIGNED_TRANSACTION,\n });\n return data;\n}\n\n/**\n * Submit transaction to chain\n *\n * @param args.transaction A aptos transaction type\n * @param args.senderAuthenticator The account authenticator of the transaction sender\n * @param args.secondarySignerAuthenticators optional. For when the transaction is a multi signers transaction\n *\n * @return PendingTransactionResponse\n */\nexport async function submitTransaction(\n args: {\n aptosConfig: AptosConfig;\n } & InputSubmitTransactionData,\n): Promise<PendingTransactionResponse> {\n const { aptosConfig } = args;\n const signedTransaction = generateSignedTransaction({ ...args });\n const { data } = await postAptosFullNode<Uint8Array, PendingTransactionResponse>({\n aptosConfig,\n body: signedTransaction,\n path: \"transactions\",\n originMethod: \"submitTransaction\",\n contentType: MimeType.BCS_SIGNED_TRANSACTION,\n });\n return data;\n}\n\nexport async function signAndSubmitTransaction(args: {\n aptosConfig: AptosConfig;\n signer: Account;\n transaction: AnyRawTransaction;\n}): Promise<PendingTransactionResponse> {\n const { aptosConfig, signer, transaction } = args;\n // If the signer contains a KeylessAccount, await proof fetching in case the proof\n // was fetched asyncronously.\n if (signer instanceof KeylessAccount || signer instanceof MultiKeyAccount) {\n await signer.waitForProofFetch();\n }\n const authenticator = signTransaction({ signer, transaction });\n return submitTransaction({\n aptosConfig,\n transaction,\n senderAuthenticator: authenticator,\n });\n}\n\nconst packagePublishAbi: EntryFunctionABI = {\n typeParameters: [],\n parameters: [TypeTagVector.u8(), new TypeTagVector(TypeTagVector.u8())],\n};\n\nexport async function publicPackageTransaction(args: {\n aptosConfig: AptosConfig;\n account: AccountAddressInput;\n metadataBytes: HexInput;\n moduleBytecode: Array<HexInput>;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, account, metadataBytes, moduleBytecode, options } = args;\n\n const totalByteCode = moduleBytecode.map((bytecode) => MoveVector.U8(bytecode));\n\n return generateTransaction({\n aptosConfig,\n sender: AccountAddress.from(account),\n data: {\n function: \"0x1::code::publish_package_txn\",\n functionArguments: [MoveVector.U8(metadataBytes), new MoveVector(totalByteCode)],\n abi: packagePublishAbi,\n },\n options,\n });\n}\n\nconst rotateAuthKeyAbi: EntryFunctionABI = {\n typeParameters: [],\n parameters: [\n new TypeTagU8(),\n TypeTagVector.u8(),\n new TypeTagU8(),\n TypeTagVector.u8(),\n TypeTagVector.u8(),\n TypeTagVector.u8(),\n ],\n};\n\n/**\n * TODO: Need to refactor and move this function out of transactionSubmission\n */\nexport async function rotateAuthKey(args: {\n aptosConfig: AptosConfig;\n fromAccount: Account;\n toNewPrivateKey: PrivateKey;\n}): Promise<TransactionResponse> {\n const { aptosConfig, fromAccount, toNewPrivateKey } = args;\n const accountInfo = await getInfo({\n aptosConfig,\n accountAddress: fromAccount.accountAddress,\n });\n\n const newAccount = Account.fromPrivateKey({ privateKey: toNewPrivateKey, legacy: true });\n\n const challenge = new RotationProofChallenge({\n sequenceNumber: BigInt(accountInfo.sequence_number),\n originator: fromAccount.accountAddress,\n currentAuthKey: AccountAddress.from(accountInfo.authentication_key),\n newPublicKey: newAccount.publicKey,\n });\n\n // Sign the challenge\n const challengeHex = challenge.bcsToBytes();\n const proofSignedByCurrentPrivateKey = fromAccount.sign(challengeHex);\n const proofSignedByNewPrivateKey = newAccount.sign(challengeHex);\n\n // Generate transaction\n const rawTxn = await generateTransaction({\n aptosConfig,\n sender: fromAccount.accountAddress,\n data: {\n function: \"0x1::account::rotate_authentication_key\",\n functionArguments: [\n new U8(fromAccount.signingScheme), // from scheme\n MoveVector.U8(fromAccount.publicKey.toUint8Array()),\n new U8(newAccount.signingScheme), // to scheme\n MoveVector.U8(newAccount.publicKey.toUint8Array()),\n MoveVector.U8(proofSignedByCurrentPrivateKey.toUint8Array()),\n MoveVector.U8(proofSignedByNewPrivateKey.toUint8Array()),\n ],\n abi: rotateAuthKeyAbi,\n },\n });\n return signAndSubmitTransaction({\n aptosConfig,\n signer: fromAccount,\n transaction: rawTxn,\n });\n}\n"],"mappings":"wgBA2FA,eAAsBA,EACpBC,EAC4B,CAC5B,IAAMC,EAAU,MAAMC,E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ACJ,SAAU,0CACV,kBAAmB,CACjB,IAAIW,EAAGX,EAAY,aAAa,EAChCJ,EAAW,GAAGI,EAAY,UAAU,aAAa,CAAC,EAClD,IAAIW,EAAGP,EAAW,aAAa,EAC/BR,EAAW,GAAGQ,EAAW,UAAU,aAAa,CAAC,EACjDR,EAAW,GAAGY,EAA+B,aAAa,CAAC,EAC3DZ,EAAW,GAAGa,EAA2B,aAAa,CAAC,CACzD,EACA,IAAKZ,CACP,CACF,CAAC,EACD,OAAOb,EAAyB,CAC9B,YAAA1B,EACA,OAAQ0C,EACR,YAAaU,CACf,CAAC,CACH","names":["generateTransaction","args","payload","buildTransactionPayload","buildRawTransaction","aptosConfig","data","generateTransactionPayloadData","generateTransactionPayload","sender","options","feePayerAddress","isFeePayerTransactionInput","AccountAddress","isMultiAgentTransactionInput","secondarySignerAddresses","buildTransaction","getSigningMessage","transaction","generateSigningMessageForTransaction","signTransaction","signer","simulateTransaction","signerPublicKey","secondarySignersPublicKeys","feePayerPublicKey","signedTransaction","generateSignedTransactionForSimulation","postAptosFullNode","submitTransaction","generateSignedTransaction","signAndSubmitTransaction","KeylessAccount","MultiKeyAccount","authenticator","packagePublishAbi","TypeTagVector","publicPackageTransaction","account","metadataBytes","moduleBytecode","totalByteCode","bytecode","MoveVector","rotateAuthKeyAbi","TypeTagU8","rotateAuthKey","fromAccount","toNewPrivateKey","accountInfo","getInfo","newAccount","Account","challengeHex","RotationProofChallenge","proofSignedByCurrentPrivateKey","proofSignedByNewPrivateKey","rawTxn","U8"]}
@@ -1,2 +0,0 @@
1
- import{b as h}from"./chunk-LDTF3ABK.mjs";import{a as y}from"./chunk-BOYYQAB4.mjs";import{b as n}from"./chunk-OHRL766V.mjs";import{a as _}from"./chunk-A63SMUOU.mjs";var t=class i extends _{constructor(e,s,a,r,c,d,l){super(),this.sender=e,this.sequence_number=s,this.payload=a,this.max_gas_amount=r,this.gas_unit_price=c,this.expiration_timestamp_secs=d,this.chain_id=l}serialize(e){this.sender.serialize(e),e.serializeU64(this.sequence_number),this.payload.serialize(e),e.serializeU64(this.max_gas_amount),e.serializeU64(this.gas_unit_price),e.serializeU64(this.expiration_timestamp_secs),this.chain_id.serialize(e)}static deserialize(e){let s=n.deserialize(e),a=e.deserializeU64(),r=h.deserialize(e),c=e.deserializeU64(),d=e.deserializeU64(),l=e.deserializeU64(),m=y.deserialize(e);return new i(s,a,r,c,d,l,m)}},o=class extends _{static deserialize(e){let s=e.deserializeUleb128AsU32();switch(s){case 0:return u.load(e);case 1:return p.load(e);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${s}`)}}},u=class i extends o{constructor(e,s){super(),this.raw_txn=e,this.secondary_signer_addresses=s}serialize(e){e.serializeU32AsUleb128(0),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses)}static load(e){let s=t.deserialize(e),a=e.deserializeVector(n);return new i(s,a)}},p=class i extends o{constructor(e,s,a){super(),this.raw_txn=e,this.secondary_signer_addresses=s,this.fee_payer_address=a}serialize(e){e.serializeU32AsUleb128(1),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses),this.fee_payer_address.serialize(e)}static load(e){let s=t.deserialize(e),a=e.deserializeVector(n),r=n.deserialize(e);return new i(s,a,r)}};export{t as a,o as b,u as c,p as d};
2
- //# sourceMappingURL=chunk-GXTEJ7NO.mjs.map
@@ -1,2 +0,0 @@
1
- import{a as r}from"./chunk-A63SMUOU.mjs";import{b as i}from"./chunk-BCUSI3N6.mjs";var t=class a extends r{constructor(e){super(),this.value=i.fromHexInput(e).toUint8Array()}serialize(e){e.serializeFixedBytes(this.value)}serializeForEntryFunction(e){e.serialize(this)}serializeForScriptFunction(e){e.serialize(this)}static deserialize(e,s){let o=e.deserializeFixedBytes(s);return new a(o)}};export{t as a};
2
- //# sourceMappingURL=chunk-H6YNXJNF.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/internal/account.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file contains the underlying implementations for exposed API surface in\n * the {@link api/account}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * account namespace and without having a dependency cycle error.\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { AptosApiError, getAptosFullNode, paginateWithCursor } from \"../client\";\nimport { AccountAddress, AccountAddressInput } from \"../core/accountAddress\";\nimport { Account } from \"../account\";\nimport { AnyPublicKey, Ed25519PublicKey, PrivateKey } from \"../core/crypto\";\nimport { queryIndexer } from \"./general\";\nimport {\n AccountData,\n GetAccountCoinsDataResponse,\n GetAccountCollectionsWithOwnedTokenResponse,\n GetAccountOwnedTokensFromCollectionResponse,\n GetAccountOwnedTokensQueryResponse,\n GetObjectDataQueryResponse,\n LedgerVersionArg,\n MoveModuleBytecode,\n MoveResource,\n MoveStructId,\n OrderByArg,\n PaginationArgs,\n TokenStandardArg,\n TransactionResponse,\n WhereArg,\n} from \"../types\";\nimport {\n GetAccountCoinsCountQuery,\n GetAccountCoinsDataQuery,\n GetAccountCollectionsWithOwnedTokensQuery,\n GetObjectDataQuery,\n GetAccountOwnedTokensFromCollectionQuery,\n GetAccountOwnedTokensQuery,\n GetAccountTokensCountQuery,\n GetAccountTransactionsCountQuery,\n} from \"../types/generated/operations\";\nimport {\n GetAccountCoinsCount,\n GetAccountCoinsData,\n GetAccountCollectionsWithOwnedTokens,\n GetObjectData,\n GetAccountOwnedTokens,\n GetAccountOwnedTokensFromCollection,\n GetAccountTokensCount,\n GetAccountTransactionsCount,\n} from \"../types/generated/queries\";\nimport { memoizeAsync } from \"../utils/memoize\";\nimport { Secp256k1PrivateKey, AuthenticationKey, Ed25519PrivateKey, createObjectAddress } from \"../core\";\nimport { CurrentFungibleAssetBalancesBoolExp } from \"../types/generated/types\";\nimport { getTableItem } from \"./table\";\nimport { APTOS_COIN } from \"../utils\";\n\nexport async function getInfo(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n}): Promise<AccountData> {\n const { aptosConfig, accountAddress } = args;\n const { data } = await getAptosFullNode<{}, AccountData>({\n aptosConfig,\n originMethod: \"getInfo\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}`,\n });\n return data;\n}\n\nexport async function getModules(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & LedgerVersionArg;\n}): Promise<MoveModuleBytecode[]> {\n const { aptosConfig, accountAddress, options } = args;\n return paginateWithCursor<{}, MoveModuleBytecode[]>({\n aptosConfig,\n originMethod: \"getModules\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/modules`,\n params: {\n ledger_version: options?.ledgerVersion,\n start: options?.offset,\n limit: options?.limit ?? 1000,\n },\n });\n}\n\n/**\n * Queries for a move module given account address and module name\n *\n * @param args.accountAddress Hex-encoded 32 byte Aptos account address\n * @param args.moduleName The name of the module\n * @param args.query.ledgerVersion Specifies ledger version of transactions. By default, latest version will be used\n * @returns The move module.\n */\nexport async function getModule(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n moduleName: string;\n options?: LedgerVersionArg;\n}): Promise<MoveModuleBytecode> {\n // We don't memoize the account module by ledger version, as it's not a common use case, this would be handled\n // by the developer directly\n if (args.options?.ledgerVersion !== undefined) {\n return getModuleInner(args);\n }\n\n return memoizeAsync(\n async () => getModuleInner(args),\n `module-${args.accountAddress}-${args.moduleName}`,\n 1000 * 60 * 5, // 5 minutes\n )();\n}\n\nasync function getModuleInner(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n moduleName: string;\n options?: LedgerVersionArg;\n}): Promise<MoveModuleBytecode> {\n const { aptosConfig, accountAddress, moduleName, options } = args;\n\n const { data } = await getAptosFullNode<{}, MoveModuleBytecode>({\n aptosConfig,\n originMethod: \"getModule\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/module/${moduleName}`,\n params: { ledger_version: options?.ledgerVersion },\n });\n return data;\n}\n\nexport async function getTransactions(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: PaginationArgs;\n}): Promise<TransactionResponse[]> {\n const { aptosConfig, accountAddress, options } = args;\n return paginateWithCursor<{}, TransactionResponse[]>({\n aptosConfig,\n originMethod: \"getTransactions\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/transactions`,\n params: { start: options?.offset, limit: options?.limit },\n });\n}\n\nexport async function getResources(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & LedgerVersionArg;\n}): Promise<MoveResource[]> {\n const { aptosConfig, accountAddress, options } = args;\n return paginateWithCursor<{}, MoveResource[]>({\n aptosConfig,\n originMethod: \"getResources\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/resources`,\n params: {\n ledger_version: options?.ledgerVersion,\n start: options?.offset,\n limit: options?.limit ?? 999,\n },\n });\n}\n\nexport async function getResource<T extends {}>(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n resourceType: MoveStructId;\n options?: LedgerVersionArg;\n}): Promise<T> {\n const { aptosConfig, accountAddress, resourceType, options } = args;\n const { data } = await getAptosFullNode<{}, MoveResource>({\n aptosConfig,\n originMethod: \"getResource\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/resource/${resourceType}`,\n params: { ledger_version: options?.ledgerVersion },\n });\n return data.data as T;\n}\n\nexport async function lookupOriginalAccountAddress(args: {\n aptosConfig: AptosConfig;\n authenticationKey: AccountAddressInput;\n options?: LedgerVersionArg;\n}): Promise<AccountAddress> {\n const { aptosConfig, authenticationKey, options } = args;\n type OriginatingAddress = {\n address_map: { handle: string };\n };\n const resource = await getResource<OriginatingAddress>({\n aptosConfig,\n accountAddress: \"0x1\",\n resourceType: \"0x1::account::OriginatingAddress\",\n options,\n });\n\n const {\n address_map: { handle },\n } = resource;\n\n const authKeyAddress = AccountAddress.from(authenticationKey);\n\n // If the address is not found in the address map, which means its not rotated\n // then return the address as is\n try {\n const originalAddress = await getTableItem<string>({\n aptosConfig,\n handle,\n data: {\n key: authKeyAddress.toString(),\n key_type: \"address\",\n value_type: \"address\",\n },\n options,\n });\n\n return AccountAddress.from(originalAddress);\n } catch (err) {\n if (err instanceof AptosApiError && err.data.error_code === \"table_item_not_found\") {\n return authKeyAddress;\n }\n\n throw err;\n }\n}\n\nexport async function getAccountTokensCount(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, accountAddress } = args;\n\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: { owner_address: { _eq: string }; amount: { _gt: number } } = {\n owner_address: { _eq: address },\n amount: { _gt: 0 },\n };\n\n const graphqlQuery = {\n query: GetAccountTokensCount,\n variables: { where_condition: whereCondition },\n };\n\n const data = await queryIndexer<GetAccountTokensCountQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountTokensCount\",\n });\n\n // commonjs (aka cjs) doesnt handle Nullish Coalescing for some reason\n // might be because of how ts infer the graphql generated scheme type\n return data.current_token_ownerships_v2_aggregate.aggregate\n ? data.current_token_ownerships_v2_aggregate.aggregate.count\n : 0;\n}\n\nexport async function getAccountOwnedTokens(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensQueryResponse[0]>;\n}): Promise<GetAccountOwnedTokensQueryResponse> {\n const { aptosConfig, accountAddress, options } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: { owner_address: { _eq: string }; amount: { _gt: number }; token_standard?: { _eq: string } } =\n {\n owner_address: { _eq: address },\n amount: { _gt: 0 },\n };\n\n if (options?.tokenStandard) {\n whereCondition.token_standard = { _eq: options?.tokenStandard };\n }\n\n const graphqlQuery = {\n query: GetAccountOwnedTokens,\n variables: {\n where_condition: whereCondition,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetAccountOwnedTokensQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountOwnedTokens\",\n });\n\n return data.current_token_ownerships_v2;\n}\n\nexport async function getAccountOwnedTokensFromCollectionAddress(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n collectionAddress: AccountAddressInput;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensFromCollectionResponse[0]>;\n}): Promise<GetAccountOwnedTokensFromCollectionResponse> {\n const { aptosConfig, accountAddress, collectionAddress, options } = args;\n const ownerAddress = AccountAddress.from(accountAddress).toStringLong();\n const collAddress = AccountAddress.from(collectionAddress).toStringLong();\n\n const whereCondition: {\n owner_address: { _eq: string };\n current_token_data: { collection_id: { _eq: string } };\n amount: { _gt: number };\n token_standard?: { _eq: string };\n } = {\n owner_address: { _eq: ownerAddress },\n current_token_data: { collection_id: { _eq: collAddress } },\n amount: { _gt: 0 },\n };\n\n if (options?.tokenStandard) {\n whereCondition.token_standard = { _eq: options?.tokenStandard };\n }\n\n const graphqlQuery = {\n query: GetAccountOwnedTokensFromCollection,\n variables: {\n where_condition: whereCondition,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetAccountOwnedTokensFromCollectionQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountOwnedTokensFromCollectionAddress\",\n });\n\n return data.current_token_ownerships_v2;\n}\n\nexport async function getAccountCollectionsWithOwnedTokens(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountCollectionsWithOwnedTokenResponse[0]>;\n}): Promise<GetAccountCollectionsWithOwnedTokenResponse> {\n const { aptosConfig, accountAddress, options } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: {\n owner_address: { _eq: string };\n current_collection?: { token_standard: { _eq: string } };\n } = {\n owner_address: { _eq: address },\n };\n\n if (options?.tokenStandard) {\n whereCondition.current_collection = {\n token_standard: { _eq: options?.tokenStandard },\n };\n }\n\n const graphqlQuery = {\n query: GetAccountCollectionsWithOwnedTokens,\n variables: {\n where_condition: whereCondition,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetAccountCollectionsWithOwnedTokensQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountCollectionsWithOwnedTokens\",\n });\n\n return data.current_collection_ownership_v2_view;\n}\n\nexport async function getAccountTransactionsCount(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, accountAddress } = args;\n\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const graphqlQuery = {\n query: GetAccountTransactionsCount,\n variables: { address },\n };\n\n const data = await queryIndexer<GetAccountTransactionsCountQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountTransactionsCount\",\n });\n\n // commonjs (aka cjs) doesnt handle Nullish Coalescing for some reason\n // might be because of how ts infer the graphql generated scheme type\n return data.account_transactions_aggregate.aggregate ? data.account_transactions_aggregate.aggregate.count : 0;\n}\n\nexport async function getAccountCoinAmount(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n coinType?: MoveStructId;\n faMetadataAddress?: AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, accountAddress, coinType, faMetadataAddress } = args;\n let coinAssetType: string | undefined;\n let faAddress: string;\n\n if (coinType !== undefined && faMetadataAddress !== undefined) {\n faAddress = AccountAddress.from(faMetadataAddress).toStringLong();\n } else if (coinType !== undefined && faMetadataAddress === undefined) {\n coinAssetType = coinType;\n // TODO Move to a separate function as defined in the AIP for coin migration\n if (args.coinType === APTOS_COIN) {\n faAddress = AccountAddress.A.toStringLong();\n } else {\n faAddress = createObjectAddress(AccountAddress.A, coinType).toStringLong();\n }\n } else if (coinType === undefined && faMetadataAddress !== undefined) {\n // TODO: add a view function lookup for non-APT migrated coins\n const addr = AccountAddress.from(faMetadataAddress);\n faAddress = addr.toStringLong();\n if (addr === AccountAddress.A) {\n coinAssetType = APTOS_COIN;\n }\n } else {\n throw new Error(\"Either coinType, fungibleAssetAddress, or both must be provided\");\n }\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n // Search by fungible asset address, unless it has a coin it migrated from\n let where: any = { asset_type: { _eq: faAddress } };\n if (coinType !== undefined) {\n where = { asset_type: { _in: [coinAssetType, faAddress] } };\n }\n\n const data = await getAccountCoinsData({\n aptosConfig,\n accountAddress: address,\n options: {\n where,\n },\n });\n\n // commonjs (aka cjs) doesnt handle Nullish Coalescing for some reason\n // might be because of how ts infer the graphql generated scheme type\n return data[0] ? data[0].amount : 0;\n}\n\nexport async function getAccountCoinsData(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & OrderByArg<GetAccountCoinsDataResponse[0]> & WhereArg<CurrentFungibleAssetBalancesBoolExp>;\n}): Promise<GetAccountCoinsDataResponse> {\n const { aptosConfig, accountAddress, options } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: { owner_address: { _eq: string } } = {\n ...options?.where,\n owner_address: { _eq: address },\n };\n\n const graphqlQuery = {\n query: GetAccountCoinsData,\n variables: {\n where_condition: whereCondition,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetAccountCoinsDataQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountCoinsData\",\n });\n\n return data.current_fungible_asset_balances;\n}\n\nexport async function getAccountCoinsCount(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, accountAddress } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const graphqlQuery = {\n query: GetAccountCoinsCount,\n variables: { address },\n };\n\n const data = await queryIndexer<GetAccountCoinsCountQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountCoinsCount\",\n });\n\n if (!data.current_fungible_asset_balances_aggregate.aggregate) {\n throw Error(\"Failed to get the count of account coins\");\n }\n\n return data.current_fungible_asset_balances_aggregate.aggregate.count;\n}\n\nexport async function getAccountOwnedObjects(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & OrderByArg<GetObjectDataQueryResponse[0]>;\n}): Promise<GetObjectDataQueryResponse> {\n const { aptosConfig, accountAddress, options } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: { owner_address: { _eq: string } } = {\n owner_address: { _eq: address },\n };\n const graphqlQuery = {\n query: GetObjectData,\n variables: {\n where_condition: whereCondition,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n const data = await queryIndexer<GetObjectDataQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountOwnedObjects\",\n });\n\n return data.current_objects;\n}\n\n/**\n * NOTE: There is a potential issue once unified single signer scheme will be adopted\n * by the community.\n *\n * Becuase on could create 2 accounts with the same private key with this new authenticator type,\n * we’ll need to determine the order in which we lookup the accounts. First unified\n * scheme and then legacy scheme vs first legacy scheme and then unified scheme.\n *\n */\nexport async function deriveAccountFromPrivateKey(args: {\n aptosConfig: AptosConfig;\n privateKey: PrivateKey;\n}): Promise<Account> {\n const { aptosConfig, privateKey } = args;\n const publicKey = new AnyPublicKey(privateKey.publicKey());\n\n if (privateKey instanceof Secp256k1PrivateKey) {\n // private key is secp256k1, therefore we know it for sure uses a single signer key\n const authKey = AuthenticationKey.fromPublicKey({ publicKey });\n const address = authKey.derivedAddress();\n return Account.fromPrivateKey({ privateKey, address });\n }\n\n if (privateKey instanceof Ed25519PrivateKey) {\n // lookup single sender ed25519\n const singleSenderTransactionAuthenticatorAuthKey = AuthenticationKey.fromPublicKey({\n publicKey,\n });\n const isSingleSenderTransactionAuthenticator = await isAccountExist({\n authKey: singleSenderTransactionAuthenticatorAuthKey,\n aptosConfig,\n });\n if (isSingleSenderTransactionAuthenticator) {\n const address = singleSenderTransactionAuthenticatorAuthKey.derivedAddress();\n return Account.fromPrivateKey({ privateKey, address, legacy: false });\n }\n // lookup legacy ed25519\n const legacyAuthKey = AuthenticationKey.fromPublicKey({\n publicKey: publicKey.publicKey as Ed25519PublicKey,\n });\n const isLegacyEd25519 = await isAccountExist({ authKey: legacyAuthKey, aptosConfig });\n if (isLegacyEd25519) {\n const address = legacyAuthKey.derivedAddress();\n return Account.fromPrivateKey({ privateKey, address, legacy: true });\n }\n }\n // if we are here, it means we couldn't find an address with an\n // auth key that matches the provided private key\n throw new Error(`Can't derive account from private key ${privateKey}`);\n}\n\nexport async function isAccountExist(args: { aptosConfig: AptosConfig; authKey: AuthenticationKey }): Promise<boolean> {\n const { aptosConfig, authKey } = args;\n const accountAddress = await lookupOriginalAccountAddress({\n aptosConfig,\n authenticationKey: authKey.derivedAddress(),\n });\n\n try {\n await getInfo({\n aptosConfig,\n accountAddress,\n });\n return true;\n } catch (error: any) {\n // account not found\n if (error.status === 404) {\n return false;\n }\n throw new Error(`Error while looking for an account info ${accountAddress.toString()}`);\n }\n}\n"],"mappings":"snBA2DA,eAAsBA,EAAQC,EAGL,CACvB,GAAM,CAAE,YAAAC,EAAa,eAAAC,CAAe,EAAIF,EAClC,CAAE,KAAAG,CAAK,EAAI,MAAMC,EAAkC,CACvD,YAAAH,EACA,aAAc,UACd,KAAM,YAAYI,EAAe,KAAKH,CAAc,EAAE,SAAS,CAAC,EAClE,CAAC,EACD,OAAOC,CACT,CAEA,eAAsBG,EAAWN,EAIC,CAChC,GAAM,CAAE,YAAAC,EAAa,eAAAC,EAAgB,QAAAK,CAAQ,EAAIP,EACjD,OAAOQ,EAA6C,CAClD,YAAAP,EACA,aAAc,aACd,KAAM,YAAYI,EAAe,KAAKH,CAAc,EAAE,SAAS,CAAC,WAChE,OAAQ,CACN,eAAgBK,GAAS,cACzB,MAAOA,GAAS,OAChB,MAAOA,GAAS,OAAS,GAC3B,CACF,CAAC,CACH,CAUA,e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AAsBQ,EAAenE,EAAkF,CACrH,GAAM,CAAE,YAAAC,EAAa,QAAAoE,CAAQ,EAAIrE,EAC3BE,EAAiB,MAAMe,EAA6B,CACxD,YAAAhB,EACA,kBAAmBoE,EAAQ,eAAe,CAC5C,CAAC,EAED,GAAI,CACF,aAAMtE,EAAQ,CACZ,YAAAE,EACA,eAAAC,CACF,CAAC,EACM,EACT,OAASoE,EAAY,CAEnB,GAAIA,EAAM,SAAW,IACnB,MAAO,GAET,MAAM,IAAI,MAAM,2CAA2CpE,EAAe,SAAS,CAAC,EAAE,CACxF,CACF","names":["getInfo","args","aptosConfig","accountAddress","data","getAptosFullNode","AccountAddress","getModules","options","paginateWithCursor","getModule","getModuleInner","memoizeAsync","moduleName","getTransactions","getResources","getResource","resourceType","lookupOriginalAccountAddress","authenticationKey","resource","handle","authKeyAddress","originalAddress","getTableItem","err","AptosApiError","getAccountTokensCount","whereCondition","queryIndexer","GetAccountTokensCount","getAccountOwnedTokens","graphqlQuery","GetAccountOwnedTokens","getAccountOwnedTokensFromCollectionAddress","collectionAddress","ownerAddress","collAddress","GetAccountOwnedTokensFromCollection","getAccountCollectionsWithOwnedTokens","GetAccountCollectionsWithOwnedTokens","getAccountTransactionsCount","address","GetAccountTransactionsCount","getAccountCoinAmount","coinType","faMetadataAddress","coinAssetType","faAddress","APTOS_COIN","createObjectAddress","addr","where","getAccountCoinsData","GetAccountCoinsData","getAccountCoinsCount","GetAccountCoinsCount","getAccountOwnedObjects","GetObjectData","deriveAccountFromPrivateKey","privateKey","publicKey","AnyPublicKey","Secp256k1PrivateKey","AuthenticationKey","Account","Ed25519PrivateKey","singleSenderTransactionAuthenticatorAuthKey","isAccountExist","legacyAuthKey","authKey","error"]}
@@ -1,2 +0,0 @@
1
- import{a as l,b as s,c as u,d as c,e as d,f as m,g as U}from"./chunk-YPHH6CAO.mjs";import{a as o}from"./chunk-A63SMUOU.mjs";import{b as w}from"./chunk-BCUSI3N6.mjs";var t=class n extends o{constructor(e){super(),this.values=e}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){if(!(this.values[0]instanceof s)&&this.values[0]!==void 0)throw new Error("Script function arguments only accept u8 vectors");e.serializeU32AsUleb128(4),e.serialize(this)}static U8(e){let r;if(Array.isArray(e)&&e.length===0)r=[];else if(Array.isArray(e)&&typeof e[0]=="number")r=e;else if(typeof e=="string"){let i=w.fromHexInput(e);r=Array.from(i.toUint8Array())}else if(e instanceof Uint8Array)r=Array.from(e);else throw new Error("Invalid input type, must be an number[], Uint8Array, or hex string");return new n(r.map(i=>new s(i)))}static U16(e){return new n(e.map(r=>new u(r)))}static U32(e){return new n(e.map(r=>new c(r)))}static U64(e){return new n(e.map(r=>new d(r)))}static U128(e){return new n(e.map(r=>new m(r)))}static U256(e){return new n(e.map(r=>new U(r)))}static Bool(e){return new n(e.map(r=>new l(r)))}static MoveString(e){return new n(e.map(r=>new a(r)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,r){let i=e.deserializeUleb128AsU32(),y=new Array;for(let p=0;p<i;p+=1)y.push(r.deserialize(e));return new n(y)}},a=class n extends o{constructor(e){super(),this.value=e}serialize(e){e.serializeStr(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){let r=this.bcsToBytes().slice(1);t.U8(r).serializeForScriptFunction(e)}static deserialize(e){return new n(e.deserializeStr())}},z=class n extends o{constructor(e){super(),typeof e<"u"&&e!==null?this.vec=new t([e]):this.vec=new t([]),[this.value]=this.vec.values}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}unwrap(){if(this.isSome())return this.vec.values[0];throw new Error("Called unwrap on a MoveOption with no value")}isSome(){return this.vec.values.length===1}serialize(e){this.vec.serialize(e)}static U8(e){return new n(e!=null?new s(e):void 0)}static U16(e){return new n(e!=null?new u(e):void 0)}static U32(e){return new n(e!=null?new c(e):void 0)}static U64(e){return new n(e!=null?new d(e):void 0)}static U128(e){return new n(e!=null?new m(e):void 0)}static U256(e){return new n(e!=null?new U(e):void 0)}static Bool(e){return new n(e!=null?new l(e):void 0)}static MoveString(e){return new n(e!=null?new a(e):void 0)}static deserialize(e,r){let i=t.deserialize(e,r);return new n(i.values[0])}};export{t as a,a as b,z as c};
2
- //# sourceMappingURL=chunk-KMJ6TF6Y.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/bcs/serializable/moveStructs.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Bool, U128, U16, U256, U32, U64, U8 } from \"./movePrimitives\";\nimport { Serializable, Serializer } from \"../serializer\";\nimport { Deserializable, Deserializer } from \"../deserializer\";\nimport { AnyNumber, HexInput, ScriptTransactionArgumentVariants } from \"../../types\";\nimport { Hex } from \"../../core/hex\";\nimport { EntryFunctionArgument, TransactionArgument } from \"../../transactions/instances/transactionArgument\";\n\n/**\n * This class is the Aptos Typescript SDK representation of a Move `vector<T>`,\n * where `T` represents either a primitive type (`bool`, `u8`, `u64`, ...)\n * or a BCS-serializable struct itself.\n *\n * It is a BCS-serializable, array-like type that contains an array of values of type `T`,\n * where `T` is a class that implements `Serializable`.\n *\n * The purpose of this class is to facilitate easy construction of BCS-serializable\n * Move `vector<T>` types.\n *\n * @example\n * // in Move: `vector<u8> [1, 2, 3, 4];`\n * const vecOfU8s = new MoveVector<U8>([new U8(1), new U8(2), new U8(3), new U8(4)]);\n * // in Move: `std::bcs::to_bytes(vector<u8> [1, 2, 3, 4]);`\n * const bcsBytes = vecOfU8s.toUint8Array();\n *\n * // vector<vector<u8>> [ vector<u8> [1], vector<u8> [1, 2, 3, 4], vector<u8> [5, 6, 7, 8] ];\n * const vecOfVecs = new MoveVector<MoveVector<U8>>([\n * new MoveVector<U8>([new U8(1)]),\n * MoveVector.U8([1, 2, 3, 4]),\n * MoveVector.U8([5, 6, 7, 8]),\n * ]);\n *\n * // vector<Option<u8>> [ std::option::some<u8>(1), std::option::some<u8>(2) ];\n * const vecOfOptionU8s = new MoveVector<MoveOption<U8>>([\n * MoveOption.U8(1),\n * MoveOption.U8(2),\n * ]);\n *\n * // vector<MoveString> [ std::string::utf8(b\"hello\"), std::string::utf8(b\"world\") ];\n * const vecOfStrings = new MoveVector([new MoveString(\"hello\"), new MoveString(\"world\")]);\n * const vecOfStrings2 = MoveVector.MoveString([\"hello\", \"world\"]);\n *\n * @params\n * values: an Array<T> of values where T is a class that implements Serializable\n * @returns a `MoveVector<T>` with the values `values`\n */\nexport class MoveVector<T extends Serializable & EntryFunctionArgument>\n extends Serializable\n implements TransactionArgument\n{\n public values: Array<T>;\n\n constructor(values: Array<T>) {\n super();\n this.values = values;\n }\n\n serializeForEntryFunction(serializer: Serializer): void {\n const bcsBytes = this.bcsToBytes();\n serializer.serializeBytes(bcsBytes);\n }\n\n /**\n * NOTE: This function will only work when the inner values in the `MoveVector` are `U8`s.\n * @param serializer\n */\n serializeForScriptFunction(serializer: Serializer): void {\n // runtime check to ensure that you can't serialize anything other than vector<u8>\n const isU8 = this.values[0] instanceof U8;\n // if the inner array is length 0, we can't check the type because it has no instance, so we assume it's a u8\n // it may not be, but we don't care because regardless of a vector's type,\n // a zero-length vector is serialized to a single byte value: 0\n if (!isU8 && this.values[0] !== undefined) {\n throw new Error(\"Script function arguments only accept u8 vectors\");\n }\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.U8Vector);\n serializer.serialize(this);\n }\n\n /**\n * Factory method to generate a MoveVector of U8s from an array of numbers.\n *\n * @example\n * const v = MoveVector.U8([1, 2, 3, 4]);\n * @params values: an array of `numbers` to convert to U8s\n * @returns a `MoveVector<U8>`\n */\n static U8(values: Array<number> | HexInput): MoveVector<U8> {\n let numbers: Array<number>;\n\n if (Array.isArray(values) && values.length === 0) {\n // Handle empty array, since it won't have a \"first value\"\n numbers = [];\n } else if (Array.isArray(values) && typeof values[0] === \"number\") {\n numbers = values;\n } else if (typeof values === \"string\") {\n const hex = Hex.fromHexInput(values);\n numbers = Array.from(hex.toUint8Array());\n } else if (values instanceof Uint8Array) {\n numbers = Array.from(values);\n } else {\n throw new Error(\"Invalid input type, must be an number[], Uint8Array, or hex string\");\n }\n\n return new MoveVector<U8>(numbers.map((v) => new U8(v)));\n }\n\n /**\n * Factory method to generate a MoveVector of U16s from an array of numbers.\n *\n * @example\n * const v = MoveVector.U16([1, 2, 3, 4]);\n * @params values: an array of `numbers` to convert to U16s\n * @returns a `MoveVector<U16>`\n */\n static U16(values: Array<number>): MoveVector<U16> {\n return new MoveVector<U16>(values.map((v) => new U16(v)));\n }\n\n /**\n * Factory method to generate a MoveVector of U32s from an array of numbers.\n *\n * @example\n * const v = MoveVector.U32([1, 2, 3, 4]);\n * @params values: an array of `numbers` to convert to U32s\n * @returns a `MoveVector<U32>`\n */\n static U32(values: Array<number>): MoveVector<U32> {\n return new MoveVector<U32>(values.map((v) => new U32(v)));\n }\n\n /**\n * Factory method to generate a MoveVector of U64s from an array of numbers or bigints.\n *\n * @example\n * const v = MoveVector.U64([1, 2, 3, 4]);\n * @params values: an array of numbers of type `number | bigint` to convert to U64s\n * @returns a `MoveVector<U64>`\n */\n static U64(values: Array<AnyNumber>): MoveVector<U64> {\n return new MoveVector<U64>(values.map((v) => new U64(v)));\n }\n\n /**\n * Factory method to generate a MoveVector of U128s from an array of numbers or bigints.\n *\n * @example\n * const v = MoveVector.U128([1, 2, 3, 4]);\n * @params values: an array of numbers of type `number | bigint` to convert to U128s\n * @returns a `MoveVector<U128>`\n */\n static U128(values: Array<AnyNumber>): MoveVector<U128> {\n return new MoveVector<U128>(values.map((v) => new U128(v)));\n }\n\n /**\n * Factory method to generate a MoveVector of U256s from an array of numbers or bigints.\n *\n * @example\n * const v = MoveVector.U256([1, 2, 3, 4]);\n * @params values: an array of numbers of type `number | bigint` to convert to U256s\n * @returns a `MoveVector<U256>`\n */\n static U256(values: Array<AnyNumber>): MoveVector<U256> {\n return new MoveVector<U256>(values.map((v) => new U256(v)));\n }\n\n /**\n * Factory method to generate a MoveVector of Bools from an array of booleans.\n *\n * @example\n * const v = MoveVector.Bool([true, false, true, false]);\n * @params values: an array of `bools` to convert to Bools\n * @returns a `MoveVector<Bool>`\n */\n static Bool(values: Array<boolean>): MoveVector<Bool> {\n return new MoveVector<Bool>(values.map((v) => new Bool(v)));\n }\n\n /**\n * Factory method to generate a MoveVector of MoveStrings from an array of strings.\n *\n * @example\n * const v = MoveVector.MoveString([\"hello\", \"world\"]);\n * @params values: an array of `strings` to convert to MoveStrings\n * @returns a `MoveVector<MoveString>`\n */\n static MoveString(values: Array<string>): MoveVector<MoveString> {\n return new MoveVector<MoveString>(values.map((v) => new MoveString(v)));\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeVector(this.values);\n }\n\n /**\n * Deserialize a MoveVector of type T, specifically where T is a Serializable and Deserializable type.\n *\n * NOTE: This only works with a depth of one. Generics will not work.\n *\n * NOTE: This will not work with types that aren't of the Serializable class.\n *\n * If you're looking for a more flexible deserialization function, you can use the deserializeVector function\n * in the Deserializer class.\n *\n * @example\n * const vec = MoveVector.deserialize(deserializer, U64);\n * @params deserializer: the Deserializer instance to use, with bytes loaded into it already.\n * cls: the class to typecast the input values to, must be a Serializable and Deserializable type.\n * @returns a MoveVector of the corresponding class T\n * *\n */\n static deserialize<T extends Serializable & EntryFunctionArgument>(\n deserializer: Deserializer,\n cls: Deserializable<T>,\n ): MoveVector<T> {\n const length = deserializer.deserializeUleb128AsU32();\n const values = new Array<T>();\n for (let i = 0; i < length; i += 1) {\n values.push(cls.deserialize(deserializer));\n }\n return new MoveVector(values);\n }\n}\n\nexport class MoveString extends Serializable implements TransactionArgument {\n public value: string;\n\n constructor(value: string) {\n super();\n this.value = value;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeStr(this.value);\n }\n\n serializeForEntryFunction(serializer: Serializer): void {\n const bcsBytes = this.bcsToBytes();\n serializer.serializeBytes(bcsBytes);\n }\n\n serializeForScriptFunction(serializer: Serializer): void {\n // Serialize the string as a fixed byte string, i.e., without the length prefix\n const fixedStringBytes = this.bcsToBytes().slice(1);\n // Put those bytes into a vector<u8> and serialize it as a script function argument\n const vectorU8 = MoveVector.U8(fixedStringBytes);\n vectorU8.serializeForScriptFunction(serializer);\n }\n\n static deserialize(deserializer: Deserializer): MoveString {\n return new MoveString(deserializer.deserializeStr());\n }\n}\n\nexport class MoveOption<T extends Serializable & EntryFunctionArgument>\n extends Serializable\n implements EntryFunctionArgument\n{\n private vec: MoveVector<T>;\n\n public readonly value?: T;\n\n constructor(value?: T | null) {\n super();\n if (typeof value !== \"undefined\" && value !== null) {\n this.vec = new MoveVector([value]);\n } else {\n this.vec = new MoveVector([]);\n }\n\n [this.value] = this.vec.values;\n }\n\n serializeForEntryFunction(serializer: Serializer): void {\n const bcsBytes = this.bcsToBytes();\n serializer.serializeBytes(bcsBytes);\n }\n\n /**\n * Retrieves the inner value of the MoveOption.\n *\n * This method is inspired by Rust's `Option<T>.unwrap()`.\n * In Rust, attempting to unwrap a `None` value results in a panic.\n *\n * Similarly, this method will throw an error if the value is not present.\n *\n * @example\n * const option = new MoveOption<Bool>(new Bool(true));\n * const value = option.unwrap(); // Returns the Bool instance\n *\n * @throws {Error} Throws an error if the MoveOption does not contain a value.\n *\n * @returns {T} The contained value if present.\n */\n unwrap(): T {\n if (!this.isSome()) {\n throw new Error(\"Called unwrap on a MoveOption with no value\");\n } else {\n return this.vec.values[0];\n }\n }\n\n // Check if the MoveOption has a value.\n isSome(): boolean {\n return this.vec.values.length === 1;\n }\n\n serialize(serializer: Serializer): void {\n // serialize 0 or 1\n // if 1, serialize the value\n this.vec.serialize(serializer);\n }\n\n /**\n * Factory method to generate a MoveOption<U8> from a `number` or `undefined`.\n *\n * @example\n * MoveOption.U8(1).isSome() === true;\n * MoveOption.U8().isSome() === false;\n * MoveOption.U8(undefined).isSome() === false;\n * @params value: the value used to fill the MoveOption. If `value` is undefined\n * the resulting MoveOption's .isSome() method will return false.\n * @returns a MoveOption<U8> with an inner value `value`\n */\n static U8(value?: number | null): MoveOption<U8> {\n return new MoveOption<U8>(value !== null && value !== undefined ? new U8(value) : undefined);\n }\n\n /**\n * Factory method to generate a MoveOption<U16> from a `number` or `undefined`.\n *\n * @example\n * MoveOption.U16(1).isSome() === true;\n * MoveOption.U16().isSome() === false;\n * MoveOption.U16(undefined).isSome() === false;\n * @params value: the value used to fill the MoveOption. If `value` is undefined\n * the resulting MoveOption's .isSome() method will return false.\n * @returns a MoveOption<U16> with an inner value `value`\n */\n static U16(value?: number | null): MoveOption<U16> {\n return new MoveOption<U16>(value !== null && value !== undefined ? new U16(value) : undefined);\n }\n\n /**\n * Factory method to generate a MoveOption<U32> from a `number` or `undefined`.\n *\n * @example\n * MoveOption.U32(1).isSome() === true;\n * MoveOption.U32().isSome() === false;\n * MoveOption.U32(undefined).isSome() === false;\n * @params value: the value used to fill the MoveOption. If `value` is undefined\n * the resulting MoveOption's .isSome() method will return false.\n * @returns a MoveOption<U32> with an inner value `value`\n */\n static U32(value?: number | null): MoveOption<U32> {\n return new MoveOption<U32>(value !== null && value !== undefined ? new U32(value) : undefined);\n }\n\n /**\n * Factory method to generate a MoveOption<U64> from a `number` or a `bigint` or `undefined`.\n *\n * @example\n * MoveOption.U64(1).isSome() === true;\n * MoveOption.U64().isSome() === false;\n * MoveOption.U64(undefined).isSome() === false;\n * @params value: the value used to fill the MoveOption. If `value` is undefined\n * the resulting MoveOption's .isSome() method will return false.\n * @returns a MoveOption<U64> with an inner value `value`\n */\n static U64(value?: AnyNumber | null): MoveOption<U64> {\n return new MoveOption<U64>(value !== null && value !== undefined ? new U64(value) : undefined);\n }\n\n /**\n * Factory method to generate a MoveOption<U128> from a `number` or a `bigint` or `undefined`.\n *\n * @example\n * MoveOption.U128(1).isSome() === true;\n * MoveOption.U128().isSome() === false;\n * MoveOption.U128(undefined).isSome() === false;\n * @params value: the value used to fill the MoveOption. If `value` is undefined\n * the resulting MoveOption's .isSome() method will return false.\n * @returns a MoveOption<U128> with an inner value `value`\n */\n static U128(value?: AnyNumber | null): MoveOption<U128> {\n return new MoveOption<U128>(value !== null && value !== undefined ? new U128(value) : undefined);\n }\n\n /**\n * Factory method to generate a MoveOption<U256> from a `number` or a `bigint` or `undefined`.\n *\n * @example\n * MoveOption.U256(1).isSome() === true;\n * MoveOption.U256().isSome() === false;\n * MoveOption.U256(undefined).isSome() === false;\n * @params value: the value used to fill the MoveOption. If `value` is undefined\n * the resulting MoveOption's .isSome() method will return false.\n * @returns a MoveOption<U256> with an inner value `value`\n */\n static U256(value?: AnyNumber | null): MoveOption<U256> {\n return new MoveOption<U256>(value !== null && value !== undefined ? new U256(value) : undefined);\n }\n\n /**\n * Factory method to generate a MoveOption<Bool> from a `boolean` or `undefined`.\n *\n * @example\n * MoveOption.Bool(true).isSome() === true;\n * MoveOption.Bool().isSome() === false;\n * MoveOption.Bool(undefined).isSome() === false;\n * @params value: the value used to fill the MoveOption. If `value` is undefined\n * the resulting MoveOption's .isSome() method will return false.\n * @returns a MoveOption<Bool> with an inner value `value`\n */\n static Bool(value?: boolean | null): MoveOption<Bool> {\n return new MoveOption<Bool>(value !== null && value !== undefined ? new Bool(value) : undefined);\n }\n\n /**\n * Factory method to generate a MoveOption<MoveString> from a `string` or `undefined`.\n *\n * @example\n * MoveOption.MoveString(\"hello\").isSome() === true;\n * MoveOption.MoveString(\"\").isSome() === true;\n * MoveOption.MoveString().isSome() === false;\n * MoveOption.MoveString(undefined).isSome() === false;\n * @params value: the value used to fill the MoveOption. If `value` is undefined\n * the resulting MoveOption's .isSome() method will return false.\n * @returns a MoveOption<MoveString> with an inner value `value`\n */\n static MoveString(value?: string | null): MoveOption<MoveString> {\n return new MoveOption<MoveString>(value !== null && value !== undefined ? new MoveString(value) : undefined);\n }\n\n static deserialize<U extends Serializable & EntryFunctionArgument>(\n deserializer: Deserializer,\n cls: Deserializable<U>,\n ): MoveOption<U> {\n const vector = MoveVector.deserialize(deserializer, cls);\n return new MoveOption(vector.values[0]);\n }\n}\n"],"mappings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G,CAcA,OAAO,WAAWA,EAA+C,CAC/D,OAAO,IAAIG,EAAuBH,GAAU,KAA8B,IAAIN,EAAWM,CAAK,EAAI,MAAS,CAC7G,CAEA,OAAO,YACLL,EACAC,EACe,CACf,IAAMQ,EAAS3B,EAAW,YAAYkB,EAAcC,CAAG,EACvD,OAAO,IAAIO,EAAWC,EAAO,OAAO,CAAC,CAAC,CACxC,CACF","names":["MoveVector","_MoveVector","Serializable","values","serializer","bcsBytes","U8","numbers","hex","Hex","v","U16","U32","U64","U128","U256","Bool","MoveString","deserializer","cls","length","i","_MoveString","value","fixedStringBytes","MoveOption","_MoveOption","vector"]}
@@ -1,2 +0,0 @@
1
- var S=(O=>(O.FULLNODE="Fullnode",O.INDEXER="Indexer",O.FAUCET="Faucet",O.PEPPER="Pepper",O.PROVER="Prover",O))(S||{}),R=2e5,t=20,n=20,o="0x1::aptos_coin::AptosCoin",T="APTOS::RawTransaction",A="APTOS::RawTransactionWithData",E=(_=>(_.ACCOUNT_TRANSACTION_PROCESSOR="account_transactions_processor",_.DEFAULT="default_processor",_.EVENTS_PROCESSOR="events_processor",_.FUNGIBLE_ASSET_PROCESSOR="fungible_asset_processor",_.STAKE_PROCESSOR="stake_processor",_.TOKEN_V2_PROCESSOR="token_v2_processor",_.USER_TRANSACTION_PROCESSOR="user_transaction_processor",_.OBJECT_PROCESSOR="objects_processor",_))(E||{});export{S as a,R as b,t as c,n as d,o as e,T as f,A as g,E as h};
2
- //# sourceMappingURL=chunk-L36ZHC7J.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/const.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Type of API endpoint for request routing\n */\nexport enum AptosApiType {\n FULLNODE = \"Fullnode\",\n INDEXER = \"Indexer\",\n FAUCET = \"Faucet\",\n PEPPER = \"Pepper\",\n PROVER = \"Prover\",\n}\n\n/**\n * The default max gas amount when none is given.\n *\n * This is the maximum number of gas units that will be used by a transaction before being rejected.\n *\n * Note that max gas amount varies based on the transaction. A larger transaction will go over this\n * default gas amount, and the value will need to be changed for the specific transaction.\n */\nexport const DEFAULT_MAX_GAS_AMOUNT = 200000;\n\n/**\n * The default transaction expiration seconds from now.\n *\n * This time is how long until the blockchain nodes will reject the transaction.\n *\n * Note that the transaction expiration time varies based on network connection and network load. It may need to be\n * increased for the transaction to be processed.\n */\nexport const DEFAULT_TXN_EXP_SEC_FROM_NOW = 20;\n\n/**\n * The default number of seconds to wait for a transaction to be processed.\n *\n * This time is the amount of time that the SDK will wait for a transaction to be processed when waiting for\n * the results of the transaction. It may take longer based on network connection and network load.\n */\nexport const DEFAULT_TXN_TIMEOUT_SEC = 20;\n\n/**\n * The default gas currency for the network.\n */\nexport const APTOS_COIN = \"0x1::aptos_coin::AptosCoin\";\n\nexport const RAW_TRANSACTION_SALT = \"APTOS::RawTransaction\";\nexport const RAW_TRANSACTION_WITH_DATA_SALT = \"APTOS::RawTransactionWithData\";\n\n/**\n * The list of supported Processor types for our indexer api.\n *\n * These can be found from the processor_status table in the indexer database.\n * {@link https://cloud.hasura.io/public/graphiql?endpoint=https://api.mainnet.aptoslabs.com/v1/graphql}\n */\nexport enum ProcessorType {\n ACCOUNT_TRANSACTION_PROCESSOR = \"account_transactions_processor\",\n DEFAULT = \"default_processor\",\n EVENTS_PROCESSOR = \"events_processor\",\n // Fungible asset processor also handles coins\n FUNGIBLE_ASSET_PROCESSOR = \"fungible_asset_processor\",\n STAKE_PROCESSOR = \"stake_processor\",\n // Token V2 processor replaces Token processor (not only for digital assets)\n TOKEN_V2_PROCESSOR = \"token_v2_processor\",\n USER_TRANSACTION_PROCESSOR = \"user_transaction_processor\",\n OBJECT_PROCESSOR = \"objects_processor\",\n}\n"],"mappings":"AAMO,IAAKA,OACVA,EAAA,SAAW,WACXA,EAAA,QAAU,UACVA,EAAA,OAAS,SACTA,EAAA,OAAS,SACTA,EAAA,OAAS,SALCA,OAAA,IAgBCC,EAAyB,IAUzBC,EAA+B,GAQ/BC,EAA0B,GAK1BC,EAAa,6BAEbC,EAAuB,wBACvBC,EAAiC,gCAQlCC,OACVA,EAAA,8BAAgC,iCAChCA,EAAA,QAAU,oBACVA,EAAA,iBAAmB,mBAEnBA,EAAA,yBAA2B,2BAC3BA,EAAA,gBAAkB,kBAElBA,EAAA,mBAAqB,qBACrBA,EAAA,2BAA6B,6BAC7BA,EAAA,iBAAmB,oBAVTA,OAAA","names":["AptosApiType","DEFAULT_MAX_GAS_AMOUNT","DEFAULT_TXN_EXP_SEC_FROM_NOW","DEFAULT_TXN_TIMEOUT_SEC","APTOS_COIN","RAW_TRANSACTION_SALT","RAW_TRANSACTION_WITH_DATA_SALT","ProcessorType"]}
@@ -1,2 +0,0 @@
1
- import{a as m}from"./chunk-SUJLWCRN.mjs";import{a as g}from"./chunk-YDZBU2DJ.mjs";import{a as p}from"./chunk-YUNDX5I7.mjs";import{b as y}from"./chunk-OHRL766V.mjs";import{a as S}from"./chunk-P5V7OZNN.mjs";import{a as v}from"./chunk-KMJ6TF6Y.mjs";import{a as F,b as d,c as T,d as x,e as E,f as _,g as w}from"./chunk-YPHH6CAO.mjs";import{a as u}from"./chunk-A63SMUOU.mjs";function D(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return d.deserialize(t);case 1:return E.deserialize(t);case 2:return _.deserialize(t);case 3:return y.deserialize(t);case 4:return v.deserialize(t,d);case 5:return F.deserialize(t);case 6:return T.deserialize(t);case 7:return x.deserialize(t);case 8:return w.deserialize(t);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${e}`)}}var a=class extends u{static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return A.load(e);case 2:return z.load(e);case 3:return h.load(e);default:throw new Error(`Unknown variant index for TransactionPayload: ${r}`)}}},A=class t extends a{constructor(e){super(),this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let r=U.deserialize(e);return new t(r)}},z=class t extends a{constructor(e){super(),this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let r=l.deserialize(e);return new t(r)}},h=class t extends a{constructor(e){super(),this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let r=f.deserialize(e);return new t(r)}},l=class t{constructor(e,r,i,n){this.module_name=e,this.function_name=r,this.type_args=i,this.args=n}static build(e,r,i,n){return new t(g.fromStr(e),new p(r),i,n)}serialize(e){this.module_name.serialize(e),this.function_name.serialize(e),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(r=>{r.serializeForEntryFunction(e)})}static deserialize(e){let r=g.deserialize(e),i=p.deserialize(e),n=e.deserializeVector(m),o=e.deserializeUleb128AsU32(),s=new Array;for(let c=0;c<o;c+=1){let M=e.deserializeUleb128AsU32(),B=S.deserialize(e,M);s.push(B)}return new t(r,i,n,s)}},U=class t{constructor(e,r,i){this.bytecode=e,this.type_args=r,this.args=i}serialize(e){e.serializeBytes(this.bytecode),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(r=>{r.serializeForScriptFunction(e)})}static deserialize(e){let r=e.deserializeBytes(),i=e.deserializeVector(m),n=e.deserializeUleb128AsU32(),o=new Array;for(let s=0;s<n;s+=1){let c=D(e);o.push(c)}return new t(r,i,o)}},f=class t{constructor(e,r){this.multisig_address=e,this.transaction_payload=r}serialize(e){this.multisig_address.serialize(e),this.transaction_payload===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.transaction_payload.serialize(e))}static deserialize(e){let r=y.deserialize(e),i=e.deserializeBool(),n;return i&&(n=b.deserialize(e)),new t(r,n)}},b=class t extends u{constructor(e){super(),this.transaction_payload=e}serialize(e){e.serializeU32AsUleb128(0),this.transaction_payload.serialize(e)}static deserialize(e){return e.deserializeUleb128AsU32(),new t(l.deserialize(e))}};export{D as a,a as b,A as c,z as d,h as e,l as f,U as g,f as h,b as i};
2
- //# sourceMappingURL=chunk-LDTF3ABK.mjs.map