@aptos-labs/ts-sdk 1.32.0 → 1.33.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 (414) hide show
  1. package/dist/common/{accountAddress-6RqI8Aam.d.ts → accountAddress-fJZJVSBc.d.ts} +2 -1
  2. package/dist/common/chunk-F43XVDYJ.js.map +1 -1
  3. package/dist/common/cli/index.d.ts +1 -1
  4. package/dist/common/cli/index.js.map +1 -1
  5. package/dist/common/index.d.ts +31 -116
  6. package/dist/common/index.js +31 -31
  7. package/dist/common/index.js.map +1 -1
  8. package/dist/esm/account/AbstractKeylessAccount.d.mts +0 -1
  9. package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
  10. package/dist/esm/account/Account.d.mts +0 -1
  11. package/dist/esm/account/Account.mjs +1 -1
  12. package/dist/esm/account/Ed25519Account.d.mts +0 -1
  13. package/dist/esm/account/Ed25519Account.mjs +1 -1
  14. package/dist/esm/account/EphemeralKeyPair.d.mts +0 -1
  15. package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
  16. package/dist/esm/account/FederatedKeylessAccount.d.mts +0 -1
  17. package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
  18. package/dist/esm/account/KeylessAccount.d.mts +0 -1
  19. package/dist/esm/account/KeylessAccount.mjs +1 -1
  20. package/dist/esm/account/MultiKeyAccount.d.mts +0 -1
  21. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  22. package/dist/esm/account/SingleKeyAccount.d.mts +0 -1
  23. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  24. package/dist/esm/account/index.d.mts +0 -1
  25. package/dist/esm/account/index.mjs +1 -1
  26. package/dist/esm/api/account.d.mts +0 -1
  27. package/dist/esm/api/account.mjs +1 -1
  28. package/dist/esm/api/ans.d.mts +0 -1
  29. package/dist/esm/api/ans.mjs +1 -1
  30. package/dist/esm/api/aptos.d.mts +0 -2
  31. package/dist/esm/api/aptos.mjs +1 -1
  32. package/dist/esm/api/aptosConfig.d.mts +0 -1
  33. package/dist/esm/api/aptosConfig.mjs +1 -1
  34. package/dist/esm/api/coin.d.mts +0 -1
  35. package/dist/esm/api/coin.mjs +1 -1
  36. package/dist/esm/api/digitalAsset.d.mts +0 -1
  37. package/dist/esm/api/digitalAsset.mjs +1 -1
  38. package/dist/esm/api/event.d.mts +0 -1
  39. package/dist/esm/api/event.mjs +1 -1
  40. package/dist/esm/api/faucet.d.mts +0 -1
  41. package/dist/esm/api/faucet.mjs +1 -1
  42. package/dist/esm/api/fungibleAsset.d.mts +0 -1
  43. package/dist/esm/api/fungibleAsset.mjs +1 -1
  44. package/dist/esm/api/general.d.mts +0 -1
  45. package/dist/esm/api/general.mjs +1 -1
  46. package/dist/esm/api/index.d.mts +0 -2
  47. package/dist/esm/api/index.mjs +1 -1
  48. package/dist/esm/api/keyless.d.mts +0 -1
  49. package/dist/esm/api/keyless.mjs +1 -1
  50. package/dist/esm/api/object.d.mts +0 -1
  51. package/dist/esm/api/object.mjs +1 -1
  52. package/dist/esm/api/staking.d.mts +0 -1
  53. package/dist/esm/api/staking.mjs +1 -1
  54. package/dist/esm/api/table.d.mts +0 -1
  55. package/dist/esm/api/table.mjs +1 -1
  56. package/dist/esm/api/transaction.d.mts +0 -2
  57. package/dist/esm/api/transaction.mjs +1 -1
  58. package/dist/esm/api/transactionSubmission/build.d.mts +0 -66
  59. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  60. package/dist/esm/api/transactionSubmission/helpers.mjs +1 -1
  61. package/dist/esm/api/transactionSubmission/management.d.mts +0 -1
  62. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  63. package/dist/esm/api/transactionSubmission/sign.d.mts +0 -1
  64. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  65. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  66. package/dist/esm/api/transactionSubmission/simulate.d.mts +9 -9
  67. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  68. package/dist/esm/api/transactionSubmission/submit.d.mts +0 -1
  69. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  70. package/dist/esm/api/utils.d.mts +0 -1
  71. package/dist/esm/api/utils.mjs +1 -1
  72. package/dist/esm/bcs/consts.d.mts +0 -1
  73. package/dist/esm/bcs/deserializer.d.mts +0 -1
  74. package/dist/esm/bcs/index.d.mts +0 -1
  75. package/dist/esm/bcs/index.mjs +1 -1
  76. package/dist/esm/bcs/serializable/entryFunctionBytes.d.mts +0 -1
  77. package/dist/esm/bcs/serializable/fixedBytes.d.mts +0 -1
  78. package/dist/esm/bcs/serializable/movePrimitives.d.mts +0 -1
  79. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  80. package/dist/esm/bcs/serializable/moveStructs.d.mts +0 -1
  81. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  82. package/dist/esm/bcs/serializer.d.mts +0 -1
  83. package/dist/esm/{chunk-NHKAQRJB.mjs → chunk-2D7OMWVL.mjs} +2 -2
  84. package/dist/esm/{chunk-HEHVWRMO.mjs → chunk-2E3BT4YW.mjs} +2 -2
  85. package/dist/esm/{chunk-AHWZA3GD.mjs → chunk-476F5NJ6.mjs} +2 -2
  86. package/dist/esm/chunk-476F5NJ6.mjs.map +1 -0
  87. package/dist/esm/{chunk-IBMZYDAR.mjs → chunk-4IQZOAN7.mjs} +2 -2
  88. package/dist/esm/{chunk-6K4TOFCO.mjs → chunk-4ULPBQ3M.mjs} +2 -2
  89. package/dist/esm/{chunk-4DNCQM3S.mjs → chunk-4ZNSNWQL.mjs} +2 -2
  90. package/dist/esm/{chunk-WSFHH3BK.mjs → chunk-5O3RHPER.mjs} +2 -2
  91. package/dist/esm/{chunk-ZRWZIAF5.mjs → chunk-5XLZACVT.mjs} +2 -2
  92. package/dist/esm/{chunk-JDNI5VIJ.mjs → chunk-64IZ5PQR.mjs} +2 -2
  93. package/dist/esm/{chunk-DP3YPGIK.mjs → chunk-6AEXQEO2.mjs} +2 -2
  94. package/dist/esm/{chunk-AAATWCJT.mjs → chunk-737YW3CY.mjs} +2 -2
  95. package/dist/esm/{chunk-K4TJRYGQ.mjs → chunk-7ZA434Z3.mjs} +2 -2
  96. package/dist/esm/{chunk-E2NYQVP3.mjs → chunk-7ZVXQAG4.mjs} +2 -2
  97. package/dist/esm/{chunk-L2QVUMBV.mjs → chunk-A3USS2NC.mjs} +2 -2
  98. package/dist/esm/{chunk-2NHQQQZK.mjs → chunk-A7TJF3BX.mjs} +2 -2
  99. package/dist/esm/{chunk-XT5T5LAP.mjs → chunk-ALOYOMRE.mjs} +2 -2
  100. package/dist/esm/{chunk-XUP6VABV.mjs → chunk-B5BXB2BB.mjs} +2 -2
  101. package/dist/esm/{chunk-37Y54PJ5.mjs → chunk-BWV6OYLG.mjs} +2 -2
  102. package/dist/esm/{chunk-PW3ISXPN.mjs → chunk-CK5NDXQT.mjs} +2 -2
  103. package/dist/esm/{chunk-X3JPX7T6.mjs → chunk-D54FD6XE.mjs} +2 -2
  104. package/dist/esm/chunk-FD6FGKYY.mjs +1 -0
  105. package/dist/esm/{chunk-IDNDUJOK.mjs → chunk-FH27D7S3.mjs} +2 -2
  106. package/dist/esm/{chunk-DDVOBEJA.mjs → chunk-FSBEKFEF.mjs} +2 -2
  107. package/dist/esm/{chunk-YPBNYKOD.mjs → chunk-FUC7SLH7.mjs} +2 -2
  108. package/dist/esm/{chunk-46L6BAJG.mjs → chunk-GT7QFXER.mjs} +2 -2
  109. package/dist/esm/{chunk-H457BI3I.mjs → chunk-H7PDLUNP.mjs} +2 -2
  110. package/dist/esm/{chunk-CA3Q2X6B.mjs → chunk-HKVZ7CAG.mjs} +2 -2
  111. package/dist/esm/{chunk-JJUINAQE.mjs → chunk-HULCIESG.mjs} +2 -2
  112. package/dist/esm/chunk-HULCIESG.mjs.map +1 -0
  113. package/dist/esm/{chunk-QQM47PHZ.mjs → chunk-I3452DF5.mjs} +2 -2
  114. package/dist/esm/chunk-I5OYNCZS.mjs +1 -0
  115. package/dist/esm/chunk-IHGA5KAD.mjs +2 -0
  116. package/dist/esm/{chunk-I2NMCLNW.mjs.map → chunk-IHGA5KAD.mjs.map} +1 -1
  117. package/dist/esm/{chunk-J245N3XF.mjs → chunk-J7PJSK3J.mjs} +2 -2
  118. package/dist/esm/{chunk-J245N3XF.mjs.map → chunk-J7PJSK3J.mjs.map} +1 -1
  119. package/dist/esm/{chunk-VCY3JGZM.mjs → chunk-JKA22FG5.mjs} +2 -2
  120. package/dist/esm/{chunk-SBCLBDCP.mjs → chunk-JUQBFGUD.mjs} +2 -2
  121. package/dist/esm/{chunk-II654QZU.mjs → chunk-JYGAG754.mjs} +2 -2
  122. package/dist/esm/{chunk-LAAFLCDM.mjs → chunk-KKLF7DQV.mjs} +2 -2
  123. package/dist/esm/chunk-KPPM2BSC.mjs +2 -0
  124. package/dist/esm/chunk-KPPM2BSC.mjs.map +1 -0
  125. package/dist/esm/{chunk-JLD7DLKM.mjs → chunk-L3J2QVIY.mjs} +2 -2
  126. package/dist/esm/{chunk-MOGPSSTD.mjs → chunk-LK67PZX3.mjs} +2 -2
  127. package/dist/esm/{chunk-6LLGRGCN.mjs → chunk-LRN4ALMT.mjs} +2 -2
  128. package/dist/esm/{chunk-BLLHTGAP.mjs → chunk-LWXBEIFO.mjs} +2 -2
  129. package/dist/esm/{chunk-7WXDXBXK.mjs → chunk-LZ5PSDOS.mjs} +2 -2
  130. package/dist/esm/chunk-MCWOKFVH.mjs +2 -0
  131. package/dist/esm/chunk-MCWOKFVH.mjs.map +1 -0
  132. package/dist/esm/{chunk-GBVRCWCD.mjs → chunk-MV5PGWJQ.mjs} +2 -2
  133. package/dist/esm/{chunk-4YEOOZ2N.mjs → chunk-MWNYODWU.mjs} +2 -2
  134. package/dist/esm/{chunk-YNT7JHMS.mjs → chunk-O4MRRWRI.mjs} +2 -2
  135. package/dist/esm/chunk-OEM75TVE.mjs +2 -0
  136. package/dist/esm/chunk-OEM75TVE.mjs.map +1 -0
  137. package/dist/esm/{chunk-F2AIWA7L.mjs → chunk-OGBU52BQ.mjs} +2 -2
  138. package/dist/esm/{chunk-KT3DT5GV.mjs → chunk-P6RNNESB.mjs} +2 -2
  139. package/dist/esm/{chunk-WGIYSLH6.mjs → chunk-P74XXLE4.mjs} +2 -2
  140. package/dist/esm/{chunk-TM7OZT3W.mjs → chunk-Q3CWUEXI.mjs} +2 -2
  141. package/dist/esm/{chunk-OJBMR5CT.mjs → chunk-QK32EQSF.mjs} +2 -2
  142. package/dist/esm/{chunk-NARS3JDH.mjs → chunk-QLC7SSLJ.mjs} +2 -2
  143. package/dist/esm/chunk-QN7AK5PU.mjs +2 -0
  144. package/dist/esm/chunk-QN7AK5PU.mjs.map +1 -0
  145. package/dist/esm/{chunk-3XCYCFYI.mjs → chunk-QZT2M7UA.mjs} +2 -2
  146. package/dist/esm/{chunk-HXXELLHN.mjs → chunk-R2YT2IM5.mjs} +2 -2
  147. package/dist/esm/{chunk-HFWFDS6Y.mjs → chunk-RV7PNWDY.mjs} +2 -2
  148. package/dist/esm/{chunk-SU2WB34N.mjs → chunk-S22QVNK7.mjs} +2 -2
  149. package/dist/esm/{chunk-2QBCTW67.mjs → chunk-S3YVCCYI.mjs} +2 -2
  150. package/dist/esm/{chunk-KUL55M2H.mjs → chunk-SMFTISPN.mjs} +2 -2
  151. package/dist/esm/{chunk-FXUI3SSD.mjs → chunk-TQA6HY6A.mjs} +2 -2
  152. package/dist/esm/{chunk-L2SDI7PI.mjs → chunk-TTERI67T.mjs} +2 -2
  153. package/dist/esm/chunk-U2PRGW4O.mjs +2 -0
  154. package/dist/esm/chunk-U2PRGW4O.mjs.map +1 -0
  155. package/dist/esm/{chunk-DSKAMBBL.mjs → chunk-U7UTBXJD.mjs} +2 -2
  156. package/dist/esm/{chunk-5NJWJXSS.mjs → chunk-VAKNMHOA.mjs} +2 -2
  157. package/dist/esm/{chunk-ONFKJ57C.mjs → chunk-VELQA2Y3.mjs} +2 -2
  158. package/dist/esm/chunk-WTWWJWKC.mjs +2 -0
  159. package/dist/esm/chunk-WTWWJWKC.mjs.map +1 -0
  160. package/dist/esm/{chunk-AVPQOD67.mjs → chunk-WXLSHECY.mjs} +2 -2
  161. package/dist/esm/{chunk-OKE3FXIP.mjs → chunk-XOOYRVFK.mjs} +2 -2
  162. package/dist/esm/{chunk-6PJH53CK.mjs → chunk-XVPWTWPY.mjs} +2 -2
  163. package/dist/esm/{chunk-KA5FX53Q.mjs → chunk-Y5HLXDYG.mjs} +2 -2
  164. package/dist/esm/{chunk-5AKSORBJ.mjs → chunk-YITOC4Z6.mjs} +2 -2
  165. package/dist/esm/chunk-YQHOQJRQ.mjs +2 -0
  166. package/dist/esm/{chunk-AMCJQIOT.mjs.map → chunk-YQHOQJRQ.mjs.map} +1 -1
  167. package/dist/esm/{chunk-WKNX43KN.mjs → chunk-YT3IP57B.mjs} +2 -2
  168. package/dist/esm/cli/index.d.mts +0 -1
  169. package/dist/esm/cli/move.d.mts +0 -1
  170. package/dist/esm/client/core.d.mts +0 -1
  171. package/dist/esm/client/core.mjs +1 -1
  172. package/dist/esm/client/get.d.mts +0 -1
  173. package/dist/esm/client/get.mjs +1 -1
  174. package/dist/esm/client/index.d.mts +0 -1
  175. package/dist/esm/client/index.mjs +1 -1
  176. package/dist/esm/client/post.d.mts +0 -1
  177. package/dist/esm/client/post.mjs +1 -1
  178. package/dist/esm/core/account/index.d.mts +0 -1
  179. package/dist/esm/core/account/index.mjs +1 -1
  180. package/dist/esm/core/account/utils/address.d.mts +0 -1
  181. package/dist/esm/core/account/utils/address.mjs +1 -1
  182. package/dist/esm/core/account/utils/index.d.mts +0 -1
  183. package/dist/esm/core/account/utils/index.mjs +1 -1
  184. package/dist/esm/core/accountAddress.d.mts +0 -1
  185. package/dist/esm/core/accountAddress.mjs +1 -1
  186. package/dist/esm/core/authenticationKey.d.mts +0 -1
  187. package/dist/esm/core/authenticationKey.mjs +1 -1
  188. package/dist/esm/core/crypto/ed25519.d.mts +0 -1
  189. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  190. package/dist/esm/core/crypto/ephemeral.d.mts +0 -1
  191. package/dist/esm/core/crypto/ephemeral.mjs +1 -1
  192. package/dist/esm/core/crypto/federatedKeyless.d.mts +0 -1
  193. package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
  194. package/dist/esm/core/crypto/index.d.mts +0 -1
  195. package/dist/esm/core/crypto/index.mjs +1 -1
  196. package/dist/esm/core/crypto/keyless.d.mts +0 -1
  197. package/dist/esm/core/crypto/keyless.mjs +1 -1
  198. package/dist/esm/core/crypto/multiEd25519.d.mts +0 -1
  199. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  200. package/dist/esm/core/crypto/multiKey.d.mts +0 -1
  201. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  202. package/dist/esm/core/crypto/privateKey.d.mts +0 -1
  203. package/dist/esm/core/crypto/privateKey.mjs +1 -1
  204. package/dist/esm/core/crypto/proof.d.mts +0 -1
  205. package/dist/esm/core/crypto/proof.mjs +1 -1
  206. package/dist/esm/core/crypto/publicKey.d.mts +0 -1
  207. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  208. package/dist/esm/core/crypto/secp256k1.d.mts +0 -1
  209. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  210. package/dist/esm/core/crypto/signature.d.mts +0 -1
  211. package/dist/esm/core/crypto/signature.mjs +1 -1
  212. package/dist/esm/core/crypto/singleKey.d.mts +0 -1
  213. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  214. package/dist/esm/core/crypto/utils.d.mts +0 -1
  215. package/dist/esm/core/hex.d.mts +0 -1
  216. package/dist/esm/core/index.d.mts +0 -1
  217. package/dist/esm/core/index.mjs +1 -1
  218. package/dist/esm/errors/index.d.mts +0 -1
  219. package/dist/esm/errors/index.mjs +1 -1
  220. package/dist/esm/index.d.mts +4 -6
  221. package/dist/esm/index.mjs +1 -1
  222. package/dist/esm/internal/account.d.mts +0 -1
  223. package/dist/esm/internal/account.mjs +1 -1
  224. package/dist/esm/internal/ans.d.mts +0 -1
  225. package/dist/esm/internal/ans.mjs +1 -1
  226. package/dist/esm/internal/coin.d.mts +0 -1
  227. package/dist/esm/internal/coin.mjs +1 -1
  228. package/dist/esm/internal/digitalAsset.d.mts +0 -1
  229. package/dist/esm/internal/digitalAsset.mjs +1 -1
  230. package/dist/esm/internal/event.d.mts +0 -1
  231. package/dist/esm/internal/event.mjs +1 -1
  232. package/dist/esm/internal/faucet.d.mts +0 -1
  233. package/dist/esm/internal/faucet.mjs +1 -1
  234. package/dist/esm/internal/fungibleAsset.d.mts +0 -1
  235. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  236. package/dist/esm/internal/general.d.mts +0 -1
  237. package/dist/esm/internal/general.mjs +1 -1
  238. package/dist/esm/internal/keyless.d.mts +0 -1
  239. package/dist/esm/internal/keyless.mjs +1 -1
  240. package/dist/esm/internal/object.d.mts +0 -1
  241. package/dist/esm/internal/object.mjs +1 -1
  242. package/dist/esm/internal/staking.d.mts +0 -1
  243. package/dist/esm/internal/staking.mjs +1 -1
  244. package/dist/esm/internal/table.d.mts +0 -1
  245. package/dist/esm/internal/table.mjs +1 -1
  246. package/dist/esm/internal/transaction.d.mts +0 -1
  247. package/dist/esm/internal/transaction.mjs +1 -1
  248. package/dist/esm/internal/transactionSubmission.d.mts +1 -2
  249. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  250. package/dist/esm/internal/view.d.mts +0 -1
  251. package/dist/esm/internal/view.mjs +1 -1
  252. package/dist/esm/transactions/authenticator/account.d.mts +10 -2
  253. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  254. package/dist/esm/transactions/authenticator/index.d.mts +1 -2
  255. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  256. package/dist/esm/transactions/authenticator/transaction.d.mts +0 -1
  257. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  258. package/dist/esm/transactions/index.d.mts +3 -5
  259. package/dist/esm/transactions/index.mjs +1 -1
  260. package/dist/esm/transactions/instances/chainId.d.mts +0 -1
  261. package/dist/esm/transactions/instances/identifier.d.mts +0 -1
  262. package/dist/esm/transactions/instances/index.d.mts +0 -1
  263. package/dist/esm/transactions/instances/index.mjs +1 -1
  264. package/dist/esm/transactions/instances/moduleId.d.mts +0 -1
  265. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  266. package/dist/esm/transactions/instances/multiAgentTransaction.d.mts +0 -1
  267. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  268. package/dist/esm/transactions/instances/rawTransaction.d.mts +0 -1
  269. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  270. package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +0 -1
  271. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  272. package/dist/esm/transactions/instances/signedTransaction.d.mts +0 -1
  273. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  274. package/dist/esm/transactions/instances/simpleTransaction.d.mts +0 -1
  275. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  276. package/dist/esm/transactions/instances/transactionArgument.d.mts +0 -1
  277. package/dist/esm/transactions/instances/transactionPayload.d.mts +0 -1
  278. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  279. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +0 -1
  280. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  281. package/dist/esm/transactions/management/index.d.mts +0 -1
  282. package/dist/esm/transactions/management/index.mjs +1 -1
  283. package/dist/esm/transactions/management/transactionWorker.d.mts +0 -1
  284. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  285. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +0 -1
  286. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  287. package/dist/esm/transactions/transactionBuilder/index.d.mts +1 -2
  288. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  289. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +2 -23
  290. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  291. package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +0 -1
  292. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  293. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +2 -3
  294. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  295. package/dist/esm/transactions/typeTag/index.d.mts +0 -1
  296. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  297. package/dist/esm/transactions/typeTag/parser.d.mts +0 -1
  298. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  299. package/dist/esm/transactions/types.d.mts +4 -12
  300. package/dist/esm/types/index.d.mts +0 -1
  301. package/dist/esm/types/index.mjs +1 -1
  302. package/dist/esm/types/types.d.mts +2 -2
  303. package/dist/esm/types/types.mjs +1 -1
  304. package/dist/esm/utils/const.d.mts +7 -1
  305. package/dist/esm/utils/const.mjs +1 -1
  306. package/dist/esm/utils/helpers.d.mts +0 -1
  307. package/dist/esm/utils/index.d.mts +1 -2
  308. package/dist/esm/utils/index.mjs +1 -1
  309. package/dist/esm/utils/normalizeBundle.d.mts +0 -1
  310. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  311. package/dist/esm/version.d.mts +1 -1
  312. package/dist/esm/version.mjs +1 -1
  313. package/package.json +2 -3
  314. package/src/api/transactionSubmission/build.ts +1 -82
  315. package/src/api/transactionSubmission/helpers.ts +0 -6
  316. package/src/api/transactionSubmission/simulate.ts +9 -8
  317. package/src/internal/keyless.ts +11 -1
  318. package/src/internal/transactionSubmission.ts +1 -1
  319. package/src/transactions/authenticator/account.ts +19 -0
  320. package/src/transactions/index.ts +0 -1
  321. package/src/transactions/transactionBuilder/remoteAbi.ts +1 -55
  322. package/src/transactions/transactionBuilder/transactionBuilder.ts +25 -17
  323. package/src/transactions/types.ts +3 -13
  324. package/src/types/index.ts +0 -1
  325. package/src/types/types.ts +1 -0
  326. package/src/utils/const.ts +7 -0
  327. package/src/version.ts +1 -1
  328. package/dist/esm/chunk-3DQVGPFE.mjs +0 -2
  329. package/dist/esm/chunk-3DQVGPFE.mjs.map +0 -1
  330. package/dist/esm/chunk-4PBXTMN3.mjs +0 -2
  331. package/dist/esm/chunk-4PBXTMN3.mjs.map +0 -1
  332. package/dist/esm/chunk-AHWZA3GD.mjs.map +0 -1
  333. package/dist/esm/chunk-AMCJQIOT.mjs +0 -2
  334. package/dist/esm/chunk-EEB7EZFO.mjs +0 -2
  335. package/dist/esm/chunk-EEB7EZFO.mjs.map +0 -1
  336. package/dist/esm/chunk-G2GN4LH5.mjs +0 -2
  337. package/dist/esm/chunk-G2GN4LH5.mjs.map +0 -1
  338. package/dist/esm/chunk-I2NMCLNW.mjs +0 -2
  339. package/dist/esm/chunk-JJUINAQE.mjs.map +0 -1
  340. package/dist/esm/chunk-L56DQ4N3.mjs +0 -2
  341. package/dist/esm/chunk-L56DQ4N3.mjs.map +0 -1
  342. package/dist/esm/chunk-UIRAXHDH.mjs +0 -1
  343. package/dist/esm/chunk-WQF3IOXC.mjs +0 -2
  344. package/dist/esm/chunk-WQF3IOXC.mjs.map +0 -1
  345. package/dist/esm/chunk-XKOSS5KC.mjs +0 -2
  346. package/dist/esm/chunk-XKOSS5KC.mjs.map +0 -1
  347. package/dist/esm/chunk-YZ3YPLEU.mjs +0 -2
  348. package/dist/esm/chunk-YZ3YPLEU.mjs.map +0 -1
  349. package/dist/esm/transactions/script-composer/index.d.mts +0 -44
  350. package/dist/esm/transactions/script-composer/index.mjs +0 -2
  351. package/src/transactions/script-composer/index.ts +0 -76
  352. /package/dist/esm/{chunk-NHKAQRJB.mjs.map → chunk-2D7OMWVL.mjs.map} +0 -0
  353. /package/dist/esm/{chunk-HEHVWRMO.mjs.map → chunk-2E3BT4YW.mjs.map} +0 -0
  354. /package/dist/esm/{chunk-IBMZYDAR.mjs.map → chunk-4IQZOAN7.mjs.map} +0 -0
  355. /package/dist/esm/{chunk-6K4TOFCO.mjs.map → chunk-4ULPBQ3M.mjs.map} +0 -0
  356. /package/dist/esm/{chunk-4DNCQM3S.mjs.map → chunk-4ZNSNWQL.mjs.map} +0 -0
  357. /package/dist/esm/{chunk-WSFHH3BK.mjs.map → chunk-5O3RHPER.mjs.map} +0 -0
  358. /package/dist/esm/{chunk-ZRWZIAF5.mjs.map → chunk-5XLZACVT.mjs.map} +0 -0
  359. /package/dist/esm/{chunk-JDNI5VIJ.mjs.map → chunk-64IZ5PQR.mjs.map} +0 -0
  360. /package/dist/esm/{chunk-DP3YPGIK.mjs.map → chunk-6AEXQEO2.mjs.map} +0 -0
  361. /package/dist/esm/{chunk-AAATWCJT.mjs.map → chunk-737YW3CY.mjs.map} +0 -0
  362. /package/dist/esm/{chunk-K4TJRYGQ.mjs.map → chunk-7ZA434Z3.mjs.map} +0 -0
  363. /package/dist/esm/{chunk-E2NYQVP3.mjs.map → chunk-7ZVXQAG4.mjs.map} +0 -0
  364. /package/dist/esm/{chunk-L2QVUMBV.mjs.map → chunk-A3USS2NC.mjs.map} +0 -0
  365. /package/dist/esm/{chunk-2NHQQQZK.mjs.map → chunk-A7TJF3BX.mjs.map} +0 -0
  366. /package/dist/esm/{chunk-XT5T5LAP.mjs.map → chunk-ALOYOMRE.mjs.map} +0 -0
  367. /package/dist/esm/{chunk-XUP6VABV.mjs.map → chunk-B5BXB2BB.mjs.map} +0 -0
  368. /package/dist/esm/{chunk-37Y54PJ5.mjs.map → chunk-BWV6OYLG.mjs.map} +0 -0
  369. /package/dist/esm/{chunk-PW3ISXPN.mjs.map → chunk-CK5NDXQT.mjs.map} +0 -0
  370. /package/dist/esm/{chunk-X3JPX7T6.mjs.map → chunk-D54FD6XE.mjs.map} +0 -0
  371. /package/dist/esm/{chunk-UIRAXHDH.mjs.map → chunk-FD6FGKYY.mjs.map} +0 -0
  372. /package/dist/esm/{chunk-IDNDUJOK.mjs.map → chunk-FH27D7S3.mjs.map} +0 -0
  373. /package/dist/esm/{chunk-DDVOBEJA.mjs.map → chunk-FSBEKFEF.mjs.map} +0 -0
  374. /package/dist/esm/{chunk-YPBNYKOD.mjs.map → chunk-FUC7SLH7.mjs.map} +0 -0
  375. /package/dist/esm/{chunk-46L6BAJG.mjs.map → chunk-GT7QFXER.mjs.map} +0 -0
  376. /package/dist/esm/{chunk-H457BI3I.mjs.map → chunk-H7PDLUNP.mjs.map} +0 -0
  377. /package/dist/esm/{chunk-CA3Q2X6B.mjs.map → chunk-HKVZ7CAG.mjs.map} +0 -0
  378. /package/dist/esm/{chunk-QQM47PHZ.mjs.map → chunk-I3452DF5.mjs.map} +0 -0
  379. /package/dist/esm/{transactions/script-composer/index.mjs.map → chunk-I5OYNCZS.mjs.map} +0 -0
  380. /package/dist/esm/{chunk-VCY3JGZM.mjs.map → chunk-JKA22FG5.mjs.map} +0 -0
  381. /package/dist/esm/{chunk-SBCLBDCP.mjs.map → chunk-JUQBFGUD.mjs.map} +0 -0
  382. /package/dist/esm/{chunk-II654QZU.mjs.map → chunk-JYGAG754.mjs.map} +0 -0
  383. /package/dist/esm/{chunk-LAAFLCDM.mjs.map → chunk-KKLF7DQV.mjs.map} +0 -0
  384. /package/dist/esm/{chunk-JLD7DLKM.mjs.map → chunk-L3J2QVIY.mjs.map} +0 -0
  385. /package/dist/esm/{chunk-MOGPSSTD.mjs.map → chunk-LK67PZX3.mjs.map} +0 -0
  386. /package/dist/esm/{chunk-6LLGRGCN.mjs.map → chunk-LRN4ALMT.mjs.map} +0 -0
  387. /package/dist/esm/{chunk-BLLHTGAP.mjs.map → chunk-LWXBEIFO.mjs.map} +0 -0
  388. /package/dist/esm/{chunk-7WXDXBXK.mjs.map → chunk-LZ5PSDOS.mjs.map} +0 -0
  389. /package/dist/esm/{chunk-GBVRCWCD.mjs.map → chunk-MV5PGWJQ.mjs.map} +0 -0
  390. /package/dist/esm/{chunk-4YEOOZ2N.mjs.map → chunk-MWNYODWU.mjs.map} +0 -0
  391. /package/dist/esm/{chunk-YNT7JHMS.mjs.map → chunk-O4MRRWRI.mjs.map} +0 -0
  392. /package/dist/esm/{chunk-F2AIWA7L.mjs.map → chunk-OGBU52BQ.mjs.map} +0 -0
  393. /package/dist/esm/{chunk-KT3DT5GV.mjs.map → chunk-P6RNNESB.mjs.map} +0 -0
  394. /package/dist/esm/{chunk-WGIYSLH6.mjs.map → chunk-P74XXLE4.mjs.map} +0 -0
  395. /package/dist/esm/{chunk-TM7OZT3W.mjs.map → chunk-Q3CWUEXI.mjs.map} +0 -0
  396. /package/dist/esm/{chunk-OJBMR5CT.mjs.map → chunk-QK32EQSF.mjs.map} +0 -0
  397. /package/dist/esm/{chunk-NARS3JDH.mjs.map → chunk-QLC7SSLJ.mjs.map} +0 -0
  398. /package/dist/esm/{chunk-3XCYCFYI.mjs.map → chunk-QZT2M7UA.mjs.map} +0 -0
  399. /package/dist/esm/{chunk-HXXELLHN.mjs.map → chunk-R2YT2IM5.mjs.map} +0 -0
  400. /package/dist/esm/{chunk-HFWFDS6Y.mjs.map → chunk-RV7PNWDY.mjs.map} +0 -0
  401. /package/dist/esm/{chunk-SU2WB34N.mjs.map → chunk-S22QVNK7.mjs.map} +0 -0
  402. /package/dist/esm/{chunk-2QBCTW67.mjs.map → chunk-S3YVCCYI.mjs.map} +0 -0
  403. /package/dist/esm/{chunk-KUL55M2H.mjs.map → chunk-SMFTISPN.mjs.map} +0 -0
  404. /package/dist/esm/{chunk-FXUI3SSD.mjs.map → chunk-TQA6HY6A.mjs.map} +0 -0
  405. /package/dist/esm/{chunk-L2SDI7PI.mjs.map → chunk-TTERI67T.mjs.map} +0 -0
  406. /package/dist/esm/{chunk-DSKAMBBL.mjs.map → chunk-U7UTBXJD.mjs.map} +0 -0
  407. /package/dist/esm/{chunk-5NJWJXSS.mjs.map → chunk-VAKNMHOA.mjs.map} +0 -0
  408. /package/dist/esm/{chunk-ONFKJ57C.mjs.map → chunk-VELQA2Y3.mjs.map} +0 -0
  409. /package/dist/esm/{chunk-AVPQOD67.mjs.map → chunk-WXLSHECY.mjs.map} +0 -0
  410. /package/dist/esm/{chunk-OKE3FXIP.mjs.map → chunk-XOOYRVFK.mjs.map} +0 -0
  411. /package/dist/esm/{chunk-6PJH53CK.mjs.map → chunk-XVPWTWPY.mjs.map} +0 -0
  412. /package/dist/esm/{chunk-KA5FX53Q.mjs.map → chunk-Y5HLXDYG.mjs.map} +0 -0
  413. /package/dist/esm/{chunk-5AKSORBJ.mjs.map → chunk-YITOC4Z6.mjs.map} +0 -0
  414. /package/dist/esm/{chunk-WKNX43KN.mjs.map → chunk-YT3IP57B.mjs.map} +0 -0
@@ -47,7 +47,7 @@ export class Simulate {
47
47
  * This function helps you understand the outcome of a transaction before executing it on the blockchain.
48
48
  *
49
49
  * @param args - The parameters for simulating the transaction.
50
- * @param args.signerPublicKey - The public key of the signer for the transaction.
50
+ * @param args.signerPublicKey - The public key of the signer for the transaction (optional).
51
51
  * @param args.transaction - The raw transaction data to simulate.
52
52
  * @param args.feePayerPublicKey - The public key of the fee payer (optional).
53
53
  * @param args.options - Additional options for simulating the transaction (optional).
@@ -100,7 +100,7 @@ export class Simulate {
100
100
  */
101
101
  @ValidateFeePayerDataOnSimulation
102
102
  async simple(args: {
103
- signerPublicKey: PublicKey;
103
+ signerPublicKey?: PublicKey;
104
104
  transaction: AnyRawTransaction;
105
105
  feePayerPublicKey?: PublicKey;
106
106
  options?: InputSimulateTransactionOptions;
@@ -113,11 +113,12 @@ export class Simulate {
113
113
  * This function helps in understanding the outcome of a transaction involving multiple signers before it is executed.
114
114
  *
115
115
  * @param args - The parameters for simulating the transaction.
116
- * @param args.signerPublicKey - The public key of the primary signer.
116
+ * @param args.signerPublicKey - The public key of the primary signer (optional).
117
117
  * @param args.transaction - The raw transaction to be simulated.
118
- * @param args.secondarySignersPublicKeys - An array of public keys for secondary signers.
119
- * @param args.feePayerPublicKey - (Optional) The public key of the fee payer.
120
- * @param args.options - (Optional) Options for simulating the transaction.
118
+ * @param args.secondarySignersPublicKeys - An array of public keys for secondary signers (optional).
119
+ * Each element of the array can be optional, allowing the corresponding key check to be skipped.
120
+ * @param args.feePayerPublicKey - The public key of the fee payer (optional).
121
+ * @param args.options - Options for simulating the transaction (optional).
121
122
  *
122
123
  * @example
123
124
  * ```typescript
@@ -176,9 +177,9 @@ export class Simulate {
176
177
  */
177
178
  @ValidateFeePayerDataOnSimulation
178
179
  async multiAgent(args: {
179
- signerPublicKey: PublicKey;
180
+ signerPublicKey?: PublicKey;
180
181
  transaction: AnyRawTransaction;
181
- secondarySignersPublicKeys: Array<PublicKey>;
182
+ secondarySignersPublicKeys?: Array<PublicKey | undefined>;
182
183
  feePayerPublicKey?: PublicKey;
183
184
  options?: InputSimulateTransactionOptions;
184
185
  }): Promise<Array<UserTransactionResponse>> {
@@ -31,6 +31,7 @@ import { MoveVector } from "../bcs";
31
31
  import { generateTransaction } from "./transactionSubmission";
32
32
  import { InputGenerateTransactionOptions, SimpleTransaction } from "../transactions";
33
33
  import { KeylessError, KeylessErrorType } from "../errors";
34
+ import { FIREBASE_AUTH_ISS_PATTERN } from "../utils/const";
34
35
 
35
36
  /**
36
37
  * Retrieves a pepper value based on the provided configuration and authentication details.
@@ -232,7 +233,16 @@ export async function updateFederatedKeylessJwkSetTransaction(args: {
232
233
  options?: InputGenerateTransactionOptions;
233
234
  }): Promise<SimpleTransaction> {
234
235
  const { aptosConfig, sender, iss, options } = args;
235
- const jwksUrl = args.jwksUrl ?? (iss.endsWith("/") ? `${iss}.well-known/jwks.json` : `${iss}/.well-known/jwks.json`);
236
+
237
+ let { jwksUrl } = args;
238
+
239
+ if (jwksUrl === undefined) {
240
+ if (FIREBASE_AUTH_ISS_PATTERN.test(iss)) {
241
+ jwksUrl = "https://www.googleapis.com/service_accounts/v1/jwk/securetoken@system.gserviceaccount.com";
242
+ } else {
243
+ jwksUrl = iss.endsWith("/") ? `${iss}.well-known/jwks.json` : `${iss}/.well-known/jwks.json`;
244
+ }
245
+ }
236
246
 
237
247
  let response: Response;
238
248
 
@@ -258,7 +258,7 @@ export function signAsFeePayer(args: { signer: Account; transaction: AnyRawTrans
258
258
  * @param args The arguments for simulating the transaction.
259
259
  * @param args.aptosConfig The configuration for the Aptos network.
260
260
  * @param args.transaction The raw transaction to simulate.
261
- * @param args.signerPublicKey The signer public key.
261
+ * @param args.signerPublicKey Optional. The signer public key.
262
262
  * @param args.secondarySignersPublicKeys Optional. For when the transaction involves multiple signers.
263
263
  * @param args.feePayerPublicKey Optional. For when the transaction is sponsored by a fee payer.
264
264
  * @param args.options Optional. A configuration object to customize the simulation process.
@@ -37,6 +37,8 @@ export abstract class AccountAuthenticator extends Serializable {
37
37
  return AccountAuthenticatorSingleKey.load(deserializer);
38
38
  case AccountAuthenticatorVariant.MultiKey:
39
39
  return AccountAuthenticatorMultiKey.load(deserializer);
40
+ case AccountAuthenticatorVariant.NoAccountAuthenticator:
41
+ return AccountAuthenticatorNoAccountAuthenticator.load(deserializer);
40
42
  default:
41
43
  throw new Error(`Unknown variant index for AccountAuthenticator: ${index}`);
42
44
  }
@@ -218,3 +220,20 @@ export class AccountAuthenticatorMultiKey extends AccountAuthenticator {
218
220
  return new AccountAuthenticatorMultiKey(public_keys, signatures);
219
221
  }
220
222
  }
223
+
224
+ /**
225
+ * AccountAuthenticatorNoAccountAuthenticator for no account authenticator
226
+ * It represents the absence of a public key for transaction simulation.
227
+ * It allows skipping the public/auth key check during the simulation.
228
+ */
229
+ export class AccountAuthenticatorNoAccountAuthenticator extends AccountAuthenticator {
230
+ // eslint-disable-next-line class-methods-use-this
231
+ serialize(serializer: Serializer): void {
232
+ serializer.serializeU32AsUleb128(AccountAuthenticatorVariant.NoAccountAuthenticator);
233
+ }
234
+
235
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
236
+ static load(deserializer: Deserializer): AccountAuthenticatorNoAccountAuthenticator {
237
+ return new AccountAuthenticatorNoAccountAuthenticator();
238
+ }
239
+ }
@@ -7,4 +7,3 @@ export * from "./transactionBuilder";
7
7
  export * from "./typeTag";
8
8
  export * from "./typeTag/parser";
9
9
  export * from "./types";
10
- export * from "./script-composer";
@@ -45,7 +45,7 @@ import {
45
45
  throwTypeMismatch,
46
46
  convertNumber,
47
47
  } from "./helpers";
48
- import { CallArgument, MoveFunction } from "../../types";
48
+ import { MoveFunction } from "../../types";
49
49
 
50
50
  const TEXT_ENCODER = new TextEncoder();
51
51
 
@@ -92,34 +92,6 @@ export async function fetchFunctionAbi(
92
92
  return undefined;
93
93
  }
94
94
 
95
- /**
96
- * Fetches a function ABI from the on-chain module ABI. It doesn't validate whether it's a view or entry function.
97
- * @param moduleAddress
98
- * @param moduleName
99
- * @param functionName
100
- * @param aptosConfig
101
- */
102
- export async function fetchMoveFunctionAbi(
103
- moduleAddress: string,
104
- moduleName: string,
105
- functionName: string,
106
- aptosConfig: AptosConfig,
107
- ): Promise<FunctionABI> {
108
- const functionAbi = await fetchFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig);
109
- if (!functionAbi) {
110
- throw new Error(`Could not find function ABI for '${moduleAddress}::${moduleName}::${functionName}'`);
111
- }
112
- const params: TypeTag[] = [];
113
- for (let i = 0; i < functionAbi.params.length; i += 1) {
114
- params.push(parseTypeTag(functionAbi.params[i], { allowGenerics: true }));
115
- }
116
-
117
- return {
118
- typeParameters: functionAbi.generic_type_params,
119
- parameters: params,
120
- };
121
- }
122
-
123
95
  /**
124
96
  * Fetches the ABI for an entry function from the specified module address.
125
97
  * This function validates if the ABI corresponds to an entry function and retrieves its parameters.
@@ -211,32 +183,6 @@ export async function fetchViewFunctionAbi(
211
183
  };
212
184
  }
213
185
 
214
- /**
215
- * Converts a entry function argument into CallArgument, if necessary.
216
- * This function checks the provided argument against the expected parameter type and converts it accordingly.
217
- *
218
- * @param functionName - The name of the function for which the argument is being converted.
219
- * @param functionAbi - The ABI (Application Binary Interface) of the function, which defines its parameters.
220
- * @param argument - The argument to be converted, which can be of various types. If the argument is already
221
- * CallArgument returned from TransactionComposer it would be returned immediately.
222
- * @param position - The index of the argument in the function's parameter list.
223
- * @param genericTypeParams - An array of type tags for any generic type parameters.
224
- */
225
- export function convertCallArgument(
226
- argument: CallArgument | EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes,
227
- functionName: string,
228
- functionAbi: FunctionABI,
229
- position: number,
230
- genericTypeParams: Array<TypeTag>,
231
- ): CallArgument {
232
- if (argument instanceof CallArgument) {
233
- return argument;
234
- }
235
- return CallArgument.new_bytes(
236
- convertArgument(functionName, functionAbi, argument, position, genericTypeParams).bcsToBytes(),
237
- );
238
- }
239
-
240
186
  /**
241
187
  * Converts a non-BCS encoded argument into BCS encoded, if necessary.
242
188
  * This function checks the provided argument against the expected parameter type and converts it accordingly.
@@ -30,6 +30,7 @@ import {
30
30
  AccountAuthenticator,
31
31
  AccountAuthenticatorEd25519,
32
32
  AccountAuthenticatorMultiKey,
33
+ AccountAuthenticatorNoAccountAuthenticator,
33
34
  AccountAuthenticatorSingleKey,
34
35
  } from "../authenticator/account";
35
36
  import {
@@ -479,15 +480,16 @@ export function generateSignedTransactionForSimulation(args: InputSimulateTransa
479
480
  transaction.feePayerAddress,
480
481
  );
481
482
  let secondaryAccountAuthenticators: Array<AccountAuthenticator> = [];
482
- if (secondarySignersPublicKeys) {
483
- secondaryAccountAuthenticators = secondarySignersPublicKeys.map((publicKey) =>
484
- getAuthenticatorForSimulation(publicKey),
485
- );
486
- }
487
- if (!feePayerPublicKey) {
488
- throw new Error(
489
- "Must provide a feePayerPublicKey argument to generate a signed fee payer transaction for simulation",
490
- );
483
+ if (transaction.secondarySignerAddresses) {
484
+ if (secondarySignersPublicKeys) {
485
+ secondaryAccountAuthenticators = secondarySignersPublicKeys.map((publicKey) =>
486
+ getAuthenticatorForSimulation(publicKey),
487
+ );
488
+ } else {
489
+ secondaryAccountAuthenticators = Array.from({ length: transaction.secondarySignerAddresses.length }, () =>
490
+ getAuthenticatorForSimulation(undefined),
491
+ );
492
+ }
491
493
  }
492
494
  const feePayerAuthenticator = getAuthenticatorForSimulation(feePayerPublicKey);
493
495
 
@@ -512,16 +514,16 @@ export function generateSignedTransactionForSimulation(args: InputSimulateTransa
512
514
 
513
515
  let secondaryAccountAuthenticators: Array<AccountAuthenticator> = [];
514
516
 
515
- if (!secondarySignersPublicKeys) {
516
- throw new Error(
517
- "Must provide a secondarySignersPublicKeys argument to generate a signed multi agent transaction for simulation",
517
+ if (secondarySignersPublicKeys) {
518
+ secondaryAccountAuthenticators = secondarySignersPublicKeys.map((publicKey) =>
519
+ getAuthenticatorForSimulation(publicKey),
520
+ );
521
+ } else {
522
+ secondaryAccountAuthenticators = Array.from({ length: transaction.secondarySignerAddresses.length }, () =>
523
+ getAuthenticatorForSimulation(undefined),
518
524
  );
519
525
  }
520
526
 
521
- secondaryAccountAuthenticators = secondarySignersPublicKeys.map((publicKey) =>
522
- getAuthenticatorForSimulation(publicKey),
523
- );
524
-
525
527
  const transactionAuthenticator = new TransactionAuthenticatorMultiAgent(
526
528
  accountAuthenticator,
527
529
  transaction.secondarySignerAddresses,
@@ -543,13 +545,19 @@ export function generateSignedTransactionForSimulation(args: InputSimulateTransa
543
545
  accountAuthenticator instanceof AccountAuthenticatorMultiKey
544
546
  ) {
545
547
  transactionAuthenticator = new TransactionAuthenticatorSingleSender(accountAuthenticator);
548
+ } else if (accountAuthenticator instanceof AccountAuthenticatorNoAccountAuthenticator) {
549
+ transactionAuthenticator = new TransactionAuthenticatorSingleSender(accountAuthenticator);
546
550
  } else {
547
551
  throw new Error("Invalid public key");
548
552
  }
549
553
  return new SignedTransaction(transaction.rawTransaction, transactionAuthenticator).bcsToBytes();
550
554
  }
551
555
 
552
- export function getAuthenticatorForSimulation(publicKey: PublicKey) {
556
+ export function getAuthenticatorForSimulation(publicKey?: PublicKey) {
557
+ if (!publicKey) {
558
+ return new AccountAuthenticatorNoAccountAuthenticator();
559
+ }
560
+
553
561
  // Wrap the public key types below with AnyPublicKey as they are only support through single sender.
554
562
  // Learn more about AnyPublicKey here - https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-55.md
555
563
  const convertToAnyPublicKey =
@@ -1,7 +1,6 @@
1
1
  // Copyright © Aptos Foundation
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { CallArgument } from "@wgb5445/aptos-intent-npm";
5
4
  import { AptosConfig } from "../api/aptosConfig";
6
5
  import { MoveOption, MoveString, MoveVector } from "../bcs/serializable/moveStructs";
7
6
  import { Bool, U128, U16, U256, U32, U64, U8 } from "../bcs/serializable/movePrimitives";
@@ -165,16 +164,6 @@ export type InputMultiSigDataWithABI = {
165
164
  * Combines input function data with Aptos configuration for remote ABI interactions.
166
165
  */
167
166
  export type InputEntryFunctionDataWithRemoteABI = InputEntryFunctionData & { aptosConfig: AptosConfig };
168
-
169
- /**
170
- * The data needed to generate a batched function payload
171
- */
172
- export type InputBatchedFunctionData = {
173
- function: MoveFunctionId;
174
- typeArguments?: Array<TypeArgument>;
175
- functionArguments: Array<EntryFunctionArgumentTypes | CallArgument | SimpleEntryFunctionArgumentTypes>;
176
- };
177
-
178
167
  /**
179
168
  * The data needed to generate a Multi Sig payload
180
169
  */
@@ -318,12 +307,13 @@ export type InputSimulateTransactionData = {
318
307
  transaction: AnyRawTransaction;
319
308
  /**
320
309
  * For a single signer transaction
310
+ * This is optional and can be undefined to skip the public/auth key check during the transaction simulation.
321
311
  */
322
- signerPublicKey: PublicKey;
312
+ signerPublicKey?: PublicKey;
323
313
  /**
324
314
  * For a fee payer or multi-agent transaction that requires additional signers in
325
315
  */
326
- secondarySignersPublicKeys?: Array<PublicKey>;
316
+ secondarySignersPublicKeys?: Array<PublicKey | undefined>;
327
317
  /**
328
318
  * For a fee payer transaction (aka Sponsored Transaction)
329
319
  */
@@ -1,3 +1,2 @@
1
1
  export * from "./indexer";
2
2
  export * from "./types";
3
- export { CallArgument } from "@wgb5445/aptos-intent-npm";
@@ -105,6 +105,7 @@ export enum AccountAuthenticatorVariant {
105
105
  MultiEd25519 = 1,
106
106
  SingleKey = 2,
107
107
  MultiKey = 3,
108
+ NoAccountAuthenticator = 4,
108
109
  }
109
110
 
110
111
  /**
@@ -65,3 +65,10 @@ export enum ProcessorType {
65
65
  USER_TRANSACTION_PROCESSOR = "user_transaction_processor",
66
66
  OBJECT_PROCESSOR = "objects_processor",
67
67
  }
68
+
69
+ /**
70
+ * Regular expression pattern for Firebase Auth issuer URLs
71
+ * Matches URLs in the format: https://securetoken.google.com/[project-id]
72
+ * where project-id can contain letters, numbers, hyphens, and underscores
73
+ */
74
+ export const FIREBASE_AUTH_ISS_PATTERN = /^https:\/\/securetoken\.google\.com\/[a-zA-Z0-9-_]+$/;
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.32.0";
9
+ export const VERSION = "1.33.0";
@@ -1,2 +0,0 @@
1
- import{a as t}from"./chunk-AHWZA3GD.mjs";import{a as i}from"./chunk-4PBXTMN3.mjs";import{e as a}from"./chunk-XKOSS5KC.mjs";import{a as r}from"./chunk-YNT7JHMS.mjs";import{c as e}from"./chunk-L2QVUMBV.mjs";import{a as o}from"./chunk-D52UKPQF.mjs";var s=class{constructor(n){this.config=n}async simple(n){return t({aptosConfig:this.config,...n})}async scriptComposer(n){let p=(await n.builder(new i(this.config))).build(),c=await a({aptosConfig:this.config,payload:e.load(new o(p)),...n});return new r(c)}async multiAgent(n){return t({aptosConfig:this.config,...n})}};export{s as a};
2
- //# sourceMappingURL=chunk-3DQVGPFE.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/api/transactionSubmission/build.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AccountAddressInput } from \"../../core\";\nimport { generateTransaction } from \"../../internal/transactionSubmission\";\nimport {\n InputGenerateTransactionPayloadData,\n InputGenerateTransactionOptions,\n AptosScriptComposer,\n TransactionPayloadScript,\n generateRawTransaction,\n} from \"../../transactions\";\nimport { MultiAgentTransaction } from \"../../transactions/instances/multiAgentTransaction\";\nimport { SimpleTransaction } from \"../../transactions/instances/simpleTransaction\";\nimport { AptosConfig } from \"../aptosConfig\";\nimport { Deserializer } from \"../../bcs\";\n\n/**\n * A class to handle all `Build` transaction operations.\n */\nexport class Build {\n readonly config: AptosConfig;\n\n /**\n * Initializes a new instance of the Aptos client with the specified configuration.\n * This allows you to interact with the Aptos blockchain using the provided settings.\n *\n * @param config - The configuration settings for the Aptos client.\n * @param config.network - The network to connect to (e.g., TESTNET, MAINNET).\n * @param config.nodeUrl - The URL of the Aptos node to connect to.\n * @param config.account - The account details for authentication.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * async function runExample() {\n * // Create a configuration for the Aptos client\n * const config = new AptosConfig({\n * network: Network.TESTNET, // specify the network\n * nodeUrl: \"https://testnet.aptos.dev\", // specify the node URL\n * });\n *\n * // Initialize the Aptos client\n * const aptos = new Aptos(config);\n *\n * console.log(\"Aptos client initialized:\", aptos);\n * }\n * runExample().catch(console.error);\n * ```\n */\n constructor(config: AptosConfig) {\n this.config = config;\n }\n\n /**\n * Build a simple transaction.\n *\n * This function allows you to create a transaction with specified sender and data.\n *\n * @param args.sender - The sender account address.\n * @param args.data - The transaction data.\n * @param args.options - Optional transaction configurations.\n * @param args.withFeePayer - Whether there is a fee payer for the transaction.\n *\n * @returns SimpleTransaction\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Build a simple transaction\n * const transaction = await aptos.transaction.simple({\n * sender: \"0x1\", // replace with a real sender account address\n * data: {\n * function: \"0x1::aptos_account::transfer\",\n * functionArguments: [\"0x2\", 100], // replace with a real destination account address\n * },\n * options: {\n * gasUnitPrice: 100, // specify your own gas unit price if needed\n * maxGasAmount: 1000, // specify your own max gas amount if needed\n * },\n * });\n *\n * console.log(transaction);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async simple(args: {\n sender: AccountAddressInput;\n data: InputGenerateTransactionPayloadData;\n options?: InputGenerateTransactionOptions;\n withFeePayer?: boolean;\n }): Promise<SimpleTransaction> {\n return generateTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Build a transaction from a series of Move calls.\n *\n * This function allows you to create a transaction with a list of Move calls.\n *\n * Right now we only tested this logic with single signer and we will add support\n * for mutli agent transactions if needed.\n *\n * @param args.sender - The sender account address.\n * @param args.builder - The closure to construct the list of calls.\n * @param args.options - Optional transaction configurations.\n * @param args.withFeePayer - Whether there is a fee payer for the transaction.\n *\n * @returns SimpleTransaction\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Build a transaction from a chained series of Move calls.\n * const transaction = await aptos.transaction.script_composer({\n * sender: \"0x1\", // replace with a real sender account address\n * builder: builder: async (builder) => {\n * const coin = await builder.addBatchedCalls({\n * function: \"0x1::coin::withdraw\",\n * functionArguments: [CallArgument.new_signer(0), 1],\n * typeArguments: [\"0x1::aptos_coin::AptosCoin\"],\n * });\n *\n * // Pass the returned value from the first function call to the second call\n * const fungibleAsset = await builder.addBatchedCalls({\n * function: \"0x1::coin::coin_to_fungible_asset\",\n * functionArguments: [coin[0]],\n * typeArguments: [\"0x1::aptos_coin::AptosCoin\"],\n * });\n *\n * await builder.addBatchedCalls({\n * function: \"0x1::primary_fungible_store::deposit\",\n * functionArguments: [singleSignerED25519SenderAccount.accountAddress, fungibleAsset[0]],\n * typeArguments: [],\n * });\n * return builder;\n * },\n * options: {\n * gasUnitPrice: 100, // specify your own gas unit price if needed\n * maxGasAmount: 1000, // specify your own max gas amount if needed\n * },\n * });\n *\n * console.log(transaction);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async scriptComposer(args: {\n sender: AccountAddressInput;\n builder: (builder: AptosScriptComposer) => Promise<AptosScriptComposer>;\n options?: InputGenerateTransactionOptions;\n withFeePayer?: boolean;\n }): Promise<SimpleTransaction> {\n const builder = await args.builder(new AptosScriptComposer(this.config));\n const bytes = builder.build();\n const rawTxn = await generateRawTransaction({\n aptosConfig: this.config,\n payload: TransactionPayloadScript.load(new Deserializer(bytes)),\n ...args,\n });\n return new SimpleTransaction(rawTxn);\n }\n\n /**\n * Build a multi-agent transaction that allows multiple signers to authorize a transaction.\n *\n * @param args - The parameters for creating the multi-agent transaction.\n * @param args.sender - The sender account address.\n * @param args.data - The transaction data.\n * @param args.secondarySignerAddresses - An array of the secondary signers' account addresses.\n * @param args.options - Optional transaction configurations.\n * @param args.withFeePayer - Whether there is a fee payer for the transaction.\n *\n * @returns MultiAgentTransaction\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Build a multi-agent transaction\n * const transaction = await aptos.multiAgent({\n * sender: \"0x1\", // replace with a real sender account address\n * data: {\n * // Transaction data structure\n * function: \"0x1::aptos_account::transfer\",\n * functionArguments: [\"0x2\", 100], // replace with a real destination account address and amount\n * },\n * secondarySignerAddresses: [\"0x3\", \"0x4\"], // replace with real secondary signer addresses\n * options: {\n * // Optional transaction configurations\n * maxGasAmount: \"1000\",\n * gasUnitPrice: \"1\",\n * },\n * });\n *\n * console.log(transaction);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async multiAgent(args: {\n sender: AccountAddressInput;\n data: InputGenerateTransactionPayloadData;\n secondarySignerAddresses: AccountAddressInput[];\n options?: InputGenerateTransactionOptions;\n withFeePayer?: boolean;\n }): Promise<MultiAgentTransaction> {\n return generateTransaction({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"sPAoBO,IAAMA,EAAN,KAAY,CA+BjB,YAAYC,EAAqB,CAC/B,KAAK,OAASA,CAChB,CAwCA,MAAM,OAAOC,EAKkB,CAC7B,OAAOC,EAAoB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CAClE,CA4DA,MAAM,eAAeA,EAKU,CAE7B,IAAME,GADU,MAAMF,EAAK,QAAQ,IAAIG,EAAoB,KAAK,MAAM,CAAC,GACjD,MAAM,EACtBC,EAAS,MAAMC,EAAuB,CAC1C,YAAa,KAAK,OAClB,QAASC,EAAyB,KAAK,IAAIC,EAAaL,CAAK,CAAC,EAC9D,GAAGF,CACL,CAAC,EACD,OAAO,IAAIQ,EAAkBJ,CAAM,CACrC,CA2CA,MAAM,WAAWJ,EAMkB,CACjC,OAAOC,EAAoB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CAClE,CACF","names":["Build","config","args","generateTransaction","bytes","AptosScriptComposer","rawTxn","generateRawTransaction","TransactionPayloadScript","Deserializer","SimpleTransaction"]}
@@ -1,2 +0,0 @@
1
- import{a as c,c as u,f as l}from"./chunk-G2GN4LH5.mjs";import{u as m}from"./chunk-WSFHH3BK.mjs";import{TransactionComposer as f,initSync as h,wasm as A}from"@wgb5445/aptos-intent-npm";(async()=>h({module:A}))();var g=class{constructor(t){this.builder=f.single_signer(),this.config=t}async addBatchedCalls(t){let{moduleAddress:r,moduleName:o,functionName:i}=m(t.function),s=this.config.getRequestUrl("Fullnode");if(await this.builder.load_module(s,`${r}::${o}`),t.typeArguments!==void 0)for(let e of t.typeArguments)await this.builder.load_type_tag(s,e.toString());let n=c(t.typeArguments),a=await u(r,o,i,this.config);if(n.length!==a.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${a.typeParameters.length}, received ${n.length}`);let d=t.functionArguments.map((e,p)=>l(e,i,a,p,n));return this.builder.add_batched_call(`${r}::${o}`,i,n.map(e=>e.toString()),d)}build(){return this.builder.generate_batched_calls(!0)}};export{g as a};
2
- //# sourceMappingURL=chunk-4PBXTMN3.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/transactions/script-composer/index.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { TransactionComposer, initSync, wasm } from \"@wgb5445/aptos-intent-npm\";\nimport { AptosApiType } from \"../../utils\";\nimport { AptosConfig } from \"../../api/aptosConfig\";\nimport { InputBatchedFunctionData } from \"../types\";\nimport { fetchMoveFunctionAbi, getFunctionParts, standardizeTypeTags } from \"../transactionBuilder\";\nimport { CallArgument } from \"../../types\";\nimport { convertCallArgument } from \"../transactionBuilder/remoteAbi\";\n\n(async () => {\n initSync({ module: wasm });\n})();\n\n// A wrapper class around TransactionComposer, which is a WASM library compiled\n// from aptos-core/aptos-move/script-composer.\n//\n// This class allows the SDK caller to build a transaction that invokes multiple Move functions\n// and allow for arguments to be passed around.\nexport class AptosScriptComposer {\n private builder: TransactionComposer;\n\n private config: AptosConfig;\n\n constructor(aptosConfig: AptosConfig) {\n this.builder = TransactionComposer.single_signer();\n this.config = aptosConfig;\n }\n\n // Add a move function invocation to the TransactionComposer.\n //\n // Similar to how to create an entry function, the difference is that input arguments could\n // either be a `CallArgument` which represents an abstract value returned from a previous Move call\n // or the regular entry function arguments.\n //\n // The function would also return a list of `CallArgument` that can be passed on to future calls.\n async addBatchedCalls(input: InputBatchedFunctionData): Promise<CallArgument[]> {\n const { moduleAddress, moduleName, functionName } = getFunctionParts(input.function);\n const nodeUrl = this.config.getRequestUrl(AptosApiType.FULLNODE);\n\n // Load the calling module into the builder.\n await this.builder.load_module(nodeUrl, `${moduleAddress}::${moduleName}`);\n\n // Load the calling type arguments into the loader.\n if (input.typeArguments !== undefined) {\n for (const typeTag of input.typeArguments) {\n // eslint-disable-next-line no-await-in-loop\n await this.builder.load_type_tag(nodeUrl, typeTag.toString());\n }\n }\n const typeArguments = standardizeTypeTags(input.typeArguments);\n const functionAbi = await fetchMoveFunctionAbi(moduleAddress, moduleName, functionName, this.config);\n // Check the type argument count against the ABI\n if (typeArguments.length !== functionAbi.typeParameters.length) {\n throw new Error(\n `Type argument count mismatch, expected ${functionAbi.typeParameters.length}, received ${typeArguments.length}`,\n );\n }\n\n const functionArguments: CallArgument[] = input.functionArguments.map((arg, i) =>\n convertCallArgument(arg, functionName, functionAbi, i, typeArguments),\n );\n\n return this.builder.add_batched_call(\n `${moduleAddress}::${moduleName}`,\n functionName,\n typeArguments.map((arg) => arg.toString()),\n functionArguments,\n );\n }\n\n build(): Uint8Array {\n return this.builder.generate_batched_calls(true);\n }\n}\n"],"mappings":"gGAGA,OAAS,uBAAAA,EAAqB,YAAAC,EAAU,QAAAC,MAAY,6BAQnD,SACCC,EAAS,CAAE,OAAQC,CAAK,CAAC,KAQpB,IAAMC,EAAN,KAA0B,CAK/B,YAAYC,EAA0B,CACpC,KAAK,QAAUC,EAAoB,cAAc,EACjD,KAAK,OAASD,CAChB,CASA,MAAM,gBAAgBE,EAA0D,CAC9E,GAAM,CAAE,cAAAC,EAAe,WAAAC,EAAY,aAAAC,CAAa,EAAIC,EAAiBJ,EAAM,QAAQ,EAC7EK,EAAU,KAAK,OAAO,wBAAmC,EAM/D,GAHA,MAAM,KAAK,QAAQ,YAAYA,EAAS,GAAGJ,CAAa,KAAKC,CAAU,EAAE,EAGrEF,EAAM,gBAAkB,OAC1B,QAAWM,KAAWN,EAAM,cAE1B,MAAM,KAAK,QAAQ,cAAcK,EAASC,EAAQ,SAAS,CAAC,EAGhE,IAAMC,EAAgBC,EAAoBR,EAAM,aAAa,EACvDS,EAAc,MAAMC,EAAqBT,EAAeC,EAAYC,EAAc,KAAK,MAAM,EAEnG,GAAII,EAAc,SAAWE,EAAY,eAAe,OACtD,MAAM,IAAI,MACR,0CAA0CA,EAAY,eAAe,MAAM,cAAcF,EAAc,MAAM,EAC/G,EAGF,IAAMI,EAAoCX,EAAM,kBAAkB,IAAI,CAACY,EAAKC,IAC1EC,EAAoBF,EAAKT,EAAcM,EAAaI,EAAGN,CAAa,CACtE,EAEA,OAAO,KAAK,QAAQ,iBAClB,GAAGN,CAAa,KAAKC,CAAU,GAC/BC,EACAI,EAAc,IAAKK,GAAQA,EAAI,SAAS,CAAC,EACzCD,CACF,CACF,CAEA,OAAoB,CAClB,OAAO,KAAK,QAAQ,uBAAuB,EAAI,CACjD,CACF","names":["TransactionComposer","initSync","wasm","initSync","wasm","AptosScriptComposer","aptosConfig","TransactionComposer","input","moduleAddress","moduleName","functionName","getFunctionParts","nodeUrl","typeTag","typeArguments","standardizeTypeTags","functionAbi","fetchMoveFunctionAbi","functionArguments","arg","i","convertCallArgument"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/internal/transactionSubmission.ts"],"sourcesContent":["/**\n * This file contains the underlying implementations for exposed submission API surface in\n * the {@link api/transaction}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * transaction namespace and without having a dependency cycle error.\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { Deserializer, MoveVector, U8 } from \"../bcs\";\nimport { postAptosFullNode } from \"../client\";\nimport { Account, AbstractKeylessAccount, isKeylessSigner } from \"../account\";\nimport { AccountAddress, AccountAddressInput } from \"../core/accountAddress\";\nimport { FederatedKeylessPublicKey, KeylessPublicKey, KeylessSignature, PrivateKey } from \"../core/crypto\";\nimport { AccountAuthenticator } from \"../transactions/authenticator/account\";\nimport { RotationProofChallenge } from \"../transactions/instances/rotationProofChallenge\";\nimport {\n buildTransaction,\n generateTransactionPayload,\n generateSignedTransactionForSimulation,\n generateSignedTransaction,\n} from \"../transactions/transactionBuilder/transactionBuilder\";\nimport {\n InputGenerateTransactionData,\n AnyRawTransaction,\n InputSimulateTransactionData,\n InputGenerateTransactionOptions,\n InputGenerateTransactionPayloadDataWithRemoteABI,\n InputSubmitTransactionData,\n InputGenerateMultiAgentRawTransactionData,\n InputGenerateSingleSignerRawTransactionData,\n AnyTransactionPayloadInstance,\n EntryFunctionABI,\n} from \"../transactions/types\";\nimport { getInfo } from \"./account\";\nimport { UserTransactionResponse, PendingTransactionResponse, MimeType, HexInput, TransactionResponse } from \"../types\";\nimport { SignedTransaction, TypeTagU8, TypeTagVector, generateSigningMessageForTransaction } from \"../transactions\";\nimport { SimpleTransaction } from \"../transactions/instances/simpleTransaction\";\nimport { MultiAgentTransaction } from \"../transactions/instances/multiAgentTransaction\";\n\n/**\n * We are defining function signatures, each with its specific input and output.\n * These are the possible function signature for `generateTransaction` function.\n * When we call `generateTransaction` function with the relevant type properties,\n * Typescript can infer the return type based on the appropriate function overload.\n */\nexport async function generateTransaction(\n args: { aptosConfig: AptosConfig } & InputGenerateSingleSignerRawTransactionData,\n): Promise<SimpleTransaction>;\nexport async function generateTransaction(\n args: { aptosConfig: AptosConfig } & InputGenerateMultiAgentRawTransactionData,\n): Promise<MultiAgentTransaction>;\n/**\n * Generates any transaction by passing in the required arguments\n *\n * @param args.sender The transaction sender's account address as a AccountAddressInput\n * @param args.data EntryFunctionData | ScriptData | MultiSigData\n * @param args.feePayerAddress optional. For a fee payer (aka sponsored) transaction\n * @param args.secondarySignerAddresses optional. For a multi-agent or fee payer (aka sponsored) transactions\n * @param args.options optional. GenerateTransactionOptions type\n *\n * @example\n * For a single signer entry function\n * move function name, move function type arguments, move function arguments\n * `\n * data: {\n * function:\"0x1::aptos_account::transfer\",\n * typeArguments:[]\n * functionArguments :[receiverAddress,10]\n * }\n * `\n *\n * @example\n * For a single signer script function\n * module bytecode, move function type arguments, move function arguments\n * ```\n * data: {\n * bytecode:\"0x001234567\",\n * typeArguments:[],\n * functionArguments :[receiverAddress,10]\n * }\n * ```\n *\n * @return An instance of a RawTransaction, plus optional secondary/fee payer addresses\n * ```\n * {\n * rawTransaction: RawTransaction,\n * secondarySignerAddresses?: Array<AccountAddress>,\n * feePayerAddress?: AccountAddress\n * }\n * ```\n */\nexport async function generateTransaction(\n args: { aptosConfig: AptosConfig } & InputGenerateTransactionData,\n): Promise<AnyRawTransaction> {\n const payload = await buildTransactionPayload(args);\n return buildRawTransaction(args, payload);\n}\n\n/**\n * Builds a transaction payload based on the provided configuration and input data.\n * This function is essential for preparing transaction data for execution on the Aptos blockchain.\n *\n * @param args - The arguments for building the transaction payload.\n * @param args.aptosConfig - Configuration settings for the Aptos network.\n * @param args.data - Input data required to generate the transaction payload, which may include bytecode, multisig address,\n * function name, function arguments, type arguments, and ABI.\n * @returns A promise that resolves to the generated transaction payload instance.\n */\nexport async function buildTransactionPayload(\n args: { aptosConfig: AptosConfig } & InputGenerateTransactionData,\n): Promise<AnyTransactionPayloadInstance> {\n const { aptosConfig, data } = args;\n // Merge in aptosConfig for remote ABI on non-script payloads\n let generateTransactionPayloadData: InputGenerateTransactionPayloadDataWithRemoteABI;\n let payload: AnyTransactionPayloadInstance;\n\n if (\"bytecode\" in data) {\n // TODO: Add ABI checking later\n payload = await generateTransactionPayload(data);\n } else if (\"multisigAddress\" in data) {\n generateTransactionPayloadData = {\n aptosConfig,\n multisigAddress: data.multisigAddress,\n function: data.function,\n functionArguments: data.functionArguments,\n typeArguments: data.typeArguments,\n abi: data.abi,\n };\n payload = await generateTransactionPayload(generateTransactionPayloadData);\n } else {\n generateTransactionPayloadData = {\n aptosConfig,\n function: data.function,\n functionArguments: data.functionArguments,\n typeArguments: data.typeArguments,\n abi: data.abi,\n };\n payload = await generateTransactionPayload(generateTransactionPayloadData);\n }\n return payload;\n}\n\n/**\n * Builds a raw transaction based on the provided configuration and payload.\n * This function helps in creating a transaction that can be sent to the Aptos blockchain.\n *\n * @param args - The arguments for generating the transaction.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.sender - The address of the sender of the transaction.\n * @param args.options - Additional options for the transaction.\n * @param payload - The payload of the transaction, which defines the action to be performed.\n */\nexport async function buildRawTransaction(\n args: { aptosConfig: AptosConfig } & InputGenerateTransactionData,\n payload: AnyTransactionPayloadInstance,\n): Promise<AnyRawTransaction> {\n const { aptosConfig, sender, options } = args;\n\n let feePayerAddress;\n if (isFeePayerTransactionInput(args)) {\n feePayerAddress = AccountAddress.ZERO.toString();\n }\n\n if (isMultiAgentTransactionInput(args)) {\n const { secondarySignerAddresses } = args;\n return buildTransaction({\n aptosConfig,\n sender,\n payload,\n options,\n secondarySignerAddresses,\n feePayerAddress,\n });\n }\n\n return buildTransaction({\n aptosConfig,\n sender,\n payload,\n options,\n feePayerAddress,\n });\n}\n\n/**\n * Determine if the transaction input includes a fee payer.\n *\n * @param data - The input data for generating a transaction.\n * @param data.withFeePayer - Indicates whether a fee payer is included in the transaction input.\n * @returns A boolean value indicating if the transaction input has a fee payer.\n */\nfunction isFeePayerTransactionInput(data: InputGenerateTransactionData): boolean {\n return data.withFeePayer === true;\n}\n\n/**\n * Determines whether the provided transaction input data includes multiple agent signatures.\n *\n * @param data - The transaction input data to evaluate.\n * @param data.secondarySignerAddresses - An array of secondary signer addresses, indicating multiple agents.\n */\nfunction isMultiAgentTransactionInput(\n data: InputGenerateTransactionData,\n): data is InputGenerateMultiAgentRawTransactionData {\n return \"secondarySignerAddresses\" in data;\n}\n\n/**\n * Builds a signing message that can be signed by external signers.\n *\n * Note: Please prefer using `signTransaction` unless signing outside the SDK.\n *\n * @param args - The arguments for generating the signing message.\n * @param args.transaction - AnyRawTransaction, as generated by `generateTransaction()`.\n *\n * @returns The message to be signed.\n */\nexport function getSigningMessage(args: { transaction: AnyRawTransaction }): Uint8Array {\n const { transaction } = args;\n return generateSigningMessageForTransaction(transaction);\n}\n\n/**\n * Sign a transaction that can later be submitted to the chain.\n *\n * @param args The arguments for signing the transaction.\n * @param args.signer The signer account to sign the transaction.\n * @param args.transaction An instance of a RawTransaction, plus optional secondary/fee payer addresses.\n *\n * @return The signer AccountAuthenticator.\n */\nexport function signTransaction(args: { signer: Account; transaction: AnyRawTransaction }): AccountAuthenticator {\n const { signer, transaction } = args;\n return signer.signTransactionWithAuthenticator(transaction);\n}\n\nexport function signAsFeePayer(args: { signer: Account; transaction: AnyRawTransaction }): AccountAuthenticator {\n const { signer, transaction } = args;\n\n // if transaction doesn't hold a \"feePayerAddress\" prop it means\n // this is not a fee payer transaction\n if (!transaction.feePayerAddress) {\n throw new Error(`Transaction ${transaction} is not a Fee Payer transaction`);\n }\n\n // Set the feePayerAddress to the signer account address\n transaction.feePayerAddress = signer.accountAddress;\n\n return signTransaction({\n signer,\n transaction,\n });\n}\n\n/**\n * Simulates a transaction before signing it to evaluate its potential outcome.\n *\n * @param args The arguments for simulating the transaction.\n * @param args.aptosConfig The configuration for the Aptos network.\n * @param args.transaction The raw transaction to simulate.\n * @param args.signerPublicKey The signer public key.\n * @param args.secondarySignersPublicKeys Optional. For when the transaction involves multiple signers.\n * @param args.feePayerPublicKey Optional. For when the transaction is sponsored by a fee payer.\n * @param args.options Optional. A configuration object to customize the simulation process.\n * @param args.options.estimateGasUnitPrice Optional. Indicates whether to estimate the gas unit price.\n * @param args.options.estimateMaxGasAmount Optional. Indicates whether to estimate the maximum gas amount.\n * @param args.options.estimatePrioritizedGasUnitPrice Optional. Indicates whether to estimate the prioritized gas unit price.\n */\nexport async function simulateTransaction(\n args: { aptosConfig: AptosConfig } & InputSimulateTransactionData,\n): Promise<Array<UserTransactionResponse>> {\n const { aptosConfig, transaction, signerPublicKey, secondarySignersPublicKeys, feePayerPublicKey, options } = args;\n\n const signedTransaction = generateSignedTransactionForSimulation({\n transaction,\n signerPublicKey,\n secondarySignersPublicKeys,\n feePayerPublicKey,\n options,\n });\n\n const { data } = await postAptosFullNode<Uint8Array, Array<UserTransactionResponse>>({\n aptosConfig,\n body: signedTransaction,\n path: \"transactions/simulate\",\n params: {\n estimate_gas_unit_price: args.options?.estimateGasUnitPrice ?? false,\n estimate_max_gas_amount: args.options?.estimateMaxGasAmount ?? false,\n estimate_prioritized_gas_unit_price: args.options?.estimatePrioritizedGasUnitPrice ?? false,\n },\n originMethod: \"simulateTransaction\",\n contentType: MimeType.BCS_SIGNED_TRANSACTION,\n });\n return data;\n}\n\n/**\n * Submit a transaction to the Aptos blockchain.\n *\n * @param args - The arguments for submitting the transaction.\n * @param args.aptosConfig - The configuration for connecting to the Aptos network.\n * @param args.transaction - The Aptos transaction data to be submitted.\n * @param args.senderAuthenticator - The account authenticator of the transaction sender.\n * @param args.secondarySignerAuthenticators - Optional. Authenticators for additional signers in a multi-signer transaction.\n *\n * @returns PendingTransactionResponse - The response containing the status of the submitted transaction.\n */\nexport async function submitTransaction(\n args: {\n aptosConfig: AptosConfig;\n } & InputSubmitTransactionData,\n): Promise<PendingTransactionResponse> {\n const { aptosConfig } = args;\n const signedTransaction = generateSignedTransaction({ ...args });\n try {\n const { data } = await postAptosFullNode<Uint8Array, PendingTransactionResponse>({\n aptosConfig,\n body: signedTransaction,\n path: \"transactions\",\n originMethod: \"submitTransaction\",\n contentType: MimeType.BCS_SIGNED_TRANSACTION,\n });\n return data;\n } catch (e) {\n const signedTxn = SignedTransaction.deserialize(new Deserializer(signedTransaction));\n if (\n signedTxn.authenticator.isSingleSender() &&\n signedTxn.authenticator.sender.isSingleKey() &&\n (signedTxn.authenticator.sender.public_key.publicKey instanceof KeylessPublicKey ||\n signedTxn.authenticator.sender.public_key.publicKey instanceof FederatedKeylessPublicKey)\n ) {\n await AbstractKeylessAccount.fetchJWK({\n aptosConfig,\n publicKey: signedTxn.authenticator.sender.public_key.publicKey,\n kid: (signedTxn.authenticator.sender.signature.signature as KeylessSignature).getJwkKid(),\n });\n }\n throw e;\n }\n}\n\nexport type FeePayerOrFeePayerAuthenticatorOrNeither =\n | { feePayer: Account; feePayerAuthenticator?: never }\n | { feePayer?: never; feePayerAuthenticator: AccountAuthenticator }\n | { feePayer?: never; feePayerAuthenticator?: never };\n\nexport async function signAndSubmitTransaction(\n args: FeePayerOrFeePayerAuthenticatorOrNeither & {\n aptosConfig: AptosConfig;\n signer: Account;\n transaction: AnyRawTransaction;\n },\n): Promise<PendingTransactionResponse> {\n const { aptosConfig, signer, feePayer, transaction } = args;\n // If the signer contains a KeylessAccount, await proof fetching in case the proof\n // was fetched asynchronously.\n if (isKeylessSigner(signer)) {\n await signer.checkKeylessAccountValidity(aptosConfig);\n }\n if (isKeylessSigner(feePayer)) {\n await feePayer.checkKeylessAccountValidity(aptosConfig);\n }\n const feePayerAuthenticator =\n args.feePayerAuthenticator || (feePayer && signAsFeePayer({ signer: feePayer, transaction }));\n\n const senderAuthenticator = signTransaction({ signer, transaction });\n return submitTransaction({\n aptosConfig,\n transaction,\n senderAuthenticator,\n feePayerAuthenticator,\n });\n}\n\nexport async function signAndSubmitAsFeePayer(args: {\n aptosConfig: AptosConfig;\n feePayer: Account;\n senderAuthenticator: AccountAuthenticator;\n transaction: AnyRawTransaction;\n}): Promise<PendingTransactionResponse> {\n const { aptosConfig, senderAuthenticator, feePayer, transaction } = args;\n\n if (isKeylessSigner(feePayer)) {\n await feePayer.checkKeylessAccountValidity(aptosConfig);\n }\n\n const feePayerAuthenticator = signAsFeePayer({ signer: feePayer, transaction });\n\n return submitTransaction({\n aptosConfig,\n transaction,\n senderAuthenticator,\n feePayerAuthenticator,\n });\n}\n\nconst packagePublishAbi: EntryFunctionABI = {\n typeParameters: [],\n parameters: [TypeTagVector.u8(), new TypeTagVector(TypeTagVector.u8())],\n};\n\n/**\n * Publishes a package transaction to the Aptos blockchain.\n * This function allows you to create and send a transaction that publishes a package with the specified metadata and bytecode.\n *\n * @param args - The arguments for the package transaction.\n * @param args.aptosConfig - The configuration settings for the Aptos client.\n * @param args.account - The address of the account sending the transaction.\n * @param args.metadataBytes - The metadata associated with the package, represented as hexadecimal input.\n * @param args.moduleBytecode - An array of module bytecode, each represented as hexadecimal input.\n * @param args.options - Optional parameters for generating the transaction.\n */\nexport async function publicPackageTransaction(args: {\n aptosConfig: AptosConfig;\n account: AccountAddressInput;\n metadataBytes: HexInput;\n moduleBytecode: Array<HexInput>;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, account, metadataBytes, moduleBytecode, options } = args;\n\n const totalByteCode = moduleBytecode.map((bytecode) => MoveVector.U8(bytecode));\n\n return generateTransaction({\n aptosConfig,\n sender: AccountAddress.from(account),\n data: {\n function: \"0x1::code::publish_package_txn\",\n functionArguments: [MoveVector.U8(metadataBytes), new MoveVector(totalByteCode)],\n abi: packagePublishAbi,\n },\n options,\n });\n}\n\nconst rotateAuthKeyAbi: EntryFunctionABI = {\n typeParameters: [],\n parameters: [\n new TypeTagU8(),\n TypeTagVector.u8(),\n new TypeTagU8(),\n TypeTagVector.u8(),\n TypeTagVector.u8(),\n TypeTagVector.u8(),\n ],\n};\n\n/**\n * Rotates the authentication key for a given account, allowing for enhanced security and management of account access.\n *\n * @param args - The arguments for rotating the authentication key.\n * @param args.aptosConfig - The configuration settings for the Aptos network.\n * @param args.fromAccount - The account from which the authentication key will be rotated.\n * @param args.toNewPrivateKey - The new private key that will be associated with the account.\n *\n * @remarks\n * This function requires the current authentication key and the new private key to sign a challenge that validates the rotation.\n *\n * TODO: Need to refactor and move this function out of transactionSubmission.\n */\nexport async function rotateAuthKey(args: {\n aptosConfig: AptosConfig;\n fromAccount: Account;\n toNewPrivateKey: PrivateKey;\n}): Promise<TransactionResponse> {\n const { aptosConfig, fromAccount, toNewPrivateKey } = args;\n const accountInfo = await getInfo({\n aptosConfig,\n accountAddress: fromAccount.accountAddress,\n });\n\n const newAccount = Account.fromPrivateKey({ privateKey: toNewPrivateKey, legacy: true });\n\n const challenge = new RotationProofChallenge({\n sequenceNumber: BigInt(accountInfo.sequence_number),\n originator: fromAccount.accountAddress,\n currentAuthKey: AccountAddress.from(accountInfo.authentication_key),\n newPublicKey: newAccount.publicKey,\n });\n\n // Sign the challenge\n const challengeHex = challenge.bcsToBytes();\n const proofSignedByCurrentPrivateKey = fromAccount.sign(challengeHex);\n const proofSignedByNewPrivateKey = newAccount.sign(challengeHex);\n\n // Generate transaction\n const rawTxn = await generateTransaction({\n aptosConfig,\n sender: fromAccount.accountAddress,\n data: {\n function: \"0x1::account::rotate_authentication_key\",\n functionArguments: [\n new U8(fromAccount.signingScheme), // from scheme\n MoveVector.U8(fromAccount.publicKey.toUint8Array()),\n new U8(newAccount.signingScheme), // to scheme\n MoveVector.U8(newAccount.publicKey.toUint8Array()),\n MoveVector.U8(proofSignedByCurrentPrivateKey.toUint8Array()),\n MoveVector.U8(proofSignedByNewPrivateKey.toUint8Array()),\n ],\n abi: rotateAuthKeyAbi,\n },\n });\n return signAndSubmitTransaction({\n aptosConfig,\n signer: fromAccount,\n transaction: rawTxn,\n });\n}\n"],"mappings":"0oBA2FA,eAAsBA,EACpBC,EAC4B,CAC5B,IAAMC,EAAU,MAAMC,EAAwBF,CAAI,EAClD,OAAOG,EAAoBH,EAAMC,CAAO,CAC1C,CAYA,eAAsBC,EACpBF,EACwC,CACxC,GAAM,CAAE,YAAAI,EAAa,KAAAC,CAAK,EAAIL,EAE1BM,EACAL,EAEJ,MAAI,aAAcI,EAEhBJ,EAAU,MAAMM,EAA2BF,CAAI,EACtC,oBAAqBA,GAC9BC,EAAiC,CAC/B,YAAAF,EACA,gBAAiBC,EAAK,gBACtB,SAAUA,EAAK,SACf,kBAAmBA,EAAK,kBACxB,cAAeA,EAAK,cACpB,IAAKA,EAAK,GACZ,EACAJ,EAAU,MAAMM,EAA2BD,CAA8B,IAEzEA,EAAiC,CAC/B,YAAAF,EACA,SAAUC,EAAK,SACf,kBAAmBA,EAAK,kBACxB,cAAeA,EAAK,cACpB,IAAKA,EAAK,GACZ,EACAJ,EAAU,MAAMM,EAA2BD,CAA8B,GAEpEL,CACT,CAYA,eAAsBE,EACpBH,EACAC,EAC4B,CAC5B,GAAM,CAAE,YAAAG,EAAa,OAAAI,EAAQ,QAAAC,CAAQ,EAAIT,EAErCU,EAKJ,GAJIC,EAA2BX,CAAI,IACjCU,EAAkBE,EAAe,KAAK,SAAS,GAG7CC,EAA6Bb,CAAI,EAAG,CACtC,GAAM,CAAE,yBAAAc,CAAyB,EAAId,EACrC,OAAOe,EAAiB,CACtB,YAAAX,EACA,OAAAI,EACA,QAAAP,EACA,QAAAQ,EACA,yBAAAK,EACA,gBAAAJ,CACF,CAAC,CACH,CAEA,OAAOK,EAAiB,CACtB,YAAAX,EACA,OAAAI,EACA,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B,EAClE,aAAcE,EAAW,SAC3B,CAAC,EAG8B,WAAW,EACpCI,EAAiCR,EAAY,KAAKM,CAAY,EAC9DG,EAA6BL,EAAW,KAAKE,CAAY,EAGzDI,EAAS,MAAMnE,EAAoB,CACvC,YAAAK,EACA,OAAQoD,EAAY,eACpB,KAAM,CACJ,SAAU,0CACV,kBAAmB,CACjB,IAAIW,EAAGX,EAAY,aAAa,EAChCJ,EAAW,GAAGI,EAAY,UAAU,aAAa,CAAC,EAClD,IAAIW,EAAGP,EAAW,aAAa,EAC/BR,EAAW,GAAGQ,EAAW,UAAU,aAAa,CAAC,EACjDR,EAAW,GAAGY,EAA+B,aAAa,CAAC,EAC3DZ,EAAW,GAAGa,EAA2B,aAAa,CAAC,CACzD,EACA,IAAKZ,CACP,CACF,CAAC,EACD,OAAOf,EAAyB,CAC9B,YAAAlC,EACA,OAAQoD,EACR,YAAaU,CACf,CAAC,CACH","names":["generateTransaction","args","payload","buildTransactionPayload","buildRawTransaction","aptosConfig","data","generateTransactionPayloadData","generateTransactionPayload","sender","options","feePayerAddress","isFeePayerTransactionInput","AccountAddress","isMultiAgentTransactionInput","secondarySignerAddresses","buildTransaction","getSigningMessage","transaction","generateSigningMessageForTransaction","signTransaction","signer","signAsFeePayer","simulateTransaction","signerPublicKey","secondarySignersPublicKeys","feePayerPublicKey","signedTransaction","generateSignedTransactionForSimulation","postAptosFullNode","submitTransaction","generateSignedTransaction","e","signedTxn","SignedTransaction","Deserializer","KeylessPublicKey","FederatedKeylessPublicKey","AbstractKeylessAccount","signAndSubmitTransaction","feePayer","isKeylessSigner","feePayerAuthenticator","senderAuthenticator","signAndSubmitAsFeePayer","packagePublishAbi","TypeTagVector","publicPackageTransaction","account","metadataBytes","moduleBytecode","totalByteCode","bytecode","MoveVector","rotateAuthKeyAbi","TypeTagU8","rotateAuthKey","fromAccount","toNewPrivateKey","accountInfo","getInfo","newAccount","Account","challengeHex","RotationProofChallenge","proofSignedByCurrentPrivateKey","proofSignedByNewPrivateKey","rawTxn","U8"]}
@@ -1,2 +0,0 @@
1
- var o="1.32.0";export{o as a};
2
- //# sourceMappingURL=chunk-AMCJQIOT.mjs.map
@@ -1,2 +0,0 @@
1
- import{a as v}from"./chunk-AHWZA3GD.mjs";import{g}from"./chunk-K4TJRYGQ.mjs";import{a as C}from"./chunk-ONFKJ57C.mjs";import{a as l}from"./chunk-WGIYSLH6.mjs";import{a as S}from"./chunk-YPBNYKOD.mjs";import{i as x,l as k,m as E,n as b,q as m}from"./chunk-XUP6VABV.mjs";import{b as h}from"./chunk-3XCYCFYI.mjs";import{e as K,f as A}from"./chunk-WKNX43KN.mjs";import{d as w}from"./chunk-F45G3GP3.mjs";import{a as u}from"./chunk-TM7OZT3W.mjs";import{b as f}from"./chunk-SPRNSFUV.mjs";import{jwtDecode as F}from"jwt-decode";async function j(r){let{aptosConfig:s,jwt:a,ephemeralKeyPair:t,uidKey:p="sub",derivationPath:i}=r,e={jwt_b64:a,epk:t.getPublicKey().bcsToHex().toStringWithoutPrefix(),exp_date_secs:t.expiryDateSecs,epk_blinder:f.fromHexInput(t.blinder).toStringWithoutPrefix(),uid_key:p,derivation_path:i},{data:n}=await K({aptosConfig:s,path:"fetch",body:e,originMethod:"getPepper",overrides:{WITH_CREDENTIALS:!1}});return f.fromHexInput(n.pepper).toUint8Array()}async function I(r){let{aptosConfig:s,jwt:a,ephemeralKeyPair:t,pepper:p=await j(r),uidKey:i="sub",maxExpHorizonSecs:e=(await m({aptosConfig:s})).maxExpHorizonSecs}=r;if(f.fromHexInput(p).toUint8Array().length!==l.PEPPER_LENGTH)throw new Error(`Pepper needs to be ${l.PEPPER_LENGTH} bytes`);let n=F(a);if(typeof n.iat!="number")throw new Error("iat was not found");if(e<t.expiryDateSecs-n.iat)throw Error(`The EphemeralKeyPair is too long lived. It's lifespan must be less than ${e}`);let o={jwt_b64:a,epk:t.getPublicKey().bcsToHex().toStringWithoutPrefix(),epk_blinder:f.fromHexInput(t.blinder).toStringWithoutPrefix(),exp_date_secs:t.expiryDateSecs,exp_horizon_secs:e,pepper:f.fromHexInput(p).toStringWithoutPrefix(),uid_key:i},{data:c}=await A({aptosConfig:s,path:"prove",body:o,originMethod:"getProof",overrides:{WITH_CREDENTIALS:!1}}),d=c.proof,y=new k({a:d.a,b:d.b,c:d.c});return new b({proof:new E(y,0),trainingWheelsSignature:h.fromHex(c.training_wheels_signature),expHorizonSecs:e})}async function ee(r){let{aptosConfig:s,jwt:a,jwkAddress:t,uidKey:p,proofFetchCallback:i,pepper:e=await j(r)}=r,{verificationKey:n,maxExpHorizonSecs:o}=await m({aptosConfig:s}),c=I({...r,pepper:e,maxExpHorizonSecs:o}),d=i?c:await c;if(t!==void 0){let _=S.fromJwtAndPepper({jwt:a,pepper:e,jwkAddress:t,uidKey:p}),H=await g({aptosConfig:s,authenticationKey:_.authKey().derivedAddress()});return C.create({...r,address:H,proof:d,pepper:e,proofFetchCallback:i,jwkAddress:t,verificationKey:n})}let y=x.fromJwtAndPepper({jwt:a,pepper:e,uidKey:p}),P=await g({aptosConfig:s,authenticationKey:y.authKey().derivedAddress()});return l.create({...r,address:P,proof:d,pepper:e,proofFetchCallback:i,verificationKey:n})}async function te(r){let{aptosConfig:s,sender:a,iss:t,options:p}=r,i=r.jwksUrl??(t.endsWith("/")?`${t}.well-known/jwks.json`:`${t}/.well-known/jwks.json`),e;try{if(e=await fetch(i),!e.ok)throw new Error(`${e.status} ${e.statusText}`)}catch(o){let c;throw o instanceof Error?c=`${o.message}`:c=`error unknown - ${o}`,w.fromErrorType({type:14,details:`Failed to fetch JWKS at ${i}: ${c}`})}let n=await e.json();return v({aptosConfig:s,sender:a.accountAddress,data:{function:"0x1::jwks::update_federated_jwk_set",functionArguments:[t,u.MoveString(n.keys.map(o=>o.kid)),u.MoveString(n.keys.map(o=>o.alg)),u.MoveString(n.keys.map(o=>o.e)),u.MoveString(n.keys.map(o=>o.n))]},options:p})}export{j as a,I as b,ee as c,te as d};
2
- //# sourceMappingURL=chunk-EEB7EZFO.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/internal/keyless.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file contains the underlying implementations for exposed API surface in\n * the {@link api/keyless}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * keyless namespace and without having a dependency cycle error.\n */\nimport { jwtDecode, JwtPayload } from \"jwt-decode\";\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { postAptosPepperService, postAptosProvingService } from \"../client\";\nimport {\n AccountAddressInput,\n EphemeralSignature,\n Groth16Zkp,\n Hex,\n KeylessPublicKey,\n MoveJWK,\n ZeroKnowledgeSig,\n ZkProof,\n getKeylessConfig,\n} from \"../core\";\nimport { HexInput, ZkpVariant } from \"../types\";\nimport { Account, EphemeralKeyPair, KeylessAccount, ProofFetchCallback } from \"../account\";\nimport { PepperFetchRequest, PepperFetchResponse, ProverRequest, ProverResponse } from \"../types/keyless\";\nimport { lookupOriginalAccountAddress } from \"./account\";\nimport { FederatedKeylessPublicKey } from \"../core/crypto/federatedKeyless\";\nimport { FederatedKeylessAccount } from \"../account/FederatedKeylessAccount\";\nimport { MoveVector } from \"../bcs\";\nimport { generateTransaction } from \"./transactionSubmission\";\nimport { InputGenerateTransactionOptions, SimpleTransaction } from \"../transactions\";\nimport { KeylessError, KeylessErrorType } from \"../errors\";\n\n/**\n * Retrieves a pepper value based on the provided configuration and authentication details.\n *\n * @param args - The arguments required to fetch the pepper.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.jwt - The JSON Web Token used for authentication.\n * @param args.ephemeralKeyPair - The ephemeral key pair used for the operation.\n * @param args.uidKey - An optional unique identifier key (defaults to \"sub\").\n * @param args.derivationPath - An optional derivation path for the key.\n * @returns A Uint8Array containing the fetched pepper value.\n */\nexport async function getPepper(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n uidKey?: string;\n derivationPath?: string;\n}): Promise<Uint8Array> {\n const { aptosConfig, jwt, ephemeralKeyPair, uidKey = \"sub\", derivationPath } = args;\n\n const body = {\n jwt_b64: jwt,\n epk: ephemeralKeyPair.getPublicKey().bcsToHex().toStringWithoutPrefix(),\n exp_date_secs: ephemeralKeyPair.expiryDateSecs,\n epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),\n uid_key: uidKey,\n derivation_path: derivationPath,\n };\n const { data } = await postAptosPepperService<PepperFetchRequest, PepperFetchResponse>({\n aptosConfig,\n path: \"fetch\",\n body,\n originMethod: \"getPepper\",\n overrides: { WITH_CREDENTIALS: false },\n });\n return Hex.fromHexInput(data.pepper).toUint8Array();\n}\n\n/**\n * Generates a zero-knowledge proof based on the provided parameters.\n * This function is essential for creating a signed proof that can be used in various cryptographic operations.\n *\n * @param args - The parameters required to generate the proof.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.jwt - The JSON Web Token used for authentication.\n * @param args.ephemeralKeyPair - The ephemeral key pair used for generating the proof.\n * @param args.pepper - An optional hex input used to enhance security (default is generated if not provided).\n * @param args.uidKey - An optional string that specifies the unique identifier key (defaults to \"sub\").\n * @throws Error if the pepper length is not valid or if the ephemeral key pair's lifespan exceeds the maximum allowed.\n */\nexport async function getProof(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n pepper?: HexInput;\n uidKey?: string;\n maxExpHorizonSecs?: number;\n}): Promise<ZeroKnowledgeSig> {\n const {\n aptosConfig,\n jwt,\n ephemeralKeyPair,\n pepper = await getPepper(args),\n uidKey = \"sub\",\n maxExpHorizonSecs = (await getKeylessConfig({ aptosConfig })).maxExpHorizonSecs,\n } = args;\n if (Hex.fromHexInput(pepper).toUint8Array().length !== KeylessAccount.PEPPER_LENGTH) {\n throw new Error(`Pepper needs to be ${KeylessAccount.PEPPER_LENGTH} bytes`);\n }\n const decodedJwt = jwtDecode<JwtPayload>(jwt);\n if (typeof decodedJwt.iat !== \"number\") {\n throw new Error(\"iat was not found\");\n }\n if (maxExpHorizonSecs < ephemeralKeyPair.expiryDateSecs - decodedJwt.iat) {\n throw Error(`The EphemeralKeyPair is too long lived. It's lifespan must be less than ${maxExpHorizonSecs}`);\n }\n const json = {\n jwt_b64: jwt,\n epk: ephemeralKeyPair.getPublicKey().bcsToHex().toStringWithoutPrefix(),\n epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),\n exp_date_secs: ephemeralKeyPair.expiryDateSecs,\n exp_horizon_secs: maxExpHorizonSecs,\n pepper: Hex.fromHexInput(pepper).toStringWithoutPrefix(),\n uid_key: uidKey,\n };\n\n const { data } = await postAptosProvingService<ProverRequest, ProverResponse>({\n aptosConfig,\n path: \"prove\",\n body: json,\n originMethod: \"getProof\",\n overrides: { WITH_CREDENTIALS: false },\n });\n\n const proofPoints = data.proof;\n const groth16Zkp = new Groth16Zkp({\n a: proofPoints.a,\n b: proofPoints.b,\n c: proofPoints.c,\n });\n\n const signedProof = new ZeroKnowledgeSig({\n proof: new ZkProof(groth16Zkp, ZkpVariant.Groth16),\n trainingWheelsSignature: EphemeralSignature.fromHex(data.training_wheels_signature),\n expHorizonSecs: maxExpHorizonSecs,\n });\n return signedProof;\n}\n\n/**\n * Derives a keyless account by fetching the necessary proof and looking up the original account address.\n * This function helps in creating a keyless account that can be used without managing private keys directly.\n *\n * @param args - The arguments required to derive the keyless account.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.jwt - The JSON Web Token used for authentication.\n * @param args.ephemeralKeyPair - The ephemeral key pair used for cryptographic operations.\n * @param args.uidKey - An optional unique identifier key for the user.\n * @param args.pepper - An optional hexadecimal input used for additional security.\n * @param args.proofFetchCallback - An optional callback function to handle the proof fetch outcome.\n * @returns A keyless account object.\n */\nexport async function deriveKeylessAccount(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n uidKey?: string;\n pepper?: HexInput;\n proofFetchCallback?: ProofFetchCallback;\n}): Promise<KeylessAccount>;\n\nexport async function deriveKeylessAccount(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n jwkAddress: AccountAddressInput;\n uidKey?: string;\n pepper?: HexInput;\n proofFetchCallback?: ProofFetchCallback;\n}): Promise<FederatedKeylessAccount>;\n\nexport async function deriveKeylessAccount(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n jwkAddress?: AccountAddressInput;\n uidKey?: string;\n pepper?: HexInput;\n proofFetchCallback?: ProofFetchCallback;\n}): Promise<KeylessAccount | FederatedKeylessAccount> {\n const { aptosConfig, jwt, jwkAddress, uidKey, proofFetchCallback, pepper = await getPepper(args) } = args;\n const { verificationKey, maxExpHorizonSecs } = await getKeylessConfig({ aptosConfig });\n\n const proofPromise = getProof({ ...args, pepper, maxExpHorizonSecs });\n // If a callback is provided, pass in the proof as a promise to KeylessAccount.create. This will make the proof be fetched in the\n // background and the callback will handle the outcome of the fetch. This allows the developer to not have to block on the proof fetch\n // allowing for faster rendering of UX.\n //\n // If no callback is provided, the just await the proof fetch and continue synchronously.\n const proof = proofFetchCallback ? proofPromise : await proofPromise;\n\n // Look up the original address to handle key rotations and then instantiate the account.\n if (jwkAddress !== undefined) {\n const publicKey = FederatedKeylessPublicKey.fromJwtAndPepper({ jwt, pepper, jwkAddress, uidKey });\n const address = await lookupOriginalAccountAddress({\n aptosConfig,\n authenticationKey: publicKey.authKey().derivedAddress(),\n });\n\n return FederatedKeylessAccount.create({\n ...args,\n address,\n proof,\n pepper,\n proofFetchCallback,\n jwkAddress,\n verificationKey,\n });\n }\n\n const publicKey = KeylessPublicKey.fromJwtAndPepper({ jwt, pepper, uidKey });\n const address = await lookupOriginalAccountAddress({\n aptosConfig,\n authenticationKey: publicKey.authKey().derivedAddress(),\n });\n return KeylessAccount.create({ ...args, address, proof, pepper, proofFetchCallback, verificationKey });\n}\n\nexport interface JWKS {\n keys: MoveJWK[];\n}\n\nexport async function updateFederatedKeylessJwkSetTransaction(args: {\n aptosConfig: AptosConfig;\n sender: Account;\n iss: string;\n jwksUrl?: string;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, sender, iss, options } = args;\n const jwksUrl = args.jwksUrl ?? (iss.endsWith(\"/\") ? `${iss}.well-known/jwks.json` : `${iss}/.well-known/jwks.json`);\n\n let response: Response;\n\n try {\n response = await fetch(jwksUrl);\n if (!response.ok) {\n throw new Error(`${response.status} ${response.statusText}`);\n }\n } catch (error) {\n let errorMessage: string;\n if (error instanceof Error) {\n errorMessage = `${error.message}`;\n } else {\n errorMessage = `error unknown - ${error}`;\n }\n throw KeylessError.fromErrorType({\n type: KeylessErrorType.JWK_FETCH_FAILED_FEDERATED,\n details: `Failed to fetch JWKS at ${jwksUrl}: ${errorMessage}`,\n });\n }\n\n const jwks: JWKS = await response.json();\n return generateTransaction({\n aptosConfig,\n sender: sender.accountAddress,\n data: {\n function: \"0x1::jwks::update_federated_jwk_set\",\n functionArguments: [\n iss,\n MoveVector.MoveString(jwks.keys.map((key) => key.kid)),\n MoveVector.MoveString(jwks.keys.map((key) => key.alg)),\n MoveVector.MoveString(jwks.keys.map((key) => key.e)),\n MoveVector.MoveString(jwks.keys.map((key) => key.n)),\n ],\n },\n options,\n });\n}\n"],"mappings":"ieASA,OAAS,aAAAA,MAA6B,aAoCtC,eAAsBC,EAAUC,EAMR,CACtB,GAAM,CAAE,YAAAC,EAAa,IAAAC,EAAK,iBAAAC,EAAkB,OAAAC,EAAS,MAAO,eAAAC,CAAe,EAAIL,EAEzEM,EAAO,CACX,QAASJ,EACT,IAAKC,EAAiB,aAAa,EAAE,SAAS,EAAE,sBAAsB,EACtE,cAAeA,EAAiB,eAChC,YAAaI,EAAI,aAAaJ,EAAiB,OAAO,EAAE,sBAAsB,EAC9E,QAASC,EACT,gBAAiBC,CACnB,EACM,CAAE,KAAAG,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C,EAAQ,IAAAC,EAAK,QAAAC,CAAQ,EAAIxC,EACxCyC,EAAUzC,EAAK,UAAYuC,EAAI,SAAS,GAAG,EAAI,GAAGA,CAAG,wBAA0B,GAAGA,CAAG,0BAEvFG,EAEJ,GAAI,CAEF,GADAA,EAAW,MAAM,MAAMD,CAAO,EAC1B,CAACC,EAAS,GACZ,MAAM,IAAI,MAAM,GAAGA,EAAS,MAAM,IAAIA,EAAS,UAAU,EAAE,CAE/D,OAASC,EAAO,CACd,IAAIC,EACJ,MAAID,aAAiB,MACnBC,EAAe,GAAGD,EAAM,OAAO,GAE/BC,EAAe,mBAAmBD,CAAK,GAEnCE,EAAa,cAAc,CAC/B,QACA,QAAS,2BAA2BJ,CAAO,KAAKG,CAAY,EAC9D,CAAC,CACH,CAEA,IAAME,EAAa,MAAMJ,EAAS,KAAK,EACvC,OAAOK,EAAoB,CACzB,YAAA9C,EACA,OAAQqC,EAAO,eACf,KAAM,CACJ,SAAU,sCACV,kBAAmB,CACjBC,EACAS,EAAW,WAAWF,EAAK,KAAK,IAAKG,GAAQA,EAAI,GAAG,CAAC,EACrDD,EAAW,WAAWF,EAAK,KAAK,IAAKG,GAAQA,EAAI,GAAG,CAAC,EACrDD,EAAW,WAAWF,EAAK,KAAK,IAAKG,GAAQA,EAAI,CAAC,CAAC,EACnDD,EAAW,WAAWF,EAAK,KAAK,IAAKG,GAAQA,EAAI,CAAC,CAAC,CACrD,CACF,EACA,QAAAT,CACF,CAAC,CACH","names":["jwtDecode","getPepper","args","aptosConfig","jwt","ephemeralKeyPair","uidKey","derivationPath","body","Hex","data","postAptosPepperService","getProof","pepper","maxExpHorizonSecs","getKeylessConfig","KeylessAccount","decodedJwt","jwtDecode","json","postAptosProvingService","proofPoints","groth16Zkp","Groth16Zkp","ZeroKnowledgeSig","ZkProof","EphemeralSignature","deriveKeylessAccount","jwkAddress","proofFetchCallback","verificationKey","proofPromise","proof","publicKey","FederatedKeylessPublicKey","address","lookupOriginalAccountAddress","FederatedKeylessAccount","KeylessPublicKey","updateFederatedKeylessJwkSetTransaction","sender","iss","options","jwksUrl","response","error","errorMessage","KeylessError","jwks","generateTransaction","MoveVector","key"]}
@@ -1,2 +0,0 @@
1
- import{c as l}from"./chunk-AOROYJ74.mjs";import{a as k,b as y,d as g,e as w,f as z,g as D,h as L,i as d,j as R,l as X,m as q,n as H,o as J,p as K,q as Q,s as i,t as W}from"./chunk-WSFHH3BK.mjs";import{c as j}from"./chunk-K4TJRYGQ.mjs";import{b as C,c as x,d as a,e as M,f as _,g as O,h as V,i as G,n as P}from"./chunk-T6ADNZE5.mjs";import{b as m}from"./chunk-JNO7KPMG.mjs";import{a as T,c as I,d as f}from"./chunk-TM7OZT3W.mjs";import{a as A,b as E,c as v,d as b,e as F,f as $,g as S}from"./chunk-42H7WETG.mjs";import{a as p}from"./chunk-L56DQ4N3.mjs";var Y=new TextEncoder;function yn(n){return n?.map(e=>y(e)?l(e):e)??[]}async function B(n,e,t,u){let r=await j({aptosConfig:u,accountAddress:n,moduleName:e});if(r.abi)return r.abi.exposed_functions.find(s=>s.name===t)}async function Tn(n,e,t,u){let r=await B(n,e,t,u);if(!r)throw new Error(`Could not find function ABI for '${n}::${e}::${t}'`);let s=[];for(let c=0;c<r.params.length;c+=1)s.push(l(r.params[c],{allowGenerics:!0}));return{typeParameters:r.generic_type_params,parameters:s}}async function ln(n,e,t,u){let r=await B(n,e,t,u);if(!r)throw new Error(`Could not find entry function ABI for '${n}::${e}::${t}'`);if(!r.is_entry)throw new Error(`'${n}::${e}::${t}' is not an entry function`);let s=W(r),c=[];for(let o=s;o<r.params.length;o+=1)c.push(l(r.params[o],{allowGenerics:!0}));return{signers:s,typeParameters:r.generic_type_params,parameters:c}}async function An(n,e,t,u){let r=await B(n,e,t,u);if(!r)throw new Error(`Could not find view function ABI for '${n}::${e}::${t}'`);if(!r.is_view)throw new Error(`'${n}::${e}::${t}' is not an view function`);let s=[];for(let o=0;o<r.params.length;o+=1)s.push(l(r.params[o],{allowGenerics:!0}));let c=[];for(let o=0;o<r.return.length;o+=1)c.push(l(r.return[o],{allowGenerics:!0}));return{typeParameters:r.generic_type_params,parameters:s,returnTypes:c}}function gn(n,e,t,u,r){return n instanceof p?n:p.new_bytes(Z(e,t,n,u,r).bcsToBytes())}function Z(n,e,t,u,r){if(u>=e.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${e.parameters.length}`);let s=e.parameters[u];return U(t,s,u,r)}function U(n,e,t,u){return D(n)?(h(e,n,t),n):N(n,e,t,u)}function N(n,e,t,u){if(e.isBool()){if(k(n))return new A(n);if(y(n)){if(n==="true")return new A(!0);if(n==="false")return new A(!1)}i("boolean",t)}if(e.isAddress()){if(y(n))return m.fromString(n);i("string | AccountAddress",t)}if(e.isU8()){let r=g(n);if(r!==void 0)return new E(r);i("number | string",t)}if(e.isU16()){let r=g(n);if(r!==void 0)return new v(r);i("number | string",t)}if(e.isU32()){let r=g(n);if(r!==void 0)return new b(r);i("number | string",t)}if(e.isU64()){if(w(n))return new F(BigInt(n));i("bigint | number | string",t)}if(e.isU128()){if(w(n))return new $(BigInt(n));i("bigint | number | string",t)}if(e.isU256()){if(w(n))return new S(BigInt(n));i("bigint | number | string",t)}if(e.isGeneric()){let r=e.value;if(r<0||r>=u.length)throw new Error(`Generic argument ${e.toString()} is invalid for argument ${t}`);return U(n,u[r],t,u)}if(e.isVector()){if(e.value.isU8()){if(y(n))return T.U8(Y.encode(n));if(n instanceof Uint8Array)return T.U8(n);if(n instanceof ArrayBuffer)return T.U8(new Uint8Array(n))}if(Array.isArray(n))return new T(n.map(r=>U(r,e.value,t,u)));throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}if(e.isStruct()){if(e.isString()){if(y(n))return new I(n);i("string",t)}if(e.isObject()){if(y(n))return m.fromString(n);i("string | AccountAddress",t)}if(e.isOption()){if(z(n)){let r=e.value.typeArgs[0];return r instanceof C?new f(null):r instanceof G?new f(null):r instanceof x?new f(null):r instanceof a?new f(null):r instanceof M?new f(null):r instanceof _?new f(null):r instanceof O?new f(null):r instanceof V?new f(null):new f(null)}return new f(U(n,e.value.typeArgs[0],t,u))}throw new Error(`Unsupported struct input type for argument ${t}, type '${e.toString()}'`)}throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}function h(n,e,t){if(n.isBool()){if(L(e))return;i("Bool",t)}if(n.isAddress()){if(d(e))return;i("AccountAddress",t)}if(n.isU8()){if(X(e))return;i("U8",t)}if(n.isU16()){if(q(e))return;i("U16",t)}if(n.isU32()){if(H(e))return;i("U32",t)}if(n.isU64()){if(J(e))return;i("U64",t)}if(n.isU128()){if(K(e))return;i("U128",t)}if(n.isU256()){if(Q(e))return;i("U256",t)}if(n.isVector()){if(e instanceof T){e.values.length>0&&h(n.value,e.values[0],t);return}i("MoveVector",t)}if(n instanceof P){if(n.isString()){if(R(e))return;i("MoveString",t)}if(n.isObject()){if(d(e))return;i("AccountAddress",t)}if(n.isOption()){if(e instanceof f){e.value!==void 0&&h(n.value.typeArgs[0],e.value,t);return}i("MoveOption",t)}}throw new Error(`Type mismatch for argument ${t}, expected '${n.toString()}'`)}export{yn as a,B as b,Tn as c,ln as d,An as e,gn as f,Z as g,U as h};
2
- //# sourceMappingURL=chunk-G2GN4LH5.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/account\";\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 */\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 */\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 */\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 */\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.new_bytes(\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 */\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 */\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 */\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 */\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 */\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 // 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 */\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":"wiBAiDA,IAAMA,EAAe,IAAI,YAQlB,SAASC,GAAoBC,EAAqD,CACvF,OACEA,GAAe,IAAKC,GAEdC,EAASD,CAAO,EACXE,EAAaF,CAAO,EAEtBA,CACR,GAAK,CAAC,CAEX,CAWA,eAAsBG,EACpBC,EACAC,EACAC,EACAC,EACmC,CAEnC,IAAMC,EAAS,MAAMC,EAAU,CAAE,YAAAF,EAAa,eAAgBH,EAAe,WAAAC,CAAW,CAAC,EAEzF,GAAIG,EAAO,IACT,OAAOA,EAAO,IAAI,kBAAkB,KAAME,GAASA,EAAK,OAASJ,CAAY,CAIjF,CASA,eAAsBK,GACpBP,EACAC,EACAC,EACAC,EACsB,CACtB,IAAMK,EAAc,MAAMT,EAAiBC,EAAeC,EAAYC,EAAcC,CAAW,EAC/F,GAAI,CAACK,EACH,MAAM,IAAI,MAAM,oCAAoCR,CAAa,KAAKC,CAAU,KAAKC,CAAY,GAAG,EAEtG,IAAMO,EAAoB,CAAC,EAC3B,QAASC,EAAI,EAAGA,EAAIF,EAAY,OAAO,OAAQE,GAAK,EAClDD,EAAO,KAAKX,EAAaU,EAAY,OAAOE,CAAC,EAAG,CAAE,cAAe,EAAK,CAAC,CAAC,EAG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AAM,SAAS,EAAG,CACpB,GAAI0C,EAAY3C,CAAG,EACjB,OAEFQ,EAAkB,aAAcZ,CAAQ,CAC1C,CACA,GAAIK,EAAM,SAAS,EAAG,CACpB,GAAIkC,EAAanC,CAAG,EAClB,OAEFQ,EAAkB,iBAAkBZ,CAAQ,CAC9C,CACA,GAAIK,EAAM,SAAS,EAAG,CACpB,GAAID,aAAe0B,EAAY,CAEzB1B,EAAI,QAAU,QAChBI,EAAUH,EAAM,MAAM,SAAS,CAAC,EAAGD,EAAI,MAAOJ,CAAQ,EAExD,MACF,CACAY,EAAkB,aAAcZ,CAAQ,CAC1C,CACF,CAEA,MAAM,IAAI,MAAM,8BAA8BA,CAAQ,eAAeK,EAAM,SAAS,CAAC,GAAG,CAC1F","names":["TEXT_ENCODER","standardizeTypeTags","typeArguments","typeArg","isString","parseTypeTag","fetchFunctionAbi","moduleAddress","moduleName","functionName","aptosConfig","module","getModule","func","fetchMoveFunctionAbi","functionAbi","params","i","fetchEntryFunctionAbi","numSigners","findFirstNonSignerArg","fetchViewFunctionAbi","returnTypes","convertCallArgument","argument","position","genericTypeParams","CallArgument","convertArgument","arg","param","checkOrConvertArgument","isEncodedEntryFunctionArgument","checkType","parseArg","isBool","Bool","throwTypeMismatch","AccountAddress","num","convertNumber","U8","U16","U32","isLargeNumber","U64","U128","U256","genericIndex","MoveVector","item","MoveString","isEmptyOption","innerParam","TypeTagBool","MoveOption","TypeTagAddress","TypeTagU8","TypeTagU16","TypeTagU32","TypeTagU64","TypeTagU128","TypeTagU256","isBcsBool","isBcsAddress","isBcsU8","isBcsU16","isBcsU32","isBcsU64","isBcsU128","isBcsU256","TypeTagStruct","isBcsString"]}
@@ -1,2 +0,0 @@
1
- function o(a,i,e){let r=e.value;return e.value=async function(...t){let[n]=t;if(n.transaction.feePayerAddress&&!n.feePayerAuthenticator)throw new Error("You are submitting a Fee Payer transaction but missing the feePayerAuthenticator");return r.apply(this,t)},e}function u(a,i,e){let r=e.value;return e.value=async function(...t){let[n]=t;if(n.transaction.feePayerAddress&&!n.feePayerPublicKey)throw new Error("You are simulating a Fee Payer transaction but missing the feePayerPublicKey");return r.apply(this,t)},e}export{o as a,u as b};
2
- //# sourceMappingURL=chunk-I2NMCLNW.mjs.map