@aptos-labs/ts-sdk 1.34.0 → 1.35.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 (419) hide show
  1. package/README.md +8 -9
  2. package/dist/common/{accountAddress-CDtCLtJA.d.ts → accountAddress-CuHovHdK.d.ts} +19 -0
  3. package/dist/common/chunk-RX5UBAME.js +4 -0
  4. package/dist/common/chunk-RX5UBAME.js.map +1 -0
  5. package/dist/common/cli/index.d.ts +1 -1
  6. package/dist/common/cli/index.js +1 -1
  7. package/dist/common/cli/index.js.map +1 -1
  8. package/dist/common/index.d.ts +489 -241
  9. package/dist/common/index.js +32 -32
  10. package/dist/common/index.js.map +1 -1
  11. package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
  12. package/dist/esm/account/AbstractedAccount.mjs +1 -1
  13. package/dist/esm/account/Account.d.mts +1 -1
  14. package/dist/esm/account/Account.mjs +1 -1
  15. package/dist/esm/account/AccountUtils.mjs +1 -1
  16. package/dist/esm/account/Ed25519Account.d.mts +2 -2
  17. package/dist/esm/account/Ed25519Account.mjs +1 -1
  18. package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
  19. package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
  20. package/dist/esm/account/KeylessAccount.mjs +1 -1
  21. package/dist/esm/account/MultiEd25519Account.d.mts +108 -0
  22. package/dist/esm/account/MultiEd25519Account.mjs +2 -0
  23. package/dist/esm/account/MultiKeyAccount.d.mts +1 -2
  24. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  25. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  26. package/dist/esm/account/index.d.mts +1 -0
  27. package/dist/esm/account/index.mjs +1 -1
  28. package/dist/esm/account/utils.mjs +1 -1
  29. package/dist/esm/api/account/abstraction.mjs +1 -1
  30. package/dist/esm/api/account.d.mts +1 -1
  31. package/dist/esm/api/account.mjs +1 -1
  32. package/dist/esm/api/ans.mjs +1 -1
  33. package/dist/esm/api/aptos.d.mts +3 -1
  34. package/dist/esm/api/aptos.mjs +1 -1
  35. package/dist/esm/api/aptosConfig.mjs +1 -1
  36. package/dist/esm/api/coin.d.mts +2 -2
  37. package/dist/esm/api/coin.mjs +1 -1
  38. package/dist/esm/api/digitalAsset.mjs +1 -1
  39. package/dist/esm/api/event.mjs +1 -1
  40. package/dist/esm/api/experimental.d.mts +83 -0
  41. package/dist/esm/api/experimental.mjs +2 -0
  42. package/dist/esm/api/experimental.mjs.map +1 -0
  43. package/dist/esm/api/faucet.mjs +1 -1
  44. package/dist/esm/api/fungibleAsset.mjs +1 -1
  45. package/dist/esm/api/general.mjs +1 -1
  46. package/dist/esm/api/index.d.mts +1 -0
  47. package/dist/esm/api/index.mjs +1 -1
  48. package/dist/esm/api/keyless.mjs +1 -1
  49. package/dist/esm/api/object.mjs +1 -1
  50. package/dist/esm/api/staking.mjs +1 -1
  51. package/dist/esm/api/table.mjs +1 -1
  52. package/dist/esm/api/transaction.mjs +1 -1
  53. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  54. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  55. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  56. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  57. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  58. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  59. package/dist/esm/api/utils.mjs +1 -1
  60. package/dist/esm/bcs/deserializer.mjs +1 -1
  61. package/dist/esm/bcs/index.mjs +1 -1
  62. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  63. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  64. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  65. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  66. package/dist/esm/bcs/serializer.mjs +1 -1
  67. package/dist/esm/{chunk-P7SE5LQE.mjs → chunk-27ESCVVC.mjs} +2 -2
  68. package/dist/esm/chunk-2SAYQUUX.mjs +2 -0
  69. package/dist/esm/chunk-2SAYQUUX.mjs.map +1 -0
  70. package/dist/esm/{chunk-UTXEW2FT.mjs → chunk-2TRQERBL.mjs} +2 -2
  71. package/dist/esm/chunk-2V636AYW.mjs +2 -0
  72. package/dist/esm/{chunk-L6FONDPA.mjs → chunk-2YKERRHD.mjs} +2 -2
  73. package/dist/esm/chunk-2ZLFQBT2.mjs +2 -0
  74. package/dist/esm/chunk-2ZLFQBT2.mjs.map +1 -0
  75. package/dist/esm/{chunk-XDIX7NIP.mjs → chunk-3LDVJ2YK.mjs} +2 -2
  76. package/dist/esm/{chunk-J7HRQ2IH.mjs → chunk-44EHAKKW.mjs} +2 -2
  77. package/dist/esm/{chunk-2FNFUTFJ.mjs → chunk-53IBOHXB.mjs} +2 -2
  78. package/dist/esm/{chunk-X6IHNXWY.mjs → chunk-5H5D6QVX.mjs} +2 -2
  79. package/dist/esm/{chunk-G4O6FXCF.mjs → chunk-5W2ERBGY.mjs} +2 -2
  80. package/dist/esm/{chunk-VOCI2675.mjs → chunk-67A5U2X6.mjs} +2 -2
  81. package/dist/esm/{chunk-XXHZQFYW.mjs → chunk-6IJZRG3U.mjs} +2 -2
  82. package/dist/esm/{chunk-N4DM5FYH.mjs → chunk-6KZT3KFZ.mjs} +2 -2
  83. package/dist/esm/chunk-752TOOCA.mjs +2 -0
  84. package/dist/esm/chunk-752TOOCA.mjs.map +1 -0
  85. package/dist/esm/{chunk-ZP5EBIBE.mjs → chunk-7A2KHJ3D.mjs} +2 -2
  86. package/dist/esm/{chunk-ROT6S6BM.mjs → chunk-7CRQNXR5.mjs} +2 -2
  87. package/dist/esm/{chunk-TM6IKHMX.mjs → chunk-7OUPEQRN.mjs} +2 -2
  88. package/dist/esm/chunk-A3VO773Q.mjs +2 -0
  89. package/dist/esm/{chunk-DWJ3PGWE.mjs → chunk-AEGA5N2W.mjs} +2 -2
  90. package/dist/esm/{chunk-BI3BTSUB.mjs → chunk-AIPHJFJL.mjs} +2 -2
  91. package/dist/esm/{chunk-HLJE5XGE.mjs → chunk-AQWKKSRN.mjs} +2 -2
  92. package/dist/esm/{chunk-D6T3NYOA.mjs → chunk-B23VO5TB.mjs} +2 -2
  93. package/dist/esm/{chunk-42T3UGSW.mjs → chunk-BHVSIRNF.mjs} +2 -2
  94. package/dist/esm/chunk-BMPHQ3E7.mjs +2 -0
  95. package/dist/esm/{chunk-EGZI6EJ2.mjs → chunk-BPHCRTHD.mjs} +2 -2
  96. package/dist/esm/{chunk-XH3BEKII.mjs → chunk-BQYKFATL.mjs} +2 -2
  97. package/dist/esm/chunk-BY3XFRUM.mjs +2 -0
  98. package/dist/esm/{chunk-EY2JUXEC.mjs.map → chunk-BY3XFRUM.mjs.map} +1 -1
  99. package/dist/esm/{chunk-DBIZE7G6.mjs → chunk-CGTMSLVZ.mjs} +2 -2
  100. package/dist/esm/{chunk-4T75XRI2.mjs → chunk-CPAAEEF4.mjs} +2 -2
  101. package/dist/esm/{chunk-DMS7K76O.mjs → chunk-CPFQUFVD.mjs} +2 -2
  102. package/dist/esm/chunk-CXLNTATW.mjs +2 -0
  103. package/dist/esm/chunk-CXLNTATW.mjs.map +1 -0
  104. package/dist/esm/{chunk-Q7RG7KQS.mjs → chunk-DAJFOJ3L.mjs} +2 -2
  105. package/dist/esm/chunk-DOVH6HPL.mjs +2 -0
  106. package/dist/esm/{chunk-U2SJIG2T.mjs → chunk-E5PAUR4N.mjs} +2 -2
  107. package/dist/esm/{chunk-6LGXFXXR.mjs → chunk-EGCL6KA6.mjs} +2 -2
  108. package/dist/esm/{chunk-TOBQ5UE6.mjs → chunk-ERLDXTIY.mjs} +2 -2
  109. package/dist/esm/{chunk-CSG67JHZ.mjs → chunk-FJ5J7CVW.mjs} +2 -2
  110. package/dist/esm/{chunk-DLLDRANJ.mjs → chunk-FOEPRHAC.mjs} +2 -2
  111. package/dist/esm/{chunk-6JTNS5O6.mjs → chunk-G5F5ZOH5.mjs} +2 -2
  112. package/dist/esm/chunk-GFPEB22G.mjs +1 -0
  113. package/dist/esm/chunk-GFPEB22G.mjs.map +1 -0
  114. package/dist/esm/{chunk-AZWVCBK2.mjs → chunk-GI4AR6DQ.mjs} +2 -2
  115. package/dist/esm/{chunk-Y3Y4DVCK.mjs → chunk-GRRBXHVG.mjs} +2 -2
  116. package/dist/esm/{chunk-HT2WC3QV.mjs → chunk-GTVMJJQQ.mjs} +2 -2
  117. package/dist/esm/{chunk-HL2O3T57.mjs → chunk-GU4MD5ST.mjs} +2 -2
  118. package/dist/esm/chunk-H4YAL2IL.mjs +2 -0
  119. package/dist/esm/{chunk-X24PSWCX.mjs → chunk-HBTJN4RJ.mjs} +2 -2
  120. package/dist/esm/{chunk-IDTLNF4M.mjs → chunk-HHWJHOFZ.mjs} +2 -2
  121. package/dist/esm/{chunk-OURSLL3I.mjs → chunk-HKL4MFNL.mjs} +2 -2
  122. package/dist/esm/{chunk-G6RLN6ET.mjs → chunk-HVIF6DW6.mjs} +2 -2
  123. package/dist/esm/{chunk-VKDTI6NX.mjs → chunk-HYJQHVDZ.mjs} +2 -2
  124. package/dist/esm/chunk-HYJQHVDZ.mjs.map +1 -0
  125. package/dist/esm/{chunk-XAPQNCTN.mjs → chunk-ILUFGYLO.mjs} +2 -2
  126. package/dist/esm/{chunk-ABXES4FS.mjs → chunk-IMYNN4TW.mjs} +2 -2
  127. package/dist/esm/{chunk-2GIPNLDO.mjs → chunk-IOHESHLR.mjs} +2 -2
  128. package/dist/esm/{chunk-GQX5KMF7.mjs → chunk-JNNFNYDO.mjs} +2 -2
  129. package/dist/esm/{chunk-3HFZN7L5.mjs → chunk-K233I26C.mjs} +2 -2
  130. package/dist/esm/{chunk-AC3BISWL.mjs → chunk-KK5HUWF6.mjs} +2 -2
  131. package/dist/esm/chunk-KSLLV3ZC.mjs +2 -0
  132. package/dist/esm/chunk-KSLLV3ZC.mjs.map +1 -0
  133. package/dist/esm/{chunk-N7C6LQPZ.mjs → chunk-L6KVC7CJ.mjs} +2 -2
  134. package/dist/esm/{chunk-Q4C4U6I4.mjs → chunk-LQOSHBB7.mjs} +2 -2
  135. package/dist/esm/{chunk-XKUIMGKU.mjs → chunk-LS3IDL2N.mjs} +2 -2
  136. package/dist/esm/{chunk-HFCWJ6QL.mjs → chunk-MAWGZICD.mjs} +2 -2
  137. package/dist/esm/{chunk-JF66JS2R.mjs → chunk-MFLHAVIW.mjs} +2 -2
  138. package/dist/esm/chunk-OLGEN23M.mjs +2 -0
  139. package/dist/esm/{chunk-4UK4MUSD.mjs → chunk-ONGH5DXZ.mjs} +2 -2
  140. package/dist/esm/{chunk-4776UXL6.mjs → chunk-OPD5EKOA.mjs} +2 -2
  141. package/dist/esm/{chunk-V2EXS6TM.mjs → chunk-P5CM4C2G.mjs} +2 -2
  142. package/dist/esm/{chunk-BBUN4IO4.mjs → chunk-PC25RPDV.mjs} +2 -2
  143. package/dist/esm/{chunk-N6YTF76Q.mjs → chunk-PDAWVDI7.mjs} +2 -2
  144. package/dist/esm/chunk-PIPDQFL2.mjs +2 -0
  145. package/dist/esm/chunk-PIPDQFL2.mjs.map +1 -0
  146. package/dist/esm/{chunk-6PBMD2BQ.mjs → chunk-PWGTRRSJ.mjs} +2 -2
  147. package/dist/esm/{chunk-PWYJWTEM.mjs → chunk-PYY2RXFP.mjs} +2 -2
  148. package/dist/esm/chunk-PYY2RXFP.mjs.map +1 -0
  149. package/dist/esm/chunk-QUJM5W4L.mjs +2 -0
  150. package/dist/esm/chunk-QUJM5W4L.mjs.map +1 -0
  151. package/dist/esm/{chunk-H4GZWYIG.mjs → chunk-QYJKCRVA.mjs} +2 -2
  152. package/dist/esm/{chunk-X2CPDUOS.mjs → chunk-R6QCPXQG.mjs} +2 -2
  153. package/dist/esm/chunk-R6QCPXQG.mjs.map +1 -0
  154. package/dist/esm/{chunk-33CBJFX2.mjs → chunk-RDPWCN4B.mjs} +2 -2
  155. package/dist/esm/{chunk-MT2RJ7H3.mjs → chunk-RIINVEZA.mjs} +2 -2
  156. package/dist/esm/{chunk-EBMEXURY.mjs → chunk-RXHER6EA.mjs} +2 -2
  157. package/dist/esm/chunk-SJDHW55X.mjs +2 -0
  158. package/dist/esm/chunk-SJDHW55X.mjs.map +1 -0
  159. package/dist/esm/{chunk-KEJAUCQF.mjs → chunk-T7X4GZDU.mjs} +2 -2
  160. package/dist/esm/{chunk-BUTMGMSD.mjs → chunk-TH5JCPN2.mjs} +2 -2
  161. package/dist/esm/{chunk-ORMOQWWH.mjs → chunk-TKXEVD7A.mjs} +2 -2
  162. package/dist/esm/{chunk-FN4C3CKC.mjs → chunk-TTY5GFMN.mjs} +2 -2
  163. package/dist/esm/chunk-TWETGZ3W.mjs +2 -0
  164. package/dist/esm/chunk-TWETGZ3W.mjs.map +1 -0
  165. package/dist/esm/{chunk-PR3W2QEH.mjs → chunk-U4DEYWFT.mjs} +2 -2
  166. package/dist/esm/{chunk-7CYCKCVU.mjs → chunk-UJJGIPOA.mjs} +2 -2
  167. package/dist/esm/{chunk-ZCEBDPBJ.mjs → chunk-US2HZFOM.mjs} +2 -2
  168. package/dist/esm/{chunk-S47HA7O7.mjs → chunk-VDYUMBOT.mjs} +2 -2
  169. package/dist/esm/chunk-VHY6ZATX.mjs +2 -0
  170. package/dist/esm/chunk-VHY6ZATX.mjs.map +1 -0
  171. package/dist/esm/{chunk-TDGUMBON.mjs → chunk-VWZEJTGP.mjs} +2 -2
  172. package/dist/esm/{chunk-TDGUMBON.mjs.map → chunk-VWZEJTGP.mjs.map} +1 -1
  173. package/dist/esm/{chunk-3EY7MT2M.mjs → chunk-W2C5KRUQ.mjs} +2 -2
  174. package/dist/esm/{chunk-O37BZP2G.mjs → chunk-W4SMZ6IW.mjs} +2 -2
  175. package/dist/esm/chunk-WFKPVKU3.mjs +2 -0
  176. package/dist/esm/chunk-WFKPVKU3.mjs.map +1 -0
  177. package/dist/esm/{chunk-CXNF73OX.mjs → chunk-WHVCUVZP.mjs} +2 -2
  178. package/dist/esm/{chunk-QBFGY74I.mjs → chunk-WLDYBSOG.mjs} +2 -2
  179. package/dist/esm/{chunk-HEAWDTLG.mjs → chunk-XRVZAEQO.mjs} +2 -2
  180. package/dist/esm/chunk-XSBUL2WP.mjs +2 -0
  181. package/dist/esm/chunk-XSBUL2WP.mjs.map +1 -0
  182. package/dist/esm/{chunk-DNWFDS7F.mjs → chunk-XW3BXTCZ.mjs} +2 -2
  183. package/dist/esm/{chunk-L2AQG3G3.mjs → chunk-Y65PKZLK.mjs} +2 -2
  184. package/dist/esm/{chunk-WXDA4CCR.mjs → chunk-YAGIE4GN.mjs} +2 -2
  185. package/dist/esm/{chunk-CRFLR3ZY.mjs → chunk-YLUULY6G.mjs} +2 -2
  186. package/dist/esm/{chunk-SCBYJU6K.mjs → chunk-YWSDONJJ.mjs} +2 -2
  187. package/dist/esm/{chunk-BYHCW7MI.mjs → chunk-YXYYII5S.mjs} +2 -2
  188. package/dist/esm/{chunk-XTOIL6MB.mjs → chunk-ZD2TY5N3.mjs} +2 -2
  189. package/dist/esm/{chunk-5BSMF22B.mjs → chunk-ZS2IVRHT.mjs} +2 -2
  190. package/dist/esm/cli/index.mjs +1 -1
  191. package/dist/esm/cli/localNode.mjs +1 -1
  192. package/dist/esm/client/core.d.mts +36 -1
  193. package/dist/esm/client/core.mjs +1 -1
  194. package/dist/esm/client/get.d.mts +35 -1
  195. package/dist/esm/client/get.mjs +1 -1
  196. package/dist/esm/client/index.d.mts +3 -3
  197. package/dist/esm/client/index.mjs +1 -1
  198. package/dist/esm/client/post.d.mts +34 -1
  199. package/dist/esm/client/post.mjs +1 -1
  200. package/dist/esm/core/account/index.mjs +1 -1
  201. package/dist/esm/core/account/utils/address.mjs +1 -1
  202. package/dist/esm/core/account/utils/index.mjs +1 -1
  203. package/dist/esm/core/accountAddress.mjs +1 -1
  204. package/dist/esm/core/authenticationKey.mjs +1 -1
  205. package/dist/esm/core/crypto/abstraction.mjs +1 -1
  206. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  207. package/dist/esm/core/crypto/ephemeral.mjs +1 -1
  208. package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
  209. package/dist/esm/core/crypto/index.d.mts +1 -1
  210. package/dist/esm/core/crypto/index.mjs +1 -1
  211. package/dist/esm/core/crypto/keyless.mjs +1 -1
  212. package/dist/esm/core/crypto/multiEd25519.d.mts +17 -2
  213. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  214. package/dist/esm/core/crypto/multiKey.d.mts +33 -15
  215. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  216. package/dist/esm/core/crypto/privateKey.mjs +1 -1
  217. package/dist/esm/core/crypto/proof.mjs +1 -1
  218. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  219. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  220. package/dist/esm/core/crypto/signature.mjs +1 -1
  221. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  222. package/dist/esm/core/crypto/utils.mjs +1 -1
  223. package/dist/esm/core/hex.mjs +1 -1
  224. package/dist/esm/core/index.d.mts +1 -1
  225. package/dist/esm/core/index.mjs +1 -1
  226. package/dist/esm/errors/index.mjs +1 -1
  227. package/dist/esm/index.d.mts +6 -4
  228. package/dist/esm/index.mjs +1 -1
  229. package/dist/esm/internal/abstraction.mjs +1 -1
  230. package/dist/esm/internal/account.mjs +1 -1
  231. package/dist/esm/internal/ans.mjs +1 -1
  232. package/dist/esm/internal/coin.mjs +1 -1
  233. package/dist/esm/internal/digitalAsset.mjs +1 -1
  234. package/dist/esm/internal/event.mjs +1 -1
  235. package/dist/esm/internal/experimental.d.mts +52 -0
  236. package/dist/esm/internal/experimental.mjs +2 -0
  237. package/dist/esm/internal/experimental.mjs.map +1 -0
  238. package/dist/esm/internal/faucet.mjs +1 -1
  239. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  240. package/dist/esm/internal/general.mjs +1 -1
  241. package/dist/esm/internal/keyless.mjs +1 -1
  242. package/dist/esm/internal/object.mjs +1 -1
  243. package/dist/esm/internal/staking.mjs +1 -1
  244. package/dist/esm/internal/table.mjs +1 -1
  245. package/dist/esm/internal/transaction.mjs +1 -1
  246. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  247. package/dist/esm/internal/view.mjs +1 -1
  248. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  249. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  250. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  251. package/dist/esm/transactions/index.mjs +1 -1
  252. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  253. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  254. package/dist/esm/transactions/instances/index.mjs +1 -1
  255. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  256. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  257. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  258. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  259. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  260. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  261. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  262. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  263. package/dist/esm/transactions/management/index.mjs +1 -1
  264. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  265. package/dist/esm/transactions/scriptComposer/index.mjs +1 -1
  266. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  267. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  268. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  269. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  270. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +2 -2
  271. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  272. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  273. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  274. package/dist/esm/types/index.mjs +1 -1
  275. package/dist/esm/types/types.d.mts +19 -0
  276. package/dist/esm/types/types.mjs +1 -1
  277. package/dist/esm/utils/helpers.mjs +1 -1
  278. package/dist/esm/utils/index.mjs +1 -1
  279. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  280. package/dist/esm/version.d.mts +1 -1
  281. package/dist/esm/version.mjs +1 -1
  282. package/package.json +2 -7
  283. package/src/account/MultiEd25519Account.ts +154 -0
  284. package/src/account/MultiKeyAccount.ts +1 -2
  285. package/src/account/index.ts +1 -0
  286. package/src/api/account.ts +1 -1
  287. package/src/api/aptos.ts +6 -0
  288. package/src/api/aptosConfig.ts +2 -2
  289. package/src/api/experimental.ts +64 -0
  290. package/src/client/core.ts +120 -0
  291. package/src/client/get.ts +73 -1
  292. package/src/client/post.ts +70 -1
  293. package/src/core/crypto/multiEd25519.ts +19 -3
  294. package/src/core/crypto/multiKey.ts +76 -52
  295. package/src/core/hex.ts +3 -1
  296. package/src/internal/experimental.ts +55 -0
  297. package/src/internal/view.ts +4 -4
  298. package/src/transactions/transactionBuilder/transactionBuilder.ts +7 -0
  299. package/src/types/types.ts +20 -0
  300. package/src/version.ts +1 -1
  301. package/dist/common/chunk-ZYPBABLQ.js +0 -4
  302. package/dist/common/chunk-ZYPBABLQ.js.map +0 -1
  303. package/dist/esm/chunk-4YLUM62M.mjs +0 -2
  304. package/dist/esm/chunk-66HHRRIX.mjs +0 -2
  305. package/dist/esm/chunk-66HHRRIX.mjs.map +0 -1
  306. package/dist/esm/chunk-7C2RDOWS.mjs +0 -1
  307. package/dist/esm/chunk-7DPHPPMG.mjs +0 -2
  308. package/dist/esm/chunk-7DPHPPMG.mjs.map +0 -1
  309. package/dist/esm/chunk-DNJQWGB7.mjs +0 -2
  310. package/dist/esm/chunk-DPW6ELCQ.mjs +0 -2
  311. package/dist/esm/chunk-EMURYYVO.mjs +0 -2
  312. package/dist/esm/chunk-EY2JUXEC.mjs +0 -2
  313. package/dist/esm/chunk-F2ZTBAJJ.mjs +0 -2
  314. package/dist/esm/chunk-F2ZTBAJJ.mjs.map +0 -1
  315. package/dist/esm/chunk-I7YHK6ZF.mjs +0 -2
  316. package/dist/esm/chunk-I7YHK6ZF.mjs.map +0 -1
  317. package/dist/esm/chunk-PNSF3E67.mjs +0 -2
  318. package/dist/esm/chunk-PNSF3E67.mjs.map +0 -1
  319. package/dist/esm/chunk-PWYJWTEM.mjs.map +0 -1
  320. package/dist/esm/chunk-STY74NUA.mjs +0 -2
  321. package/dist/esm/chunk-STY74NUA.mjs.map +0 -1
  322. package/dist/esm/chunk-ULHOJ2BE.mjs +0 -2
  323. package/dist/esm/chunk-ULHOJ2BE.mjs.map +0 -1
  324. package/dist/esm/chunk-V7G2EDNR.mjs +0 -2
  325. package/dist/esm/chunk-V7G2EDNR.mjs.map +0 -1
  326. package/dist/esm/chunk-VKDTI6NX.mjs.map +0 -1
  327. package/dist/esm/chunk-WCMW2L3P.mjs +0 -2
  328. package/dist/esm/chunk-X2CPDUOS.mjs.map +0 -1
  329. package/dist/esm/chunk-XJJVJOX5.mjs +0 -2
  330. package/dist/esm/chunk-YIF242TF.mjs +0 -2
  331. package/dist/esm/chunk-YIF242TF.mjs.map +0 -1
  332. /package/dist/esm/{chunk-7C2RDOWS.mjs.map → account/MultiEd25519Account.mjs.map} +0 -0
  333. /package/dist/esm/{chunk-P7SE5LQE.mjs.map → chunk-27ESCVVC.mjs.map} +0 -0
  334. /package/dist/esm/{chunk-UTXEW2FT.mjs.map → chunk-2TRQERBL.mjs.map} +0 -0
  335. /package/dist/esm/{chunk-XJJVJOX5.mjs.map → chunk-2V636AYW.mjs.map} +0 -0
  336. /package/dist/esm/{chunk-L6FONDPA.mjs.map → chunk-2YKERRHD.mjs.map} +0 -0
  337. /package/dist/esm/{chunk-XDIX7NIP.mjs.map → chunk-3LDVJ2YK.mjs.map} +0 -0
  338. /package/dist/esm/{chunk-J7HRQ2IH.mjs.map → chunk-44EHAKKW.mjs.map} +0 -0
  339. /package/dist/esm/{chunk-2FNFUTFJ.mjs.map → chunk-53IBOHXB.mjs.map} +0 -0
  340. /package/dist/esm/{chunk-X6IHNXWY.mjs.map → chunk-5H5D6QVX.mjs.map} +0 -0
  341. /package/dist/esm/{chunk-G4O6FXCF.mjs.map → chunk-5W2ERBGY.mjs.map} +0 -0
  342. /package/dist/esm/{chunk-VOCI2675.mjs.map → chunk-67A5U2X6.mjs.map} +0 -0
  343. /package/dist/esm/{chunk-XXHZQFYW.mjs.map → chunk-6IJZRG3U.mjs.map} +0 -0
  344. /package/dist/esm/{chunk-N4DM5FYH.mjs.map → chunk-6KZT3KFZ.mjs.map} +0 -0
  345. /package/dist/esm/{chunk-ZP5EBIBE.mjs.map → chunk-7A2KHJ3D.mjs.map} +0 -0
  346. /package/dist/esm/{chunk-ROT6S6BM.mjs.map → chunk-7CRQNXR5.mjs.map} +0 -0
  347. /package/dist/esm/{chunk-TM6IKHMX.mjs.map → chunk-7OUPEQRN.mjs.map} +0 -0
  348. /package/dist/esm/{chunk-WCMW2L3P.mjs.map → chunk-A3VO773Q.mjs.map} +0 -0
  349. /package/dist/esm/{chunk-DWJ3PGWE.mjs.map → chunk-AEGA5N2W.mjs.map} +0 -0
  350. /package/dist/esm/{chunk-BI3BTSUB.mjs.map → chunk-AIPHJFJL.mjs.map} +0 -0
  351. /package/dist/esm/{chunk-HLJE5XGE.mjs.map → chunk-AQWKKSRN.mjs.map} +0 -0
  352. /package/dist/esm/{chunk-D6T3NYOA.mjs.map → chunk-B23VO5TB.mjs.map} +0 -0
  353. /package/dist/esm/{chunk-42T3UGSW.mjs.map → chunk-BHVSIRNF.mjs.map} +0 -0
  354. /package/dist/esm/{chunk-4YLUM62M.mjs.map → chunk-BMPHQ3E7.mjs.map} +0 -0
  355. /package/dist/esm/{chunk-EGZI6EJ2.mjs.map → chunk-BPHCRTHD.mjs.map} +0 -0
  356. /package/dist/esm/{chunk-XH3BEKII.mjs.map → chunk-BQYKFATL.mjs.map} +0 -0
  357. /package/dist/esm/{chunk-DBIZE7G6.mjs.map → chunk-CGTMSLVZ.mjs.map} +0 -0
  358. /package/dist/esm/{chunk-4T75XRI2.mjs.map → chunk-CPAAEEF4.mjs.map} +0 -0
  359. /package/dist/esm/{chunk-DMS7K76O.mjs.map → chunk-CPFQUFVD.mjs.map} +0 -0
  360. /package/dist/esm/{chunk-Q7RG7KQS.mjs.map → chunk-DAJFOJ3L.mjs.map} +0 -0
  361. /package/dist/esm/{chunk-DPW6ELCQ.mjs.map → chunk-DOVH6HPL.mjs.map} +0 -0
  362. /package/dist/esm/{chunk-U2SJIG2T.mjs.map → chunk-E5PAUR4N.mjs.map} +0 -0
  363. /package/dist/esm/{chunk-6LGXFXXR.mjs.map → chunk-EGCL6KA6.mjs.map} +0 -0
  364. /package/dist/esm/{chunk-TOBQ5UE6.mjs.map → chunk-ERLDXTIY.mjs.map} +0 -0
  365. /package/dist/esm/{chunk-CSG67JHZ.mjs.map → chunk-FJ5J7CVW.mjs.map} +0 -0
  366. /package/dist/esm/{chunk-DLLDRANJ.mjs.map → chunk-FOEPRHAC.mjs.map} +0 -0
  367. /package/dist/esm/{chunk-6JTNS5O6.mjs.map → chunk-G5F5ZOH5.mjs.map} +0 -0
  368. /package/dist/esm/{chunk-AZWVCBK2.mjs.map → chunk-GI4AR6DQ.mjs.map} +0 -0
  369. /package/dist/esm/{chunk-Y3Y4DVCK.mjs.map → chunk-GRRBXHVG.mjs.map} +0 -0
  370. /package/dist/esm/{chunk-HT2WC3QV.mjs.map → chunk-GTVMJJQQ.mjs.map} +0 -0
  371. /package/dist/esm/{chunk-HL2O3T57.mjs.map → chunk-GU4MD5ST.mjs.map} +0 -0
  372. /package/dist/esm/{chunk-EMURYYVO.mjs.map → chunk-H4YAL2IL.mjs.map} +0 -0
  373. /package/dist/esm/{chunk-X24PSWCX.mjs.map → chunk-HBTJN4RJ.mjs.map} +0 -0
  374. /package/dist/esm/{chunk-IDTLNF4M.mjs.map → chunk-HHWJHOFZ.mjs.map} +0 -0
  375. /package/dist/esm/{chunk-OURSLL3I.mjs.map → chunk-HKL4MFNL.mjs.map} +0 -0
  376. /package/dist/esm/{chunk-G6RLN6ET.mjs.map → chunk-HVIF6DW6.mjs.map} +0 -0
  377. /package/dist/esm/{chunk-XAPQNCTN.mjs.map → chunk-ILUFGYLO.mjs.map} +0 -0
  378. /package/dist/esm/{chunk-ABXES4FS.mjs.map → chunk-IMYNN4TW.mjs.map} +0 -0
  379. /package/dist/esm/{chunk-2GIPNLDO.mjs.map → chunk-IOHESHLR.mjs.map} +0 -0
  380. /package/dist/esm/{chunk-GQX5KMF7.mjs.map → chunk-JNNFNYDO.mjs.map} +0 -0
  381. /package/dist/esm/{chunk-3HFZN7L5.mjs.map → chunk-K233I26C.mjs.map} +0 -0
  382. /package/dist/esm/{chunk-AC3BISWL.mjs.map → chunk-KK5HUWF6.mjs.map} +0 -0
  383. /package/dist/esm/{chunk-N7C6LQPZ.mjs.map → chunk-L6KVC7CJ.mjs.map} +0 -0
  384. /package/dist/esm/{chunk-Q4C4U6I4.mjs.map → chunk-LQOSHBB7.mjs.map} +0 -0
  385. /package/dist/esm/{chunk-XKUIMGKU.mjs.map → chunk-LS3IDL2N.mjs.map} +0 -0
  386. /package/dist/esm/{chunk-HFCWJ6QL.mjs.map → chunk-MAWGZICD.mjs.map} +0 -0
  387. /package/dist/esm/{chunk-JF66JS2R.mjs.map → chunk-MFLHAVIW.mjs.map} +0 -0
  388. /package/dist/esm/{chunk-DNJQWGB7.mjs.map → chunk-OLGEN23M.mjs.map} +0 -0
  389. /package/dist/esm/{chunk-4UK4MUSD.mjs.map → chunk-ONGH5DXZ.mjs.map} +0 -0
  390. /package/dist/esm/{chunk-4776UXL6.mjs.map → chunk-OPD5EKOA.mjs.map} +0 -0
  391. /package/dist/esm/{chunk-V2EXS6TM.mjs.map → chunk-P5CM4C2G.mjs.map} +0 -0
  392. /package/dist/esm/{chunk-BBUN4IO4.mjs.map → chunk-PC25RPDV.mjs.map} +0 -0
  393. /package/dist/esm/{chunk-N6YTF76Q.mjs.map → chunk-PDAWVDI7.mjs.map} +0 -0
  394. /package/dist/esm/{chunk-6PBMD2BQ.mjs.map → chunk-PWGTRRSJ.mjs.map} +0 -0
  395. /package/dist/esm/{chunk-H4GZWYIG.mjs.map → chunk-QYJKCRVA.mjs.map} +0 -0
  396. /package/dist/esm/{chunk-33CBJFX2.mjs.map → chunk-RDPWCN4B.mjs.map} +0 -0
  397. /package/dist/esm/{chunk-MT2RJ7H3.mjs.map → chunk-RIINVEZA.mjs.map} +0 -0
  398. /package/dist/esm/{chunk-EBMEXURY.mjs.map → chunk-RXHER6EA.mjs.map} +0 -0
  399. /package/dist/esm/{chunk-KEJAUCQF.mjs.map → chunk-T7X4GZDU.mjs.map} +0 -0
  400. /package/dist/esm/{chunk-BUTMGMSD.mjs.map → chunk-TH5JCPN2.mjs.map} +0 -0
  401. /package/dist/esm/{chunk-ORMOQWWH.mjs.map → chunk-TKXEVD7A.mjs.map} +0 -0
  402. /package/dist/esm/{chunk-FN4C3CKC.mjs.map → chunk-TTY5GFMN.mjs.map} +0 -0
  403. /package/dist/esm/{chunk-PR3W2QEH.mjs.map → chunk-U4DEYWFT.mjs.map} +0 -0
  404. /package/dist/esm/{chunk-7CYCKCVU.mjs.map → chunk-UJJGIPOA.mjs.map} +0 -0
  405. /package/dist/esm/{chunk-ZCEBDPBJ.mjs.map → chunk-US2HZFOM.mjs.map} +0 -0
  406. /package/dist/esm/{chunk-S47HA7O7.mjs.map → chunk-VDYUMBOT.mjs.map} +0 -0
  407. /package/dist/esm/{chunk-3EY7MT2M.mjs.map → chunk-W2C5KRUQ.mjs.map} +0 -0
  408. /package/dist/esm/{chunk-O37BZP2G.mjs.map → chunk-W4SMZ6IW.mjs.map} +0 -0
  409. /package/dist/esm/{chunk-CXNF73OX.mjs.map → chunk-WHVCUVZP.mjs.map} +0 -0
  410. /package/dist/esm/{chunk-QBFGY74I.mjs.map → chunk-WLDYBSOG.mjs.map} +0 -0
  411. /package/dist/esm/{chunk-HEAWDTLG.mjs.map → chunk-XRVZAEQO.mjs.map} +0 -0
  412. /package/dist/esm/{chunk-DNWFDS7F.mjs.map → chunk-XW3BXTCZ.mjs.map} +0 -0
  413. /package/dist/esm/{chunk-L2AQG3G3.mjs.map → chunk-Y65PKZLK.mjs.map} +0 -0
  414. /package/dist/esm/{chunk-WXDA4CCR.mjs.map → chunk-YAGIE4GN.mjs.map} +0 -0
  415. /package/dist/esm/{chunk-CRFLR3ZY.mjs.map → chunk-YLUULY6G.mjs.map} +0 -0
  416. /package/dist/esm/{chunk-SCBYJU6K.mjs.map → chunk-YWSDONJJ.mjs.map} +0 -0
  417. /package/dist/esm/{chunk-BYHCW7MI.mjs.map → chunk-YXYYII5S.mjs.map} +0 -0
  418. /package/dist/esm/{chunk-XTOIL6MB.mjs.map → chunk-ZD2TY5N3.mjs.map} +0 -0
  419. /package/dist/esm/{chunk-5BSMF22B.mjs.map → chunk-ZS2IVRHT.mjs.map} +0 -0
@@ -15,6 +15,7 @@ import { AptosApiError } from "../errors";
15
15
  * @param options.method - The HTTP method to use for the request.
16
16
  * @param options.body - The body of the request.
17
17
  * @param options.contentType - The content type of the request.
18
+ * @param options.acceptType - The accept type of the request.
18
19
  * @param options.params - The query parameters to include in the request.
19
20
  * @param options.overrides - Additional overrides for the request.
20
21
  * @param options.overrides.HEADERS - Custom headers to include in the request.
@@ -57,6 +58,62 @@ export async function request<Req, Res>(options: ClientRequest<Req>, client: Cli
57
58
  });
58
59
  }
59
60
 
61
+ /**
62
+ * Sends a request using the specified options and returns the response.
63
+ *
64
+ * @param options - The options for the request.
65
+ * @param options.url - The URL to send the request to.
66
+ * @param options.method - The HTTP method to use for the request.
67
+ * @param options.body - The body of the request.
68
+ * @param options.contentType - The content type of the request.
69
+ * @param options.acceptType - The accept type of the request.
70
+ * @param options.params - The query parameters to include in the request.
71
+ * @param options.overrides - Additional overrides for the request.
72
+ * @param options.overrides.HEADERS - Custom headers to include in the request.
73
+ * @param options.overrides.AUTH_TOKEN - The authorization token for the request.
74
+ * @param options.overrides.API_KEY - The API key for the request.
75
+ * @param options.originMethod - The origin method for the request.
76
+ * @param client - The client used to make the request.
77
+ *
78
+ * @returns The response from the request.
79
+ * @group Implementation
80
+ * @category Client
81
+ */
82
+ export async function binaryRequest<Req>(options: ClientRequest<Req>, client: Client): Promise<ClientResponse<Buffer>> {
83
+ if (client.binaryProvider === undefined) {
84
+ throw new Error("Binary provider is not provided");
85
+ }
86
+ const { url, method, body, contentType, acceptType, params, overrides, originMethod } = options;
87
+ const headers: Record<string, string | AnyNumber | boolean | undefined> = {
88
+ ...overrides?.HEADERS,
89
+ "x-aptos-client": `aptos-typescript-sdk/${VERSION}`,
90
+ "content-type": contentType ?? MimeType.JSON,
91
+ accept: acceptType ?? MimeType.BCS,
92
+ "x-aptos-typescript-sdk-origin-method": originMethod,
93
+ };
94
+
95
+ if (overrides?.AUTH_TOKEN) {
96
+ headers.Authorization = `Bearer ${overrides?.AUTH_TOKEN}`;
97
+ }
98
+ if (overrides?.API_KEY) {
99
+ headers.Authorization = `Bearer ${overrides?.API_KEY}`;
100
+ }
101
+
102
+ /*
103
+ * make a call using the @aptos-labs/aptos-client package
104
+ * {@link https://www.npmjs.com/package/@aptos-labs/aptos-client}
105
+ */
106
+ return client.binaryProvider<Req>({
107
+ acceptType: MimeType.BCS,
108
+ url,
109
+ method,
110
+ body,
111
+ params,
112
+ headers,
113
+ overrides,
114
+ });
115
+ }
116
+
60
117
  /**
61
118
  * The main function to use when making an API request, returning the response or throwing an AptosApiError on failure.
62
119
  *
@@ -118,3 +175,66 @@ export async function aptosRequest<Req extends {}, Res extends {}>(
118
175
  // comes from an indexer request (e.g. 404), we'll need to mention it appropriately
119
176
  throw new AptosApiError({ apiType, aptosRequest: aptosRequestOpts, aptosResponse });
120
177
  }
178
+
179
+ /**
180
+ * The main function to use when making an API request, returning the response or throwing an AptosApiError on failure.
181
+ *
182
+ * @param aptosRequestOpts - Options for the Aptos request, including the URL and path.
183
+ * @param aptosConfig - The configuration information for the SDK client instance.
184
+ * @param apiType - The type of API being accessed, which determines how the response is handled.
185
+ * @returns The response from the API request or throws an AptosApiError if the request fails.
186
+ * @group Implementation
187
+ * @category Client
188
+ * @experimental
189
+ */
190
+ export async function aptosBinaryRequest<Req extends {}>(
191
+ aptosRequestOpts: AptosRequest,
192
+ aptosConfig: AptosConfig,
193
+ apiType: AptosApiType,
194
+ ): Promise<AptosResponse<Req, Buffer>> {
195
+ const { url, path } = aptosRequestOpts;
196
+ const fullUrl = path ? `${url}/${path}` : url;
197
+ const clientResponse = await binaryRequest<Req>({ ...aptosRequestOpts, url: fullUrl }, aptosConfig.client);
198
+
199
+ const aptosResponse: AptosResponse<Req, Buffer> = {
200
+ status: clientResponse.status,
201
+ statusText: clientResponse.statusText ?? "No status text provided",
202
+ data: clientResponse.data,
203
+ headers: clientResponse.headers,
204
+ config: clientResponse.config,
205
+ request: clientResponse.request,
206
+ url: fullUrl,
207
+ };
208
+
209
+ // Handle case for `Unauthorized` error (i.e. API_KEY error)
210
+ if (aptosResponse.status === 401) {
211
+ throw new AptosApiError({ apiType, aptosRequest: aptosRequestOpts, aptosResponse });
212
+ }
213
+
214
+ // to support both fullnode and indexer responses,
215
+ // check if it is an indexer query, and adjust response.data
216
+ if (apiType === AptosApiType.INDEXER) {
217
+ const indexerResponse = aptosResponse.data as any;
218
+ // Handle Indexer general errors
219
+ if (indexerResponse.errors) {
220
+ throw new AptosApiError({
221
+ apiType,
222
+ aptosRequest: aptosRequestOpts,
223
+ aptosResponse,
224
+ });
225
+ }
226
+ aptosResponse.data = indexerResponse.data as Buffer;
227
+ } else if (apiType === AptosApiType.PEPPER || apiType === AptosApiType.PROVER) {
228
+ if (aptosResponse.status >= 400) {
229
+ throw new AptosApiError({ apiType, aptosRequest: aptosRequestOpts, aptosResponse });
230
+ }
231
+ }
232
+
233
+ if (aptosResponse.status >= 200 && aptosResponse.status < 300) {
234
+ return aptosResponse;
235
+ }
236
+
237
+ // We have to explicitly check for all request types, because if the error is a non-indexer error, but
238
+ // comes from an indexer request (e.g. 404), we'll need to mention it appropriately
239
+ throw new AptosApiError({ apiType, aptosRequest: aptosRequestOpts, aptosResponse });
240
+ }
package/src/client/get.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AptosConfig } from "../api/aptosConfig";
2
- import { aptosRequest } from "./core";
2
+ import { aptosBinaryRequest, aptosRequest } from "./core";
3
3
  import { AptosResponse, AnyNumber, ClientConfig, MimeType } from "../types";
4
4
  import { AptosApiType } from "../utils/const";
5
5
 
@@ -107,6 +107,46 @@ export async function get<Req extends {}, Res extends {}>(
107
107
  );
108
108
  }
109
109
 
110
+ /**
111
+ * Executes a GET request to retrieve data based on the provided options.
112
+ *
113
+ * @param options - The options for the GET request.
114
+ * @param options.aptosConfig - The configuration object for Aptos requests.
115
+ * @param options.overrides - Optional overrides for the request configuration.
116
+ * @param options.params - Query parameters to include in the request.
117
+ * @param options.contentType - The content type of the request.
118
+ * @param options.acceptType - The accepted response type.
119
+ * @param options.path - The specific path for the request.
120
+ * @param options.originMethod - The original method of the request.
121
+ * @param options.type - The type of request being made.
122
+ * @returns The response from the GET request.
123
+ * @group Implementation
124
+ * @category Client
125
+ * @experimental
126
+ */
127
+ export async function getBinary<Req extends {}>(options: GetRequestOptions): Promise<AptosResponse<Req, Buffer>> {
128
+ const { aptosConfig, overrides, params, contentType, acceptType, path, originMethod, type } = options;
129
+ const url = aptosConfig.getRequestUrl(type);
130
+
131
+ return aptosBinaryRequest<Req>(
132
+ {
133
+ url,
134
+ method: "GET",
135
+ originMethod,
136
+ path,
137
+ contentType,
138
+ acceptType,
139
+ params,
140
+ overrides: {
141
+ ...aptosConfig.clientConfig,
142
+ ...overrides,
143
+ },
144
+ },
145
+ aptosConfig,
146
+ options.type,
147
+ );
148
+ }
149
+
110
150
  /**
111
151
  * Retrieves data from the Aptos full node using the provided options.
112
152
  *
@@ -138,6 +178,38 @@ export async function getAptosFullNode<Req extends {}, Res extends {}>(
138
178
  });
139
179
  }
140
180
 
181
+ /**
182
+ * Retrieves data from the Aptos full node using the provided options.
183
+ *
184
+ * @param options - The options for the request to the Aptos full node.
185
+ * @param options.aptosConfig - Configuration settings specific to the Aptos client and full node.
186
+ * @param options.aptosConfig.clientConfig - The client configuration settings.
187
+ * @param options.aptosConfig.fullnodeConfig - The full node configuration settings.
188
+ * @param options.overrides - Additional overrides for the request.
189
+ * @param options.type - The type of API request being made.
190
+ *
191
+ * @returns A promise that resolves with the response from the Aptos full node.
192
+ * @group Implementation
193
+ * @category Client
194
+ * @experimental
195
+ */
196
+ export async function getBinaryAptosFullNode<Req extends {}>(
197
+ options: GetAptosRequestOptions,
198
+ ): Promise<AptosResponse<Req, Buffer>> {
199
+ const { aptosConfig } = options;
200
+
201
+ return getBinary<Req>({
202
+ ...options,
203
+ type: AptosApiType.FULLNODE,
204
+ overrides: {
205
+ ...aptosConfig.clientConfig,
206
+ ...aptosConfig.fullnodeConfig,
207
+ ...options.overrides,
208
+ HEADERS: { ...aptosConfig.clientConfig?.HEADERS, ...aptosConfig.fullnodeConfig?.HEADERS },
209
+ },
210
+ });
211
+ }
212
+
141
213
  /**
142
214
  * Makes a GET request to the Aptos Pepper service to retrieve data.
143
215
  *
@@ -2,7 +2,7 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  import { AptosConfig } from "../api/aptosConfig";
5
- import { aptosRequest } from "./core";
5
+ import { aptosBinaryRequest, aptosRequest } from "./core";
6
6
  import { AptosResponse, AnyNumber, ClientConfig, MimeType } from "../types";
7
7
  import { AptosApiType } from "../utils/const";
8
8
 
@@ -115,6 +115,45 @@ export async function post<Req extends {}, Res extends {}>(
115
115
  );
116
116
  }
117
117
 
118
+ /**
119
+ * Executes a POST request to the specified URL with the provided options.
120
+ *
121
+ * @param options - The options for the POST request.
122
+ * @param options.type - The type of the request.
123
+ * @param options.originMethod - The original method that initiated the request.
124
+ * @param options.path - The path for the request.
125
+ * @param options.body - The body content to be sent with the request.
126
+ * @param options.acceptType - The type of response expected from the server.
127
+ * @param options.contentType - The content type of the request body.
128
+ * @param options.params - Additional parameters to include in the request.
129
+ * @param options.aptosConfig - Configuration settings for the Aptos request.
130
+ * @param options.overrides - Any overrides for the default request behavior.
131
+ * @returns The response from the POST request.
132
+ * @group Implementation
133
+ * @category Client
134
+ * @experimental
135
+ */
136
+ export async function postBinary<Req extends {}>(options: PostRequestOptions): Promise<AptosResponse<Req, Buffer>> {
137
+ const { type, originMethod, path, body, acceptType, contentType, params, aptosConfig, overrides } = options;
138
+ const url = aptosConfig.getRequestUrl(type);
139
+
140
+ return aptosBinaryRequest<Req>(
141
+ {
142
+ url,
143
+ method: "POST",
144
+ originMethod,
145
+ path,
146
+ body,
147
+ contentType,
148
+ acceptType,
149
+ params,
150
+ overrides,
151
+ },
152
+ aptosConfig,
153
+ options.type,
154
+ );
155
+ }
156
+
118
157
  /**
119
158
  * Sends a request to the Aptos full node using the specified options.
120
159
  * This function allows you to interact with the Aptos blockchain by sending requests to the full node.
@@ -144,6 +183,36 @@ export async function postAptosFullNode<Req extends {}, Res extends {}>(
144
183
  });
145
184
  }
146
185
 
186
+ /**
187
+ * Sends a request to the Aptos full node using the specified options.
188
+ * This function allows you to interact with the Aptos blockchain by sending requests to the full node.
189
+ *
190
+ * @param options - The options for the request.
191
+ * @param options.aptosConfig - Configuration settings for the Aptos client.
192
+ * @param options.aptosConfig.clientConfig - Client-specific configuration settings.
193
+ * @param options.aptosConfig.fullnodeConfig - Full node-specific configuration settings.
194
+ * @param options.overrides - Additional overrides for the request.
195
+ * @group Implementation
196
+ * @category Client
197
+ * @experimental
198
+ */
199
+ export async function postBinaryAptosFullNode<Req extends {}>(
200
+ options: PostAptosRequestOptions,
201
+ ): Promise<AptosResponse<Req, Buffer>> {
202
+ const { aptosConfig } = options;
203
+
204
+ return postBinary<Req>({
205
+ ...options,
206
+ type: AptosApiType.FULLNODE,
207
+ overrides: {
208
+ ...aptosConfig.clientConfig,
209
+ ...aptosConfig.fullnodeConfig,
210
+ ...options.overrides,
211
+ HEADERS: { ...aptosConfig.clientConfig?.HEADERS, ...aptosConfig.fullnodeConfig?.HEADERS },
212
+ },
213
+ });
214
+ }
215
+
147
216
  /**
148
217
  * Sends a request to the Aptos indexer with the specified options.
149
218
  * This function allows you to interact with the Aptos indexer and customize the request using various configurations.
@@ -5,7 +5,8 @@ import { Deserializer, Serializer } from "../../bcs";
5
5
  import { SigningScheme as AuthenticationKeyScheme } from "../../types";
6
6
  import { AuthenticationKey } from "../authenticationKey";
7
7
  import { Ed25519PublicKey, Ed25519Signature } from "./ed25519";
8
- import { AccountPublicKey, VerifySignatureArgs } from "./publicKey";
8
+ import { AbstractMultiKey } from "./multiKey";
9
+ import { VerifySignatureArgs } from "./publicKey";
9
10
  import { Signature } from "./signature";
10
11
 
11
12
  /**
@@ -19,7 +20,7 @@ import { Signature } from "./signature";
19
20
  * @group Implementation
20
21
  * @category Serialization
21
22
  */
22
- export class MultiEd25519PublicKey extends AccountPublicKey {
23
+ export class MultiEd25519PublicKey extends AbstractMultiKey {
23
24
  /**
24
25
  * Maximum number of public keys supported
25
26
  * @group Implementation
@@ -69,8 +70,8 @@ export class MultiEd25519PublicKey extends AccountPublicKey {
69
70
  * @category Serialization
70
71
  */
71
72
  constructor(args: { publicKeys: Ed25519PublicKey[]; threshold: number }) {
72
- super();
73
73
  const { publicKeys, threshold } = args;
74
+ super({ publicKeys });
74
75
 
75
76
  // Validate number of public keys
76
77
  if (publicKeys.length > MultiEd25519PublicKey.MAX_KEYS || publicKeys.length < MultiEd25519PublicKey.MIN_KEYS) {
@@ -209,6 +210,21 @@ export class MultiEd25519PublicKey extends AccountPublicKey {
209
210
  }
210
211
 
211
212
  // endregion
213
+
214
+ /**
215
+ * Get the index of the provided public key.
216
+ *
217
+ * This function retrieves the index of a specified public key within the MultiKey.
218
+ * If the public key does not exist, it throws an error.
219
+ *
220
+ * @param publicKey - The public key to find the index for.
221
+ * @returns The corresponding index of the public key, if it exists.
222
+ * @throws Error - If the public key is not found in the MultiKey.
223
+ * @group Implementation
224
+ */
225
+ getIndex(publicKey: Ed25519PublicKey): number {
226
+ return super.getIndex(publicKey);
227
+ }
212
228
  }
213
229
 
214
230
  /**
@@ -23,6 +23,79 @@ function bitCount(byte: number) {
23
23
  }
24
24
  /* eslint-enable no-bitwise */
25
25
 
26
+ export abstract class AbstractMultiKey extends AccountPublicKey {
27
+ publicKeys: PublicKey[];
28
+
29
+ constructor(args: { publicKeys: PublicKey[] }) {
30
+ super();
31
+ this.publicKeys = args.publicKeys;
32
+ }
33
+
34
+ /**
35
+ * Create a bitmap that holds the mapping from the original public keys
36
+ * to the signatures passed in
37
+ *
38
+ * @param args.bits array of the index mapping to the matching public keys
39
+ * @returns Uint8array bit map
40
+ * @group Implementation
41
+ * @category Serialization
42
+ */
43
+ createBitmap(args: { bits: number[] }): Uint8Array {
44
+ const { bits } = args;
45
+ // Bits are read from left to right. e.g. 0b10000000 represents the first bit is set in one byte.
46
+ // The decimal value of 0b10000000 is 128.
47
+ const firstBitInByte = 128;
48
+ const bitmap = new Uint8Array([0, 0, 0, 0]);
49
+
50
+ // Check if duplicates exist in bits
51
+ const dupCheckSet = new Set();
52
+
53
+ bits.forEach((bit: number, idx: number) => {
54
+ if (idx + 1 > this.publicKeys.length) {
55
+ throw new Error(`Signature index ${idx + 1} is out of public keys range, ${this.publicKeys.length}.`);
56
+ }
57
+
58
+ if (dupCheckSet.has(bit)) {
59
+ throw new Error(`Duplicate bit ${bit} detected.`);
60
+ }
61
+
62
+ dupCheckSet.add(bit);
63
+
64
+ const byteOffset = Math.floor(bit / 8);
65
+
66
+ let byte = bitmap[byteOffset];
67
+
68
+ // eslint-disable-next-line no-bitwise
69
+ byte |= firstBitInByte >> bit % 8;
70
+
71
+ bitmap[byteOffset] = byte;
72
+ });
73
+
74
+ return bitmap;
75
+ }
76
+
77
+ /**
78
+ * Get the index of the provided public key.
79
+ *
80
+ * This function retrieves the index of a specified public key within the MultiKey.
81
+ * If the public key does not exist, it throws an error.
82
+ *
83
+ * @param publicKey - The public key to find the index for.
84
+ * @returns The corresponding index of the public key, if it exists.
85
+ * @throws Error - If the public key is not found in the MultiKey.
86
+ * @group Implementation
87
+ * @category Serialization
88
+ */
89
+ getIndex(publicKey: PublicKey): number {
90
+ const index = this.publicKeys.findIndex((pk) => pk.toString() === publicKey.toString());
91
+
92
+ if (index !== -1) {
93
+ return index;
94
+ }
95
+ throw new Error(`Public key ${publicKey} not found in multi key set ${this.publicKeys}`);
96
+ }
97
+ }
98
+
26
99
  /**
27
100
  * Represents a multi-key authentication scheme for accounts, allowing multiple public keys
28
101
  * to be associated with a single account. This class enforces a minimum number of valid signatures
@@ -34,7 +107,7 @@ function bitCount(byte: number) {
34
107
  * @group Implementation
35
108
  * @category Serialization
36
109
  */
37
- export class MultiKey extends AccountPublicKey {
110
+ export class MultiKey extends AbstractMultiKey {
38
111
  /**
39
112
  * List of any public keys
40
113
  * @group Implementation
@@ -65,8 +138,8 @@ export class MultiKey extends AccountPublicKey {
65
138
  */
66
139
  // region Constructors
67
140
  constructor(args: { publicKeys: Array<PublicKey>; signaturesRequired: number }) {
68
- super();
69
141
  const { publicKeys, signaturesRequired } = args;
142
+ super({ publicKeys });
70
143
 
71
144
  // Validate number of public keys is greater than signature required
72
145
  if (signaturesRequired < 1) {
@@ -156,49 +229,6 @@ export class MultiKey extends AccountPublicKey {
156
229
 
157
230
  // endregion
158
231
 
159
- /**
160
- * Create a bitmap that holds the mapping from the original public keys
161
- * to the signatures passed in
162
- *
163
- * @param args.bits array of the index mapping to the matching public keys
164
- * @returns Uint8array bit map
165
- * @group Implementation
166
- * @category Serialization
167
- */
168
- createBitmap(args: { bits: number[] }): Uint8Array {
169
- const { bits } = args;
170
- // Bits are read from left to right. e.g. 0b10000000 represents the first bit is set in one byte.
171
- // The decimal value of 0b10000000 is 128.
172
- const firstBitInByte = 128;
173
- const bitmap = new Uint8Array([0, 0, 0, 0]);
174
-
175
- // Check if duplicates exist in bits
176
- const dupCheckSet = new Set();
177
-
178
- bits.forEach((bit: number, idx: number) => {
179
- if (idx + 1 > this.publicKeys.length) {
180
- throw new Error(`Signature index ${idx + 1} is out of public keys range, ${this.publicKeys.length}.`);
181
- }
182
-
183
- if (dupCheckSet.has(bit)) {
184
- throw new Error(`Duplicate bit ${bit} detected.`);
185
- }
186
-
187
- dupCheckSet.add(bit);
188
-
189
- const byteOffset = Math.floor(bit / 8);
190
-
191
- let byte = bitmap[byteOffset];
192
-
193
- // eslint-disable-next-line no-bitwise
194
- byte |= firstBitInByte >> bit % 8;
195
-
196
- bitmap[byteOffset] = byte;
197
- });
198
-
199
- return bitmap;
200
- }
201
-
202
232
  /**
203
233
  * Get the index of the provided public key.
204
234
  *
@@ -209,16 +239,10 @@ export class MultiKey extends AccountPublicKey {
209
239
  * @returns The corresponding index of the public key, if it exists.
210
240
  * @throws Error - If the public key is not found in the MultiKey.
211
241
  * @group Implementation
212
- * @category Serialization
213
242
  */
214
243
  getIndex(publicKey: PublicKey): number {
215
244
  const anyPublicKey = publicKey instanceof AnyPublicKey ? publicKey : new AnyPublicKey(publicKey);
216
- const index = this.publicKeys.findIndex((pk) => pk.toString() === anyPublicKey.toString());
217
-
218
- if (index !== -1) {
219
- return index;
220
- }
221
- throw new Error(`Public key ${publicKey} not found in MultiKey ${this.publicKeys}`);
245
+ return super.getIndex(anyPublicKey);
222
246
  }
223
247
 
224
248
  public static isInstance(value: PublicKey): value is MultiKey {
package/src/core/hex.ts CHANGED
@@ -146,8 +146,10 @@ export class Hex {
146
146
  * @category Serialization
147
147
  */
148
148
  static fromHexInput(hexInput: HexInput): Hex {
149
+ if (hexInput instanceof Buffer) return new Hex(new Uint8Array(hexInput));
149
150
  if (hexInput instanceof Uint8Array) return new Hex(hexInput);
150
- return Hex.fromHexString(hexInput);
151
+ if (typeof hexInput === "string") return Hex.fromHexString(hexInput);
152
+ throw new Error(`Invalid hex input type: ${typeof hexInput}`);
151
153
  }
152
154
 
153
155
  /**
@@ -0,0 +1,55 @@
1
+ import { AptosConfig } from "../api/aptosConfig";
2
+ import { generateViewFunctionPayload, InputViewFunctionData } from "../transactions";
3
+ import { LedgerVersionArg, MimeType } from "../types";
4
+ import { Serializer } from "../bcs";
5
+ import { postBinaryAptosFullNode } from "../client";
6
+
7
+ export async function viewBinary(args: {
8
+ aptosConfig: AptosConfig;
9
+ payload: InputViewFunctionData;
10
+ options?: LedgerVersionArg & { convert?: undefined };
11
+ }): Promise<Uint8Array>;
12
+
13
+ export async function viewBinary<T extends {}>(args: {
14
+ aptosConfig: AptosConfig;
15
+ payload: InputViewFunctionData;
16
+ options?: LedgerVersionArg & { convert?: (input: Uint8Array) => T };
17
+ }): Promise<T>;
18
+
19
+ /**
20
+ * Reads a binary view function, and converts into the appropriate type if a converter is provided.
21
+ * @experimental
22
+ * @param args
23
+ */
24
+ export async function viewBinary<T extends {} = Uint8Array>(args: {
25
+ aptosConfig: AptosConfig;
26
+ payload: InputViewFunctionData;
27
+ options?: LedgerVersionArg & { convert?: (input: Uint8Array) => T };
28
+ }): Promise<Uint8Array | T> {
29
+ const { aptosConfig, payload, options } = args;
30
+ const viewFunctionPayload = await generateViewFunctionPayload({
31
+ ...payload,
32
+ aptosConfig,
33
+ });
34
+
35
+ const serializer = new Serializer();
36
+ viewFunctionPayload.serialize(serializer);
37
+ const bytes = serializer.toUint8Array();
38
+
39
+ const { data } = await postBinaryAptosFullNode<Uint8Array>({
40
+ aptosConfig,
41
+ path: "view",
42
+ originMethod: "view",
43
+ contentType: MimeType.BCS_VIEW_FUNCTION,
44
+ acceptType: MimeType.BCS,
45
+ params: { ledger_version: options?.ledgerVersion },
46
+ body: bytes,
47
+ });
48
+
49
+ const array = new Uint8Array(data);
50
+ if (options?.convert) {
51
+ return options.convert(array);
52
+ }
53
+
54
+ return array;
55
+ }
@@ -27,7 +27,7 @@ export async function view<T extends Array<MoveValue> = Array<MoveValue>>(args:
27
27
  viewFunctionPayload.serialize(serializer);
28
28
  const bytes = serializer.toUint8Array();
29
29
 
30
- const { data } = await postAptosFullNode<Uint8Array, MoveValue[]>({
30
+ const { data } = await postAptosFullNode<Uint8Array, T>({
31
31
  aptosConfig,
32
32
  path: "view",
33
33
  originMethod: "view",
@@ -36,7 +36,7 @@ export async function view<T extends Array<MoveValue> = Array<MoveValue>>(args:
36
36
  body: bytes,
37
37
  });
38
38
 
39
- return data as T;
39
+ return data;
40
40
  }
41
41
 
42
42
  export async function viewJson<T extends Array<MoveValue> = Array<MoveValue>>(args: {
@@ -45,7 +45,7 @@ export async function viewJson<T extends Array<MoveValue> = Array<MoveValue>>(ar
45
45
  options?: LedgerVersionArg;
46
46
  }): Promise<T> {
47
47
  const { aptosConfig, payload, options } = args;
48
- const { data } = await postAptosFullNode<ViewFunctionJsonPayload, MoveValue[]>({
48
+ const { data } = await postAptosFullNode<ViewFunctionJsonPayload, T>({
49
49
  aptosConfig,
50
50
  originMethod: "viewJson",
51
51
  path: "view",
@@ -57,5 +57,5 @@ export async function viewJson<T extends Array<MoveValue> = Array<MoveValue>>(ar
57
57
  },
58
58
  });
59
59
 
60
- return data as T;
60
+ return data;
61
61
  }
@@ -29,6 +29,7 @@ import { normalizeBundle } from "../../utils/normalizeBundle";
29
29
  import {
30
30
  AccountAuthenticator,
31
31
  AccountAuthenticatorEd25519,
32
+ AccountAuthenticatorMultiEd25519,
32
33
  AccountAuthenticatorMultiKey,
33
34
  AccountAuthenticatorNoAccountAuthenticator,
34
35
  AccountAuthenticatorSingleKey,
@@ -38,6 +39,7 @@ import {
38
39
  TransactionAuthenticatorEd25519,
39
40
  TransactionAuthenticatorFeePayer,
40
41
  TransactionAuthenticatorMultiAgent,
42
+ TransactionAuthenticatorMultiEd25519,
41
43
  TransactionAuthenticatorSingleSender,
42
44
  } from "../authenticator/transaction";
43
45
  import {
@@ -700,6 +702,11 @@ export function generateSignedTransaction(args: InputSubmitTransactionData): Uin
700
702
  senderAuthenticator.public_key,
701
703
  senderAuthenticator.signature,
702
704
  );
705
+ } else if (senderAuthenticator instanceof AccountAuthenticatorMultiEd25519) {
706
+ txnAuthenticator = new TransactionAuthenticatorMultiEd25519(
707
+ senderAuthenticator.public_key,
708
+ senderAuthenticator.signature,
709
+ );
703
710
  } else {
704
711
  txnAuthenticator = new TransactionAuthenticatorSingleSender(senderAuthenticator);
705
712
  }