@aptos-labs/ts-sdk 1.35.0-zeta.2 → 1.36.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 (596) hide show
  1. package/dist/common/{accountAddress-Ce4Cv60D.d.ts → accountAddress-C685VEzA.d.ts} +11 -99
  2. package/dist/common/chunk-5GUWOXQG.js +4 -0
  3. package/dist/common/chunk-5GUWOXQG.js.map +1 -0
  4. package/dist/common/cli/index.d.ts +1 -1
  5. package/dist/common/cli/index.js +1 -486
  6. package/dist/common/cli/index.js.map +1 -1
  7. package/dist/common/index.d.ts +9105 -8699
  8. package/dist/common/index.js +436 -18333
  9. package/dist/common/index.js.map +1 -1
  10. package/dist/esm/{Ed25519Account-D4j3_WIS.d.mts → Ed25519Account-6KGApCPu.d.mts} +3 -3
  11. package/dist/esm/account/AbstractKeylessAccount.d.mts +23 -13
  12. package/dist/esm/account/AbstractKeylessAccount.mjs +1 -75
  13. package/dist/esm/account/AbstractedAccount.d.mts +10 -10
  14. package/dist/esm/account/AbstractedAccount.mjs +1 -74
  15. package/dist/esm/account/Account.d.mts +6 -6
  16. package/dist/esm/account/Account.mjs +1 -72
  17. package/dist/esm/account/AccountUtils.d.mts +11 -10
  18. package/dist/esm/account/AccountUtils.mjs +1 -78
  19. package/dist/esm/account/Ed25519Account.d.mts +5 -5
  20. package/dist/esm/account/Ed25519Account.mjs +1 -70
  21. package/dist/esm/account/EphemeralKeyPair.d.mts +3 -1
  22. package/dist/esm/account/EphemeralKeyPair.mjs +1 -50
  23. package/dist/esm/account/FederatedKeylessAccount.d.mts +12 -11
  24. package/dist/esm/account/FederatedKeylessAccount.mjs +1 -72
  25. package/dist/esm/account/KeylessAccount.d.mts +12 -11
  26. package/dist/esm/account/KeylessAccount.mjs +1 -72
  27. package/dist/esm/account/MultiEd25519Account.d.mts +9 -9
  28. package/dist/esm/account/MultiEd25519Account.mjs +1 -70
  29. package/dist/esm/account/MultiKeyAccount.d.mts +34 -12
  30. package/dist/esm/account/MultiKeyAccount.mjs +1 -74
  31. package/dist/esm/account/SingleKeyAccount.d.mts +5 -5
  32. package/dist/esm/account/SingleKeyAccount.mjs +1 -72
  33. package/dist/esm/account/index.d.mts +7 -6
  34. package/dist/esm/account/index.mjs +1 -119
  35. package/dist/esm/account/utils.mjs +1 -54
  36. package/dist/esm/api/account/abstraction.d.mts +9 -9
  37. package/dist/esm/api/account/abstraction.mjs +1 -101
  38. package/dist/esm/api/account.d.mts +4 -20
  39. package/dist/esm/api/account.mjs +1 -105
  40. package/dist/esm/api/ans.d.mts +13 -13
  41. package/dist/esm/api/ans.mjs +1 -101
  42. package/dist/esm/api/aptos.d.mts +6 -5
  43. package/dist/esm/api/aptos.mjs +1 -139
  44. package/dist/esm/api/aptosConfig.mjs +1 -9
  45. package/dist/esm/api/coin.d.mts +9 -9
  46. package/dist/esm/api/coin.mjs +1 -100
  47. package/dist/esm/api/digitalAsset.d.mts +5 -5
  48. package/dist/esm/api/digitalAsset.mjs +1 -101
  49. package/dist/esm/api/event.mjs +1 -59
  50. package/dist/esm/api/experimental.d.mts +7 -7
  51. package/dist/esm/api/experimental.mjs +1 -85
  52. package/dist/esm/api/faucet.mjs +1 -58
  53. package/dist/esm/api/fungibleAsset.d.mts +13 -13
  54. package/dist/esm/api/fungibleAsset.mjs +1 -101
  55. package/dist/esm/api/general.d.mts +7 -7
  56. package/dist/esm/api/general.mjs +1 -85
  57. package/dist/esm/api/index.d.mts +6 -5
  58. package/dist/esm/api/index.mjs +1 -143
  59. package/dist/esm/api/keyless.d.mts +20 -19
  60. package/dist/esm/api/keyless.mjs +1 -102
  61. package/dist/esm/api/object.mjs +1 -59
  62. package/dist/esm/api/staking.mjs +1 -59
  63. package/dist/esm/api/table.mjs +1 -38
  64. package/dist/esm/api/transaction.d.mts +4 -4
  65. package/dist/esm/api/transaction.mjs +1 -110
  66. package/dist/esm/api/transactionSubmission/build.d.mts +9 -9
  67. package/dist/esm/api/transactionSubmission/build.mjs +1 -99
  68. package/dist/esm/api/transactionSubmission/helpers.mjs +1 -9
  69. package/dist/esm/api/transactionSubmission/management.d.mts +8 -8
  70. package/dist/esm/api/transactionSubmission/management.mjs +1 -105
  71. package/dist/esm/api/transactionSubmission/sign.d.mts +3 -3
  72. package/dist/esm/api/transactionSubmission/sign.mjs +1 -218
  73. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  74. package/dist/esm/api/transactionSubmission/simulate.d.mts +9 -9
  75. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -100
  76. package/dist/esm/api/transactionSubmission/submit.d.mts +3 -3
  77. package/dist/esm/api/transactionSubmission/submit.mjs +1 -100
  78. package/dist/esm/api/utils.mjs +1 -36
  79. package/dist/esm/bcs/consts.mjs +1 -17
  80. package/dist/esm/bcs/deserializer.mjs +1 -10
  81. package/dist/esm/bcs/index.mjs +1 -60
  82. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -12
  83. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -11
  84. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -26
  85. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -22
  86. package/dist/esm/bcs/serializer.mjs +1 -18
  87. package/dist/esm/chunk-2V636AYW.mjs +2 -0
  88. package/dist/esm/{chunk-3IWV2Q3K.mjs.map → chunk-2V636AYW.mjs.map} +1 -1
  89. package/dist/esm/chunk-35CO4BP4.mjs +2 -0
  90. package/dist/esm/chunk-35CO4BP4.mjs.map +1 -0
  91. package/dist/esm/chunk-35DKMW7Q.mjs +2 -0
  92. package/dist/esm/{chunk-GUA5YTIK.mjs.map → chunk-35DKMW7Q.mjs.map} +1 -1
  93. package/dist/esm/chunk-3EUHEZND.mjs +2 -0
  94. package/dist/esm/{chunk-G34CJDST.mjs.map → chunk-3EUHEZND.mjs.map} +1 -1
  95. package/dist/esm/chunk-3OLFJ65O.mjs +2 -0
  96. package/dist/esm/{chunk-G4NBRMZ2.mjs.map → chunk-3OLFJ65O.mjs.map} +1 -1
  97. package/dist/esm/chunk-3RVAGHAA.mjs +2 -0
  98. package/dist/esm/{chunk-XQFUKBY7.mjs.map → chunk-3RVAGHAA.mjs.map} +1 -1
  99. package/dist/esm/chunk-4RXKALLC.mjs +2 -0
  100. package/dist/esm/{chunk-SFLQPB72.mjs.map → chunk-4RXKALLC.mjs.map} +1 -1
  101. package/dist/esm/chunk-56CNRT2K.mjs +2 -0
  102. package/dist/esm/{chunk-SBB4YEPT.mjs.map → chunk-56CNRT2K.mjs.map} +1 -1
  103. package/dist/esm/chunk-6KE4JZD6.mjs +2 -0
  104. package/dist/esm/chunk-6KE4JZD6.mjs.map +1 -0
  105. package/dist/esm/chunk-7CRQNXR5.mjs +2 -0
  106. package/dist/esm/{chunk-YU65LNIC.mjs.map → chunk-7CRQNXR5.mjs.map} +1 -1
  107. package/dist/esm/chunk-7YTGBTWH.mjs +2 -0
  108. package/dist/esm/chunk-7YTGBTWH.mjs.map +1 -0
  109. package/dist/esm/chunk-A3VO773Q.mjs +2 -0
  110. package/dist/esm/{chunk-KLUO6XPE.mjs.map → chunk-A3VO773Q.mjs.map} +1 -1
  111. package/dist/esm/chunk-A5L76YP7.mjs +2 -0
  112. package/dist/esm/{chunk-PT2QHUB6.mjs.map → chunk-A5L76YP7.mjs.map} +1 -1
  113. package/dist/esm/chunk-AEGA5N2W.mjs +2 -0
  114. package/dist/esm/{chunk-QJ6CGH7N.mjs.map → chunk-AEGA5N2W.mjs.map} +1 -1
  115. package/dist/esm/chunk-AIPHJFJL.mjs +2 -0
  116. package/dist/esm/{chunk-6I37A76G.mjs.map → chunk-AIPHJFJL.mjs.map} +1 -1
  117. package/dist/esm/chunk-BMPHQ3E7.mjs +2 -0
  118. package/dist/esm/{chunk-MWXBQ6HR.mjs.map → chunk-BMPHQ3E7.mjs.map} +1 -1
  119. package/dist/esm/chunk-C3Q23D22.mjs +2 -0
  120. package/dist/esm/{chunk-F7W7KS5C.mjs.map → chunk-C3Q23D22.mjs.map} +1 -1
  121. package/dist/esm/chunk-CWL7ZA3P.mjs +2 -0
  122. package/dist/esm/{chunk-6T3V5LXK.mjs.map → chunk-CWL7ZA3P.mjs.map} +1 -1
  123. package/dist/esm/chunk-DOVH6HPL.mjs +2 -0
  124. package/dist/esm/{chunk-THWEBWUC.mjs.map → chunk-DOVH6HPL.mjs.map} +1 -1
  125. package/dist/esm/chunk-EODSU3YN.mjs +2 -0
  126. package/dist/esm/{chunk-WXQUBQK4.mjs.map → chunk-EODSU3YN.mjs.map} +1 -1
  127. package/dist/esm/chunk-ERLDXTIY.mjs +2 -0
  128. package/dist/esm/{chunk-6ASWESA2.mjs.map → chunk-ERLDXTIY.mjs.map} +1 -1
  129. package/dist/esm/chunk-GOXRBEIJ.mjs +2 -0
  130. package/dist/esm/{chunk-APM7OSLS.mjs.map → chunk-GOXRBEIJ.mjs.map} +1 -1
  131. package/dist/esm/chunk-HHWJHOFZ.mjs +2 -0
  132. package/dist/esm/{chunk-KSK3XIGF.mjs.map → chunk-HHWJHOFZ.mjs.map} +1 -1
  133. package/dist/esm/chunk-IF4UU2MT.mjs +2 -0
  134. package/dist/esm/{chunk-QPT4BSAB.mjs.map → chunk-IF4UU2MT.mjs.map} +1 -1
  135. package/dist/esm/chunk-IMTC3J2M.mjs +2 -0
  136. package/dist/esm/{chunk-LJRNGZMY.mjs.map → chunk-IMTC3J2M.mjs.map} +1 -1
  137. package/dist/esm/chunk-KDMSOCZY.mjs +2 -0
  138. package/dist/esm/chunk-KSLLV3ZC.mjs +2 -0
  139. package/dist/esm/{chunk-OFUNBTK4.mjs.map → chunk-KSLLV3ZC.mjs.map} +1 -1
  140. package/dist/esm/chunk-KXVD52Y6.mjs +2 -0
  141. package/dist/esm/{chunk-YT7V6AVJ.mjs.map → chunk-KXVD52Y6.mjs.map} +1 -1
  142. package/dist/esm/chunk-LGC2JORV.mjs +2 -0
  143. package/dist/esm/chunk-LGC2JORV.mjs.map +1 -0
  144. package/dist/esm/chunk-LQOSHBB7.mjs +4 -0
  145. package/dist/esm/{chunk-CXLXUSCG.mjs.map → chunk-LQOSHBB7.mjs.map} +1 -1
  146. package/dist/esm/chunk-LS3IDL2N.mjs +2 -0
  147. package/dist/esm/{chunk-MYEYZ7PF.mjs.map → chunk-LS3IDL2N.mjs.map} +1 -1
  148. package/dist/esm/chunk-MIW45ADL.mjs +2 -0
  149. package/dist/esm/chunk-MIW45ADL.mjs.map +1 -0
  150. package/dist/esm/chunk-NFPNWY6Z.mjs +4 -0
  151. package/dist/esm/chunk-NFPNWY6Z.mjs.map +1 -0
  152. package/dist/esm/chunk-PDAWVDI7.mjs +2 -0
  153. package/dist/esm/{chunk-MFFBZ43D.mjs.map → chunk-PDAWVDI7.mjs.map} +1 -1
  154. package/dist/esm/chunk-PSZYS4RG.mjs +2 -0
  155. package/dist/esm/{chunk-YK66QBML.mjs.map → chunk-PSZYS4RG.mjs.map} +1 -1
  156. package/dist/esm/chunk-R6QCPXQG.mjs +2 -0
  157. package/dist/esm/{chunk-SQNS4SFV.mjs.map → chunk-R6QCPXQG.mjs.map} +1 -1
  158. package/dist/esm/chunk-RIINVEZA.mjs +2 -0
  159. package/dist/esm/{chunk-Y3ENAKRC.mjs.map → chunk-RIINVEZA.mjs.map} +1 -1
  160. package/dist/esm/chunk-RJ7F4JDV.mjs +2 -0
  161. package/dist/esm/chunk-RJ7F4JDV.mjs.map +1 -0
  162. package/dist/esm/chunk-RXHER6EA.mjs +2 -0
  163. package/dist/esm/{chunk-C7T6GW5P.mjs.map → chunk-RXHER6EA.mjs.map} +1 -1
  164. package/dist/esm/chunk-RXMLONF7.mjs +2 -0
  165. package/dist/esm/{chunk-BU43ZFDJ.mjs.map → chunk-RXMLONF7.mjs.map} +1 -1
  166. package/dist/esm/chunk-TBY3VMMV.mjs +2 -0
  167. package/dist/esm/chunk-TBY3VMMV.mjs.map +1 -0
  168. package/dist/esm/chunk-TKXEVD7A.mjs +2 -0
  169. package/dist/esm/{chunk-QSYWLSSN.mjs.map → chunk-TKXEVD7A.mjs.map} +1 -1
  170. package/dist/esm/chunk-TNWABITK.mjs +2 -0
  171. package/dist/esm/{chunk-FRLS4GRM.mjs.map → chunk-TNWABITK.mjs.map} +1 -1
  172. package/dist/esm/chunk-TTY5GFMN.mjs +2 -0
  173. package/dist/esm/{chunk-PKUXOBIV.mjs.map → chunk-TTY5GFMN.mjs.map} +1 -1
  174. package/dist/esm/chunk-VHNX2NUR.mjs +473 -0
  175. package/dist/esm/chunk-VHNX2NUR.mjs.map +1 -0
  176. package/dist/esm/chunk-VHY6ZATX.mjs +2 -0
  177. package/dist/esm/{chunk-BDM6FBUO.mjs.map → chunk-VHY6ZATX.mjs.map} +1 -1
  178. package/dist/esm/chunk-W4BSN6SK.mjs +2 -0
  179. package/dist/esm/{chunk-ZWCTF3NQ.mjs.map → chunk-W4BSN6SK.mjs.map} +1 -1
  180. package/dist/esm/chunk-WB26DWOY.mjs +7 -0
  181. package/dist/esm/chunk-WB26DWOY.mjs.map +1 -0
  182. package/dist/esm/chunk-X5YB74NB.mjs +2 -0
  183. package/dist/esm/{chunk-I25AX6PQ.mjs.map → chunk-X5YB74NB.mjs.map} +1 -1
  184. package/dist/esm/chunk-XLDMPCLF.mjs +2 -0
  185. package/dist/esm/{chunk-WLTQHGIJ.mjs.map → chunk-XLDMPCLF.mjs.map} +1 -1
  186. package/dist/esm/chunk-YOZBVVKL.mjs +2 -0
  187. package/dist/esm/{chunk-BEYIOC2H.mjs.map → chunk-YOZBVVKL.mjs.map} +1 -1
  188. package/dist/esm/chunk-ZD2TY5N3.mjs +2 -0
  189. package/dist/esm/{chunk-NUT2VOX2.mjs.map → chunk-ZD2TY5N3.mjs.map} +1 -1
  190. package/dist/esm/chunk-ZELTLAUN.mjs +2 -0
  191. package/dist/esm/chunk-ZELTLAUN.mjs.map +1 -0
  192. package/dist/esm/cli/index.mjs +1 -20
  193. package/dist/esm/cli/localNode.mjs +1 -16
  194. package/dist/esm/cli/move.mjs +1 -7
  195. package/dist/esm/client/core.mjs +1 -34
  196. package/dist/esm/client/get.mjs +1 -41
  197. package/dist/esm/client/index.mjs +1 -69
  198. package/dist/esm/client/post.mjs +1 -43
  199. package/dist/esm/core/account/index.mjs +1 -21
  200. package/dist/esm/core/account/utils/address.mjs +1 -19
  201. package/dist/esm/core/account/utils/index.mjs +1 -20
  202. package/dist/esm/core/accountAddress.mjs +1 -16
  203. package/dist/esm/core/authenticationKey.d.mts +3 -1
  204. package/dist/esm/core/authenticationKey.mjs +1 -15
  205. package/dist/esm/core/common.mjs +1 -7
  206. package/dist/esm/core/crypto/abstraction.d.mts +4 -1
  207. package/dist/esm/core/crypto/abstraction.mjs +1 -26
  208. package/dist/esm/core/crypto/ed25519.d.mts +18 -1
  209. package/dist/esm/core/crypto/ed25519.mjs +1 -33
  210. package/dist/esm/core/crypto/ephemeral.d.mts +8 -1
  211. package/dist/esm/core/crypto/ephemeral.mjs +1 -30
  212. package/dist/esm/core/crypto/federatedKeyless.d.mts +11 -87
  213. package/dist/esm/core/crypto/federatedKeyless.mjs +1 -44
  214. package/dist/esm/core/crypto/hdKey.mjs +1 -25
  215. package/dist/esm/core/crypto/index.d.mts +8 -6
  216. package/dist/esm/core/crypto/index.mjs +1 -173
  217. package/dist/esm/core/crypto/keyless.d.mts +13 -586
  218. package/dist/esm/core/crypto/keyless.mjs +1 -83
  219. package/dist/esm/core/crypto/multiEd25519.d.mts +14 -4
  220. package/dist/esm/core/crypto/multiEd25519.mjs +1 -50
  221. package/dist/esm/core/crypto/multiKey.d.mts +39 -3
  222. package/dist/esm/core/crypto/multiKey.mjs +1 -51
  223. package/dist/esm/core/crypto/poseidon.mjs +1 -15
  224. package/dist/esm/core/crypto/privateKey.d.mts +3 -1
  225. package/dist/esm/core/crypto/privateKey.mjs +1 -12
  226. package/dist/esm/core/crypto/proof.mjs +1 -20
  227. package/dist/esm/core/crypto/publicKey.d.mts +3 -1
  228. package/dist/esm/core/crypto/publicKey.mjs +1 -22
  229. package/dist/esm/core/crypto/secp256k1.d.mts +26 -2
  230. package/dist/esm/core/crypto/secp256k1.mjs +1 -29
  231. package/dist/esm/core/crypto/signature.mjs +1 -20
  232. package/dist/esm/core/crypto/singleKey.d.mts +27 -5
  233. package/dist/esm/core/crypto/singleKey.mjs +1 -48
  234. package/dist/esm/core/crypto/utils.mjs +1 -9
  235. package/dist/esm/core/hex.mjs +1 -12
  236. package/dist/esm/core/index.d.mts +8 -6
  237. package/dist/esm/core/index.mjs +1 -202
  238. package/dist/esm/errors/index.d.mts +10 -2
  239. package/dist/esm/errors/index.mjs +1 -25
  240. package/dist/esm/federatedKeyless-Qe_j8OqV.d.mts +875 -0
  241. package/dist/esm/index.d.mts +11 -10
  242. package/dist/esm/index.mjs +1 -798
  243. package/dist/esm/internal/abstraction.d.mts +9 -9
  244. package/dist/esm/internal/abstraction.mjs +1 -103
  245. package/dist/esm/internal/account.d.mts +7 -24
  246. package/dist/esm/internal/account.mjs +1 -142
  247. package/dist/esm/internal/ans.d.mts +13 -13
  248. package/dist/esm/internal/ans.mjs +1 -138
  249. package/dist/esm/internal/coin.d.mts +7 -7
  250. package/dist/esm/internal/coin.mjs +1 -99
  251. package/dist/esm/internal/digitalAsset.d.mts +2 -2
  252. package/dist/esm/internal/digitalAsset.mjs +1 -145
  253. package/dist/esm/internal/event.mjs +1 -62
  254. package/dist/esm/internal/experimental.d.mts +7 -7
  255. package/dist/esm/internal/experimental.mjs +1 -84
  256. package/dist/esm/internal/faucet.mjs +1 -57
  257. package/dist/esm/internal/fungibleAsset.d.mts +2 -2
  258. package/dist/esm/internal/fungibleAsset.mjs +1 -105
  259. package/dist/esm/internal/general.mjs +1 -43
  260. package/dist/esm/internal/keyless.d.mts +10 -20
  261. package/dist/esm/internal/keyless.mjs +1 -107
  262. package/dist/esm/internal/object.mjs +1 -58
  263. package/dist/esm/internal/staking.mjs +1 -60
  264. package/dist/esm/internal/table.mjs +1 -38
  265. package/dist/esm/internal/transaction.mjs +1 -57
  266. package/dist/esm/internal/transactionSubmission.d.mts +6 -6
  267. package/dist/esm/internal/transactionSubmission.mjs +1 -118
  268. package/dist/esm/internal/utils/index.mjs +1 -38
  269. package/dist/esm/internal/utils/utils.mjs +1 -37
  270. package/dist/esm/internal/view.d.mts +7 -7
  271. package/dist/esm/internal/view.mjs +1 -86
  272. package/dist/esm/{publicKey-BMtGNNLg.d.mts → publicKey-pDHBAZlT.d.mts} +27 -1
  273. package/dist/esm/transactions/authenticator/account.d.mts +3 -1
  274. package/dist/esm/transactions/authenticator/account.mjs +1 -67
  275. package/dist/esm/transactions/authenticator/index.d.mts +3 -1
  276. package/dist/esm/transactions/authenticator/index.mjs +1 -82
  277. package/dist/esm/transactions/authenticator/transaction.d.mts +4 -2
  278. package/dist/esm/transactions/authenticator/transaction.mjs +1 -66
  279. package/dist/esm/transactions/index.d.mts +4 -4
  280. package/dist/esm/transactions/index.mjs +1 -296
  281. package/dist/esm/transactions/instances/chainId.mjs +1 -11
  282. package/dist/esm/transactions/instances/identifier.mjs +1 -11
  283. package/dist/esm/transactions/instances/index.d.mts +4 -2
  284. package/dist/esm/transactions/instances/index.mjs +1 -114
  285. package/dist/esm/transactions/instances/moduleId.mjs +1 -55
  286. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -60
  287. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -65
  288. package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +3 -1
  289. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -21
  290. package/dist/esm/transactions/instances/signedTransaction.d.mts +3 -1
  291. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -63
  292. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -60
  293. package/dist/esm/transactions/instances/transactionArgument.mjs +1 -1
  294. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -73
  295. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +2 -2
  296. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -101
  297. package/dist/esm/transactions/management/asyncQueue.mjs +1 -9
  298. package/dist/esm/transactions/management/index.d.mts +2 -2
  299. package/dist/esm/transactions/management/index.mjs +1 -111
  300. package/dist/esm/transactions/management/transactionWorker.d.mts +3 -3
  301. package/dist/esm/transactions/management/transactionWorker.mjs +1 -107
  302. package/dist/esm/transactions/scriptComposer/index.d.mts +7 -7
  303. package/dist/esm/transactions/scriptComposer/index.mjs +1 -80
  304. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +8 -8
  305. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -92
  306. package/dist/esm/transactions/transactionBuilder/index.d.mts +8 -8
  307. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -166
  308. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +34 -23
  309. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -74
  310. package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +7 -7
  311. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -75
  312. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +8 -8
  313. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -97
  314. package/dist/esm/transactions/typeTag/index.d.mts +16 -0
  315. package/dist/esm/transactions/typeTag/index.mjs +1 -91
  316. package/dist/esm/transactions/typeTag/parser.mjs +1 -60
  317. package/dist/esm/transactions/types.d.mts +5 -5
  318. package/dist/esm/transactions/types.mjs +1 -1
  319. package/dist/esm/types/abstraction.mjs +1 -7
  320. package/dist/esm/types/generated/operations.d.mts +10 -63
  321. package/dist/esm/types/generated/queries.d.mts +2 -10
  322. package/dist/esm/types/generated/queries.mjs +1 -69
  323. package/dist/esm/types/generated/types.d.mts +1054 -824
  324. package/dist/esm/types/generated/types.mjs +1 -774
  325. package/dist/esm/types/generated/types.mjs.map +1 -1
  326. package/dist/esm/types/index.d.mts +2 -2
  327. package/dist/esm/types/index.mjs +1 -82
  328. package/dist/esm/types/indexer.d.mts +2 -14
  329. package/dist/esm/types/indexer.mjs +1 -1
  330. package/dist/esm/types/keyless.d.mts +1 -1
  331. package/dist/esm/types/types.d.mts +3 -58
  332. package/dist/esm/types/types.mjs +1 -77
  333. package/dist/esm/utils/apiEndpoints.mjs +1 -21
  334. package/dist/esm/utils/const.d.mts +1 -1
  335. package/dist/esm/utils/const.mjs +1 -25
  336. package/dist/esm/utils/helpers.d.mts +2 -1
  337. package/dist/esm/utils/helpers.mjs +1 -37
  338. package/dist/esm/utils/index.d.mts +1 -1
  339. package/dist/esm/utils/index.mjs +1 -88
  340. package/dist/esm/utils/memoize.mjs +1 -9
  341. package/dist/esm/utils/normalizeBundle.mjs +1 -20
  342. package/dist/esm/version.d.mts +1 -1
  343. package/dist/esm/version.mjs +1 -7
  344. package/package.json +3 -3
  345. package/src/account/AbstractKeylessAccount.ts +33 -49
  346. package/src/account/MultiKeyAccount.ts +23 -16
  347. package/src/api/account.ts +2 -56
  348. package/src/cli/localNode.ts +6 -15
  349. package/src/core/crypto/abstraction.ts +6 -1
  350. package/src/core/crypto/ed25519.ts +19 -1
  351. package/src/core/crypto/ephemeral.ts +9 -0
  352. package/src/core/crypto/federatedKeyless.ts +40 -4
  353. package/src/core/crypto/index.ts +4 -3
  354. package/src/core/crypto/keyless.ts +577 -17
  355. package/src/core/crypto/multiEd25519.ts +11 -3
  356. package/src/core/crypto/multiKey.ts +74 -4
  357. package/src/core/crypto/publicKey.ts +28 -0
  358. package/src/core/crypto/secp256k1.ts +25 -2
  359. package/src/core/crypto/singleKey.ts +32 -7
  360. package/src/errors/index.ts +50 -0
  361. package/src/internal/account.ts +2 -395
  362. package/src/internal/keyless.ts +9 -17
  363. package/src/transactions/scriptComposer/index.ts +19 -6
  364. package/src/transactions/transactionBuilder/remoteAbi.ts +107 -35
  365. package/src/transactions/typeTag/index.ts +22 -0
  366. package/src/types/codegen.yaml +1 -1
  367. package/src/types/generated/operations.ts +8 -69
  368. package/src/types/generated/queries.ts +0 -111
  369. package/src/types/generated/types.ts +1159 -951
  370. package/src/types/indexer.ts +0 -16
  371. package/src/types/keyless.ts +1 -1
  372. package/src/types/types.ts +3 -62
  373. package/src/utils/const.ts +1 -1
  374. package/src/utils/helpers.ts +11 -0
  375. package/src/version.ts +1 -1
  376. package/dist/common/chunk-JMOQXLED.js +0 -1305
  377. package/dist/common/chunk-JMOQXLED.js.map +0 -1
  378. package/dist/esm/chunk-2FTF6J7F.mjs +0 -97
  379. package/dist/esm/chunk-2FTF6J7F.mjs.map +0 -1
  380. package/dist/esm/chunk-2HL7JEFC.mjs +0 -829
  381. package/dist/esm/chunk-2HL7JEFC.mjs.map +0 -1
  382. package/dist/esm/chunk-2WBJAKBO.mjs +0 -53
  383. package/dist/esm/chunk-2WBJAKBO.mjs.map +0 -1
  384. package/dist/esm/chunk-32UQAST6.mjs +0 -296
  385. package/dist/esm/chunk-32UQAST6.mjs.map +0 -1
  386. package/dist/esm/chunk-3DAVHDK4.mjs +0 -195
  387. package/dist/esm/chunk-3DAVHDK4.mjs.map +0 -1
  388. package/dist/esm/chunk-3IWV2Q3K.mjs +0 -12
  389. package/dist/esm/chunk-3TUV6YMI.mjs +0 -305
  390. package/dist/esm/chunk-3TUV6YMI.mjs.map +0 -1
  391. package/dist/esm/chunk-4NMDYPUD.mjs +0 -1
  392. package/dist/esm/chunk-56UCIGTO.mjs +0 -21
  393. package/dist/esm/chunk-56UCIGTO.mjs.map +0 -1
  394. package/dist/esm/chunk-5ORUQZAR.mjs +0 -100
  395. package/dist/esm/chunk-5ORUQZAR.mjs.map +0 -1
  396. package/dist/esm/chunk-5QHMFYVL.mjs +0 -42
  397. package/dist/esm/chunk-5QHMFYVL.mjs.map +0 -1
  398. package/dist/esm/chunk-62LC4PPC.mjs +0 -128
  399. package/dist/esm/chunk-62LC4PPC.mjs.map +0 -1
  400. package/dist/esm/chunk-6ASWESA2.mjs +0 -77
  401. package/dist/esm/chunk-6I37A76G.mjs +0 -29
  402. package/dist/esm/chunk-6OFCIXWS.mjs +0 -379
  403. package/dist/esm/chunk-6OFCIXWS.mjs.map +0 -1
  404. package/dist/esm/chunk-6SNGKTWE.mjs +0 -91
  405. package/dist/esm/chunk-6SNGKTWE.mjs.map +0 -1
  406. package/dist/esm/chunk-6T3V5LXK.mjs +0 -119
  407. package/dist/esm/chunk-7F32C225.mjs +0 -219
  408. package/dist/esm/chunk-7F32C225.mjs.map +0 -1
  409. package/dist/esm/chunk-7WW735TU.mjs +0 -276
  410. package/dist/esm/chunk-7WW735TU.mjs.map +0 -1
  411. package/dist/esm/chunk-A33OBGVN.mjs +0 -1014
  412. package/dist/esm/chunk-A33OBGVN.mjs.map +0 -1
  413. package/dist/esm/chunk-A7LYGPFL.mjs +0 -208
  414. package/dist/esm/chunk-A7LYGPFL.mjs.map +0 -1
  415. package/dist/esm/chunk-AGKEC2IM.mjs +0 -250
  416. package/dist/esm/chunk-AGKEC2IM.mjs.map +0 -1
  417. package/dist/esm/chunk-AKXCFBYF.mjs +0 -49
  418. package/dist/esm/chunk-AKXCFBYF.mjs.map +0 -1
  419. package/dist/esm/chunk-APM7OSLS.mjs +0 -122
  420. package/dist/esm/chunk-BDM6FBUO.mjs +0 -198
  421. package/dist/esm/chunk-BEYIOC2H.mjs +0 -34
  422. package/dist/esm/chunk-BMM72IIP.mjs +0 -250
  423. package/dist/esm/chunk-BMM72IIP.mjs.map +0 -1
  424. package/dist/esm/chunk-BSCOVLWS.mjs +0 -1
  425. package/dist/esm/chunk-BSCOVLWS.mjs.map +0 -1
  426. package/dist/esm/chunk-BU43ZFDJ.mjs +0 -281
  427. package/dist/esm/chunk-C7EEG6SW.mjs +0 -689
  428. package/dist/esm/chunk-C7EEG6SW.mjs.map +0 -1
  429. package/dist/esm/chunk-C7T6GW5P.mjs +0 -376
  430. package/dist/esm/chunk-CXLXUSCG.mjs +0 -417
  431. package/dist/esm/chunk-D4MW64RH.mjs +0 -188
  432. package/dist/esm/chunk-D4MW64RH.mjs.map +0 -1
  433. package/dist/esm/chunk-D6RXVCE3.mjs +0 -86
  434. package/dist/esm/chunk-D6RXVCE3.mjs.map +0 -1
  435. package/dist/esm/chunk-DDZGHA66.mjs +0 -495
  436. package/dist/esm/chunk-DDZGHA66.mjs.map +0 -1
  437. package/dist/esm/chunk-DGDZNHUJ.mjs +0 -72
  438. package/dist/esm/chunk-DGDZNHUJ.mjs.map +0 -1
  439. package/dist/esm/chunk-DMFRIING.mjs +0 -286
  440. package/dist/esm/chunk-DMFRIING.mjs.map +0 -1
  441. package/dist/esm/chunk-E7FWVXGX.mjs +0 -1
  442. package/dist/esm/chunk-E7FWVXGX.mjs.map +0 -1
  443. package/dist/esm/chunk-EBFKT35C.mjs +0 -66
  444. package/dist/esm/chunk-EBFKT35C.mjs.map +0 -1
  445. package/dist/esm/chunk-ECTX2FGD.mjs +0 -355
  446. package/dist/esm/chunk-ECTX2FGD.mjs.map +0 -1
  447. package/dist/esm/chunk-EPTUAWRA.mjs +0 -895
  448. package/dist/esm/chunk-EPTUAWRA.mjs.map +0 -1
  449. package/dist/esm/chunk-F4VI7BNX.mjs +0 -58
  450. package/dist/esm/chunk-F4VI7BNX.mjs.map +0 -1
  451. package/dist/esm/chunk-F7W7KS5C.mjs +0 -52
  452. package/dist/esm/chunk-FDMI4BUL.mjs +0 -611
  453. package/dist/esm/chunk-FDMI4BUL.mjs.map +0 -1
  454. package/dist/esm/chunk-FMNMYKYH.mjs +0 -71
  455. package/dist/esm/chunk-FMNMYKYH.mjs.map +0 -1
  456. package/dist/esm/chunk-FRLS4GRM.mjs +0 -62
  457. package/dist/esm/chunk-G34CJDST.mjs +0 -139
  458. package/dist/esm/chunk-G4NBRMZ2.mjs +0 -7
  459. package/dist/esm/chunk-G6R77JKO.mjs +0 -121
  460. package/dist/esm/chunk-G6R77JKO.mjs.map +0 -1
  461. package/dist/esm/chunk-G7BB6K4B.mjs +0 -167
  462. package/dist/esm/chunk-G7BB6K4B.mjs.map +0 -1
  463. package/dist/esm/chunk-GCQK2S5Q.mjs +0 -43
  464. package/dist/esm/chunk-GCQK2S5Q.mjs.map +0 -1
  465. package/dist/esm/chunk-GFPEB22G.mjs +0 -1
  466. package/dist/esm/chunk-GFPEB22G.mjs.map +0 -1
  467. package/dist/esm/chunk-GUA5YTIK.mjs +0 -362
  468. package/dist/esm/chunk-HBXBODME.mjs +0 -84
  469. package/dist/esm/chunk-HBXBODME.mjs.map +0 -1
  470. package/dist/esm/chunk-HEZ2ZYZA.mjs +0 -1
  471. package/dist/esm/chunk-HEZ2ZYZA.mjs.map +0 -1
  472. package/dist/esm/chunk-HKQY5GXT.mjs +0 -231
  473. package/dist/esm/chunk-HKQY5GXT.mjs.map +0 -1
  474. package/dist/esm/chunk-HL337SEM.mjs +0 -219
  475. package/dist/esm/chunk-HL337SEM.mjs.map +0 -1
  476. package/dist/esm/chunk-HQDHSKVS.mjs +0 -74
  477. package/dist/esm/chunk-HQDHSKVS.mjs.map +0 -1
  478. package/dist/esm/chunk-I25AX6PQ.mjs +0 -7
  479. package/dist/esm/chunk-I5G7XFGT.mjs +0 -86
  480. package/dist/esm/chunk-I5G7XFGT.mjs.map +0 -1
  481. package/dist/esm/chunk-IHYTP2EW.mjs +0 -1
  482. package/dist/esm/chunk-IHYTP2EW.mjs.map +0 -1
  483. package/dist/esm/chunk-IJ7XCPP3.mjs +0 -480
  484. package/dist/esm/chunk-IJ7XCPP3.mjs.map +0 -1
  485. package/dist/esm/chunk-ILTEOGFF.mjs +0 -407
  486. package/dist/esm/chunk-ILTEOGFF.mjs.map +0 -1
  487. package/dist/esm/chunk-IP7GATDH.mjs +0 -322
  488. package/dist/esm/chunk-IP7GATDH.mjs.map +0 -1
  489. package/dist/esm/chunk-IPUAVRGL.mjs +0 -248
  490. package/dist/esm/chunk-IPUAVRGL.mjs.map +0 -1
  491. package/dist/esm/chunk-IQVHXOD3.mjs +0 -192
  492. package/dist/esm/chunk-IQVHXOD3.mjs.map +0 -1
  493. package/dist/esm/chunk-JAZJE3OR.mjs +0 -45
  494. package/dist/esm/chunk-JAZJE3OR.mjs.map +0 -1
  495. package/dist/esm/chunk-JEVGHYEP.mjs +0 -162
  496. package/dist/esm/chunk-JEVGHYEP.mjs.map +0 -1
  497. package/dist/esm/chunk-JFMFZ2IL.mjs +0 -147
  498. package/dist/esm/chunk-JFMFZ2IL.mjs.map +0 -1
  499. package/dist/esm/chunk-JQIRRM7G.mjs +0 -195
  500. package/dist/esm/chunk-JQIRRM7G.mjs.map +0 -1
  501. package/dist/esm/chunk-JXCZTOYC.mjs +0 -1
  502. package/dist/esm/chunk-JXCZTOYC.mjs.map +0 -1
  503. package/dist/esm/chunk-K5OCDM3W.mjs +0 -207
  504. package/dist/esm/chunk-K5OCDM3W.mjs.map +0 -1
  505. package/dist/esm/chunk-KLUO6XPE.mjs +0 -33
  506. package/dist/esm/chunk-KSK3XIGF.mjs +0 -502
  507. package/dist/esm/chunk-KW64NP2F.mjs +0 -71
  508. package/dist/esm/chunk-KW64NP2F.mjs.map +0 -1
  509. package/dist/esm/chunk-LJRNGZMY.mjs +0 -10
  510. package/dist/esm/chunk-MFFBZ43D.mjs +0 -45
  511. package/dist/esm/chunk-MWXBQ6HR.mjs +0 -15
  512. package/dist/esm/chunk-MYEYZ7PF.mjs +0 -46
  513. package/dist/esm/chunk-NUT2VOX2.mjs +0 -317
  514. package/dist/esm/chunk-OFUNBTK4.mjs +0 -169
  515. package/dist/esm/chunk-ORCQEMJL.mjs +0 -51
  516. package/dist/esm/chunk-ORCQEMJL.mjs.map +0 -1
  517. package/dist/esm/chunk-PGFEUN7K.mjs +0 -129
  518. package/dist/esm/chunk-PGFEUN7K.mjs.map +0 -1
  519. package/dist/esm/chunk-PKUXOBIV.mjs +0 -138
  520. package/dist/esm/chunk-PT2QHUB6.mjs +0 -96
  521. package/dist/esm/chunk-QJ6CGH7N.mjs +0 -71
  522. package/dist/esm/chunk-QPT4BSAB.mjs +0 -20
  523. package/dist/esm/chunk-QSYWLSSN.mjs +0 -216
  524. package/dist/esm/chunk-QYNYDQE3.mjs +0 -288
  525. package/dist/esm/chunk-QYNYDQE3.mjs.map +0 -1
  526. package/dist/esm/chunk-R45SPK6Q.mjs +0 -61
  527. package/dist/esm/chunk-R45SPK6Q.mjs.map +0 -1
  528. package/dist/esm/chunk-R4JTQQBX.mjs +0 -37
  529. package/dist/esm/chunk-R4JTQQBX.mjs.map +0 -1
  530. package/dist/esm/chunk-RCXGTN36.mjs +0 -58
  531. package/dist/esm/chunk-RCXGTN36.mjs.map +0 -1
  532. package/dist/esm/chunk-RMMOF53Q.mjs +0 -1
  533. package/dist/esm/chunk-RMMOF53Q.mjs.map +0 -1
  534. package/dist/esm/chunk-RQS33JAS.mjs +0 -77
  535. package/dist/esm/chunk-RQS33JAS.mjs.map +0 -1
  536. package/dist/esm/chunk-SAWN7RJP.mjs +0 -15
  537. package/dist/esm/chunk-SAWN7RJP.mjs.map +0 -1
  538. package/dist/esm/chunk-SBB4YEPT.mjs +0 -17
  539. package/dist/esm/chunk-SFLQPB72.mjs +0 -63
  540. package/dist/esm/chunk-SPI2HO3E.mjs +0 -177
  541. package/dist/esm/chunk-SPI2HO3E.mjs.map +0 -1
  542. package/dist/esm/chunk-SPVJXZL5.mjs +0 -865
  543. package/dist/esm/chunk-SPVJXZL5.mjs.map +0 -1
  544. package/dist/esm/chunk-SQNS4SFV.mjs +0 -232
  545. package/dist/esm/chunk-SRXIHVZE.mjs +0 -50
  546. package/dist/esm/chunk-SRXIHVZE.mjs.map +0 -1
  547. package/dist/esm/chunk-T4BFWV46.mjs +0 -63
  548. package/dist/esm/chunk-T4BFWV46.mjs.map +0 -1
  549. package/dist/esm/chunk-T573PCIR.mjs +0 -700
  550. package/dist/esm/chunk-T573PCIR.mjs.map +0 -1
  551. package/dist/esm/chunk-TDLL7QX5.mjs +0 -239
  552. package/dist/esm/chunk-TDLL7QX5.mjs.map +0 -1
  553. package/dist/esm/chunk-TFW6N66T.mjs +0 -415
  554. package/dist/esm/chunk-TFW6N66T.mjs.map +0 -1
  555. package/dist/esm/chunk-THWEBWUC.mjs +0 -20
  556. package/dist/esm/chunk-TJDF4CXI.mjs +0 -513
  557. package/dist/esm/chunk-TJDF4CXI.mjs.map +0 -1
  558. package/dist/esm/chunk-TL4Z4KHK.mjs +0 -70
  559. package/dist/esm/chunk-TL4Z4KHK.mjs.map +0 -1
  560. package/dist/esm/chunk-UGFIWCJQ.mjs +0 -130
  561. package/dist/esm/chunk-UGFIWCJQ.mjs.map +0 -1
  562. package/dist/esm/chunk-UGKZQUGE.mjs +0 -367
  563. package/dist/esm/chunk-UGKZQUGE.mjs.map +0 -1
  564. package/dist/esm/chunk-UIRAXHDH.mjs +0 -1
  565. package/dist/esm/chunk-UIRAXHDH.mjs.map +0 -1
  566. package/dist/esm/chunk-UK7SPHIE.mjs +0 -420
  567. package/dist/esm/chunk-UK7SPHIE.mjs.map +0 -1
  568. package/dist/esm/chunk-UOHCJOXI.mjs +0 -150
  569. package/dist/esm/chunk-UOHCJOXI.mjs.map +0 -1
  570. package/dist/esm/chunk-WHSS6I7T.mjs +0 -90
  571. package/dist/esm/chunk-WHSS6I7T.mjs.map +0 -1
  572. package/dist/esm/chunk-WLTQHGIJ.mjs +0 -177
  573. package/dist/esm/chunk-WUM247HF.mjs +0 -125
  574. package/dist/esm/chunk-WUM247HF.mjs.map +0 -1
  575. package/dist/esm/chunk-WXQUBQK4.mjs +0 -19
  576. package/dist/esm/chunk-X4N5BN3S.mjs +0 -40
  577. package/dist/esm/chunk-X4N5BN3S.mjs.map +0 -1
  578. package/dist/esm/chunk-XIBOO3WF.mjs +0 -168
  579. package/dist/esm/chunk-XIBOO3WF.mjs.map +0 -1
  580. package/dist/esm/chunk-XQFUKBY7.mjs +0 -136
  581. package/dist/esm/chunk-XX6C2QGI.mjs +0 -160
  582. package/dist/esm/chunk-XX6C2QGI.mjs.map +0 -1
  583. package/dist/esm/chunk-Y3ENAKRC.mjs +0 -73
  584. package/dist/esm/chunk-Y3M32DIB.mjs +0 -79
  585. package/dist/esm/chunk-Y3M32DIB.mjs.map +0 -1
  586. package/dist/esm/chunk-YK66QBML.mjs +0 -89
  587. package/dist/esm/chunk-YT7V6AVJ.mjs +0 -66
  588. package/dist/esm/chunk-YU65LNIC.mjs +0 -72
  589. package/dist/esm/chunk-ZRBUAZZD.mjs +0 -36
  590. package/dist/esm/chunk-ZRBUAZZD.mjs.map +0 -1
  591. package/dist/esm/chunk-ZWCTF3NQ.mjs +0 -25
  592. package/src/internal/queries/getAccountAddressForAuthKey.graphql +0 -8
  593. package/src/internal/queries/getAuthKeysForPublicKey.graphql +0 -9
  594. package/src/internal/queries/getMultiKeyForAuthKey.graphql +0 -9
  595. package/src/internal/queries/getSignatures.graphql +0 -13
  596. /package/dist/esm/{chunk-4NMDYPUD.mjs.map → chunk-KDMSOCZY.mjs.map} +0 -0
@@ -1,379 +0,0 @@
1
- import {
2
- parseTypeTag
3
- } from "./chunk-BMM72IIP.mjs";
4
- import {
5
- convertNumber,
6
- findFirstNonSignerArg,
7
- isBcsAddress,
8
- isBcsBool,
9
- isBcsString,
10
- isBcsU128,
11
- isBcsU16,
12
- isBcsU256,
13
- isBcsU32,
14
- isBcsU64,
15
- isBcsU8,
16
- isBool,
17
- isEmptyOption,
18
- isEncodedEntryFunctionArgument,
19
- isLargeNumber,
20
- isString,
21
- throwTypeMismatch
22
- } from "./chunk-JQIRRM7G.mjs";
23
- import {
24
- getModule
25
- } from "./chunk-FRLS4GRM.mjs";
26
- import {
27
- TypeTagAddress,
28
- TypeTagBool,
29
- TypeTagStruct,
30
- TypeTagU128,
31
- TypeTagU16,
32
- TypeTagU256,
33
- TypeTagU32,
34
- TypeTagU64,
35
- TypeTagU8
36
- } from "./chunk-DDZGHA66.mjs";
37
- import {
38
- AccountAddress
39
- } from "./chunk-CXLXUSCG.mjs";
40
- import {
41
- MoveOption,
42
- MoveString,
43
- MoveVector
44
- } from "./chunk-KSK3XIGF.mjs";
45
- import {
46
- Bool,
47
- U128,
48
- U16,
49
- U256,
50
- U32,
51
- U64,
52
- U8
53
- } from "./chunk-QSYWLSSN.mjs";
54
- import {
55
- CallArgument
56
- } from "./chunk-G4NBRMZ2.mjs";
57
-
58
- // src/transactions/transactionBuilder/remoteAbi.ts
59
- var TEXT_ENCODER = new TextEncoder();
60
- function standardizeTypeTags(typeArguments) {
61
- return typeArguments?.map((typeArg) => {
62
- if (isString(typeArg)) {
63
- return parseTypeTag(typeArg);
64
- }
65
- return typeArg;
66
- }) ?? [];
67
- }
68
- async function fetchFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig) {
69
- const module = await getModule({ aptosConfig, accountAddress: moduleAddress, moduleName });
70
- if (module.abi) {
71
- return module.abi.exposed_functions.find((func) => func.name === functionName);
72
- }
73
- return void 0;
74
- }
75
- async function fetchMoveFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig) {
76
- const functionAbi = await fetchFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig);
77
- if (!functionAbi) {
78
- throw new Error(`Could not find function ABI for '${moduleAddress}::${moduleName}::${functionName}'`);
79
- }
80
- const params = [];
81
- for (let i = 0; i < functionAbi.params.length; i += 1) {
82
- params.push(parseTypeTag(functionAbi.params[i], { allowGenerics: true }));
83
- }
84
- return {
85
- typeParameters: functionAbi.generic_type_params,
86
- parameters: params
87
- };
88
- }
89
- async function fetchEntryFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig) {
90
- const functionAbi = await fetchFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig);
91
- if (!functionAbi) {
92
- throw new Error(`Could not find entry function ABI for '${moduleAddress}::${moduleName}::${functionName}'`);
93
- }
94
- if (!functionAbi.is_entry) {
95
- throw new Error(`'${moduleAddress}::${moduleName}::${functionName}' is not an entry function`);
96
- }
97
- const numSigners = findFirstNonSignerArg(functionAbi);
98
- const params = [];
99
- for (let i = numSigners; i < functionAbi.params.length; i += 1) {
100
- params.push(parseTypeTag(functionAbi.params[i], { allowGenerics: true }));
101
- }
102
- return {
103
- signers: numSigners,
104
- typeParameters: functionAbi.generic_type_params,
105
- parameters: params
106
- };
107
- }
108
- async function fetchViewFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig) {
109
- const functionAbi = await fetchFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig);
110
- if (!functionAbi) {
111
- throw new Error(`Could not find view function ABI for '${moduleAddress}::${moduleName}::${functionName}'`);
112
- }
113
- if (!functionAbi.is_view) {
114
- throw new Error(`'${moduleAddress}::${moduleName}::${functionName}' is not an view function`);
115
- }
116
- const params = [];
117
- for (let i = 0; i < functionAbi.params.length; i += 1) {
118
- params.push(parseTypeTag(functionAbi.params[i], { allowGenerics: true }));
119
- }
120
- const returnTypes = [];
121
- for (let i = 0; i < functionAbi.return.length; i += 1) {
122
- returnTypes.push(parseTypeTag(functionAbi.return[i], { allowGenerics: true }));
123
- }
124
- return {
125
- typeParameters: functionAbi.generic_type_params,
126
- parameters: params,
127
- returnTypes
128
- };
129
- }
130
- function convertCallArgument(argument, functionName, functionAbi, position, genericTypeParams) {
131
- if (argument instanceof CallArgument) {
132
- return argument;
133
- }
134
- return CallArgument.newBytes(
135
- convertArgument(functionName, functionAbi, argument, position, genericTypeParams).bcsToBytes()
136
- );
137
- }
138
- function convertArgument(functionName, functionAbi, arg, position, genericTypeParams) {
139
- if (position >= functionAbi.parameters.length) {
140
- throw new Error(`Too many arguments for '${functionName}', expected ${functionAbi.parameters.length}`);
141
- }
142
- const param = functionAbi.parameters[position];
143
- return checkOrConvertArgument(arg, param, position, genericTypeParams);
144
- }
145
- function checkOrConvertArgument(arg, param, position, genericTypeParams) {
146
- if (isEncodedEntryFunctionArgument(arg)) {
147
- checkType(param, arg, position);
148
- return arg;
149
- }
150
- return parseArg(arg, param, position, genericTypeParams);
151
- }
152
- function parseArg(arg, param, position, genericTypeParams) {
153
- if (param.isBool()) {
154
- if (isBool(arg)) {
155
- return new Bool(arg);
156
- }
157
- if (isString(arg)) {
158
- if (arg === "true") return new Bool(true);
159
- if (arg === "false") return new Bool(false);
160
- }
161
- throwTypeMismatch("boolean", position);
162
- }
163
- if (param.isAddress()) {
164
- if (isString(arg)) {
165
- return AccountAddress.fromString(arg);
166
- }
167
- throwTypeMismatch("string | AccountAddress", position);
168
- }
169
- if (param.isU8()) {
170
- const num = convertNumber(arg);
171
- if (num !== void 0) {
172
- return new U8(num);
173
- }
174
- throwTypeMismatch("number | string", position);
175
- }
176
- if (param.isU16()) {
177
- const num = convertNumber(arg);
178
- if (num !== void 0) {
179
- return new U16(num);
180
- }
181
- throwTypeMismatch("number | string", position);
182
- }
183
- if (param.isU32()) {
184
- const num = convertNumber(arg);
185
- if (num !== void 0) {
186
- return new U32(num);
187
- }
188
- throwTypeMismatch("number | string", position);
189
- }
190
- if (param.isU64()) {
191
- if (isLargeNumber(arg)) {
192
- return new U64(BigInt(arg));
193
- }
194
- throwTypeMismatch("bigint | number | string", position);
195
- }
196
- if (param.isU128()) {
197
- if (isLargeNumber(arg)) {
198
- return new U128(BigInt(arg));
199
- }
200
- throwTypeMismatch("bigint | number | string", position);
201
- }
202
- if (param.isU256()) {
203
- if (isLargeNumber(arg)) {
204
- return new U256(BigInt(arg));
205
- }
206
- throwTypeMismatch("bigint | number | string", position);
207
- }
208
- if (param.isGeneric()) {
209
- const genericIndex = param.value;
210
- if (genericIndex < 0 || genericIndex >= genericTypeParams.length) {
211
- throw new Error(`Generic argument ${param.toString()} is invalid for argument ${position}`);
212
- }
213
- return checkOrConvertArgument(arg, genericTypeParams[genericIndex], position, genericTypeParams);
214
- }
215
- if (param.isVector()) {
216
- if (param.value.isU8()) {
217
- if (isString(arg)) {
218
- return MoveVector.U8(TEXT_ENCODER.encode(arg));
219
- }
220
- if (arg instanceof Uint8Array) {
221
- return MoveVector.U8(arg);
222
- }
223
- if (arg instanceof ArrayBuffer) {
224
- return MoveVector.U8(new Uint8Array(arg));
225
- }
226
- }
227
- if (isString(arg)) {
228
- if (arg.startsWith("[")) {
229
- return checkOrConvertArgument(JSON.parse(arg), param, position, genericTypeParams);
230
- }
231
- }
232
- if (Array.isArray(arg)) {
233
- return new MoveVector(arg.map((item) => checkOrConvertArgument(item, param.value, position, genericTypeParams)));
234
- }
235
- throw new Error(`Type mismatch for argument ${position}, type '${param.toString()}'`);
236
- }
237
- if (param.isStruct()) {
238
- if (param.isString()) {
239
- if (isString(arg)) {
240
- return new MoveString(arg);
241
- }
242
- throwTypeMismatch("string", position);
243
- }
244
- if (param.isObject()) {
245
- if (isString(arg)) {
246
- return AccountAddress.fromString(arg);
247
- }
248
- throwTypeMismatch("string | AccountAddress", position);
249
- }
250
- if (param.isOption()) {
251
- if (isEmptyOption(arg)) {
252
- const innerParam = param.value.typeArgs[0];
253
- if (innerParam instanceof TypeTagBool) {
254
- return new MoveOption(null);
255
- }
256
- if (innerParam instanceof TypeTagAddress) {
257
- return new MoveOption(null);
258
- }
259
- if (innerParam instanceof TypeTagU8) {
260
- return new MoveOption(null);
261
- }
262
- if (innerParam instanceof TypeTagU16) {
263
- return new MoveOption(null);
264
- }
265
- if (innerParam instanceof TypeTagU32) {
266
- return new MoveOption(null);
267
- }
268
- if (innerParam instanceof TypeTagU64) {
269
- return new MoveOption(null);
270
- }
271
- if (innerParam instanceof TypeTagU128) {
272
- return new MoveOption(null);
273
- }
274
- if (innerParam instanceof TypeTagU256) {
275
- return new MoveOption(null);
276
- }
277
- return new MoveOption(null);
278
- }
279
- return new MoveOption(checkOrConvertArgument(arg, param.value.typeArgs[0], position, genericTypeParams));
280
- }
281
- throw new Error(`Unsupported struct input type for argument ${position}, type '${param.toString()}'`);
282
- }
283
- throw new Error(`Type mismatch for argument ${position}, type '${param.toString()}'`);
284
- }
285
- function checkType(param, arg, position) {
286
- if (param.isBool()) {
287
- if (isBcsBool(arg)) {
288
- return;
289
- }
290
- throwTypeMismatch("Bool", position);
291
- }
292
- if (param.isAddress()) {
293
- if (isBcsAddress(arg)) {
294
- return;
295
- }
296
- throwTypeMismatch("AccountAddress", position);
297
- }
298
- if (param.isU8()) {
299
- if (isBcsU8(arg)) {
300
- return;
301
- }
302
- throwTypeMismatch("U8", position);
303
- }
304
- if (param.isU16()) {
305
- if (isBcsU16(arg)) {
306
- return;
307
- }
308
- throwTypeMismatch("U16", position);
309
- }
310
- if (param.isU32()) {
311
- if (isBcsU32(arg)) {
312
- return;
313
- }
314
- throwTypeMismatch("U32", position);
315
- }
316
- if (param.isU64()) {
317
- if (isBcsU64(arg)) {
318
- return;
319
- }
320
- throwTypeMismatch("U64", position);
321
- }
322
- if (param.isU128()) {
323
- if (isBcsU128(arg)) {
324
- return;
325
- }
326
- throwTypeMismatch("U128", position);
327
- }
328
- if (param.isU256()) {
329
- if (isBcsU256(arg)) {
330
- return;
331
- }
332
- throwTypeMismatch("U256", position);
333
- }
334
- if (param.isVector()) {
335
- if (arg instanceof MoveVector) {
336
- if (arg.values.length > 0) {
337
- checkType(param.value, arg.values[0], position);
338
- }
339
- return;
340
- }
341
- throwTypeMismatch("MoveVector", position);
342
- }
343
- if (param instanceof TypeTagStruct) {
344
- if (param.isString()) {
345
- if (isBcsString(arg)) {
346
- return;
347
- }
348
- throwTypeMismatch("MoveString", position);
349
- }
350
- if (param.isObject()) {
351
- if (isBcsAddress(arg)) {
352
- return;
353
- }
354
- throwTypeMismatch("AccountAddress", position);
355
- }
356
- if (param.isOption()) {
357
- if (arg instanceof MoveOption) {
358
- if (arg.value !== void 0) {
359
- checkType(param.value.typeArgs[0], arg.value, position);
360
- }
361
- return;
362
- }
363
- throwTypeMismatch("MoveOption", position);
364
- }
365
- }
366
- throw new Error(`Type mismatch for argument ${position}, expected '${param.toString()}'`);
367
- }
368
-
369
- export {
370
- standardizeTypeTags,
371
- fetchFunctionAbi,
372
- fetchMoveFunctionAbi,
373
- fetchEntryFunctionAbi,
374
- fetchViewFunctionAbi,
375
- convertCallArgument,
376
- convertArgument,
377
- checkOrConvertArgument
378
- };
379
- //# sourceMappingURL=chunk-6OFCIXWS.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/transactions/transactionBuilder/remoteAbi.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { parseTypeTag } from \"../typeTag/parser\";\nimport {\n TypeTag,\n TypeTagAddress,\n TypeTagBool,\n TypeTagStruct,\n TypeTagU128,\n TypeTagU16,\n TypeTagU256,\n TypeTagU32,\n TypeTagU64,\n TypeTagU8,\n} from \"../typeTag\";\nimport { AptosConfig } from \"../../api/aptosConfig\";\nimport {\n EntryFunctionArgumentTypes,\n SimpleEntryFunctionArgumentTypes,\n EntryFunctionABI,\n ViewFunctionABI,\n FunctionABI,\n TypeArgument,\n} from \"../types\";\nimport { Bool, MoveOption, MoveString, MoveVector, U128, U16, U256, U32, U64, U8 } from \"../../bcs\";\nimport { AccountAddress } from \"../../core\";\nimport { getModule } from \"../../internal/utils\";\nimport {\n findFirstNonSignerArg,\n isBcsAddress,\n isBcsBool,\n isBcsString,\n isBcsU128,\n isBcsU16,\n isBcsU256,\n isBcsU32,\n isBcsU64,\n isBcsU8,\n isBool,\n isEncodedEntryFunctionArgument,\n isLargeNumber,\n isEmptyOption,\n isString,\n throwTypeMismatch,\n convertNumber,\n} from \"./helpers\";\nimport { CallArgument, MoveFunction } from \"../../types\";\n\nconst TEXT_ENCODER = new TextEncoder();\n\n/**\n * Convert type arguments to only type tags, allowing for string representations of type tags.\n *\n * @param typeArguments - An optional array of type arguments that may include string representations.\n * @returns An array of TypeTag objects derived from the provided type arguments.\n * @group Implementation\n * @category Transactions\n */\nexport function standardizeTypeTags(typeArguments?: Array<TypeArgument>): Array<TypeTag> {\n return (\n typeArguments?.map((typeArg: TypeArgument): TypeTag => {\n // Convert to TypeTag if it's a string representation\n if (isString(typeArg)) {\n return parseTypeTag(typeArg);\n }\n return typeArg;\n }) ?? []\n );\n}\n\n/**\n * Fetches the ABI of a specified function from the on-chain module ABI. This function allows you to access the details of a\n * specific function within a module.\n *\n * @param moduleAddress - The address of the module from which to fetch the function ABI.\n * @param moduleName - The name of the module containing the function.\n * @param functionName - The name of the function whose ABI is to be fetched.\n * @param aptosConfig - The configuration settings for Aptos.\n * @group Implementation\n * @category Transactions\n */\nexport async function fetchFunctionAbi(\n moduleAddress: string,\n moduleName: string,\n functionName: string,\n aptosConfig: AptosConfig,\n): Promise<MoveFunction | undefined> {\n // This fetch from the API is currently cached\n const module = await getModule({ aptosConfig, accountAddress: moduleAddress, moduleName });\n\n if (module.abi) {\n return module.abi.exposed_functions.find((func) => func.name === functionName);\n }\n\n return undefined;\n}\n\n/**\n * Fetches a function ABI from the on-chain module ABI. It doesn't validate whether it's a view or entry function.\n * @param moduleAddress\n * @param moduleName\n * @param functionName\n * @param aptosConfig\n */\nexport async function fetchMoveFunctionAbi(\n moduleAddress: string,\n moduleName: string,\n functionName: string,\n aptosConfig: AptosConfig,\n): Promise<FunctionABI> {\n const functionAbi = await fetchFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig);\n if (!functionAbi) {\n throw new Error(`Could not find function ABI for '${moduleAddress}::${moduleName}::${functionName}'`);\n }\n const params: TypeTag[] = [];\n for (let i = 0; i < functionAbi.params.length; i += 1) {\n params.push(parseTypeTag(functionAbi.params[i], { allowGenerics: true }));\n }\n\n return {\n typeParameters: functionAbi.generic_type_params,\n parameters: params,\n };\n}\n\n/**\n * Fetches the ABI for an entry function from the specified module address.\n * This function validates if the ABI corresponds to an entry function and retrieves its parameters.\n *\n * @param moduleAddress - The address of the module containing the entry function.\n * @param moduleName - The name of the module containing the entry function.\n * @param functionName - The name of the entry function to fetch the ABI for.\n * @param aptosConfig - The configuration settings for Aptos.\n * @returns An object containing the number of signers, type parameters, and function parameters.\n * @throws Error if the ABI cannot be found or if the function is not an entry function.\n * @group Implementation\n * @category Transactions\n */\nexport async function fetchEntryFunctionAbi(\n moduleAddress: string,\n moduleName: string,\n functionName: string,\n aptosConfig: AptosConfig,\n): Promise<EntryFunctionABI> {\n const functionAbi = await fetchFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig);\n\n // If there's no ABI, then the function is invalid\n if (!functionAbi) {\n throw new Error(`Could not find entry function ABI for '${moduleAddress}::${moduleName}::${functionName}'`);\n }\n\n // Non-entry functions also can't be used\n if (!functionAbi.is_entry) {\n throw new Error(`'${moduleAddress}::${moduleName}::${functionName}' is not an entry function`);\n }\n\n // Remove the signer arguments\n const numSigners = findFirstNonSignerArg(functionAbi);\n const params: TypeTag[] = [];\n for (let i = numSigners; i < functionAbi.params.length; i += 1) {\n params.push(parseTypeTag(functionAbi.params[i], { allowGenerics: true }));\n }\n\n return {\n signers: numSigners,\n typeParameters: functionAbi.generic_type_params,\n parameters: params,\n };\n}\n\n/**\n * Fetches the ABI for a view function from the specified module address.\n * This function ensures that the ABI is valid and retrieves the type parameters, parameters, and return types for the view function.\n *\n * @param moduleAddress - The address of the module containing the view function.\n * @param moduleName - The name of the module containing the view function.\n * @param functionName - The name of the view function for which to fetch the ABI.\n * @param aptosConfig - The configuration settings for Aptos.\n * @returns An object containing the type parameters, parameters, and return types of the view function.\n * @throws Error if the ABI cannot be found or if the function is not a view function.\n * @group Implementation\n * @category Transactions\n */\nexport async function fetchViewFunctionAbi(\n moduleAddress: string,\n moduleName: string,\n functionName: string,\n aptosConfig: AptosConfig,\n): Promise<ViewFunctionABI> {\n const functionAbi = await fetchFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig);\n\n // If there's no ABI, then the function is invalid\n if (!functionAbi) {\n throw new Error(`Could not find view function ABI for '${moduleAddress}::${moduleName}::${functionName}'`);\n }\n\n // Non-view functions can't be used\n if (!functionAbi.is_view) {\n throw new Error(`'${moduleAddress}::${moduleName}::${functionName}' is not an view function`);\n }\n\n // Type tag parameters for the function\n const params: TypeTag[] = [];\n for (let i = 0; i < functionAbi.params.length; i += 1) {\n params.push(parseTypeTag(functionAbi.params[i], { allowGenerics: true }));\n }\n\n // The return types of the view function\n const returnTypes: TypeTag[] = [];\n for (let i = 0; i < functionAbi.return.length; i += 1) {\n returnTypes.push(parseTypeTag(functionAbi.return[i], { allowGenerics: true }));\n }\n\n return {\n typeParameters: functionAbi.generic_type_params,\n parameters: params,\n returnTypes,\n };\n}\n\n/**\n * Converts a entry function argument into CallArgument, if necessary.\n * This function checks the provided argument against the expected parameter type and converts it accordingly.\n *\n * @param functionName - The name of the function for which the argument is being converted.\n * @param functionAbi - The ABI (Application Binary Interface) of the function, which defines its parameters.\n * @param argument - The argument to be converted, which can be of various types. If the argument is already\n * CallArgument returned from TransactionComposer it would be returned immediately.\n * @param position - The index of the argument in the function's parameter list.\n * @param genericTypeParams - An array of type tags for any generic type parameters.\n */\nexport function convertCallArgument(\n argument: CallArgument | EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes,\n functionName: string,\n functionAbi: FunctionABI,\n position: number,\n genericTypeParams: Array<TypeTag>,\n): CallArgument {\n if (argument instanceof CallArgument) {\n return argument;\n }\n return CallArgument.newBytes(\n convertArgument(functionName, functionAbi, argument, position, genericTypeParams).bcsToBytes(),\n );\n}\n\n/**\n * Converts a non-BCS encoded argument into BCS encoded, if necessary.\n * This function checks the provided argument against the expected parameter type and converts it accordingly.\n *\n * @param functionName - The name of the function for which the argument is being converted.\n * @param functionAbi - The ABI (Application Binary Interface) of the function, which defines its parameters.\n * @param arg - The argument to be converted, which can be of various types.\n * @param position - The index of the argument in the function's parameter list.\n * @param genericTypeParams - An array of type tags for any generic type parameters.\n * @group Implementation\n * @category Transactions\n */\nexport function convertArgument(\n functionName: string,\n functionAbi: FunctionABI,\n arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes,\n position: number,\n genericTypeParams: Array<TypeTag>,\n) {\n // Ensure not too many arguments\n if (position >= functionAbi.parameters.length) {\n throw new Error(`Too many arguments for '${functionName}', expected ${functionAbi.parameters.length}`);\n }\n\n const param = functionAbi.parameters[position];\n return checkOrConvertArgument(arg, param, position, genericTypeParams);\n}\n\n/**\n * Checks if the provided argument is BCS encoded and converts it if necessary, ensuring type compatibility with the ABI.\n * This function helps in validating and converting arguments for entry functions based on their expected types.\n *\n * @param arg - The argument to check or convert, which can be either a simple or entry function argument type.\n * @param param - The expected type tag for the argument.\n * @param position - The position of the argument in the function call.\n * @param genericTypeParams - An array of generic type parameters that may be used for conversion.\n * @group Implementation\n * @category Transactions\n */\nexport function checkOrConvertArgument(\n arg: SimpleEntryFunctionArgumentTypes | EntryFunctionArgumentTypes,\n param: TypeTag,\n position: number,\n genericTypeParams: Array<TypeTag>,\n) {\n // If the argument is bcs encoded, we can just use it directly\n if (isEncodedEntryFunctionArgument(arg)) {\n // Ensure the type matches the ABI\n\n /**\n * Checks the type of the provided argument against the expected type.\n * This function helps validate that the argument conforms to the specified type requirements.\n *\n * @param typeArgs - The expected type arguments.\n * @param arg - The argument to be checked.\n * @param position - The position of the argument in the context of the check.\n * @group Implementation\n * @category Transactions\n */\n checkType(param, arg, position);\n return arg;\n }\n\n // If it is not BCS encoded, we will need to convert it with the ABI\n return parseArg(arg, param, position, genericTypeParams);\n}\n\n/**\n * Parses a non-BCS encoded argument into a BCS encoded argument recursively.\n * This function helps convert various types of input arguments into their corresponding BCS encoded formats based on the\n * specified parameter type.\n *\n * @param arg - The argument to be parsed, which can be of various types.\n * @param param - The type tag that defines the expected type of the argument.\n * @param position - The position of the argument in the function call, used for error reporting.\n * @param genericTypeParams - An array of type tags for generic type parameters, used when the parameter type is generic.\n * @group Implementation\n * @category Transactions\n */\nfunction parseArg(\n arg: SimpleEntryFunctionArgumentTypes,\n param: TypeTag,\n position: number,\n genericTypeParams: Array<TypeTag>,\n): EntryFunctionArgumentTypes {\n if (param.isBool()) {\n if (isBool(arg)) {\n return new Bool(arg);\n }\n if (isString(arg)) {\n if (arg === \"true\") return new Bool(true);\n if (arg === \"false\") return new Bool(false);\n }\n\n /**\n * Throws a type mismatch error for the specified move option.\n *\n * @param moveOption - The name of the move option that caused the type mismatch.\n * @param position - The position where the error occurred.\n * @group Implementation\n * @category Transactions\n */\n throwTypeMismatch(\"boolean\", position);\n }\n // TODO: support uint8array?\n if (param.isAddress()) {\n if (isString(arg)) {\n return AccountAddress.fromString(arg);\n }\n throwTypeMismatch(\"string | AccountAddress\", position);\n }\n if (param.isU8()) {\n const num = convertNumber(arg);\n if (num !== undefined) {\n return new U8(num);\n }\n throwTypeMismatch(\"number | string\", position);\n }\n if (param.isU16()) {\n const num = convertNumber(arg);\n if (num !== undefined) {\n return new U16(num);\n }\n throwTypeMismatch(\"number | string\", position);\n }\n if (param.isU32()) {\n const num = convertNumber(arg);\n if (num !== undefined) {\n return new U32(num);\n }\n throwTypeMismatch(\"number | string\", position);\n }\n if (param.isU64()) {\n if (isLargeNumber(arg)) {\n return new U64(BigInt(arg));\n }\n throwTypeMismatch(\"bigint | number | string\", position);\n }\n if (param.isU128()) {\n if (isLargeNumber(arg)) {\n return new U128(BigInt(arg));\n }\n throwTypeMismatch(\"bigint | number | string\", position);\n }\n if (param.isU256()) {\n if (isLargeNumber(arg)) {\n return new U256(BigInt(arg));\n }\n throwTypeMismatch(\"bigint | number | string\", position);\n }\n\n // Generic needs to use the subtype\n if (param.isGeneric()) {\n const genericIndex = param.value;\n if (genericIndex < 0 || genericIndex >= genericTypeParams.length) {\n throw new Error(`Generic argument ${param.toString()} is invalid for argument ${position}`);\n }\n\n return checkOrConvertArgument(arg, genericTypeParams[genericIndex], position, genericTypeParams);\n }\n\n // We have to special case some vectors for Vector<u8>\n if (param.isVector()) {\n // Check special case for Vector<u8>\n if (param.value.isU8()) {\n // We don't allow vector<u8>, but we convert strings to UTF8 Uint8Array\n // This is legacy behavior from the original SDK\n if (isString(arg)) {\n return MoveVector.U8(TEXT_ENCODER.encode(arg));\n }\n if (arg instanceof Uint8Array) {\n return MoveVector.U8(arg);\n }\n if (arg instanceof ArrayBuffer) {\n return MoveVector.U8(new Uint8Array(arg));\n }\n }\n\n if (isString(arg)) {\n // In a web env, arguments are passing as strings\n if (arg.startsWith(\"[\")) {\n return checkOrConvertArgument(JSON.parse(arg), param, position, genericTypeParams);\n }\n }\n\n // TODO: Support Uint16Array, Uint32Array, BigUint64Array?\n\n if (Array.isArray(arg)) {\n return new MoveVector(arg.map((item) => checkOrConvertArgument(item, param.value, position, genericTypeParams)));\n }\n\n throw new Error(`Type mismatch for argument ${position}, type '${param.toString()}'`);\n }\n\n // Handle structs as they're more complex\n if (param.isStruct()) {\n if (param.isString()) {\n if (isString(arg)) {\n return new MoveString(arg);\n }\n throwTypeMismatch(\"string\", position);\n }\n if (param.isObject()) {\n // The inner type of Object doesn't matter, since it's just syntactic sugar\n if (isString(arg)) {\n return AccountAddress.fromString(arg);\n }\n throwTypeMismatch(\"string | AccountAddress\", position);\n }\n\n if (param.isOption()) {\n if (isEmptyOption(arg)) {\n // Here we attempt to reconstruct the underlying type\n // Note, for some reason the `isBool` etc. does not work with the compiler\n const innerParam = param.value.typeArgs[0];\n if (innerParam instanceof TypeTagBool) {\n return new MoveOption<Bool>(null);\n }\n if (innerParam instanceof TypeTagAddress) {\n return new MoveOption<AccountAddress>(null);\n }\n if (innerParam instanceof TypeTagU8) {\n return new MoveOption<U8>(null);\n }\n if (innerParam instanceof TypeTagU16) {\n return new MoveOption<U16>(null);\n }\n if (innerParam instanceof TypeTagU32) {\n return new MoveOption<U32>(null);\n }\n if (innerParam instanceof TypeTagU64) {\n return new MoveOption<U64>(null);\n }\n if (innerParam instanceof TypeTagU128) {\n return new MoveOption<U128>(null);\n }\n if (innerParam instanceof TypeTagU256) {\n return new MoveOption<U256>(null);\n }\n\n // In all other cases, we will use a placeholder, it doesn't actually matter what the type is, but it will be obvious\n // Note: This is a placeholder U8 type, and does not match the actual type, as that can't be dynamically grabbed\n return new MoveOption<MoveString>(null);\n }\n\n return new MoveOption(checkOrConvertArgument(arg, param.value.typeArgs[0], position, genericTypeParams));\n }\n\n throw new Error(`Unsupported struct input type for argument ${position}, type '${param.toString()}'`);\n }\n\n throw new Error(`Type mismatch for argument ${position}, type '${param.toString()}'`);\n}\n\n/**\n * Checks that the type of the BCS encoded argument matches the ABI\n * @param param\n * @param arg\n * @param position\n * @group Implementation\n * @category Transactions\n */\nfunction checkType(param: TypeTag, arg: EntryFunctionArgumentTypes, position: number) {\n if (param.isBool()) {\n if (isBcsBool(arg)) {\n return;\n }\n throwTypeMismatch(\"Bool\", position);\n }\n if (param.isAddress()) {\n if (isBcsAddress(arg)) {\n return;\n }\n throwTypeMismatch(\"AccountAddress\", position);\n }\n if (param.isU8()) {\n if (isBcsU8(arg)) {\n return;\n }\n throwTypeMismatch(\"U8\", position);\n }\n if (param.isU16()) {\n if (isBcsU16(arg)) {\n return;\n }\n throwTypeMismatch(\"U16\", position);\n }\n if (param.isU32()) {\n if (isBcsU32(arg)) {\n return;\n }\n throwTypeMismatch(\"U32\", position);\n }\n if (param.isU64()) {\n if (isBcsU64(arg)) {\n return;\n }\n throwTypeMismatch(\"U64\", position);\n }\n if (param.isU128()) {\n if (isBcsU128(arg)) {\n return;\n }\n throwTypeMismatch(\"U128\", position);\n }\n if (param.isU256()) {\n if (isBcsU256(arg)) {\n return;\n }\n throwTypeMismatch(\"U256\", position);\n }\n if (param.isVector()) {\n if (arg instanceof MoveVector) {\n // If there's anything in it, check that the inner types match\n // Note that since it's typed, the first item should be the same as the rest\n if (arg.values.length > 0) {\n checkType(param.value, arg.values[0], position);\n }\n\n return;\n }\n throwTypeMismatch(\"MoveVector\", position);\n }\n\n // Handle structs as they're more complex\n if (param instanceof TypeTagStruct) {\n if (param.isString()) {\n if (isBcsString(arg)) {\n return;\n }\n throwTypeMismatch(\"MoveString\", position);\n }\n if (param.isObject()) {\n if (isBcsAddress(arg)) {\n return;\n }\n throwTypeMismatch(\"AccountAddress\", position);\n }\n if (param.isOption()) {\n if (arg instanceof MoveOption) {\n // If there's a value, we can check the inner type (otherwise it doesn't really matter)\n if (arg.value !== undefined) {\n checkType(param.value.typeArgs[0], arg.value, position);\n }\n return;\n }\n throwTypeMismatch(\"MoveOption\", position);\n }\n }\n\n throw new Error(`Type mismatch for argument ${position}, expected '${param.toString()}'`);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AG;AAClB;AAAA,IACF;AACA,sBAAkB,QAAQ,QAAQ;AAAA,EACpC;AACA,MAAI,MAAM,OAAO,GAAG;AAClB,QAAI,UAAU,GAAG,GAAG;AAClB;AAAA,IACF;AACA,sBAAkB,QAAQ,QAAQ;AAAA,EACpC;AACA,MAAI,MAAM,SAAS,GAAG;AACpB,QAAI,eAAe,YAAY;AAG7B,UAAI,IAAI,OAAO,SAAS,GAAG;AACzB,kBAAU,MAAM,OAAO,IAAI,OAAO,CAAC,GAAG,QAAQ;AAAA,MAChD;AAEA;AAAA,IACF;AACA,sBAAkB,cAAc,QAAQ;AAAA,EAC1C;AAGA,MAAI,iBAAiB,eAAe;AAClC,QAAI,MAAM,SAAS,GAAG;AACpB,UAAI,YAAY,GAAG,GAAG;AACpB;AAAA,MACF;AACA,wBAAkB,cAAc,QAAQ;AAAA,IAC1C;AACA,QAAI,MAAM,SAAS,GAAG;AACpB,UAAI,aAAa,GAAG,GAAG;AACrB;AAAA,MACF;AACA,wBAAkB,kBAAkB,QAAQ;AAAA,IAC9C;AACA,QAAI,MAAM,SAAS,GAAG;AACpB,UAAI,eAAe,YAAY;AAE7B,YAAI,IAAI,UAAU,QAAW;AAC3B,oBAAU,MAAM,MAAM,SAAS,CAAC,GAAG,IAAI,OAAO,QAAQ;AAAA,QACxD;AACA;AAAA,MACF;AACA,wBAAkB,cAAc,QAAQ;AAAA,IAC1C;AAAA,EACF;AAEA,QAAM,IAAI,MAAM,8BAA8B,QAAQ,eAAe,MAAM,SAAS,CAAC,GAAG;AAC1F;","names":[]}
@@ -1,91 +0,0 @@
1
- import {
2
- KeylessPublicKey
3
- } from "./chunk-T573PCIR.mjs";
4
- import {
5
- AccountPublicKey
6
- } from "./chunk-R4JTQQBX.mjs";
7
- import {
8
- AuthenticationKey
9
- } from "./chunk-PKUXOBIV.mjs";
10
- import {
11
- AccountAddress
12
- } from "./chunk-CXLXUSCG.mjs";
13
- import {
14
- Serializer
15
- } from "./chunk-C7T6GW5P.mjs";
16
-
17
- // src/core/crypto/federatedKeyless.ts
18
- var FederatedKeylessPublicKey = class _FederatedKeylessPublicKey extends AccountPublicKey {
19
- constructor(jwkAddress, keylessPublicKey) {
20
- super();
21
- this.jwkAddress = AccountAddress.from(jwkAddress);
22
- this.keylessPublicKey = keylessPublicKey;
23
- }
24
- /**
25
- * Get the authentication key for the federated keyless public key
26
- *
27
- * @returns AuthenticationKey
28
- * @group Implementation
29
- * @category Serialization
30
- */
31
- authKey() {
32
- const serializer = new Serializer();
33
- serializer.serializeU32AsUleb128(4 /* FederatedKeyless */);
34
- serializer.serializeFixedBytes(this.bcsToBytes());
35
- return AuthenticationKey.fromSchemeAndBytes({
36
- scheme: 2 /* SingleKey */,
37
- input: serializer.toUint8Array()
38
- });
39
- }
40
- /**
41
- * Verifies a signed data with a public key
42
- *
43
- * @param args.message message
44
- * @param args.signature The signature
45
- * @returns true if the signature is valid
46
- * @group Implementation
47
- * @category Serialization
48
- */
49
- // eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this
50
- verifySignature(args) {
51
- throw new Error("Not yet implemented");
52
- }
53
- serialize(serializer) {
54
- this.jwkAddress.serialize(serializer);
55
- this.keylessPublicKey.serialize(serializer);
56
- }
57
- static deserialize(deserializer) {
58
- const jwkAddress = AccountAddress.deserialize(deserializer);
59
- const keylessPublicKey = KeylessPublicKey.deserialize(deserializer);
60
- return new _FederatedKeylessPublicKey(jwkAddress, keylessPublicKey);
61
- }
62
- static isPublicKey(publicKey) {
63
- return publicKey instanceof _FederatedKeylessPublicKey;
64
- }
65
- /**
66
- * Creates a FederatedKeylessPublicKey from the JWT components plus pepper
67
- *
68
- * @param args.iss the iss of the identity
69
- * @param args.uidKey the key to use to get the uidVal in the JWT token
70
- * @param args.uidVal the value of the uidKey in the JWT token
71
- * @param args.aud the client ID of the application
72
- * @param args.pepper The pepper used to maintain privacy of the account
73
- * @returns FederatedKeylessPublicKey
74
- * @group Implementation
75
- * @category Serialization
76
- */
77
- static create(args) {
78
- return new _FederatedKeylessPublicKey(args.jwkAddress, KeylessPublicKey.create(args));
79
- }
80
- static fromJwtAndPepper(args) {
81
- return new _FederatedKeylessPublicKey(args.jwkAddress, KeylessPublicKey.fromJwtAndPepper(args));
82
- }
83
- static isInstance(publicKey) {
84
- return "jwkAddress" in publicKey && publicKey.jwkAddress instanceof AccountAddress && "keylessPublicKey" in publicKey && publicKey.keylessPublicKey instanceof KeylessPublicKey;
85
- }
86
- };
87
-
88
- export {
89
- FederatedKeylessPublicKey
90
- };
91
- //# sourceMappingURL=chunk-6SNGKTWE.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/core/crypto/federatedKeyless.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AccountPublicKey, PublicKey } from \"./publicKey\";\nimport { Deserializer, Serializer } from \"../../bcs\";\nimport { HexInput, AnyPublicKeyVariant, SigningScheme } from \"../../types\";\nimport { AuthenticationKey } from \"../authenticationKey\";\nimport { AccountAddress, AccountAddressInput } from \"../accountAddress\";\nimport { KeylessPublicKey, KeylessSignature } from \"./keyless\";\n\n/**\n * Represents the FederatedKeylessPublicKey public key\n *\n * These keys use an on-chain address as a source of truth for the JWK used to verify signatures.\n *\n * FederatedKeylessPublicKey authentication key is represented in the SDK as `AnyPublicKey`.\n * @group Implementation\n * @category Serialization\n */\nexport class FederatedKeylessPublicKey extends AccountPublicKey {\n /**\n * The address that contains the JWK set to be used for verification.\n * @group Implementation\n * @category Serialization\n */\n readonly jwkAddress: AccountAddress;\n\n /**\n * The inner public key which contains the standard Keyless public key.\n * @group Implementation\n * @category Serialization\n */\n readonly keylessPublicKey: KeylessPublicKey;\n\n constructor(jwkAddress: AccountAddressInput, keylessPublicKey: KeylessPublicKey) {\n super();\n this.jwkAddress = AccountAddress.from(jwkAddress);\n this.keylessPublicKey = keylessPublicKey;\n }\n\n /**\n * Get the authentication key for the federated keyless public key\n *\n * @returns AuthenticationKey\n * @group Implementation\n * @category Serialization\n */\n authKey(): AuthenticationKey {\n const serializer = new Serializer();\n serializer.serializeU32AsUleb128(AnyPublicKeyVariant.FederatedKeyless);\n serializer.serializeFixedBytes(this.bcsToBytes());\n return AuthenticationKey.fromSchemeAndBytes({\n scheme: SigningScheme.SingleKey,\n input: serializer.toUint8Array(),\n });\n }\n\n /**\n * Verifies a signed data with a public key\n *\n * @param args.message message\n * @param args.signature The signature\n * @returns true if the signature is valid\n * @group Implementation\n * @category Serialization\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this\n verifySignature(args: { message: HexInput; signature: KeylessSignature }): boolean {\n throw new Error(\"Not yet implemented\");\n }\n\n serialize(serializer: Serializer): void {\n this.jwkAddress.serialize(serializer);\n this.keylessPublicKey.serialize(serializer);\n }\n\n static deserialize(deserializer: Deserializer): FederatedKeylessPublicKey {\n const jwkAddress = AccountAddress.deserialize(deserializer);\n const keylessPublicKey = KeylessPublicKey.deserialize(deserializer);\n return new FederatedKeylessPublicKey(jwkAddress, keylessPublicKey);\n }\n\n static isPublicKey(publicKey: PublicKey): publicKey is FederatedKeylessPublicKey {\n return publicKey instanceof FederatedKeylessPublicKey;\n }\n\n /**\n * Creates a FederatedKeylessPublicKey from the JWT components plus pepper\n *\n * @param args.iss the iss of the identity\n * @param args.uidKey the key to use to get the uidVal in the JWT token\n * @param args.uidVal the value of the uidKey in the JWT token\n * @param args.aud the client ID of the application\n * @param args.pepper The pepper used to maintain privacy of the account\n * @returns FederatedKeylessPublicKey\n * @group Implementation\n * @category Serialization\n */\n static create(args: {\n iss: string;\n uidKey: string;\n uidVal: string;\n aud: string;\n pepper: HexInput;\n jwkAddress: AccountAddressInput;\n }): FederatedKeylessPublicKey {\n return new FederatedKeylessPublicKey(args.jwkAddress, KeylessPublicKey.create(args));\n }\n\n static fromJwtAndPepper(args: {\n jwt: string;\n pepper: HexInput;\n jwkAddress: AccountAddressInput;\n uidKey?: string;\n }): FederatedKeylessPublicKey {\n return new FederatedKeylessPublicKey(args.jwkAddress, KeylessPublicKey.fromJwtAndPepper(args));\n }\n\n static isInstance(publicKey: PublicKey) {\n return (\n \"jwkAddress\" in publicKey &&\n publicKey.jwkAddress instanceof AccountAddress &&\n \"keylessPublicKey\" in publicKey &&\n publicKey.keylessPublicKey instanceof KeylessPublicKey\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAmBO,IAAM,4BAAN,MAAM,mCAAkC,iBAAiB;AAAA,EAe9D,YAAY,YAAiC,kBAAoC;AAC/E,UAAM;AACN,SAAK,aAAa,eAAe,KAAK,UAAU;AAChD,SAAK,mBAAmB;AAAA,EAC1B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,UAA6B;AAC3B,UAAM,aAAa,IAAI,WAAW;AAClC,eAAW,8CAA0D;AACrE,eAAW,oBAAoB,KAAK,WAAW,CAAC;AAChD,WAAO,kBAAkB,mBAAmB;AAAA,MAC1C;AAAA,MACA,OAAO,WAAW,aAAa;AAAA,IACjC,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,gBAAgB,MAAmE;AACjF,UAAM,IAAI,MAAM,qBAAqB;AAAA,EACvC;AAAA,EAEA,UAAU,YAA8B;AACtC,SAAK,WAAW,UAAU,UAAU;AACpC,SAAK,iBAAiB,UAAU,UAAU;AAAA,EAC5C;AAAA,EAEA,OAAO,YAAY,cAAuD;AACxE,UAAM,aAAa,eAAe,YAAY,YAAY;AAC1D,UAAM,mBAAmB,iBAAiB,YAAY,YAAY;AAClE,WAAO,IAAI,2BAA0B,YAAY,gBAAgB;AAAA,EACnE;AAAA,EAEA,OAAO,YAAY,WAA8D;AAC/E,WAAO,qBAAqB;AAAA,EAC9B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcA,OAAO,OAAO,MAOgB;AAC5B,WAAO,IAAI,2BAA0B,KAAK,YAAY,iBAAiB,OAAO,IAAI,CAAC;AAAA,EACrF;AAAA,EAEA,OAAO,iBAAiB,MAKM;AAC5B,WAAO,IAAI,2BAA0B,KAAK,YAAY,iBAAiB,iBAAiB,IAAI,CAAC;AAAA,EAC/F;AAAA,EAEA,OAAO,WAAW,WAAsB;AACtC,WACE,gBAAgB,aAChB,UAAU,sBAAsB,kBAChC,sBAAsB,aACtB,UAAU,4BAA4B;AAAA,EAE1C;AACF;","names":[]}
@@ -1,119 +0,0 @@
1
- import {
2
- aptosBinaryRequest,
3
- aptosRequest
4
- } from "./chunk-G34CJDST.mjs";
5
-
6
- // src/client/post.ts
7
- async function post(options) {
8
- const { type, originMethod, path, body, acceptType, contentType, params, aptosConfig, overrides } = options;
9
- const url = aptosConfig.getRequestUrl(type);
10
- return aptosRequest(
11
- {
12
- url,
13
- method: "POST",
14
- originMethod,
15
- path,
16
- body,
17
- contentType,
18
- acceptType,
19
- params,
20
- overrides
21
- },
22
- aptosConfig,
23
- options.type
24
- );
25
- }
26
- async function postBinary(options) {
27
- const { type, originMethod, path, body, acceptType, contentType, params, aptosConfig, overrides } = options;
28
- const url = aptosConfig.getRequestUrl(type);
29
- return aptosBinaryRequest(
30
- {
31
- url,
32
- method: "POST",
33
- originMethod,
34
- path,
35
- body,
36
- contentType,
37
- acceptType,
38
- params,
39
- overrides
40
- },
41
- aptosConfig,
42
- options.type
43
- );
44
- }
45
- async function postAptosFullNode(options) {
46
- const { aptosConfig } = options;
47
- return post({
48
- ...options,
49
- type: "Fullnode" /* FULLNODE */,
50
- overrides: {
51
- ...aptosConfig.clientConfig,
52
- ...aptosConfig.fullnodeConfig,
53
- ...options.overrides,
54
- HEADERS: { ...aptosConfig.clientConfig?.HEADERS, ...aptosConfig.fullnodeConfig?.HEADERS }
55
- }
56
- });
57
- }
58
- async function postBinaryAptosFullNode(options) {
59
- const { aptosConfig } = options;
60
- return postBinary({
61
- ...options,
62
- type: "Fullnode" /* FULLNODE */,
63
- overrides: {
64
- ...aptosConfig.clientConfig,
65
- ...aptosConfig.fullnodeConfig,
66
- ...options.overrides,
67
- HEADERS: { ...aptosConfig.clientConfig?.HEADERS, ...aptosConfig.fullnodeConfig?.HEADERS }
68
- }
69
- });
70
- }
71
- async function postAptosIndexer(options) {
72
- const { aptosConfig } = options;
73
- return post({
74
- ...options,
75
- type: "Indexer" /* INDEXER */,
76
- overrides: {
77
- ...aptosConfig.clientConfig,
78
- ...aptosConfig.indexerConfig,
79
- ...options.overrides,
80
- HEADERS: { ...aptosConfig.clientConfig?.HEADERS, ...aptosConfig.indexerConfig?.HEADERS }
81
- }
82
- });
83
- }
84
- async function postAptosFaucet(options) {
85
- const { aptosConfig } = options;
86
- const modifiedAptosConfig = {
87
- ...aptosConfig,
88
- clientConfig: { ...aptosConfig.clientConfig }
89
- };
90
- delete modifiedAptosConfig?.clientConfig?.API_KEY;
91
- return post({
92
- ...options,
93
- type: "Faucet" /* FAUCET */,
94
- overrides: {
95
- ...modifiedAptosConfig.clientConfig,
96
- ...modifiedAptosConfig.faucetConfig,
97
- ...options.overrides,
98
- HEADERS: { ...modifiedAptosConfig.clientConfig?.HEADERS, ...modifiedAptosConfig.faucetConfig?.HEADERS }
99
- }
100
- });
101
- }
102
- async function postAptosPepperService(options) {
103
- return post({ ...options, type: "Pepper" /* PEPPER */ });
104
- }
105
- async function postAptosProvingService(options) {
106
- return post({ ...options, type: "Prover" /* PROVER */ });
107
- }
108
-
109
- export {
110
- post,
111
- postBinary,
112
- postAptosFullNode,
113
- postBinaryAptosFullNode,
114
- postAptosIndexer,
115
- postAptosFaucet,
116
- postAptosPepperService,
117
- postAptosProvingService
118
- };
119
- //# sourceMappingURL=chunk-6T3V5LXK.mjs.map