@aptos-labs/ts-sdk 1.16.0 → 1.17.0-zeta.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 (501) hide show
  1. package/dist/common/{accountAddress-ccLvlUQe.d.ts → accountAddress-jP2Ua0t9.d.ts} +97 -5
  2. package/dist/common/chunk-BHKSQXUZ.js +2 -0
  3. package/dist/common/chunk-BHKSQXUZ.js.map +1 -0
  4. package/dist/common/cli/index.d.ts +1 -1
  5. package/dist/common/cli/index.js +1 -1
  6. package/dist/common/index.d.ts +862 -122
  7. package/dist/common/index.js +28 -28
  8. package/dist/common/index.js.map +1 -1
  9. package/dist/esm/{Ed25519Account-B1VMJOY2.d.mts → Ed25519Account-9zBaZEnp.d.mts} +1 -1
  10. package/dist/esm/account/Account.d.mts +2 -2
  11. package/dist/esm/account/Account.mjs +1 -1
  12. package/dist/esm/account/Ed25519Account.d.mts +2 -2
  13. package/dist/esm/account/Ed25519Account.mjs +1 -1
  14. package/dist/esm/account/EphemeralKeyPair.d.mts +90 -0
  15. package/dist/esm/account/EphemeralKeyPair.mjs +2 -0
  16. package/dist/esm/account/KeylessAccount.d.mts +211 -0
  17. package/dist/esm/account/KeylessAccount.mjs +2 -0
  18. package/dist/esm/account/MultiKeyAccount.d.mts +13 -7
  19. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  20. package/dist/esm/account/SingleKeyAccount.d.mts +2 -2
  21. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  22. package/dist/esm/account/index.d.mts +9 -2
  23. package/dist/esm/account/index.mjs +1 -1
  24. package/dist/esm/api/account.d.mts +4 -4
  25. package/dist/esm/api/account.mjs +1 -1
  26. package/dist/esm/api/ans.d.mts +4 -4
  27. package/dist/esm/api/ans.mjs +1 -1
  28. package/dist/esm/api/aptos.d.mts +12 -3
  29. package/dist/esm/api/aptos.mjs +1 -1
  30. package/dist/esm/api/aptosConfig.d.mts +20 -0
  31. package/dist/esm/api/aptosConfig.mjs +1 -1
  32. package/dist/esm/api/coin.d.mts +5 -5
  33. package/dist/esm/api/coin.mjs +1 -1
  34. package/dist/esm/api/digitalAsset.d.mts +6 -6
  35. package/dist/esm/api/digitalAsset.mjs +1 -1
  36. package/dist/esm/api/event.d.mts +1 -1
  37. package/dist/esm/api/event.mjs +1 -1
  38. package/dist/esm/api/faucet.mjs +1 -1
  39. package/dist/esm/api/fungibleAsset.d.mts +3 -3
  40. package/dist/esm/api/fungibleAsset.mjs +1 -1
  41. package/dist/esm/api/general.d.mts +3 -3
  42. package/dist/esm/api/general.mjs +1 -1
  43. package/dist/esm/api/index.d.mts +10 -2
  44. package/dist/esm/api/index.mjs +1 -1
  45. package/dist/esm/api/keyless.d.mts +85 -0
  46. package/dist/esm/api/keyless.mjs +2 -0
  47. package/dist/esm/api/keyless.mjs.map +1 -0
  48. package/dist/esm/api/staking.d.mts +2 -2
  49. package/dist/esm/api/staking.mjs +1 -1
  50. package/dist/esm/api/table.d.mts +1 -1
  51. package/dist/esm/api/table.mjs +1 -1
  52. package/dist/esm/api/transaction.d.mts +3 -3
  53. package/dist/esm/api/transaction.mjs +1 -1
  54. package/dist/esm/api/transactionSubmission/build.d.mts +3 -3
  55. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  56. package/dist/esm/api/transactionSubmission/management.d.mts +2 -2
  57. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  58. package/dist/esm/api/transactionSubmission/sign.d.mts +4 -4
  59. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  60. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  61. package/dist/esm/api/transactionSubmission/simulate.d.mts +3 -3
  62. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  63. package/dist/esm/api/transactionSubmission/submit.d.mts +3 -3
  64. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  65. package/dist/esm/api/utils.mjs +1 -1
  66. package/dist/esm/bcs/deserializer.d.mts +32 -0
  67. package/dist/esm/bcs/deserializer.mjs +1 -1
  68. package/dist/esm/bcs/index.mjs +1 -1
  69. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  70. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  71. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  72. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  73. package/dist/esm/bcs/serializer.d.mts +42 -0
  74. package/dist/esm/bcs/serializer.mjs +1 -1
  75. package/dist/esm/chunk-2G4IGSGM.mjs +2 -0
  76. package/dist/esm/{chunk-XHEZAVN3.mjs.map → chunk-2G4IGSGM.mjs.map} +1 -1
  77. package/dist/esm/chunk-37FFZSIM.mjs +2 -0
  78. package/dist/esm/chunk-37FFZSIM.mjs.map +1 -0
  79. package/dist/esm/chunk-3IFR6T3V.mjs +2 -0
  80. package/dist/esm/chunk-3IFR6T3V.mjs.map +1 -0
  81. package/dist/esm/chunk-3RJZNUCQ.mjs +2 -0
  82. package/dist/esm/chunk-3SACE4I2.mjs +2 -0
  83. package/dist/esm/{chunk-T2WZWN6W.mjs.map → chunk-3SACE4I2.mjs.map} +1 -1
  84. package/dist/esm/chunk-472OGHMG.mjs +2 -0
  85. package/dist/esm/chunk-4BJA3QUQ.mjs +2 -0
  86. package/dist/esm/{chunk-NYXLPBKE.mjs.map → chunk-4BJA3QUQ.mjs.map} +1 -1
  87. package/dist/esm/chunk-4CUDBBTC.mjs +2 -0
  88. package/dist/esm/chunk-4CUDBBTC.mjs.map +1 -0
  89. package/dist/esm/chunk-4VPCPASN.mjs +2 -0
  90. package/dist/esm/chunk-54LCK6EN.mjs +2 -0
  91. package/dist/esm/chunk-54LCK6EN.mjs.map +1 -0
  92. package/dist/esm/{chunk-OLKEU7WZ.mjs → chunk-5WFKJO5L.mjs} +2 -2
  93. package/dist/esm/{chunk-HZ3YB6TN.mjs → chunk-64CUEMFI.mjs} +2 -2
  94. package/dist/esm/{chunk-LM7CN4LT.mjs → chunk-64VPA7CM.mjs} +2 -2
  95. package/dist/esm/{chunk-GHYE26Q5.mjs → chunk-6FBKUTGF.mjs} +2 -2
  96. package/dist/esm/chunk-7BW2N4IE.mjs +2 -0
  97. package/dist/esm/{chunk-UF5B4XMN.mjs → chunk-7G3RSOWE.mjs} +2 -2
  98. package/dist/esm/{chunk-AKJZL3HT.mjs → chunk-7M4C4OZN.mjs} +2 -2
  99. package/dist/esm/{chunk-DO444YYD.mjs → chunk-7UKBRLGM.mjs} +2 -2
  100. package/dist/esm/chunk-7Z6DYLCA.mjs +1 -0
  101. package/dist/esm/chunk-7Z6DYLCA.mjs.map +1 -0
  102. package/dist/esm/{chunk-BCUSI3N6.mjs → chunk-AOCNYMMX.mjs} +2 -2
  103. package/dist/esm/chunk-AQ4I7VVB.mjs +1 -0
  104. package/dist/esm/chunk-AQ4I7VVB.mjs.map +1 -0
  105. package/dist/esm/{chunk-YMHX6GC2.mjs → chunk-B2RYTKNN.mjs} +2 -2
  106. package/dist/esm/chunk-BCZGONNO.mjs +2 -0
  107. package/dist/esm/chunk-BCZGONNO.mjs.map +1 -0
  108. package/dist/esm/chunk-BLWJZXAD.mjs +2 -0
  109. package/dist/esm/chunk-BLWJZXAD.mjs.map +1 -0
  110. package/dist/esm/{chunk-JWTZDA6A.mjs → chunk-BO44HPGU.mjs} +2 -2
  111. package/dist/esm/{chunk-DPWXEJP6.mjs → chunk-BT6IM25V.mjs} +2 -2
  112. package/dist/esm/chunk-CPDSBH23.mjs +2 -0
  113. package/dist/esm/chunk-CPDSBH23.mjs.map +1 -0
  114. package/dist/esm/chunk-DJPYZIJY.mjs +2 -0
  115. package/dist/esm/chunk-DJPYZIJY.mjs.map +1 -0
  116. package/dist/esm/{chunk-JNDRFTEA.mjs → chunk-DPWEHSHH.mjs} +2 -2
  117. package/dist/esm/{chunk-WNVUG2UF.mjs → chunk-EFMAZTIM.mjs} +2 -2
  118. package/dist/esm/chunk-EHL3WIK3.mjs +2 -0
  119. package/dist/esm/chunk-EHL3WIK3.mjs.map +1 -0
  120. package/dist/esm/{chunk-UEI62FBQ.mjs → chunk-F3ZVWLDH.mjs} +2 -2
  121. package/dist/esm/{chunk-UEI62FBQ.mjs.map → chunk-F3ZVWLDH.mjs.map} +1 -1
  122. package/dist/esm/chunk-FBPNHF54.mjs +2 -0
  123. package/dist/esm/{chunk-YJIRT3GJ.mjs → chunk-FGGRPEQ3.mjs} +2 -2
  124. package/dist/esm/chunk-FIG65OJD.mjs +2 -0
  125. package/dist/esm/{chunk-ISIUQQMV.mjs → chunk-FNFQA7NS.mjs} +2 -2
  126. package/dist/esm/{chunk-XXBMHWNV.mjs → chunk-FR6UGCOX.mjs} +2 -2
  127. package/dist/esm/chunk-FR6UGCOX.mjs.map +1 -0
  128. package/dist/esm/{chunk-HMTYASEZ.mjs → chunk-FSO54CI4.mjs} +2 -2
  129. package/dist/esm/{chunk-DBC2JY65.mjs → chunk-GBQU2OCK.mjs} +2 -2
  130. package/dist/esm/{chunk-FW6TF3O2.mjs → chunk-GPWSPT44.mjs} +2 -2
  131. package/dist/esm/{chunk-QKV2H27T.mjs → chunk-GQC73XWZ.mjs} +2 -2
  132. package/dist/esm/chunk-GRHLQDHF.mjs +2 -0
  133. package/dist/esm/chunk-GSCM444Z.mjs +2 -0
  134. package/dist/esm/{chunk-VJL6AF64.mjs → chunk-HGJMVOBH.mjs} +2 -2
  135. package/dist/esm/chunk-HP6YVTTT.mjs +2 -0
  136. package/dist/esm/{chunk-LGOZUIGE.mjs.map → chunk-HP6YVTTT.mjs.map} +1 -1
  137. package/dist/esm/{chunk-MEXWNZY6.mjs → chunk-HXYZECGS.mjs} +2 -2
  138. package/dist/esm/chunk-IBDBKQMF.mjs +2 -0
  139. package/dist/esm/chunk-IBDBKQMF.mjs.map +1 -0
  140. package/dist/esm/chunk-IBN7ETCB.mjs +2 -0
  141. package/dist/esm/{chunk-5NSXEM3O.mjs.map → chunk-IBN7ETCB.mjs.map} +1 -1
  142. package/dist/esm/{chunk-LKVJZTBM.mjs → chunk-IPFITPKC.mjs} +2 -2
  143. package/dist/esm/chunk-IPFITPKC.mjs.map +1 -0
  144. package/dist/esm/chunk-IT7YNITU.mjs +2 -0
  145. package/dist/esm/chunk-IVVWQKCF.mjs +2 -0
  146. package/dist/esm/chunk-IVVWQKCF.mjs.map +1 -0
  147. package/dist/esm/{chunk-TZCETTAW.mjs → chunk-IXFYYWAC.mjs} +2 -2
  148. package/dist/esm/chunk-J3DCBYOY.mjs +2 -0
  149. package/dist/esm/chunk-J3DCBYOY.mjs.map +1 -0
  150. package/dist/esm/{chunk-OOH7MH2H.mjs → chunk-JZOTXY77.mjs} +2 -2
  151. package/dist/esm/chunk-L5CPAOUM.mjs +2 -0
  152. package/dist/esm/chunk-L5CPAOUM.mjs.map +1 -0
  153. package/dist/esm/{chunk-FLUCRNGU.mjs → chunk-L5ZHZWHI.mjs} +2 -2
  154. package/dist/esm/chunk-LDQJ5S77.mjs +2 -0
  155. package/dist/esm/chunk-LDQJ5S77.mjs.map +1 -0
  156. package/dist/esm/{chunk-YTJ73ZX3.mjs → chunk-LIT6V2A6.mjs} +2 -2
  157. package/dist/esm/{chunk-S5AGI7RQ.mjs → chunk-MLX6DFMR.mjs} +2 -2
  158. package/dist/esm/chunk-MNTLX37G.mjs +2 -0
  159. package/dist/esm/chunk-MNTLX37G.mjs.map +1 -0
  160. package/dist/esm/chunk-NMD45OTM.mjs +2 -0
  161. package/dist/esm/chunk-NMD45OTM.mjs.map +1 -0
  162. package/dist/esm/chunk-NW3WUTTD.mjs +2 -0
  163. package/dist/esm/{chunk-BCLP2ENK.mjs → chunk-O7VXANBW.mjs} +2 -2
  164. package/dist/esm/chunk-Q6LFIZ3L.mjs +2 -0
  165. package/dist/esm/chunk-Q6LFIZ3L.mjs.map +1 -0
  166. package/dist/esm/{chunk-43HKFNUB.mjs → chunk-QFVQSFBZ.mjs} +2 -2
  167. package/dist/esm/chunk-QSMVCD52.mjs +2 -0
  168. package/dist/esm/chunk-QSMVCD52.mjs.map +1 -0
  169. package/dist/esm/chunk-R2TZZVTU.mjs +2 -0
  170. package/dist/esm/chunk-R2TZZVTU.mjs.map +1 -0
  171. package/dist/esm/{chunk-V367QLY3.mjs → chunk-S5ABQH5R.mjs} +2 -2
  172. package/dist/esm/chunk-SCHZ67F3.mjs +2 -0
  173. package/dist/esm/chunk-SCHZ67F3.mjs.map +1 -0
  174. package/dist/esm/{chunk-AR3GW64L.mjs → chunk-SNDFJWYM.mjs} +2 -2
  175. package/dist/esm/{chunk-TAVPFLW5.mjs → chunk-SYRND55P.mjs} +2 -2
  176. package/dist/esm/{chunk-JHBMHOSV.mjs → chunk-T5YEMU53.mjs} +2 -2
  177. package/dist/esm/chunk-TJDC5PWD.mjs +2 -0
  178. package/dist/esm/{chunk-LF6IQT54.mjs → chunk-TUCCV62K.mjs} +2 -2
  179. package/dist/esm/chunk-U3S4AX6K.mjs +2 -0
  180. package/dist/esm/chunk-U3S4AX6K.mjs.map +1 -0
  181. package/dist/esm/chunk-U5F4NL24.mjs +2 -0
  182. package/dist/esm/{chunk-QIELBIZW.mjs → chunk-UHZWZWJ7.mjs} +2 -2
  183. package/dist/esm/{chunk-4KMISR2H.mjs → chunk-UMLUOYFK.mjs} +2 -2
  184. package/dist/esm/{chunk-4KMISR2H.mjs.map → chunk-UMLUOYFK.mjs.map} +1 -1
  185. package/dist/esm/{chunk-LVYNEPH4.mjs → chunk-UVTJEMV4.mjs} +2 -2
  186. package/dist/esm/chunk-VIX4BX35.mjs +2 -0
  187. package/dist/esm/chunk-VIX4BX35.mjs.map +1 -0
  188. package/dist/esm/{chunk-RC6B45PP.mjs → chunk-W63KIXLK.mjs} +2 -2
  189. package/dist/esm/chunk-WA2NTBYY.mjs +2 -0
  190. package/dist/esm/{chunk-X6BYF2UD.mjs → chunk-WIYDJE6F.mjs} +2 -2
  191. package/dist/esm/{chunk-OO5EJW3B.mjs → chunk-X3HGM2KT.mjs} +2 -2
  192. package/dist/esm/{chunk-I3MG3W4J.mjs → chunk-X4X5H6NC.mjs} +2 -2
  193. package/dist/esm/chunk-XH33BXEY.mjs +2 -0
  194. package/dist/esm/chunk-XH33BXEY.mjs.map +1 -0
  195. package/dist/esm/{chunk-CX4BEIQT.mjs → chunk-XVZBWW46.mjs} +2 -2
  196. package/dist/esm/{chunk-6SK246YU.mjs → chunk-YA4XTZNZ.mjs} +2 -2
  197. package/dist/esm/chunk-YD5IB4TH.mjs +2 -0
  198. package/dist/esm/chunk-YD5IB4TH.mjs.map +1 -0
  199. package/dist/esm/{chunk-A7J2UMLS.mjs → chunk-YDNOKWV3.mjs} +2 -2
  200. package/dist/esm/chunk-YE5B2S5L.mjs +2 -0
  201. package/dist/esm/chunk-YE5B2S5L.mjs.map +1 -0
  202. package/dist/esm/{chunk-4D42AAH3.mjs → chunk-YRUF6N3U.mjs} +2 -2
  203. package/dist/esm/chunk-YTQVMLFD.mjs +2 -0
  204. package/dist/esm/chunk-YTQVMLFD.mjs.map +1 -0
  205. package/dist/esm/{chunk-ZMXURV35.mjs → chunk-ZIDLP5MI.mjs} +2 -2
  206. package/dist/esm/{chunk-AWPRGMUP.mjs → chunk-ZV5MKFV7.mjs} +2 -2
  207. package/dist/esm/cli/index.mjs +1 -1
  208. package/dist/esm/cli/localNode.mjs +1 -1
  209. package/dist/esm/client/core.mjs +1 -1
  210. package/dist/esm/client/get.d.mts +8 -1
  211. package/dist/esm/client/get.mjs +1 -1
  212. package/dist/esm/client/index.d.mts +2 -2
  213. package/dist/esm/client/index.mjs +1 -1
  214. package/dist/esm/client/post.d.mts +9 -1
  215. package/dist/esm/client/post.mjs +1 -1
  216. package/dist/esm/client/types.mjs +1 -1
  217. package/dist/esm/core/account/index.mjs +1 -1
  218. package/dist/esm/core/account/utils/address.mjs +1 -1
  219. package/dist/esm/core/account/utils/index.mjs +1 -1
  220. package/dist/esm/core/accountAddress.mjs +1 -1
  221. package/dist/esm/core/authenticationKey.d.mts +1 -1
  222. package/dist/esm/core/authenticationKey.mjs +1 -1
  223. package/dist/esm/core/common.mjs +1 -1
  224. package/dist/esm/core/crypto/cryptoHashable.d.mts +21 -0
  225. package/dist/esm/core/crypto/cryptoHashable.mjs +2 -0
  226. package/dist/esm/core/crypto/cryptoHashable.mjs.map +1 -0
  227. package/dist/esm/core/crypto/ed25519.d.mts +1 -1
  228. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  229. package/dist/esm/core/crypto/ephemeral.d.mts +73 -0
  230. package/dist/esm/core/crypto/ephemeral.mjs +2 -0
  231. package/dist/esm/core/crypto/ephemeral.mjs.map +1 -0
  232. package/dist/esm/core/crypto/index.d.mts +7 -1
  233. package/dist/esm/core/crypto/index.mjs +1 -1
  234. package/dist/esm/core/crypto/keyless.d.mts +321 -0
  235. package/dist/esm/core/crypto/keyless.mjs +2 -0
  236. package/dist/esm/core/crypto/keyless.mjs.map +1 -0
  237. package/dist/esm/core/crypto/multiEd25519.d.mts +1 -1
  238. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  239. package/dist/esm/core/crypto/multiKey.d.mts +1 -1
  240. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  241. package/dist/esm/core/crypto/poseidon.d.mts +19 -0
  242. package/dist/esm/core/crypto/poseidon.mjs +2 -0
  243. package/dist/esm/core/crypto/poseidon.mjs.map +1 -0
  244. package/dist/esm/core/crypto/privateKey.d.mts +1 -1
  245. package/dist/esm/core/crypto/proof.d.mts +21 -0
  246. package/dist/esm/core/crypto/proof.mjs +2 -0
  247. package/dist/esm/core/crypto/proof.mjs.map +1 -0
  248. package/dist/esm/core/crypto/publicKey.d.mts +1 -1
  249. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  250. package/dist/esm/core/crypto/secp256k1.d.mts +1 -1
  251. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  252. package/dist/esm/core/crypto/signature.mjs +1 -1
  253. package/dist/esm/core/crypto/singleKey.d.mts +1 -1
  254. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  255. package/dist/esm/core/crypto/utils.mjs +1 -1
  256. package/dist/esm/core/hex.mjs +1 -1
  257. package/dist/esm/core/index.d.mts +7 -1
  258. package/dist/esm/core/index.mjs +1 -1
  259. package/dist/esm/index.d.mts +15 -7
  260. package/dist/esm/index.mjs +1 -1
  261. package/dist/esm/internal/account.d.mts +3 -3
  262. package/dist/esm/internal/account.mjs +1 -1
  263. package/dist/esm/internal/ans.d.mts +2 -2
  264. package/dist/esm/internal/ans.mjs +1 -1
  265. package/dist/esm/internal/coin.d.mts +4 -4
  266. package/dist/esm/internal/coin.mjs +1 -1
  267. package/dist/esm/internal/digitalAsset.d.mts +2 -2
  268. package/dist/esm/internal/digitalAsset.mjs +1 -1
  269. package/dist/esm/internal/event.d.mts +1 -1
  270. package/dist/esm/internal/event.mjs +1 -1
  271. package/dist/esm/internal/faucet.d.mts +3 -3
  272. package/dist/esm/internal/faucet.mjs +1 -1
  273. package/dist/esm/internal/fungibleAsset.d.mts +3 -3
  274. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  275. package/dist/esm/internal/general.d.mts +2 -16
  276. package/dist/esm/internal/general.mjs +1 -1
  277. package/dist/esm/internal/keyless.d.mts +73 -0
  278. package/dist/esm/internal/keyless.mjs +2 -0
  279. package/dist/esm/internal/keyless.mjs.map +1 -0
  280. package/dist/esm/internal/staking.d.mts +2 -2
  281. package/dist/esm/internal/staking.mjs +1 -1
  282. package/dist/esm/internal/table.mjs +1 -1
  283. package/dist/esm/internal/transaction.d.mts +16 -2
  284. package/dist/esm/internal/transaction.mjs +1 -1
  285. package/dist/esm/internal/transactionSubmission.d.mts +6 -6
  286. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  287. package/dist/esm/internal/view.d.mts +1 -1
  288. package/dist/esm/internal/view.mjs +1 -1
  289. package/dist/esm/transactions/authenticator/account.d.mts +1 -1
  290. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  291. package/dist/esm/transactions/authenticator/index.d.mts +1 -1
  292. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  293. package/dist/esm/transactions/authenticator/transaction.d.mts +1 -1
  294. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  295. package/dist/esm/transactions/index.d.mts +2 -2
  296. package/dist/esm/transactions/index.mjs +1 -1
  297. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  298. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  299. package/dist/esm/transactions/instances/index.d.mts +1 -1
  300. package/dist/esm/transactions/instances/index.mjs +1 -1
  301. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  302. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  303. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  304. package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +1 -1
  305. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  306. package/dist/esm/transactions/instances/signedTransaction.d.mts +1 -1
  307. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  308. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  309. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  310. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +2 -2
  311. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  312. package/dist/esm/transactions/management/index.d.mts +2 -2
  313. package/dist/esm/transactions/management/index.mjs +1 -1
  314. package/dist/esm/transactions/management/transactionWorker.d.mts +2 -2
  315. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  316. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +1 -1
  317. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  318. package/dist/esm/transactions/transactionBuilder/index.d.mts +1 -1
  319. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  320. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +3 -3
  321. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  322. package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +4 -1
  323. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  324. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +1 -1
  325. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  326. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  327. package/dist/esm/transactions/typeTag/parser.d.mts +3 -1
  328. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  329. package/dist/esm/transactions/types.d.mts +23 -5
  330. package/dist/esm/types/index.d.mts +21 -5
  331. package/dist/esm/types/index.mjs +1 -1
  332. package/dist/esm/types/keyless.d.mts +52 -0
  333. package/dist/esm/types/keyless.mjs +1 -0
  334. package/dist/esm/types/keyless.mjs.map +1 -0
  335. package/dist/esm/utils/apiEndpoints.d.mts +3 -1
  336. package/dist/esm/utils/apiEndpoints.mjs +1 -1
  337. package/dist/esm/utils/const.d.mts +3 -1
  338. package/dist/esm/utils/const.mjs +1 -1
  339. package/dist/esm/utils/helpers.d.mts +4 -1
  340. package/dist/esm/utils/helpers.mjs +1 -1
  341. package/dist/esm/utils/index.d.mts +1 -1
  342. package/dist/esm/utils/index.mjs +1 -1
  343. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  344. package/dist/esm/version.d.mts +1 -1
  345. package/dist/esm/version.mjs +1 -1
  346. package/package.json +11 -4
  347. package/src/account/EphemeralKeyPair.ts +158 -0
  348. package/src/account/KeylessAccount.ts +367 -0
  349. package/src/account/MultiKeyAccount.ts +11 -0
  350. package/src/account/index.ts +2 -0
  351. package/src/api/aptos.ts +6 -0
  352. package/src/api/aptosConfig.ts +46 -1
  353. package/src/api/general.ts +1 -2
  354. package/src/api/keyless.ts +51 -0
  355. package/src/bcs/deserializer.ts +46 -0
  356. package/src/bcs/serializer.ts +58 -0
  357. package/src/client/core.ts +4 -0
  358. package/src/client/get.ts +12 -0
  359. package/src/client/post.ts +18 -0
  360. package/src/core/crypto/cryptoHashable.ts +16 -0
  361. package/src/core/crypto/ephemeral.ts +138 -0
  362. package/src/core/crypto/index.ts +2 -0
  363. package/src/core/crypto/keyless.ts +679 -0
  364. package/src/core/crypto/poseidon.ts +144 -0
  365. package/src/core/crypto/proof.ts +16 -0
  366. package/src/core/crypto/singleKey.ts +11 -0
  367. package/src/internal/general.ts +1 -38
  368. package/src/internal/keyless.ts +121 -0
  369. package/src/internal/transaction.ts +92 -0
  370. package/src/internal/transactionSubmission.ts +6 -1
  371. package/src/transactions/management/accountSequenceNumber.ts +5 -8
  372. package/src/transactions/transactionBuilder/remoteAbi.ts +3 -2
  373. package/src/transactions/transactionBuilder/signingMessage.ts +4 -1
  374. package/src/transactions/transactionBuilder/transactionBuilder.ts +22 -2
  375. package/src/transactions/typeTag/parser.ts +98 -52
  376. package/src/transactions/types.ts +22 -3
  377. package/src/types/index.ts +24 -2
  378. package/src/types/keyless.ts +42 -0
  379. package/src/utils/apiEndpoints.ts +16 -0
  380. package/src/utils/const.ts +2 -0
  381. package/src/utils/helpers.ts +22 -0
  382. package/src/version.ts +1 -1
  383. package/dist/common/chunk-KSEUZTKY.js +0 -2
  384. package/dist/common/chunk-KSEUZTKY.js.map +0 -1
  385. package/dist/esm/chunk-2XVDVF5C.mjs +0 -2
  386. package/dist/esm/chunk-3JPVQHOR.mjs +0 -2
  387. package/dist/esm/chunk-3JPVQHOR.mjs.map +0 -1
  388. package/dist/esm/chunk-43YYG5VO.mjs +0 -2
  389. package/dist/esm/chunk-43YYG5VO.mjs.map +0 -1
  390. package/dist/esm/chunk-5NSXEM3O.mjs +0 -2
  391. package/dist/esm/chunk-5SQAHWDI.mjs +0 -2
  392. package/dist/esm/chunk-5TTCAW72.mjs +0 -2
  393. package/dist/esm/chunk-5TTCAW72.mjs.map +0 -1
  394. package/dist/esm/chunk-6IFMQ5AS.mjs +0 -2
  395. package/dist/esm/chunk-6IFMQ5AS.mjs.map +0 -1
  396. package/dist/esm/chunk-6JFZZLRC.mjs +0 -2
  397. package/dist/esm/chunk-6JFZZLRC.mjs.map +0 -1
  398. package/dist/esm/chunk-AFTMLXYT.mjs +0 -2
  399. package/dist/esm/chunk-CCQRMKD2.mjs +0 -2
  400. package/dist/esm/chunk-CCQRMKD2.mjs.map +0 -1
  401. package/dist/esm/chunk-CYNQRMO5.mjs +0 -2
  402. package/dist/esm/chunk-CYNQRMO5.mjs.map +0 -1
  403. package/dist/esm/chunk-EUUIYMYC.mjs +0 -2
  404. package/dist/esm/chunk-F7EMGK4M.mjs +0 -2
  405. package/dist/esm/chunk-F7J7ZW4H.mjs +0 -2
  406. package/dist/esm/chunk-FNKDXPPQ.mjs +0 -2
  407. package/dist/esm/chunk-FVN6MJTH.mjs +0 -2
  408. package/dist/esm/chunk-FVN6MJTH.mjs.map +0 -1
  409. package/dist/esm/chunk-FWPK5KC2.mjs +0 -2
  410. package/dist/esm/chunk-FWPK5KC2.mjs.map +0 -1
  411. package/dist/esm/chunk-HYCGMFC2.mjs +0 -2
  412. package/dist/esm/chunk-HYCGMFC2.mjs.map +0 -1
  413. package/dist/esm/chunk-JE7INUQ2.mjs +0 -2
  414. package/dist/esm/chunk-JE7INUQ2.mjs.map +0 -1
  415. package/dist/esm/chunk-LG7RJQ57.mjs +0 -2
  416. package/dist/esm/chunk-LGOZUIGE.mjs +0 -2
  417. package/dist/esm/chunk-LKVJZTBM.mjs.map +0 -1
  418. package/dist/esm/chunk-LX53BIRN.mjs +0 -2
  419. package/dist/esm/chunk-NYXLPBKE.mjs +0 -2
  420. package/dist/esm/chunk-OIH4KBXW.mjs +0 -2
  421. package/dist/esm/chunk-OIH4KBXW.mjs.map +0 -1
  422. package/dist/esm/chunk-OWW6SIDP.mjs +0 -2
  423. package/dist/esm/chunk-OWW6SIDP.mjs.map +0 -1
  424. package/dist/esm/chunk-P2CIREOD.mjs +0 -2
  425. package/dist/esm/chunk-R5NNAF5B.mjs +0 -2
  426. package/dist/esm/chunk-R5NNAF5B.mjs.map +0 -1
  427. package/dist/esm/chunk-ROXFCLDT.mjs +0 -2
  428. package/dist/esm/chunk-RTSWVT2Q.mjs +0 -2
  429. package/dist/esm/chunk-RTSWVT2Q.mjs.map +0 -1
  430. package/dist/esm/chunk-T2WZWN6W.mjs +0 -2
  431. package/dist/esm/chunk-UO3NZ5AH.mjs +0 -1
  432. package/dist/esm/chunk-UVSRX4SV.mjs +0 -1
  433. package/dist/esm/chunk-V3DEJBS6.mjs +0 -2
  434. package/dist/esm/chunk-V6J6AW5T.mjs +0 -2
  435. package/dist/esm/chunk-V6J6AW5T.mjs.map +0 -1
  436. package/dist/esm/chunk-VEB6NALT.mjs +0 -2
  437. package/dist/esm/chunk-VEB6NALT.mjs.map +0 -1
  438. package/dist/esm/chunk-WZSVQBPA.mjs +0 -2
  439. package/dist/esm/chunk-XHEZAVN3.mjs +0 -2
  440. package/dist/esm/chunk-XXBMHWNV.mjs.map +0 -1
  441. /package/dist/esm/{chunk-UO3NZ5AH.mjs.map → account/EphemeralKeyPair.mjs.map} +0 -0
  442. /package/dist/esm/{chunk-UVSRX4SV.mjs.map → account/KeylessAccount.mjs.map} +0 -0
  443. /package/dist/esm/{chunk-ROXFCLDT.mjs.map → chunk-3RJZNUCQ.mjs.map} +0 -0
  444. /package/dist/esm/{chunk-LX53BIRN.mjs.map → chunk-472OGHMG.mjs.map} +0 -0
  445. /package/dist/esm/{chunk-AFTMLXYT.mjs.map → chunk-4VPCPASN.mjs.map} +0 -0
  446. /package/dist/esm/{chunk-OLKEU7WZ.mjs.map → chunk-5WFKJO5L.mjs.map} +0 -0
  447. /package/dist/esm/{chunk-HZ3YB6TN.mjs.map → chunk-64CUEMFI.mjs.map} +0 -0
  448. /package/dist/esm/{chunk-LM7CN4LT.mjs.map → chunk-64VPA7CM.mjs.map} +0 -0
  449. /package/dist/esm/{chunk-GHYE26Q5.mjs.map → chunk-6FBKUTGF.mjs.map} +0 -0
  450. /package/dist/esm/{chunk-2XVDVF5C.mjs.map → chunk-7BW2N4IE.mjs.map} +0 -0
  451. /package/dist/esm/{chunk-UF5B4XMN.mjs.map → chunk-7G3RSOWE.mjs.map} +0 -0
  452. /package/dist/esm/{chunk-AKJZL3HT.mjs.map → chunk-7M4C4OZN.mjs.map} +0 -0
  453. /package/dist/esm/{chunk-DO444YYD.mjs.map → chunk-7UKBRLGM.mjs.map} +0 -0
  454. /package/dist/esm/{chunk-BCUSI3N6.mjs.map → chunk-AOCNYMMX.mjs.map} +0 -0
  455. /package/dist/esm/{chunk-YMHX6GC2.mjs.map → chunk-B2RYTKNN.mjs.map} +0 -0
  456. /package/dist/esm/{chunk-JWTZDA6A.mjs.map → chunk-BO44HPGU.mjs.map} +0 -0
  457. /package/dist/esm/{chunk-DPWXEJP6.mjs.map → chunk-BT6IM25V.mjs.map} +0 -0
  458. /package/dist/esm/{chunk-JNDRFTEA.mjs.map → chunk-DPWEHSHH.mjs.map} +0 -0
  459. /package/dist/esm/{chunk-WNVUG2UF.mjs.map → chunk-EFMAZTIM.mjs.map} +0 -0
  460. /package/dist/esm/{chunk-LG7RJQ57.mjs.map → chunk-FBPNHF54.mjs.map} +0 -0
  461. /package/dist/esm/{chunk-YJIRT3GJ.mjs.map → chunk-FGGRPEQ3.mjs.map} +0 -0
  462. /package/dist/esm/{chunk-5SQAHWDI.mjs.map → chunk-FIG65OJD.mjs.map} +0 -0
  463. /package/dist/esm/{chunk-ISIUQQMV.mjs.map → chunk-FNFQA7NS.mjs.map} +0 -0
  464. /package/dist/esm/{chunk-HMTYASEZ.mjs.map → chunk-FSO54CI4.mjs.map} +0 -0
  465. /package/dist/esm/{chunk-DBC2JY65.mjs.map → chunk-GBQU2OCK.mjs.map} +0 -0
  466. /package/dist/esm/{chunk-FW6TF3O2.mjs.map → chunk-GPWSPT44.mjs.map} +0 -0
  467. /package/dist/esm/{chunk-QKV2H27T.mjs.map → chunk-GQC73XWZ.mjs.map} +0 -0
  468. /package/dist/esm/{chunk-FNKDXPPQ.mjs.map → chunk-GRHLQDHF.mjs.map} +0 -0
  469. /package/dist/esm/{chunk-WZSVQBPA.mjs.map → chunk-GSCM444Z.mjs.map} +0 -0
  470. /package/dist/esm/{chunk-VJL6AF64.mjs.map → chunk-HGJMVOBH.mjs.map} +0 -0
  471. /package/dist/esm/{chunk-MEXWNZY6.mjs.map → chunk-HXYZECGS.mjs.map} +0 -0
  472. /package/dist/esm/{chunk-EUUIYMYC.mjs.map → chunk-IT7YNITU.mjs.map} +0 -0
  473. /package/dist/esm/{chunk-TZCETTAW.mjs.map → chunk-IXFYYWAC.mjs.map} +0 -0
  474. /package/dist/esm/{chunk-OOH7MH2H.mjs.map → chunk-JZOTXY77.mjs.map} +0 -0
  475. /package/dist/esm/{chunk-FLUCRNGU.mjs.map → chunk-L5ZHZWHI.mjs.map} +0 -0
  476. /package/dist/esm/{chunk-YTJ73ZX3.mjs.map → chunk-LIT6V2A6.mjs.map} +0 -0
  477. /package/dist/esm/{chunk-S5AGI7RQ.mjs.map → chunk-MLX6DFMR.mjs.map} +0 -0
  478. /package/dist/esm/{chunk-P2CIREOD.mjs.map → chunk-NW3WUTTD.mjs.map} +0 -0
  479. /package/dist/esm/{chunk-BCLP2ENK.mjs.map → chunk-O7VXANBW.mjs.map} +0 -0
  480. /package/dist/esm/{chunk-43HKFNUB.mjs.map → chunk-QFVQSFBZ.mjs.map} +0 -0
  481. /package/dist/esm/{chunk-V367QLY3.mjs.map → chunk-S5ABQH5R.mjs.map} +0 -0
  482. /package/dist/esm/{chunk-AR3GW64L.mjs.map → chunk-SNDFJWYM.mjs.map} +0 -0
  483. /package/dist/esm/{chunk-TAVPFLW5.mjs.map → chunk-SYRND55P.mjs.map} +0 -0
  484. /package/dist/esm/{chunk-JHBMHOSV.mjs.map → chunk-T5YEMU53.mjs.map} +0 -0
  485. /package/dist/esm/{chunk-F7EMGK4M.mjs.map → chunk-TJDC5PWD.mjs.map} +0 -0
  486. /package/dist/esm/{chunk-LF6IQT54.mjs.map → chunk-TUCCV62K.mjs.map} +0 -0
  487. /package/dist/esm/{chunk-V3DEJBS6.mjs.map → chunk-U5F4NL24.mjs.map} +0 -0
  488. /package/dist/esm/{chunk-QIELBIZW.mjs.map → chunk-UHZWZWJ7.mjs.map} +0 -0
  489. /package/dist/esm/{chunk-LVYNEPH4.mjs.map → chunk-UVTJEMV4.mjs.map} +0 -0
  490. /package/dist/esm/{chunk-RC6B45PP.mjs.map → chunk-W63KIXLK.mjs.map} +0 -0
  491. /package/dist/esm/{chunk-F7J7ZW4H.mjs.map → chunk-WA2NTBYY.mjs.map} +0 -0
  492. /package/dist/esm/{chunk-X6BYF2UD.mjs.map → chunk-WIYDJE6F.mjs.map} +0 -0
  493. /package/dist/esm/{chunk-OO5EJW3B.mjs.map → chunk-X3HGM2KT.mjs.map} +0 -0
  494. /package/dist/esm/{chunk-I3MG3W4J.mjs.map → chunk-X4X5H6NC.mjs.map} +0 -0
  495. /package/dist/esm/{chunk-CX4BEIQT.mjs.map → chunk-XVZBWW46.mjs.map} +0 -0
  496. /package/dist/esm/{chunk-6SK246YU.mjs.map → chunk-YA4XTZNZ.mjs.map} +0 -0
  497. /package/dist/esm/{chunk-A7J2UMLS.mjs.map → chunk-YDNOKWV3.mjs.map} +0 -0
  498. /package/dist/esm/{chunk-4D42AAH3.mjs.map → chunk-YRUF6N3U.mjs.map} +0 -0
  499. /package/dist/esm/{chunk-ZMXURV35.mjs.map → chunk-ZIDLP5MI.mjs.map} +0 -0
  500. /package/dist/esm/{chunk-AWPRGMUP.mjs.map → chunk-ZV5MKFV7.mjs.map} +0 -0
  501. /package/dist/esm/{publicKey-B3XRNhHO.d.mts → publicKey-lq5djCIY.d.mts} +0 -0
@@ -21,18 +21,64 @@ import {
21
21
  import { AccountAddress } from "../../core";
22
22
  import { Identifier } from "../instances/identifier";
23
23
 
24
+ /**
25
+ * Tells if the string is a valid Move identifier. It can only be alphanumeric and `_`
26
+ * @param str
27
+ */
24
28
  function isValidIdentifier(str: string) {
25
29
  return !!str.match(/^[_a-zA-Z0-9]+$/);
26
30
  }
27
31
 
32
+ /**
33
+ * Tells if the character is a whitespace character. Does not work for multiple characters
34
+ * @param char
35
+ */
28
36
  function isValidWhitespaceCharacter(char: string) {
29
37
  return !!char.match(/\s/);
30
38
  }
31
39
 
40
+ /**
41
+ * Tells if a type is a generic type from the ABI, this will be of the form T0, T1, ...
42
+ * @param str
43
+ */
32
44
  function isGeneric(str: string) {
33
45
  return !!str.match(/^T[0-9]+$/);
34
46
  }
35
47
 
48
+ /**
49
+ * Tells if a type is a reference type (starts with &)
50
+ * @param str
51
+ */
52
+ function isRef(str: string) {
53
+ return !!str.match(/^&.+$/);
54
+ }
55
+
56
+ /**
57
+ * Tells if a type is a primitive type
58
+ * @param str
59
+ */
60
+ function isPrimitive(str: string) {
61
+ switch (str) {
62
+ case "signer":
63
+ case "address":
64
+ case "bool":
65
+ case "u8":
66
+ case "u16":
67
+ case "u32":
68
+ case "u64":
69
+ case "u128":
70
+ case "u256":
71
+ return true;
72
+ default:
73
+ return false;
74
+ }
75
+ }
76
+
77
+ /**
78
+ * Consumes all whitespace in a string, similar to trim
79
+ * @param tagStr
80
+ * @param pos
81
+ */
36
82
  function consumeWhitespace(tagStr: string, pos: number) {
37
83
  let i = pos;
38
84
  for (; i < tagStr.length; i += 1) {
@@ -46,6 +92,9 @@ function consumeWhitespace(tagStr: string, pos: number) {
46
92
  return i;
47
93
  }
48
94
 
95
+ /**
96
+ * State for TypeTag parsing. This is pushed onto a stack to keep track of what is the current state
97
+ */
49
98
  type TypeTagState = {
50
99
  savedExpectedTypes: number;
51
100
  savedStr: string;
@@ -60,11 +109,13 @@ export enum TypeTagParserErrorType {
60
109
  UnexpectedComma = "unexpected ','",
61
110
  TypeArgumentCountMismatch = "type argument count doesn't match expected amount",
62
111
  MissingTypeArgumentClose = "no matching '>' for '<'",
112
+ MissingTypeArgument = "no type argument before ','",
63
113
  UnexpectedPrimitiveTypeArguments = "primitive types not expected to have type arguments",
64
114
  UnexpectedVectorTypeArgumentCount = "vector type expected to have exactly one type argument",
65
115
  UnexpectedStructFormat = "unexpected struct format, must be of the form 0xaddress::module_name::struct_name",
66
116
  InvalidModuleNameCharacter = "module name must only contain alphanumeric or '_' characters",
67
117
  InvalidStructNameCharacter = "struct name must only contain alphanumeric or '_' characters",
118
+ InvalidAddress = "struct address must be valid",
68
119
  }
69
120
 
70
121
  export class TypeTagParserError extends Error {
@@ -141,16 +192,24 @@ export function parseTypeTag(typeStr: string, options?: { allowGenerics?: boolea
141
192
  expectedTypes = savedExpectedTypes;
142
193
  } else if (char === ",") {
143
194
  // Comma means we need to start parsing a new tag, push the previous one to the curTypes
144
- // Process last type, if there is no type string, then don't parse it
145
- if (currentStr.length !== 0) {
146
- const newType = parseTypeTagInner(currentStr, innerTypes, allowGenerics);
147
195
 
148
- // parse type tag and push it on the types
149
- innerTypes = [];
150
- curTypes.push(newType);
151
- currentStr = "";
152
- expectedTypes += 1;
196
+ // No top level commas (not in a type <> are allowed)
197
+ if (saved.length === 0) {
198
+ throw new TypeTagParserError(typeStr, TypeTagParserErrorType.UnexpectedComma);
199
+ }
200
+ // If there was no actual value before the comma, then it's missing a type argument
201
+ if (currentStr.length === 0) {
202
+ throw new TypeTagParserError(typeStr, TypeTagParserErrorType.MissingTypeArgument);
153
203
  }
204
+
205
+ // Process characters before as a type
206
+ const newType = parseTypeTagInner(currentStr, innerTypes, allowGenerics);
207
+
208
+ // parse type tag and push it on the types
209
+ innerTypes = [];
210
+ curTypes.push(newType);
211
+ currentStr = "";
212
+ expectedTypes += 1;
154
213
  } else if (isValidWhitespaceCharacter(char)) {
155
214
  // This means we should save what we have and everything else should skip until the next
156
215
  let parsedTypeTag = false;
@@ -207,59 +266,35 @@ export function parseTypeTag(typeStr: string, options?: { allowGenerics?: boolea
207
266
  * Parses a type tag with internal types associated
208
267
  * @param str
209
268
  * @param types
269
+ * @param allowGenerics allow generic in parsing of the type tag
210
270
  */
211
271
  function parseTypeTagInner(str: string, types: Array<TypeTag>, allowGenerics: boolean): TypeTag {
212
- // TODO: Parse references to any item not just signer
213
- switch (str) {
214
- case "&signer":
215
- if (types.length > 0) {
216
- throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);
217
- }
218
- return new TypeTagReference(new TypeTagSigner());
272
+ const trimmedStr = str.trim();
273
+ const lowerCaseTrimmed = trimmedStr.toLowerCase();
274
+ if (isPrimitive(lowerCaseTrimmed)) {
275
+ if (types.length > 0) {
276
+ throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);
277
+ }
278
+ }
279
+
280
+ switch (trimmedStr.toLowerCase()) {
219
281
  case "signer":
220
- if (types.length > 0) {
221
- throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);
222
- }
223
282
  return new TypeTagSigner();
224
283
  case "bool":
225
- if (types.length > 0) {
226
- throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);
227
- }
228
284
  return new TypeTagBool();
229
285
  case "address":
230
- if (types.length > 0) {
231
- throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);
232
- }
233
286
  return new TypeTagAddress();
234
287
  case "u8":
235
- if (types.length > 0) {
236
- throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);
237
- }
238
288
  return new TypeTagU8();
239
289
  case "u16":
240
- if (types.length > 0) {
241
- throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);
242
- }
243
290
  return new TypeTagU16();
244
291
  case "u32":
245
- if (types.length > 0) {
246
- throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);
247
- }
248
292
  return new TypeTagU32();
249
293
  case "u64":
250
- if (types.length > 0) {
251
- throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);
252
- }
253
294
  return new TypeTagU64();
254
295
  case "u128":
255
- if (types.length > 0) {
256
- throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);
257
- }
258
296
  return new TypeTagU128();
259
297
  case "u256":
260
- if (types.length > 0) {
261
- throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);
262
- }
263
298
  return new TypeTagU256();
264
299
  case "vector":
265
300
  if (types.length !== 1) {
@@ -267,25 +302,41 @@ function parseTypeTagInner(str: string, types: Array<TypeTag>, allowGenerics: bo
267
302
  }
268
303
  return new TypeTagVector(types[0]);
269
304
  default:
270
- if (isGeneric(str)) {
305
+ // Reference will have to handle the inner type
306
+ if (isRef(trimmedStr)) {
307
+ const actualType = trimmedStr.substring(1);
308
+ return new TypeTagReference(parseTypeTagInner(actualType, types, allowGenerics));
309
+ }
310
+
311
+ // Generics are always expected to be T0 or T1
312
+ if (isGeneric(trimmedStr)) {
271
313
  if (allowGenerics) {
272
- return new TypeTagGeneric(Number(str.split("T")[1]));
314
+ return new TypeTagGeneric(Number(trimmedStr.split("T")[1]));
273
315
  }
274
316
  throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedGenericType);
275
317
  }
276
318
 
277
319
  // If the value doesn't contain a colon, then we'll assume it isn't trying to be a struct
278
- if (!str.match(/:/)) {
320
+ if (!trimmedStr.match(/:/)) {
279
321
  throw new TypeTagParserError(str, TypeTagParserErrorType.InvalidTypeTag);
280
322
  }
281
323
 
282
324
  // Parse for a struct tag
283
325
  // eslint-disable-next-line no-case-declarations
284
- const structParts = str.split("::");
326
+ const structParts = trimmedStr.split("::");
285
327
  if (structParts.length !== 3) {
286
328
  throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedStructFormat);
287
329
  }
288
330
 
331
+ // Validate struct address
332
+ // eslint-disable-next-line no-case-declarations
333
+ let address: AccountAddress;
334
+ try {
335
+ address = AccountAddress.fromString(structParts[0]);
336
+ } catch (error: any) {
337
+ throw new TypeTagParserError(str, TypeTagParserErrorType.InvalidAddress);
338
+ }
339
+
289
340
  // Validate identifier characters
290
341
  if (!isValidIdentifier(structParts[1])) {
291
342
  throw new TypeTagParserError(str, TypeTagParserErrorType.InvalidModuleNameCharacter);
@@ -295,12 +346,7 @@ function parseTypeTagInner(str: string, types: Array<TypeTag>, allowGenerics: bo
295
346
  }
296
347
 
297
348
  return new TypeTagStruct(
298
- new StructTag(
299
- AccountAddress.fromString(structParts[0]),
300
- new Identifier(structParts[1]),
301
- new Identifier(structParts[2]),
302
- types,
303
- ),
349
+ new StructTag(address, new Identifier(structParts[1]), new Identifier(structParts[2]), types),
304
350
  );
305
351
  }
306
352
  }
@@ -68,6 +68,25 @@ export type ScriptFunctionArgumentTypes =
68
68
  | MoveString
69
69
  | FixedBytes;
70
70
 
71
+ /**
72
+ * TypeArgument inputs for Entry functions, view functions, and scripts
73
+ *
74
+ * This can be a string version of the type argument such as:
75
+ * - u8
76
+ * - u16
77
+ * - u32
78
+ * - u64
79
+ * - u128
80
+ * - u256
81
+ * - bool
82
+ * - address
83
+ * - signer
84
+ * - vector<Type>
85
+ * - address::module::struct
86
+ * - address::module::struct<Type1, Type2>
87
+ */
88
+ export type TypeArgument = TypeTag | string;
89
+
71
90
  /**
72
91
  * Type that holds all raw transaction instances Aptos SDK supports
73
92
  */
@@ -109,7 +128,7 @@ export type InputGenerateTransactionPayloadDataWithRemoteABI =
109
128
  */
110
129
  export type InputEntryFunctionData = {
111
130
  function: MoveFunctionId;
112
- typeArguments?: Array<TypeTag | string>;
131
+ typeArguments?: Array<TypeArgument>;
113
132
  functionArguments: Array<EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes>;
114
133
  abi?: EntryFunctionABI;
115
134
  };
@@ -144,7 +163,7 @@ export type InputMultiSigDataWithRemoteABI = {
144
163
  */
145
164
  export type InputScriptData = {
146
165
  bytecode: HexInput;
147
- typeArguments?: Array<TypeTag>;
166
+ typeArguments?: Array<TypeArgument>;
148
167
  functionArguments: Array<ScriptFunctionArgumentTypes>;
149
168
  };
150
169
 
@@ -153,7 +172,7 @@ export type InputScriptData = {
153
172
  */
154
173
  export type InputViewFunctionData = {
155
174
  function: MoveFunctionId;
156
- typeArguments?: Array<TypeTag | string>;
175
+ typeArguments?: Array<TypeArgument>;
157
176
  functionArguments?: Array<EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes>;
158
177
  abi?: ViewFunctionABI;
159
178
  };
@@ -108,11 +108,29 @@ export enum AccountAuthenticatorVariant {
108
108
  export enum AnyPublicKeyVariant {
109
109
  Ed25519 = 0,
110
110
  Secp256k1 = 1,
111
+ Keyless = 3,
111
112
  }
112
113
 
113
114
  export enum AnySignatureVariant {
114
115
  Ed25519 = 0,
115
116
  Secp256k1 = 1,
117
+ Keyless = 3,
118
+ }
119
+
120
+ export enum EphemeralPublicKeyVariant {
121
+ Ed25519 = 0,
122
+ }
123
+
124
+ export enum EphemeralSignatureVariant {
125
+ Ed25519 = 0,
126
+ }
127
+
128
+ export enum EphemeralCertificateVariant {
129
+ ZkProof = 0,
130
+ }
131
+
132
+ export enum ZkpVariant {
133
+ Groth16 = 0,
116
134
  }
117
135
 
118
136
  /**
@@ -140,6 +158,10 @@ export type AptosSettings = {
140
158
 
141
159
  readonly indexer?: string;
142
160
 
161
+ readonly pepper?: string;
162
+
163
+ readonly prover?: string;
164
+
143
165
  readonly clientConfig?: ClientConfig;
144
166
 
145
167
  readonly client?: Client;
@@ -300,9 +322,9 @@ export type GasEstimation = {
300
322
  prioritized_gas_estimate?: number;
301
323
  };
302
324
 
303
- export type MoveResource = {
325
+ export type MoveResource<T = {}> = {
304
326
  type: MoveStructId;
305
- data: {};
327
+ data: T;
306
328
  };
307
329
 
308
330
  export type AccountData = {
@@ -0,0 +1,42 @@
1
+ export type ProverRequest = {
2
+ jwt_b64: string;
3
+ epk: string;
4
+ exp_date_secs: number;
5
+ exp_horizon_secs: number;
6
+ epk_blinder: string;
7
+ uid_key: string;
8
+ pepper: string;
9
+ };
10
+ export type ProverResponse = {
11
+ proof: { a: string; b: string; c: string };
12
+ public_inputs_hash: string;
13
+ training_wheels_signature: string;
14
+ };
15
+ export type PepperFetchRequest = {
16
+ jwt_b64: number;
17
+ epk: string;
18
+ exp_date_secs: number;
19
+ epk_blinder: string;
20
+ uid_key: string;
21
+ derivation_path: string;
22
+ };
23
+ export type PepperFetchResponse = { signature: string; pepper: string; address: string };
24
+
25
+ export type KeylessConfigurationResponse = {
26
+ max_commited_epk_bytes: number;
27
+ max_exp_horizon_secs: string;
28
+ max_extra_field_bytes: number;
29
+ max_iss_val_bytes: number;
30
+ max_jwt_header_b64_bytes: number;
31
+ max_signatures_per_txn: number;
32
+ override_aud_vals: string[];
33
+ training_wheels_pubkey: { vec: string[] };
34
+ };
35
+
36
+ export type Groth16VerificationKeyResponse = {
37
+ alpha_g1: string;
38
+ beta_g2: string;
39
+ delta_g2: string;
40
+ gamma_abc_g1: [string, string];
41
+ gamma_g2: string;
42
+ };
@@ -22,6 +22,22 @@ export const NetworkToFaucetAPI: Record<string, string> = {
22
22
  local: "http://127.0.0.1:8081",
23
23
  };
24
24
 
25
+ export const NetworkToPepperAPI: Record<string, string> = {
26
+ mainnet: "https://api.mainnet.aptoslabs.com/keyless/pepper/v0",
27
+ testnet: "https://api.testnet.aptoslabs.com/keyless/pepper/v0",
28
+ devnet: "https://api.devnet.aptoslabs.com/keyless/pepper/v0",
29
+ // Use the devnet service for local environment
30
+ local: "https://api.devnet.aptoslabs.com/keyless/pepper/v0",
31
+ };
32
+
33
+ export const NetworkToProverAPI: Record<string, string> = {
34
+ mainnet: "https://api.mainnet.aptoslabs.com/keyless/prover/v0",
35
+ testnet: "https://api.testnet.aptoslabs.com/keyless/prover/v0",
36
+ devnet: "https://api.devnet.aptoslabs.com/keyless/prover/v0",
37
+ // Use the devnet service for local environment
38
+ local: "https://api.devnet.aptoslabs.com/keyless/prover/v0",
39
+ };
40
+
25
41
  export enum Network {
26
42
  MAINNET = "mainnet",
27
43
  TESTNET = "testnet",
@@ -8,6 +8,8 @@ export enum AptosApiType {
8
8
  FULLNODE = "Fullnode",
9
9
  INDEXER = "Indexer",
10
10
  FAUCET = "Faucet",
11
+ PEPPER = "Pepper",
12
+ PROVER = "Prover",
11
13
  }
12
14
 
13
15
  /**
@@ -1,6 +1,8 @@
1
1
  // Copyright © Aptos Foundation
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
+ import { decode } from "js-base64";
5
+
4
6
  /**
5
7
  * Sleep the current thread for the given amount of time
6
8
  * @param timeMs time in milliseconds to sleep
@@ -10,3 +12,23 @@ export async function sleep(timeMs: number): Promise<null> {
10
12
  setTimeout(resolve, timeMs);
11
13
  });
12
14
  }
15
+
16
+ export const nowInSeconds = () => Math.floor(Date.now() / 1000);
17
+
18
+ export function floorToWholeHour(timestampInSeconds: number): number {
19
+ const date = new Date(timestampInSeconds * 1000);
20
+ // Reset minutes and seconds to zero
21
+ date.setMinutes(0);
22
+ date.setSeconds(0);
23
+ date.setMilliseconds(0);
24
+ return Math.floor(date.getTime() / 1000);
25
+ }
26
+
27
+ export function base64UrlDecode(base64Url: string): string {
28
+ // Replace base64url-specific characters
29
+ const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
30
+ // Pad the string with '=' characters if needed
31
+ const paddedBase64 = base64 + "==".substring(0, (3 - (base64.length % 3)) % 3);
32
+ const decodedString = decode(paddedBase64);
33
+ return decodedString;
34
+ }
package/src/version.ts CHANGED
@@ -6,4 +6,4 @@
6
6
  *
7
7
  * hardcoded for now, we would want to have it injected dynamically
8
8
  */
9
- export const VERSION = "1.16.0";
9
+ export const VERSION = "1.17.0";
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var i=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var l=(r,n,s,o)=>{for(var e=o>1?void 0:o?m(n,s):n,t=r.length-1,u;t>=0;t--)(u=r[t])&&(e=(o?u(n,s,e):u(e))||e);return o&&e&&i(n,s,e),e};async function p(r){return new Promise(n=>{setTimeout(n,r)})}exports.a = l; exports.b = p;
2
- //# sourceMappingURL=chunk-KSEUZTKY.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/helpers.ts"],"names":["sleep","timeMs","resolve"],"mappings":"wMAOA,eAAsBA,EAAMC,EAA+B,CACzD,OAAO,IAAI,QAASC,GAAY,CAC9B,WAAWA,EAASD,CAAM,CAC5B,CAAC,CACH","sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Sleep the current thread for the given amount of time\n * @param timeMs time in milliseconds to sleep\n */\nexport async function sleep(timeMs: number): Promise<null> {\n return new Promise((resolve) => {\n setTimeout(resolve, timeMs);\n });\n}\n"]}
@@ -1,2 +0,0 @@
1
- import{a as r}from"./chunk-4KMISR2H.mjs";import{b as i}from"./chunk-BCUSI3N6.mjs";var t=class a extends r{constructor(e){super(),this.value=i.fromHexInput(e).toUint8Array()}serialize(e){e.serializeFixedBytes(this.value)}serializeForEntryFunction(e){e.serialize(this)}serializeForScriptFunction(e){e.serialize(this)}static deserialize(e,s){let o=e.deserializeFixedBytes(s);return new a(o)}};export{t as a};
2
- //# sourceMappingURL=chunk-2XVDVF5C.mjs.map
@@ -1,2 +0,0 @@
1
- async function r(e){return new Promise(n=>{setTimeout(n,e)})}export{r as a};
2
- //# sourceMappingURL=chunk-3JPVQHOR.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/helpers.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Sleep the current thread for the given amount of time\n * @param timeMs time in milliseconds to sleep\n */\nexport async function sleep(timeMs: number): Promise<null> {\n return new Promise((resolve) => {\n setTimeout(resolve, timeMs);\n });\n}\n"],"mappings":"AAOA,eAAsBA,EAAMC,EAA+B,CACzD,OAAO,IAAI,QAASC,GAAY,CAC9B,WAAWA,EAASD,CAAM,CAC5B,CAAC,CACH","names":["sleep","timeMs","resolve"]}
@@ -1,2 +0,0 @@
1
- import{a as n,c as s}from"./chunk-CX4BEIQT.mjs";import{a,c}from"./chunk-JWTZDA6A.mjs";import{a as y}from"./chunk-AFTMLXYT.mjs";import{b as l}from"./chunk-F7J7ZW4H.mjs";import{a as u}from"./chunk-WNVUG2UF.mjs";var b=class t extends l{constructor(e){if(super(),this.publicKey=e,e instanceof n)this.variant=0;else if(e instanceof a)this.variant=1;else throw new Error("Unsupported public key type")}verifySignature(e){let{message:r,signature:i}=e;return i instanceof o?this.publicKey.verifySignature({message:r,signature:i.signature}):!1}authKey(){return u.fromSchemeAndBytes({scheme:2,input:this.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeU32AsUleb128(this.variant),this.publicKey.serialize(e)}static deserialize(e){let r=e.deserializeUleb128AsU32(),i;switch(r){case 0:i=n.deserialize(e);break;case 1:i=a.deserialize(e);break;default:throw new Error(`Unknown variant index for AnyPublicKey: ${r}`)}return new t(i)}static isPublicKey(e){return e instanceof t}isEd25519(){return this.publicKey instanceof n}isSecp256k1PublicKey(){return this.publicKey instanceof a}},o=class t extends y{constructor(e){if(super(),this.signature=e,e instanceof s)this.variant=0;else if(e instanceof c)this.variant=1;else throw new Error("Unsupported signature type")}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let r=e.deserializeUleb128AsU32(),i;switch(r){case 0:i=s.deserialize(e);break;case 1:i=c.deserialize(e);break;default:throw new Error(`Unknown variant index for AnySignature: ${r}`)}return new t(i)}};export{b as a,o as b};
2
- //# sourceMappingURL=chunk-43YYG5VO.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/core/crypto/singleKey.ts"],"sourcesContent":["import { Deserializer, Serializer } from \"../../bcs\";\nimport { AnyPublicKeyVariant, AnySignatureVariant, SigningScheme as AuthenticationKeyScheme } from \"../../types\";\nimport { AuthenticationKey } from \"../authenticationKey\";\nimport { Ed25519PublicKey, Ed25519Signature } from \"./ed25519\";\nimport { AccountPublicKey, PublicKey, VerifySignatureArgs } from \"./publicKey\";\nimport { Secp256k1PublicKey, Secp256k1Signature } from \"./secp256k1\";\nimport { Signature } from \"./signature\";\n\n/**\n * Represents any public key supported by Aptos.\n *\n * Since [AIP-55](https://github.com/aptos-foundation/AIPs/pull/263) Aptos supports\n * `Legacy` and `Unified` authentication keys.\n *\n * Any unified authentication key is represented in the SDK as `AnyPublicKey`.\n */\nexport class AnyPublicKey extends AccountPublicKey {\n /**\n * Reference to the inner public key\n */\n public readonly publicKey: PublicKey;\n\n /**\n * Index of the underlying enum variant\n */\n public readonly variant: AnyPublicKeyVariant;\n\n // region Constructors\n\n constructor(publicKey: PublicKey) {\n super();\n this.publicKey = publicKey;\n if (publicKey instanceof Ed25519PublicKey) {\n this.variant = AnyPublicKeyVariant.Ed25519;\n } else if (publicKey instanceof Secp256k1PublicKey) {\n this.variant = AnyPublicKeyVariant.Secp256k1;\n } else {\n throw new Error(\"Unsupported public key type\");\n }\n }\n\n // endregion\n\n // region AccountPublicKey\n\n verifySignature(args: VerifySignatureArgs): boolean {\n const { message, signature } = args;\n if (!(signature instanceof AnySignature)) {\n return false;\n }\n\n return this.publicKey.verifySignature({\n message,\n signature: signature.signature,\n });\n }\n\n authKey(): AuthenticationKey {\n return AuthenticationKey.fromSchemeAndBytes({\n scheme: AuthenticationKeyScheme.SingleKey,\n input: this.toUint8Array(),\n });\n }\n\n toUint8Array() {\n return this.bcsToBytes();\n }\n\n // endregion\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(this.variant);\n this.publicKey.serialize(serializer);\n }\n\n static deserialize(deserializer: Deserializer): AnyPublicKey {\n const variantIndex = deserializer.deserializeUleb128AsU32();\n let publicKey: PublicKey;\n switch (variantIndex) {\n case AnyPublicKeyVariant.Ed25519:\n publicKey = Ed25519PublicKey.deserialize(deserializer);\n break;\n case AnyPublicKeyVariant.Secp256k1:\n publicKey = Secp256k1PublicKey.deserialize(deserializer);\n break;\n default:\n throw new Error(`Unknown variant index for AnyPublicKey: ${variantIndex}`);\n }\n return new AnyPublicKey(publicKey);\n }\n\n // endregion\n\n /**\n * @deprecated use `instanceof AnyPublicKey` instead.\n */\n static isPublicKey(publicKey: AccountPublicKey): publicKey is AnyPublicKey {\n return publicKey instanceof AnyPublicKey;\n }\n\n /**\n * @deprecated use `publicKey instanceof Ed25519PublicKey` instead.\n */\n isEd25519(): boolean {\n return this.publicKey instanceof Ed25519PublicKey;\n }\n\n /**\n * @deprecated use `publicKey instanceof Secp256k1PublicKey` instead.\n */\n isSecp256k1PublicKey(): boolean {\n return this.publicKey instanceof Secp256k1PublicKey;\n }\n}\n\n/**\n * Instance of signature that uses the SingleKey authentication scheme.\n * This signature can only be generated by a `SingleKeySigner`, since it uses the\n * same authentication scheme.\n */\nexport class AnySignature extends Signature {\n public readonly signature: Signature;\n\n /**\n * Index of the underlying enum variant\n */\n private readonly variant: AnySignatureVariant;\n\n // region Constructors\n\n constructor(signature: Signature) {\n super();\n this.signature = signature;\n\n if (signature instanceof Ed25519Signature) {\n this.variant = AnySignatureVariant.Ed25519;\n } else if (signature instanceof Secp256k1Signature) {\n this.variant = AnySignatureVariant.Secp256k1;\n } else {\n throw new Error(\"Unsupported signature type\");\n }\n }\n\n // endregion\n\n // region AccountSignature\n\n toUint8Array() {\n return this.bcsToBytes();\n }\n\n // endregion\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(this.variant);\n this.signature.serialize(serializer);\n }\n\n static deserialize(deserializer: Deserializer): AnySignature {\n const variantIndex = deserializer.deserializeUleb128AsU32();\n let signature: Signature;\n switch (variantIndex) {\n case AnySignatureVariant.Ed25519:\n signature = Ed25519Signature.deserialize(deserializer);\n break;\n case AnySignatureVariant.Secp256k1:\n signature = Secp256k1Signature.deserialize(deserializer);\n break;\n default:\n throw new Error(`Unknown variant index for AnySignature: ${variantIndex}`);\n }\n return new AnySignature(signature);\n }\n\n // endregion\n}\n"],"mappings":"iNAgBO,IAAMA,EAAN,MAAMC,UAAqBC,CAAiB,CAajD,YAAYC,EAAsB,CAGhC,GAFA,MAAM,EACN,KAAK,UAAYA,EACbA,aAAqBC,EACvB,KAAK,QAAU,UACND,aAAqBE,EAC9B,KAAK,QAAU,MAEf,OAAM,IAAI,MAAM,6BAA6B,CAEjD,CAMA,gBAAgBC,EAAoC,CAClD,GAAM,CAAE,QAAAC,EAAS,UAAAC,CAAU,EAAIF,EAC/B,OAAME,aAAqBC,EAIpB,KAAK,UAAU,gBAAgB,CACpC,QAAAF,EACA,UAAWC,EAAU,SACvB,CAAC,EANQ,EAOX,CAEA,SAA6B,CAC3B,OAAOE,EAAkB,mBAAmB,CAC1C,SACA,MAAO,KAAK,aAAa,CAC3B,CAAC,CACH,CAEA,cAAe,CACb,OAAO,KAAK,WAAW,CACzB,CAMA,UAAUC,EAA8B,CACtCA,EAAW,sBAAsB,KAAK,OAAO,EAC7C,KAAK,UAAU,UAAUA,CAAU,CACrC,CAEA,OAAO,YAAYC,EAA0C,CAC3D,IAAMC,EAAeD,EAAa,wBAAwB,EACtDT,EACJ,OAAQU,EAAc,CACpB,OACEV,EAAYC,EAAiB,YAAYQ,CAAY,EACrD,MACF,OACET,EAAYE,EAAmB,YAAYO,CAAY,EACvD,MACF,QACE,MAAM,IAAI,MAAM,2CAA2CC,CAAY,EAAE,CAC7E,CACA,OAAO,IAAIZ,EAAaE,CAAS,CACnC,CAOA,OAAO,YAAYA,EAAwD,CACzE,OAAOA,aAAqBF,CAC9B,CAKA,WAAqB,CACnB,OAAO,KAAK,qBAAqBG,CACnC,CAKA,sBAAgC,CAC9B,OAAO,KAAK,qBAAqBC,CACnC,CACF,EAOaI,EAAN,MAAMK,UAAqBC,CAAU,CAU1C,YAAYP,EAAsB,CAIhC,GAHA,MAAM,EACN,KAAK,UAAYA,EAEbA,aAAqBQ,EACvB,KAAK,QAAU,UACNR,aAAqBS,EAC9B,KAAK,QAAU,MAEf,OAAM,IAAI,MAAM,4BAA4B,CAEhD,CAMA,cAAe,CACb,OAAO,KAAK,WAAW,CACzB,CAMA,UAAUN,EAA8B,CACtCA,EAAW,sBAAsB,KAAK,OAAO,EAC7C,KAAK,UAAU,UAAUA,CAAU,CACrC,CAEA,OAAO,YAAYC,EAA0C,CAC3D,IAAMC,EAAeD,EAAa,wBAAwB,EACtDJ,EACJ,OAAQK,EAAc,CACpB,OACEL,EAAYQ,EAAiB,YAAYJ,CAAY,EACrD,MACF,OACEJ,EAAYS,EAAmB,YAAYL,CAAY,EACvD,MACF,QACE,MAAM,IAAI,MAAM,2CAA2CC,CAAY,EAAE,CAC7E,CACA,OAAO,IAAIC,EAAaN,CAAS,CACnC,CAGF","names":["AnyPublicKey","_AnyPublicKey","AccountPublicKey","publicKey","Ed25519PublicKey","Secp256k1PublicKey","args","message","signature","AnySignature","AuthenticationKey","serializer","deserializer","variantIndex","_AnySignature","Signature","Ed25519Signature","Secp256k1Signature"]}
@@ -1,2 +0,0 @@
1
- import{a as s,c as u,e as t}from"./chunk-4KMISR2H.mjs";import{a,b as l,c as n,d as o,e as c,f as z}from"./chunk-56CNRT2K.mjs";var d=class i extends s{constructor(e){super(),u(e),this.value=e}serialize(e){e.serializeBool(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(5),e.serialize(this)}static deserialize(e){return new i(e.deserializeBool())}},U=class i extends s{constructor(e){super(),t(e,0,a),this.value=e}serialize(e){e.serializeU8(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(0),e.serialize(this)}static deserialize(e){return new i(e.deserializeU8())}},p=class i extends s{constructor(e){super(),t(e,0,l),this.value=e}serialize(e){e.serializeU16(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(6),e.serialize(this)}static deserialize(e){return new i(e.deserializeU16())}},b=class i extends s{constructor(e){super(),t(e,0,n),this.value=e}serialize(e){e.serializeU32(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(7),e.serialize(this)}static deserialize(e){return new i(e.deserializeU32())}},y=class i extends s{constructor(e){super(),t(e,BigInt(0),o),this.value=BigInt(e)}serialize(e){e.serializeU64(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(1),e.serialize(this)}static deserialize(e){return new i(e.deserializeU64())}},m=class i extends s{constructor(e){super(),t(e,BigInt(0),c),this.value=BigInt(e)}serialize(e){e.serializeU128(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(2),e.serialize(this)}static deserialize(e){return new i(e.deserializeU128())}},B=class i extends s{constructor(e){super(),t(e,BigInt(0),z),this.value=BigInt(e)}serialize(e){e.serializeU256(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(8),e.serialize(this)}static deserialize(e){return new i(e.deserializeU256())}};export{d as a,U as b,p as c,b as d,y as e,m as f,B as g};
2
- //# sourceMappingURL=chunk-5NSXEM3O.mjs.map
@@ -1,2 +0,0 @@
1
- import{a as m}from"./chunk-S5AGI7RQ.mjs";import{a as g}from"./chunk-LF6IQT54.mjs";import{a as p}from"./chunk-WZSVQBPA.mjs";import{a as v}from"./chunk-YJIRT3GJ.mjs";import{a as F,b as d,c as T,d as x,e as E,f as _,g as w}from"./chunk-5NSXEM3O.mjs";import{a as S}from"./chunk-FNKDXPPQ.mjs";import{b as y}from"./chunk-UEI62FBQ.mjs";import{a as u}from"./chunk-4KMISR2H.mjs";function D(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return d.deserialize(t);case 1:return E.deserialize(t);case 2:return _.deserialize(t);case 3:return y.deserialize(t);case 4:return v.deserialize(t,d);case 5:return F.deserialize(t);case 6:return T.deserialize(t);case 7:return x.deserialize(t);case 8:return w.deserialize(t);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${e}`)}}var a=class extends u{static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return A.load(e);case 2:return z.load(e);case 3:return h.load(e);default:throw new Error(`Unknown variant index for TransactionPayload: ${r}`)}}},A=class t extends a{constructor(e){super(),this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let r=U.deserialize(e);return new t(r)}},z=class t extends a{constructor(e){super(),this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let r=l.deserialize(e);return new t(r)}},h=class t extends a{constructor(e){super(),this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let r=f.deserialize(e);return new t(r)}},l=class t{constructor(e,r,i,n){this.module_name=e,this.function_name=r,this.type_args=i,this.args=n}static build(e,r,i,n){return new t(g.fromStr(e),new p(r),i,n)}serialize(e){this.module_name.serialize(e),this.function_name.serialize(e),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(r=>{r.serializeForEntryFunction(e)})}static deserialize(e){let r=g.deserialize(e),i=p.deserialize(e),n=e.deserializeVector(m),o=e.deserializeUleb128AsU32(),s=new Array;for(let c=0;c<o;c+=1){let M=e.deserializeUleb128AsU32(),B=S.deserialize(e,M);s.push(B)}return new t(r,i,n,s)}},U=class t{constructor(e,r,i){this.bytecode=e,this.type_args=r,this.args=i}serialize(e){e.serializeBytes(this.bytecode),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(r=>{r.serializeForScriptFunction(e)})}static deserialize(e){let r=e.deserializeBytes(),i=e.deserializeVector(m),n=e.deserializeUleb128AsU32(),o=new Array;for(let s=0;s<n;s+=1){let c=D(e);o.push(c)}return new t(r,i,o)}},f=class t{constructor(e,r){this.multisig_address=e,this.transaction_payload=r}serialize(e){this.multisig_address.serialize(e),this.transaction_payload===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.transaction_payload.serialize(e))}static deserialize(e){let r=y.deserialize(e),i=e.deserializeBool(),n;return i&&(n=b.deserialize(e)),new t(r,n)}},b=class t extends u{constructor(e){super(),this.transaction_payload=e}serialize(e){e.serializeU32AsUleb128(0),this.transaction_payload.serialize(e)}static deserialize(e){return e.deserializeUleb128AsU32(),new t(l.deserialize(e))}};export{D as a,a as b,A as c,z as d,h as e,l as f,U as g,f as h,b as i};
2
- //# sourceMappingURL=chunk-5SQAHWDI.mjs.map
@@ -1,2 +0,0 @@
1
- import{b as r}from"./chunk-T2WZWN6W.mjs";async function i(e){let{aptosConfig:t,overrides:s,params:n,contentType:o,acceptType:p,path:a,originMethod:d,type:R}=e,u=t.getRequestUrl(R);return r({url:u,method:"GET",originMethod:d,path:a,contentType:o,acceptType:p,params:n,overrides:{...t.clientConfig,...s}},t,e.type)}async function c(e){let{aptosConfig:t}=e;return i({...e,type:"Fullnode",overrides:{...t.clientConfig,...t.fullnodeConfig,...e.overrides,HEADERS:{...t.clientConfig?.HEADERS,...t.fullnodeConfig?.HEADERS}}})}async function y(e){let t=[],s,n=e.params;do{let o=await i({type:"Fullnode",aptosConfig:e.aptosConfig,originMethod:e.originMethod,path:e.path,params:n,overrides:e.overrides});s=o.headers["x-aptos-cursor"],delete o.headers,t.push(...o.data),n.start=s}while(s!=null);return t}export{i as a,c as b,y as c};
2
- //# sourceMappingURL=chunk-5TTCAW72.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/client/get.ts"],"sourcesContent":["import { AptosConfig } from \"../api/aptosConfig\";\nimport { aptosRequest } from \"./core\";\nimport { AptosResponse } from \"./types\";\nimport { AnyNumber, ClientConfig, MimeType } from \"../types\";\nimport { AptosApiType } from \"../utils/const\";\n\nexport type GetRequestOptions = {\n /**\n * The config for the API client\n */\n aptosConfig: AptosConfig;\n /**\n * The type of API endpoint to call e.g. fullnode, indexer, etc\n */\n type: AptosApiType;\n /**\n * The name of the API method\n */\n originMethod: string;\n /**\n * The URL path to the API method\n */\n path: string;\n /**\n * The content type of the request body\n */\n contentType?: MimeType;\n /**\n * The accepted content type of the response of the API\n */\n acceptType?: MimeType;\n /**\n * The query parameters for the request\n */\n params?: Record<string, string | AnyNumber | boolean | undefined>;\n /**\n * Specific client overrides for this request to override aptosConfig\n */\n overrides?: ClientConfig;\n};\n\nexport type GetAptosRequestOptions = Omit<GetRequestOptions, \"type\">;\n\n/**\n * Main function to do a Get request\n *\n * @param options GetRequestOptions\n * @returns\n */\nexport async function get<Req extends {}, Res extends {}>(\n options: GetRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { aptosConfig, overrides, params, contentType, acceptType, path, originMethod, type } = options;\n const url = aptosConfig.getRequestUrl(type);\n\n return aptosRequest<Req, Res>(\n {\n url,\n method: \"GET\",\n originMethod,\n path,\n contentType,\n acceptType,\n params,\n overrides: {\n ...aptosConfig.clientConfig,\n ...overrides,\n },\n },\n aptosConfig,\n options.type,\n );\n}\n\nexport async function getAptosFullNode<Req extends {}, Res extends {}>(\n options: GetAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { aptosConfig } = options;\n\n return get<Req, Res>({\n ...options,\n type: AptosApiType.FULLNODE,\n overrides: {\n ...aptosConfig.clientConfig,\n ...aptosConfig.fullnodeConfig,\n ...options.overrides,\n HEADERS: { ...aptosConfig.clientConfig?.HEADERS, ...aptosConfig.fullnodeConfig?.HEADERS },\n },\n });\n}\n\n/// This function is a helper for paginating using a function wrapping an API\nexport async function paginateWithCursor<Req extends Record<string, any>, Res extends Array<{}>>(\n options: GetAptosRequestOptions,\n): Promise<Res> {\n const out: any[] = [];\n let cursor: string | undefined;\n const requestParams = options.params as { start?: string; limit?: number };\n do {\n // eslint-disable-next-line no-await-in-loop\n const response = await get<Req, Res>({\n type: AptosApiType.FULLNODE,\n aptosConfig: options.aptosConfig,\n originMethod: options.originMethod,\n path: options.path,\n params: requestParams,\n overrides: options.overrides,\n });\n /**\n * the cursor is a \"state key\" from the API perspective. Client\n * should not need to \"care\" what it represents but just use it\n * to query the next chunk of data.\n */\n cursor = response.headers[\"x-aptos-cursor\"];\n // Now that we have the cursor (if any), we remove the headers before\n // adding these to the output of this function.\n delete response.headers;\n out.push(...response.data);\n requestParams.start = cursor;\n } while (cursor !== null && cursor !== undefined);\n return out as Res;\n}\n"],"mappings":"yCAiDA,eAAsBA,EACpBC,EACkC,CAClC,GAAM,CAAE,YAAAC,EAAa,UAAAC,EAAW,OAAAC,EAAQ,YAAAC,EAAa,WAAAC,EAAY,KAAAC,EAAM,aAAAC,EAAc,KAAAC,CAAK,EAAIR,EACxFS,EAAMR,EAAY,cAAcO,CAAI,EAE1C,OAAOE,EACL,CACE,IAAAD,EACA,OAAQ,MACR,aAAAF,EACA,KAAAD,EACA,YAAAF,EACA,WAAAC,EACA,OAAAF,EACA,UAAW,CACT,GAAGF,EAAY,aACf,GAAGC,CACL,CACF,EACAD,EACAD,EAAQ,IACV,CACF,CAEA,eAAsBW,EACpBX,EACkC,CAClC,GAAM,CAAE,YAAAC,CAAY,EAAID,EAExB,OAAOD,EAAc,CACnB,GAAGC,EACH,gBACA,UAAW,CACT,GAAGC,EAAY,aACf,GAAGA,EAAY,eACf,GAAGD,EAAQ,UACX,QAAS,CAAE,GAAGC,EAAY,cAAc,QAAS,GAAGA,EAAY,gBAAgB,OAAQ,CAC1F,CACF,CAAC,CACH,CAGA,eAAsBW,EACpBZ,EACc,CACd,IAAMa,EAAa,CAAC,EAChBC,EACEC,EAAgBf,EAAQ,OAC9B,EAAG,CAED,IAAMgB,EAAW,MAAMjB,EAAc,CACnC,gBACA,YAAaC,EAAQ,YACrB,aAAcA,EAAQ,aACtB,KAAMA,EAAQ,KACd,OAAQe,EACR,UAAWf,EAAQ,SACrB,CAAC,EAMDc,EAASE,EAAS,QAAQ,gBAAgB,EAG1C,OAAOA,EAAS,QAChBH,EAAI,KAAK,GAAGG,EAAS,IAAI,EACzBD,EAAc,MAAQD,CACxB,OAASA,GAAW,MACpB,OAAOD,CACT","names":["get","options","aptosConfig","overrides","params","contentType","acceptType","path","originMethod","type","url","aptosRequest","getAptosFullNode","paginateWithCursor","out","cursor","requestParams","response"]}
@@ -1,2 +0,0 @@
1
- import{c as t}from"./chunk-56CNRT2K.mjs";var n=class{constructor(e){this.buffer=new ArrayBuffer(e.length),new Uint8Array(this.buffer).set(e,0),this.offset=0}read(e){if(this.offset+e>this.buffer.byteLength)throw new Error("Reached to the end of buffer");let i=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,i}deserializeStr(){let e=this.deserializeBytes();return new TextDecoder().decode(e)}deserializeBytes(){let e=this.deserializeUleb128AsU32();return new Uint8Array(this.read(e))}deserializeFixedBytes(e){return new Uint8Array(this.read(e))}deserializeBool(){let e=new Uint8Array(this.read(1))[0];if(e!==1&&e!==0)throw new Error("Invalid boolean value");return e===1}deserializeU8(){return new DataView(this.read(1)).getUint8(0)}deserializeU16(){return new DataView(this.read(2)).getUint16(0,!0)}deserializeU32(){return new DataView(this.read(4)).getUint32(0,!0)}deserializeU64(){let e=this.deserializeU32(),i=this.deserializeU32();return BigInt(BigInt(i)<<BigInt(32)|BigInt(e))}deserializeU128(){let e=this.deserializeU64(),i=this.deserializeU64();return BigInt(i<<BigInt(64)|e)}deserializeU256(){let e=this.deserializeU128(),i=this.deserializeU128();return BigInt(i<<BigInt(128)|e)}deserializeUleb128AsU32(){let e=BigInt(0),i=0;for(;e<t;){let r=this.deserializeU8();if(e|=BigInt(r&127)<<BigInt(i),!(r&128))break;i+=7}if(e>t)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(e)}deserialize(e){return e.deserialize(this)}deserializeVector(e){let i=this.deserializeUleb128AsU32(),r=new Array;for(let s=0;s<i;s+=1)r.push(this.deserialize(e));return r}};export{n as a};
2
- //# sourceMappingURL=chunk-6IFMQ5AS.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/bcs/deserializer.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable no-bitwise */\nimport { MAX_U32_NUMBER } from \"./consts\";\nimport { Uint8, Uint16, Uint32, Uint64, Uint128, Uint256 } from \"../types\";\n\n/**\n * This interface exists to define Deserializable<T> inputs for functions that\n * deserialize a byte buffer into a type T.\n * It is not intended to be implemented or extended, because Typescript has no support\n * for static methods in interfaces.\n */\nexport interface Deserializable<T> {\n deserialize(deserializer: Deserializer): T;\n}\n\nexport class Deserializer {\n private buffer: ArrayBuffer;\n\n private offset: number;\n\n constructor(data: Uint8Array) {\n // copies data to prevent outside mutation of buffer.\n this.buffer = new ArrayBuffer(data.length);\n new Uint8Array(this.buffer).set(data, 0);\n this.offset = 0;\n }\n\n private read(length: number): ArrayBuffer {\n if (this.offset + length > this.buffer.byteLength) {\n throw new Error(\"Reached to the end of buffer\");\n }\n\n const bytes = this.buffer.slice(this.offset, this.offset + length);\n this.offset += length;\n return bytes;\n }\n\n /**\n * Deserializes a string. UTF8 string is supported. Reads the string's bytes length \"l\" first,\n * and then reads \"l\" bytes of content. Decodes the byte array into a string.\n *\n * BCS layout for \"string\": string_length | string_content\n * where string_length is a u32 integer encoded as a uleb128 integer, equal to the number of bytes in string_content.\n *\n * @example\n * ```ts\n * const deserializer = new Deserializer(new Uint8Array([8, 49, 50, 51, 52, 97, 98, 99, 100]));\n * assert(deserializer.deserializeStr() === \"1234abcd\");\n * ```\n */\n deserializeStr(): string {\n const value = this.deserializeBytes();\n const textDecoder = new TextDecoder();\n return textDecoder.decode(value);\n }\n\n /**\n * Deserializes an array of bytes.\n *\n * BCS layout for \"bytes\": bytes_length | bytes\n * where bytes_length is a u32 integer encoded as a uleb128 integer, equal to the length of the bytes array.\n */\n deserializeBytes(): Uint8Array {\n const len = this.deserializeUleb128AsU32();\n return new Uint8Array(this.read(len));\n }\n\n /**\n * Deserializes an array of bytes. The number of bytes to read is already known.\n *\n */\n deserializeFixedBytes(len: number): Uint8Array {\n return new Uint8Array(this.read(len));\n }\n\n /**\n * Deserializes a boolean value.\n *\n * BCS layout for \"boolean\": One byte. \"0x01\" for true and \"0x00\" for false.\n */\n deserializeBool(): boolean {\n const bool = new Uint8Array(this.read(1))[0];\n if (bool !== 1 && bool !== 0) {\n throw new Error(\"Invalid boolean value\");\n }\n return bool === 1;\n }\n\n /**\n * Deserializes a uint8 number.\n *\n * BCS layout for \"uint8\": One byte. Binary format in little-endian representation.\n */\n deserializeU8(): Uint8 {\n return new DataView(this.read(1)).getUint8(0);\n }\n\n /**\n * Deserializes a uint16 number.\n *\n * BCS layout for \"uint16\": Two bytes. Binary format in little-endian representation.\n * @example\n * ```ts\n * const deserializer = new Deserializer(new Uint8Array([0x34, 0x12]));\n * assert(deserializer.deserializeU16() === 4660);\n * ```\n */\n deserializeU16(): Uint16 {\n return new DataView(this.read(2)).getUint16(0, true);\n }\n\n /**\n * Deserializes a uint32 number.\n *\n * BCS layout for \"uint32\": Four bytes. Binary format in little-endian representation.\n * @example\n * ```ts\n * const deserializer = new Deserializer(new Uint8Array([0x78, 0x56, 0x34, 0x12]));\n * assert(deserializer.deserializeU32() === 305419896);\n * ```\n */\n deserializeU32(): Uint32 {\n return new DataView(this.read(4)).getUint32(0, true);\n }\n\n /**\n * Deserializes a uint64 number.\n *\n * BCS layout for \"uint64\": Eight bytes. Binary format in little-endian representation.\n * @example\n * ```ts\n * const deserializer = new Deserializer(new Uint8Array([0x00, 0xEF, 0xCD, 0xAB, 0x78, 0x56, 0x34, 0x12]));\n * assert(deserializer.deserializeU64() === 1311768467750121216);\n * ```\n */\n deserializeU64(): Uint64 {\n const low = this.deserializeU32();\n const high = this.deserializeU32();\n\n // combine the two 32-bit values and return (little endian)\n return BigInt((BigInt(high) << BigInt(32)) | BigInt(low));\n }\n\n /**\n * Deserializes a uint128 number.\n *\n * BCS layout for \"uint128\": Sixteen bytes. Binary format in little-endian representation.\n */\n deserializeU128(): Uint128 {\n const low = this.deserializeU64();\n const high = this.deserializeU64();\n\n // combine the two 64-bit values and return (little endian)\n return BigInt((high << BigInt(64)) | low);\n }\n\n /**\n * Deserializes a uint256 number.\n *\n * BCS layout for \"uint256\": Thirty-two bytes. Binary format in little-endian representation.\n */\n deserializeU256(): Uint256 {\n const low = this.deserializeU128();\n const high = this.deserializeU128();\n\n // combine the two 128-bit values and return (little endian)\n return BigInt((high << BigInt(128)) | low);\n }\n\n /**\n * Deserializes a uleb128 encoded uint32 number.\n *\n * BCS use uleb128 encoding in two cases: (1) lengths of variable-length sequences and (2) tags of enum values\n */\n deserializeUleb128AsU32(): Uint32 {\n let value: bigint = BigInt(0);\n let shift = 0;\n\n while (value < MAX_U32_NUMBER) {\n const byte = this.deserializeU8();\n value |= BigInt(byte & 0x7f) << BigInt(shift);\n\n if ((byte & 0x80) === 0) {\n break;\n }\n shift += 7;\n }\n\n if (value > MAX_U32_NUMBER) {\n throw new Error(\"Overflow while parsing uleb128-encoded uint32 value\");\n }\n\n return Number(value);\n }\n\n /**\n * Helper function that primarily exists to support alternative syntax for deserialization.\n * That is, if we have a `const deserializer: new Deserializer(...)`, instead of having to use\n * `MyClass.deserialize(deserializer)`, we can call `deserializer.deserialize(MyClass)`.\n *\n * @example const deserializer = new Deserializer(new Uint8Array([1, 2, 3]));\n * const value = deserializer.deserialize(MyClass); // where MyClass has a `deserialize` function\n * // value is now an instance of MyClass\n * // equivalent to `const value = MyClass.deserialize(deserializer)`\n * @param cls The BCS-deserializable class to deserialize the buffered bytes into.\n *\n * @returns the deserialized value of class type T\n */\n deserialize<T>(cls: Deserializable<T>): T {\n // NOTE: `deserialize` in `cls.deserialize(this)` here is a static method defined in `cls`,\n // It is separate from the `deserialize` instance method defined here in Deserializer.\n return cls.deserialize(this);\n }\n\n /**\n * Deserializes an array of BCS Deserializable values given an existing Deserializer\n * instance with a loaded byte buffer.\n *\n * @param cls The BCS-deserializable class to deserialize the buffered bytes into.\n * @example\n * // serialize a vector of addresses\n * const addresses = new Array<AccountAddress>(\n * AccountAddress.from(\"0x1\"),\n * AccountAddress.from(\"0x2\"),\n * AccountAddress.from(\"0xa\"),\n * AccountAddress.from(\"0xb\"),\n * );\n * const serializer = new Serializer();\n * serializer.serializeVector(addresses);\n * const serializedBytes = serializer.toUint8Array();\n *\n * // deserialize the bytes into an array of addresses\n * const deserializer = new Deserializer(serializedBytes);\n * const deserializedAddresses = deserializer.deserializeVector(AccountAddress);\n * // deserializedAddresses is now an array of AccountAddress instances\n * @returns an array of deserialized values of type T\n */\n deserializeVector<T>(cls: Deserializable<T>): Array<T> {\n const length = this.deserializeUleb128AsU32();\n const vector = new Array<T>();\n for (let i = 0; i < length; i += 1) {\n vector.push(this.deserialize(cls));\n }\n return vector;\n }\n}\n"],"mappings":"yCAiBO,IAAMA,EAAN,KAAmB,CAKxB,YAAYC,EAAkB,CAE5B,KAAK,OAAS,IAAI,YAAYA,EAAK,MAAM,EACzC,IAAI,WAAW,KAAK,MAAM,EAAE,IAAIA,EAAM,CAAC,EACvC,KAAK,OAAS,CAChB,CAEQ,KAAKC,EAA6B,CACxC,GAAI,KAAK,OAASA,EAAS,KAAK,OAAO,WACrC,MAAM,IAAI,MAAM,8BAA8B,EAGhD,IAAMC,EAAQ,KAAK,OAAO,MAAM,KAAK,OAAQ,KAAK,OAASD,CAAM,EACjE,YAAK,QAAUA,EACRC,CACT,CAeA,gBAAyB,CACvB,IAAMC,EAAQ,KAAK,iBAAiB,EAEpC,OADoB,IAAI,YAAY,EACjB,OAAOA,CAAK,CACjC,CAQA,kBAA+B,CAC7B,IAAMC,EAAM,KAAK,wBAAwB,EACzC,OAAO,IAAI,WAAW,KAAK,KAAKA,CAAG,CAAC,CACtC,CAMA,sBAAsBA,EAAyB,CAC7C,OAAO,IAAI,WAAW,KAAK,KAAKA,CAAG,CAAC,CACtC,CAOA,iBAA2B,CACzB,IAAMC,EAAO,IAAI,WAAW,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC,EAC3C,GAAIA,IAAS,GAAKA,IAAS,EACzB,MAAM,IAAI,MAAM,uBAAuB,EAEzC,OAAOA,IAAS,CAClB,CAOA,eAAuB,CACrB,OAAO,IAAI,SAAS,KAAK,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAC9C,CAYA,gBAAyB,CACvB,OAAO,IAAI,SAAS,KAAK,KAAK,CAAC,CAAC,EAAE,UAAU,EAAG,EAAI,CACrD,CAYA,gBAAyB,CACvB,OAAO,IAAI,SAAS,KAAK,KAAK,CAAC,CAAC,EAAE,UAAU,EAAG,EAAI,CACrD,CAYA,gBAAyB,CACvB,IAAMC,EAAM,KAAK,eAAe,EAC1BC,EAAO,KAAK,eAAe,EAGjC,OAAO,OAAQ,OAAOA,CAAI,GAAK,OAAO,EAAE,EAAK,OAAOD,CAAG,CAAC,CAC1D,CAOA,iBAA2B,CACzB,IAAMA,EAAM,KAAK,eAAe,EAC1BC,EAAO,KAAK,eAAe,EAGjC,OAAO,OAAQA,GAAQ,OAAO,EAAE,EAAKD,CAAG,CAC1C,CAOA,iBAA2B,CACzB,IAAMA,EAAM,KAAK,gBAAgB,EAC3BC,EAAO,KAAK,gBAAgB,EAGlC,OAAO,OAAQA,GAAQ,OAAO,GAAG,EAAKD,CAAG,CAC3C,CAOA,yBAAkC,CAChC,IAAIH,EAAgB,OAAO,CAAC,EACxBK,EAAQ,EAEZ,KAAOL,EAAQM,GAAgB,CAC7B,IAAMC,EAAO,KAAK,cAAc,EAGhC,GAFAP,GAAS,OAAOO,EAAO,GAAI,GAAK,OAAOF,CAAK,EAEvC,EAAAE,EAAO,KACV,MAEFF,GAAS,CACX,CAEA,GAAIL,EAAQM,EACV,MAAM,IAAI,MAAM,qDAAqD,EAGvE,OAAO,OAAON,CAAK,CACrB,CAeA,YAAeQ,EAA2B,CAGxC,OAAOA,EAAI,YAAY,IAAI,CAC7B,CAyBA,kBAAqBA,EAAkC,CACrD,IAAMV,EAAS,KAAK,wBAAwB,EACtCW,EAAS,IAAI,MACnB,QAASC,EAAI,EAAGA,EAAIZ,EAAQY,GAAK,EAC/BD,EAAO,KAAK,KAAK,YAAYD,CAAG,CAAC,EAEnC,OAAOC,CACT,CACF","names":["Deserializer","data","length","bytes","value","len","bool","low","high","shift","MAX_U32_NUMBER","byte","cls","vector","i"]}
@@ -1,2 +0,0 @@
1
- import{e as o}from"./chunk-LGOZUIGE.mjs";import{a as g,b as c}from"./chunk-AWPRGMUP.mjs";var y=class a{constructor(i){let{multiKey:n,signers:s}=i;this.publicKey=n,this.signingScheme=3,this.accountAddress=this.publicKey.authKey().derivedAddress();let r=[];for(let e of s)r.push(this.publicKey.getIndex(e.publicKey));let t=s.map((e,u)=>[e,r[u]]);t.sort((e,u)=>e[1]-u[1]),this.signers=t.map(e=>e[0]),this.signerIndicies=t.map(e=>e[1]),this.signaturesBitmap=this.publicKey.createBitmap({bits:r})}static fromPublicKeysAndSigners(i){let{publicKeys:n,signaturesRequired:s,signers:r}=i,t=new g({publicKeys:n,signaturesRequired:s});return new a({multiKey:t,signers:r})}static isMultiKeySigner(i){return i instanceof a}signWithAuthenticator(i){return new o(this.publicKey,this.sign(i))}signTransactionWithAuthenticator(i){return new o(this.publicKey,this.signTransaction(i))}sign(i){let n=[];for(let s of this.signers)n.push(s.sign(i));return new c({signatures:n,bitmap:this.signaturesBitmap})}signTransaction(i){let n=[];for(let s of this.signers)n.push(s.signTransaction(i));return new c({signatures:n,bitmap:this.signaturesBitmap})}verifySignature(i){let{message:n,signature:s}=i;if(!this.signerIndicies.every((t,e)=>e===0||t>=this.signerIndicies[e-1]))return!1;for(let t=0;t<s.signatures.length;t+=1){let e=s.signatures[t];if(!this.publicKey.publicKeys[this.signerIndicies[t]].verifySignature({message:n,signature:e}))return!1}return!0}};export{y as a};
2
- //# sourceMappingURL=chunk-6JFZZLRC.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/account/MultiKeyAccount.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Account } from \"./Account\";\nimport { MultiKey, MultiKeySignature, PublicKey } from \"../core/crypto\";\nimport { AccountAddress } from \"../core/accountAddress\";\nimport { HexInput, SigningScheme } from \"../types\";\nimport { AccountAuthenticatorMultiKey } from \"../transactions/authenticator/account\";\nimport { AnyRawTransaction } from \"../transactions/types\";\n\nexport interface VerifyMultiKeySignatureArgs {\n message: HexInput;\n signature: MultiKeySignature;\n}\n\n/**\n * Signer implementation for the MultiKey authentication scheme.\n *\n * This accounts to use a M of N signing scheme. M and N are specified in the {@link MultiKey}\n * It signs messages via the array of M number of Accounts that individually correspond to a public key in the {@link MultiKey}.\n *\n * Note: Generating a signer instance does not create the account on-chain.\n */\nexport class MultiKeyAccount implements Account {\n /**\n * Public key associated with the account\n */\n readonly publicKey: MultiKey;\n\n /**\n * Account address associated with the account\n */\n readonly accountAddress: AccountAddress;\n\n /**\n * Signing scheme used to sign transactions\n */\n readonly signingScheme: SigningScheme;\n\n /**\n * The signers used to sign messages. These signers should correspond to public keys in the\n * MultiKeyAccount's public key. The number of signers should be equal or greater\n * than this.publicKey.signaturesRequired\n */\n readonly signers: Account[];\n\n /**\n * An array of indicies where for signer[i], signerIndicies[i] is the index of the corresponding public key in\n * publicKey.publicKeys. Used to derive the right public key to use for verification.\n */\n readonly signerIndicies: number[];\n\n readonly signaturesBitmap: Uint8Array;\n\n /**\n * constructor for MultiKeyAccount\n *\n * @param args.multiKey the multikey of the account which consists of N public keys and a number M which is\n * the number of required signatures.\n * @param args.signers an array of M signers that will be used to sign the transaction\n * @returns MultiKeyAccount\n */\n constructor(args: { multiKey: MultiKey; signers: Account[] }) {\n const { multiKey, signers } = args;\n\n this.publicKey = multiKey;\n this.signingScheme = SigningScheme.MultiKey;\n\n this.accountAddress = this.publicKey.authKey().derivedAddress();\n\n // Get the index of each respective signer in the bitmap\n const bitPositions: number[] = [];\n for (const signer of signers) {\n bitPositions.push(this.publicKey.getIndex(signer.publicKey));\n }\n // Zip signers and bit positions and sort signers by bit positions in order\n // to ensure the signature is signed in ascending order according to the bitmap.\n // Authentication on chain will fail otherwise.\n const signersAndBitPosition: [Account, number][] = signers.map((signer, index) => [signer, bitPositions[index]]);\n signersAndBitPosition.sort((a, b) => a[1] - b[1]);\n this.signers = signersAndBitPosition.map((value) => value[0]);\n this.signerIndicies = signersAndBitPosition.map((value) => value[1]);\n this.signaturesBitmap = this.publicKey.createBitmap({ bits: bitPositions });\n }\n\n /**\n * Static constructor for MultiKeyAccount\n *\n * @param args.publicKeys the N public keys of the MultiKeyAccount\n * @param args.signaturesRequired the number of signatures required\n * @param args.signers an array of M signers that will be used to sign the transaction\n * @returns MultiKeyAccount\n */\n static fromPublicKeysAndSigners(args: {\n publicKeys: PublicKey[];\n signaturesRequired: number;\n signers: Account[];\n }): MultiKeyAccount {\n const { publicKeys, signaturesRequired, signers } = args;\n const multiKey = new MultiKey({ publicKeys, signaturesRequired });\n return new MultiKeyAccount({ multiKey, signers });\n }\n\n static isMultiKeySigner(account: Account): account is MultiKeyAccount {\n return account instanceof MultiKeyAccount;\n }\n\n /**\n * Sign a message using the account's signers.\n * @param message the signing message, as binary input\n * @return the AccountAuthenticator containing the signature, together with the account's public key\n */\n signWithAuthenticator(message: HexInput): AccountAuthenticatorMultiKey {\n return new AccountAuthenticatorMultiKey(this.publicKey, this.sign(message));\n }\n\n /**\n * Sign a transaction using the account's signers.\n * @param transaction the raw transaction\n * @return the AccountAuthenticator containing the signature of the transaction, together with the account's public key\n */\n signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorMultiKey {\n return new AccountAuthenticatorMultiKey(this.publicKey, this.signTransaction(transaction));\n }\n\n /**\n * Sign the given message using the MultiKeyAccount's signers\n * @param message in HexInput format\n * @returns MultiKeySignature\n */\n sign(data: HexInput): MultiKeySignature {\n const signatures = [];\n for (const signer of this.signers) {\n signatures.push(signer.sign(data));\n }\n return new MultiKeySignature({ signatures, bitmap: this.signaturesBitmap });\n }\n\n /**\n * Sign the given transaction using the MultiKeyAccount's signers\n * @param transaction the transaction to be signed\n * @returns MultiKeySignature\n */\n signTransaction(transaction: AnyRawTransaction): MultiKeySignature {\n const signatures = [];\n for (const signer of this.signers) {\n signatures.push(signer.signTransaction(transaction));\n }\n return new MultiKeySignature({ signatures, bitmap: this.signaturesBitmap });\n }\n\n /**\n * Verify the given message and signature with the public key.\n *\n * @param args.message raw message data in HexInput format\n * @param args.signatures signed message MultiKeySignature\n * @returns boolean\n */\n verifySignature(args: VerifyMultiKeySignatureArgs): boolean {\n const { message, signature } = args;\n const isSignerIndiciesSorted = this.signerIndicies.every(\n (value, i) => i === 0 || value >= this.signerIndicies[i - 1],\n );\n if (!isSignerIndiciesSorted) {\n return false;\n }\n for (let i = 0; i < signature.signatures.length; i += 1) {\n const singleSignature = signature.signatures[i];\n const publicKey = this.publicKey.publicKeys[this.signerIndicies[i]];\n if (!publicKey.verifySignature({ message, signature: singleSignature })) {\n return false;\n }\n }\n return true;\n }\n}\n"],"mappings":"yFAuBO,IAAMA,EAAN,MAAMC,CAAmC,CAuC9C,YAAYC,EAAkD,CAC5D,GAAM,CAAE,SAAAC,EAAU,QAAAC,CAAQ,EAAIF,EAE9B,KAAK,UAAYC,EACjB,KAAK,cAAgB,EAErB,KAAK,eAAiB,KAAK,UAAU,QAAQ,EAAE,eAAe,EAG9D,IAAME,EAAyB,CAAC,EAChC,QAAWC,KAAUF,EACnBC,EAAa,KAAK,KAAK,UAAU,SAASC,EAAO,SAAS,CAAC,EAK7D,IAAMC,EAA6CH,EAAQ,IAAI,CAACE,EAAQE,IAAU,CAACF,EAAQD,EAAaG,CAAK,CAAC,CAAC,EAC/GD,EAAsB,KAAK,CAACE,EAAGC,IAAMD,EAAE,CAAC,EAAIC,EAAE,CAAC,CAAC,EAChD,KAAK,QAAUH,EAAsB,IAAKI,GAAUA,EAAM,CAAC,CAAC,EAC5D,KAAK,eAAiBJ,EAAsB,IAAKI,GAAUA,EAAM,CAAC,CAAC,EACnE,KAAK,iBAAmB,KAAK,UAAU,aAAa,CAAE,KAAMN,CAAa,CAAC,CAC5E,CAUA,OAAO,yBAAyBH,EAIZ,CAClB,GAAM,CAAE,WAAAU,EAAY,mBAAAC,EAAoB,QAAAT,CAAQ,EAAIF,EAC9CC,EAAW,IAAIW,EAAS,CAAE,WAAAF,EAAY,mBAAAC,CAAmB,CAAC,EAChE,OAAO,IAAIZ,EAAgB,CAAE,SAAAE,EAAU,QAAAC,CAAQ,CAAC,CAClD,CAEA,OAAO,iBAAiBW,EAA8C,CACpE,OAAOA,aAAmBd,CAC5B,CAOA,sBAAsBe,EAAiD,CACrE,OAAO,IAAIC,EAA6B,KAAK,UAAW,KAAK,KAAKD,CAAO,CAAC,CAC5E,CAOA,iCAAiCE,EAA8D,CAC7F,OAAO,IAAID,EAA6B,KAAK,UAAW,KAAK,gBAAgBC,CAAW,CAAC,CAC3F,CAOA,KAAKC,EAAmC,CACtC,IAAMC,EAAa,CAAC,EACpB,QAAWd,KAAU,KAAK,QACxBc,EAAW,KAAKd,EAAO,KAAKa,CAAI,CAAC,EAEnC,OAAO,IAAIE,EAAkB,CAAE,WAAAD,EAAY,OAAQ,KAAK,gBAAiB,CAAC,CAC5E,CAOA,gBAAgBF,EAAmD,CACjE,IAAME,EAAa,CAAC,EACpB,QAAWd,KAAU,KAAK,QACxBc,EAAW,KAAKd,EAAO,gBAAgBY,CAAW,CAAC,EAErD,OAAO,IAAIG,EAAkB,CAAE,WAAAD,EAAY,OAAQ,KAAK,gBAAiB,CAAC,CAC5E,CASA,gBAAgBlB,EAA4C,CAC1D,GAAM,CAAE,QAAAc,EAAS,UAAAM,CAAU,EAAIpB,EAI/B,GAAI,CAH2B,KAAK,eAAe,MACjD,CAACS,EAAOY,IAAMA,IAAM,GAAKZ,GAAS,KAAK,eAAeY,EAAI,CAAC,CAC7D,EAEE,MAAO,GAET,QAASA,EAAI,EAAGA,EAAID,EAAU,WAAW,OAAQC,GAAK,EAAG,CACvD,IAAMC,EAAkBF,EAAU,WAAWC,CAAC,EAE9C,GAAI,CADc,KAAK,UAAU,WAAW,KAAK,eAAeA,CAAC,CAAC,EACnD,gBAAgB,CAAE,QAAAP,EAAS,UAAWQ,CAAgB,CAAC,EACpE,MAAO,EAEX,CACA,MAAO,EACT,CACF","names":["MultiKeyAccount","_MultiKeyAccount","args","multiKey","signers","bitPositions","signer","signersAndBitPosition","index","a","b","value","publicKeys","signaturesRequired","MultiKey","account","message","AccountAuthenticatorMultiKey","transaction","data","signatures","MultiKeySignature","signature","i","singleSignature"]}
@@ -1,2 +0,0 @@
1
- import{a as r}from"./chunk-4KMISR2H.mjs";import{b as t}from"./chunk-BCUSI3N6.mjs";var o=class extends r{toString(){let i=this.toUint8Array();return t.fromHexInput(i).toString()}};export{o as a};
2
- //# sourceMappingURL=chunk-AFTMLXYT.mjs.map
@@ -1,2 +0,0 @@
1
- import{a as u}from"./chunk-OLKEU7WZ.mjs";import{a as m}from"./chunk-DO444YYD.mjs";import{a as h}from"./chunk-DBC2JY65.mjs";import{a as A}from"./chunk-RTSWVT2Q.mjs";import{a as r}from"./chunk-FW6TF3O2.mjs";import{a}from"./chunk-HMTYASEZ.mjs";import{a as c}from"./chunk-YTJ73ZX3.mjs";import{a as f}from"./chunk-AKJZL3HT.mjs";import{a as g}from"./chunk-BCLP2ENK.mjs";import{a as l}from"./chunk-VEB6NALT.mjs";import{a as s}from"./chunk-UF5B4XMN.mjs";import{a as p}from"./chunk-LM7CN4LT.mjs";var t=class{constructor(i){this.config=new A(i),this.account=new s(this.config),this.ans=new p(this.config),this.coin=new r(this.config),this.digitalAsset=new a(this.config),this.event=new c(this.config),this.faucet=new f(this.config),this.fungibleAsset=new g(this.config),this.general=new l(this.config),this.staking=new u(this.config),this.transaction=new h(this.config),this.table=new m(this.config)}};function n(y,i,d){Object.getOwnPropertyNames(i.prototype).forEach(e=>{let o=Object.getOwnPropertyDescriptor(i.prototype,e);o&&(o.value=function(...b){return this[d][e](...b)},Object.defineProperty(y.prototype,e,o))})}n(t,s,"account");n(t,p,"ans");n(t,r,"coin");n(t,a,"digitalAsset");n(t,c,"event");n(t,f,"faucet");n(t,g,"fungibleAsset");n(t,l,"general");n(t,u,"staking");n(t,h,"transaction");n(t,m,"table");export{t as a};
2
- //# sourceMappingURL=chunk-CCQRMKD2.mjs.map