@aptos-labs/ts-sdk 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (423) hide show
  1. package/README.md +17 -1
  2. package/dist/browser/index.d.ts +798 -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 +798 -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 +21 -18
  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-UAAI3NCA.mjs → chunk-2SAKPC5Q.mjs} +2 -2
  56. package/dist/esm/{chunk-3732I6BR.mjs → chunk-2YQXX64E.mjs} +2 -2
  57. package/dist/esm/chunk-3F5WV6US.mjs +2 -0
  58. package/dist/esm/chunk-3F5WV6US.mjs.map +1 -0
  59. package/dist/esm/{chunk-ARVSIDVB.mjs → chunk-3RMXGSHK.mjs} +2 -2
  60. package/dist/esm/chunk-3RMXGSHK.mjs.map +1 -0
  61. package/dist/esm/{chunk-4ADA5BE7.mjs → chunk-53DS6NBQ.mjs} +2 -2
  62. package/dist/esm/chunk-5CUNY7X2.mjs +2 -0
  63. package/dist/esm/chunk-5CUNY7X2.mjs.map +1 -0
  64. package/dist/esm/{chunk-QWVR4RCV.mjs → chunk-5OPOJ43H.mjs} +2 -2
  65. package/dist/esm/{chunk-72F5YXGC.mjs → chunk-5UY5OKXR.mjs} +2 -2
  66. package/dist/esm/chunk-5UY5OKXR.mjs.map +1 -0
  67. package/dist/esm/chunk-5ZVCSKFX.mjs +2 -0
  68. package/dist/esm/chunk-5ZVCSKFX.mjs.map +1 -0
  69. package/dist/esm/{chunk-HVADSXTB.mjs → chunk-73VWOS4Z.mjs} +2 -2
  70. package/dist/esm/chunk-ALFESCPU.mjs +2 -0
  71. package/dist/esm/chunk-ALFESCPU.mjs.map +1 -0
  72. package/dist/esm/chunk-APSQ4M23.mjs +2 -0
  73. package/dist/esm/chunk-APSQ4M23.mjs.map +1 -0
  74. package/dist/esm/{chunk-U25N2VWA.mjs → chunk-AZUWHKN5.mjs} +2 -2
  75. package/dist/esm/{chunk-UDBH4CER.mjs → chunk-BQSE5HHW.mjs} +7 -7
  76. package/dist/esm/chunk-BQSE5HHW.mjs.map +1 -0
  77. package/dist/esm/chunk-CCXMVVXD.mjs +2 -0
  78. package/dist/esm/chunk-CCXMVVXD.mjs.map +1 -0
  79. package/dist/esm/{chunk-JZNLZMUC.mjs → chunk-CJPCOS4R.mjs} +2 -2
  80. package/dist/esm/{chunk-S36IYY6K.mjs → chunk-CL5B2QNS.mjs} +2 -2
  81. package/dist/esm/chunk-CLJLQXFQ.mjs +2 -0
  82. package/dist/esm/chunk-CLJLQXFQ.mjs.map +1 -0
  83. package/dist/esm/{chunk-EWTHPMEE.mjs → chunk-CU2DINU4.mjs} +2 -2
  84. package/dist/esm/{chunk-5LO7FR2P.mjs → chunk-EFRFDFS4.mjs} +2 -2
  85. package/dist/esm/chunk-EOC4UI5B.mjs +2 -0
  86. package/dist/esm/{chunk-KC64ESLO.mjs.map → chunk-EOC4UI5B.mjs.map} +1 -1
  87. package/dist/esm/{chunk-HA6JD5R6.mjs → chunk-F6K26WV5.mjs} +2 -2
  88. package/dist/esm/{chunk-HA6JD5R6.mjs.map → chunk-F6K26WV5.mjs.map} +1 -1
  89. package/dist/esm/chunk-F7EWDYTE.mjs +2 -0
  90. package/dist/esm/chunk-F7EWDYTE.mjs.map +1 -0
  91. package/dist/esm/{chunk-44MGBJ73.mjs → chunk-FZ56IS3E.mjs} +2 -2
  92. package/dist/esm/chunk-G36AY4R7.mjs +2 -0
  93. package/dist/esm/chunk-G36AY4R7.mjs.map +1 -0
  94. package/dist/esm/chunk-GEZSEAL5.mjs +2 -0
  95. package/dist/esm/chunk-GEZSEAL5.mjs.map +1 -0
  96. package/dist/esm/chunk-GIZLK7M7.mjs +2 -0
  97. package/dist/esm/chunk-GIZLK7M7.mjs.map +1 -0
  98. package/dist/esm/chunk-GMG4VR3K.mjs +2 -0
  99. package/dist/esm/chunk-GMG4VR3K.mjs.map +1 -0
  100. package/dist/esm/{chunk-U6SZNNVL.mjs → chunk-GXPGRCSW.mjs} +2 -2
  101. package/dist/esm/{chunk-U6SZNNVL.mjs.map → chunk-GXPGRCSW.mjs.map} +1 -1
  102. package/dist/esm/{chunk-TPWSHFFI.mjs → chunk-HC5VMNXA.mjs} +2 -2
  103. package/dist/esm/chunk-HTI5LEST.mjs +2 -0
  104. package/dist/esm/chunk-HTI5LEST.mjs.map +1 -0
  105. package/dist/esm/chunk-IELTCGLP.mjs +2 -0
  106. package/dist/esm/chunk-IELTCGLP.mjs.map +1 -0
  107. package/dist/esm/chunk-IHYTP2EW.mjs +1 -0
  108. package/dist/esm/chunk-IHYTP2EW.mjs.map +1 -0
  109. package/dist/esm/chunk-JI2BBZ2W.mjs +2 -0
  110. package/dist/esm/{chunk-ND3ZQKTT.mjs.map → chunk-JI2BBZ2W.mjs.map} +1 -1
  111. package/dist/esm/chunk-KKER5KL4.mjs +2 -0
  112. package/dist/esm/chunk-KKER5KL4.mjs.map +1 -0
  113. package/dist/esm/chunk-KNMWDGP4.mjs +2 -0
  114. package/dist/esm/chunk-KNMWDGP4.mjs.map +1 -0
  115. package/dist/esm/{chunk-YYRDFZE6.mjs → chunk-KZSJ5MFF.mjs} +2 -2
  116. package/dist/esm/{chunk-YYRDFZE6.mjs.map → chunk-KZSJ5MFF.mjs.map} +1 -1
  117. package/dist/esm/chunk-MWAMLQ25.mjs +2 -0
  118. package/dist/esm/chunk-MWAMLQ25.mjs.map +1 -0
  119. package/dist/esm/chunk-NL72WE3E.mjs +2 -0
  120. package/dist/esm/{chunk-TIH6ARYP.mjs.map → chunk-NL72WE3E.mjs.map} +1 -1
  121. package/dist/esm/chunk-NZSGGL25.mjs +2 -0
  122. package/dist/esm/chunk-NZSGGL25.mjs.map +1 -0
  123. package/dist/esm/chunk-OBOOY2QD.mjs +2 -0
  124. package/dist/esm/chunk-OBOOY2QD.mjs.map +1 -0
  125. package/dist/esm/chunk-OT2UDMUU.mjs +2 -0
  126. package/dist/esm/chunk-OT2UDMUU.mjs.map +1 -0
  127. package/dist/esm/chunk-OZZDXS26.mjs +2 -0
  128. package/dist/esm/chunk-OZZDXS26.mjs.map +1 -0
  129. package/dist/esm/{chunk-DRPMIJH7.mjs → chunk-P5747ZYC.mjs} +2 -2
  130. package/dist/esm/{chunk-BPYLPPEQ.mjs → chunk-PL2VA73L.mjs} +2 -2
  131. package/dist/esm/chunk-PXTMLJKO.mjs +2 -0
  132. package/dist/esm/{chunk-WL4OXZLN.mjs → chunk-QCBIJCU4.mjs} +2 -2
  133. package/dist/esm/chunk-QEXAMHPU.mjs +2 -0
  134. package/dist/esm/chunk-QEXAMHPU.mjs.map +1 -0
  135. package/dist/esm/{chunk-KQXRH5FK.mjs → chunk-QNTV5NMH.mjs} +2 -2
  136. package/dist/esm/{chunk-HO7K2UAK.mjs → chunk-RCM3K5JL.mjs} +2 -2
  137. package/dist/esm/{chunk-3VZ3OZKC.mjs → chunk-RLG3WOTH.mjs} +2 -2
  138. package/dist/esm/chunk-SDPICQ5B.mjs +2 -0
  139. package/dist/esm/{chunk-FYIFBLHU.mjs.map → chunk-SDPICQ5B.mjs.map} +1 -1
  140. package/dist/esm/chunk-SGTFMSOG.mjs +2 -0
  141. package/dist/esm/chunk-SGTFMSOG.mjs.map +1 -0
  142. package/dist/esm/chunk-SO6EE5DX.mjs +2 -0
  143. package/dist/esm/chunk-SO6EE5DX.mjs.map +1 -0
  144. package/dist/esm/chunk-SRGPSANH.mjs +2 -0
  145. package/dist/esm/chunk-SRGPSANH.mjs.map +1 -0
  146. package/dist/esm/{chunk-GAI75GOG.mjs → chunk-SSJQOXEP.mjs} +2 -2
  147. package/dist/esm/chunk-TZ623H2V.mjs +2 -0
  148. package/dist/esm/chunk-TZ623H2V.mjs.map +1 -0
  149. package/dist/esm/chunk-U6Z4FNB7.mjs +2 -0
  150. package/dist/esm/chunk-U6Z4FNB7.mjs.map +1 -0
  151. package/dist/esm/{chunk-GTC7WHMV.mjs → chunk-UDMADMVO.mjs} +1 -1
  152. package/dist/esm/{chunk-GTC7WHMV.mjs.map → chunk-UDMADMVO.mjs.map} +1 -1
  153. package/dist/esm/chunk-UIVJXLRM.mjs +1 -0
  154. package/dist/esm/chunk-UIVJXLRM.mjs.map +1 -0
  155. package/dist/esm/chunk-UKSA4H2O.mjs +2 -0
  156. package/dist/esm/chunk-UKSA4H2O.mjs.map +1 -0
  157. package/dist/esm/chunk-UW6HQ643.mjs +2 -0
  158. package/dist/esm/chunk-UW6HQ643.mjs.map +1 -0
  159. package/dist/esm/{chunk-ZUHN56GM.mjs → chunk-UWXDXOFK.mjs} +2 -2
  160. package/dist/esm/chunk-UWXDXOFK.mjs.map +1 -0
  161. package/dist/esm/chunk-VQ7LYNMD.mjs +2 -0
  162. package/dist/esm/chunk-VQ7LYNMD.mjs.map +1 -0
  163. package/dist/esm/{chunk-IBH7IOIM.mjs → chunk-WTGGCH34.mjs} +2 -2
  164. package/dist/esm/{chunk-X32O46IB.mjs → chunk-XITLXPBK.mjs} +2 -2
  165. package/dist/esm/chunk-XMUUI6HG.mjs +2 -0
  166. package/dist/esm/{chunk-R3KWVOFG.mjs.map → chunk-XMUUI6HG.mjs.map} +1 -1
  167. package/dist/esm/chunk-XX2Z26FH.mjs +2 -0
  168. package/dist/esm/chunk-XX2Z26FH.mjs.map +1 -0
  169. package/dist/esm/chunk-Y6PVFMBS.mjs +2 -0
  170. package/dist/esm/chunk-Y6PVFMBS.mjs.map +1 -0
  171. package/dist/esm/{chunk-VWVEDCBM.mjs → chunk-YN6UIVFB.mjs} +2 -2
  172. package/dist/esm/{chunk-4KTQIWUP.mjs → chunk-ZFK7QD3B.mjs} +2 -2
  173. package/dist/esm/chunk-ZJUDDSWN.mjs +2 -0
  174. package/dist/esm/chunk-ZJUDDSWN.mjs.map +1 -0
  175. package/dist/esm/client/core.mjs +1 -1
  176. package/dist/esm/client/get.d.mts +1 -1
  177. package/dist/esm/client/get.mjs +1 -1
  178. package/dist/esm/client/index.mjs +1 -1
  179. package/dist/esm/client/post.mjs +1 -1
  180. package/dist/esm/core/account.mjs +1 -1
  181. package/dist/esm/core/accountAddress.d.mts +9 -9
  182. package/dist/esm/core/accountAddress.mjs +1 -1
  183. package/dist/esm/core/authenticationKey.mjs +1 -1
  184. package/dist/esm/core/crypto/anyPublicKey.d.mts +5 -0
  185. package/dist/esm/core/crypto/anyPublicKey.mjs +1 -1
  186. package/dist/esm/core/crypto/anySignature.mjs +1 -1
  187. package/dist/esm/core/crypto/asymmetricCrypto.mjs +1 -1
  188. package/dist/esm/core/crypto/ed25519.d.mts +3 -0
  189. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  190. package/dist/esm/core/crypto/index.d.mts +2 -2
  191. package/dist/esm/core/crypto/index.mjs +1 -1
  192. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  193. package/dist/esm/core/crypto/multiKey.d.mts +2 -0
  194. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  195. package/dist/esm/core/crypto/secp256k1.d.mts +3 -0
  196. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  197. package/dist/esm/core/hex.mjs +1 -1
  198. package/dist/esm/core/index.d.mts +2 -2
  199. package/dist/esm/core/index.mjs +1 -1
  200. package/dist/esm/index.d.mts +11 -8
  201. package/dist/esm/index.mjs +1 -1
  202. package/dist/esm/internal/account.d.mts +20 -33
  203. package/dist/esm/internal/account.mjs +1 -1
  204. package/dist/esm/internal/ans.d.mts +7 -10
  205. package/dist/esm/internal/ans.mjs +1 -1
  206. package/dist/esm/internal/coin.d.mts +4 -3
  207. package/dist/esm/internal/coin.mjs +1 -1
  208. package/dist/esm/internal/digitalAsset.d.mts +9 -18
  209. package/dist/esm/internal/digitalAsset.mjs +1 -1
  210. package/dist/esm/internal/event.d.mts +5 -12
  211. package/dist/esm/internal/event.mjs +1 -1
  212. package/dist/esm/internal/faucet.d.mts +5 -5
  213. package/dist/esm/internal/faucet.mjs +1 -1
  214. package/dist/esm/internal/fungibleAsset.d.mts +40 -22
  215. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  216. package/dist/esm/internal/general.d.mts +9 -5
  217. package/dist/esm/internal/general.mjs +1 -1
  218. package/dist/esm/internal/staking.d.mts +5 -7
  219. package/dist/esm/internal/staking.mjs +1 -1
  220. package/dist/esm/internal/transaction.d.mts +12 -4
  221. package/dist/esm/internal/transaction.mjs +1 -1
  222. package/dist/esm/internal/transactionSubmission.d.mts +24 -5
  223. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  224. package/dist/esm/transactions/authenticator/account.d.mts +5 -0
  225. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  226. package/dist/esm/transactions/authenticator/index.d.mts +1 -0
  227. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  228. package/dist/esm/transactions/authenticator/transaction.d.mts +1 -0
  229. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  230. package/dist/esm/transactions/index.d.mts +4 -3
  231. package/dist/esm/transactions/index.mjs +1 -1
  232. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  233. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  234. package/dist/esm/transactions/instances/index.d.mts +1 -0
  235. package/dist/esm/transactions/instances/index.mjs +1 -1
  236. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  237. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  238. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  239. package/dist/esm/transactions/instances/signedTransaction.d.mts +1 -0
  240. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  241. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  242. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +89 -0
  243. package/dist/esm/transactions/management/accountSequenceNumber.mjs +2 -0
  244. package/dist/esm/transactions/management/accountSequenceNumber.mjs.map +1 -0
  245. package/dist/esm/transactions/management/asyncQueue.d.mts +58 -0
  246. package/dist/esm/transactions/management/asyncQueue.mjs +2 -0
  247. package/dist/esm/transactions/management/asyncQueue.mjs.map +1 -0
  248. package/dist/esm/transactions/management/index.d.mts +36 -0
  249. package/dist/esm/transactions/management/index.mjs +2 -0
  250. package/dist/esm/transactions/management/index.mjs.map +1 -0
  251. package/dist/esm/transactions/management/transactionWorker.d.mts +135 -0
  252. package/dist/esm/transactions/management/transactionWorker.mjs +2 -0
  253. package/dist/esm/transactions/management/transactionWorker.mjs.map +1 -0
  254. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +3 -1
  255. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  256. package/dist/esm/transactions/transactionBuilder/index.d.mts +4 -3
  257. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  258. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +3 -1
  259. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  260. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +3 -2
  261. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  262. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  263. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  264. package/dist/esm/transactions/types.d.mts +3 -2
  265. package/dist/esm/types/generated/operations.d.mts +3 -3
  266. package/dist/esm/types/generated/queries.d.mts +3 -3
  267. package/dist/esm/types/generated/queries.mjs +1 -1
  268. package/dist/esm/types/index.d.mts +27 -9
  269. package/dist/esm/types/index.mjs +1 -1
  270. package/dist/esm/utils/const.d.mts +18 -1
  271. package/dist/esm/utils/const.mjs +1 -1
  272. package/dist/esm/utils/index.d.mts +1 -1
  273. package/dist/esm/utils/index.mjs +1 -1
  274. package/dist/esm/version.d.mts +1 -1
  275. package/dist/esm/version.mjs +1 -1
  276. package/package.json +1 -1
  277. package/src/api/account.ts +150 -53
  278. package/src/api/ans.ts +19 -22
  279. package/src/api/aptosConfig.ts +2 -2
  280. package/src/api/coin.ts +2 -6
  281. package/src/api/digitalAsset.ts +72 -22
  282. package/src/api/event.ts +28 -17
  283. package/src/api/faucet.ts +12 -9
  284. package/src/api/fungibleAsset.ts +76 -35
  285. package/src/api/general.ts +19 -3
  286. package/src/api/staking.ts +30 -11
  287. package/src/api/transaction.ts +16 -1
  288. package/src/api/transactionSubmission.ts +43 -1
  289. package/src/api/utils.ts +37 -0
  290. package/src/bcs/deserializer.ts +4 -4
  291. package/src/bcs/serializer.ts +4 -4
  292. package/src/client/core.ts +6 -4
  293. package/src/client/get.ts +7 -6
  294. package/src/core/accountAddress.ts +20 -22
  295. package/src/core/crypto/anyPublicKey.ts +12 -0
  296. package/src/core/crypto/ed25519.ts +13 -0
  297. package/src/core/crypto/index.ts +2 -0
  298. package/src/core/crypto/secp256k1.ts +12 -0
  299. package/src/core/hex.ts +5 -7
  300. package/src/index.ts +1 -0
  301. package/src/internal/account.ts +56 -50
  302. package/src/internal/ans.ts +52 -39
  303. package/src/internal/coin.ts +4 -6
  304. package/src/internal/digitalAsset.ts +12 -22
  305. package/src/internal/event.ts +7 -14
  306. package/src/internal/faucet.ts +10 -6
  307. package/src/internal/fungibleAsset.ts +36 -18
  308. package/src/internal/general.ts +30 -3
  309. package/src/internal/queries/getNumberOfDelegatorsQuery.graphql +5 -5
  310. package/src/internal/queries/getProcessorStatus.graphql +2 -2
  311. package/src/internal/staking.ts +12 -14
  312. package/src/internal/transaction.ts +23 -26
  313. package/src/internal/transactionSubmission.ts +35 -5
  314. package/src/transactions/authenticator/account.ts +16 -0
  315. package/src/transactions/instances/moduleId.ts +1 -1
  316. package/src/transactions/management/accountSequenceNumber.ts +186 -0
  317. package/src/transactions/management/asyncQueue.ts +107 -0
  318. package/src/transactions/management/index.ts +2 -0
  319. package/src/transactions/management/transactionWorker.ts +275 -0
  320. package/src/transactions/transactionBuilder/helpers.ts +28 -1
  321. package/src/transactions/transactionBuilder/remoteAbi.ts +35 -28
  322. package/src/transactions/transactionBuilder/transactionBuilder.ts +28 -26
  323. package/src/transactions/typeTag/parser.ts +1 -1
  324. package/src/transactions/types.ts +2 -2
  325. package/src/types/generated/operations.ts +4 -2
  326. package/src/types/generated/queries.ts +4 -4
  327. package/src/types/index.ts +67 -11
  328. package/src/utils/const.ts +18 -0
  329. package/src/version.ts +1 -1
  330. package/dist/esm/chunk-2OZRBXLM.mjs +0 -2
  331. package/dist/esm/chunk-2OZRBXLM.mjs.map +0 -1
  332. package/dist/esm/chunk-33T7WTB6.mjs +0 -2
  333. package/dist/esm/chunk-33T7WTB6.mjs.map +0 -1
  334. package/dist/esm/chunk-62SCW5NH.mjs +0 -2
  335. package/dist/esm/chunk-62SCW5NH.mjs.map +0 -1
  336. package/dist/esm/chunk-67OGU66P.mjs +0 -2
  337. package/dist/esm/chunk-67OGU66P.mjs.map +0 -1
  338. package/dist/esm/chunk-72F5YXGC.mjs.map +0 -1
  339. package/dist/esm/chunk-ARVSIDVB.mjs.map +0 -1
  340. package/dist/esm/chunk-BFQRMCY2.mjs +0 -2
  341. package/dist/esm/chunk-BFQRMCY2.mjs.map +0 -1
  342. package/dist/esm/chunk-BM4HBROC.mjs +0 -2
  343. package/dist/esm/chunk-BM4HBROC.mjs.map +0 -1
  344. package/dist/esm/chunk-BV4OOU5Y.mjs +0 -2
  345. package/dist/esm/chunk-BV4OOU5Y.mjs.map +0 -1
  346. package/dist/esm/chunk-EFIYW4WK.mjs +0 -2
  347. package/dist/esm/chunk-FYIFBLHU.mjs +0 -2
  348. package/dist/esm/chunk-GU4OUKAF.mjs +0 -2
  349. package/dist/esm/chunk-GU4OUKAF.mjs.map +0 -1
  350. package/dist/esm/chunk-J5BH7V37.mjs +0 -2
  351. package/dist/esm/chunk-J5BH7V37.mjs.map +0 -1
  352. package/dist/esm/chunk-KC64ESLO.mjs +0 -2
  353. package/dist/esm/chunk-L7AA75WZ.mjs +0 -2
  354. package/dist/esm/chunk-L7AA75WZ.mjs.map +0 -1
  355. package/dist/esm/chunk-LACQ537H.mjs +0 -2
  356. package/dist/esm/chunk-LACQ537H.mjs.map +0 -1
  357. package/dist/esm/chunk-LDAD54H5.mjs +0 -2
  358. package/dist/esm/chunk-LDAD54H5.mjs.map +0 -1
  359. package/dist/esm/chunk-LXW3A3MJ.mjs +0 -2
  360. package/dist/esm/chunk-LXW3A3MJ.mjs.map +0 -1
  361. package/dist/esm/chunk-M2V2POWK.mjs +0 -2
  362. package/dist/esm/chunk-M2V2POWK.mjs.map +0 -1
  363. package/dist/esm/chunk-ND3ZQKTT.mjs +0 -2
  364. package/dist/esm/chunk-NZIJV4O2.mjs +0 -2
  365. package/dist/esm/chunk-NZIJV4O2.mjs.map +0 -1
  366. package/dist/esm/chunk-O2B54NZT.mjs +0 -2
  367. package/dist/esm/chunk-O2B54NZT.mjs.map +0 -1
  368. package/dist/esm/chunk-OCW2L33Q.mjs +0 -2
  369. package/dist/esm/chunk-OCW2L33Q.mjs.map +0 -1
  370. package/dist/esm/chunk-OCYS4V2V.mjs +0 -2
  371. package/dist/esm/chunk-OCYS4V2V.mjs.map +0 -1
  372. package/dist/esm/chunk-OSTH5JRX.mjs +0 -2
  373. package/dist/esm/chunk-OSTH5JRX.mjs.map +0 -1
  374. package/dist/esm/chunk-OVHY6ZUJ.mjs +0 -2
  375. package/dist/esm/chunk-OVHY6ZUJ.mjs.map +0 -1
  376. package/dist/esm/chunk-PZCMSHY6.mjs +0 -2
  377. package/dist/esm/chunk-PZCMSHY6.mjs.map +0 -1
  378. package/dist/esm/chunk-R3KWVOFG.mjs +0 -2
  379. package/dist/esm/chunk-RHS5ROLP.mjs +0 -2
  380. package/dist/esm/chunk-RHS5ROLP.mjs.map +0 -1
  381. package/dist/esm/chunk-RKKU2SY5.mjs +0 -2
  382. package/dist/esm/chunk-RKKU2SY5.mjs.map +0 -1
  383. package/dist/esm/chunk-RYETO74W.mjs +0 -2
  384. package/dist/esm/chunk-RYETO74W.mjs.map +0 -1
  385. package/dist/esm/chunk-TCTZCPQ6.mjs +0 -1
  386. package/dist/esm/chunk-TGKB6ALT.mjs +0 -2
  387. package/dist/esm/chunk-TGKB6ALT.mjs.map +0 -1
  388. package/dist/esm/chunk-TIH6ARYP.mjs +0 -2
  389. package/dist/esm/chunk-UDBH4CER.mjs.map +0 -1
  390. package/dist/esm/chunk-WEJAI26R.mjs +0 -2
  391. package/dist/esm/chunk-WEJAI26R.mjs.map +0 -1
  392. package/dist/esm/chunk-Y2HRRUZ6.mjs +0 -2
  393. package/dist/esm/chunk-Y2HRRUZ6.mjs.map +0 -1
  394. package/dist/esm/chunk-Y7VR7X5W.mjs +0 -2
  395. package/dist/esm/chunk-Y7VR7X5W.mjs.map +0 -1
  396. package/dist/esm/chunk-ZLW65YCO.mjs +0 -2
  397. package/dist/esm/chunk-ZLW65YCO.mjs.map +0 -1
  398. package/dist/esm/chunk-ZUHN56GM.mjs.map +0 -1
  399. /package/dist/esm/{chunk-TCTZCPQ6.mjs.map → api/utils.mjs.map} +0 -0
  400. /package/dist/esm/{chunk-UAAI3NCA.mjs.map → chunk-2SAKPC5Q.mjs.map} +0 -0
  401. /package/dist/esm/{chunk-3732I6BR.mjs.map → chunk-2YQXX64E.mjs.map} +0 -0
  402. /package/dist/esm/{chunk-4ADA5BE7.mjs.map → chunk-53DS6NBQ.mjs.map} +0 -0
  403. /package/dist/esm/{chunk-QWVR4RCV.mjs.map → chunk-5OPOJ43H.mjs.map} +0 -0
  404. /package/dist/esm/{chunk-HVADSXTB.mjs.map → chunk-73VWOS4Z.mjs.map} +0 -0
  405. /package/dist/esm/{chunk-U25N2VWA.mjs.map → chunk-AZUWHKN5.mjs.map} +0 -0
  406. /package/dist/esm/{chunk-JZNLZMUC.mjs.map → chunk-CJPCOS4R.mjs.map} +0 -0
  407. /package/dist/esm/{chunk-S36IYY6K.mjs.map → chunk-CL5B2QNS.mjs.map} +0 -0
  408. /package/dist/esm/{chunk-EWTHPMEE.mjs.map → chunk-CU2DINU4.mjs.map} +0 -0
  409. /package/dist/esm/{chunk-5LO7FR2P.mjs.map → chunk-EFRFDFS4.mjs.map} +0 -0
  410. /package/dist/esm/{chunk-44MGBJ73.mjs.map → chunk-FZ56IS3E.mjs.map} +0 -0
  411. /package/dist/esm/{chunk-TPWSHFFI.mjs.map → chunk-HC5VMNXA.mjs.map} +0 -0
  412. /package/dist/esm/{chunk-DRPMIJH7.mjs.map → chunk-P5747ZYC.mjs.map} +0 -0
  413. /package/dist/esm/{chunk-BPYLPPEQ.mjs.map → chunk-PL2VA73L.mjs.map} +0 -0
  414. /package/dist/esm/{chunk-EFIYW4WK.mjs.map → chunk-PXTMLJKO.mjs.map} +0 -0
  415. /package/dist/esm/{chunk-WL4OXZLN.mjs.map → chunk-QCBIJCU4.mjs.map} +0 -0
  416. /package/dist/esm/{chunk-KQXRH5FK.mjs.map → chunk-QNTV5NMH.mjs.map} +0 -0
  417. /package/dist/esm/{chunk-HO7K2UAK.mjs.map → chunk-RCM3K5JL.mjs.map} +0 -0
  418. /package/dist/esm/{chunk-3VZ3OZKC.mjs.map → chunk-RLG3WOTH.mjs.map} +0 -0
  419. /package/dist/esm/{chunk-GAI75GOG.mjs.map → chunk-SSJQOXEP.mjs.map} +0 -0
  420. /package/dist/esm/{chunk-IBH7IOIM.mjs.map → chunk-WTGGCH34.mjs.map} +0 -0
  421. /package/dist/esm/{chunk-X32O46IB.mjs.map → chunk-XITLXPBK.mjs.map} +0 -0
  422. /package/dist/esm/{chunk-VWVEDCBM.mjs.map → chunk-YN6UIVFB.mjs.map} +0 -0
  423. /package/dist/esm/{chunk-4KTQIWUP.mjs.map → chunk-ZFK7QD3B.mjs.map} +0 -0
@@ -10,7 +10,7 @@
10
10
 
11
11
  import { AptosConfig } from "../api/aptosConfig";
12
12
  import { AccountAddress, AccountAddressInput } from "../core";
13
- import { AnyNumber, GetEventsResponse, PaginationArgs, MoveStructId, OrderBy } from "../types";
13
+ import { AnyNumber, GetEventsResponse, PaginationArgs, MoveStructId, OrderByArg, WhereArg } from "../types";
14
14
  import { GetEventsQuery } from "../types/generated/operations";
15
15
  import { GetEvents } from "../types/generated/queries";
16
16
  import { EventsBoolExp } from "../types/generated/types";
@@ -36,13 +36,10 @@ export async function getAccountEventsByEventType(args: {
36
36
  aptosConfig: AptosConfig;
37
37
  accountAddress: AccountAddressInput;
38
38
  eventType: MoveStructId;
39
- options?: {
40
- pagination?: PaginationArgs;
41
- orderBy?: OrderBy<GetEventsResponse[0]>;
42
- };
39
+ options?: PaginationArgs & OrderByArg<GetEventsResponse[0]>;
43
40
  }): Promise<GetEventsResponse> {
44
41
  const { accountAddress, aptosConfig, eventType, options } = args;
45
- const address = AccountAddress.fromRelaxed(accountAddress).toStringLong();
42
+ const address = AccountAddress.from(accountAddress).toStringLong();
46
43
 
47
44
  const whereCondition: EventsBoolExp = {
48
45
  account_address: { _eq: address },
@@ -51,7 +48,7 @@ export async function getAccountEventsByEventType(args: {
51
48
 
52
49
  const customOptions = {
53
50
  where: whereCondition,
54
- pagination: options?.pagination,
51
+ pagination: options,
55
52
  orderBy: options?.orderBy,
56
53
  };
57
54
 
@@ -60,11 +57,7 @@ export async function getAccountEventsByEventType(args: {
60
57
 
61
58
  export async function getEvents(args: {
62
59
  aptosConfig: AptosConfig;
63
- options?: {
64
- where?: EventsBoolExp;
65
- pagination?: PaginationArgs;
66
- orderBy?: OrderBy<GetEventsResponse[0]>;
67
- };
60
+ options?: PaginationArgs & OrderByArg<GetEventsResponse[0]> & WhereArg<EventsBoolExp>;
68
61
  }): Promise<GetEventsResponse> {
69
62
  const { aptosConfig, options } = args;
70
63
 
@@ -72,8 +65,8 @@ export async function getEvents(args: {
72
65
  query: GetEvents,
73
66
  variables: {
74
67
  where_condition: options?.where,
75
- offset: options?.pagination?.offset,
76
- limit: options?.pagination?.limit,
68
+ offset: options?.offset,
69
+ limit: options?.limit,
77
70
  order_by: options?.orderBy,
78
71
  },
79
72
  };
@@ -11,7 +11,7 @@
11
11
  import { AptosConfig } from "../api/aptosConfig";
12
12
  import { postAptosFaucet } from "../client";
13
13
  import { AccountAddress, AccountAddressInput } from "../core";
14
- import { WaitForTransactionOptions } from "../types";
14
+ import { TransactionResponseType, UserTransactionResponse, WaitForTransactionOptions } from "../types";
15
15
  import { DEFAULT_TXN_TIMEOUT_SEC } from "../utils/const";
16
16
  import { waitForTransaction } from "./transaction";
17
17
 
@@ -20,14 +20,14 @@ export async function fundAccount(args: {
20
20
  accountAddress: AccountAddressInput;
21
21
  amount: number;
22
22
  options?: WaitForTransactionOptions;
23
- }): Promise<string> {
23
+ }): Promise<UserTransactionResponse> {
24
24
  const { aptosConfig, accountAddress, amount, options } = args;
25
25
  const timeout = options?.timeoutSecs || DEFAULT_TXN_TIMEOUT_SEC;
26
26
  const { data } = await postAptosFaucet<any, { txn_hashes: Array<string> }>({
27
27
  aptosConfig,
28
28
  path: "fund",
29
29
  body: {
30
- address: AccountAddress.fromRelaxed(accountAddress).toString(),
30
+ address: AccountAddress.from(accountAddress).toString(),
31
31
  amount,
32
32
  },
33
33
  originMethod: "fundAccount",
@@ -35,15 +35,19 @@ export async function fundAccount(args: {
35
35
 
36
36
  const txnHash = data.txn_hashes[0];
37
37
 
38
- await waitForTransaction({
38
+ const res = await waitForTransaction({
39
39
  aptosConfig,
40
40
  transactionHash: txnHash,
41
41
  options: {
42
42
  timeoutSecs: timeout,
43
43
  checkSuccess: options?.checkSuccess,
44
- indexerVersionCheck: options?.indexerVersionCheck,
45
44
  },
46
45
  });
47
46
 
48
- return txnHash;
47
+ // Response is always User transaction for a user submitted transaction
48
+ if (res.type === TransactionResponseType.User) {
49
+ return res;
50
+ }
51
+
52
+ throw new Error(`Unexpected transaction received for fund account: ${res.type}`);
49
53
  }
@@ -10,10 +10,12 @@
10
10
 
11
11
  import { AptosConfig } from "../api/aptosConfig";
12
12
  import {
13
+ AnyNumber,
13
14
  GetCurrentFungibleAssetBalancesResponse,
14
15
  GetFungibleAssetActivitiesResponse,
15
16
  GetFungibleAssetMetadataResponse,
16
17
  PaginationArgs,
18
+ WhereArg,
17
19
  } from "../types";
18
20
  import { queryIndexer } from "./general";
19
21
  import {
@@ -31,13 +33,13 @@ import {
31
33
  FungibleAssetActivitiesBoolExp,
32
34
  FungibleAssetMetadataBoolExp,
33
35
  } from "../types/generated/types";
36
+ import { Account, AccountAddress } from "../core";
37
+ import { InputGenerateTransactionOptions } from "../transactions";
38
+ import { generateTransaction } from "./transactionSubmission";
34
39
 
35
40
  export async function getFungibleAssetMetadata(args: {
36
41
  aptosConfig: AptosConfig;
37
- options?: {
38
- pagination?: PaginationArgs;
39
- where?: FungibleAssetMetadataBoolExp;
40
- };
42
+ options?: PaginationArgs & WhereArg<FungibleAssetMetadataBoolExp>;
41
43
  }): Promise<GetFungibleAssetMetadataResponse> {
42
44
  const { aptosConfig, options } = args;
43
45
 
@@ -45,8 +47,8 @@ export async function getFungibleAssetMetadata(args: {
45
47
  query: GetFungibleAssetMetadata,
46
48
  variables: {
47
49
  where_condition: options?.where,
48
- limit: options?.pagination?.limit,
49
- offset: options?.pagination?.offset,
50
+ limit: options?.limit,
51
+ offset: options?.offset,
50
52
  },
51
53
  };
52
54
 
@@ -61,10 +63,7 @@ export async function getFungibleAssetMetadata(args: {
61
63
 
62
64
  export async function getFungibleAssetActivities(args: {
63
65
  aptosConfig: AptosConfig;
64
- options?: {
65
- pagination?: PaginationArgs;
66
- where?: FungibleAssetActivitiesBoolExp;
67
- };
66
+ options?: PaginationArgs & WhereArg<FungibleAssetActivitiesBoolExp>;
68
67
  }): Promise<GetFungibleAssetActivitiesResponse> {
69
68
  const { aptosConfig, options } = args;
70
69
 
@@ -72,8 +71,8 @@ export async function getFungibleAssetActivities(args: {
72
71
  query: GetFungibleAssetActivities,
73
72
  variables: {
74
73
  where_condition: options?.where,
75
- limit: options?.pagination?.limit,
76
- offset: options?.pagination?.offset,
74
+ limit: options?.limit,
75
+ offset: options?.offset,
77
76
  },
78
77
  };
79
78
 
@@ -88,10 +87,7 @@ export async function getFungibleAssetActivities(args: {
88
87
 
89
88
  export async function getCurrentFungibleAssetBalances(args: {
90
89
  aptosConfig: AptosConfig;
91
- options?: {
92
- pagination?: PaginationArgs;
93
- where?: CurrentFungibleAssetBalancesBoolExp;
94
- };
90
+ options?: PaginationArgs & WhereArg<CurrentFungibleAssetBalancesBoolExp>;
95
91
  }): Promise<GetCurrentFungibleAssetBalancesResponse> {
96
92
  const { aptosConfig, options } = args;
97
93
 
@@ -99,8 +95,8 @@ export async function getCurrentFungibleAssetBalances(args: {
99
95
  query: GetCurrentFungibleAssetBalances,
100
96
  variables: {
101
97
  where_condition: options?.where,
102
- limit: options?.pagination?.limit,
103
- offset: options?.pagination?.offset,
98
+ limit: options?.limit,
99
+ offset: options?.offset,
104
100
  },
105
101
  };
106
102
 
@@ -112,3 +108,25 @@ export async function getCurrentFungibleAssetBalances(args: {
112
108
 
113
109
  return data.current_fungible_asset_balances;
114
110
  }
111
+
112
+ export async function transferFungibleAsset(args: {
113
+ aptosConfig: AptosConfig;
114
+ sender: Account;
115
+ fungibleAssetMetadataAddress: AccountAddress;
116
+ recipient: AccountAddress;
117
+ amount: AnyNumber;
118
+ options?: InputGenerateTransactionOptions;
119
+ }) {
120
+ const { aptosConfig, sender, fungibleAssetMetadataAddress, recipient, amount, options } = args;
121
+ const transaction = await generateTransaction({
122
+ aptosConfig,
123
+ sender: sender.accountAddress,
124
+ data: {
125
+ function: "0x1::primary_fungible_store::transfer",
126
+ typeArguments: ["0x1::fungible_asset::Metadata"],
127
+ functionArguments: [fungibleAssetMetadataAddress, recipient, amount],
128
+ },
129
+ options,
130
+ });
131
+ return transaction;
132
+ }
@@ -17,7 +17,7 @@ import {
17
17
  GetProcessorStatusResponse,
18
18
  GraphqlQuery,
19
19
  LedgerInfo,
20
- LedgerVersion,
20
+ LedgerVersionArg,
21
21
  MoveValue,
22
22
  TableItemRequest,
23
23
  ViewRequest,
@@ -25,6 +25,7 @@ import {
25
25
  } from "../types";
26
26
  import { GetChainTopUserTransactionsQuery, GetProcessorStatusQuery } from "../types/generated/operations";
27
27
  import { GetChainTopUserTransactions, GetProcessorStatus } from "../types/generated/queries";
28
+ import { ProcessorType } from "../utils/const";
28
29
 
29
30
  export async function getLedgerInfo(args: { aptosConfig: AptosConfig }): Promise<LedgerInfo> {
30
31
  const { aptosConfig } = args;
@@ -70,7 +71,7 @@ export async function getTableItem<T>(args: {
70
71
  aptosConfig: AptosConfig;
71
72
  handle: string;
72
73
  data: TableItemRequest;
73
- options?: LedgerVersion;
74
+ options?: LedgerVersionArg;
74
75
  }): Promise<T> {
75
76
  const { aptosConfig, handle, data, options } = args;
76
77
  const response = await postAptosFullNode<TableItemRequest, any>({
@@ -86,7 +87,7 @@ export async function getTableItem<T>(args: {
86
87
  export async function view<T extends Array<MoveValue> = Array<MoveValue>>(args: {
87
88
  aptosConfig: AptosConfig;
88
89
  payload: InputViewRequestData;
89
- options?: LedgerVersion;
90
+ options?: LedgerVersionArg;
90
91
  }): Promise<T> {
91
92
  const { aptosConfig, payload, options } = args;
92
93
  const { data } = await postAptosFullNode<ViewRequest, MoveValue[]>({
@@ -159,3 +160,29 @@ export async function getIndexerLastSuccessVersion(args: { aptosConfig: AptosCon
159
160
  const response = await getProcessorStatuses({ aptosConfig: args.aptosConfig });
160
161
  return response[0].last_success_version;
161
162
  }
163
+
164
+ export async function getProcessorStatus(args: {
165
+ aptosConfig: AptosConfig;
166
+ processorType: ProcessorType;
167
+ }): Promise<GetProcessorStatusResponse[0]> {
168
+ const { aptosConfig, processorType } = args;
169
+
170
+ const whereCondition: { processor: { _eq: string } } = {
171
+ processor: { _eq: processorType.valueOf() },
172
+ };
173
+
174
+ const graphqlQuery = {
175
+ query: GetProcessorStatus,
176
+ variables: {
177
+ where_condition: whereCondition,
178
+ },
179
+ };
180
+
181
+ const data = await queryIndexer<GetProcessorStatusQuery>({
182
+ aptosConfig,
183
+ query: graphqlQuery,
184
+ originMethod: "getProcessorStatus",
185
+ });
186
+
187
+ return data.processor_status[0];
188
+ }
@@ -1,8 +1,8 @@
1
- query getNumberOfDelegators($where_condition: num_active_delegator_per_pool_bool_exp!, $order_by: [num_active_delegator_per_pool_order_by!]) {
2
- num_active_delegator_per_pool(
3
- where: $where_condition,
4
- order_by: $order_by
5
- ) {
1
+ query getNumberOfDelegators(
2
+ $where_condition: num_active_delegator_per_pool_bool_exp
3
+ $order_by: [num_active_delegator_per_pool_order_by!]
4
+ ) {
5
+ num_active_delegator_per_pool(where: $where_condition, order_by: $order_by) {
6
6
  num_active_delegator
7
7
  pool_address
8
8
  }
@@ -1,5 +1,5 @@
1
- query getProcessorStatus {
2
- processor_status {
1
+ query getProcessorStatus($where_condition: processor_status_bool_exp) {
2
+ processor_status(where: $where_condition) {
3
3
  last_success_version
4
4
  processor
5
5
  last_updated
@@ -10,7 +10,7 @@
10
10
 
11
11
  import { AptosConfig } from "../api/aptosConfig";
12
12
  import { AccountAddress, AccountAddressInput } from "../core";
13
- import { GetDelegatedStakingActivitiesResponse, GetNumberOfDelegatorsResponse, OrderBy } from "../types";
13
+ import { GetDelegatedStakingActivitiesResponse, GetNumberOfDelegatorsResponse, OrderByArg } from "../types";
14
14
  import { GetDelegatedStakingActivitiesQuery, GetNumberOfDelegatorsQuery } from "../types/generated/operations";
15
15
  import { GetDelegatedStakingActivities, GetNumberOfDelegators } from "../types/generated/queries";
16
16
  import { queryIndexer } from "./general";
@@ -20,30 +20,28 @@ export async function getNumberOfDelegators(args: {
20
20
  poolAddress: AccountAddressInput;
21
21
  }): Promise<number> {
22
22
  const { aptosConfig, poolAddress } = args;
23
- const address = AccountAddress.fromRelaxed(poolAddress).toStringLong();
23
+ const address = AccountAddress.from(poolAddress).toStringLong();
24
24
  const query = {
25
25
  query: GetNumberOfDelegators,
26
26
  variables: { where_condition: { pool_address: { _eq: address } } },
27
27
  };
28
- const data: GetNumberOfDelegatorsQuery = await queryIndexer<GetNumberOfDelegatorsQuery>({ aptosConfig, query });
29
- if (data.num_active_delegator_per_pool.length === 0) {
30
- throw Error("Delegator pool not found");
31
- }
32
- return data.num_active_delegator_per_pool[0].num_active_delegator;
28
+ const data = await queryIndexer<GetNumberOfDelegatorsQuery>({ aptosConfig, query });
29
+
30
+ // commonjs (aka cjs) doesnt handle Nullish Coalescing for some reason
31
+ // might be because of how ts infer the graphql generated scheme type
32
+ return data.num_active_delegator_per_pool[0] ? data.num_active_delegator_per_pool[0].num_active_delegator : 0;
33
33
  }
34
34
 
35
35
  export async function getNumberOfDelegatorsForAllPools(args: {
36
36
  aptosConfig: AptosConfig;
37
- options?: {
38
- orderBy?: OrderBy<GetNumberOfDelegatorsResponse[0]>;
39
- };
37
+ options?: OrderByArg<GetNumberOfDelegatorsResponse[0]>;
40
38
  }): Promise<GetNumberOfDelegatorsResponse> {
41
39
  const { aptosConfig, options } = args;
42
40
  const query = {
43
41
  query: GetNumberOfDelegators,
44
- variables: { where_condition: {}, order_by: options?.orderBy },
42
+ variables: { order_by: options?.orderBy },
45
43
  };
46
- const data: GetNumberOfDelegatorsQuery = await queryIndexer<GetNumberOfDelegatorsQuery>({
44
+ const data = await queryIndexer<GetNumberOfDelegatorsQuery>({
47
45
  aptosConfig,
48
46
  query,
49
47
  });
@@ -59,8 +57,8 @@ export async function getDelegatedStakingActivities(args: {
59
57
  const query = {
60
58
  query: GetDelegatedStakingActivities,
61
59
  variables: {
62
- delegatorAddress: AccountAddress.fromRelaxed(delegatorAddress).toStringLong(),
63
- poolAddress: AccountAddress.fromRelaxed(poolAddress).toStringLong(),
60
+ delegatorAddress: AccountAddress.from(delegatorAddress).toStringLong(),
61
+ poolAddress: AccountAddress.from(poolAddress).toStringLong(),
64
62
  },
65
63
  };
66
64
  const data = await queryIndexer<GetDelegatedStakingActivitiesQuery>({ aptosConfig, query });
@@ -18,11 +18,12 @@ import {
18
18
  type PaginationArgs,
19
19
  type TransactionResponse,
20
20
  WaitForTransactionOptions,
21
+ CommittedTransactionResponse,
21
22
  } from "../types";
22
- import { DEFAULT_TXN_TIMEOUT_SEC } from "../utils/const";
23
+ import { DEFAULT_TXN_TIMEOUT_SEC, ProcessorType } from "../utils/const";
23
24
  import { sleep } from "../utils/helpers";
24
25
  import { memoizeAsync } from "../utils/memoize";
25
- import { getIndexerLastSuccessVersion } from "./general";
26
+ import { getIndexerLastSuccessVersion, getProcessorStatus } from "./general";
26
27
 
27
28
  export async function getTransactions(args: {
28
29
  aptosConfig: AptosConfig;
@@ -100,11 +101,10 @@ export async function waitForTransaction(args: {
100
101
  aptosConfig: AptosConfig;
101
102
  transactionHash: HexInput;
102
103
  options?: WaitForTransactionOptions;
103
- }): Promise<TransactionResponse> {
104
+ }): Promise<CommittedTransactionResponse> {
104
105
  const { aptosConfig, transactionHash, options } = args;
105
106
  const timeoutSecs = options?.timeoutSecs ?? DEFAULT_TXN_TIMEOUT_SEC;
106
107
  const checkSuccess = options?.checkSuccess ?? true;
107
- const indexerVersionCheck = options?.indexerVersionCheck ?? true;
108
108
 
109
109
  let isPending = true;
110
110
  let timeElapsed = 0;
@@ -167,49 +167,46 @@ export async function waitForTransaction(args: {
167
167
  }
168
168
  if (!lastTxn.success) {
169
169
  throw new FailedTransactionError(
170
- `Transaction ${transactionHash} failed with an error: ${(lastTxn as any).vm_status}`,
170
+ `Transaction ${transactionHash} failed with an error: ${lastTxn.vm_status}`,
171
171
  lastTxn,
172
172
  );
173
173
  }
174
174
 
175
- // Make sure indexer is synced with the latest ledger version
176
- if (indexerVersionCheck) {
177
- try {
178
- await waitForLastSuccessIndexerVersionSync({ aptosConfig, ledgerVersion: Number(lastTxn.version) });
179
- } catch (_e) {
180
- throw new WaitForTransactionError(
181
- // eslint-disable-next-line max-len
182
- `Transaction ${transactionHash} committed, but timed out waiting for indexer to sync with ledger version ${lastTxn.version}.` +
183
- "You can disable this check by setting `indexerVersionCheck` to false in the `extraArgs` parameter.",
184
- lastTxn,
185
- );
186
- }
187
- }
188
-
189
175
  return lastTxn;
190
176
  }
191
177
 
192
178
  /**
193
179
  * Waits for the indexer to sync up to the ledgerVersion. Timeout is 3 seconds.
194
180
  */
195
- async function waitForLastSuccessIndexerVersionSync(args: {
181
+ export async function waitForIndexer(args: {
196
182
  aptosConfig: AptosConfig;
197
- ledgerVersion: number;
183
+ minimumLedgerVersion: AnyNumber;
184
+ processorType?: ProcessorType;
198
185
  }): Promise<void> {
199
- const { aptosConfig, ledgerVersion } = args;
186
+ const { aptosConfig, processorType } = args;
187
+ const minimumLedgerVersion = BigInt(args.minimumLedgerVersion);
200
188
  const timeoutMilliseconds = 3000; // 3 seconds
201
189
  const startTime = new Date().getTime();
202
190
  let indexerVersion = -1;
203
191
 
204
- while (indexerVersion < ledgerVersion) {
192
+ while (indexerVersion < minimumLedgerVersion) {
205
193
  // check for timeout
206
194
  if (new Date().getTime() - startTime > timeoutMilliseconds) {
207
195
  throw new Error("waitForLastSuccessIndexerVersionSync timeout");
208
196
  }
209
197
 
210
- // eslint-disable-next-line no-await-in-loop
211
- indexerVersion = await getIndexerLastSuccessVersion({ aptosConfig });
212
- if (indexerVersion >= ledgerVersion) {
198
+ if (processorType === undefined) {
199
+ // Get the last success version from all processor
200
+ // eslint-disable-next-line no-await-in-loop
201
+ indexerVersion = await getIndexerLastSuccessVersion({ aptosConfig });
202
+ } else {
203
+ // Get the last success version from the specific processor
204
+ // eslint-disable-next-line no-await-in-loop
205
+ const processor = await getProcessorStatus({ aptosConfig, processorType });
206
+ indexerVersion = processor.last_success_version;
207
+ }
208
+
209
+ if (indexerVersion >= minimumLedgerVersion) {
213
210
  // break out immediately if we are synced
214
211
  break;
215
212
  }
@@ -19,6 +19,7 @@ import {
19
19
  generateSignedTransactionForSimulation,
20
20
  generateSignedTransaction,
21
21
  sign,
22
+ generateSigningMessage,
22
23
  } from "../transactions/transactionBuilder/transactionBuilder";
23
24
  import {
24
25
  InputGenerateTransactionData,
@@ -91,7 +92,14 @@ export async function generateTransaction(
91
92
  export async function generateTransaction(
92
93
  args: { aptosConfig: AptosConfig } & InputGenerateTransactionData,
93
94
  ): Promise<AnyRawTransaction> {
94
- const { aptosConfig, sender, data, options } = args;
95
+ const payload = await buildTransactionPayload(args);
96
+ return buildRawTransaction(args, payload);
97
+ }
98
+
99
+ export async function buildTransactionPayload(
100
+ args: { aptosConfig: AptosConfig } & InputGenerateTransactionData,
101
+ ): Promise<AnyTransactionPayloadInstance> {
102
+ const { aptosConfig, data } = args;
95
103
 
96
104
  // Merge in aptosConfig for remote ABI on non-script payloads
97
105
  let generateTransactionPayloadData: InputGenerateTransactionPayloadDataWithRemoteABI;
@@ -117,6 +125,14 @@ export async function generateTransaction(
117
125
  };
118
126
  payload = await generateTransactionPayload(generateTransactionPayloadData);
119
127
  }
128
+ return payload;
129
+ }
130
+
131
+ export async function buildRawTransaction(
132
+ args: { aptosConfig: AptosConfig } & InputGenerateTransactionData,
133
+ payload: AnyTransactionPayloadInstance,
134
+ ): Promise<AnyRawTransaction> {
135
+ const { aptosConfig, sender, options } = args;
120
136
 
121
137
  let feePayerAddress;
122
138
  if (isFeePayerTransactionInput(args)) {
@@ -154,6 +170,20 @@ function isMultiAgentTransactionInput(
154
170
  return "secondarySignerAddresses" in data;
155
171
  }
156
172
 
173
+ /**
174
+ * Builds a signing message that can be signed by external signers
175
+ *
176
+ * Note: Please prefer using `signTransaction` unless signing outside the SDK
177
+ *
178
+ * @param args.transaction AnyRawTransaction, as generated by `generateTransaction()`
179
+ *
180
+ * @return The message to be signed
181
+ */
182
+ export function getSigningMessage(args: { transaction: AnyRawTransaction }): Uint8Array {
183
+ const { transaction } = args;
184
+ return generateSigningMessage(transaction);
185
+ }
186
+
157
187
  /**
158
188
  * Sign a transaction that can later be submitted to chain
159
189
  *
@@ -264,14 +294,14 @@ export async function publicPackageTransaction(args: {
264
294
 
265
295
  const transaction = await generateTransaction({
266
296
  aptosConfig,
267
- sender: AccountAddress.fromRelaxed(account),
297
+ sender: AccountAddress.from(account),
268
298
  data: {
269
299
  function: "0x1::code::publish_package_txn",
270
300
  functionArguments: [MoveVector.U8(metadataBytes), new MoveVector(totalByteCode)],
271
301
  },
272
302
  options,
273
303
  });
274
- return transaction as SingleSignerTransaction;
304
+ return transaction;
275
305
  }
276
306
 
277
307
  /**
@@ -285,7 +315,7 @@ export async function rotateAuthKey(args: {
285
315
  const { aptosConfig, fromAccount, toNewPrivateKey } = args;
286
316
  const accountInfo = await getInfo({
287
317
  aptosConfig,
288
- accountAddress: fromAccount.accountAddress.toString(),
318
+ accountAddress: fromAccount.accountAddress,
289
319
  });
290
320
 
291
321
  const newAccount = Account.fromPrivateKey({ privateKey: toNewPrivateKey, legacy: true });
@@ -305,7 +335,7 @@ export async function rotateAuthKey(args: {
305
335
  // Generate transaction
306
336
  const rawTxn = await generateTransaction({
307
337
  aptosConfig,
308
- sender: fromAccount.accountAddress.toString(),
338
+ sender: fromAccount.accountAddress,
309
339
  data: {
310
340
  function: "0x1::account::rotate_authentication_key",
311
341
  functionArguments: [
@@ -29,6 +29,22 @@ export abstract class AccountAuthenticator extends Serializable {
29
29
  throw new Error(`Unknown variant index for AccountAuthenticator: ${index}`);
30
30
  }
31
31
  }
32
+
33
+ isEd25519(): this is AccountAuthenticatorEd25519 {
34
+ return this instanceof AccountAuthenticatorEd25519;
35
+ }
36
+
37
+ isMultiEd25519(): this is AccountAuthenticatorMultiEd25519 {
38
+ return this instanceof AccountAuthenticatorMultiEd25519;
39
+ }
40
+
41
+ isSingleKey(): this is AccountAuthenticatorSingleKey {
42
+ return this instanceof AccountAuthenticatorSingleKey;
43
+ }
44
+
45
+ isMultiKey(): this is AccountAuthenticatorMultiKey {
46
+ return this instanceof AccountAuthenticatorMultiKey;
47
+ }
32
48
  }
33
49
 
34
50
  /**
@@ -37,7 +37,7 @@ export class ModuleId extends Serializable {
37
37
  if (parts.length !== 2) {
38
38
  throw new Error("Invalid module id.");
39
39
  }
40
- return new ModuleId(AccountAddress.fromStringRelaxed(parts[0]), new Identifier(parts[1]));
40
+ return new ModuleId(AccountAddress.fromString(parts[0]), new Identifier(parts[1]));
41
41
  }
42
42
 
43
43
  serialize(serializer: Serializer): void {