@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
@@ -21,15 +21,16 @@ import {
21
21
  GetAccountOwnedObjectsResponse,
22
22
  GetAccountOwnedTokensFromCollectionResponse,
23
23
  GetAccountOwnedTokensQueryResponse,
24
- LedgerVersion,
24
+ LedgerVersionArg,
25
25
  MoveModuleBytecode,
26
26
  MoveResource,
27
27
  MoveStructId,
28
- OrderBy,
28
+ OrderByArg,
29
29
  PaginationArgs,
30
30
  SigningScheme,
31
- TokenStandard,
31
+ TokenStandardArg,
32
32
  TransactionResponse,
33
+ WhereArg,
33
34
  } from "../types";
34
35
  import {
35
36
  GetAccountCoinsCountQuery,
@@ -54,6 +55,7 @@ import {
54
55
  import { memoizeAsync } from "../utils/memoize";
55
56
  import { Secp256k1PrivateKey, AuthenticationKey, Ed25519PrivateKey } from "../core";
56
57
  import { AnyPublicKey } from "../core/crypto/anyPublicKey";
58
+ import { CurrentFungibleAssetBalancesBoolExp } from "../types/generated/types";
57
59
 
58
60
  export async function getInfo(args: {
59
61
  aptosConfig: AptosConfig;
@@ -71,7 +73,7 @@ export async function getInfo(args: {
71
73
  export async function getModules(args: {
72
74
  aptosConfig: AptosConfig;
73
75
  accountAddress: AccountAddressInput;
74
- options?: PaginationArgs & LedgerVersion;
76
+ options?: PaginationArgs & LedgerVersionArg;
75
77
  }): Promise<MoveModuleBytecode[]> {
76
78
  const { aptosConfig, accountAddress, options } = args;
77
79
  return paginateWithCursor<{}, MoveModuleBytecode[]>({
@@ -98,7 +100,7 @@ export async function getModule(args: {
98
100
  aptosConfig: AptosConfig;
99
101
  accountAddress: AccountAddressInput;
100
102
  moduleName: string;
101
- options?: LedgerVersion;
103
+ options?: LedgerVersionArg;
102
104
  }): Promise<MoveModuleBytecode> {
103
105
  // We don't memoize the account module by ledger version, as it's not a common use case, this would be handled
104
106
  // by the developer directly
@@ -117,7 +119,7 @@ async function getModuleInner(args: {
117
119
  aptosConfig: AptosConfig;
118
120
  accountAddress: AccountAddressInput;
119
121
  moduleName: string;
120
- options?: LedgerVersion;
122
+ options?: LedgerVersionArg;
121
123
  }): Promise<MoveModuleBytecode> {
122
124
  const { aptosConfig, accountAddress, moduleName, options } = args;
123
125
 
@@ -147,7 +149,7 @@ export async function getTransactions(args: {
147
149
  export async function getResources(args: {
148
150
  aptosConfig: AptosConfig;
149
151
  accountAddress: AccountAddressInput;
150
- options?: PaginationArgs & LedgerVersion;
152
+ options?: PaginationArgs & LedgerVersionArg;
151
153
  }): Promise<MoveResource[]> {
152
154
  const { aptosConfig, accountAddress, options } = args;
153
155
  return paginateWithCursor<{}, MoveResource[]>({
@@ -166,7 +168,7 @@ export async function getResource<T extends {}>(args: {
166
168
  aptosConfig: AptosConfig;
167
169
  accountAddress: AccountAddressInput;
168
170
  resourceType: MoveStructId;
169
- options?: LedgerVersion;
171
+ options?: LedgerVersionArg;
170
172
  }): Promise<T> {
171
173
  const { aptosConfig, accountAddress, resourceType, options } = args;
172
174
  const { data } = await getAptosFullNode<{}, MoveResource>({
@@ -181,7 +183,7 @@ export async function getResource<T extends {}>(args: {
181
183
  export async function lookupOriginalAccountAddress(args: {
182
184
  aptosConfig: AptosConfig;
183
185
  authenticationKey: AccountAddressInput;
184
- options?: LedgerVersion;
186
+ options?: LedgerVersionArg;
185
187
  }): Promise<AccountAddress> {
186
188
  const { aptosConfig, authenticationKey, options } = args;
187
189
  type OriginatingAddress = {
@@ -247,20 +249,18 @@ export async function getAccountTokensCount(args: {
247
249
  query: graphqlQuery,
248
250
  originMethod: "getAccountTokensCount",
249
251
  });
250
- if (!data.current_token_ownerships_v2_aggregate.aggregate) {
251
- throw Error("Failed to get the count of account tokens");
252
- }
253
- return data.current_token_ownerships_v2_aggregate.aggregate.count;
252
+
253
+ // commonjs (aka cjs) doesnt handle Nullish Coalescing for some reason
254
+ // might be because of how ts infer the graphql generated scheme type
255
+ return data.current_token_ownerships_v2_aggregate.aggregate
256
+ ? data.current_token_ownerships_v2_aggregate.aggregate.count
257
+ : 0;
254
258
  }
255
259
 
256
260
  export async function getAccountOwnedTokens(args: {
257
261
  aptosConfig: AptosConfig;
258
262
  accountAddress: AccountAddressInput;
259
- options?: {
260
- tokenStandard?: TokenStandard;
261
- pagination?: PaginationArgs;
262
- orderBy?: OrderBy<GetAccountOwnedTokensQueryResponse[0]>;
263
- };
263
+ options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensQueryResponse[0]>;
264
264
  }): Promise<GetAccountOwnedTokensQueryResponse> {
265
265
  const { aptosConfig, accountAddress, options } = args;
266
266
  const address = AccountAddress.from(accountAddress).toStringLong();
@@ -279,8 +279,8 @@ export async function getAccountOwnedTokens(args: {
279
279
  query: GetAccountOwnedTokens,
280
280
  variables: {
281
281
  where_condition: whereCondition,
282
- offset: options?.pagination?.offset,
283
- limit: options?.pagination?.limit,
282
+ offset: options?.offset,
283
+ limit: options?.limit,
284
284
  order_by: options?.orderBy,
285
285
  },
286
286
  };
@@ -298,11 +298,7 @@ export async function getAccountOwnedTokensFromCollectionAddress(args: {
298
298
  aptosConfig: AptosConfig;
299
299
  accountAddress: AccountAddressInput;
300
300
  collectionAddress: AccountAddressInput;
301
- options?: {
302
- tokenStandard?: TokenStandard;
303
- pagination?: PaginationArgs;
304
- orderBy?: OrderBy<GetAccountOwnedTokensFromCollectionResponse[0]>;
305
- };
301
+ options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensFromCollectionResponse[0]>;
306
302
  }): Promise<GetAccountOwnedTokensFromCollectionResponse> {
307
303
  const { aptosConfig, accountAddress, collectionAddress, options } = args;
308
304
  const ownerAddress = AccountAddress.from(accountAddress).toStringLong();
@@ -327,8 +323,8 @@ export async function getAccountOwnedTokensFromCollectionAddress(args: {
327
323
  query: GetAccountOwnedTokensFromCollection,
328
324
  variables: {
329
325
  where_condition: whereCondition,
330
- offset: options?.pagination?.offset,
331
- limit: options?.pagination?.limit,
326
+ offset: options?.offset,
327
+ limit: options?.limit,
332
328
  order_by: options?.orderBy,
333
329
  },
334
330
  };
@@ -345,11 +341,7 @@ export async function getAccountOwnedTokensFromCollectionAddress(args: {
345
341
  export async function getAccountCollectionsWithOwnedTokens(args: {
346
342
  aptosConfig: AptosConfig;
347
343
  accountAddress: AccountAddressInput;
348
- options?: {
349
- tokenStandard?: TokenStandard;
350
- pagination?: PaginationArgs;
351
- orderBy?: OrderBy<GetAccountCollectionsWithOwnedTokenResponse[0]>;
352
- };
344
+ options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountCollectionsWithOwnedTokenResponse[0]>;
353
345
  }): Promise<GetAccountCollectionsWithOwnedTokenResponse> {
354
346
  const { aptosConfig, accountAddress, options } = args;
355
347
  const address = AccountAddress.from(accountAddress).toStringLong();
@@ -373,8 +365,8 @@ export async function getAccountCollectionsWithOwnedTokens(args: {
373
365
  query: GetAccountCollectionsWithOwnedTokens,
374
366
  variables: {
375
367
  where_condition: whereCondition,
376
- offset: options?.pagination?.offset,
377
- limit: options?.pagination?.limit,
368
+ offset: options?.offset,
369
+ limit: options?.limit,
378
370
  order_by: options?.orderBy,
379
371
  },
380
372
  };
@@ -407,25 +399,42 @@ export async function getAccountTransactionsCount(args: {
407
399
  originMethod: "getAccountTransactionsCount",
408
400
  });
409
401
 
410
- if (!data.account_transactions_aggregate.aggregate) {
411
- throw Error("Failed to get the count of account transactions");
412
- }
402
+ // commonjs (aka cjs) doesnt handle Nullish Coalescing for some reason
403
+ // might be because of how ts infer the graphql generated scheme type
404
+ return data.account_transactions_aggregate.aggregate ? data.account_transactions_aggregate.aggregate.count : 0;
405
+ }
406
+
407
+ export async function getAccountCoinAmount(args: {
408
+ aptosConfig: AptosConfig;
409
+ accountAddress: AccountAddressInput;
410
+ coinType: MoveStructId;
411
+ }): Promise<number> {
412
+ const { aptosConfig, accountAddress, coinType } = args;
413
+ const address = AccountAddress.from(accountAddress).toStringLong();
413
414
 
414
- return data.account_transactions_aggregate.aggregate.count;
415
+ const data = await getAccountCoinsData({
416
+ aptosConfig,
417
+ accountAddress: address,
418
+ options: {
419
+ where: { asset_type: { _eq: coinType } },
420
+ },
421
+ });
422
+
423
+ // commonjs (aka cjs) doesnt handle Nullish Coalescing for some reason
424
+ // might be because of how ts infer the graphql generated scheme type
425
+ return data[0] ? data[0].amount : 0;
415
426
  }
416
427
 
417
428
  export async function getAccountCoinsData(args: {
418
429
  aptosConfig: AptosConfig;
419
430
  accountAddress: AccountAddressInput;
420
- options?: {
421
- pagination?: PaginationArgs;
422
- orderBy?: OrderBy<GetAccountCoinsDataResponse[0]>;
423
- };
431
+ options?: PaginationArgs & OrderByArg<GetAccountCoinsDataResponse[0]> & WhereArg<CurrentFungibleAssetBalancesBoolExp>;
424
432
  }): Promise<GetAccountCoinsDataResponse> {
425
433
  const { aptosConfig, accountAddress, options } = args;
426
434
  const address = AccountAddress.from(accountAddress).toStringLong();
427
435
 
428
436
  const whereCondition: { owner_address: { _eq: string } } = {
437
+ ...options?.where,
429
438
  owner_address: { _eq: address },
430
439
  };
431
440
 
@@ -433,8 +442,8 @@ export async function getAccountCoinsData(args: {
433
442
  query: GetAccountCoinsData,
434
443
  variables: {
435
444
  where_condition: whereCondition,
436
- offset: options?.pagination?.offset,
437
- limit: options?.pagination?.limit,
445
+ offset: options?.offset,
446
+ limit: options?.limit,
438
447
  order_by: options?.orderBy,
439
448
  },
440
449
  };
@@ -476,10 +485,7 @@ export async function getAccountCoinsCount(args: {
476
485
  export async function getAccountOwnedObjects(args: {
477
486
  aptosConfig: AptosConfig;
478
487
  accountAddress: AccountAddressInput;
479
- options?: {
480
- pagination?: PaginationArgs;
481
- orderBy?: OrderBy<GetAccountOwnedObjectsResponse[0]>;
482
- };
488
+ options?: PaginationArgs & OrderByArg<GetAccountOwnedObjectsResponse[0]>;
483
489
  }): Promise<GetAccountOwnedObjectsResponse> {
484
490
  const { aptosConfig, accountAddress, options } = args;
485
491
  const address = AccountAddress.from(accountAddress).toStringLong();
@@ -491,8 +497,8 @@ export async function getAccountOwnedObjects(args: {
491
497
  query: GetAccountOwnedObjects,
492
498
  variables: {
493
499
  where_condition: whereCondition,
494
- offset: options?.pagination?.offset,
495
- limit: options?.pagination?.limit,
500
+ offset: options?.offset,
501
+ limit: options?.limit,
496
502
  order_by: options?.orderBy,
497
503
  },
498
504
  };
@@ -11,7 +11,7 @@
11
11
  import { AptosConfig } from "../api/aptosConfig";
12
12
  import { Account, AccountAddress, AccountAddressInput } from "../core";
13
13
  import { InputGenerateTransactionOptions, SingleSignerTransaction } from "../transactions/types";
14
- import { GetANSNameResponse, MoveAddressType, MoveValue, OrderBy, PaginationArgs } from "../types";
14
+ import { GetANSNameResponse, MoveAddressType, MoveValue, OrderByArg, PaginationArgs, WhereArg } from "../types";
15
15
  import { GetNamesQuery } from "../types/generated/operations";
16
16
  import { GetNames } from "../types/generated/queries";
17
17
  import { CurrentAptosNamesBoolExp } from "../types/generated/types";
@@ -84,8 +84,8 @@ function getRouterAddress(aptosConfig: AptosConfig): string {
84
84
  return address;
85
85
  }
86
86
 
87
- const Some = <T>(value: T): MoveValue => ({ vec: [value] }) as any;
88
- const None = (): MoveValue => ({ vec: [] }) as any;
87
+ const Some = <T>(value: T): MoveValue => ({ vec: [value] });
88
+ const None = (): MoveValue => ({ vec: [] });
89
89
  // != here is intentional, we want to check for null and undefined
90
90
  // eslint-disable-next-line eqeqeq
91
91
  const Option = <T>(value: T | undefined | null): MoveValue => (value != undefined ? Some(value) : None());
@@ -113,7 +113,7 @@ export async function getOwnerAddress(args: { aptosConfig: AptosConfig; name: st
113
113
 
114
114
  const owner = unwrapOption<MoveAddressType>(res[0]);
115
115
 
116
- return owner ? AccountAddress.fromRelaxed(owner).toString() : undefined;
116
+ return owner ? AccountAddress.from(owner).toString() : undefined;
117
117
  }
118
118
 
119
119
  export interface RegisterNameParameters {
@@ -123,7 +123,7 @@ export interface RegisterNameParameters {
123
123
  expiration:
124
124
  | { policy: "domain"; years?: 1 }
125
125
  | { policy: "subdomain:follow-domain" }
126
- | { policy: "subdomain:independent"; expirationDate: Date };
126
+ | { policy: "subdomain:independent"; expirationDate: number };
127
127
  transferable?: boolean;
128
128
  toAddress?: AccountAddressInput;
129
129
  targetAddress?: AccountAddressInput;
@@ -167,7 +167,7 @@ export async function registerName(args: RegisterNameParameters): Promise<Single
167
167
  options,
168
168
  });
169
169
 
170
- return transaction as SingleSignerTransaction;
170
+ return transaction;
171
171
  }
172
172
 
173
173
  // We are a subdomain
@@ -175,15 +175,13 @@ export async function registerName(args: RegisterNameParameters): Promise<Single
175
175
  throw new Error(`${expiration.policy} requires a subdomain to be provided.`);
176
176
  }
177
177
 
178
- let tldExpiration = await getExpiration({ aptosConfig, name: domainName });
178
+ const tldExpiration = await getExpiration({ aptosConfig, name: domainName });
179
179
  if (!tldExpiration) {
180
180
  throw new Error("The domain does not exist");
181
181
  }
182
- // The contract gives us seconds, but JS expects milliseconds
183
- tldExpiration *= 1000;
184
182
 
185
183
  const expirationDateInMillisecondsSinceEpoch =
186
- expiration.policy === "subdomain:independent" ? expiration.expirationDate.valueOf() : tldExpiration;
184
+ expiration.policy === "subdomain:independent" ? expiration.expirationDate : tldExpiration;
187
185
 
188
186
  if (expirationDateInMillisecondsSinceEpoch > tldExpiration) {
189
187
  throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");
@@ -207,7 +205,7 @@ export async function registerName(args: RegisterNameParameters): Promise<Single
207
205
  options,
208
206
  });
209
207
 
210
- return transaction as SingleSignerTransaction;
208
+ return transaction;
211
209
  }
212
210
 
213
211
  export async function getExpiration(args: { aptosConfig: AptosConfig; name: string }): Promise<number | undefined> {
@@ -224,7 +222,8 @@ export async function getExpiration(args: { aptosConfig: AptosConfig; name: stri
224
222
  },
225
223
  });
226
224
 
227
- return res[0] as number;
225
+ // Normalize expiration time from epoch seconds to epoch milliseconds
226
+ return Number(res[0]) * 1000;
228
227
  } catch (e) {
229
228
  return undefined;
230
229
  }
@@ -241,7 +240,7 @@ export async function getPrimaryName(args: {
241
240
  aptosConfig,
242
241
  payload: {
243
242
  function: `${routerAddress}::router::get_primary_name`,
244
- functionArguments: [AccountAddress.fromRelaxed(address).toString()],
243
+ functionArguments: [AccountAddress.from(address).toString()],
245
244
  },
246
245
  });
247
246
 
@@ -256,7 +255,7 @@ export async function getPrimaryName(args: {
256
255
  export async function setPrimaryName(args: {
257
256
  aptosConfig: AptosConfig;
258
257
  sender: Account;
259
- name: string | null;
258
+ name?: string;
260
259
  options?: InputGenerateTransactionOptions;
261
260
  }): Promise<SingleSignerTransaction> {
262
261
  const { aptosConfig, sender, name, options } = args;
@@ -273,7 +272,7 @@ export async function setPrimaryName(args: {
273
272
  options,
274
273
  });
275
274
 
276
- return transaction as SingleSignerTransaction;
275
+ return transaction;
277
276
  }
278
277
 
279
278
  const { domainName, subdomainName } = isValidANSName(name);
@@ -288,7 +287,7 @@ export async function setPrimaryName(args: {
288
287
  options,
289
288
  });
290
289
 
291
- return transaction as SingleSignerTransaction;
290
+ return transaction;
292
291
  }
293
292
 
294
293
  export async function getTargetAddress(args: {
@@ -308,7 +307,7 @@ export async function getTargetAddress(args: {
308
307
  });
309
308
 
310
309
  const target = unwrapOption<MoveAddressType>(res[0]);
311
- return target ? AccountAddress.fromRelaxed(target).toString() : undefined;
310
+ return target ? AccountAddress.from(target).toString() : undefined;
312
311
  }
313
312
 
314
313
  export async function setTargetAddress(args: {
@@ -332,7 +331,7 @@ export async function setTargetAddress(args: {
332
331
  options,
333
332
  });
334
333
 
335
- return transaction as SingleSignerTransaction;
334
+ return transaction;
336
335
  }
337
336
 
338
337
  export async function getName(args: {
@@ -359,15 +358,17 @@ export async function getName(args: {
359
358
  originMethod: "getName",
360
359
  });
361
360
 
362
- return data.current_aptos_names[0] as GetANSNameResponse[0] | undefined;
361
+ // Convert the expiration_timestamp from an ISO string to milliseconds since epoch
362
+ let res = data.current_aptos_names[0];
363
+ if (res) {
364
+ res = sanitizeANSName(res);
365
+ }
366
+
367
+ return res;
363
368
  }
364
369
 
365
370
  interface QueryNamesOptions {
366
- options?: {
367
- pagination?: PaginationArgs;
368
- orderBy?: OrderBy<GetANSNameResponse[0]>;
369
- where?: CurrentAptosNamesBoolExp;
370
- };
371
+ options?: PaginationArgs & OrderByArg<GetANSNameResponse[0]> & WhereArg<CurrentAptosNamesBoolExp>;
371
372
  }
372
373
 
373
374
  export interface GetAccountNamesArgs extends QueryNamesOptions {
@@ -387,8 +388,8 @@ export async function getAccountNames(
387
388
  query: {
388
389
  query: GetNames,
389
390
  variables: {
390
- limit: options?.pagination?.limit,
391
- offset: options?.pagination?.offset,
391
+ limit: options?.limit,
392
+ offset: options?.offset,
392
393
  order_by: options?.orderBy,
393
394
  where_condition: {
394
395
  ...(args.options?.where ?? {}),
@@ -399,7 +400,7 @@ export async function getAccountNames(
399
400
  },
400
401
  });
401
402
 
402
- return data.current_aptos_names;
403
+ return data.current_aptos_names.map(sanitizeANSName);
403
404
  }
404
405
 
405
406
  export interface GetAccountDomainsArgs extends QueryNamesOptions {
@@ -419,8 +420,8 @@ export async function getAccountDomains(
419
420
  query: {
420
421
  query: GetNames,
421
422
  variables: {
422
- limit: options?.pagination?.limit,
423
- offset: options?.pagination?.offset,
423
+ limit: options?.limit,
424
+ offset: options?.offset,
424
425
  order_by: options?.orderBy,
425
426
  where_condition: {
426
427
  ...(args.options?.where ?? {}),
@@ -432,7 +433,7 @@ export async function getAccountDomains(
432
433
  },
433
434
  });
434
435
 
435
- return data.current_aptos_names;
436
+ return data.current_aptos_names.map(sanitizeANSName);
436
437
  }
437
438
 
438
439
  export interface GetAccountSubdomainsArgs extends QueryNamesOptions {
@@ -452,8 +453,8 @@ export async function getAccountSubdomains(
452
453
  query: {
453
454
  query: GetNames,
454
455
  variables: {
455
- limit: options?.pagination?.limit,
456
- offset: options?.pagination?.offset,
456
+ limit: options?.limit,
457
+ offset: options?.offset,
457
458
  order_by: options?.orderBy,
458
459
  where_condition: {
459
460
  ...(args.options?.where ?? {}),
@@ -465,7 +466,7 @@ export async function getAccountSubdomains(
465
466
  },
466
467
  });
467
468
 
468
- return data.current_aptos_names;
469
+ return data.current_aptos_names.map(sanitizeANSName);
469
470
  }
470
471
 
471
472
  export interface GetDomainSubdomainsArgs extends QueryNamesOptions {
@@ -483,8 +484,8 @@ export async function getDomainSubdomains(
483
484
  query: {
484
485
  query: GetNames,
485
486
  variables: {
486
- limit: options?.pagination?.limit,
487
- offset: options?.pagination?.offset,
487
+ limit: options?.limit,
488
+ offset: options?.offset,
488
489
  order_by: options?.orderBy,
489
490
  where_condition: {
490
491
  ...(args.options?.where ?? {}),
@@ -495,7 +496,7 @@ export async function getDomainSubdomains(
495
496
  },
496
497
  });
497
498
 
498
- return data.current_aptos_names;
499
+ return data.current_aptos_names.map(sanitizeANSName);
499
500
  }
500
501
 
501
502
  /**
@@ -513,7 +514,7 @@ async function getANSExpirationDate(args: { aptosConfig: AptosConfig }): Promise
513
514
  const { aptosConfig } = args;
514
515
  const routerAddress = getRouterAddress(aptosConfig);
515
516
 
516
- const res = await view({
517
+ const [gracePeriodInSeconds] = await view<[number]>({
517
518
  aptosConfig,
518
519
  payload: {
519
520
  function: `${routerAddress}::config::reregistration_grace_sec`,
@@ -521,7 +522,6 @@ async function getANSExpirationDate(args: { aptosConfig: AptosConfig }): Promise
521
522
  },
522
523
  });
523
524
 
524
- const gracePeriodInSeconds = res[0] as number;
525
525
  const gracePeriodInDays = gracePeriodInSeconds / 60 / 60 / 24;
526
526
  const now = () => new Date();
527
527
  return new Date(now().setDate(now().getDate() - gracePeriodInDays)).toISOString();
@@ -557,5 +557,18 @@ export async function renewDomain(args: {
557
557
  options,
558
558
  });
559
559
 
560
- return transaction as SingleSignerTransaction;
560
+ return transaction;
561
+ }
562
+
563
+ /**
564
+ * The indexer returns ISO strings for expiration, however the contract works in
565
+ * epoch milliseconds. This function converts the ISO string to epoch
566
+ * milliseconds. In the future, if other properties need sanitization, this can
567
+ * be extended.
568
+ */
569
+ function sanitizeANSName(name: GetANSNameResponse[0]): GetANSNameResponse[0] {
570
+ return {
571
+ ...name,
572
+ expiration_timestamp: new Date(name.expiration_timestamp).valueOf(),
573
+ };
561
574
  }
@@ -1,11 +1,9 @@
1
1
  import { AptosConfig } from "../api/aptosConfig";
2
- import { U64 } from "../bcs/serializable/movePrimitives";
3
- import { Account, AccountAddress, AccountAddressInput } from "../core";
2
+ import { Account, AccountAddressInput } from "../core";
4
3
  import { InputGenerateTransactionOptions, SingleSignerTransaction } from "../transactions/types";
5
4
  import { AnyNumber, MoveStructId } from "../types";
6
5
  import { APTOS_COIN } from "../utils/const";
7
6
  import { generateTransaction } from "./transactionSubmission";
8
- import { parseTypeTag } from "../transactions/typeTag/parser";
9
7
 
10
8
  export async function transferCoinTransaction(args: {
11
9
  aptosConfig: AptosConfig;
@@ -22,11 +20,11 @@ export async function transferCoinTransaction(args: {
22
20
  sender: sender.accountAddress,
23
21
  data: {
24
22
  function: "0x1::aptos_account::transfer_coins",
25
- typeArguments: [parseTypeTag(coinStructType)],
26
- functionArguments: [AccountAddress.from(recipient), new U64(amount)],
23
+ typeArguments: [coinStructType],
24
+ functionArguments: [recipient, amount],
27
25
  },
28
26
  options,
29
27
  });
30
28
 
31
- return transaction as SingleSignerTransaction;
29
+ return transaction;
32
30
  }
@@ -19,9 +19,10 @@ import {
19
19
  GetOwnedTokensResponse,
20
20
  GetTokenActivityResponse,
21
21
  GetTokenDataResponse,
22
- OrderBy,
22
+ MoveStructId,
23
+ OrderByArg,
23
24
  PaginationArgs,
24
- TokenStandard,
25
+ TokenStandardArg,
25
26
  } from "../types";
26
27
  import {
27
28
  GetCollectionDataQuery,
@@ -74,7 +75,7 @@ export async function mintTokenTransaction(args: {
74
75
  },
75
76
  options,
76
77
  });
77
- return transaction as SingleSignerTransaction;
78
+ return transaction;
78
79
  }
79
80
 
80
81
  export async function getTokenData(args: {
@@ -132,23 +133,21 @@ export async function getCurrentTokenOwnership(args: {
132
133
  export async function getOwnedTokens(args: {
133
134
  aptosConfig: AptosConfig;
134
135
  ownerAddress: AccountAddressInput;
135
- options?: {
136
- pagination?: PaginationArgs;
137
- orderBy?: OrderBy<GetTokenActivityResponse[0]>;
138
- };
136
+ options?: PaginationArgs & OrderByArg<GetTokenActivityResponse[0]>;
139
137
  }): Promise<GetOwnedTokensResponse> {
140
138
  const { aptosConfig, ownerAddress, options } = args;
141
139
 
142
140
  const whereCondition: CurrentTokenOwnershipsV2BoolExp = {
143
141
  owner_address: { _eq: AccountAddress.from(ownerAddress).toStringLong() },
142
+ amount: { _gt: 0 },
144
143
  };
145
144
 
146
145
  const graphqlQuery = {
147
146
  query: GetCurrentTokenOwnership,
148
147
  variables: {
149
148
  where_condition: whereCondition,
150
- offset: options?.pagination?.offset,
151
- limit: options?.pagination?.limit,
149
+ offset: options?.offset,
150
+ limit: options?.limit,
152
151
  order_by: options?.orderBy,
153
152
  },
154
153
  };
@@ -165,10 +164,7 @@ export async function getOwnedTokens(args: {
165
164
  export async function getTokenActivity(args: {
166
165
  aptosConfig: AptosConfig;
167
166
  tokenAddress: AccountAddressInput;
168
- options?: {
169
- pagination?: PaginationArgs;
170
- orderBy?: OrderBy<GetTokenActivityResponse[0]>;
171
- };
167
+ options?: PaginationArgs & OrderByArg<GetTokenActivityResponse[0]>;
172
168
  }): Promise<GetTokenActivityResponse> {
173
169
  const { aptosConfig, tokenAddress, options } = args;
174
170
 
@@ -180,8 +176,8 @@ export async function getTokenActivity(args: {
180
176
  query: GetTokenActivity,
181
177
  variables: {
182
178
  where_condition: whereCondition,
183
- offset: options?.pagination?.offset,
184
- limit: options?.pagination?.limit,
179
+ offset: options?.offset,
180
+ limit: options?.limit,
185
181
  order_by: options?.orderBy,
186
182
  },
187
183
  };
@@ -247,16 +243,14 @@ export async function createCollectionTransaction(
247
243
  },
248
244
  options,
249
245
  });
250
- return transaction as SingleSignerTransaction;
246
+ return transaction;
251
247
  }
252
248
 
253
249
  export async function getCollectionData(args: {
254
250
  aptosConfig: AptosConfig;
255
251
  creatorAddress: AccountAddressInput;
256
252
  collectionName: string;
257
- options?: {
258
- tokenStandard?: TokenStandard;
259
- };
253
+ options?: TokenStandardArg;
260
254
  }): Promise<GetCollectionDataResponse> {
261
255
  const { aptosConfig, creatorAddress, collectionName, options } = args;
262
256
  const address = AccountAddress.from(creatorAddress);
@@ -289,9 +283,29 @@ export async function getCollectionId(args: {
289
283
  aptosConfig: AptosConfig;
290
284
  creatorAddress: AccountAddressInput;
291
285
  collectionName: string;
292
- options?: {
293
- tokenStandard?: TokenStandard;
294
- };
286
+ options?: TokenStandardArg;
295
287
  }): Promise<string> {
296
288
  return (await getCollectionData(args)).collection_id;
297
289
  }
290
+
291
+ export async function transferDigitalAsset(args: {
292
+ aptosConfig: AptosConfig;
293
+ sender: Account;
294
+ digitalAssetAddress: AccountAddressInput;
295
+ recipient: AccountAddress;
296
+ digitalAssetType?: MoveStructId;
297
+ options?: InputGenerateTransactionOptions;
298
+ }): Promise<SingleSignerTransaction> {
299
+ const { aptosConfig, sender, digitalAssetAddress, recipient, digitalAssetType, options } = args;
300
+ const transaction = await generateTransaction({
301
+ aptosConfig,
302
+ sender: sender.accountAddress,
303
+ data: {
304
+ function: "0x1::object::transfer",
305
+ typeArguments: [digitalAssetType ?? "0x4::token::Token"],
306
+ functionArguments: [digitalAssetAddress, recipient],
307
+ },
308
+ options,
309
+ });
310
+ return transaction;
311
+ }