@aptos-labs/ts-sdk 1.35.0-zeta.2 → 1.36.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 (596) hide show
  1. package/dist/common/{accountAddress-Ce4Cv60D.d.ts → accountAddress-C685VEzA.d.ts} +11 -99
  2. package/dist/common/chunk-5GUWOXQG.js +4 -0
  3. package/dist/common/chunk-5GUWOXQG.js.map +1 -0
  4. package/dist/common/cli/index.d.ts +1 -1
  5. package/dist/common/cli/index.js +1 -486
  6. package/dist/common/cli/index.js.map +1 -1
  7. package/dist/common/index.d.ts +9105 -8699
  8. package/dist/common/index.js +436 -18333
  9. package/dist/common/index.js.map +1 -1
  10. package/dist/esm/{Ed25519Account-D4j3_WIS.d.mts → Ed25519Account-6KGApCPu.d.mts} +3 -3
  11. package/dist/esm/account/AbstractKeylessAccount.d.mts +23 -13
  12. package/dist/esm/account/AbstractKeylessAccount.mjs +1 -75
  13. package/dist/esm/account/AbstractedAccount.d.mts +10 -10
  14. package/dist/esm/account/AbstractedAccount.mjs +1 -74
  15. package/dist/esm/account/Account.d.mts +6 -6
  16. package/dist/esm/account/Account.mjs +1 -72
  17. package/dist/esm/account/AccountUtils.d.mts +11 -10
  18. package/dist/esm/account/AccountUtils.mjs +1 -78
  19. package/dist/esm/account/Ed25519Account.d.mts +5 -5
  20. package/dist/esm/account/Ed25519Account.mjs +1 -70
  21. package/dist/esm/account/EphemeralKeyPair.d.mts +3 -1
  22. package/dist/esm/account/EphemeralKeyPair.mjs +1 -50
  23. package/dist/esm/account/FederatedKeylessAccount.d.mts +12 -11
  24. package/dist/esm/account/FederatedKeylessAccount.mjs +1 -72
  25. package/dist/esm/account/KeylessAccount.d.mts +12 -11
  26. package/dist/esm/account/KeylessAccount.mjs +1 -72
  27. package/dist/esm/account/MultiEd25519Account.d.mts +9 -9
  28. package/dist/esm/account/MultiEd25519Account.mjs +1 -70
  29. package/dist/esm/account/MultiKeyAccount.d.mts +34 -12
  30. package/dist/esm/account/MultiKeyAccount.mjs +1 -74
  31. package/dist/esm/account/SingleKeyAccount.d.mts +5 -5
  32. package/dist/esm/account/SingleKeyAccount.mjs +1 -72
  33. package/dist/esm/account/index.d.mts +7 -6
  34. package/dist/esm/account/index.mjs +1 -119
  35. package/dist/esm/account/utils.mjs +1 -54
  36. package/dist/esm/api/account/abstraction.d.mts +9 -9
  37. package/dist/esm/api/account/abstraction.mjs +1 -101
  38. package/dist/esm/api/account.d.mts +4 -20
  39. package/dist/esm/api/account.mjs +1 -105
  40. package/dist/esm/api/ans.d.mts +13 -13
  41. package/dist/esm/api/ans.mjs +1 -101
  42. package/dist/esm/api/aptos.d.mts +6 -5
  43. package/dist/esm/api/aptos.mjs +1 -139
  44. package/dist/esm/api/aptosConfig.mjs +1 -9
  45. package/dist/esm/api/coin.d.mts +9 -9
  46. package/dist/esm/api/coin.mjs +1 -100
  47. package/dist/esm/api/digitalAsset.d.mts +5 -5
  48. package/dist/esm/api/digitalAsset.mjs +1 -101
  49. package/dist/esm/api/event.mjs +1 -59
  50. package/dist/esm/api/experimental.d.mts +7 -7
  51. package/dist/esm/api/experimental.mjs +1 -85
  52. package/dist/esm/api/faucet.mjs +1 -58
  53. package/dist/esm/api/fungibleAsset.d.mts +13 -13
  54. package/dist/esm/api/fungibleAsset.mjs +1 -101
  55. package/dist/esm/api/general.d.mts +7 -7
  56. package/dist/esm/api/general.mjs +1 -85
  57. package/dist/esm/api/index.d.mts +6 -5
  58. package/dist/esm/api/index.mjs +1 -143
  59. package/dist/esm/api/keyless.d.mts +20 -19
  60. package/dist/esm/api/keyless.mjs +1 -102
  61. package/dist/esm/api/object.mjs +1 -59
  62. package/dist/esm/api/staking.mjs +1 -59
  63. package/dist/esm/api/table.mjs +1 -38
  64. package/dist/esm/api/transaction.d.mts +4 -4
  65. package/dist/esm/api/transaction.mjs +1 -110
  66. package/dist/esm/api/transactionSubmission/build.d.mts +9 -9
  67. package/dist/esm/api/transactionSubmission/build.mjs +1 -99
  68. package/dist/esm/api/transactionSubmission/helpers.mjs +1 -9
  69. package/dist/esm/api/transactionSubmission/management.d.mts +8 -8
  70. package/dist/esm/api/transactionSubmission/management.mjs +1 -105
  71. package/dist/esm/api/transactionSubmission/sign.d.mts +3 -3
  72. package/dist/esm/api/transactionSubmission/sign.mjs +1 -218
  73. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  74. package/dist/esm/api/transactionSubmission/simulate.d.mts +9 -9
  75. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -100
  76. package/dist/esm/api/transactionSubmission/submit.d.mts +3 -3
  77. package/dist/esm/api/transactionSubmission/submit.mjs +1 -100
  78. package/dist/esm/api/utils.mjs +1 -36
  79. package/dist/esm/bcs/consts.mjs +1 -17
  80. package/dist/esm/bcs/deserializer.mjs +1 -10
  81. package/dist/esm/bcs/index.mjs +1 -60
  82. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -12
  83. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -11
  84. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -26
  85. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -22
  86. package/dist/esm/bcs/serializer.mjs +1 -18
  87. package/dist/esm/chunk-2V636AYW.mjs +2 -0
  88. package/dist/esm/{chunk-3IWV2Q3K.mjs.map → chunk-2V636AYW.mjs.map} +1 -1
  89. package/dist/esm/chunk-35CO4BP4.mjs +2 -0
  90. package/dist/esm/chunk-35CO4BP4.mjs.map +1 -0
  91. package/dist/esm/chunk-35DKMW7Q.mjs +2 -0
  92. package/dist/esm/{chunk-GUA5YTIK.mjs.map → chunk-35DKMW7Q.mjs.map} +1 -1
  93. package/dist/esm/chunk-3EUHEZND.mjs +2 -0
  94. package/dist/esm/{chunk-G34CJDST.mjs.map → chunk-3EUHEZND.mjs.map} +1 -1
  95. package/dist/esm/chunk-3OLFJ65O.mjs +2 -0
  96. package/dist/esm/{chunk-G4NBRMZ2.mjs.map → chunk-3OLFJ65O.mjs.map} +1 -1
  97. package/dist/esm/chunk-3RVAGHAA.mjs +2 -0
  98. package/dist/esm/{chunk-XQFUKBY7.mjs.map → chunk-3RVAGHAA.mjs.map} +1 -1
  99. package/dist/esm/chunk-4RXKALLC.mjs +2 -0
  100. package/dist/esm/{chunk-SFLQPB72.mjs.map → chunk-4RXKALLC.mjs.map} +1 -1
  101. package/dist/esm/chunk-56CNRT2K.mjs +2 -0
  102. package/dist/esm/{chunk-SBB4YEPT.mjs.map → chunk-56CNRT2K.mjs.map} +1 -1
  103. package/dist/esm/chunk-6KE4JZD6.mjs +2 -0
  104. package/dist/esm/chunk-6KE4JZD6.mjs.map +1 -0
  105. package/dist/esm/chunk-7CRQNXR5.mjs +2 -0
  106. package/dist/esm/{chunk-YU65LNIC.mjs.map → chunk-7CRQNXR5.mjs.map} +1 -1
  107. package/dist/esm/chunk-7YTGBTWH.mjs +2 -0
  108. package/dist/esm/chunk-7YTGBTWH.mjs.map +1 -0
  109. package/dist/esm/chunk-A3VO773Q.mjs +2 -0
  110. package/dist/esm/{chunk-KLUO6XPE.mjs.map → chunk-A3VO773Q.mjs.map} +1 -1
  111. package/dist/esm/chunk-A5L76YP7.mjs +2 -0
  112. package/dist/esm/{chunk-PT2QHUB6.mjs.map → chunk-A5L76YP7.mjs.map} +1 -1
  113. package/dist/esm/chunk-AEGA5N2W.mjs +2 -0
  114. package/dist/esm/{chunk-QJ6CGH7N.mjs.map → chunk-AEGA5N2W.mjs.map} +1 -1
  115. package/dist/esm/chunk-AIPHJFJL.mjs +2 -0
  116. package/dist/esm/{chunk-6I37A76G.mjs.map → chunk-AIPHJFJL.mjs.map} +1 -1
  117. package/dist/esm/chunk-BMPHQ3E7.mjs +2 -0
  118. package/dist/esm/{chunk-MWXBQ6HR.mjs.map → chunk-BMPHQ3E7.mjs.map} +1 -1
  119. package/dist/esm/chunk-C3Q23D22.mjs +2 -0
  120. package/dist/esm/{chunk-F7W7KS5C.mjs.map → chunk-C3Q23D22.mjs.map} +1 -1
  121. package/dist/esm/chunk-CWL7ZA3P.mjs +2 -0
  122. package/dist/esm/{chunk-6T3V5LXK.mjs.map → chunk-CWL7ZA3P.mjs.map} +1 -1
  123. package/dist/esm/chunk-DOVH6HPL.mjs +2 -0
  124. package/dist/esm/{chunk-THWEBWUC.mjs.map → chunk-DOVH6HPL.mjs.map} +1 -1
  125. package/dist/esm/chunk-EODSU3YN.mjs +2 -0
  126. package/dist/esm/{chunk-WXQUBQK4.mjs.map → chunk-EODSU3YN.mjs.map} +1 -1
  127. package/dist/esm/chunk-ERLDXTIY.mjs +2 -0
  128. package/dist/esm/{chunk-6ASWESA2.mjs.map → chunk-ERLDXTIY.mjs.map} +1 -1
  129. package/dist/esm/chunk-GOXRBEIJ.mjs +2 -0
  130. package/dist/esm/{chunk-APM7OSLS.mjs.map → chunk-GOXRBEIJ.mjs.map} +1 -1
  131. package/dist/esm/chunk-HHWJHOFZ.mjs +2 -0
  132. package/dist/esm/{chunk-KSK3XIGF.mjs.map → chunk-HHWJHOFZ.mjs.map} +1 -1
  133. package/dist/esm/chunk-IF4UU2MT.mjs +2 -0
  134. package/dist/esm/{chunk-QPT4BSAB.mjs.map → chunk-IF4UU2MT.mjs.map} +1 -1
  135. package/dist/esm/chunk-IMTC3J2M.mjs +2 -0
  136. package/dist/esm/{chunk-LJRNGZMY.mjs.map → chunk-IMTC3J2M.mjs.map} +1 -1
  137. package/dist/esm/chunk-KDMSOCZY.mjs +2 -0
  138. package/dist/esm/chunk-KSLLV3ZC.mjs +2 -0
  139. package/dist/esm/{chunk-OFUNBTK4.mjs.map → chunk-KSLLV3ZC.mjs.map} +1 -1
  140. package/dist/esm/chunk-KXVD52Y6.mjs +2 -0
  141. package/dist/esm/{chunk-YT7V6AVJ.mjs.map → chunk-KXVD52Y6.mjs.map} +1 -1
  142. package/dist/esm/chunk-LGC2JORV.mjs +2 -0
  143. package/dist/esm/chunk-LGC2JORV.mjs.map +1 -0
  144. package/dist/esm/chunk-LQOSHBB7.mjs +4 -0
  145. package/dist/esm/{chunk-CXLXUSCG.mjs.map → chunk-LQOSHBB7.mjs.map} +1 -1
  146. package/dist/esm/chunk-LS3IDL2N.mjs +2 -0
  147. package/dist/esm/{chunk-MYEYZ7PF.mjs.map → chunk-LS3IDL2N.mjs.map} +1 -1
  148. package/dist/esm/chunk-MIW45ADL.mjs +2 -0
  149. package/dist/esm/chunk-MIW45ADL.mjs.map +1 -0
  150. package/dist/esm/chunk-NFPNWY6Z.mjs +4 -0
  151. package/dist/esm/chunk-NFPNWY6Z.mjs.map +1 -0
  152. package/dist/esm/chunk-PDAWVDI7.mjs +2 -0
  153. package/dist/esm/{chunk-MFFBZ43D.mjs.map → chunk-PDAWVDI7.mjs.map} +1 -1
  154. package/dist/esm/chunk-PSZYS4RG.mjs +2 -0
  155. package/dist/esm/{chunk-YK66QBML.mjs.map → chunk-PSZYS4RG.mjs.map} +1 -1
  156. package/dist/esm/chunk-R6QCPXQG.mjs +2 -0
  157. package/dist/esm/{chunk-SQNS4SFV.mjs.map → chunk-R6QCPXQG.mjs.map} +1 -1
  158. package/dist/esm/chunk-RIINVEZA.mjs +2 -0
  159. package/dist/esm/{chunk-Y3ENAKRC.mjs.map → chunk-RIINVEZA.mjs.map} +1 -1
  160. package/dist/esm/chunk-RJ7F4JDV.mjs +2 -0
  161. package/dist/esm/chunk-RJ7F4JDV.mjs.map +1 -0
  162. package/dist/esm/chunk-RXHER6EA.mjs +2 -0
  163. package/dist/esm/{chunk-C7T6GW5P.mjs.map → chunk-RXHER6EA.mjs.map} +1 -1
  164. package/dist/esm/chunk-RXMLONF7.mjs +2 -0
  165. package/dist/esm/{chunk-BU43ZFDJ.mjs.map → chunk-RXMLONF7.mjs.map} +1 -1
  166. package/dist/esm/chunk-TBY3VMMV.mjs +2 -0
  167. package/dist/esm/chunk-TBY3VMMV.mjs.map +1 -0
  168. package/dist/esm/chunk-TKXEVD7A.mjs +2 -0
  169. package/dist/esm/{chunk-QSYWLSSN.mjs.map → chunk-TKXEVD7A.mjs.map} +1 -1
  170. package/dist/esm/chunk-TNWABITK.mjs +2 -0
  171. package/dist/esm/{chunk-FRLS4GRM.mjs.map → chunk-TNWABITK.mjs.map} +1 -1
  172. package/dist/esm/chunk-TTY5GFMN.mjs +2 -0
  173. package/dist/esm/{chunk-PKUXOBIV.mjs.map → chunk-TTY5GFMN.mjs.map} +1 -1
  174. package/dist/esm/chunk-VHNX2NUR.mjs +473 -0
  175. package/dist/esm/chunk-VHNX2NUR.mjs.map +1 -0
  176. package/dist/esm/chunk-VHY6ZATX.mjs +2 -0
  177. package/dist/esm/{chunk-BDM6FBUO.mjs.map → chunk-VHY6ZATX.mjs.map} +1 -1
  178. package/dist/esm/chunk-W4BSN6SK.mjs +2 -0
  179. package/dist/esm/{chunk-ZWCTF3NQ.mjs.map → chunk-W4BSN6SK.mjs.map} +1 -1
  180. package/dist/esm/chunk-WB26DWOY.mjs +7 -0
  181. package/dist/esm/chunk-WB26DWOY.mjs.map +1 -0
  182. package/dist/esm/chunk-X5YB74NB.mjs +2 -0
  183. package/dist/esm/{chunk-I25AX6PQ.mjs.map → chunk-X5YB74NB.mjs.map} +1 -1
  184. package/dist/esm/chunk-XLDMPCLF.mjs +2 -0
  185. package/dist/esm/{chunk-WLTQHGIJ.mjs.map → chunk-XLDMPCLF.mjs.map} +1 -1
  186. package/dist/esm/chunk-YOZBVVKL.mjs +2 -0
  187. package/dist/esm/{chunk-BEYIOC2H.mjs.map → chunk-YOZBVVKL.mjs.map} +1 -1
  188. package/dist/esm/chunk-ZD2TY5N3.mjs +2 -0
  189. package/dist/esm/{chunk-NUT2VOX2.mjs.map → chunk-ZD2TY5N3.mjs.map} +1 -1
  190. package/dist/esm/chunk-ZELTLAUN.mjs +2 -0
  191. package/dist/esm/chunk-ZELTLAUN.mjs.map +1 -0
  192. package/dist/esm/cli/index.mjs +1 -20
  193. package/dist/esm/cli/localNode.mjs +1 -16
  194. package/dist/esm/cli/move.mjs +1 -7
  195. package/dist/esm/client/core.mjs +1 -34
  196. package/dist/esm/client/get.mjs +1 -41
  197. package/dist/esm/client/index.mjs +1 -69
  198. package/dist/esm/client/post.mjs +1 -43
  199. package/dist/esm/core/account/index.mjs +1 -21
  200. package/dist/esm/core/account/utils/address.mjs +1 -19
  201. package/dist/esm/core/account/utils/index.mjs +1 -20
  202. package/dist/esm/core/accountAddress.mjs +1 -16
  203. package/dist/esm/core/authenticationKey.d.mts +3 -1
  204. package/dist/esm/core/authenticationKey.mjs +1 -15
  205. package/dist/esm/core/common.mjs +1 -7
  206. package/dist/esm/core/crypto/abstraction.d.mts +4 -1
  207. package/dist/esm/core/crypto/abstraction.mjs +1 -26
  208. package/dist/esm/core/crypto/ed25519.d.mts +18 -1
  209. package/dist/esm/core/crypto/ed25519.mjs +1 -33
  210. package/dist/esm/core/crypto/ephemeral.d.mts +8 -1
  211. package/dist/esm/core/crypto/ephemeral.mjs +1 -30
  212. package/dist/esm/core/crypto/federatedKeyless.d.mts +11 -87
  213. package/dist/esm/core/crypto/federatedKeyless.mjs +1 -44
  214. package/dist/esm/core/crypto/hdKey.mjs +1 -25
  215. package/dist/esm/core/crypto/index.d.mts +8 -6
  216. package/dist/esm/core/crypto/index.mjs +1 -173
  217. package/dist/esm/core/crypto/keyless.d.mts +13 -586
  218. package/dist/esm/core/crypto/keyless.mjs +1 -83
  219. package/dist/esm/core/crypto/multiEd25519.d.mts +14 -4
  220. package/dist/esm/core/crypto/multiEd25519.mjs +1 -50
  221. package/dist/esm/core/crypto/multiKey.d.mts +39 -3
  222. package/dist/esm/core/crypto/multiKey.mjs +1 -51
  223. package/dist/esm/core/crypto/poseidon.mjs +1 -15
  224. package/dist/esm/core/crypto/privateKey.d.mts +3 -1
  225. package/dist/esm/core/crypto/privateKey.mjs +1 -12
  226. package/dist/esm/core/crypto/proof.mjs +1 -20
  227. package/dist/esm/core/crypto/publicKey.d.mts +3 -1
  228. package/dist/esm/core/crypto/publicKey.mjs +1 -22
  229. package/dist/esm/core/crypto/secp256k1.d.mts +26 -2
  230. package/dist/esm/core/crypto/secp256k1.mjs +1 -29
  231. package/dist/esm/core/crypto/signature.mjs +1 -20
  232. package/dist/esm/core/crypto/singleKey.d.mts +27 -5
  233. package/dist/esm/core/crypto/singleKey.mjs +1 -48
  234. package/dist/esm/core/crypto/utils.mjs +1 -9
  235. package/dist/esm/core/hex.mjs +1 -12
  236. package/dist/esm/core/index.d.mts +8 -6
  237. package/dist/esm/core/index.mjs +1 -202
  238. package/dist/esm/errors/index.d.mts +10 -2
  239. package/dist/esm/errors/index.mjs +1 -25
  240. package/dist/esm/federatedKeyless-Qe_j8OqV.d.mts +875 -0
  241. package/dist/esm/index.d.mts +11 -10
  242. package/dist/esm/index.mjs +1 -798
  243. package/dist/esm/internal/abstraction.d.mts +9 -9
  244. package/dist/esm/internal/abstraction.mjs +1 -103
  245. package/dist/esm/internal/account.d.mts +7 -24
  246. package/dist/esm/internal/account.mjs +1 -142
  247. package/dist/esm/internal/ans.d.mts +13 -13
  248. package/dist/esm/internal/ans.mjs +1 -138
  249. package/dist/esm/internal/coin.d.mts +7 -7
  250. package/dist/esm/internal/coin.mjs +1 -99
  251. package/dist/esm/internal/digitalAsset.d.mts +2 -2
  252. package/dist/esm/internal/digitalAsset.mjs +1 -145
  253. package/dist/esm/internal/event.mjs +1 -62
  254. package/dist/esm/internal/experimental.d.mts +7 -7
  255. package/dist/esm/internal/experimental.mjs +1 -84
  256. package/dist/esm/internal/faucet.mjs +1 -57
  257. package/dist/esm/internal/fungibleAsset.d.mts +2 -2
  258. package/dist/esm/internal/fungibleAsset.mjs +1 -105
  259. package/dist/esm/internal/general.mjs +1 -43
  260. package/dist/esm/internal/keyless.d.mts +10 -20
  261. package/dist/esm/internal/keyless.mjs +1 -107
  262. package/dist/esm/internal/object.mjs +1 -58
  263. package/dist/esm/internal/staking.mjs +1 -60
  264. package/dist/esm/internal/table.mjs +1 -38
  265. package/dist/esm/internal/transaction.mjs +1 -57
  266. package/dist/esm/internal/transactionSubmission.d.mts +6 -6
  267. package/dist/esm/internal/transactionSubmission.mjs +1 -118
  268. package/dist/esm/internal/utils/index.mjs +1 -38
  269. package/dist/esm/internal/utils/utils.mjs +1 -37
  270. package/dist/esm/internal/view.d.mts +7 -7
  271. package/dist/esm/internal/view.mjs +1 -86
  272. package/dist/esm/{publicKey-BMtGNNLg.d.mts → publicKey-pDHBAZlT.d.mts} +27 -1
  273. package/dist/esm/transactions/authenticator/account.d.mts +3 -1
  274. package/dist/esm/transactions/authenticator/account.mjs +1 -67
  275. package/dist/esm/transactions/authenticator/index.d.mts +3 -1
  276. package/dist/esm/transactions/authenticator/index.mjs +1 -82
  277. package/dist/esm/transactions/authenticator/transaction.d.mts +4 -2
  278. package/dist/esm/transactions/authenticator/transaction.mjs +1 -66
  279. package/dist/esm/transactions/index.d.mts +4 -4
  280. package/dist/esm/transactions/index.mjs +1 -296
  281. package/dist/esm/transactions/instances/chainId.mjs +1 -11
  282. package/dist/esm/transactions/instances/identifier.mjs +1 -11
  283. package/dist/esm/transactions/instances/index.d.mts +4 -2
  284. package/dist/esm/transactions/instances/index.mjs +1 -114
  285. package/dist/esm/transactions/instances/moduleId.mjs +1 -55
  286. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -60
  287. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -65
  288. package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +3 -1
  289. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -21
  290. package/dist/esm/transactions/instances/signedTransaction.d.mts +3 -1
  291. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -63
  292. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -60
  293. package/dist/esm/transactions/instances/transactionArgument.mjs +1 -1
  294. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -73
  295. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +2 -2
  296. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -101
  297. package/dist/esm/transactions/management/asyncQueue.mjs +1 -9
  298. package/dist/esm/transactions/management/index.d.mts +2 -2
  299. package/dist/esm/transactions/management/index.mjs +1 -111
  300. package/dist/esm/transactions/management/transactionWorker.d.mts +3 -3
  301. package/dist/esm/transactions/management/transactionWorker.mjs +1 -107
  302. package/dist/esm/transactions/scriptComposer/index.d.mts +7 -7
  303. package/dist/esm/transactions/scriptComposer/index.mjs +1 -80
  304. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +8 -8
  305. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -92
  306. package/dist/esm/transactions/transactionBuilder/index.d.mts +8 -8
  307. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -166
  308. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +34 -23
  309. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -74
  310. package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +7 -7
  311. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -75
  312. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +8 -8
  313. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -97
  314. package/dist/esm/transactions/typeTag/index.d.mts +16 -0
  315. package/dist/esm/transactions/typeTag/index.mjs +1 -91
  316. package/dist/esm/transactions/typeTag/parser.mjs +1 -60
  317. package/dist/esm/transactions/types.d.mts +5 -5
  318. package/dist/esm/transactions/types.mjs +1 -1
  319. package/dist/esm/types/abstraction.mjs +1 -7
  320. package/dist/esm/types/generated/operations.d.mts +10 -63
  321. package/dist/esm/types/generated/queries.d.mts +2 -10
  322. package/dist/esm/types/generated/queries.mjs +1 -69
  323. package/dist/esm/types/generated/types.d.mts +1054 -824
  324. package/dist/esm/types/generated/types.mjs +1 -774
  325. package/dist/esm/types/generated/types.mjs.map +1 -1
  326. package/dist/esm/types/index.d.mts +2 -2
  327. package/dist/esm/types/index.mjs +1 -82
  328. package/dist/esm/types/indexer.d.mts +2 -14
  329. package/dist/esm/types/indexer.mjs +1 -1
  330. package/dist/esm/types/keyless.d.mts +1 -1
  331. package/dist/esm/types/types.d.mts +3 -58
  332. package/dist/esm/types/types.mjs +1 -77
  333. package/dist/esm/utils/apiEndpoints.mjs +1 -21
  334. package/dist/esm/utils/const.d.mts +1 -1
  335. package/dist/esm/utils/const.mjs +1 -25
  336. package/dist/esm/utils/helpers.d.mts +2 -1
  337. package/dist/esm/utils/helpers.mjs +1 -37
  338. package/dist/esm/utils/index.d.mts +1 -1
  339. package/dist/esm/utils/index.mjs +1 -88
  340. package/dist/esm/utils/memoize.mjs +1 -9
  341. package/dist/esm/utils/normalizeBundle.mjs +1 -20
  342. package/dist/esm/version.d.mts +1 -1
  343. package/dist/esm/version.mjs +1 -7
  344. package/package.json +3 -3
  345. package/src/account/AbstractKeylessAccount.ts +33 -49
  346. package/src/account/MultiKeyAccount.ts +23 -16
  347. package/src/api/account.ts +2 -56
  348. package/src/cli/localNode.ts +6 -15
  349. package/src/core/crypto/abstraction.ts +6 -1
  350. package/src/core/crypto/ed25519.ts +19 -1
  351. package/src/core/crypto/ephemeral.ts +9 -0
  352. package/src/core/crypto/federatedKeyless.ts +40 -4
  353. package/src/core/crypto/index.ts +4 -3
  354. package/src/core/crypto/keyless.ts +577 -17
  355. package/src/core/crypto/multiEd25519.ts +11 -3
  356. package/src/core/crypto/multiKey.ts +74 -4
  357. package/src/core/crypto/publicKey.ts +28 -0
  358. package/src/core/crypto/secp256k1.ts +25 -2
  359. package/src/core/crypto/singleKey.ts +32 -7
  360. package/src/errors/index.ts +50 -0
  361. package/src/internal/account.ts +2 -395
  362. package/src/internal/keyless.ts +9 -17
  363. package/src/transactions/scriptComposer/index.ts +19 -6
  364. package/src/transactions/transactionBuilder/remoteAbi.ts +107 -35
  365. package/src/transactions/typeTag/index.ts +22 -0
  366. package/src/types/codegen.yaml +1 -1
  367. package/src/types/generated/operations.ts +8 -69
  368. package/src/types/generated/queries.ts +0 -111
  369. package/src/types/generated/types.ts +1159 -951
  370. package/src/types/indexer.ts +0 -16
  371. package/src/types/keyless.ts +1 -1
  372. package/src/types/types.ts +3 -62
  373. package/src/utils/const.ts +1 -1
  374. package/src/utils/helpers.ts +11 -0
  375. package/src/version.ts +1 -1
  376. package/dist/common/chunk-JMOQXLED.js +0 -1305
  377. package/dist/common/chunk-JMOQXLED.js.map +0 -1
  378. package/dist/esm/chunk-2FTF6J7F.mjs +0 -97
  379. package/dist/esm/chunk-2FTF6J7F.mjs.map +0 -1
  380. package/dist/esm/chunk-2HL7JEFC.mjs +0 -829
  381. package/dist/esm/chunk-2HL7JEFC.mjs.map +0 -1
  382. package/dist/esm/chunk-2WBJAKBO.mjs +0 -53
  383. package/dist/esm/chunk-2WBJAKBO.mjs.map +0 -1
  384. package/dist/esm/chunk-32UQAST6.mjs +0 -296
  385. package/dist/esm/chunk-32UQAST6.mjs.map +0 -1
  386. package/dist/esm/chunk-3DAVHDK4.mjs +0 -195
  387. package/dist/esm/chunk-3DAVHDK4.mjs.map +0 -1
  388. package/dist/esm/chunk-3IWV2Q3K.mjs +0 -12
  389. package/dist/esm/chunk-3TUV6YMI.mjs +0 -305
  390. package/dist/esm/chunk-3TUV6YMI.mjs.map +0 -1
  391. package/dist/esm/chunk-4NMDYPUD.mjs +0 -1
  392. package/dist/esm/chunk-56UCIGTO.mjs +0 -21
  393. package/dist/esm/chunk-56UCIGTO.mjs.map +0 -1
  394. package/dist/esm/chunk-5ORUQZAR.mjs +0 -100
  395. package/dist/esm/chunk-5ORUQZAR.mjs.map +0 -1
  396. package/dist/esm/chunk-5QHMFYVL.mjs +0 -42
  397. package/dist/esm/chunk-5QHMFYVL.mjs.map +0 -1
  398. package/dist/esm/chunk-62LC4PPC.mjs +0 -128
  399. package/dist/esm/chunk-62LC4PPC.mjs.map +0 -1
  400. package/dist/esm/chunk-6ASWESA2.mjs +0 -77
  401. package/dist/esm/chunk-6I37A76G.mjs +0 -29
  402. package/dist/esm/chunk-6OFCIXWS.mjs +0 -379
  403. package/dist/esm/chunk-6OFCIXWS.mjs.map +0 -1
  404. package/dist/esm/chunk-6SNGKTWE.mjs +0 -91
  405. package/dist/esm/chunk-6SNGKTWE.mjs.map +0 -1
  406. package/dist/esm/chunk-6T3V5LXK.mjs +0 -119
  407. package/dist/esm/chunk-7F32C225.mjs +0 -219
  408. package/dist/esm/chunk-7F32C225.mjs.map +0 -1
  409. package/dist/esm/chunk-7WW735TU.mjs +0 -276
  410. package/dist/esm/chunk-7WW735TU.mjs.map +0 -1
  411. package/dist/esm/chunk-A33OBGVN.mjs +0 -1014
  412. package/dist/esm/chunk-A33OBGVN.mjs.map +0 -1
  413. package/dist/esm/chunk-A7LYGPFL.mjs +0 -208
  414. package/dist/esm/chunk-A7LYGPFL.mjs.map +0 -1
  415. package/dist/esm/chunk-AGKEC2IM.mjs +0 -250
  416. package/dist/esm/chunk-AGKEC2IM.mjs.map +0 -1
  417. package/dist/esm/chunk-AKXCFBYF.mjs +0 -49
  418. package/dist/esm/chunk-AKXCFBYF.mjs.map +0 -1
  419. package/dist/esm/chunk-APM7OSLS.mjs +0 -122
  420. package/dist/esm/chunk-BDM6FBUO.mjs +0 -198
  421. package/dist/esm/chunk-BEYIOC2H.mjs +0 -34
  422. package/dist/esm/chunk-BMM72IIP.mjs +0 -250
  423. package/dist/esm/chunk-BMM72IIP.mjs.map +0 -1
  424. package/dist/esm/chunk-BSCOVLWS.mjs +0 -1
  425. package/dist/esm/chunk-BSCOVLWS.mjs.map +0 -1
  426. package/dist/esm/chunk-BU43ZFDJ.mjs +0 -281
  427. package/dist/esm/chunk-C7EEG6SW.mjs +0 -689
  428. package/dist/esm/chunk-C7EEG6SW.mjs.map +0 -1
  429. package/dist/esm/chunk-C7T6GW5P.mjs +0 -376
  430. package/dist/esm/chunk-CXLXUSCG.mjs +0 -417
  431. package/dist/esm/chunk-D4MW64RH.mjs +0 -188
  432. package/dist/esm/chunk-D4MW64RH.mjs.map +0 -1
  433. package/dist/esm/chunk-D6RXVCE3.mjs +0 -86
  434. package/dist/esm/chunk-D6RXVCE3.mjs.map +0 -1
  435. package/dist/esm/chunk-DDZGHA66.mjs +0 -495
  436. package/dist/esm/chunk-DDZGHA66.mjs.map +0 -1
  437. package/dist/esm/chunk-DGDZNHUJ.mjs +0 -72
  438. package/dist/esm/chunk-DGDZNHUJ.mjs.map +0 -1
  439. package/dist/esm/chunk-DMFRIING.mjs +0 -286
  440. package/dist/esm/chunk-DMFRIING.mjs.map +0 -1
  441. package/dist/esm/chunk-E7FWVXGX.mjs +0 -1
  442. package/dist/esm/chunk-E7FWVXGX.mjs.map +0 -1
  443. package/dist/esm/chunk-EBFKT35C.mjs +0 -66
  444. package/dist/esm/chunk-EBFKT35C.mjs.map +0 -1
  445. package/dist/esm/chunk-ECTX2FGD.mjs +0 -355
  446. package/dist/esm/chunk-ECTX2FGD.mjs.map +0 -1
  447. package/dist/esm/chunk-EPTUAWRA.mjs +0 -895
  448. package/dist/esm/chunk-EPTUAWRA.mjs.map +0 -1
  449. package/dist/esm/chunk-F4VI7BNX.mjs +0 -58
  450. package/dist/esm/chunk-F4VI7BNX.mjs.map +0 -1
  451. package/dist/esm/chunk-F7W7KS5C.mjs +0 -52
  452. package/dist/esm/chunk-FDMI4BUL.mjs +0 -611
  453. package/dist/esm/chunk-FDMI4BUL.mjs.map +0 -1
  454. package/dist/esm/chunk-FMNMYKYH.mjs +0 -71
  455. package/dist/esm/chunk-FMNMYKYH.mjs.map +0 -1
  456. package/dist/esm/chunk-FRLS4GRM.mjs +0 -62
  457. package/dist/esm/chunk-G34CJDST.mjs +0 -139
  458. package/dist/esm/chunk-G4NBRMZ2.mjs +0 -7
  459. package/dist/esm/chunk-G6R77JKO.mjs +0 -121
  460. package/dist/esm/chunk-G6R77JKO.mjs.map +0 -1
  461. package/dist/esm/chunk-G7BB6K4B.mjs +0 -167
  462. package/dist/esm/chunk-G7BB6K4B.mjs.map +0 -1
  463. package/dist/esm/chunk-GCQK2S5Q.mjs +0 -43
  464. package/dist/esm/chunk-GCQK2S5Q.mjs.map +0 -1
  465. package/dist/esm/chunk-GFPEB22G.mjs +0 -1
  466. package/dist/esm/chunk-GFPEB22G.mjs.map +0 -1
  467. package/dist/esm/chunk-GUA5YTIK.mjs +0 -362
  468. package/dist/esm/chunk-HBXBODME.mjs +0 -84
  469. package/dist/esm/chunk-HBXBODME.mjs.map +0 -1
  470. package/dist/esm/chunk-HEZ2ZYZA.mjs +0 -1
  471. package/dist/esm/chunk-HEZ2ZYZA.mjs.map +0 -1
  472. package/dist/esm/chunk-HKQY5GXT.mjs +0 -231
  473. package/dist/esm/chunk-HKQY5GXT.mjs.map +0 -1
  474. package/dist/esm/chunk-HL337SEM.mjs +0 -219
  475. package/dist/esm/chunk-HL337SEM.mjs.map +0 -1
  476. package/dist/esm/chunk-HQDHSKVS.mjs +0 -74
  477. package/dist/esm/chunk-HQDHSKVS.mjs.map +0 -1
  478. package/dist/esm/chunk-I25AX6PQ.mjs +0 -7
  479. package/dist/esm/chunk-I5G7XFGT.mjs +0 -86
  480. package/dist/esm/chunk-I5G7XFGT.mjs.map +0 -1
  481. package/dist/esm/chunk-IHYTP2EW.mjs +0 -1
  482. package/dist/esm/chunk-IHYTP2EW.mjs.map +0 -1
  483. package/dist/esm/chunk-IJ7XCPP3.mjs +0 -480
  484. package/dist/esm/chunk-IJ7XCPP3.mjs.map +0 -1
  485. package/dist/esm/chunk-ILTEOGFF.mjs +0 -407
  486. package/dist/esm/chunk-ILTEOGFF.mjs.map +0 -1
  487. package/dist/esm/chunk-IP7GATDH.mjs +0 -322
  488. package/dist/esm/chunk-IP7GATDH.mjs.map +0 -1
  489. package/dist/esm/chunk-IPUAVRGL.mjs +0 -248
  490. package/dist/esm/chunk-IPUAVRGL.mjs.map +0 -1
  491. package/dist/esm/chunk-IQVHXOD3.mjs +0 -192
  492. package/dist/esm/chunk-IQVHXOD3.mjs.map +0 -1
  493. package/dist/esm/chunk-JAZJE3OR.mjs +0 -45
  494. package/dist/esm/chunk-JAZJE3OR.mjs.map +0 -1
  495. package/dist/esm/chunk-JEVGHYEP.mjs +0 -162
  496. package/dist/esm/chunk-JEVGHYEP.mjs.map +0 -1
  497. package/dist/esm/chunk-JFMFZ2IL.mjs +0 -147
  498. package/dist/esm/chunk-JFMFZ2IL.mjs.map +0 -1
  499. package/dist/esm/chunk-JQIRRM7G.mjs +0 -195
  500. package/dist/esm/chunk-JQIRRM7G.mjs.map +0 -1
  501. package/dist/esm/chunk-JXCZTOYC.mjs +0 -1
  502. package/dist/esm/chunk-JXCZTOYC.mjs.map +0 -1
  503. package/dist/esm/chunk-K5OCDM3W.mjs +0 -207
  504. package/dist/esm/chunk-K5OCDM3W.mjs.map +0 -1
  505. package/dist/esm/chunk-KLUO6XPE.mjs +0 -33
  506. package/dist/esm/chunk-KSK3XIGF.mjs +0 -502
  507. package/dist/esm/chunk-KW64NP2F.mjs +0 -71
  508. package/dist/esm/chunk-KW64NP2F.mjs.map +0 -1
  509. package/dist/esm/chunk-LJRNGZMY.mjs +0 -10
  510. package/dist/esm/chunk-MFFBZ43D.mjs +0 -45
  511. package/dist/esm/chunk-MWXBQ6HR.mjs +0 -15
  512. package/dist/esm/chunk-MYEYZ7PF.mjs +0 -46
  513. package/dist/esm/chunk-NUT2VOX2.mjs +0 -317
  514. package/dist/esm/chunk-OFUNBTK4.mjs +0 -169
  515. package/dist/esm/chunk-ORCQEMJL.mjs +0 -51
  516. package/dist/esm/chunk-ORCQEMJL.mjs.map +0 -1
  517. package/dist/esm/chunk-PGFEUN7K.mjs +0 -129
  518. package/dist/esm/chunk-PGFEUN7K.mjs.map +0 -1
  519. package/dist/esm/chunk-PKUXOBIV.mjs +0 -138
  520. package/dist/esm/chunk-PT2QHUB6.mjs +0 -96
  521. package/dist/esm/chunk-QJ6CGH7N.mjs +0 -71
  522. package/dist/esm/chunk-QPT4BSAB.mjs +0 -20
  523. package/dist/esm/chunk-QSYWLSSN.mjs +0 -216
  524. package/dist/esm/chunk-QYNYDQE3.mjs +0 -288
  525. package/dist/esm/chunk-QYNYDQE3.mjs.map +0 -1
  526. package/dist/esm/chunk-R45SPK6Q.mjs +0 -61
  527. package/dist/esm/chunk-R45SPK6Q.mjs.map +0 -1
  528. package/dist/esm/chunk-R4JTQQBX.mjs +0 -37
  529. package/dist/esm/chunk-R4JTQQBX.mjs.map +0 -1
  530. package/dist/esm/chunk-RCXGTN36.mjs +0 -58
  531. package/dist/esm/chunk-RCXGTN36.mjs.map +0 -1
  532. package/dist/esm/chunk-RMMOF53Q.mjs +0 -1
  533. package/dist/esm/chunk-RMMOF53Q.mjs.map +0 -1
  534. package/dist/esm/chunk-RQS33JAS.mjs +0 -77
  535. package/dist/esm/chunk-RQS33JAS.mjs.map +0 -1
  536. package/dist/esm/chunk-SAWN7RJP.mjs +0 -15
  537. package/dist/esm/chunk-SAWN7RJP.mjs.map +0 -1
  538. package/dist/esm/chunk-SBB4YEPT.mjs +0 -17
  539. package/dist/esm/chunk-SFLQPB72.mjs +0 -63
  540. package/dist/esm/chunk-SPI2HO3E.mjs +0 -177
  541. package/dist/esm/chunk-SPI2HO3E.mjs.map +0 -1
  542. package/dist/esm/chunk-SPVJXZL5.mjs +0 -865
  543. package/dist/esm/chunk-SPVJXZL5.mjs.map +0 -1
  544. package/dist/esm/chunk-SQNS4SFV.mjs +0 -232
  545. package/dist/esm/chunk-SRXIHVZE.mjs +0 -50
  546. package/dist/esm/chunk-SRXIHVZE.mjs.map +0 -1
  547. package/dist/esm/chunk-T4BFWV46.mjs +0 -63
  548. package/dist/esm/chunk-T4BFWV46.mjs.map +0 -1
  549. package/dist/esm/chunk-T573PCIR.mjs +0 -700
  550. package/dist/esm/chunk-T573PCIR.mjs.map +0 -1
  551. package/dist/esm/chunk-TDLL7QX5.mjs +0 -239
  552. package/dist/esm/chunk-TDLL7QX5.mjs.map +0 -1
  553. package/dist/esm/chunk-TFW6N66T.mjs +0 -415
  554. package/dist/esm/chunk-TFW6N66T.mjs.map +0 -1
  555. package/dist/esm/chunk-THWEBWUC.mjs +0 -20
  556. package/dist/esm/chunk-TJDF4CXI.mjs +0 -513
  557. package/dist/esm/chunk-TJDF4CXI.mjs.map +0 -1
  558. package/dist/esm/chunk-TL4Z4KHK.mjs +0 -70
  559. package/dist/esm/chunk-TL4Z4KHK.mjs.map +0 -1
  560. package/dist/esm/chunk-UGFIWCJQ.mjs +0 -130
  561. package/dist/esm/chunk-UGFIWCJQ.mjs.map +0 -1
  562. package/dist/esm/chunk-UGKZQUGE.mjs +0 -367
  563. package/dist/esm/chunk-UGKZQUGE.mjs.map +0 -1
  564. package/dist/esm/chunk-UIRAXHDH.mjs +0 -1
  565. package/dist/esm/chunk-UIRAXHDH.mjs.map +0 -1
  566. package/dist/esm/chunk-UK7SPHIE.mjs +0 -420
  567. package/dist/esm/chunk-UK7SPHIE.mjs.map +0 -1
  568. package/dist/esm/chunk-UOHCJOXI.mjs +0 -150
  569. package/dist/esm/chunk-UOHCJOXI.mjs.map +0 -1
  570. package/dist/esm/chunk-WHSS6I7T.mjs +0 -90
  571. package/dist/esm/chunk-WHSS6I7T.mjs.map +0 -1
  572. package/dist/esm/chunk-WLTQHGIJ.mjs +0 -177
  573. package/dist/esm/chunk-WUM247HF.mjs +0 -125
  574. package/dist/esm/chunk-WUM247HF.mjs.map +0 -1
  575. package/dist/esm/chunk-WXQUBQK4.mjs +0 -19
  576. package/dist/esm/chunk-X4N5BN3S.mjs +0 -40
  577. package/dist/esm/chunk-X4N5BN3S.mjs.map +0 -1
  578. package/dist/esm/chunk-XIBOO3WF.mjs +0 -168
  579. package/dist/esm/chunk-XIBOO3WF.mjs.map +0 -1
  580. package/dist/esm/chunk-XQFUKBY7.mjs +0 -136
  581. package/dist/esm/chunk-XX6C2QGI.mjs +0 -160
  582. package/dist/esm/chunk-XX6C2QGI.mjs.map +0 -1
  583. package/dist/esm/chunk-Y3ENAKRC.mjs +0 -73
  584. package/dist/esm/chunk-Y3M32DIB.mjs +0 -79
  585. package/dist/esm/chunk-Y3M32DIB.mjs.map +0 -1
  586. package/dist/esm/chunk-YK66QBML.mjs +0 -89
  587. package/dist/esm/chunk-YT7V6AVJ.mjs +0 -66
  588. package/dist/esm/chunk-YU65LNIC.mjs +0 -72
  589. package/dist/esm/chunk-ZRBUAZZD.mjs +0 -36
  590. package/dist/esm/chunk-ZRBUAZZD.mjs.map +0 -1
  591. package/dist/esm/chunk-ZWCTF3NQ.mjs +0 -25
  592. package/src/internal/queries/getAccountAddressForAuthKey.graphql +0 -8
  593. package/src/internal/queries/getAuthKeysForPublicKey.graphql +0 -9
  594. package/src/internal/queries/getMultiKeyForAuthKey.graphql +0 -9
  595. package/src/internal/queries/getSignatures.graphql +0 -13
  596. /package/dist/esm/{chunk-4NMDYPUD.mjs.map → chunk-KDMSOCZY.mjs.map} +0 -0
@@ -1,192 +0,0 @@
1
- import {
2
- lookupOriginalAccountAddress
3
- } from "./chunk-SPVJXZL5.mjs";
4
- import {
5
- generateTransaction
6
- } from "./chunk-HKQY5GXT.mjs";
7
- import {
8
- FederatedKeylessAccount
9
- } from "./chunk-UGFIWCJQ.mjs";
10
- import {
11
- KeylessAccount
12
- } from "./chunk-WUM247HF.mjs";
13
- import {
14
- FederatedKeylessPublicKey
15
- } from "./chunk-6SNGKTWE.mjs";
16
- import {
17
- Groth16Zkp,
18
- KeylessPublicKey,
19
- ZeroKnowledgeSig,
20
- ZkProof,
21
- getKeylessConfig
22
- } from "./chunk-T573PCIR.mjs";
23
- import {
24
- EphemeralSignature
25
- } from "./chunk-UOHCJOXI.mjs";
26
- import {
27
- postAptosPepperService,
28
- postAptosProvingService
29
- } from "./chunk-6T3V5LXK.mjs";
30
- import {
31
- KeylessError
32
- } from "./chunk-32UQAST6.mjs";
33
- import {
34
- MoveVector
35
- } from "./chunk-KSK3XIGF.mjs";
36
- import {
37
- Hex
38
- } from "./chunk-BDM6FBUO.mjs";
39
- import {
40
- FIREBASE_AUTH_ISS_PATTERN
41
- } from "./chunk-5QHMFYVL.mjs";
42
-
43
- // src/internal/keyless.ts
44
- import { jwtDecode } from "jwt-decode";
45
- async function getPepper(args) {
46
- const { aptosConfig, jwt, ephemeralKeyPair, uidKey = "sub", derivationPath } = args;
47
- const body = {
48
- jwt_b64: jwt,
49
- epk: ephemeralKeyPair.getPublicKey().bcsToHex().toStringWithoutPrefix(),
50
- exp_date_secs: ephemeralKeyPair.expiryDateSecs,
51
- epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),
52
- uid_key: uidKey,
53
- derivation_path: derivationPath
54
- };
55
- const { data } = await postAptosPepperService({
56
- aptosConfig,
57
- path: "fetch",
58
- body,
59
- originMethod: "getPepper",
60
- overrides: { WITH_CREDENTIALS: false }
61
- });
62
- return Hex.fromHexInput(data.pepper).toUint8Array();
63
- }
64
- async function getProof(args) {
65
- const {
66
- aptosConfig,
67
- jwt,
68
- ephemeralKeyPair,
69
- pepper = await getPepper(args),
70
- uidKey = "sub",
71
- maxExpHorizonSecs = (await getKeylessConfig({ aptosConfig })).maxExpHorizonSecs
72
- } = args;
73
- if (Hex.fromHexInput(pepper).toUint8Array().length !== KeylessAccount.PEPPER_LENGTH) {
74
- throw new Error(`Pepper needs to be ${KeylessAccount.PEPPER_LENGTH} bytes`);
75
- }
76
- const decodedJwt = jwtDecode(jwt);
77
- if (typeof decodedJwt.iat !== "number") {
78
- throw new Error("iat was not found");
79
- }
80
- if (maxExpHorizonSecs < ephemeralKeyPair.expiryDateSecs - decodedJwt.iat) {
81
- throw Error(`The EphemeralKeyPair is too long lived. It's lifespan must be less than ${maxExpHorizonSecs}`);
82
- }
83
- const json = {
84
- jwt_b64: jwt,
85
- epk: ephemeralKeyPair.getPublicKey().bcsToHex().toStringWithoutPrefix(),
86
- epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),
87
- exp_date_secs: ephemeralKeyPair.expiryDateSecs,
88
- exp_horizon_secs: maxExpHorizonSecs,
89
- pepper: Hex.fromHexInput(pepper).toStringWithoutPrefix(),
90
- uid_key: uidKey
91
- };
92
- const { data } = await postAptosProvingService({
93
- aptosConfig,
94
- path: "prove",
95
- body: json,
96
- originMethod: "getProof",
97
- overrides: { WITH_CREDENTIALS: false }
98
- });
99
- const proofPoints = data.proof;
100
- const groth16Zkp = new Groth16Zkp({
101
- a: proofPoints.a,
102
- b: proofPoints.b,
103
- c: proofPoints.c
104
- });
105
- const signedProof = new ZeroKnowledgeSig({
106
- proof: new ZkProof(groth16Zkp, 0 /* Groth16 */),
107
- trainingWheelsSignature: EphemeralSignature.fromHex(data.training_wheels_signature),
108
- expHorizonSecs: maxExpHorizonSecs
109
- });
110
- return signedProof;
111
- }
112
- async function deriveKeylessAccount(args) {
113
- const { aptosConfig, jwt, jwkAddress, uidKey, proofFetchCallback, pepper = await getPepper(args) } = args;
114
- const { verificationKey, maxExpHorizonSecs } = await getKeylessConfig({ aptosConfig });
115
- const proofPromise = getProof({ ...args, pepper, maxExpHorizonSecs });
116
- const proof = proofFetchCallback ? proofPromise : await proofPromise;
117
- if (jwkAddress !== void 0) {
118
- const publicKey2 = FederatedKeylessPublicKey.fromJwtAndPepper({ jwt, pepper, jwkAddress, uidKey });
119
- const address2 = await lookupOriginalAccountAddress({
120
- aptosConfig,
121
- authenticationKey: publicKey2.authKey().derivedAddress()
122
- });
123
- return FederatedKeylessAccount.create({
124
- ...args,
125
- address: address2,
126
- proof,
127
- pepper,
128
- proofFetchCallback,
129
- jwkAddress,
130
- verificationKey
131
- });
132
- }
133
- const publicKey = KeylessPublicKey.fromJwtAndPepper({ jwt, pepper, uidKey });
134
- const address = await lookupOriginalAccountAddress({
135
- aptosConfig,
136
- authenticationKey: publicKey.authKey().derivedAddress()
137
- });
138
- return KeylessAccount.create({ ...args, address, proof, pepper, proofFetchCallback, verificationKey });
139
- }
140
- async function updateFederatedKeylessJwkSetTransaction(args) {
141
- const { aptosConfig, sender, iss, options } = args;
142
- let { jwksUrl } = args;
143
- if (jwksUrl === void 0) {
144
- if (FIREBASE_AUTH_ISS_PATTERN.test(iss)) {
145
- jwksUrl = "https://www.googleapis.com/service_accounts/v1/jwk/securetoken@system.gserviceaccount.com";
146
- } else {
147
- jwksUrl = iss.endsWith("/") ? `${iss}.well-known/jwks.json` : `${iss}/.well-known/jwks.json`;
148
- }
149
- }
150
- let response;
151
- try {
152
- response = await fetch(jwksUrl);
153
- if (!response.ok) {
154
- throw new Error(`${response.status} ${response.statusText}`);
155
- }
156
- } catch (error) {
157
- let errorMessage;
158
- if (error instanceof Error) {
159
- errorMessage = `${error.message}`;
160
- } else {
161
- errorMessage = `error unknown - ${error}`;
162
- }
163
- throw KeylessError.fromErrorType({
164
- type: 14 /* JWK_FETCH_FAILED_FEDERATED */,
165
- details: `Failed to fetch JWKS at ${jwksUrl}: ${errorMessage}`
166
- });
167
- }
168
- const jwks = await response.json();
169
- return generateTransaction({
170
- aptosConfig,
171
- sender: sender.accountAddress,
172
- data: {
173
- function: "0x1::jwks::update_federated_jwk_set",
174
- functionArguments: [
175
- iss,
176
- MoveVector.MoveString(jwks.keys.map((key) => key.kid)),
177
- MoveVector.MoveString(jwks.keys.map((key) => key.alg)),
178
- MoveVector.MoveString(jwks.keys.map((key) => key.e)),
179
- MoveVector.MoveString(jwks.keys.map((key) => key.n))
180
- ]
181
- },
182
- options
183
- });
184
- }
185
-
186
- export {
187
- getPepper,
188
- getProof,
189
- deriveKeylessAccount,
190
- updateFederatedKeylessJwkSetTransaction
191
- };
192
- //# sourceMappingURL=chunk-IQVHXOD3.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/internal/keyless.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/keyless}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * keyless namespace and without having a dependency cycle error.\n * @group Implementation\n */\nimport { jwtDecode, JwtPayload } from \"jwt-decode\";\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { postAptosPepperService, postAptosProvingService } from \"../client\";\nimport {\n AccountAddressInput,\n EphemeralSignature,\n Groth16Zkp,\n Hex,\n KeylessPublicKey,\n MoveJWK,\n ZeroKnowledgeSig,\n ZkProof,\n getKeylessConfig,\n} from \"../core\";\nimport { HexInput, ZkpVariant } from \"../types\";\nimport { Account, EphemeralKeyPair, KeylessAccount, ProofFetchCallback } from \"../account\";\nimport { PepperFetchRequest, PepperFetchResponse, ProverRequest, ProverResponse } from \"../types/keyless\";\nimport { lookupOriginalAccountAddress } from \"./account\";\nimport { FederatedKeylessPublicKey } from \"../core/crypto/federatedKeyless\";\nimport { FederatedKeylessAccount } from \"../account/FederatedKeylessAccount\";\nimport { MoveVector } from \"../bcs\";\nimport { generateTransaction } from \"./transactionSubmission\";\nimport { InputGenerateTransactionOptions, SimpleTransaction } from \"../transactions\";\nimport { KeylessError, KeylessErrorType } from \"../errors\";\nimport { FIREBASE_AUTH_ISS_PATTERN } from \"../utils/const\";\n\n/**\n * Retrieves a pepper value based on the provided configuration and authentication details.\n *\n * @param args - The arguments required to fetch the pepper.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.jwt - The JSON Web Token used for authentication.\n * @param args.ephemeralKeyPair - The ephemeral key pair used for the operation.\n * @param args.uidKey - An optional unique identifier key (defaults to \"sub\").\n * @param args.derivationPath - An optional derivation path for the key.\n * @returns A Uint8Array containing the fetched pepper value.\n * @group Implementation\n */\nexport async function getPepper(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n uidKey?: string;\n derivationPath?: string;\n}): Promise<Uint8Array> {\n const { aptosConfig, jwt, ephemeralKeyPair, uidKey = \"sub\", derivationPath } = args;\n\n const body = {\n jwt_b64: jwt,\n epk: ephemeralKeyPair.getPublicKey().bcsToHex().toStringWithoutPrefix(),\n exp_date_secs: ephemeralKeyPair.expiryDateSecs,\n epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),\n uid_key: uidKey,\n derivation_path: derivationPath,\n };\n const { data } = await postAptosPepperService<PepperFetchRequest, PepperFetchResponse>({\n aptosConfig,\n path: \"fetch\",\n body,\n originMethod: \"getPepper\",\n overrides: { WITH_CREDENTIALS: false },\n });\n return Hex.fromHexInput(data.pepper).toUint8Array();\n}\n\n/**\n * Generates a zero-knowledge proof based on the provided parameters.\n * This function is essential for creating a signed proof that can be used in various cryptographic operations.\n *\n * @param args - The parameters required to generate the proof.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.jwt - The JSON Web Token used for authentication.\n * @param args.ephemeralKeyPair - The ephemeral key pair used for generating the proof.\n * @param args.pepper - An optional hex input used to enhance security (default is generated if not provided).\n * @param args.uidKey - An optional string that specifies the unique identifier key (defaults to \"sub\").\n * @throws Error if the pepper length is not valid or if the ephemeral key pair's lifespan exceeds the maximum allowed.\n * @group Implementation\n */\nexport async function getProof(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n pepper?: HexInput;\n uidKey?: string;\n maxExpHorizonSecs?: number;\n}): Promise<ZeroKnowledgeSig> {\n const {\n aptosConfig,\n jwt,\n ephemeralKeyPair,\n pepper = await getPepper(args),\n uidKey = \"sub\",\n maxExpHorizonSecs = (await getKeylessConfig({ aptosConfig })).maxExpHorizonSecs,\n } = args;\n if (Hex.fromHexInput(pepper).toUint8Array().length !== KeylessAccount.PEPPER_LENGTH) {\n throw new Error(`Pepper needs to be ${KeylessAccount.PEPPER_LENGTH} bytes`);\n }\n const decodedJwt = jwtDecode<JwtPayload>(jwt);\n if (typeof decodedJwt.iat !== \"number\") {\n throw new Error(\"iat was not found\");\n }\n if (maxExpHorizonSecs < ephemeralKeyPair.expiryDateSecs - decodedJwt.iat) {\n throw Error(`The EphemeralKeyPair is too long lived. It's lifespan must be less than ${maxExpHorizonSecs}`);\n }\n const json = {\n jwt_b64: jwt,\n epk: ephemeralKeyPair.getPublicKey().bcsToHex().toStringWithoutPrefix(),\n epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),\n exp_date_secs: ephemeralKeyPair.expiryDateSecs,\n exp_horizon_secs: maxExpHorizonSecs,\n pepper: Hex.fromHexInput(pepper).toStringWithoutPrefix(),\n uid_key: uidKey,\n };\n\n const { data } = await postAptosProvingService<ProverRequest, ProverResponse>({\n aptosConfig,\n path: \"prove\",\n body: json,\n originMethod: \"getProof\",\n overrides: { WITH_CREDENTIALS: false },\n });\n\n const proofPoints = data.proof;\n const groth16Zkp = new Groth16Zkp({\n a: proofPoints.a,\n b: proofPoints.b,\n c: proofPoints.c,\n });\n\n const signedProof = new ZeroKnowledgeSig({\n proof: new ZkProof(groth16Zkp, ZkpVariant.Groth16),\n trainingWheelsSignature: EphemeralSignature.fromHex(data.training_wheels_signature),\n expHorizonSecs: maxExpHorizonSecs,\n });\n return signedProof;\n}\n\n/**\n * Parameters for deriving a keyless account\n */\nexport type DeriveKeylessAccountParams = {\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n jwkAddress?: AccountAddressInput;\n uidKey?: string;\n pepper?: HexInput;\n proofFetchCallback?: ProofFetchCallback;\n};\n\n/**\n * Derives a keyless account by fetching the necessary proof and looking up the original account address.\n * This function helps in creating a keyless account that can be used without managing private keys directly.\n *\n * @param args - The arguments required to derive the keyless account.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.jwt - The JSON Web Token used for authentication.\n * @param args.ephemeralKeyPair - The ephemeral key pair used for cryptographic operations.\n * @param args.uidKey - An optional unique identifier key for the user.\n * @param args.pepper - An optional hexadecimal input used for additional security.\n * @param args.proofFetchCallback - An optional callback function to handle the proof fetch outcome.\n * @returns A keyless account object.\n * @group Implementation\n */\nexport async function deriveKeylessAccount(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n uidKey?: string;\n pepper?: HexInput;\n proofFetchCallback?: ProofFetchCallback;\n}): Promise<KeylessAccount>;\n\nexport async function deriveKeylessAccount(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n jwkAddress: AccountAddressInput;\n uidKey?: string;\n pepper?: HexInput;\n proofFetchCallback?: ProofFetchCallback;\n}): Promise<FederatedKeylessAccount>;\n\nexport async function deriveKeylessAccount(\n args: {\n aptosConfig: AptosConfig;\n } & DeriveKeylessAccountParams,\n): Promise<KeylessAccount | FederatedKeylessAccount> {\n const { aptosConfig, jwt, jwkAddress, uidKey, proofFetchCallback, pepper = await getPepper(args) } = args;\n const { verificationKey, maxExpHorizonSecs } = await getKeylessConfig({ aptosConfig });\n\n const proofPromise = getProof({ ...args, pepper, maxExpHorizonSecs });\n // If a callback is provided, pass in the proof as a promise to KeylessAccount.create. This will make the proof be fetched in the\n // background and the callback will handle the outcome of the fetch. This allows the developer to not have to block on the proof fetch\n // allowing for faster rendering of UX.\n //\n // If no callback is provided, the just await the proof fetch and continue synchronously.\n const proof = proofFetchCallback ? proofPromise : await proofPromise;\n\n // Look up the original address to handle key rotations and then instantiate the account.\n if (jwkAddress !== undefined) {\n const publicKey = FederatedKeylessPublicKey.fromJwtAndPepper({ jwt, pepper, jwkAddress, uidKey });\n const address = await lookupOriginalAccountAddress({\n aptosConfig,\n authenticationKey: publicKey.authKey().derivedAddress(),\n });\n\n return FederatedKeylessAccount.create({\n ...args,\n address,\n proof,\n pepper,\n proofFetchCallback,\n jwkAddress,\n verificationKey,\n });\n }\n\n const publicKey = KeylessPublicKey.fromJwtAndPepper({ jwt, pepper, uidKey });\n const address = await lookupOriginalAccountAddress({\n aptosConfig,\n authenticationKey: publicKey.authKey().derivedAddress(),\n });\n return KeylessAccount.create({ ...args, address, proof, pepper, proofFetchCallback, verificationKey });\n}\n\nexport interface JWKS {\n keys: MoveJWK[];\n}\n\nexport async function updateFederatedKeylessJwkSetTransaction(args: {\n aptosConfig: AptosConfig;\n sender: Account;\n iss: string;\n jwksUrl?: string;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, sender, iss, options } = args;\n\n let { jwksUrl } = args;\n\n if (jwksUrl === undefined) {\n if (FIREBASE_AUTH_ISS_PATTERN.test(iss)) {\n jwksUrl = \"https://www.googleapis.com/service_accounts/v1/jwk/securetoken@system.gserviceaccount.com\";\n } else {\n jwksUrl = iss.endsWith(\"/\") ? `${iss}.well-known/jwks.json` : `${iss}/.well-known/jwks.json`;\n }\n }\n\n let response: Response;\n\n try {\n response = await fetch(jwksUrl);\n if (!response.ok) {\n throw new Error(`${response.status} ${response.statusText}`);\n }\n } catch (error) {\n let errorMessage: string;\n if (error instanceof Error) {\n errorMessage = `${error.message}`;\n } else {\n errorMessage = `error unknown - ${error}`;\n }\n throw KeylessError.fromErrorType({\n type: KeylessErrorType.JWK_FETCH_FAILED_FEDERATED,\n details: `Failed to fetch JWKS at ${jwksUrl}: ${errorMessage}`,\n });\n }\n\n const jwks: JWKS = await response.json();\n return generateTransaction({\n aptosConfig,\n sender: sender.accountAddress,\n data: {\n function: \"0x1::jwks::update_federated_jwk_set\",\n functionArguments: [\n iss,\n MoveVector.MoveString(jwks.keys.map((key) => key.kid)),\n MoveVector.MoveString(jwks.keys.map((key) => key.alg)),\n MoveVector.MoveString(jwks.keys.map((key) => key.e)),\n MoveVector.MoveString(jwks.keys.map((key) => key.n)),\n ],\n },\n options,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,SAAS,iBAA6B;AAsCtC,eAAsB,UAAU,MAMR;AACtB,QAAM,EAAE,aAAa,KAAK,kBAAkB,SAAS,OAAO,eAAe,IAAI;AAE/E,QAAM,OAAO;AAAA,IACX,SAAS;AAAA,IACT,KAAK,iBAAiB,aAAa,EAAE,SAAS,EAAE,sBAAsB;AAAA,IACtE,eAAe,iBAAiB;AAAA,IAChC,aAAa,IAAI,aAAa,iBAAiB,OAAO,EAAE,sBAAsB;AAAA,IAC9E,SAAS;AAAA,IACT,iBAAiB;AAAA,EACnB;AACA,Q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waitForTransaction
3
- } from "./chunk-BU43ZFDJ.mjs";
4
- import {
5
- postAptosFaucet
6
- } from "./chunk-6T3V5LXK.mjs";
7
- import {
8
- AccountAddress
9
- } from "./chunk-CXLXUSCG.mjs";
10
- import {
11
- DEFAULT_TXN_TIMEOUT_SEC
12
- } from "./chunk-5QHMFYVL.mjs";
13
-
14
- // src/internal/faucet.ts
15
- async function fundAccount(args) {
16
- const { aptosConfig, accountAddress, amount, options } = args;
17
- const timeout = options?.timeoutSecs || DEFAULT_TXN_TIMEOUT_SEC;
18
- const { data } = await postAptosFaucet({
19
- aptosConfig,
20
- path: "fund",
21
- body: {
22
- address: AccountAddress.from(accountAddress).toString(),
23
- amount
24
- },
25
- originMethod: "fundAccount"
26
- });
27
- const txnHash = data.txn_hashes[0];
28
- const res = await waitForTransaction({
29
- aptosConfig,
30
- transactionHash: txnHash,
31
- options: {
32
- timeoutSecs: timeout,
33
- checkSuccess: options?.checkSuccess
34
- }
35
- });
36
- if (res.type === "user_transaction" /* User */) {
37
- return res;
38
- }
39
- throw new Error(`Unexpected transaction received for fund account: ${res.type}`);
40
- }
41
-
42
- export {
43
- fundAccount
44
- };
45
- //# sourceMappingURL=chunk-JAZJE3OR.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/internal/faucet.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/faucet}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * faucet namespace and without having a dependency cycle error.\n * @group Implementation\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { postAptosFaucet } from \"../client\";\nimport { AccountAddress, AccountAddressInput } from \"../core\";\nimport { TransactionResponseType, UserTransactionResponse, WaitForTransactionOptions } from \"../types\";\nimport { DEFAULT_TXN_TIMEOUT_SEC } from \"../utils/const\";\nimport { waitForTransaction } from \"./transaction\";\n\n/**\n * Funds an account with a specified amount of tokens from the Aptos faucet.\n * This function is useful for quickly providing a new or existing account with tokens to facilitate transactions.\n *\n * Note that only devnet has a publicly accessible faucet. For testnet, you must use\n * the minting page at https://aptos.dev/network/faucet.\n *\n * @param args - The arguments for funding the account.\n * @param args.aptosConfig - The configuration settings for connecting to the Aptos network.\n * @param args.accountAddress - The address of the account to be funded.\n * @param args.amount - The amount of tokens to fund the account with.\n * @param args.options - Optional parameters for the transaction.\n * @param args.options.timeoutSecs - The maximum time to wait for the transaction to complete, in seconds.\n * @param args.options.checkSuccess - A flag indicating whether to check if the transaction was successful.\n *\n * @throws Error if the transaction does not return a user transaction type.\n * @group Implementation\n */\nexport async function fundAccount(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n amount: number;\n options?: WaitForTransactionOptions;\n}): Promise<UserTransactionResponse> {\n const { aptosConfig, accountAddress, amount, options } = args;\n const timeout = options?.timeoutSecs || DEFAULT_TXN_TIMEOUT_SEC;\n const { data } = await postAptosFaucet<any, { txn_hashes: Array<string> }>({\n aptosConfig,\n path: \"fund\",\n body: {\n address: AccountAddress.from(accountAddress).toString(),\n amount,\n },\n originMethod: \"fundAccount\",\n });\n\n const txnHash = data.txn_hashes[0];\n\n const res = await waitForTransaction({\n aptosConfig,\n transactionHash: txnHash,\n options: {\n timeoutSecs: timeout,\n checkSuccess: options?.checkSuccess,\n },\n });\n\n // Response is always User transaction for a user submitted transaction\n if (res.type === TransactionResponseType.User) {\n return res;\n }\n\n throw new Error(`Unexpected transaction received for fund account: ${res.type}`);\n}\n"],"mappings":";;;;;;;;;;;;;;AAoCA,eAAsB,YAAY,MAKG;AACnC,QAAM,EAAE,aAAa,gBAAgB,QAAQ,QAAQ,IAAI;AACzD,QAAM,UAAU,SAAS,eAAe;AACxC,QAAM,EAAE,KAAK,IAAI,MAAM,gBAAoD;AAAA,IACzE;AAAA,IACA,MAAM;AAAA,IACN,MAAM;AAAA,MACJ,SAAS,eAAe,KAAK,cAAc,EAAE,SAAS;AAAA,MACtD;AAAA,IACF;AAAA,IACA,cAAc;AAAA,EAChB,CAAC;AAED,QAAM,UAAU,KAAK,WAAW,CAAC;AAEjC,QAAM,MAAM,MAAM,mBAAmB;AAAA,IACnC;AAAA,IACA,iBAAiB;AAAA,IACjB,SAAS;AAAA,MACP,aAAa;AAAA,MACb,cAAc,SAAS;AAAA,IACzB;AAAA,EACF,CAAC;AAGD,MAAI,IAAI,wCAAuC;AAC7C,WAAO;AAAA,EACT;AAEA,QAAM,IAAI,MAAM,qDAAqD,IAAI,IAAI,EAAE;AACjF;","names":[]}
@@ -1,162 +0,0 @@
1
- import {
2
- getInfo
3
- } from "./chunk-SPVJXZL5.mjs";
4
- import {
5
- nowInSeconds,
6
- sleep
7
- } from "./chunk-RQS33JAS.mjs";
8
-
9
- // src/transactions/management/accountSequenceNumber.ts
10
- var AccountSequenceNumber = class {
11
- /**
12
- * Creates an instance of the class with the specified configuration and account details.
13
- * This constructor initializes the necessary parameters for managing Aptos transactions.
14
- *
15
- * @param aptosConfig - The configuration settings for Aptos.
16
- * @param account - The account associated with the Aptos transactions.
17
- * @param maxWaitTime - The maximum time to wait for a transaction to be processed, in milliseconds.
18
- * @param maximumInFlight - The maximum number of transactions that can be in flight at the same time.
19
- * @param sleepTime - The time to sleep between transaction checks, in milliseconds.
20
- * @group Implementation
21
- * @category Transactions
22
- */
23
- constructor(aptosConfig, account, maxWaitTime, maximumInFlight, sleepTime) {
24
- // sequence number on chain
25
- // TODO: Change to Uncommitted
26
- this.lastUncommintedNumber = null;
27
- // local sequence number
28
- this.currentNumber = null;
29
- /**
30
- * We want to guarantee that we preserve ordering of workers to requests.
31
- *
32
- * `lock` is used to try to prevent multiple coroutines from accessing a shared resource at the same time,
33
- * which can result in race conditions and data inconsistency.
34
- * This code actually doesn't do it though, since we aren't giving out a slot, it is still somewhat a race condition.
35
- *
36
- * The ideal solution is likely that each thread grabs the next number from an incremental integer.
37
- * When they complete, they increment that number and that entity is able to enter the `lock`.
38
- * That would guarantee ordering.
39
- * @group Implementation
40
- * @category Transactions
41
- */
42
- this.lock = false;
43
- this.aptosConfig = aptosConfig;
44
- this.account = account;
45
- this.maxWaitTime = maxWaitTime;
46
- this.maximumInFlight = maximumInFlight;
47
- this.sleepTime = sleepTime;
48
- }
49
- /**
50
- * Returns the next available sequence number for this account.
51
- * This function ensures that the sequence number is updated and synchronized, handling potential delays in transaction commits.
52
- *
53
- * @returns {BigInt} The next available sequence number.
54
- * @group Implementation
55
- * @category Transactions
56
- */
57
- async nextSequenceNumber() {
58
- while (this.lock) {
59
- await sleep(this.sleepTime);
60
- }
61
- this.lock = true;
62
- let nextNumber = BigInt(0);
63
- try {
64
- if (this.lastUncommintedNumber === null || this.currentNumber === null) {
65
- await this.initialize();
66
- }
67
- if (this.currentNumber - this.lastUncommintedNumber >= this.maximumInFlight) {
68
- await this.update();
69
- const startTime = nowInSeconds();
70
- while (this.currentNumber - this.lastUncommintedNumber >= this.maximumInFlight) {
71
- await sleep(this.sleepTime);
72
- if (nowInSeconds() - startTime > this.maxWaitTime) {
73
- console.warn(
74
- `Waited over 30 seconds for a transaction to commit, re-syncing ${this.account.accountAddress.toString()}`
75
- );
76
- await this.initialize();
77
- } else {
78
- await this.update();
79
- }
80
- }
81
- }
82
- nextNumber = this.currentNumber;
83
- this.currentNumber += BigInt(1);
84
- } catch (e) {
85
- console.error("error in getting next sequence number for this account", e);
86
- } finally {
87
- this.lock = false;
88
- }
89
- return nextNumber;
90
- }
91
- /**
92
- * Initializes this account with the sequence number on chain.
93
- *
94
- * @returns {Promise<void>} A promise that resolves when the account has been initialized.
95
- *
96
- * @throws {Error} Throws an error if the account information cannot be retrieved.
97
- * @group Implementation
98
- * @category Transactions
99
- */
100
- async initialize() {
101
- const { sequence_number: sequenceNumber } = await getInfo({
102
- aptosConfig: this.aptosConfig,
103
- accountAddress: this.account.accountAddress
104
- });
105
- this.currentNumber = BigInt(sequenceNumber);
106
- this.lastUncommintedNumber = BigInt(sequenceNumber);
107
- }
108
- /**
109
- * Updates this account's sequence number with the one on-chain.
110
- *
111
- * @returns The on-chain sequence number for this account.
112
- * @group Implementation
113
- * @category Transactions
114
- */
115
- async update() {
116
- const { sequence_number: sequenceNumber } = await getInfo({
117
- aptosConfig: this.aptosConfig,
118
- accountAddress: this.account.accountAddress
119
- });
120
- this.lastUncommintedNumber = BigInt(sequenceNumber);
121
- return this.lastUncommintedNumber;
122
- }
123
- /**
124
- * Synchronizes the local sequence number with the sequence number on-chain for the specified account.
125
- * This function polls the network until all submitted transactions have either been committed or until the maximum wait time has elapsed.
126
- *
127
- * @throws {Error} Throws an error if there is an issue synchronizing the account sequence number with the one on-chain.
128
- * @group Implementation
129
- * @category Transactions
130
- */
131
- async synchronize() {
132
- if (this.lastUncommintedNumber === this.currentNumber) return;
133
- while (this.lock) {
134
- await sleep(this.sleepTime);
135
- }
136
- this.lock = true;
137
- try {
138
- await this.update();
139
- const startTime = nowInSeconds();
140
- while (this.lastUncommintedNumber !== this.currentNumber) {
141
- if (nowInSeconds() - startTime > this.maxWaitTime) {
142
- console.warn(
143
- `Waited over 30 seconds for a transaction to commit, re-syncing ${this.account.accountAddress.toString()}`
144
- );
145
- await this.initialize();
146
- } else {
147
- await sleep(this.sleepTime);
148
- await this.update();
149
- }
150
- }
151
- } catch (e) {
152
- console.error("error in synchronizing this account sequence number with the one on chain", e);
153
- } finally {
154
- this.lock = false;
155
- }
156
- }
157
- };
158
-
159
- export {
160
- AccountSequenceNumber
161
- };
162
- //# sourceMappingURL=chunk-JEVGHYEP.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/transactions/management/accountSequenceNumber.ts"],"sourcesContent":["/**\n * A wrapper that handles and manages an account sequence number.\n *\n * Submit up to `maximumInFlight` transactions per account in parallel with a timeout of `sleepTime`\n * If local assumes `maximumInFlight` are in flight, determine the actual committed state from the network\n * If there are less than `maximumInFlight` due to some being committed, adjust the window\n * If `maximumInFlight` are in flight, wait `sleepTime` seconds before re-evaluating\n * If ever waiting more than `maxWaitTime` restart the sequence number to the current on-chain state\n *\n * Assumptions:\n * Accounts are expected to be managed by a single AccountSequenceNumber and not used otherwise.\n * They are initialized to the current on-chain state, so if there are already transactions in\n * flight, they may take some time to reset.\n * Accounts are automatically initialized if not explicitly\n *\n * Notes:\n * This is co-routine safe, that is many async tasks can be reading from this concurrently.\n * The state of an account cannot be used across multiple AccountSequenceNumber services.\n * The synchronize method will create a barrier that prevents additional nextSequenceNumber\n * calls until it is complete.\n * This only manages the distribution of sequence numbers it does not help handle transaction\n * failures.\n * If a transaction fails, you should call synchronize and wait for timeouts.\n * @group Implementation\n * @category Transactions\n */\n\nimport { AptosConfig } from \"../../api/aptosConfig\";\nimport { Account } from \"../../account\";\nimport { getInfo } from \"../../internal/account\";\nimport { nowInSeconds, sleep } from \"../../utils/helpers\";\n\n/**\n * Represents an account's sequence number management for transaction handling on the Aptos blockchain.\n * This class provides methods to retrieve the next available sequence number, synchronize with the on-chain sequence number,\n * and manage local sequence numbers while ensuring thread safety.\n *\n * @param aptosConfig - The configuration settings for Aptos.\n * @param account - The account associated with the sequence number.\n * @param maxWaitTime - The maximum time to wait for a transaction to commit.\n * @param maximumInFlight - The maximum number of transactions that can be in flight at once.\n * @param sleepTime - The time to wait before retrying to get the sequence number.\n * @group Implementation\n * @category Transactions\n */\nexport class AccountSequenceNumber {\n readonly aptosConfig: AptosConfig;\n\n readonly account: Account;\n\n // sequence number on chain\n // TODO: Change to Uncommitted\n lastUncommintedNumber: bigint | null = null;\n\n // local sequence number\n currentNumber: bigint | null = null;\n\n /**\n * We want to guarantee that we preserve ordering of workers to requests.\n *\n * `lock` is used to try to prevent multiple coroutines from accessing a shared resource at the same time,\n * which can result in race conditions and data inconsistency.\n * This code actually doesn't do it though, since we aren't giving out a slot, it is still somewhat a race condition.\n *\n * The ideal solution is likely that each thread grabs the next number from an incremental integer.\n * When they complete, they increment that number and that entity is able to enter the `lock`.\n * That would guarantee ordering.\n * @group Implementation\n * @category Transactions\n */\n lock = false;\n\n maxWaitTime: number;\n\n maximumInFlight: number;\n\n sleepTime: number;\n\n /**\n * Creates an instance of the class with the specified configuration and account details.\n * This constructor initializes the necessary parameters for managing Aptos transactions.\n *\n * @param aptosConfig - The configuration settings for Aptos.\n * @param account - The account associated with the Aptos transactions.\n * @param maxWaitTime - The maximum time to wait for a transaction to be processed, in milliseconds.\n * @param maximumInFlight - The maximum number of transactions that can be in flight at the same time.\n * @param sleepTime - The time to sleep between transaction checks, in milliseconds.\n * @group Implementation\n * @category Transactions\n */\n constructor(\n aptosConfig: AptosConfig,\n account: Account,\n maxWaitTime: number,\n maximumInFlight: number,\n sleepTime: number,\n ) {\n this.aptosConfig = aptosConfig;\n this.account = account;\n this.maxWaitTime = maxWaitTime;\n this.maximumInFlight = maximumInFlight;\n this.sleepTime = sleepTime;\n }\n\n /**\n * Returns the next available sequence number for this account.\n * This function ensures that the sequence number is updated and synchronized, handling potential delays in transaction commits.\n *\n * @returns {BigInt} The next available sequence number.\n * @group Implementation\n * @category Transactions\n */\n async nextSequenceNumber(): Promise<bigint | null> {\n /* eslint-disable no-await-in-loop */\n while (this.lock) {\n await sleep(this.sleepTime);\n }\n\n this.lock = true;\n let nextNumber = BigInt(0);\n try {\n if (this.lastUncommintedNumber === null || this.currentNumber === null) {\n await this.initialize();\n }\n\n if (this.currentNumber! - this.lastUncommintedNumber! >= this.maximumInFlight) {\n await this.update();\n\n const startTime = nowInSeconds();\n while (this.currentNumber! - this.lastUncommintedNumber! >= this.maximumInFlight) {\n await sleep(this.sleepTime);\n if (nowInSeconds() - startTime > this.maxWaitTime) {\n /* eslint-disable no-console */\n console.warn(\n `Waited over 30 seconds for a transaction to commit, re-syncing ${this.account.accountAddress.toString()}`,\n );\n await this.initialize();\n } else {\n await this.update();\n }\n }\n }\n nextNumber = this.currentNumber!;\n this.currentNumber! += BigInt(1);\n } catch (e) {\n console.error(\"error in getting next sequence number for this account\", e);\n } finally {\n this.lock = false;\n }\n return nextNumber;\n }\n\n /**\n * Initializes this account with the sequence number on chain.\n *\n * @returns {Promise<void>} A promise that resolves when the account has been initialized.\n *\n * @throws {Error} Throws an error if the account information cannot be retrieved.\n * @group Implementation\n * @category Transactions\n */\n async initialize(): Promise<void> {\n const { sequence_number: sequenceNumber } = await getInfo({\n aptosConfig: this.aptosConfig,\n accountAddress: this.account.accountAddress,\n });\n this.currentNumber = BigInt(sequenceNumber);\n this.lastUncommintedNumber = BigInt(sequenceNumber);\n }\n\n /**\n * Updates this account's sequence number with the one on-chain.\n *\n * @returns The on-chain sequence number for this account.\n * @group Implementation\n * @category Transactions\n */\n async update(): Promise<bigint> {\n const { sequence_number: sequenceNumber } = await getInfo({\n aptosConfig: this.aptosConfig,\n accountAddress: this.account.accountAddress,\n });\n this.lastUncommintedNumber = BigInt(sequenceNumber);\n return this.lastUncommintedNumber;\n }\n\n /**\n * Synchronizes the local sequence number with the sequence number on-chain for the specified account.\n * This function polls the network until all submitted transactions have either been committed or until the maximum wait time has elapsed.\n *\n * @throws {Error} Throws an error if there is an issue synchronizing the account sequence number with the one on-chain.\n * @group Implementation\n * @category Transactions\n */\n async synchronize(): Promise<void> {\n if (this.lastUncommintedNumber === this.currentNumber) return;\n\n /* eslint-disable no-await-in-loop */\n while (this.lock) {\n await sleep(this.sleepTime);\n }\n\n this.lock = true;\n\n try {\n await this.update();\n const startTime = nowInSeconds();\n while (this.lastUncommintedNumber !== this.currentNumber) {\n if (nowInSeconds() - startTime > this.maxWaitTime) {\n /* eslint-disable no-console */\n console.warn(\n `Waited over 30 seconds for a transaction to commit, re-syncing ${this.account.accountAddress.toString()}`,\n );\n await this.initialize();\n } else {\n await sleep(this.sleepTime);\n await this.update();\n }\n }\n } catch (e) {\n console.error(\"error in synchronizing this account sequence number with the one on chain\", e);\n } finally {\n this.lock = false;\n }\n }\n}\n"],"mappings":";;;;;;;;;AA6CO,IAAM,wBAAN,MAA4B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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NumberOfDelegatorsForAllPools
5
- } from "./chunk-2WBJAKBO.mjs";
6
- import {
7
- waitForIndexerOnVersion
8
- } from "./chunk-WXQUBQK4.mjs";
9
-
10
- // src/api/staking.ts
11
- var Staking = class {
12
- /**
13
- * Creates an instance of the Aptos client with the specified configuration.
14
- * This allows you to interact with the Aptos blockchain using the provided settings.
15
- *
16
- * @param config - The configuration settings for the Aptos client.
17
- * @param config.network - The network to connect to (e.g., TESTNET, MAINNET).
18
- * @param config.nodeUrl - The URL of the Aptos node to connect to.
19
- *
20
- * @example
21
- * ```typescript
22
- * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
23
- *
24
- * async function runExample() {
25
- * // Create a configuration for the Aptos client
26
- * const config = new AptosConfig({ network: Network.TESTNET }); // Specify your network
27
- *
28
- * // Initialize the Aptos client with the configuration
29
- * const aptos = new Aptos(config);
30
- *
31
- * console.log("Aptos client initialized:", aptos);
32
- * }
33
- * runExample().catch(console.error);
34
- * ```
35
- * @group Staking
36
- */
37
- constructor(config) {
38
- this.config = config;
39
- }
40
- /**
41
- * Queries the current number of delegators in a specified pool. Throws an error if the pool is not found.
42
- *
43
- * @param args - The parameters for the query.
44
- * @param args.poolAddress - The address of the pool to query.
45
- * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.
46
- * @returns The number of delegators for the given pool.
47
- *
48
- * @example
49
- * ```typescript
50
- * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
51
- *
52
- * const config = new AptosConfig({ network: Network.TESTNET });
53
- * const aptos = new Aptos(config);
54
- *
55
- * async function runExample() {
56
- * // Get the number of delegators for a specific pool
57
- * const delegators = await aptos.getNumberOfDelegators({ poolAddress: "0x1" }); // replace with a real pool address
58
- * console.log(`Number of delegators: ${delegators}`);
59
- * }
60
- * runExample().catch(console.error);
61
- * ```
62
- * @group Staking
63
- */
64
- async getNumberOfDelegators(args) {
65
- await waitForIndexerOnVersion({
66
- config: this.config,
67
- minimumLedgerVersion: args?.minimumLedgerVersion,
68
- processorType: "stake_processor" /* STAKE_PROCESSOR */
69
- });
70
- return getNumberOfDelegators({ aptosConfig: this.config, ...args });
71
- }
72
- /**
73
- * Retrieves the current number of delegators across all pools.
74
- *
75
- * @param args Optional parameters for the query.
76
- * @param args.minimumLedgerVersion Optional ledger version to sync up to before querying.
77
- * @param args.options Optional ordering options for the response.
78
- * @returns GetNumberOfDelegatorsForAllPoolsResponse response type containing the number of delegators per pool.
79
- *
80
- * @example
81
- * ```typescript
82
- * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
83
- *
84
- * const config = new AptosConfig({ network: Network.TESTNET });
85
- * const aptos = new Aptos(config);
86
- *
87
- * async function runExample() {
88
- * // Retrieve the number of delegators for all pools
89
- * const delegators = await aptos.getNumberOfDelegatorsForAllPools();
90
- * console.log(delegators);
91
- * }
92
- * runExample().catch(console.error);
93
- * ```
94
- * @group Staking
95
- */
96
- async getNumberOfDelegatorsForAllPools(args) {
97
- await waitForIndexerOnVersion({
98
- config: this.config,
99
- minimumLedgerVersion: args?.minimumLedgerVersion,
100
- processorType: "stake_processor" /* STAKE_PROCESSOR */
101
- });
102
- return getNumberOfDelegatorsForAllPools({ aptosConfig: this.config, ...args });
103
- }
104
- /**
105
- * Queries delegated staking activities for a specific delegator and pool.
106
- *
107
- * @param args - The arguments for querying delegated staking activities.
108
- * @param args.delegatorAddress - The address of the delegator.
109
- * @param args.poolAddress - The address of the staking pool.
110
- * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.
111
- * @returns The response containing delegated staking activities.
112
- *
113
- * @example
114
- * ```typescript
115
- * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
116
- *
117
- * const config = new AptosConfig({ network: Network.TESTNET });
118
- * const aptos = new Aptos(config);
119
- *
120
- * async function runExample() {
121
- * // Get delegated staking activities for a specific delegator and pool
122
- * const activities = await aptos.getDelegatedStakingActivities({
123
- * delegatorAddress: "0x1", // replace with a real delegator address
124
- * poolAddress: "0x2", // replace with a real pool address
125
- * minimumLedgerVersion: 1, // specify your own if needed
126
- * });
127
- *
128
- * console.log(activities);
129
- * }
130
- * runExample().catch(console.error);
131
- * ```
132
- * @group Staking
133
- */
134
- async getDelegatedStakingActivities(args) {
135
- await waitForIndexerOnVersion({
136
- config: this.config,
137
- minimumLedgerVersion: args?.minimumLedgerVersion,
138
- processorType: "stake_processor" /* STAKE_PROCESSOR */
139
- });
140
- return getDelegatedStakingActivities({ aptosConfig: this.config, ...args });
141
- }
142
- };
143
-
144
- export {
145
- Staking
146
- };
147
- //# sourceMappingURL=chunk-JFMFZ2IL.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/api/staking.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n getDelegatedStakingActivities,\n getNumberOfDelegators,\n getNumberOfDelegatorsForAllPools,\n} from \"../internal/staking\";\nimport { AnyNumber, GetDelegatedStakingActivitiesResponse, GetNumberOfDelegatorsResponse, OrderByArg } from \"../types\";\nimport { AccountAddressInput } from \"../core\";\nimport { ProcessorType } from \"../utils/const\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { waitForIndexerOnVersion } from \"./utils\";\n\n/**\n * A class to query all `Staking` related queries on Aptos.\n * @group Staking\n */\nexport class Staking {\n /**\n * Creates an instance of the Aptos client with the specified configuration.\n * This allows you to interact with the Aptos blockchain using the provided settings.\n *\n * @param config - The configuration settings for the Aptos client.\n * @param config.network - The network to connect to (e.g., TESTNET, MAINNET).\n * @param config.nodeUrl - The URL of the Aptos node to connect to.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * async function runExample() {\n * // Create a configuration for the Aptos client\n * const config = new AptosConfig({ network: Network.TESTNET }); // Specify your network\n *\n * // Initialize the Aptos client with the configuration\n * const aptos = new Aptos(config);\n *\n * console.log(\"Aptos client initialized:\", aptos);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Staking\n */\n constructor(readonly config: AptosConfig) {}\n\n /**\n * Queries the current number of delegators in a specified pool. Throws an error if the pool is not found.\n *\n * @param args - The parameters for the query.\n * @param args.poolAddress - The address of the pool to query.\n * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.\n * @returns The number of delegators for the given pool.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get the number of delegators for a specific pool\n * const delegators = await aptos.getNumberOfDelegators({ poolAddress: \"0x1\" }); // replace with a real pool address\n * console.log(`Number of delegators: ${delegators}`);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Staking\n */\n async getNumberOfDelegators(args: {\n poolAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args?.minimumLedgerVersion,\n processorType: ProcessorType.STAKE_PROCESSOR,\n });\n return getNumberOfDelegators({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Retrieves the current number of delegators across all pools.\n *\n * @param args Optional parameters for the query.\n * @param args.minimumLedgerVersion Optional ledger version to sync up to before querying.\n * @param args.options Optional ordering options for the response.\n * @returns GetNumberOfDelegatorsForAllPoolsResponse response type containing the number of delegators per pool.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Retrieve the number of delegators for all pools\n * const delegators = await aptos.getNumberOfDelegatorsForAllPools();\n * console.log(delegators);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Staking\n */\n async getNumberOfDelegatorsForAllPools(args?: {\n minimumLedgerVersion?: AnyNumber;\n options?: OrderByArg<GetNumberOfDelegatorsResponse[0]>;\n }): Promise<GetNumberOfDelegatorsResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args?.minimumLedgerVersion,\n processorType: ProcessorType.STAKE_PROCESSOR,\n });\n return getNumberOfDelegatorsForAllPools({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries delegated staking activities for a specific delegator and pool.\n *\n * @param args - The arguments for querying delegated staking activities.\n * @param args.delegatorAddress - The address of the delegator.\n * @param args.poolAddress - The address of the staking pool.\n * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.\n * @returns The response containing delegated staking activities.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get delegated staking activities for a specific delegator and pool\n * const activities = await aptos.getDelegatedStakingActivities({\n * delegatorAddress: \"0x1\", // replace with a real delegator address\n * poolAddress: \"0x2\", // replace with a real pool address\n * minimumLedgerVersion: 1, // specify your own if needed\n * });\n *\n * console.log(activities);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Staking\n */\n async getDelegatedStakingActivities(args: {\n delegatorAddress: AccountAddressInput;\n poolAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<GetDelegatedStakingActivitiesResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args?.minimumLedgerVersion,\n processorType: ProcessorType.STAKE_PROCESSOR,\n });\n return getDelegatedStakingActivities({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":";;;;;;;;;;AAkBO,IAAM,UAAN,MAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA0BnB,YAAqB,QAAqB;AAArB;AAAA,EAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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