@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
@@ -1,26 +1,28 @@
1
1
  // Copyright © Aptos Foundation
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { AptosConfig } from "./aptosConfig";
5
4
  import { AccountAddress, PrivateKey, Account as AccountModule, AccountAddressInput } from "../core";
6
5
  import {
7
6
  AccountData,
7
+ AnyNumber,
8
8
  GetAccountCoinsDataResponse,
9
9
  GetAccountCollectionsWithOwnedTokenResponse,
10
10
  GetAccountOwnedObjectsResponse,
11
11
  GetAccountOwnedTokensFromCollectionResponse,
12
12
  GetAccountOwnedTokensQueryResponse,
13
- LedgerVersion,
13
+ LedgerVersionArg,
14
14
  MoveModuleBytecode,
15
15
  MoveResource,
16
16
  MoveStructId,
17
- OrderBy,
17
+ OrderByArg,
18
18
  PaginationArgs,
19
- TokenStandard,
19
+ TokenStandardArg,
20
20
  TransactionResponse,
21
+ WhereArg,
21
22
  } from "../types";
22
23
  import {
23
24
  deriveAccountFromPrivateKey,
25
+ getAccountCoinAmount,
24
26
  getAccountCoinsCount,
25
27
  getAccountCoinsData,
26
28
  getAccountCollectionsWithOwnedTokens,
@@ -37,16 +39,16 @@ import {
37
39
  getTransactions,
38
40
  lookupOriginalAccountAddress,
39
41
  } from "../internal/account";
42
+ import { APTOS_COIN, ProcessorType } from "../utils/const";
43
+ import { AptosConfig } from "./aptosConfig";
44
+ import { waitForIndexerOnVersion } from "./utils";
45
+ import { CurrentFungibleAssetBalancesBoolExp } from "../types/generated/types";
40
46
 
41
47
  /**
42
48
  * A class to query all `Account` related queries on Aptos.
43
49
  */
44
50
  export class Account {
45
- readonly config: AptosConfig;
46
-
47
- constructor(config: AptosConfig) {
48
- this.config = config;
49
- }
51
+ constructor(readonly config: AptosConfig) {}
50
52
 
51
53
  /**
52
54
  * Queries the current state for an Aptos account given its account address
@@ -83,7 +85,7 @@ export class Account {
83
85
 
84
86
  async getAccountModules(args: {
85
87
  accountAddress: AccountAddressInput;
86
- options?: PaginationArgs & LedgerVersion;
88
+ options?: PaginationArgs & LedgerVersionArg;
87
89
  }): Promise<MoveModuleBytecode[]> {
88
90
  return getModules({ aptosConfig: this.config, ...args });
89
91
  }
@@ -108,7 +110,7 @@ export class Account {
108
110
  async getAccountModule(args: {
109
111
  accountAddress: AccountAddressInput;
110
112
  moduleName: string;
111
- options?: LedgerVersion;
113
+ options?: LedgerVersionArg;
112
114
  }): Promise<MoveModuleBytecode> {
113
115
  return getModule({ aptosConfig: this.config, ...args });
114
116
  }
@@ -149,7 +151,7 @@ export class Account {
149
151
  */
150
152
  async getAccountResources(args: {
151
153
  accountAddress: AccountAddressInput;
152
- options?: PaginationArgs & LedgerVersion;
154
+ options?: PaginationArgs & LedgerVersionArg;
153
155
  }): Promise<MoveResource[]> {
154
156
  return getResources({ aptosConfig: this.config, ...args });
155
157
  }
@@ -168,14 +170,14 @@ export class Account {
168
170
  * @example An example of an account resource
169
171
  * ```
170
172
  * {
171
- * data: { value: 6 }
173
+ * value: 6
172
174
  * }
173
175
  * ```
174
176
  */
175
177
  async getAccountResource<T extends {} = any>(args: {
176
178
  accountAddress: AccountAddressInput;
177
179
  resourceType: MoveStructId;
178
- options?: LedgerVersion;
180
+ options?: LedgerVersionArg;
179
181
  }): Promise<T> {
180
182
  return getResource<T>({ aptosConfig: this.config, ...args });
181
183
  }
@@ -186,13 +188,21 @@ export class Account {
186
188
  * This handles both if the account's authentication key has been rotated or not.
187
189
  *
188
190
  * @param args.authenticationKey The authentication key
191
+ * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
189
192
  * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version
190
193
  * @returns Promise<AccountAddress> The accountAddress associated with the authentication key
191
194
  */
192
195
  async lookupOriginalAccountAddress(args: {
193
196
  authenticationKey: AccountAddressInput;
194
- options?: LedgerVersion;
197
+ minimumLedgerVersion?: AnyNumber;
198
+ options?: LedgerVersionArg;
195
199
  }): Promise<AccountAddress> {
200
+ await waitForIndexerOnVersion({
201
+ config: this.config,
202
+ minimumLedgerVersion: args.minimumLedgerVersion,
203
+ processorTypes: [ProcessorType.ACCOUNT_TRANSACTION_PROCESSOR],
204
+ });
205
+
196
206
  return lookupOriginalAccountAddress({ aptosConfig: this.config, ...args });
197
207
  }
198
208
 
@@ -200,9 +210,18 @@ export class Account {
200
210
  * Queries the current count of tokens owned by an account
201
211
  *
202
212
  * @param args.accountAddress The account address
213
+ * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
203
214
  * @returns Current count of tokens owned by the account
204
215
  */
205
- async getAccountTokensCount(args: { accountAddress: AccountAddressInput }): Promise<number> {
216
+ async getAccountTokensCount(args: {
217
+ accountAddress: AccountAddressInput;
218
+ minimumLedgerVersion?: AnyNumber;
219
+ }): Promise<number> {
220
+ await waitForIndexerOnVersion({
221
+ config: this.config,
222
+ minimumLedgerVersion: args.minimumLedgerVersion,
223
+ processorTypes: [ProcessorType.ACCOUNT_TRANSACTION_PROCESSOR],
224
+ });
206
225
  return getAccountTokensCount({
207
226
  aptosConfig: this.config,
208
227
  ...args,
@@ -216,20 +235,23 @@ export class Account {
216
235
  * If you want to get only the token from a specific standard, you can pass an optional tokenStandard param
217
236
  *
218
237
  * @param args.accountAddress The account address we want to get the tokens for
238
+ * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
219
239
  * @param args.options.tokenStandard The NFT standard to query for
220
- * @param args.options.pagination.offset The number token to start returning results from
221
- * @param args.options.pagination.limit The number of results to return
240
+ * @param args.options.offset The number token to start returning results from
241
+ * @param args.options.limit The number of results to return
222
242
  * @param args.options.orderBy The order to sort the tokens by
223
243
  * @returns Tokens array with the token data
224
244
  */
225
245
  async getAccountOwnedTokens(args: {
226
246
  accountAddress: AccountAddressInput;
227
- options?: {
228
- tokenStandard?: TokenStandard;
229
- pagination?: PaginationArgs;
230
- orderBy?: OrderBy<GetAccountOwnedTokensQueryResponse[0]>;
231
- };
247
+ minimumLedgerVersion?: AnyNumber;
248
+ options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensQueryResponse[0]>;
232
249
  }): Promise<GetAccountOwnedTokensQueryResponse> {
250
+ await waitForIndexerOnVersion({
251
+ config: this.config,
252
+ minimumLedgerVersion: args.minimumLedgerVersion,
253
+ processorTypes: [ProcessorType.ACCOUNT_TRANSACTION_PROCESSOR],
254
+ });
233
255
  return getAccountOwnedTokens({
234
256
  aptosConfig: this.config,
235
257
  ...args,
@@ -244,21 +266,24 @@ export class Account {
244
266
  *
245
267
  * @param args.accountAddress The account address we want to get the tokens for
246
268
  * @param args.collectionAddress The address of the collection being queried
269
+ * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
247
270
  * @param args.options.tokenStandard The NFT standard to query for
248
- * @param args.options.pagination.offset The number token to start returning results from
249
- * @param args.options.pagination.limit The number of results to return
271
+ * @param args.options.offset The number token to start returning results from
272
+ * @param args.options.limit The number of results to return
250
273
  * @param args.options.orderBy The order to sort the tokens by
251
274
  * @returns Tokens array with the token data
252
275
  */
253
276
  async getAccountOwnedTokensFromCollectionAddress(args: {
254
277
  accountAddress: AccountAddressInput;
255
278
  collectionAddress: AccountAddressInput;
256
- options?: {
257
- tokenStandard?: TokenStandard;
258
- pagination?: PaginationArgs;
259
- orderBy?: OrderBy<GetAccountOwnedTokensFromCollectionResponse[0]>;
260
- };
279
+ minimumLedgerVersion?: AnyNumber;
280
+ options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensFromCollectionResponse[0]>;
261
281
  }): Promise<GetAccountOwnedTokensFromCollectionResponse> {
282
+ await waitForIndexerOnVersion({
283
+ config: this.config,
284
+ minimumLedgerVersion: args.minimumLedgerVersion,
285
+ processorTypes: [ProcessorType.ACCOUNT_TRANSACTION_PROCESSOR],
286
+ });
262
287
  return getAccountOwnedTokensFromCollectionAddress({
263
288
  aptosConfig: this.config,
264
289
  ...args,
@@ -272,20 +297,23 @@ export class Account {
272
297
  * If you want to get only the token from a specific standard, you can pass an optional tokenStandard param
273
298
  *
274
299
  * @param args.accountAddress The account address we want to get the collections for
300
+ * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
275
301
  * @param args.options.tokenStandard The NFT standard to query for
276
- * @param args.options.pagination.offset The number collection to start returning results from
277
- * @param args.options.pagination.limit The number of results to return
302
+ * @param args.options.offset The number collection to start returning results from
303
+ * @param args.options.limit The number of results to return
278
304
  * @param args.options.orderBy The order to sort the tokens by
279
305
  * @returns Collections array with the collections data
280
306
  */
281
307
  async getAccountCollectionsWithOwnedTokens(args: {
282
308
  accountAddress: AccountAddressInput;
283
- options?: {
284
- tokenStandard?: TokenStandard;
285
- pagination?: PaginationArgs;
286
- orderBy?: OrderBy<GetAccountCollectionsWithOwnedTokenResponse[0]>;
287
- };
309
+ minimumLedgerVersion?: AnyNumber;
310
+ options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountCollectionsWithOwnedTokenResponse[0]>;
288
311
  }): Promise<GetAccountCollectionsWithOwnedTokenResponse> {
312
+ await waitForIndexerOnVersion({
313
+ config: this.config,
314
+ minimumLedgerVersion: args.minimumLedgerVersion,
315
+ processorTypes: [ProcessorType.ACCOUNT_TRANSACTION_PROCESSOR],
316
+ });
289
317
  return getAccountCollectionsWithOwnedTokens({
290
318
  aptosConfig: this.config,
291
319
  ...args,
@@ -296,9 +324,18 @@ export class Account {
296
324
  * Queries the current count of transactions submitted by an account
297
325
  *
298
326
  * @param args.accountAddress The account address we want to get the total count for
327
+ * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
299
328
  * @returns Current count of transactions made by an account
300
329
  */
301
- async getAccountTransactionsCount(args: { accountAddress: AccountAddressInput }): Promise<number> {
330
+ async getAccountTransactionsCount(args: {
331
+ accountAddress: AccountAddressInput;
332
+ minimumLedgerVersion?: AnyNumber;
333
+ }): Promise<number> {
334
+ await waitForIndexerOnVersion({
335
+ config: this.config,
336
+ minimumLedgerVersion: args.minimumLedgerVersion,
337
+ processorTypes: [ProcessorType.ACCOUNT_TRANSACTION_PROCESSOR],
338
+ });
302
339
  return getAccountTransactionsCount({
303
340
  aptosConfig: this.config,
304
341
  ...args,
@@ -309,18 +346,25 @@ export class Account {
309
346
  * Queries an account's coins data
310
347
  *
311
348
  * @param args.accountAddress The account address we want to get the coins data for
312
- * @param args.options.pagination.offset The number coin to start returning results from
313
- * @param args.options.pagination.limit The number of results to return
314
- * @param args.options.orderBy The order to sort the coins by
349
+ * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
350
+ * @param args.options.offset optional. The number coin to start returning results from
351
+ * @param args.options.limit optional. The number of results to return
352
+ * @param args.options.orderBy optional. The order to sort the coins by
353
+ * @param args.options.where optional. Filter the results by
315
354
  * @returns Array with the coins data
316
355
  */
317
356
  async getAccountCoinsData(args: {
318
357
  accountAddress: AccountAddressInput;
319
- options?: {
320
- pagination?: PaginationArgs;
321
- orderBy?: OrderBy<GetAccountCoinsDataResponse[0]>;
322
- };
358
+ minimumLedgerVersion?: AnyNumber;
359
+ options?: PaginationArgs &
360
+ OrderByArg<GetAccountCoinsDataResponse[0]> &
361
+ WhereArg<CurrentFungibleAssetBalancesBoolExp>;
323
362
  }): Promise<GetAccountCoinsDataResponse> {
363
+ await waitForIndexerOnVersion({
364
+ config: this.config,
365
+ minimumLedgerVersion: args.minimumLedgerVersion,
366
+ processorTypes: [ProcessorType.ACCOUNT_TRANSACTION_PROCESSOR],
367
+ });
324
368
  return getAccountCoinsData({
325
369
  aptosConfig: this.config,
326
370
  ...args,
@@ -331,28 +375,81 @@ export class Account {
331
375
  * Queries the current count of an account's coins aggregated
332
376
  *
333
377
  * @param args.accountAddress The account address we want to get the total count for
378
+ * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
334
379
  * @returns Current count of the aggregated count of all account's coins
335
380
  */
336
- async getAccountCoinsCount(args: { accountAddress: AccountAddressInput }): Promise<number> {
381
+ async getAccountCoinsCount(args: {
382
+ accountAddress: AccountAddressInput;
383
+ minimumLedgerVersion?: AnyNumber;
384
+ }): Promise<number> {
385
+ await waitForIndexerOnVersion({
386
+ config: this.config,
387
+ minimumLedgerVersion: args.minimumLedgerVersion,
388
+ processorTypes: [ProcessorType.ACCOUNT_TRANSACTION_PROCESSOR],
389
+ });
337
390
  return getAccountCoinsCount({ aptosConfig: this.config, ...args });
338
391
  }
339
392
 
393
+ /**
394
+ * Queries the account's APT amount
395
+ *
396
+ * @param args.accountAddress The account address we want to get the total count for
397
+ * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
398
+ * @returns Current amount of account's APT
399
+ */
400
+ async getAccountAPTAmount(args: {
401
+ accountAddress: AccountAddressInput;
402
+ minimumLedgerVersion?: AnyNumber;
403
+ }): Promise<number> {
404
+ await waitForIndexerOnVersion({
405
+ config: this.config,
406
+ minimumLedgerVersion: args.minimumLedgerVersion,
407
+ processorTypes: [ProcessorType.ACCOUNT_TRANSACTION_PROCESSOR],
408
+ });
409
+ return getAccountCoinAmount({ aptosConfig: this.config, coinType: APTOS_COIN, ...args });
410
+ }
411
+
412
+ /**
413
+ * Queries the account's coin amount by the coin type
414
+ *
415
+ * @param args.accountAddress The account address we want to get the total count for
416
+ * @param args.coinType The coin type to query
417
+ * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
418
+ * @returns Current amount of account's coin
419
+ */
420
+ async getAccountCoinAmount(args: {
421
+ accountAddress: AccountAddressInput;
422
+ coinType: MoveStructId;
423
+ minimumLedgerVersion?: AnyNumber;
424
+ }): Promise<number> {
425
+ await waitForIndexerOnVersion({
426
+ config: this.config,
427
+ minimumLedgerVersion: args.minimumLedgerVersion,
428
+ processorTypes: [ProcessorType.ACCOUNT_TRANSACTION_PROCESSOR],
429
+ });
430
+ return getAccountCoinAmount({ aptosConfig: this.config, ...args });
431
+ }
432
+
340
433
  /**
341
434
  * Queries an account's owned objects
342
435
  *
343
436
  * @param args.accountAddress The account address we want to get the objects for
344
- * @param args.options.pagination.offset The number coin to start returning results from
345
- * @param args.options.pagination.limit The number of results to return
346
- * @param args.options.orderBy The order to sort the coins by
437
+ * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
438
+ * @param args.options.offset The starting position to start returning results from
439
+ * @param args.options.limit The number of results to return
440
+ * @param args.options.orderBy The order to sort the objects by
347
441
  * @returns Objects array with the object data
348
442
  */
349
443
  async getAccountOwnedObjects(args: {
350
444
  accountAddress: AccountAddressInput;
351
- options?: {
352
- pagination?: PaginationArgs;
353
- orderBy?: OrderBy<GetAccountOwnedObjectsResponse[0]>;
354
- };
445
+ minimumLedgerVersion?: AnyNumber;
446
+ options?: PaginationArgs & OrderByArg<GetAccountOwnedObjectsResponse[0]>;
355
447
  }): Promise<GetAccountOwnedObjectsResponse> {
448
+ await waitForIndexerOnVersion({
449
+ config: this.config,
450
+ minimumLedgerVersion: args.minimumLedgerVersion,
451
+ processorTypes: [ProcessorType.ACCOUNT_TRANSACTION_PROCESSOR],
452
+ });
356
453
  return getAccountOwnedObjects({
357
454
  aptosConfig: this.config,
358
455
  ...args,
package/src/api/ans.ts CHANGED
@@ -30,11 +30,7 @@ import { AptosConfig } from "./aptosConfig";
30
30
  * A class to handle all `ANS` operations
31
31
  */
32
32
  export class ANS {
33
- readonly config: AptosConfig;
34
-
35
- constructor(config: AptosConfig) {
36
- this.config = config;
37
- }
33
+ constructor(readonly config: AptosConfig) {}
38
34
 
39
35
  /**
40
36
  * Retrieve the owner address of a domain name or subdomain name from the contract.
@@ -64,7 +60,7 @@ export class ANS {
64
60
  *
65
61
  * @param args.name - A string of the name to retrieve
66
62
  *
67
- * @returns number as a unix timestamp in seconds.
63
+ * @returns number as a unix timestamp in milliseconds.
68
64
  */
69
65
  async getExpiration(args: { name: string }): Promise<number | undefined> {
70
66
  return getExpiration({ aptosConfig: this.config, ...args });
@@ -94,9 +90,9 @@ export class ANS {
94
90
  * point to addresses that are not the owner of the name
95
91
  *
96
92
  * ```ts
97
- * await aptos.setTargetAddress({sender: alice, name: "test.aptos", address: bob.accountAddress.toString})
93
+ * await aptos.setTargetAddress({sender: alice, name: "test.aptos", address: bob.accountAddress})
98
94
  * const address = await aptos.getTargetAddress({name: "test.aptos"})
99
- * // address = bob.accountAddress.toString()
95
+ * // address = bob.accountAddress
100
96
  * ```
101
97
  *
102
98
  * @param args.name - A string of the name: test.aptos.apt, test.apt, test, test.aptos, etc.
@@ -119,7 +115,7 @@ export class ANS {
119
115
  * account also may not have a primary name.
120
116
  *
121
117
  * ```ts
122
- * const name = await aptos.getPrimaryName({address: alice.accountAddress.toString()})
118
+ * const name = await aptos.getPrimaryName({address: alice.accountAddress})
123
119
  * // name = test.aptos
124
120
  * ```
125
121
  *
@@ -138,7 +134,7 @@ export class ANS {
138
134
  *
139
135
  * ```ts
140
136
  * await aptos.setPrimaryName({sender: alice, name: "test.aptos"})
141
- * const primaryName = await aptos.getPrimaryName({address: alice.accountAddress.toString()})
137
+ * const primaryName = await aptos.getPrimaryName({address: alice.accountAddress})
142
138
  * // primaryName = test.aptos
143
139
  * ```
144
140
  *
@@ -149,7 +145,7 @@ export class ANS {
149
145
  */
150
146
  async setPrimaryName(args: {
151
147
  sender: Account;
152
- name: string | null;
148
+ name?: string;
153
149
  options?: InputGenerateTransactionOptions;
154
150
  }): Promise<SingleSignerTransaction> {
155
151
  return setPrimaryName({ aptosConfig: this.config, ...args });
@@ -166,7 +162,7 @@ export class ANS {
166
162
  * name: "test.aptos.apt",
167
163
  * expiration: {
168
164
  * policy: "subdomain:independent",
169
- * expirationDate: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000),
165
+ * expirationDate: Date.now() + 30 * 24 * 60 * 60 * 1000,
170
166
  * },
171
167
  * });
172
168
  * ```
@@ -179,8 +175,9 @@ export class ANS {
179
175
  * - domain: Years is required and the name will expire after the given number of years.
180
176
  * - subdomain:follow-domain: The name will expire at the same time as the domain name.
181
177
  * - subdomain:independent: The name will expire at the given date.
182
- * @param args.expiration.expirationDate - A javascript date of when the subdomain will expire. Only applicable when
183
- * the policy is set to 'subdomain:independent'.
178
+ * @param args.expiration.expirationDate - An epoch number in milliseconds of
179
+ * the date when the subdomain will expire. Only applicable when the policy is
180
+ * set to 'subdomain:independent'.
184
181
  * @param args.transferable - Determines if the subdomain being minted is soul-bound. Applicable only to subdomains.
185
182
  * @param args.targetAddress optional - The address the domain name will resolve to. If not provided,
186
183
  * the sender's address will be used.
@@ -236,8 +233,8 @@ export class ANS {
236
233
  *
237
234
  * @param args
238
235
  * @param args.accountAddress - A AccountAddressInput of the address to retrieve names for.
239
- * @param args.options.pagination.offset - Optional, the offset to start from when fetching names
240
- * @param args.options.pagination.limit - Optional, A number of the names to fetch per request
236
+ * @param args.options.offset - Optional, the offset to start from when fetching names
237
+ * @param args.options.limit - Optional, A number of the names to fetch per request
241
238
  * @param args.options.orderBy - The order to sort the names by
242
239
  * @param args.options.where - Additional filters to apply to the query
243
240
  *
@@ -252,8 +249,8 @@ export class ANS {
252
249
  *
253
250
  * @param args
254
251
  * @param args.accountAddress - A AccountAddressInput of the address to retrieve domain names for.
255
- * @param args.options.pagination.offset - Optional, the offset to start from when fetching names
256
- * @param args.options.pagination.limit - Optional, A number of the names to fetch per request
252
+ * @param args.options.offset - Optional, the offset to start from when fetching names
253
+ * @param args.options.limit - Optional, A number of the names to fetch per request
257
254
  * @param args.options.orderBy - The order to sort the names by
258
255
  * @param args.options.where - Additional filters to apply to the query
259
256
  *
@@ -268,8 +265,8 @@ export class ANS {
268
265
  *
269
266
  * @param args
270
267
  * @param args.accountAddress - A AccountAddressInput of the address to retrieve subdomains names for.
271
- * @param args.options.pagination.offset - Optional, the offset to start from when fetching names
272
- * @param args.options.pagination.limit - Optional, A number of the names to fetch per request
268
+ * @param args.options.offset - Optional, the offset to start from when fetching names
269
+ * @param args.options.limit - Optional, A number of the names to fetch per request
273
270
  * @param args.options.orderBy - The order to sort the names by
274
271
  * @param args.options.where - Additional filters to apply to the query
275
272
  *
@@ -284,8 +281,8 @@ export class ANS {
284
281
  *
285
282
  * @param args
286
283
  * @param args.domain - A string of the domain name: eg. "test.apt" or "test" (without the suffix of .apt)
287
- * @param args.options.pagination.offset - Optional, the offset to start from when fetching names
288
- * @param args.options.pagination.limit - Optional, A number of the names to fetch per request
284
+ * @param args.options.offset - Optional, the offset to start from when fetching names
285
+ * @param args.options.limit - Optional, A number of the names to fetch per request
289
286
  * @param args.options.orderBy - The order to sort the names by
290
287
  * @param args.options.where - Additional filters to apply to the query
291
288
  *
@@ -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
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