@aptos-labs/ts-sdk 0.0.6 → 0.0.8

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 (439) hide show
  1. package/README.md +26 -5
  2. package/dist/browser/index.d.ts +1097 -519
  3. package/dist/browser/index.global.js +49 -28
  4. package/dist/browser/index.global.js.map +1 -1
  5. package/dist/common/index.d.ts +1097 -519
  6. package/dist/common/index.js +48 -27
  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 +214 -18
  11. package/dist/esm/api/ans.mjs +1 -1
  12. package/dist/esm/api/aptos.d.mts +9 -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 +6 -5
  17. package/dist/esm/api/coin.mjs +1 -1
  18. package/dist/esm/api/digitalAsset.d.mts +24 -21
  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 +5 -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 +54 -0
  35. package/dist/esm/api/transactionSubmission/build.mjs +2 -0
  36. package/dist/esm/api/transactionSubmission/sign.d.mts +51 -0
  37. package/dist/esm/api/transactionSubmission/sign.mjs +2 -0
  38. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -0
  39. package/dist/esm/api/transactionSubmission/simulate.d.mts +54 -0
  40. package/dist/esm/api/transactionSubmission/simulate.mjs +2 -0
  41. package/dist/esm/api/transactionSubmission/simulate.mjs.map +1 -0
  42. package/dist/esm/api/transactionSubmission/submit.d.mts +52 -0
  43. package/dist/esm/api/transactionSubmission/submit.mjs +2 -0
  44. package/dist/esm/api/transactionSubmission/submit.mjs.map +1 -0
  45. package/dist/esm/api/transactionSubmission.d.mts +25 -54
  46. package/dist/esm/api/transactionSubmission.mjs +1 -1
  47. package/dist/esm/api/utils.d.mts +21 -0
  48. package/dist/esm/api/utils.mjs +2 -0
  49. package/dist/esm/api/utils.mjs.map +1 -0
  50. package/dist/esm/bcs/deserializer.d.mts +4 -4
  51. package/dist/esm/bcs/deserializer.mjs +1 -1
  52. package/dist/esm/bcs/index.mjs +1 -1
  53. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  54. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  55. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  56. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  57. package/dist/esm/bcs/serializer.d.mts +4 -4
  58. package/dist/esm/bcs/serializer.mjs +1 -1
  59. package/dist/esm/{chunk-UAAI3NCA.mjs → chunk-2SAKPC5Q.mjs} +2 -2
  60. package/dist/esm/chunk-2YQXX64E.mjs +2 -0
  61. package/dist/esm/chunk-2YQXX64E.mjs.map +1 -0
  62. package/dist/esm/chunk-3F5WV6US.mjs +2 -0
  63. package/dist/esm/chunk-3F5WV6US.mjs.map +1 -0
  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-4ADA5BE7.mjs → chunk-53DS6NBQ.mjs} +2 -2
  67. package/dist/esm/chunk-5CUNY7X2.mjs +2 -0
  68. package/dist/esm/chunk-5CUNY7X2.mjs.map +1 -0
  69. package/dist/esm/{chunk-QWVR4RCV.mjs → chunk-5OPOJ43H.mjs} +2 -2
  70. package/dist/esm/{chunk-V45RFKH7.mjs → chunk-5UY5OKXR.mjs} +2 -2
  71. package/dist/esm/chunk-5UY5OKXR.mjs.map +1 -0
  72. package/dist/esm/chunk-5ZVCSKFX.mjs +2 -0
  73. package/dist/esm/chunk-5ZVCSKFX.mjs.map +1 -0
  74. package/dist/esm/{chunk-HVADSXTB.mjs → chunk-73VWOS4Z.mjs} +2 -2
  75. package/dist/esm/chunk-ALFESCPU.mjs +2 -0
  76. package/dist/esm/chunk-ALFESCPU.mjs.map +1 -0
  77. package/dist/esm/chunk-APSQ4M23.mjs +2 -0
  78. package/dist/esm/chunk-APSQ4M23.mjs.map +1 -0
  79. package/dist/esm/{chunk-U25N2VWA.mjs → chunk-AZUWHKN5.mjs} +2 -2
  80. package/dist/esm/{chunk-WX43AJTD.mjs → chunk-BQSE5HHW.mjs} +45 -24
  81. package/dist/esm/chunk-BQSE5HHW.mjs.map +1 -0
  82. package/dist/esm/chunk-CCXMVVXD.mjs +2 -0
  83. package/dist/esm/chunk-CCXMVVXD.mjs.map +1 -0
  84. package/dist/esm/{chunk-JZNLZMUC.mjs → chunk-CJPCOS4R.mjs} +2 -2
  85. package/dist/esm/{chunk-S36IYY6K.mjs → chunk-CL5B2QNS.mjs} +2 -2
  86. package/dist/esm/chunk-CLJLQXFQ.mjs +2 -0
  87. package/dist/esm/chunk-CLJLQXFQ.mjs.map +1 -0
  88. package/dist/esm/{chunk-EWTHPMEE.mjs → chunk-CU2DINU4.mjs} +2 -2
  89. package/dist/esm/chunk-EFRFDFS4.mjs +2 -0
  90. package/dist/esm/chunk-EFRFDFS4.mjs.map +1 -0
  91. package/dist/esm/chunk-EOC4UI5B.mjs +2 -0
  92. package/dist/esm/{chunk-KC64ESLO.mjs.map → chunk-EOC4UI5B.mjs.map} +1 -1
  93. package/dist/esm/{chunk-HA6JD5R6.mjs → chunk-F6K26WV5.mjs} +2 -2
  94. package/dist/esm/{chunk-HA6JD5R6.mjs.map → chunk-F6K26WV5.mjs.map} +1 -1
  95. package/dist/esm/chunk-F7EWDYTE.mjs +2 -0
  96. package/dist/esm/chunk-F7EWDYTE.mjs.map +1 -0
  97. package/dist/esm/{chunk-44MGBJ73.mjs → chunk-FZ56IS3E.mjs} +2 -2
  98. package/dist/esm/chunk-G36AY4R7.mjs +2 -0
  99. package/dist/esm/chunk-G36AY4R7.mjs.map +1 -0
  100. package/dist/esm/chunk-GEZSEAL5.mjs +2 -0
  101. package/dist/esm/chunk-GEZSEAL5.mjs.map +1 -0
  102. package/dist/esm/chunk-GIZLK7M7.mjs +2 -0
  103. package/dist/esm/chunk-GIZLK7M7.mjs.map +1 -0
  104. package/dist/esm/chunk-GMG4VR3K.mjs +2 -0
  105. package/dist/esm/chunk-GMG4VR3K.mjs.map +1 -0
  106. package/dist/esm/{chunk-U6SZNNVL.mjs → chunk-GXPGRCSW.mjs} +2 -2
  107. package/dist/esm/{chunk-U6SZNNVL.mjs.map → chunk-GXPGRCSW.mjs.map} +1 -1
  108. package/dist/esm/{chunk-GEFQFRL3.mjs → chunk-HC5VMNXA.mjs} +2 -2
  109. package/dist/esm/chunk-HTI5LEST.mjs +2 -0
  110. package/dist/esm/chunk-HTI5LEST.mjs.map +1 -0
  111. package/dist/esm/chunk-IELTCGLP.mjs +2 -0
  112. package/dist/esm/chunk-IELTCGLP.mjs.map +1 -0
  113. package/dist/esm/chunk-IHYTP2EW.mjs +1 -0
  114. package/dist/esm/chunk-IHYTP2EW.mjs.map +1 -0
  115. package/dist/esm/chunk-JI2BBZ2W.mjs +2 -0
  116. package/dist/esm/{chunk-3JVGSFHP.mjs.map → chunk-JI2BBZ2W.mjs.map} +1 -1
  117. package/dist/esm/chunk-KKER5KL4.mjs +2 -0
  118. package/dist/esm/chunk-KKER5KL4.mjs.map +1 -0
  119. package/dist/esm/chunk-KNMWDGP4.mjs +2 -0
  120. package/dist/esm/chunk-KNMWDGP4.mjs.map +1 -0
  121. package/dist/esm/{chunk-YYRDFZE6.mjs → chunk-KZSJ5MFF.mjs} +2 -2
  122. package/dist/esm/{chunk-YYRDFZE6.mjs.map → chunk-KZSJ5MFF.mjs.map} +1 -1
  123. package/dist/esm/chunk-MWAMLQ25.mjs +2 -0
  124. package/dist/esm/chunk-MWAMLQ25.mjs.map +1 -0
  125. package/dist/esm/chunk-NL72WE3E.mjs +2 -0
  126. package/dist/esm/{chunk-TIH6ARYP.mjs.map → chunk-NL72WE3E.mjs.map} +1 -1
  127. package/dist/esm/chunk-NZSGGL25.mjs +2 -0
  128. package/dist/esm/chunk-NZSGGL25.mjs.map +1 -0
  129. package/dist/esm/chunk-OBOOY2QD.mjs +2 -0
  130. package/dist/esm/chunk-OBOOY2QD.mjs.map +1 -0
  131. package/dist/esm/chunk-OT2UDMUU.mjs +2 -0
  132. package/dist/esm/chunk-OT2UDMUU.mjs.map +1 -0
  133. package/dist/esm/chunk-OZZDXS26.mjs +2 -0
  134. package/dist/esm/chunk-OZZDXS26.mjs.map +1 -0
  135. package/dist/esm/chunk-P5747ZYC.mjs +2 -0
  136. package/dist/esm/chunk-P5747ZYC.mjs.map +1 -0
  137. package/dist/esm/{chunk-BPYLPPEQ.mjs → chunk-PL2VA73L.mjs} +2 -2
  138. package/dist/esm/chunk-PXTMLJKO.mjs +2 -0
  139. package/dist/esm/{chunk-JDS7K2WI.mjs → chunk-QCBIJCU4.mjs} +2 -2
  140. package/dist/esm/chunk-QEXAMHPU.mjs +2 -0
  141. package/dist/esm/chunk-QEXAMHPU.mjs.map +1 -0
  142. package/dist/esm/{chunk-KQXRH5FK.mjs → chunk-QNTV5NMH.mjs} +2 -2
  143. package/dist/esm/{chunk-EQ5BEDJ7.mjs → chunk-RCM3K5JL.mjs} +2 -2
  144. package/dist/esm/chunk-RLG3WOTH.mjs +2 -0
  145. package/dist/esm/chunk-RLG3WOTH.mjs.map +1 -0
  146. package/dist/esm/chunk-SDPICQ5B.mjs +2 -0
  147. package/dist/esm/{chunk-FYIFBLHU.mjs.map → chunk-SDPICQ5B.mjs.map} +1 -1
  148. package/dist/esm/chunk-SGTFMSOG.mjs +2 -0
  149. package/dist/esm/chunk-SGTFMSOG.mjs.map +1 -0
  150. package/dist/esm/chunk-SO6EE5DX.mjs +2 -0
  151. package/dist/esm/chunk-SO6EE5DX.mjs.map +1 -0
  152. package/dist/esm/chunk-SRGPSANH.mjs +2 -0
  153. package/dist/esm/chunk-SRGPSANH.mjs.map +1 -0
  154. package/dist/esm/{chunk-UPLWWSB4.mjs → chunk-SSJQOXEP.mjs} +2 -2
  155. package/dist/esm/chunk-TZ623H2V.mjs +2 -0
  156. package/dist/esm/chunk-TZ623H2V.mjs.map +1 -0
  157. package/dist/esm/chunk-U6Z4FNB7.mjs +2 -0
  158. package/dist/esm/chunk-U6Z4FNB7.mjs.map +1 -0
  159. package/dist/esm/{chunk-GTC7WHMV.mjs → chunk-UDMADMVO.mjs} +1 -1
  160. package/dist/esm/{chunk-GTC7WHMV.mjs.map → chunk-UDMADMVO.mjs.map} +1 -1
  161. package/dist/esm/chunk-UIVJXLRM.mjs +1 -0
  162. package/dist/esm/chunk-UIVJXLRM.mjs.map +1 -0
  163. package/dist/esm/chunk-UKSA4H2O.mjs +2 -0
  164. package/dist/esm/chunk-UKSA4H2O.mjs.map +1 -0
  165. package/dist/esm/chunk-UW6HQ643.mjs +2 -0
  166. package/dist/esm/chunk-UW6HQ643.mjs.map +1 -0
  167. package/dist/esm/chunk-UWXDXOFK.mjs +2 -0
  168. package/dist/esm/chunk-UWXDXOFK.mjs.map +1 -0
  169. package/dist/esm/chunk-VQ7LYNMD.mjs +2 -0
  170. package/dist/esm/chunk-VQ7LYNMD.mjs.map +1 -0
  171. package/dist/esm/{chunk-U3LO2FSJ.mjs → chunk-WTGGCH34.mjs} +2 -2
  172. package/dist/esm/{chunk-X32O46IB.mjs → chunk-XITLXPBK.mjs} +2 -2
  173. package/dist/esm/chunk-XMUUI6HG.mjs +2 -0
  174. package/dist/esm/{chunk-R3KWVOFG.mjs.map → chunk-XMUUI6HG.mjs.map} +1 -1
  175. package/dist/esm/chunk-XX2Z26FH.mjs +2 -0
  176. package/dist/esm/chunk-XX2Z26FH.mjs.map +1 -0
  177. package/dist/esm/chunk-Y6PVFMBS.mjs +2 -0
  178. package/dist/esm/chunk-Y6PVFMBS.mjs.map +1 -0
  179. package/dist/esm/{chunk-VWVEDCBM.mjs → chunk-YN6UIVFB.mjs} +2 -2
  180. package/dist/esm/chunk-ZFK7QD3B.mjs +2 -0
  181. package/dist/esm/chunk-ZFK7QD3B.mjs.map +1 -0
  182. package/dist/esm/chunk-ZJUDDSWN.mjs +2 -0
  183. package/dist/esm/chunk-ZJUDDSWN.mjs.map +1 -0
  184. package/dist/esm/client/core.mjs +1 -1
  185. package/dist/esm/client/get.d.mts +1 -1
  186. package/dist/esm/client/get.mjs +1 -1
  187. package/dist/esm/client/index.mjs +1 -1
  188. package/dist/esm/client/post.mjs +1 -1
  189. package/dist/esm/core/account.mjs +1 -1
  190. package/dist/esm/core/accountAddress.d.mts +9 -9
  191. package/dist/esm/core/accountAddress.mjs +1 -1
  192. package/dist/esm/core/authenticationKey.mjs +1 -1
  193. package/dist/esm/core/crypto/anyPublicKey.d.mts +5 -0
  194. package/dist/esm/core/crypto/anyPublicKey.mjs +1 -1
  195. package/dist/esm/core/crypto/anySignature.mjs +1 -1
  196. package/dist/esm/core/crypto/asymmetricCrypto.mjs +1 -1
  197. package/dist/esm/core/crypto/ed25519.d.mts +3 -0
  198. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  199. package/dist/esm/core/crypto/index.d.mts +2 -2
  200. package/dist/esm/core/crypto/index.mjs +1 -1
  201. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  202. package/dist/esm/core/crypto/multiKey.d.mts +2 -0
  203. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  204. package/dist/esm/core/crypto/secp256k1.d.mts +3 -0
  205. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  206. package/dist/esm/core/hex.mjs +1 -1
  207. package/dist/esm/core/index.d.mts +2 -2
  208. package/dist/esm/core/index.mjs +1 -1
  209. package/dist/esm/index.d.mts +17 -10
  210. package/dist/esm/index.mjs +1 -1
  211. package/dist/esm/internal/account.d.mts +20 -33
  212. package/dist/esm/internal/account.mjs +1 -1
  213. package/dist/esm/internal/ans.d.mts +78 -14
  214. package/dist/esm/internal/ans.mjs +1 -1
  215. package/dist/esm/internal/coin.d.mts +6 -5
  216. package/dist/esm/internal/coin.mjs +1 -1
  217. package/dist/esm/internal/digitalAsset.d.mts +12 -21
  218. package/dist/esm/internal/digitalAsset.mjs +1 -1
  219. package/dist/esm/internal/event.d.mts +5 -12
  220. package/dist/esm/internal/event.mjs +1 -1
  221. package/dist/esm/internal/faucet.d.mts +2 -2
  222. package/dist/esm/internal/faucet.mjs +1 -1
  223. package/dist/esm/internal/fungibleAsset.d.mts +40 -22
  224. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  225. package/dist/esm/internal/general.d.mts +9 -5
  226. package/dist/esm/internal/general.mjs +1 -1
  227. package/dist/esm/internal/staking.d.mts +4 -6
  228. package/dist/esm/internal/staking.mjs +1 -1
  229. package/dist/esm/internal/transaction.d.mts +12 -4
  230. package/dist/esm/internal/transaction.mjs +1 -1
  231. package/dist/esm/internal/transactionSubmission.d.mts +29 -41
  232. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  233. package/dist/esm/transactions/authenticator/account.d.mts +5 -0
  234. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  235. package/dist/esm/transactions/authenticator/index.d.mts +1 -0
  236. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  237. package/dist/esm/transactions/authenticator/transaction.d.mts +1 -0
  238. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  239. package/dist/esm/transactions/index.d.mts +5 -4
  240. package/dist/esm/transactions/index.mjs +1 -1
  241. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  242. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  243. package/dist/esm/transactions/instances/index.d.mts +1 -0
  244. package/dist/esm/transactions/instances/index.mjs +1 -1
  245. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  246. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  247. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  248. package/dist/esm/transactions/instances/signedTransaction.d.mts +1 -0
  249. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  250. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  251. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +89 -0
  252. package/dist/esm/transactions/management/accountSequenceNumber.mjs +2 -0
  253. package/dist/esm/transactions/management/accountSequenceNumber.mjs.map +1 -0
  254. package/dist/esm/transactions/management/asyncQueue.d.mts +58 -0
  255. package/dist/esm/transactions/management/asyncQueue.mjs +2 -0
  256. package/dist/esm/transactions/management/asyncQueue.mjs.map +1 -0
  257. package/dist/esm/transactions/management/index.d.mts +36 -0
  258. package/dist/esm/transactions/management/index.mjs +2 -0
  259. package/dist/esm/transactions/management/index.mjs.map +1 -0
  260. package/dist/esm/transactions/management/transactionWorker.d.mts +135 -0
  261. package/dist/esm/transactions/management/transactionWorker.mjs +2 -0
  262. package/dist/esm/transactions/management/transactionWorker.mjs.map +1 -0
  263. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +3 -1
  264. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  265. package/dist/esm/transactions/transactionBuilder/index.d.mts +4 -3
  266. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  267. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +3 -1
  268. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  269. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +6 -8
  270. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  271. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  272. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  273. package/dist/esm/transactions/types.d.mts +18 -43
  274. package/dist/esm/types/generated/operations.d.mts +30 -4
  275. package/dist/esm/types/generated/queries.d.mts +8 -5
  276. package/dist/esm/types/generated/queries.mjs +1 -1
  277. package/dist/esm/types/index.d.mts +27 -9
  278. package/dist/esm/types/index.mjs +1 -1
  279. package/dist/esm/types/indexer.d.mts +3 -2
  280. package/dist/esm/utils/const.d.mts +18 -1
  281. package/dist/esm/utils/const.mjs +1 -1
  282. package/dist/esm/utils/index.d.mts +1 -1
  283. package/dist/esm/utils/index.mjs +1 -1
  284. package/dist/esm/version.d.mts +1 -1
  285. package/dist/esm/version.mjs +1 -1
  286. package/package.json +1 -1
  287. package/src/api/account.ts +150 -53
  288. package/src/api/ans.ts +252 -16
  289. package/src/api/aptos.ts +20 -0
  290. package/src/api/aptosConfig.ts +2 -2
  291. package/src/api/coin.ts +4 -8
  292. package/src/api/digitalAsset.ts +75 -25
  293. package/src/api/event.ts +28 -17
  294. package/src/api/faucet.ts +12 -9
  295. package/src/api/fungibleAsset.ts +76 -35
  296. package/src/api/general.ts +19 -3
  297. package/src/api/staking.ts +30 -11
  298. package/src/api/transaction.ts +16 -1
  299. package/src/api/transactionSubmission/build.ts +42 -0
  300. package/src/api/transactionSubmission/sign.ts +44 -0
  301. package/src/api/transactionSubmission/simulate.ts +56 -0
  302. package/src/api/transactionSubmission/submit.ts +53 -0
  303. package/src/api/transactionSubmission.ts +31 -128
  304. package/src/api/utils.ts +37 -0
  305. package/src/bcs/deserializer.ts +4 -4
  306. package/src/bcs/serializer.ts +4 -4
  307. package/src/client/core.ts +6 -4
  308. package/src/client/get.ts +7 -6
  309. package/src/core/accountAddress.ts +20 -22
  310. package/src/core/crypto/anyPublicKey.ts +12 -0
  311. package/src/core/crypto/ed25519.ts +13 -0
  312. package/src/core/crypto/index.ts +2 -0
  313. package/src/core/crypto/secp256k1.ts +12 -0
  314. package/src/core/hex.ts +5 -7
  315. package/src/index.ts +1 -0
  316. package/src/internal/account.ts +56 -50
  317. package/src/internal/ans.ts +423 -24
  318. package/src/internal/coin.ts +6 -8
  319. package/src/internal/digitalAsset.ts +15 -25
  320. package/src/internal/event.ts +7 -14
  321. package/src/internal/faucet.ts +10 -6
  322. package/src/internal/fungibleAsset.ts +36 -18
  323. package/src/internal/general.ts +30 -3
  324. package/src/internal/queries/ansTokenFragment.graphql +9 -0
  325. package/src/internal/queries/getNames.graphql +11 -0
  326. package/src/internal/queries/getNumberOfDelegatorsQuery.graphql +5 -5
  327. package/src/internal/queries/getProcessorStatus.graphql +2 -2
  328. package/src/internal/staking.ts +12 -14
  329. package/src/internal/transaction.ts +23 -26
  330. package/src/internal/transactionSubmission.ts +63 -25
  331. package/src/transactions/authenticator/account.ts +16 -0
  332. package/src/transactions/instances/moduleId.ts +1 -1
  333. package/src/transactions/management/accountSequenceNumber.ts +186 -0
  334. package/src/transactions/management/asyncQueue.ts +107 -0
  335. package/src/transactions/management/index.ts +2 -0
  336. package/src/transactions/management/transactionWorker.ts +275 -0
  337. package/src/transactions/transactionBuilder/helpers.ts +28 -1
  338. package/src/transactions/transactionBuilder/remoteAbi.ts +35 -28
  339. package/src/transactions/transactionBuilder/transactionBuilder.ts +46 -67
  340. package/src/transactions/typeTag/parser.ts +1 -1
  341. package/src/transactions/types.ts +16 -47
  342. package/src/types/generated/operations.ts +33 -2
  343. package/src/types/generated/queries.ts +38 -4
  344. package/src/types/index.ts +67 -11
  345. package/src/types/indexer.ts +3 -0
  346. package/src/utils/const.ts +18 -0
  347. package/src/version.ts +1 -1
  348. package/dist/esm/chunk-2W744GUN.mjs +0 -2
  349. package/dist/esm/chunk-2W744GUN.mjs.map +0 -1
  350. package/dist/esm/chunk-3JVGSFHP.mjs +0 -2
  351. package/dist/esm/chunk-4RVIA63I.mjs +0 -2
  352. package/dist/esm/chunk-4RVIA63I.mjs.map +0 -1
  353. package/dist/esm/chunk-62SCW5NH.mjs +0 -2
  354. package/dist/esm/chunk-62SCW5NH.mjs.map +0 -1
  355. package/dist/esm/chunk-7MNEEVXY.mjs +0 -2
  356. package/dist/esm/chunk-7MNEEVXY.mjs.map +0 -1
  357. package/dist/esm/chunk-AAIBCWZY.mjs +0 -2
  358. package/dist/esm/chunk-AAIBCWZY.mjs.map +0 -1
  359. package/dist/esm/chunk-ARVSIDVB.mjs.map +0 -1
  360. package/dist/esm/chunk-BFSEVKNA.mjs +0 -2
  361. package/dist/esm/chunk-BFSEVKNA.mjs.map +0 -1
  362. package/dist/esm/chunk-BP5ZO7NK.mjs +0 -2
  363. package/dist/esm/chunk-BP5ZO7NK.mjs.map +0 -1
  364. package/dist/esm/chunk-BV4OOU5Y.mjs +0 -2
  365. package/dist/esm/chunk-BV4OOU5Y.mjs.map +0 -1
  366. package/dist/esm/chunk-BWMNPUTK.mjs +0 -2
  367. package/dist/esm/chunk-BWMNPUTK.mjs.map +0 -1
  368. package/dist/esm/chunk-EFIYW4WK.mjs +0 -2
  369. package/dist/esm/chunk-EGOYLZBU.mjs +0 -2
  370. package/dist/esm/chunk-EGOYLZBU.mjs.map +0 -1
  371. package/dist/esm/chunk-EYXHVA6W.mjs +0 -2
  372. package/dist/esm/chunk-EYXHVA6W.mjs.map +0 -1
  373. package/dist/esm/chunk-FYIFBLHU.mjs +0 -2
  374. package/dist/esm/chunk-IG5CHHSI.mjs +0 -2
  375. package/dist/esm/chunk-IG5CHHSI.mjs.map +0 -1
  376. package/dist/esm/chunk-IXMB2GOK.mjs +0 -2
  377. package/dist/esm/chunk-IXMB2GOK.mjs.map +0 -1
  378. package/dist/esm/chunk-J5ZFOJN2.mjs +0 -2
  379. package/dist/esm/chunk-J5ZFOJN2.mjs.map +0 -1
  380. package/dist/esm/chunk-KC64ESLO.mjs +0 -2
  381. package/dist/esm/chunk-NGCFPQ22.mjs +0 -2
  382. package/dist/esm/chunk-NGCFPQ22.mjs.map +0 -1
  383. package/dist/esm/chunk-NTD3H2S4.mjs +0 -2
  384. package/dist/esm/chunk-NTD3H2S4.mjs.map +0 -1
  385. package/dist/esm/chunk-NYFVEKF6.mjs +0 -2
  386. package/dist/esm/chunk-NYFVEKF6.mjs.map +0 -1
  387. package/dist/esm/chunk-NZIJV4O2.mjs +0 -2
  388. package/dist/esm/chunk-NZIJV4O2.mjs.map +0 -1
  389. package/dist/esm/chunk-P32MY5YF.mjs +0 -2
  390. package/dist/esm/chunk-P32MY5YF.mjs.map +0 -1
  391. package/dist/esm/chunk-Q6N6QACD.mjs +0 -2
  392. package/dist/esm/chunk-Q6N6QACD.mjs.map +0 -1
  393. package/dist/esm/chunk-R26XML3D.mjs +0 -2
  394. package/dist/esm/chunk-R26XML3D.mjs.map +0 -1
  395. package/dist/esm/chunk-R3KWVOFG.mjs +0 -2
  396. package/dist/esm/chunk-RYETO74W.mjs +0 -2
  397. package/dist/esm/chunk-RYETO74W.mjs.map +0 -1
  398. package/dist/esm/chunk-TCTZCPQ6.mjs +0 -1
  399. package/dist/esm/chunk-TIH6ARYP.mjs +0 -2
  400. package/dist/esm/chunk-TQD4IGUM.mjs +0 -2
  401. package/dist/esm/chunk-TQD4IGUM.mjs.map +0 -1
  402. package/dist/esm/chunk-UNQNACJT.mjs +0 -2
  403. package/dist/esm/chunk-UNQNACJT.mjs.map +0 -1
  404. package/dist/esm/chunk-V45RFKH7.mjs.map +0 -1
  405. package/dist/esm/chunk-VMQWW5UT.mjs +0 -2
  406. package/dist/esm/chunk-VMQWW5UT.mjs.map +0 -1
  407. package/dist/esm/chunk-VOYW2TZW.mjs +0 -2
  408. package/dist/esm/chunk-VOYW2TZW.mjs.map +0 -1
  409. package/dist/esm/chunk-VYAVLUPJ.mjs +0 -2
  410. package/dist/esm/chunk-VYAVLUPJ.mjs.map +0 -1
  411. package/dist/esm/chunk-WKY5ENCK.mjs +0 -2
  412. package/dist/esm/chunk-WKY5ENCK.mjs.map +0 -1
  413. package/dist/esm/chunk-WX43AJTD.mjs.map +0 -1
  414. package/dist/esm/chunk-Y5DJPHJT.mjs +0 -2
  415. package/dist/esm/chunk-Y5DJPHJT.mjs.map +0 -1
  416. package/dist/esm/chunk-Y7VR7X5W.mjs +0 -2
  417. package/dist/esm/chunk-Y7VR7X5W.mjs.map +0 -1
  418. package/dist/esm/chunk-Z2UDRTHA.mjs +0 -2
  419. package/dist/esm/chunk-Z2UDRTHA.mjs.map +0 -1
  420. /package/dist/esm/{chunk-TCTZCPQ6.mjs.map → api/transactionSubmission/build.mjs.map} +0 -0
  421. /package/dist/esm/{chunk-UAAI3NCA.mjs.map → chunk-2SAKPC5Q.mjs.map} +0 -0
  422. /package/dist/esm/{chunk-4ADA5BE7.mjs.map → chunk-53DS6NBQ.mjs.map} +0 -0
  423. /package/dist/esm/{chunk-QWVR4RCV.mjs.map → chunk-5OPOJ43H.mjs.map} +0 -0
  424. /package/dist/esm/{chunk-HVADSXTB.mjs.map → chunk-73VWOS4Z.mjs.map} +0 -0
  425. /package/dist/esm/{chunk-U25N2VWA.mjs.map → chunk-AZUWHKN5.mjs.map} +0 -0
  426. /package/dist/esm/{chunk-JZNLZMUC.mjs.map → chunk-CJPCOS4R.mjs.map} +0 -0
  427. /package/dist/esm/{chunk-S36IYY6K.mjs.map → chunk-CL5B2QNS.mjs.map} +0 -0
  428. /package/dist/esm/{chunk-EWTHPMEE.mjs.map → chunk-CU2DINU4.mjs.map} +0 -0
  429. /package/dist/esm/{chunk-44MGBJ73.mjs.map → chunk-FZ56IS3E.mjs.map} +0 -0
  430. /package/dist/esm/{chunk-GEFQFRL3.mjs.map → chunk-HC5VMNXA.mjs.map} +0 -0
  431. /package/dist/esm/{chunk-BPYLPPEQ.mjs.map → chunk-PL2VA73L.mjs.map} +0 -0
  432. /package/dist/esm/{chunk-EFIYW4WK.mjs.map → chunk-PXTMLJKO.mjs.map} +0 -0
  433. /package/dist/esm/{chunk-JDS7K2WI.mjs.map → chunk-QCBIJCU4.mjs.map} +0 -0
  434. /package/dist/esm/{chunk-KQXRH5FK.mjs.map → chunk-QNTV5NMH.mjs.map} +0 -0
  435. /package/dist/esm/{chunk-EQ5BEDJ7.mjs.map → chunk-RCM3K5JL.mjs.map} +0 -0
  436. /package/dist/esm/{chunk-UPLWWSB4.mjs.map → chunk-SSJQOXEP.mjs.map} +0 -0
  437. /package/dist/esm/{chunk-U3LO2FSJ.mjs.map → chunk-WTGGCH34.mjs.map} +0 -0
  438. /package/dist/esm/{chunk-X32O46IB.mjs.map → chunk-XITLXPBK.mjs.map} +0 -0
  439. /package/dist/esm/{chunk-VWVEDCBM.mjs.map → chunk-YN6UIVFB.mjs.map} +0 -0
package/src/api/aptos.ts CHANGED
@@ -13,6 +13,10 @@ import { ANS } from "./ans";
13
13
  import { Staking } from "./staking";
14
14
  import { Transaction } from "./transaction";
15
15
  import { TransactionSubmission } from "./transactionSubmission";
16
+ import { Build } from "./transactionSubmission/build";
17
+ import { Sign } from "./transactionSubmission/sign";
18
+ import { Simulate } from "./transactionSubmission/simulate";
19
+ import { Submit } from "./transactionSubmission/submit";
16
20
 
17
21
  /**
18
22
  * This class is the main entry point into Aptos's
@@ -46,6 +50,14 @@ export class Aptos {
46
50
 
47
51
  readonly transactionSubmission: TransactionSubmission;
48
52
 
53
+ readonly build: Build;
54
+
55
+ readonly sign: Sign;
56
+
57
+ readonly simulate: Simulate;
58
+
59
+ readonly submit: Submit;
60
+
49
61
  constructor(settings?: AptosConfig) {
50
62
  this.config = new AptosConfig(settings);
51
63
  this.account = new Account(this.config);
@@ -59,6 +71,10 @@ export class Aptos {
59
71
  this.staking = new Staking(this.config);
60
72
  this.transaction = new Transaction(this.config);
61
73
  this.transactionSubmission = new TransactionSubmission(this.config);
74
+ this.build = new Build(this.config);
75
+ this.sign = new Sign(this.config);
76
+ this.simulate = new Simulate(this.config);
77
+ this.submit = new Submit(this.config);
62
78
  }
63
79
  }
64
80
 
@@ -107,3 +123,7 @@ applyMixin(Aptos, General, "general");
107
123
  applyMixin(Aptos, Staking, "staking");
108
124
  applyMixin(Aptos, Transaction, "transaction");
109
125
  applyMixin(Aptos, TransactionSubmission, "transactionSubmission");
126
+ applyMixin(Aptos, Build, "build");
127
+ applyMixin(Aptos, Sign, "sign");
128
+ applyMixin(Aptos, Simulate, "simulate");
129
+ applyMixin(Aptos, Submit, "submit");
@@ -10,11 +10,11 @@ import { AptosApiType, DEFAULT_NETWORK } from "../utils/const";
10
10
  * This class holds the config information for the SDK client instance.
11
11
  */
12
12
  export class AptosConfig {
13
- /** The Network that this SDK is associated with. */
13
+ /** The Network that this SDK is associated with. Defaults to DEVNET */
14
14
  readonly network: Network;
15
15
 
16
16
  /**
17
- * The client instance the SDK uses
17
+ * The client instance the SDK uses. Defaults to `@aptos-labs/aptos-client
18
18
  */
19
19
  readonly client: Client;
20
20
 
package/src/api/coin.ts CHANGED
@@ -1,21 +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 { Account, AccountAddressInput } from "../core";
6
5
  import { transferCoinTransaction } from "../internal/coin";
7
- import { InputSingleSignerTransaction, InputGenerateTransactionOptions } from "../transactions/types";
6
+ import { SingleSignerTransaction, InputGenerateTransactionOptions } from "../transactions/types";
8
7
  import { AnyNumber, MoveStructId } from "../types";
8
+ import { AptosConfig } from "./aptosConfig";
9
9
 
10
10
  /**
11
11
  * A class to handle all `Coin` operations
12
12
  */
13
13
  export class Coin {
14
- readonly config: AptosConfig;
15
-
16
- constructor(config: AptosConfig) {
17
- this.config = config;
18
- }
14
+ constructor(readonly config: AptosConfig) {}
19
15
 
20
16
  /**
21
17
  * Generate a transfer coin transaction that can be simulated and/or signed and submitted
@@ -33,7 +29,7 @@ export class Coin {
33
29
  amount: AnyNumber;
34
30
  coinType?: MoveStructId;
35
31
  options?: InputGenerateTransactionOptions;
36
- }): Promise<InputSingleSignerTransaction> {
32
+ }): Promise<SingleSignerTransaction> {
37
33
  return transferCoinTransaction({ aptosConfig: this.config, ...args });
38
34
  }
39
35
  }
@@ -2,18 +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
+ OrderByArg,
11
12
  PaginationArgs,
12
13
  TokenStandard,
14
+ TokenStandardArg,
13
15
  } from "../types";
14
- import { AptosConfig } from "./aptosConfig";
15
16
  import { Account, AccountAddressInput } from "../core";
16
- import { InputGenerateTransactionOptions, InputSingleSignerTransaction } from "../transactions/types";
17
+ import { InputGenerateTransactionOptions, SingleSignerTransaction } from "../transactions/types";
17
18
  import {
18
19
  CreateCollectionOptions,
19
20
  createCollectionTransaction,
@@ -25,16 +26,15 @@ import {
25
26
  getTokenData,
26
27
  mintTokenTransaction,
27
28
  } from "../internal/digitalAsset";
29
+ import { ProcessorType } from "../utils/const";
30
+ import { AptosConfig } from "./aptosConfig";
31
+ import { waitForIndexerOnVersion } from "./utils";
28
32
 
29
33
  /**
30
34
  * A class to query all `DigitalAsset` related queries on Aptos.
31
35
  */
32
36
  export class DigitalAsset {
33
- readonly config: AptosConfig;
34
-
35
- constructor(config: AptosConfig) {
36
- this.config = config;
37
- }
37
+ constructor(readonly config: AptosConfig) {}
38
38
 
39
39
  /**
40
40
  * Creates a new collection within the specified account
@@ -69,7 +69,7 @@ export class DigitalAsset {
69
69
  uri: string;
70
70
  options?: InputGenerateTransactionOptions;
71
71
  } & CreateCollectionOptions,
72
- ): Promise<InputSingleSignerTransaction> {
72
+ ): Promise<SingleSignerTransaction> {
73
73
  return createCollectionTransaction({ aptosConfig: this.config, ...args });
74
74
  }
75
75
 
@@ -81,16 +81,21 @@ export class DigitalAsset {
81
81
  *
82
82
  * @param args.creatorAddress the address of the collection's creator
83
83
  * @param args.collectionName the name of the collection
84
+ * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
84
85
  * @param args.options.tokenStandard the token standard to query
85
86
  * @returns GetCollectionDataResponse response type
86
87
  */
87
88
  async getCollectionData(args: {
88
89
  creatorAddress: AccountAddressInput;
89
90
  collectionName: string;
90
- options?: {
91
- tokenStandard?: TokenStandard;
92
- };
91
+ minimumLedgerVersion?: AnyNumber;
92
+ options?: TokenStandardArg;
93
93
  }): Promise<GetCollectionDataResponse> {
94
+ await waitForIndexerOnVersion({
95
+ config: this.config,
96
+ minimumLedgerVersion: args.minimumLedgerVersion,
97
+ processorTypes: getTokenProcessorTypes(args.options?.tokenStandard),
98
+ });
94
99
  return getCollectionData({ aptosConfig: this.config, ...args });
95
100
  }
96
101
 
@@ -102,16 +107,21 @@ export class DigitalAsset {
102
107
  *
103
108
  * @param args.creatorAddress the address of the collection's creator
104
109
  * @param args.collectionName the name of the collection
110
+ * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
105
111
  * @param args.options.tokenStandard the token standard to query
106
112
  * @returns the collection id
107
113
  */
108
114
  async getCollectionId(args: {
109
115
  creatorAddress: AccountAddressInput;
110
116
  collectionName: string;
111
- options?: {
112
- tokenStandard?: TokenStandard;
113
- };
117
+ minimumLedgerVersion?: AnyNumber;
118
+ options?: TokenStandardArg;
114
119
  }): Promise<string> {
120
+ await waitForIndexerOnVersion({
121
+ config: this.config,
122
+ minimumLedgerVersion: args.minimumLedgerVersion,
123
+ processorTypes: getTokenProcessorTypes(args.options?.tokenStandard),
124
+ });
115
125
  return getCollectionId({ aptosConfig: this.config, ...args });
116
126
  }
117
127
 
@@ -133,7 +143,7 @@ export class DigitalAsset {
133
143
  name: string;
134
144
  uri: string;
135
145
  options?: InputGenerateTransactionOptions;
136
- }): Promise<InputSingleSignerTransaction> {
146
+ }): Promise<SingleSignerTransaction> {
137
147
  return mintTokenTransaction({ aptosConfig: this.config, ...args });
138
148
  }
139
149
 
@@ -141,9 +151,19 @@ export class DigitalAsset {
141
151
  * Gets token data given the address of a token.
142
152
  *
143
153
  * @param args.tokenAddress The address of the token
154
+ * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
144
155
  * @returns GetTokenDataResponse containing relevant data to the token.
145
156
  */
146
- async getTokenData(args: { tokenAddress: AccountAddressInput }): Promise<GetTokenDataResponse> {
157
+ async getTokenData(args: {
158
+ tokenAddress: AccountAddressInput;
159
+ minimumLedgerVersion?: AnyNumber;
160
+ }): Promise<GetTokenDataResponse> {
161
+ await waitForIndexerOnVersion({
162
+ config: this.config,
163
+ minimumLedgerVersion: args.minimumLedgerVersion,
164
+ // TODO(greg): Should take in a consistent input for token queries
165
+ processorTypes: getTokenProcessorTypes(undefined),
166
+ });
147
167
  return getTokenData({ aptosConfig: this.config, ...args });
148
168
  }
149
169
 
@@ -151,11 +171,19 @@ export class DigitalAsset {
151
171
  * Gets token ownership data given the address of a token.
152
172
  *
153
173
  * @param args.tokenAddress The address of the token
174
+ * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
154
175
  * @returns GetCurrentTokenOwnershipResponse containing relevant ownership data of the token.
155
176
  */
156
177
  async getCurrentTokenOwnership(args: {
157
178
  tokenAddress: AccountAddressInput;
179
+ minimumLedgerVersion?: AnyNumber;
158
180
  }): Promise<GetCurrentTokenOwnershipResponse> {
181
+ await waitForIndexerOnVersion({
182
+ config: this.config,
183
+ minimumLedgerVersion: args.minimumLedgerVersion,
184
+ // TODO(greg): Should take in a consistent input for token queries
185
+ processorTypes: getTokenProcessorTypes(undefined),
186
+ });
159
187
  return getCurrentTokenOwnership({ aptosConfig: this.config, ...args });
160
188
  }
161
189
 
@@ -163,15 +191,20 @@ export class DigitalAsset {
163
191
  * Gets the tokens that the given address owns.
164
192
  *
165
193
  * @param args.ownerAddress The address of the owner
194
+ * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
166
195
  * @returns GetOwnedTokensResponse containing ownership data of the tokens belonging to the ownerAddresss.
167
196
  */
168
197
  async getOwnedTokens(args: {
169
198
  ownerAddress: AccountAddressInput;
170
- options?: {
171
- pagination?: PaginationArgs;
172
- orderBy?: OrderBy<GetOwnedTokensResponse[0]>;
173
- };
199
+ minimumLedgerVersion?: AnyNumber;
200
+ options?: PaginationArgs & OrderByArg<GetOwnedTokensResponse[0]>;
174
201
  }): Promise<GetOwnedTokensResponse> {
202
+ await waitForIndexerOnVersion({
203
+ config: this.config,
204
+ minimumLedgerVersion: args.minimumLedgerVersion,
205
+ // TODO(greg): Should take in a consistent input for token queries
206
+ processorTypes: getTokenProcessorTypes(undefined),
207
+ });
175
208
  return getOwnedTokens({ aptosConfig: this.config, ...args });
176
209
  }
177
210
 
@@ -179,15 +212,32 @@ export class DigitalAsset {
179
212
  * Gets the activity data given the address of a token.
180
213
  *
181
214
  * @param args.tokenAddress The address of the token
215
+ * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
182
216
  * @returns GetTokenActivityResponse containing relevant activity data to the token.
183
217
  */
184
218
  async getTokenActivity(args: {
185
219
  tokenAddress: AccountAddressInput;
186
- options?: {
187
- pagination?: PaginationArgs;
188
- orderBy?: OrderBy<GetTokenActivityResponse[0]>;
189
- };
220
+ minimumLedgerVersion?: AnyNumber;
221
+ options?: PaginationArgs & OrderByArg<GetTokenActivityResponse[0]>;
190
222
  }): Promise<GetTokenActivityResponse> {
223
+ await waitForIndexerOnVersion({
224
+ config: this.config,
225
+ minimumLedgerVersion: args.minimumLedgerVersion,
226
+ // TODO(greg): Should take in a consistent input for token queries
227
+ processorTypes: getTokenProcessorTypes(undefined),
228
+ });
191
229
  return getTokenActivity({ aptosConfig: this.config, ...args });
192
230
  }
193
231
  }
232
+
233
+ function getTokenProcessorTypes(tokenStandard?: TokenStandard) {
234
+ switch (tokenStandard) {
235
+ case "v1":
236
+ return [ProcessorType.TOKEN_PROCESSOR];
237
+ case "v2":
238
+ return [ProcessorType.TOKEN_V2_PROCESSOR];
239
+ default:
240
+ // If it's something we don't recognize, or undefined, just do both
241
+ return [ProcessorType.TOKEN_PROCESSOR, ProcessorType.TOKEN_V2_PROCESSOR];
242
+ }
243
+ }
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
  }