@aptos-labs/ts-sdk 0.0.7 → 1.0.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 (426) hide show
  1. package/README.md +26 -10
  2. package/dist/browser/index.d.ts +818 -446
  3. package/dist/browser/index.global.js +30 -30
  4. package/dist/browser/index.global.js.map +1 -1
  5. package/dist/common/index.d.ts +818 -446
  6. package/dist/common/index.js +29 -29
  7. package/dist/common/index.js.map +1 -1
  8. package/dist/esm/api/account.d.mts +72 -47
  9. package/dist/esm/api/account.mjs +1 -1
  10. package/dist/esm/api/ans.d.mts +19 -17
  11. package/dist/esm/api/ans.mjs +1 -1
  12. package/dist/esm/api/aptos.d.mts +1 -0
  13. package/dist/esm/api/aptos.mjs +1 -1
  14. package/dist/esm/api/aptosConfig.d.mts +2 -2
  15. package/dist/esm/api/aptosConfig.mjs +1 -1
  16. package/dist/esm/api/coin.d.mts +4 -3
  17. package/dist/esm/api/coin.mjs +1 -1
  18. package/dist/esm/api/digitalAsset.d.mts +42 -19
  19. package/dist/esm/api/digitalAsset.mjs +1 -1
  20. package/dist/esm/api/event.d.mts +12 -14
  21. package/dist/esm/api/event.mjs +1 -1
  22. package/dist/esm/api/faucet.d.mts +4 -4
  23. package/dist/esm/api/faucet.mjs +1 -1
  24. package/dist/esm/api/fungibleAsset.d.mts +71 -30
  25. package/dist/esm/api/fungibleAsset.mjs +1 -1
  26. package/dist/esm/api/general.d.mts +12 -5
  27. package/dist/esm/api/general.mjs +1 -1
  28. package/dist/esm/api/index.d.mts +1 -0
  29. package/dist/esm/api/index.mjs +1 -1
  30. package/dist/esm/api/staking.d.mts +13 -9
  31. package/dist/esm/api/staking.mjs +1 -1
  32. package/dist/esm/api/transaction.d.mts +36 -2
  33. package/dist/esm/api/transaction.mjs +1 -1
  34. package/dist/esm/api/transactionSubmission/build.d.mts +1 -0
  35. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  36. package/dist/esm/api/transactionSubmission/sign.d.mts +1 -0
  37. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  38. package/dist/esm/api/transactionSubmission/simulate.d.mts +1 -0
  39. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  40. package/dist/esm/api/transactionSubmission/submit.d.mts +1 -0
  41. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  42. package/dist/esm/api/transactionSubmission.d.mts +23 -1
  43. package/dist/esm/api/transactionSubmission.mjs +1 -1
  44. package/dist/esm/api/utils.d.mts +21 -0
  45. package/dist/esm/api/utils.mjs +2 -0
  46. package/dist/esm/bcs/deserializer.d.mts +4 -4
  47. package/dist/esm/bcs/deserializer.mjs +1 -1
  48. package/dist/esm/bcs/index.mjs +1 -1
  49. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  50. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  51. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  52. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  53. package/dist/esm/bcs/serializer.d.mts +4 -4
  54. package/dist/esm/bcs/serializer.mjs +1 -1
  55. package/dist/esm/chunk-26GRNGPL.mjs +2 -0
  56. package/dist/esm/chunk-26GRNGPL.mjs.map +1 -0
  57. package/dist/esm/{chunk-72F5YXGC.mjs → chunk-2AMFCGJ3.mjs} +2 -2
  58. package/dist/esm/chunk-2AMFCGJ3.mjs.map +1 -0
  59. package/dist/esm/{chunk-ZUHN56GM.mjs → chunk-2X3FRUKX.mjs} +2 -2
  60. package/dist/esm/chunk-2X3FRUKX.mjs.map +1 -0
  61. package/dist/esm/chunk-32A35CPU.mjs +2 -0
  62. package/dist/esm/chunk-32A35CPU.mjs.map +1 -0
  63. package/dist/esm/{chunk-JZNLZMUC.mjs → chunk-3QS3MFWJ.mjs} +2 -2
  64. package/dist/esm/{chunk-ARVSIDVB.mjs → chunk-3RMXGSHK.mjs} +2 -2
  65. package/dist/esm/chunk-3RMXGSHK.mjs.map +1 -0
  66. package/dist/esm/chunk-4FDIPWVB.mjs +2 -0
  67. package/dist/esm/chunk-4FDIPWVB.mjs.map +1 -0
  68. package/dist/esm/{chunk-U25N2VWA.mjs → chunk-4K252UDE.mjs} +2 -2
  69. package/dist/esm/{chunk-3VZ3OZKC.mjs → chunk-4XQ5IV6C.mjs} +2 -2
  70. package/dist/esm/chunk-5HZKDT5C.mjs +2 -0
  71. package/dist/esm/chunk-5HZKDT5C.mjs.map +1 -0
  72. package/dist/esm/chunk-5IVRKK5V.mjs +2 -0
  73. package/dist/esm/chunk-5IVRKK5V.mjs.map +1 -0
  74. package/dist/esm/chunk-5SRMD5C6.mjs +2 -0
  75. package/dist/esm/chunk-5SRMD5C6.mjs.map +1 -0
  76. package/dist/esm/chunk-5X46HDCI.mjs +2 -0
  77. package/dist/esm/chunk-5X46HDCI.mjs.map +1 -0
  78. package/dist/esm/{chunk-HVADSXTB.mjs → chunk-6DYNAFAP.mjs} +2 -2
  79. package/dist/esm/chunk-6F4ACCCZ.mjs +2 -0
  80. package/dist/esm/chunk-6F4ACCCZ.mjs.map +1 -0
  81. package/dist/esm/{chunk-4ADA5BE7.mjs → chunk-7B3VSBCX.mjs} +2 -2
  82. package/dist/esm/chunk-7IY2Y73Q.mjs +2 -0
  83. package/dist/esm/chunk-7IY2Y73Q.mjs.map +1 -0
  84. package/dist/esm/chunk-7QJYTQSU.mjs +2 -0
  85. package/dist/esm/chunk-7QJYTQSU.mjs.map +1 -0
  86. package/dist/esm/chunk-ALFESCPU.mjs +2 -0
  87. package/dist/esm/chunk-ALFESCPU.mjs.map +1 -0
  88. package/dist/esm/chunk-BA4TDBYB.mjs +2 -0
  89. package/dist/esm/chunk-BA4TDBYB.mjs.map +1 -0
  90. package/dist/esm/chunk-BDTDWLGO.mjs +2 -0
  91. package/dist/esm/chunk-BDTDWLGO.mjs.map +1 -0
  92. package/dist/esm/{chunk-UDBH4CER.mjs → chunk-BQSE5HHW.mjs} +7 -7
  93. package/dist/esm/chunk-BQSE5HHW.mjs.map +1 -0
  94. package/dist/esm/chunk-C3Y52GHM.mjs +2 -0
  95. package/dist/esm/chunk-C3Y52GHM.mjs.map +1 -0
  96. package/dist/esm/chunk-CBAVJ5EN.mjs +2 -0
  97. package/dist/esm/chunk-CBAVJ5EN.mjs.map +1 -0
  98. package/dist/esm/chunk-DBJTMCAG.mjs +2 -0
  99. package/dist/esm/chunk-DBJTMCAG.mjs.map +1 -0
  100. package/dist/esm/chunk-DYJVDOBH.mjs +2 -0
  101. package/dist/esm/chunk-DYJVDOBH.mjs.map +1 -0
  102. package/dist/esm/chunk-EHJEK7FU.mjs +2 -0
  103. package/dist/esm/chunk-ELWWME6B.mjs +2 -0
  104. package/dist/esm/chunk-ELWWME6B.mjs.map +1 -0
  105. package/dist/esm/chunk-EOC4UI5B.mjs +2 -0
  106. package/dist/esm/{chunk-KC64ESLO.mjs.map → chunk-EOC4UI5B.mjs.map} +1 -1
  107. package/dist/esm/{chunk-BPYLPPEQ.mjs → chunk-F2GFSFPW.mjs} +2 -2
  108. package/dist/esm/{chunk-U6SZNNVL.mjs → chunk-F52GIFKT.mjs} +2 -2
  109. package/dist/esm/{chunk-U6SZNNVL.mjs.map → chunk-F52GIFKT.mjs.map} +1 -1
  110. package/dist/esm/{chunk-KQXRH5FK.mjs → chunk-FGTQT7Q5.mjs} +2 -2
  111. package/dist/esm/chunk-GMOHGD73.mjs +2 -0
  112. package/dist/esm/chunk-GMOHGD73.mjs.map +1 -0
  113. package/dist/esm/{chunk-HO7K2UAK.mjs → chunk-GQI3HWOB.mjs} +2 -2
  114. package/dist/esm/{chunk-UAAI3NCA.mjs → chunk-HQ4DGB7L.mjs} +2 -2
  115. package/dist/esm/chunk-IHYTP2EW.mjs +1 -0
  116. package/dist/esm/chunk-IHYTP2EW.mjs.map +1 -0
  117. package/dist/esm/{chunk-HA6JD5R6.mjs → chunk-IU5JZNH4.mjs} +2 -2
  118. package/dist/esm/{chunk-HA6JD5R6.mjs.map → chunk-IU5JZNH4.mjs.map} +1 -1
  119. package/dist/esm/{chunk-TPWSHFFI.mjs → chunk-KR5JAN32.mjs} +2 -2
  120. package/dist/esm/{chunk-QWVR4RCV.mjs → chunk-KVJ2KGMW.mjs} +2 -2
  121. package/dist/esm/chunk-LBNMY7EM.mjs +2 -0
  122. package/dist/esm/chunk-LBNMY7EM.mjs.map +1 -0
  123. package/dist/esm/chunk-MNFGMNYS.mjs +2 -0
  124. package/dist/esm/chunk-MNFGMNYS.mjs.map +1 -0
  125. package/dist/esm/{chunk-IBH7IOIM.mjs → chunk-N25GOEVL.mjs} +2 -2
  126. package/dist/esm/chunk-NBSXZKMQ.mjs +2 -0
  127. package/dist/esm/chunk-NBSXZKMQ.mjs.map +1 -0
  128. package/dist/esm/chunk-NFGAZSSK.mjs +2 -0
  129. package/dist/esm/{chunk-ND3ZQKTT.mjs.map → chunk-NFGAZSSK.mjs.map} +1 -1
  130. package/dist/esm/chunk-NL72WE3E.mjs +2 -0
  131. package/dist/esm/{chunk-TIH6ARYP.mjs.map → chunk-NL72WE3E.mjs.map} +1 -1
  132. package/dist/esm/{chunk-EWTHPMEE.mjs → chunk-NLONZHYT.mjs} +2 -2
  133. package/dist/esm/{chunk-44MGBJ73.mjs → chunk-NMFS5KAE.mjs} +2 -2
  134. package/dist/esm/{chunk-4KTQIWUP.mjs → chunk-NZ36UN4C.mjs} +2 -2
  135. package/dist/esm/{chunk-YYRDFZE6.mjs → chunk-OWP2MKTX.mjs} +2 -2
  136. package/dist/esm/{chunk-YYRDFZE6.mjs.map → chunk-OWP2MKTX.mjs.map} +1 -1
  137. package/dist/esm/{chunk-WL4OXZLN.mjs → chunk-OXO3Z2MF.mjs} +2 -2
  138. package/dist/esm/{chunk-S36IYY6K.mjs → chunk-PANYJULW.mjs} +2 -2
  139. package/dist/esm/{chunk-DRPMIJH7.mjs → chunk-PEBXSNMJ.mjs} +2 -2
  140. package/dist/esm/chunk-PLY7MQKE.mjs +2 -0
  141. package/dist/esm/chunk-PLY7MQKE.mjs.map +1 -0
  142. package/dist/esm/chunk-PRKZ2KJ4.mjs +2 -0
  143. package/dist/esm/{chunk-R3KWVOFG.mjs.map → chunk-PRKZ2KJ4.mjs.map} +1 -1
  144. package/dist/esm/{chunk-GAI75GOG.mjs → chunk-PZ5JKQSP.mjs} +2 -2
  145. package/dist/esm/chunk-Q3R3KKKP.mjs +2 -0
  146. package/dist/esm/chunk-Q3R3KKKP.mjs.map +1 -0
  147. package/dist/esm/chunk-RCYWJZR4.mjs +2 -0
  148. package/dist/esm/chunk-RCYWJZR4.mjs.map +1 -0
  149. package/dist/esm/chunk-TNUGIBLO.mjs +2 -0
  150. package/dist/esm/chunk-TNUGIBLO.mjs.map +1 -0
  151. package/dist/esm/{chunk-3732I6BR.mjs → chunk-TTICPGX6.mjs} +2 -2
  152. package/dist/esm/chunk-U6Z4FNB7.mjs +2 -0
  153. package/dist/esm/chunk-U6Z4FNB7.mjs.map +1 -0
  154. package/dist/esm/{chunk-GTC7WHMV.mjs → chunk-UDMADMVO.mjs} +1 -1
  155. package/dist/esm/{chunk-GTC7WHMV.mjs.map → chunk-UDMADMVO.mjs.map} +1 -1
  156. package/dist/esm/chunk-UES76WF2.mjs +2 -0
  157. package/dist/esm/chunk-UES76WF2.mjs.map +1 -0
  158. package/dist/esm/chunk-UIVJXLRM.mjs +1 -0
  159. package/dist/esm/chunk-UIVJXLRM.mjs.map +1 -0
  160. package/dist/esm/chunk-UR5E2UDO.mjs +2 -0
  161. package/dist/esm/chunk-UR5E2UDO.mjs.map +1 -0
  162. package/dist/esm/{chunk-X32O46IB.mjs → chunk-VMCFN5CT.mjs} +2 -2
  163. package/dist/esm/{chunk-5LO7FR2P.mjs → chunk-W44E6YAW.mjs} +2 -2
  164. package/dist/esm/chunk-W4JEP5GW.mjs +2 -0
  165. package/dist/esm/{chunk-FYIFBLHU.mjs.map → chunk-W4JEP5GW.mjs.map} +1 -1
  166. package/dist/esm/chunk-WXISFVRU.mjs +2 -0
  167. package/dist/esm/chunk-WXISFVRU.mjs.map +1 -0
  168. package/dist/esm/chunk-X7QBDRQR.mjs +2 -0
  169. package/dist/esm/chunk-X7QBDRQR.mjs.map +1 -0
  170. package/dist/esm/chunk-XKINEFAA.mjs +2 -0
  171. package/dist/esm/chunk-XKINEFAA.mjs.map +1 -0
  172. package/dist/esm/chunk-Y5RQOXZH.mjs +2 -0
  173. package/dist/esm/chunk-Y5RQOXZH.mjs.map +1 -0
  174. package/dist/esm/chunk-ZKFDLJ2F.mjs +2 -0
  175. package/dist/esm/chunk-ZKFDLJ2F.mjs.map +1 -0
  176. package/dist/esm/client/core.mjs +1 -1
  177. package/dist/esm/client/get.d.mts +1 -1
  178. package/dist/esm/client/get.mjs +1 -1
  179. package/dist/esm/client/index.mjs +1 -1
  180. package/dist/esm/client/post.mjs +1 -1
  181. package/dist/esm/core/account.mjs +1 -1
  182. package/dist/esm/core/accountAddress.d.mts +9 -9
  183. package/dist/esm/core/accountAddress.mjs +1 -1
  184. package/dist/esm/core/authenticationKey.mjs +1 -1
  185. package/dist/esm/core/crypto/anyPublicKey.d.mts +5 -0
  186. package/dist/esm/core/crypto/anyPublicKey.mjs +1 -1
  187. package/dist/esm/core/crypto/anySignature.mjs +1 -1
  188. package/dist/esm/core/crypto/asymmetricCrypto.mjs +1 -1
  189. package/dist/esm/core/crypto/ed25519.d.mts +3 -0
  190. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  191. package/dist/esm/core/crypto/index.d.mts +2 -2
  192. package/dist/esm/core/crypto/index.mjs +1 -1
  193. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  194. package/dist/esm/core/crypto/multiKey.d.mts +2 -0
  195. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  196. package/dist/esm/core/crypto/secp256k1.d.mts +3 -0
  197. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  198. package/dist/esm/core/hex.mjs +1 -1
  199. package/dist/esm/core/index.d.mts +2 -2
  200. package/dist/esm/core/index.mjs +1 -1
  201. package/dist/esm/index.d.mts +11 -8
  202. package/dist/esm/index.mjs +1 -1
  203. package/dist/esm/internal/account.d.mts +20 -33
  204. package/dist/esm/internal/account.mjs +1 -1
  205. package/dist/esm/internal/ans.d.mts +7 -10
  206. package/dist/esm/internal/ans.mjs +1 -1
  207. package/dist/esm/internal/coin.d.mts +4 -3
  208. package/dist/esm/internal/coin.mjs +1 -1
  209. package/dist/esm/internal/digitalAsset.d.mts +19 -20
  210. package/dist/esm/internal/digitalAsset.mjs +1 -1
  211. package/dist/esm/internal/event.d.mts +5 -12
  212. package/dist/esm/internal/event.mjs +1 -1
  213. package/dist/esm/internal/faucet.d.mts +5 -5
  214. package/dist/esm/internal/faucet.mjs +1 -1
  215. package/dist/esm/internal/fungibleAsset.d.mts +39 -14
  216. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  217. package/dist/esm/internal/general.d.mts +9 -5
  218. package/dist/esm/internal/general.mjs +1 -1
  219. package/dist/esm/internal/staking.d.mts +5 -7
  220. package/dist/esm/internal/staking.mjs +1 -1
  221. package/dist/esm/internal/transaction.d.mts +12 -4
  222. package/dist/esm/internal/transaction.mjs +1 -1
  223. package/dist/esm/internal/transactionSubmission.d.mts +24 -5
  224. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  225. package/dist/esm/transactions/authenticator/account.d.mts +5 -0
  226. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  227. package/dist/esm/transactions/authenticator/index.d.mts +1 -0
  228. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  229. package/dist/esm/transactions/authenticator/transaction.d.mts +1 -0
  230. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  231. package/dist/esm/transactions/index.d.mts +4 -3
  232. package/dist/esm/transactions/index.mjs +1 -1
  233. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  234. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  235. package/dist/esm/transactions/instances/index.d.mts +1 -0
  236. package/dist/esm/transactions/instances/index.mjs +1 -1
  237. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  238. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  239. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  240. package/dist/esm/transactions/instances/signedTransaction.d.mts +1 -0
  241. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  242. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  243. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +89 -0
  244. package/dist/esm/transactions/management/accountSequenceNumber.mjs +2 -0
  245. package/dist/esm/transactions/management/accountSequenceNumber.mjs.map +1 -0
  246. package/dist/esm/transactions/management/asyncQueue.d.mts +58 -0
  247. package/dist/esm/transactions/management/asyncQueue.mjs +2 -0
  248. package/dist/esm/transactions/management/asyncQueue.mjs.map +1 -0
  249. package/dist/esm/transactions/management/index.d.mts +36 -0
  250. package/dist/esm/transactions/management/index.mjs +2 -0
  251. package/dist/esm/transactions/management/index.mjs.map +1 -0
  252. package/dist/esm/transactions/management/transactionWorker.d.mts +135 -0
  253. package/dist/esm/transactions/management/transactionWorker.mjs +2 -0
  254. package/dist/esm/transactions/management/transactionWorker.mjs.map +1 -0
  255. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +3 -1
  256. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  257. package/dist/esm/transactions/transactionBuilder/index.d.mts +4 -3
  258. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  259. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +3 -1
  260. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  261. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +3 -2
  262. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  263. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  264. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  265. package/dist/esm/transactions/types.d.mts +3 -2
  266. package/dist/esm/types/generated/operations.d.mts +3 -3
  267. package/dist/esm/types/generated/queries.d.mts +3 -3
  268. package/dist/esm/types/generated/queries.mjs +1 -1
  269. package/dist/esm/types/index.d.mts +27 -9
  270. package/dist/esm/types/index.mjs +1 -1
  271. package/dist/esm/utils/const.d.mts +18 -1
  272. package/dist/esm/utils/const.mjs +1 -1
  273. package/dist/esm/utils/index.d.mts +1 -1
  274. package/dist/esm/utils/index.mjs +1 -1
  275. package/dist/esm/version.d.mts +1 -1
  276. package/dist/esm/version.mjs +1 -1
  277. package/package.json +1 -1
  278. package/src/api/account.ts +150 -53
  279. package/src/api/ans.ts +19 -22
  280. package/src/api/aptosConfig.ts +2 -2
  281. package/src/api/coin.ts +2 -6
  282. package/src/api/digitalAsset.ts +98 -23
  283. package/src/api/event.ts +28 -17
  284. package/src/api/faucet.ts +12 -9
  285. package/src/api/fungibleAsset.ts +76 -35
  286. package/src/api/general.ts +19 -3
  287. package/src/api/staking.ts +30 -11
  288. package/src/api/transaction.ts +16 -1
  289. package/src/api/transactionSubmission.ts +43 -1
  290. package/src/api/utils.ts +37 -0
  291. package/src/bcs/deserializer.ts +4 -4
  292. package/src/bcs/serializer.ts +4 -4
  293. package/src/client/core.ts +6 -4
  294. package/src/client/get.ts +7 -6
  295. package/src/core/accountAddress.ts +20 -22
  296. package/src/core/crypto/anyPublicKey.ts +12 -0
  297. package/src/core/crypto/ed25519.ts +13 -0
  298. package/src/core/crypto/index.ts +2 -0
  299. package/src/core/crypto/secp256k1.ts +12 -0
  300. package/src/core/hex.ts +5 -7
  301. package/src/index.ts +1 -0
  302. package/src/internal/account.ts +56 -50
  303. package/src/internal/ans.ts +52 -39
  304. package/src/internal/coin.ts +4 -6
  305. package/src/internal/digitalAsset.ts +36 -22
  306. package/src/internal/event.ts +7 -14
  307. package/src/internal/faucet.ts +10 -6
  308. package/src/internal/fungibleAsset.ts +36 -18
  309. package/src/internal/general.ts +30 -3
  310. package/src/internal/queries/getNumberOfDelegatorsQuery.graphql +5 -5
  311. package/src/internal/queries/getProcessorStatus.graphql +2 -2
  312. package/src/internal/staking.ts +12 -14
  313. package/src/internal/transaction.ts +23 -26
  314. package/src/internal/transactionSubmission.ts +35 -5
  315. package/src/transactions/authenticator/account.ts +16 -0
  316. package/src/transactions/instances/moduleId.ts +1 -1
  317. package/src/transactions/management/accountSequenceNumber.ts +186 -0
  318. package/src/transactions/management/asyncQueue.ts +107 -0
  319. package/src/transactions/management/index.ts +2 -0
  320. package/src/transactions/management/transactionWorker.ts +275 -0
  321. package/src/transactions/transactionBuilder/helpers.ts +28 -1
  322. package/src/transactions/transactionBuilder/remoteAbi.ts +47 -32
  323. package/src/transactions/transactionBuilder/transactionBuilder.ts +28 -26
  324. package/src/transactions/typeTag/index.ts +1 -0
  325. package/src/transactions/typeTag/parser.ts +1 -1
  326. package/src/transactions/types.ts +2 -2
  327. package/src/types/generated/operations.ts +4 -2
  328. package/src/types/generated/queries.ts +4 -4
  329. package/src/types/index.ts +67 -11
  330. package/src/utils/const.ts +18 -0
  331. package/src/version.ts +1 -1
  332. package/dist/esm/chunk-2OZRBXLM.mjs +0 -2
  333. package/dist/esm/chunk-2OZRBXLM.mjs.map +0 -1
  334. package/dist/esm/chunk-33T7WTB6.mjs +0 -2
  335. package/dist/esm/chunk-33T7WTB6.mjs.map +0 -1
  336. package/dist/esm/chunk-62SCW5NH.mjs +0 -2
  337. package/dist/esm/chunk-62SCW5NH.mjs.map +0 -1
  338. package/dist/esm/chunk-67OGU66P.mjs +0 -2
  339. package/dist/esm/chunk-67OGU66P.mjs.map +0 -1
  340. package/dist/esm/chunk-72F5YXGC.mjs.map +0 -1
  341. package/dist/esm/chunk-ARVSIDVB.mjs.map +0 -1
  342. package/dist/esm/chunk-BFQRMCY2.mjs +0 -2
  343. package/dist/esm/chunk-BFQRMCY2.mjs.map +0 -1
  344. package/dist/esm/chunk-BM4HBROC.mjs +0 -2
  345. package/dist/esm/chunk-BM4HBROC.mjs.map +0 -1
  346. package/dist/esm/chunk-BV4OOU5Y.mjs +0 -2
  347. package/dist/esm/chunk-BV4OOU5Y.mjs.map +0 -1
  348. package/dist/esm/chunk-EFIYW4WK.mjs +0 -2
  349. package/dist/esm/chunk-FYIFBLHU.mjs +0 -2
  350. package/dist/esm/chunk-GU4OUKAF.mjs +0 -2
  351. package/dist/esm/chunk-GU4OUKAF.mjs.map +0 -1
  352. package/dist/esm/chunk-J5BH7V37.mjs +0 -2
  353. package/dist/esm/chunk-J5BH7V37.mjs.map +0 -1
  354. package/dist/esm/chunk-KC64ESLO.mjs +0 -2
  355. package/dist/esm/chunk-L7AA75WZ.mjs +0 -2
  356. package/dist/esm/chunk-L7AA75WZ.mjs.map +0 -1
  357. package/dist/esm/chunk-LACQ537H.mjs +0 -2
  358. package/dist/esm/chunk-LACQ537H.mjs.map +0 -1
  359. package/dist/esm/chunk-LDAD54H5.mjs +0 -2
  360. package/dist/esm/chunk-LDAD54H5.mjs.map +0 -1
  361. package/dist/esm/chunk-LXW3A3MJ.mjs +0 -2
  362. package/dist/esm/chunk-LXW3A3MJ.mjs.map +0 -1
  363. package/dist/esm/chunk-M2V2POWK.mjs +0 -2
  364. package/dist/esm/chunk-M2V2POWK.mjs.map +0 -1
  365. package/dist/esm/chunk-ND3ZQKTT.mjs +0 -2
  366. package/dist/esm/chunk-NZIJV4O2.mjs +0 -2
  367. package/dist/esm/chunk-NZIJV4O2.mjs.map +0 -1
  368. package/dist/esm/chunk-O2B54NZT.mjs +0 -2
  369. package/dist/esm/chunk-O2B54NZT.mjs.map +0 -1
  370. package/dist/esm/chunk-OCW2L33Q.mjs +0 -2
  371. package/dist/esm/chunk-OCW2L33Q.mjs.map +0 -1
  372. package/dist/esm/chunk-OCYS4V2V.mjs +0 -2
  373. package/dist/esm/chunk-OCYS4V2V.mjs.map +0 -1
  374. package/dist/esm/chunk-OSTH5JRX.mjs +0 -2
  375. package/dist/esm/chunk-OSTH5JRX.mjs.map +0 -1
  376. package/dist/esm/chunk-OVHY6ZUJ.mjs +0 -2
  377. package/dist/esm/chunk-OVHY6ZUJ.mjs.map +0 -1
  378. package/dist/esm/chunk-PZCMSHY6.mjs +0 -2
  379. package/dist/esm/chunk-PZCMSHY6.mjs.map +0 -1
  380. package/dist/esm/chunk-R3KWVOFG.mjs +0 -2
  381. package/dist/esm/chunk-RHS5ROLP.mjs +0 -2
  382. package/dist/esm/chunk-RHS5ROLP.mjs.map +0 -1
  383. package/dist/esm/chunk-RKKU2SY5.mjs +0 -2
  384. package/dist/esm/chunk-RKKU2SY5.mjs.map +0 -1
  385. package/dist/esm/chunk-RYETO74W.mjs +0 -2
  386. package/dist/esm/chunk-RYETO74W.mjs.map +0 -1
  387. package/dist/esm/chunk-TCTZCPQ6.mjs +0 -1
  388. package/dist/esm/chunk-TGKB6ALT.mjs +0 -2
  389. package/dist/esm/chunk-TGKB6ALT.mjs.map +0 -1
  390. package/dist/esm/chunk-TIH6ARYP.mjs +0 -2
  391. package/dist/esm/chunk-UDBH4CER.mjs.map +0 -1
  392. package/dist/esm/chunk-VWVEDCBM.mjs +0 -2
  393. package/dist/esm/chunk-VWVEDCBM.mjs.map +0 -1
  394. package/dist/esm/chunk-WEJAI26R.mjs +0 -2
  395. package/dist/esm/chunk-WEJAI26R.mjs.map +0 -1
  396. package/dist/esm/chunk-Y2HRRUZ6.mjs +0 -2
  397. package/dist/esm/chunk-Y2HRRUZ6.mjs.map +0 -1
  398. package/dist/esm/chunk-Y7VR7X5W.mjs +0 -2
  399. package/dist/esm/chunk-Y7VR7X5W.mjs.map +0 -1
  400. package/dist/esm/chunk-ZLW65YCO.mjs +0 -2
  401. package/dist/esm/chunk-ZLW65YCO.mjs.map +0 -1
  402. package/dist/esm/chunk-ZUHN56GM.mjs.map +0 -1
  403. /package/dist/esm/{chunk-TCTZCPQ6.mjs.map → api/utils.mjs.map} +0 -0
  404. /package/dist/esm/{chunk-JZNLZMUC.mjs.map → chunk-3QS3MFWJ.mjs.map} +0 -0
  405. /package/dist/esm/{chunk-U25N2VWA.mjs.map → chunk-4K252UDE.mjs.map} +0 -0
  406. /package/dist/esm/{chunk-3VZ3OZKC.mjs.map → chunk-4XQ5IV6C.mjs.map} +0 -0
  407. /package/dist/esm/{chunk-HVADSXTB.mjs.map → chunk-6DYNAFAP.mjs.map} +0 -0
  408. /package/dist/esm/{chunk-4ADA5BE7.mjs.map → chunk-7B3VSBCX.mjs.map} +0 -0
  409. /package/dist/esm/{chunk-EFIYW4WK.mjs.map → chunk-EHJEK7FU.mjs.map} +0 -0
  410. /package/dist/esm/{chunk-BPYLPPEQ.mjs.map → chunk-F2GFSFPW.mjs.map} +0 -0
  411. /package/dist/esm/{chunk-KQXRH5FK.mjs.map → chunk-FGTQT7Q5.mjs.map} +0 -0
  412. /package/dist/esm/{chunk-HO7K2UAK.mjs.map → chunk-GQI3HWOB.mjs.map} +0 -0
  413. /package/dist/esm/{chunk-UAAI3NCA.mjs.map → chunk-HQ4DGB7L.mjs.map} +0 -0
  414. /package/dist/esm/{chunk-TPWSHFFI.mjs.map → chunk-KR5JAN32.mjs.map} +0 -0
  415. /package/dist/esm/{chunk-QWVR4RCV.mjs.map → chunk-KVJ2KGMW.mjs.map} +0 -0
  416. /package/dist/esm/{chunk-IBH7IOIM.mjs.map → chunk-N25GOEVL.mjs.map} +0 -0
  417. /package/dist/esm/{chunk-EWTHPMEE.mjs.map → chunk-NLONZHYT.mjs.map} +0 -0
  418. /package/dist/esm/{chunk-44MGBJ73.mjs.map → chunk-NMFS5KAE.mjs.map} +0 -0
  419. /package/dist/esm/{chunk-4KTQIWUP.mjs.map → chunk-NZ36UN4C.mjs.map} +0 -0
  420. /package/dist/esm/{chunk-WL4OXZLN.mjs.map → chunk-OXO3Z2MF.mjs.map} +0 -0
  421. /package/dist/esm/{chunk-S36IYY6K.mjs.map → chunk-PANYJULW.mjs.map} +0 -0
  422. /package/dist/esm/{chunk-DRPMIJH7.mjs.map → chunk-PEBXSNMJ.mjs.map} +0 -0
  423. /package/dist/esm/{chunk-GAI75GOG.mjs.map → chunk-PZ5JKQSP.mjs.map} +0 -0
  424. /package/dist/esm/{chunk-3732I6BR.mjs.map → chunk-TTICPGX6.mjs.map} +0 -0
  425. /package/dist/esm/{chunk-X32O46IB.mjs.map → chunk-VMCFN5CT.mjs.map} +0 -0
  426. /package/dist/esm/{chunk-5LO7FR2P.mjs.map → chunk-W44E6YAW.mjs.map} +0 -0
@@ -2,17 +2,19 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  import {
5
+ AnyNumber,
5
6
  GetCollectionDataResponse,
6
7
  GetCurrentTokenOwnershipResponse,
7
8
  GetOwnedTokensResponse,
8
9
  GetTokenActivityResponse,
9
10
  GetTokenDataResponse,
10
- OrderBy,
11
+ MoveStructId,
12
+ OrderByArg,
11
13
  PaginationArgs,
12
14
  TokenStandard,
15
+ TokenStandardArg,
13
16
  } from "../types";
14
- import { AptosConfig } from "./aptosConfig";
15
- import { Account, AccountAddressInput } from "../core";
17
+ import { Account, AccountAddress, AccountAddressInput } from "../core";
16
18
  import { InputGenerateTransactionOptions, SingleSignerTransaction } from "../transactions/types";
17
19
  import {
18
20
  CreateCollectionOptions,
@@ -24,17 +26,17 @@ import {
24
26
  getTokenActivity,
25
27
  getTokenData,
26
28
  mintTokenTransaction,
29
+ transferDigitalAsset,
27
30
  } from "../internal/digitalAsset";
31
+ import { ProcessorType } from "../utils/const";
32
+ import { AptosConfig } from "./aptosConfig";
33
+ import { waitForIndexerOnVersion } from "./utils";
28
34
 
29
35
  /**
30
36
  * A class to query all `DigitalAsset` related queries on Aptos.
31
37
  */
32
38
  export class DigitalAsset {
33
- readonly config: AptosConfig;
34
-
35
- constructor(config: AptosConfig) {
36
- this.config = config;
37
- }
39
+ constructor(readonly config: AptosConfig) {}
38
40
 
39
41
  /**
40
42
  * Creates a new collection within the specified account
@@ -81,16 +83,21 @@ export class DigitalAsset {
81
83
  *
82
84
  * @param args.creatorAddress the address of the collection's creator
83
85
  * @param args.collectionName the name of the collection
86
+ * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
84
87
  * @param args.options.tokenStandard the token standard to query
85
88
  * @returns GetCollectionDataResponse response type
86
89
  */
87
90
  async getCollectionData(args: {
88
91
  creatorAddress: AccountAddressInput;
89
92
  collectionName: string;
90
- options?: {
91
- tokenStandard?: TokenStandard;
92
- };
93
+ minimumLedgerVersion?: AnyNumber;
94
+ options?: TokenStandardArg;
93
95
  }): Promise<GetCollectionDataResponse> {
96
+ await waitForIndexerOnVersion({
97
+ config: this.config,
98
+ minimumLedgerVersion: args.minimumLedgerVersion,
99
+ processorTypes: getTokenProcessorTypes(args.options?.tokenStandard),
100
+ });
94
101
  return getCollectionData({ aptosConfig: this.config, ...args });
95
102
  }
96
103
 
@@ -102,16 +109,21 @@ export class DigitalAsset {
102
109
  *
103
110
  * @param args.creatorAddress the address of the collection's creator
104
111
  * @param args.collectionName the name of the collection
112
+ * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
105
113
  * @param args.options.tokenStandard the token standard to query
106
114
  * @returns the collection id
107
115
  */
108
116
  async getCollectionId(args: {
109
117
  creatorAddress: AccountAddressInput;
110
118
  collectionName: string;
111
- options?: {
112
- tokenStandard?: TokenStandard;
113
- };
119
+ minimumLedgerVersion?: AnyNumber;
120
+ options?: TokenStandardArg;
114
121
  }): Promise<string> {
122
+ await waitForIndexerOnVersion({
123
+ config: this.config,
124
+ minimumLedgerVersion: args.minimumLedgerVersion,
125
+ processorTypes: getTokenProcessorTypes(args.options?.tokenStandard),
126
+ });
115
127
  return getCollectionId({ aptosConfig: this.config, ...args });
116
128
  }
117
129
 
@@ -141,9 +153,19 @@ export class DigitalAsset {
141
153
  * Gets token data given the address of a token.
142
154
  *
143
155
  * @param args.tokenAddress The address of the token
156
+ * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
144
157
  * @returns GetTokenDataResponse containing relevant data to the token.
145
158
  */
146
- async getTokenData(args: { tokenAddress: AccountAddressInput }): Promise<GetTokenDataResponse> {
159
+ async getTokenData(args: {
160
+ tokenAddress: AccountAddressInput;
161
+ minimumLedgerVersion?: AnyNumber;
162
+ }): Promise<GetTokenDataResponse> {
163
+ await waitForIndexerOnVersion({
164
+ config: this.config,
165
+ minimumLedgerVersion: args.minimumLedgerVersion,
166
+ // TODO(greg): Should take in a consistent input for token queries
167
+ processorTypes: getTokenProcessorTypes(undefined),
168
+ });
147
169
  return getTokenData({ aptosConfig: this.config, ...args });
148
170
  }
149
171
 
@@ -151,11 +173,19 @@ export class DigitalAsset {
151
173
  * Gets token ownership data given the address of a token.
152
174
  *
153
175
  * @param args.tokenAddress The address of the token
176
+ * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
154
177
  * @returns GetCurrentTokenOwnershipResponse containing relevant ownership data of the token.
155
178
  */
156
179
  async getCurrentTokenOwnership(args: {
157
180
  tokenAddress: AccountAddressInput;
181
+ minimumLedgerVersion?: AnyNumber;
158
182
  }): Promise<GetCurrentTokenOwnershipResponse> {
183
+ await waitForIndexerOnVersion({
184
+ config: this.config,
185
+ minimumLedgerVersion: args.minimumLedgerVersion,
186
+ // TODO(greg): Should take in a consistent input for token queries
187
+ processorTypes: getTokenProcessorTypes(undefined),
188
+ });
159
189
  return getCurrentTokenOwnership({ aptosConfig: this.config, ...args });
160
190
  }
161
191
 
@@ -163,15 +193,20 @@ export class DigitalAsset {
163
193
  * Gets the tokens that the given address owns.
164
194
  *
165
195
  * @param args.ownerAddress The address of the owner
196
+ * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
166
197
  * @returns GetOwnedTokensResponse containing ownership data of the tokens belonging to the ownerAddresss.
167
198
  */
168
199
  async getOwnedTokens(args: {
169
200
  ownerAddress: AccountAddressInput;
170
- options?: {
171
- pagination?: PaginationArgs;
172
- orderBy?: OrderBy<GetOwnedTokensResponse[0]>;
173
- };
201
+ minimumLedgerVersion?: AnyNumber;
202
+ options?: PaginationArgs & OrderByArg<GetOwnedTokensResponse[0]>;
174
203
  }): Promise<GetOwnedTokensResponse> {
204
+ await waitForIndexerOnVersion({
205
+ config: this.config,
206
+ minimumLedgerVersion: args.minimumLedgerVersion,
207
+ // TODO(greg): Should take in a consistent input for token queries
208
+ processorTypes: getTokenProcessorTypes(undefined),
209
+ });
175
210
  return getOwnedTokens({ aptosConfig: this.config, ...args });
176
211
  }
177
212
 
@@ -179,15 +214,55 @@ export class DigitalAsset {
179
214
  * Gets the activity data given the address of a token.
180
215
  *
181
216
  * @param args.tokenAddress The address of the token
217
+ * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
182
218
  * @returns GetTokenActivityResponse containing relevant activity data to the token.
183
219
  */
184
220
  async getTokenActivity(args: {
185
221
  tokenAddress: AccountAddressInput;
186
- options?: {
187
- pagination?: PaginationArgs;
188
- orderBy?: OrderBy<GetTokenActivityResponse[0]>;
189
- };
222
+ minimumLedgerVersion?: AnyNumber;
223
+ options?: PaginationArgs & OrderByArg<GetTokenActivityResponse[0]>;
190
224
  }): Promise<GetTokenActivityResponse> {
225
+ await waitForIndexerOnVersion({
226
+ config: this.config,
227
+ minimumLedgerVersion: args.minimumLedgerVersion,
228
+ // TODO(greg): Should take in a consistent input for token queries
229
+ processorTypes: getTokenProcessorTypes(undefined),
230
+ });
191
231
  return getTokenActivity({ aptosConfig: this.config, ...args });
192
232
  }
233
+
234
+ /**
235
+ * Transfer a digital asset (non fungible token) ownership.
236
+ *
237
+ * We can transfer a digital asset only when the digital asset is not frozen
238
+ * (i.e. owner transfer is not disabled such as for soul bound tokens)
239
+ *
240
+ * @param args.sender The sender account of the current digital asset owner
241
+ * @param args.digitalAssetAddress The digital asset address
242
+ * @param args.recipient The recipient account address
243
+ * @param args.digitalAssetType optional. The digital asset type, default to "0x4::token::Token"
244
+ *
245
+ * @returns A SingleSignerTransaction that can be simulated or submitted to chain
246
+ */
247
+ async transferDigitalAsset(args: {
248
+ sender: Account;
249
+ digitalAssetAddress: AccountAddressInput;
250
+ recipient: AccountAddress;
251
+ digitalAssetType?: MoveStructId;
252
+ options?: InputGenerateTransactionOptions;
253
+ }): Promise<SingleSignerTransaction> {
254
+ return transferDigitalAsset({ aptosConfig: this.config, ...args });
255
+ }
256
+ }
257
+
258
+ function getTokenProcessorTypes(tokenStandard?: TokenStandard) {
259
+ switch (tokenStandard) {
260
+ case "v1":
261
+ return [ProcessorType.TOKEN_PROCESSOR];
262
+ case "v2":
263
+ return [ProcessorType.TOKEN_V2_PROCESSOR];
264
+ default:
265
+ // If it's something we don't recognize, or undefined, just do both
266
+ return [ProcessorType.TOKEN_PROCESSOR, ProcessorType.TOKEN_V2_PROCESSOR];
267
+ }
193
268
  }
package/src/api/event.ts CHANGED
@@ -1,34 +1,39 @@
1
1
  // Copyright © Aptos Foundation
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { AptosConfig } from "./aptosConfig";
5
4
  import { getAccountEventsByCreationNumber, getAccountEventsByEventType, getEvents } from "../internal/event";
6
- import { AnyNumber, GetEventsResponse, MoveStructId, OrderBy, PaginationArgs } from "../types";
5
+ import { AnyNumber, GetEventsResponse, MoveStructId, OrderByArg, PaginationArgs, WhereArg } from "../types";
7
6
  import { EventsBoolExp } from "../types/generated/types";
8
7
  import { AccountAddressInput } from "../core";
8
+ import { ProcessorType } from "../utils/const";
9
+ import { AptosConfig } from "./aptosConfig";
10
+ import { waitForIndexerOnVersion } from "./utils";
9
11
 
10
12
  /**
11
13
  * A class to query all `Event` Aptos related queries
12
14
  */
13
15
  export class Event {
14
- readonly config: AptosConfig;
15
-
16
- constructor(config: AptosConfig) {
17
- this.config = config;
18
- }
16
+ constructor(readonly config: AptosConfig) {}
19
17
 
20
18
  /**
21
19
  * Get events by creation number and an account address
22
20
  *
23
21
  * @param args.accountAddress - The account address
24
22
  * @param args.creationNumber - The event creation number
23
+ * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
25
24
  *
26
25
  * @returns Promise<GetEventsResponse>
27
26
  */
28
27
  async getAccountEventsByCreationNumber(args: {
29
28
  accountAddress: AccountAddressInput;
30
29
  creationNumber: AnyNumber;
30
+ minimumLedgerVersion?: AnyNumber;
31
31
  }): Promise<GetEventsResponse> {
32
+ await waitForIndexerOnVersion({
33
+ config: this.config,
34
+ minimumLedgerVersion: args.minimumLedgerVersion,
35
+ processorTypes: [ProcessorType.EVENTS_PROCESSOR],
36
+ });
32
37
  return getAccountEventsByCreationNumber({ aptosConfig: this.config, ...args });
33
38
  }
34
39
 
@@ -37,17 +42,21 @@ export class Event {
37
42
  *
38
43
  * @param args.accountAddress - The account address
39
44
  * @param args.eventType - The event type
45
+ * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
40
46
  *
41
47
  * @returns Promise<GetEventsResponse>
42
48
  */
43
49
  async getAccountEventsByEventType(args: {
44
50
  accountAddress: AccountAddressInput;
45
51
  eventType: MoveStructId;
46
- options?: {
47
- pagination?: PaginationArgs;
48
- orderBy?: OrderBy<GetEventsResponse[0]>;
49
- };
52
+ minimumLedgerVersion?: AnyNumber;
53
+ options?: PaginationArgs & OrderByArg<GetEventsResponse[0]>;
50
54
  }): Promise<GetEventsResponse> {
55
+ await waitForIndexerOnVersion({
56
+ config: this.config,
57
+ minimumLedgerVersion: args.minimumLedgerVersion,
58
+ processorTypes: [ProcessorType.EVENTS_PROCESSOR],
59
+ });
51
60
  return getAccountEventsByEventType({ aptosConfig: this.config, ...args });
52
61
  }
53
62
 
@@ -55,7 +64,7 @@ export class Event {
55
64
  * Get all events
56
65
  *
57
66
  * An optional `where` can be passed in to filter out the response.
58
- *
67
+ *@param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
59
68
  * @example
60
69
  * ```
61
70
  * { where:
@@ -68,12 +77,14 @@ export class Event {
68
77
  * @returns GetEventsQuery response type
69
78
  */
70
79
  async getEvents(args?: {
71
- options?: {
72
- where?: EventsBoolExp;
73
- pagination?: PaginationArgs;
74
- orderBy?: OrderBy<GetEventsResponse[0]>;
75
- };
80
+ minimumLedgerVersion?: AnyNumber;
81
+ options?: PaginationArgs & OrderByArg<GetEventsResponse[0]> & WhereArg<EventsBoolExp>;
76
82
  }): Promise<GetEventsResponse> {
83
+ await waitForIndexerOnVersion({
84
+ config: this.config,
85
+ minimumLedgerVersion: args?.minimumLedgerVersion,
86
+ processorTypes: [ProcessorType.EVENTS_PROCESSOR],
87
+ });
77
88
  return getEvents({ aptosConfig: this.config, ...args });
78
89
  }
79
90
  }
package/src/api/faucet.ts CHANGED
@@ -1,20 +1,17 @@
1
1
  // Copyright © Aptos Foundation
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { AptosConfig } from "./aptosConfig";
5
4
  import { fundAccount } from "../internal/faucet";
6
- import { WaitForTransactionOptions } from "../types";
5
+ import { UserTransactionResponse, WaitForTransactionOptions } from "../types";
7
6
  import { AccountAddressInput } from "../core";
7
+ import { AptosConfig } from "./aptosConfig";
8
+ import { waitForIndexer } from "../internal/transaction";
8
9
 
9
10
  /**
10
11
  * A class to query all `Faucet` related queries on Aptos.
11
12
  */
12
13
  export class Faucet {
13
- readonly config: AptosConfig;
14
-
15
- constructor(config: AptosConfig) {
16
- this.config = config;
17
- }
14
+ constructor(readonly config: AptosConfig) {}
18
15
 
19
16
  /**
20
17
  * This creates an account if it does not exist and mints the specified amount of
@@ -29,7 +26,13 @@ export class Faucet {
29
26
  accountAddress: AccountAddressInput;
30
27
  amount: number;
31
28
  options?: WaitForTransactionOptions;
32
- }): Promise<string> {
33
- return fundAccount({ aptosConfig: this.config, ...args });
29
+ }): Promise<UserTransactionResponse> {
30
+ const fundTxn = await fundAccount({ aptosConfig: this.config, ...args });
31
+
32
+ if (args.options?.waitForIndexer !== false) {
33
+ await waitForIndexer({ aptosConfig: this.config, minimumLedgerVersion: BigInt(fundTxn.version) });
34
+ }
35
+
36
+ return fundTxn;
34
37
  }
35
38
  }
@@ -2,68 +2,82 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  import {
5
+ AnyNumber,
5
6
  GetCurrentFungibleAssetBalancesResponse,
6
7
  GetFungibleAssetActivitiesResponse,
7
8
  GetFungibleAssetMetadataResponse,
8
9
  PaginationArgs,
10
+ WhereArg,
9
11
  } from "../types";
10
- import { AptosConfig } from "./aptosConfig";
11
12
  import {
12
13
  getCurrentFungibleAssetBalances,
13
14
  getFungibleAssetActivities,
14
15
  getFungibleAssetMetadata,
16
+ transferFungibleAsset,
15
17
  } from "../internal/fungibleAsset";
16
18
  import {
17
19
  CurrentFungibleAssetBalancesBoolExp,
18
20
  FungibleAssetActivitiesBoolExp,
19
21
  FungibleAssetMetadataBoolExp,
20
22
  } from "../types/generated/types";
23
+ import { ProcessorType } from "../utils/const";
24
+ import { AptosConfig } from "./aptosConfig";
25
+ import { waitForIndexerOnVersion } from "./utils";
26
+ import { Account, AccountAddress } from "../core";
27
+ import { InputGenerateTransactionOptions, SingleSignerTransaction } from "../transactions";
21
28
 
22
29
  /**
23
30
  * A class to query all `FungibleAsset` related queries on Aptos.
24
31
  */
25
32
  export class FungibleAsset {
26
- readonly config: AptosConfig;
27
-
28
- constructor(config: AptosConfig) {
29
- this.config = config;
30
- }
33
+ constructor(readonly config: AptosConfig) {}
31
34
 
32
35
  /**
33
- * Queries the current fungible asset metadata.
36
+ * Queries all fungible asset metadata.
34
37
  *
35
- * This query returns the fungible asset metadata for all fungible assets.
36
- * It can be filtered by creator address and asset type.
38
+ * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
37
39
  *
38
- * @returns getFungibleAssetMetadata A list of fungible asset metadata
40
+ * @returns A list of fungible asset metadata
39
41
  */
40
42
  async getFungibleAssetMetadata(args?: {
41
- options?: {
42
- pagination?: PaginationArgs;
43
- where?: FungibleAssetMetadataBoolExp;
44
- };
43
+ minimumLedgerVersion?: AnyNumber;
44
+ options?: PaginationArgs & WhereArg<FungibleAssetMetadataBoolExp>;
45
45
  }): Promise<GetFungibleAssetMetadataResponse> {
46
+ await waitForIndexerOnVersion({
47
+ config: this.config,
48
+ minimumLedgerVersion: args?.minimumLedgerVersion,
49
+ processorTypes: [ProcessorType.FUNGIBLE_ASSET_PROCESSOR],
50
+ });
46
51
  return getFungibleAssetMetadata({ aptosConfig: this.config, ...args });
47
52
  }
48
53
 
49
54
  /**
50
- * Queries the current specific fungible asset metadata
55
+ * Queries a fungible asset metadata
51
56
  *
52
57
  * This query returns the fungible asset metadata for a specific fungible asset.
53
58
  *
54
- * @param assetType The asset type of the fungible asset.
59
+ * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
60
+ * @param args.assetType The asset type of the fungible asset.
55
61
  * e.g
56
62
  * "0x1::aptos_coin::AptosCoin" for Aptos Coin
57
63
  * "0xc2948283c2ce03aafbb294821de7ee684b06116bb378ab614fa2de07a99355a8" - address format if this is fungible asset
58
64
  *
59
- * @returns getFungibleAssetMetadata A fungible asset metadata item
65
+ * @returns A fungible asset metadata item
60
66
  */
61
- async getFungibleAssetMetadataByAssetType(assetType: string): Promise<GetFungibleAssetMetadataResponse[0]> {
67
+ async getFungibleAssetMetadataByAssetType(args: {
68
+ assetType: string;
69
+ minimumLedgerVersion?: AnyNumber;
70
+ }): Promise<GetFungibleAssetMetadataResponse[0]> {
71
+ await waitForIndexerOnVersion({
72
+ config: this.config,
73
+ minimumLedgerVersion: args?.minimumLedgerVersion,
74
+ processorTypes: [ProcessorType.FUNGIBLE_ASSET_PROCESSOR],
75
+ });
62
76
  const data = await getFungibleAssetMetadata({
63
77
  aptosConfig: this.config,
64
78
  options: {
65
79
  where: {
66
- asset_type: { _eq: assetType },
80
+ asset_type: { _eq: args.assetType },
67
81
  },
68
82
  },
69
83
  });
@@ -72,36 +86,63 @@ export class FungibleAsset {
72
86
  }
73
87
 
74
88
  /**
75
- * Queries the fungible asset activities
89
+ * Queries all fungible asset activities
76
90
  *
77
- * This query returns the fungible asset activities.
78
- * It can be filtered by owner address, asset type, and type.
91
+ * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
79
92
  *
80
- * @returns GetFungibleAssetActivitiesResponse A list of fungible asset metadata
93
+ * @returns A list of fungible asset metadata
81
94
  */
82
95
  async getFungibleAssetActivities(args?: {
83
- options?: {
84
- pagination?: PaginationArgs;
85
- where?: FungibleAssetActivitiesBoolExp;
86
- };
96
+ minimumLedgerVersion?: AnyNumber;
97
+ options?: PaginationArgs & WhereArg<FungibleAssetActivitiesBoolExp>;
87
98
  }): Promise<GetFungibleAssetActivitiesResponse> {
99
+ await waitForIndexerOnVersion({
100
+ config: this.config,
101
+ minimumLedgerVersion: args?.minimumLedgerVersion,
102
+ processorTypes: [ProcessorType.FUNGIBLE_ASSET_PROCESSOR],
103
+ });
88
104
  return getFungibleAssetActivities({ aptosConfig: this.config, ...args });
89
105
  }
90
106
 
91
107
  /**
92
- * Queries the fungible asset balance
108
+ * Queries all fungible asset balances
93
109
  *
94
- * This query returns the fungible asset balance.
95
- * It can be filtered by owner address, and asset type
110
+ * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
96
111
  *
97
- * @returns GetCurrentFungibleAssetBalancesResponse A list of fungible asset metadata
112
+ * @returns A list of fungible asset metadata
98
113
  */
99
114
  async getCurrentFungibleAssetBalances(args?: {
100
- options?: {
101
- pagination?: PaginationArgs;
102
- where?: CurrentFungibleAssetBalancesBoolExp;
103
- };
115
+ minimumLedgerVersion?: AnyNumber;
116
+ options?: PaginationArgs & WhereArg<CurrentFungibleAssetBalancesBoolExp>;
104
117
  }): Promise<GetCurrentFungibleAssetBalancesResponse> {
118
+ await waitForIndexerOnVersion({
119
+ config: this.config,
120
+ minimumLedgerVersion: args?.minimumLedgerVersion,
121
+ processorTypes: [ProcessorType.FUNGIBLE_ASSET_PROCESSOR],
122
+ });
105
123
  return getCurrentFungibleAssetBalances({ aptosConfig: this.config, ...args });
106
124
  }
125
+
126
+ /**
127
+ * Transfer `amount` of fungible asset from sender's primary store to recipient's primary store.
128
+ *
129
+ * Use this method to transfer any fungible asset including fungible token.
130
+ *
131
+ * @param sender The sender account
132
+ * @param fungibleAssetMetadataAddress The fungible asset account address.
133
+ * For example if you’re transferring USDT this would be the USDT address
134
+ * @param recipient The recipient account address
135
+ * @param amount Number of assets to transfer
136
+ *
137
+ * @returns A SingleSignerTransaction that can be simulated or submitted to chain.
138
+ */
139
+ async transferFungibleAsset(args: {
140
+ sender: Account;
141
+ fungibleAssetMetadataAddress: AccountAddress;
142
+ recipient: AccountAddress;
143
+ amount: AnyNumber;
144
+ options?: InputGenerateTransactionOptions;
145
+ }): Promise<SingleSignerTransaction> {
146
+ return transferFungibleAsset({ aptosConfig: this.config, ...args });
147
+ }
107
148
  }
@@ -8,6 +8,7 @@ import {
8
8
  getChainTopUserTransactions,
9
9
  getIndexerLastSuccessVersion,
10
10
  getLedgerInfo,
11
+ getProcessorStatus,
11
12
  getTableItem,
12
13
  queryIndexer,
13
14
  view,
@@ -16,13 +17,15 @@ import {
16
17
  AnyNumber,
17
18
  Block,
18
19
  GetChainTopUserTransactionsResponse,
20
+ GetProcessorStatusResponse,
19
21
  GraphqlQuery,
20
22
  LedgerInfo,
21
- LedgerVersion,
23
+ LedgerVersionArg,
22
24
  MoveValue,
23
25
  TableItemRequest,
24
26
  InputViewRequestData,
25
27
  } from "../types";
28
+ import { ProcessorType } from "../utils/const";
26
29
 
27
30
  /**
28
31
  * A class to query all `General` Aptos related queries
@@ -114,7 +117,7 @@ export class General {
114
117
  *
115
118
  * @returns Table item value rendered in JSON
116
119
  */
117
- async getTableItem<T>(args: { handle: string; data: TableItemRequest; options?: LedgerVersion }): Promise<T> {
120
+ async getTableItem<T>(args: { handle: string; data: TableItemRequest; options?: LedgerVersionArg }): Promise<T> {
118
121
  return getTableItem<T>({ aptosConfig: this.config, ...args });
119
122
  }
120
123
 
@@ -133,7 +136,10 @@ export class General {
133
136
  *
134
137
  * @returns an array of Move values
135
138
  */
136
- async view<T extends Array<MoveValue>>(args: { payload: InputViewRequestData; options?: LedgerVersion }): Promise<T> {
139
+ async view<T extends Array<MoveValue>>(args: {
140
+ payload: InputViewRequestData;
141
+ options?: LedgerVersionArg;
142
+ }): Promise<T> {
137
143
  return view<T>({ aptosConfig: this.config, ...args });
138
144
  }
139
145
 
@@ -185,4 +191,14 @@ export class General {
185
191
  async getIndexerLastSuccessVersion(): Promise<number> {
186
192
  return getIndexerLastSuccessVersion({ aptosConfig: this.config });
187
193
  }
194
+
195
+ /**
196
+ * Query the processor status for a specific processor type.
197
+ *
198
+ * @param processorType The processor type to query
199
+ * @returns
200
+ */
201
+ async getProcessorStatus(processorType: ProcessorType): Promise<GetProcessorStatusResponse[0]> {
202
+ return getProcessorStatus({ aptosConfig: this.config, processorType });
203
+ }
188
204
  }