@aptos-labs/ts-sdk 4.0.0 → 5.1.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 (331) hide show
  1. package/dist/common/{account-CmEgDBH6.d.ts → account-BW99GTa5.d.ts} +35 -4
  2. package/dist/common/chunk-A2XB7TVI.js +4 -0
  3. package/dist/common/chunk-A2XB7TVI.js.map +1 -0
  4. package/dist/common/cli/index.d.ts +1 -1
  5. package/dist/common/cli/index.js +1 -1
  6. package/dist/common/cli/index.js.map +1 -1
  7. package/dist/common/index.d.ts +381 -47
  8. package/dist/common/index.js +34 -36
  9. package/dist/common/index.js.map +1 -1
  10. package/dist/esm/{Ed25519Account-ndmdpFe9.d.mts → Ed25519Account-CPwej6wB.d.mts} +1 -1
  11. package/dist/esm/account/AbstractKeylessAccount.d.mts +3 -3
  12. package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
  13. package/dist/esm/account/AbstractedAccount.d.mts +3 -2
  14. package/dist/esm/account/AbstractedAccount.mjs +1 -1
  15. package/dist/esm/account/Account.d.mts +2 -2
  16. package/dist/esm/account/Account.mjs +1 -1
  17. package/dist/esm/account/AccountUtils.d.mts +3 -3
  18. package/dist/esm/account/AccountUtils.mjs +1 -1
  19. package/dist/esm/account/DerivableAbstractedAccount.d.mts +2 -2
  20. package/dist/esm/account/DerivableAbstractedAccount.mjs +1 -1
  21. package/dist/esm/account/Ed25519Account.d.mts +2 -2
  22. package/dist/esm/account/Ed25519Account.mjs +1 -1
  23. package/dist/esm/account/EphemeralKeyPair.d.mts +1 -1
  24. package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
  25. package/dist/esm/account/FederatedKeylessAccount.d.mts +3 -3
  26. package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
  27. package/dist/esm/account/KeylessAccount.d.mts +3 -3
  28. package/dist/esm/account/KeylessAccount.mjs +1 -1
  29. package/dist/esm/account/MultiEd25519Account.d.mts +2 -2
  30. package/dist/esm/account/MultiEd25519Account.mjs +1 -1
  31. package/dist/esm/account/MultiKeyAccount.d.mts +3 -3
  32. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  33. package/dist/esm/account/SingleKeyAccount.d.mts +2 -2
  34. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  35. package/dist/esm/account/index.d.mts +3 -3
  36. package/dist/esm/account/index.mjs +1 -1
  37. package/dist/esm/account/utils.d.mts +1 -1
  38. package/dist/esm/account/utils.mjs +1 -1
  39. package/dist/esm/{account--Q9z_xMN.d.mts → account-BortO8g2.d.mts} +34 -4
  40. package/dist/esm/api/account/abstraction.d.mts +1 -1
  41. package/dist/esm/api/account/abstraction.mjs +1 -1
  42. package/dist/esm/api/account.d.mts +31 -13
  43. package/dist/esm/api/account.mjs +1 -1
  44. package/dist/esm/api/ans.d.mts +2 -2
  45. package/dist/esm/api/ans.mjs +1 -1
  46. package/dist/esm/api/aptos.d.mts +4 -3
  47. package/dist/esm/api/aptos.mjs +1 -1
  48. package/dist/esm/api/aptosConfig.d.mts +1 -1
  49. package/dist/esm/api/aptosConfig.mjs +1 -1
  50. package/dist/esm/api/coin.d.mts +1 -1
  51. package/dist/esm/api/coin.mjs +1 -1
  52. package/dist/esm/api/digitalAsset.d.mts +2 -2
  53. package/dist/esm/api/digitalAsset.mjs +1 -1
  54. package/dist/esm/api/faucet.d.mts +1 -1
  55. package/dist/esm/api/faucet.mjs +1 -1
  56. package/dist/esm/api/fungibleAsset.d.mts +2 -2
  57. package/dist/esm/api/fungibleAsset.mjs +1 -1
  58. package/dist/esm/api/general.d.mts +1 -1
  59. package/dist/esm/api/general.mjs +1 -1
  60. package/dist/esm/api/index.d.mts +4 -3
  61. package/dist/esm/api/index.mjs +1 -1
  62. package/dist/esm/api/keyless.d.mts +3 -3
  63. package/dist/esm/api/keyless.mjs +1 -1
  64. package/dist/esm/api/object.d.mts +1 -1
  65. package/dist/esm/api/object.mjs +1 -1
  66. package/dist/esm/api/staking.d.mts +1 -1
  67. package/dist/esm/api/staking.mjs +1 -1
  68. package/dist/esm/api/table.d.mts +1 -1
  69. package/dist/esm/api/table.mjs +1 -1
  70. package/dist/esm/api/transaction.d.mts +56 -36
  71. package/dist/esm/api/transaction.mjs +1 -1
  72. package/dist/esm/api/transactionSubmission/build.d.mts +1 -1
  73. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  74. package/dist/esm/api/transactionSubmission/helpers.d.mts +1 -1
  75. package/dist/esm/api/transactionSubmission/management.d.mts +2 -2
  76. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  77. package/dist/esm/api/transactionSubmission/sign.d.mts +2 -2
  78. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  79. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  80. package/dist/esm/api/transactionSubmission/simulate.d.mts +1 -1
  81. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  82. package/dist/esm/api/transactionSubmission/submit.d.mts +1 -1
  83. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  84. package/dist/esm/api/utils.d.mts +1 -1
  85. package/dist/esm/api/utils.mjs +1 -1
  86. package/dist/esm/bcs/consts.d.mts +1 -1
  87. package/dist/esm/bcs/deserializer.d.mts +1 -1
  88. package/dist/esm/bcs/index.d.mts +1 -1
  89. package/dist/esm/bcs/index.mjs +1 -1
  90. package/dist/esm/bcs/serializable/entryFunctionBytes.d.mts +1 -1
  91. package/dist/esm/bcs/serializable/fixedBytes.d.mts +1 -1
  92. package/dist/esm/bcs/serializable/movePrimitives.d.mts +1 -1
  93. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  94. package/dist/esm/bcs/serializable/moveStructs.d.mts +1 -1
  95. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  96. package/dist/esm/bcs/serializer.d.mts +1 -1
  97. package/dist/esm/chunk-2PASUPUO.mjs +2 -0
  98. package/dist/esm/chunk-2PASUPUO.mjs.map +1 -0
  99. package/dist/esm/{chunk-6JYQ5P36.mjs → chunk-4AI7KQQ7.mjs} +2 -2
  100. package/dist/esm/{chunk-V6C6NWFU.mjs → chunk-6OWBKU7N.mjs} +2 -2
  101. package/dist/esm/{chunk-BPWSOC2Y.mjs → chunk-7EER7GWV.mjs} +2 -2
  102. package/dist/esm/{chunk-PLI53ZU6.mjs → chunk-AMXZQPUQ.mjs} +2 -2
  103. package/dist/esm/chunk-CIJA7ONS.mjs +2 -0
  104. package/dist/esm/{chunk-6SLY7UV2.mjs.map → chunk-CIJA7ONS.mjs.map} +1 -1
  105. package/dist/esm/chunk-I7XT6L7S.mjs +2 -0
  106. package/dist/esm/chunk-I7XT6L7S.mjs.map +1 -0
  107. package/dist/esm/{chunk-UQZTHVWC.mjs → chunk-JABP65XD.mjs} +2 -2
  108. package/dist/esm/chunk-L72TIN7T.mjs +4 -0
  109. package/dist/esm/chunk-L72TIN7T.mjs.map +1 -0
  110. package/dist/esm/{chunk-3BMZKCLH.mjs → chunk-M3AO73ZL.mjs} +2 -2
  111. package/dist/esm/chunk-MCFQE4GC.mjs +2 -0
  112. package/dist/esm/chunk-MCFQE4GC.mjs.map +1 -0
  113. package/dist/esm/chunk-OLILO7VD.mjs +2 -0
  114. package/dist/esm/{chunk-JCFTAG5Z.mjs.map → chunk-OLILO7VD.mjs.map} +1 -1
  115. package/dist/esm/{chunk-NF73V673.mjs → chunk-QP2BY4PK.mjs} +2 -2
  116. package/dist/esm/{chunk-Y7ZQTLH4.mjs → chunk-RCSJFTST.mjs} +2 -2
  117. package/dist/esm/{chunk-XYXBAU4J.mjs → chunk-SJDCGNWU.mjs} +2 -2
  118. package/dist/esm/{chunk-HZVN4JSO.mjs → chunk-WHSTLR3F.mjs} +2 -2
  119. package/dist/esm/chunk-ZP4DWSQA.mjs +2 -0
  120. package/dist/esm/chunk-ZP4DWSQA.mjs.map +1 -0
  121. package/dist/esm/cli/index.d.mts +1 -1
  122. package/dist/esm/cli/index.mjs +1 -1
  123. package/dist/esm/cli/localNode.mjs +1 -1
  124. package/dist/esm/cli/move.d.mts +1 -1
  125. package/dist/esm/client/core.d.mts +1 -1
  126. package/dist/esm/client/core.mjs +1 -1
  127. package/dist/esm/client/get.d.mts +1 -1
  128. package/dist/esm/client/get.mjs +1 -1
  129. package/dist/esm/client/index.d.mts +1 -1
  130. package/dist/esm/client/index.mjs +1 -1
  131. package/dist/esm/client/post.d.mts +1 -1
  132. package/dist/esm/client/post.mjs +1 -1
  133. package/dist/esm/core/account/index.d.mts +1 -1
  134. package/dist/esm/core/account/index.mjs +1 -1
  135. package/dist/esm/core/account/utils/address.d.mts +1 -1
  136. package/dist/esm/core/account/utils/address.mjs +1 -1
  137. package/dist/esm/core/account/utils/index.d.mts +1 -1
  138. package/dist/esm/core/account/utils/index.mjs +1 -1
  139. package/dist/esm/core/accountAddress.d.mts +1 -1
  140. package/dist/esm/core/accountAddress.mjs +1 -1
  141. package/dist/esm/core/authenticationKey.d.mts +1 -1
  142. package/dist/esm/core/authenticationKey.mjs +1 -1
  143. package/dist/esm/core/crypto/abstraction.d.mts +1 -1
  144. package/dist/esm/core/crypto/abstraction.mjs +1 -1
  145. package/dist/esm/core/crypto/deserializationUtils.d.mts +1 -1
  146. package/dist/esm/core/crypto/deserializationUtils.mjs +1 -1
  147. package/dist/esm/core/crypto/ed25519.d.mts +1 -1
  148. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  149. package/dist/esm/core/crypto/ephemeral.d.mts +1 -1
  150. package/dist/esm/core/crypto/ephemeral.mjs +1 -1
  151. package/dist/esm/core/crypto/federatedKeyless.d.mts +2 -2
  152. package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
  153. package/dist/esm/core/crypto/index.d.mts +3 -2
  154. package/dist/esm/core/crypto/index.mjs +1 -1
  155. package/dist/esm/core/crypto/keyless.d.mts +2 -2
  156. package/dist/esm/core/crypto/keyless.mjs +1 -1
  157. package/dist/esm/core/crypto/multiEd25519.d.mts +1 -1
  158. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  159. package/dist/esm/core/crypto/multiKey.d.mts +1 -1
  160. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  161. package/dist/esm/core/crypto/privateKey.d.mts +1 -1
  162. package/dist/esm/core/crypto/privateKey.mjs +1 -1
  163. package/dist/esm/core/crypto/proof.d.mts +1 -1
  164. package/dist/esm/core/crypto/proof.mjs +1 -1
  165. package/dist/esm/core/crypto/publicKey.d.mts +1 -1
  166. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  167. package/dist/esm/core/crypto/secp256k1.d.mts +1 -1
  168. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  169. package/dist/esm/core/crypto/secp256r1.d.mts +306 -0
  170. package/dist/esm/core/crypto/secp256r1.mjs +2 -0
  171. package/dist/esm/core/crypto/secp256r1.mjs.map +1 -0
  172. package/dist/esm/core/crypto/signature.d.mts +1 -1
  173. package/dist/esm/core/crypto/signature.mjs +1 -1
  174. package/dist/esm/core/crypto/singleKey.d.mts +1 -1
  175. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  176. package/dist/esm/core/crypto/types.d.mts +1 -1
  177. package/dist/esm/core/crypto/utils.d.mts +5 -2
  178. package/dist/esm/core/crypto/utils.mjs +1 -1
  179. package/dist/esm/core/hex.d.mts +1 -1
  180. package/dist/esm/core/index.d.mts +3 -2
  181. package/dist/esm/core/index.mjs +1 -1
  182. package/dist/esm/errors/index.d.mts +1 -1
  183. package/dist/esm/errors/index.mjs +1 -1
  184. package/dist/esm/{federatedKeyless-CiyplsOB.d.mts → federatedKeyless-CTzDAQTu.d.mts} +1 -1
  185. package/dist/esm/index.d.mts +5 -4
  186. package/dist/esm/index.mjs +1 -1
  187. package/dist/esm/internal/abstraction.d.mts +1 -1
  188. package/dist/esm/internal/abstraction.mjs +1 -1
  189. package/dist/esm/internal/account.d.mts +45 -21
  190. package/dist/esm/internal/account.mjs +1 -1
  191. package/dist/esm/internal/ans.d.mts +2 -2
  192. package/dist/esm/internal/ans.mjs +1 -1
  193. package/dist/esm/internal/coin.d.mts +1 -1
  194. package/dist/esm/internal/coin.mjs +1 -1
  195. package/dist/esm/internal/digitalAsset.d.mts +2 -2
  196. package/dist/esm/internal/digitalAsset.mjs +1 -1
  197. package/dist/esm/internal/faucet.d.mts +1 -1
  198. package/dist/esm/internal/faucet.mjs +1 -1
  199. package/dist/esm/internal/fungibleAsset.d.mts +2 -2
  200. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  201. package/dist/esm/internal/general.d.mts +1 -1
  202. package/dist/esm/internal/general.mjs +1 -1
  203. package/dist/esm/internal/keyless.d.mts +3 -3
  204. package/dist/esm/internal/keyless.mjs +1 -1
  205. package/dist/esm/internal/object.d.mts +1 -1
  206. package/dist/esm/internal/object.mjs +1 -1
  207. package/dist/esm/internal/staking.d.mts +1 -1
  208. package/dist/esm/internal/staking.mjs +1 -1
  209. package/dist/esm/internal/table.d.mts +1 -1
  210. package/dist/esm/internal/table.mjs +1 -1
  211. package/dist/esm/internal/transaction.d.mts +1 -1
  212. package/dist/esm/internal/transaction.mjs +1 -1
  213. package/dist/esm/internal/transactionSubmission.d.mts +2 -2
  214. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  215. package/dist/esm/internal/utils/index.d.mts +1 -1
  216. package/dist/esm/internal/utils/index.mjs +1 -1
  217. package/dist/esm/internal/utils/utils.d.mts +1 -1
  218. package/dist/esm/internal/utils/utils.mjs +1 -1
  219. package/dist/esm/internal/view.d.mts +1 -1
  220. package/dist/esm/internal/view.mjs +1 -1
  221. package/dist/esm/transactions/authenticator/account.d.mts +1 -1
  222. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  223. package/dist/esm/transactions/authenticator/index.d.mts +1 -1
  224. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  225. package/dist/esm/transactions/authenticator/transaction.d.mts +1 -1
  226. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  227. package/dist/esm/transactions/index.d.mts +1 -1
  228. package/dist/esm/transactions/index.mjs +1 -1
  229. package/dist/esm/transactions/instances/chainId.d.mts +1 -1
  230. package/dist/esm/transactions/instances/identifier.d.mts +1 -1
  231. package/dist/esm/transactions/instances/index.d.mts +1 -1
  232. package/dist/esm/transactions/instances/index.mjs +1 -1
  233. package/dist/esm/transactions/instances/moduleId.d.mts +1 -1
  234. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  235. package/dist/esm/transactions/instances/multiAgentTransaction.d.mts +1 -1
  236. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  237. package/dist/esm/transactions/instances/rawTransaction.d.mts +1 -1
  238. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  239. package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +1 -1
  240. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  241. package/dist/esm/transactions/instances/signedTransaction.d.mts +1 -1
  242. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  243. package/dist/esm/transactions/instances/simpleTransaction.d.mts +1 -1
  244. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  245. package/dist/esm/transactions/instances/transactionArgument.d.mts +1 -1
  246. package/dist/esm/transactions/instances/transactionPayload.d.mts +1 -1
  247. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  248. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +2 -2
  249. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  250. package/dist/esm/transactions/management/index.d.mts +2 -2
  251. package/dist/esm/transactions/management/index.mjs +1 -1
  252. package/dist/esm/transactions/management/transactionWorker.d.mts +2 -2
  253. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  254. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +1 -1
  255. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  256. package/dist/esm/transactions/transactionBuilder/index.d.mts +1 -1
  257. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  258. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +1 -1
  259. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  260. package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +1 -1
  261. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  262. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +2 -2
  263. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  264. package/dist/esm/transactions/typeTag/index.d.mts +1 -1
  265. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  266. package/dist/esm/transactions/typeTag/parser.d.mts +1 -1
  267. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  268. package/dist/esm/transactions/types.d.mts +1 -1
  269. package/dist/esm/types/abstraction.d.mts +9 -3
  270. package/dist/esm/types/abstraction.mjs +1 -1
  271. package/dist/esm/types/index.d.mts +1 -1
  272. package/dist/esm/types/index.mjs +1 -1
  273. package/dist/esm/types/types.d.mts +1 -1
  274. package/dist/esm/types/types.mjs +1 -1
  275. package/dist/esm/utils/const.d.mts +2 -1
  276. package/dist/esm/utils/const.mjs +1 -1
  277. package/dist/esm/utils/helpers.d.mts +1 -1
  278. package/dist/esm/utils/helpers.mjs +1 -1
  279. package/dist/esm/utils/index.d.mts +2 -2
  280. package/dist/esm/utils/index.mjs +1 -1
  281. package/dist/esm/utils/normalizeBundle.d.mts +1 -1
  282. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  283. package/dist/esm/version.d.mts +1 -1
  284. package/dist/esm/version.mjs +1 -1
  285. package/package.json +27 -28
  286. package/src/account/AbstractedAccount.ts +16 -3
  287. package/src/account/DerivableAbstractedAccount.ts +3 -1
  288. package/src/api/account.ts +36 -23
  289. package/src/api/transaction.ts +59 -36
  290. package/src/core/crypto/index.ts +1 -0
  291. package/src/core/crypto/privateKey.ts +1 -0
  292. package/src/core/crypto/secp256k1.ts +9 -1
  293. package/src/core/crypto/secp256r1.ts +495 -0
  294. package/src/core/crypto/singleKey.ts +11 -0
  295. package/src/core/crypto/utils.ts +38 -1
  296. package/src/internal/account.ts +69 -83
  297. package/src/transactions/authenticator/account.ts +71 -17
  298. package/src/types/abstraction.ts +9 -2
  299. package/src/types/types.ts +5 -0
  300. package/src/utils/const.ts +2 -0
  301. package/src/version.ts +1 -1
  302. package/dist/common/chunk-6MMUUJHX.js +0 -4
  303. package/dist/common/chunk-6MMUUJHX.js.map +0 -1
  304. package/dist/esm/chunk-4JT5AESZ.mjs +0 -2
  305. package/dist/esm/chunk-4JT5AESZ.mjs.map +0 -1
  306. package/dist/esm/chunk-55Q7BSZT.mjs +0 -6
  307. package/dist/esm/chunk-55Q7BSZT.mjs.map +0 -1
  308. package/dist/esm/chunk-6SLY7UV2.mjs +0 -2
  309. package/dist/esm/chunk-DPW6ELCQ.mjs +0 -2
  310. package/dist/esm/chunk-DPW6ELCQ.mjs.map +0 -1
  311. package/dist/esm/chunk-IJE2LVZG.mjs +0 -2
  312. package/dist/esm/chunk-IJE2LVZG.mjs.map +0 -1
  313. package/dist/esm/chunk-JCFTAG5Z.mjs +0 -2
  314. package/dist/esm/chunk-K43K3YG7.mjs +0 -2
  315. package/dist/esm/chunk-K43K3YG7.mjs.map +0 -1
  316. package/dist/esm/chunk-KJH4KKG6.mjs +0 -2
  317. package/dist/esm/chunk-KJH4KKG6.mjs.map +0 -1
  318. package/dist/esm/chunk-MSMFHPDT.mjs +0 -2
  319. package/dist/esm/chunk-MSMFHPDT.mjs.map +0 -1
  320. package/dist/esm/chunk-ROT6S6BM.mjs +0 -2
  321. package/dist/esm/chunk-ROT6S6BM.mjs.map +0 -1
  322. /package/dist/esm/{chunk-6JYQ5P36.mjs.map → chunk-4AI7KQQ7.mjs.map} +0 -0
  323. /package/dist/esm/{chunk-V6C6NWFU.mjs.map → chunk-6OWBKU7N.mjs.map} +0 -0
  324. /package/dist/esm/{chunk-BPWSOC2Y.mjs.map → chunk-7EER7GWV.mjs.map} +0 -0
  325. /package/dist/esm/{chunk-PLI53ZU6.mjs.map → chunk-AMXZQPUQ.mjs.map} +0 -0
  326. /package/dist/esm/{chunk-UQZTHVWC.mjs.map → chunk-JABP65XD.mjs.map} +0 -0
  327. /package/dist/esm/{chunk-3BMZKCLH.mjs.map → chunk-M3AO73ZL.mjs.map} +0 -0
  328. /package/dist/esm/{chunk-NF73V673.mjs.map → chunk-QP2BY4PK.mjs.map} +0 -0
  329. /package/dist/esm/{chunk-Y7ZQTLH4.mjs.map → chunk-RCSJFTST.mjs.map} +0 -0
  330. /package/dist/esm/{chunk-XYXBAU4J.mjs.map → chunk-SJDCGNWU.mjs.map} +0 -0
  331. /package/dist/esm/{chunk-HZVN4JSO.mjs.map → chunk-WHSTLR3F.mjs.map} +0 -0
@@ -1,2 +0,0 @@
1
- var o="4.0.0";export{o as a};
2
- //# sourceMappingURL=chunk-6SLY7UV2.mjs.map
@@ -1,2 +0,0 @@
1
- import{b as t}from"./chunk-STY74NUA.mjs";var o=n=>typeof n=="string"?t.isValid(n).valid?n:new TextEncoder().encode(n):n;export{o as a};
2
- //# sourceMappingURL=chunk-DPW6ELCQ.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/core/crypto/utils.ts"],"sourcesContent":["import { HexInput } from \"../../types\";\nimport { Hex } from \"../hex\";\n\n/**\n * Helper function to convert a message to sign or to verify to a valid message input\n *\n * @param message a message as a string or Uint8Array\n *\n * @returns a valid HexInput - string or Uint8Array\n * @group Implementation\n * @category Serialization\n */\nexport const convertSigningMessage = (message: HexInput): HexInput => {\n // if message is of type string, verify it is a valid Hex string\n if (typeof message === \"string\") {\n const isValid = Hex.isValid(message);\n // If message is not a valid Hex string, convert it\n if (!isValid.valid) {\n return new TextEncoder().encode(message);\n }\n // If message is a valid Hex string, return it\n return message;\n }\n // message is a Uint8Array\n return message;\n};\n"],"mappings":"yCAYO,IAAMA,EAAyBC,GAEhC,OAAOA,GAAY,SACLC,EAAI,QAAQD,CAAO,EAEtB,MAINA,EAHE,IAAI,YAAY,EAAE,OAAOA,CAAO,EAMpCA","names":["convertSigningMessage","message","Hex"]}
@@ -1,2 +0,0 @@
1
- var u=(e=>(e.JSON="application/json",e.BCS="application/x-bcs",e.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",e.BCS_VIEW_FUNCTION="application/x.aptos.view_function+bcs",e))(u||{}),y=(n=>(n[n.Bool=0]="Bool",n[n.U8=1]="U8",n[n.U64=2]="U64",n[n.U128=3]="U128",n[n.Address=4]="Address",n[n.Signer=5]="Signer",n[n.Vector=6]="Vector",n[n.Struct=7]="Struct",n[n.U16=8]="U16",n[n.U32=9]="U32",n[n.U256=10]="U256",n[n.Reference=254]="Reference",n[n.Generic=255]="Generic",n))(y||{}),d=(s=>(s[s.U8=0]="U8",s[s.U64=1]="U64",s[s.U128=2]="U128",s[s.Address=3]="Address",s[s.U8Vector=4]="U8Vector",s[s.Bool=5]="Bool",s[s.U16=6]="U16",s[s.U32=7]="U32",s[s.U256=8]="U256",s[s.Serialized=9]="Serialized",s))(d||{}),c=(e=>(e[e.Script=0]="Script",e[e.EntryFunction=2]="EntryFunction",e[e.Multisig=3]="Multisig",e[e.Payload=4]="Payload",e))(c||{}),l=(o=>(o[o.V1=0]="V1",o))(l||{}),_=(i=>(i[i.Script=0]="Script",i[i.EntryFunction=1]="EntryFunction",i[i.Empty=2]="Empty",i))(_||{}),x=(o=>(o[o.V1=0]="V1",o))(x||{}),h=(p=>(p[p.MultiAgentTransaction=0]="MultiAgentTransaction",p[p.FeePayerTransaction=1]="FeePayerTransaction",p))(h||{}),m=(r=>(r[r.Ed25519=0]="Ed25519",r[r.MultiEd25519=1]="MultiEd25519",r[r.MultiAgent=2]="MultiAgent",r[r.FeePayer=3]="FeePayer",r[r.SingleSender=4]="SingleSender",r))(m||{}),v=(a=>(a[a.Ed25519=0]="Ed25519",a[a.MultiEd25519=1]="MultiEd25519",a[a.SingleKey=2]="SingleKey",a[a.MultiKey=3]="MultiKey",a[a.NoAccountAuthenticator=4]="NoAccountAuthenticator",a[a.Abstraction=5]="Abstraction",a))(v||{}),S=(p=>(p.Ed25519="ed25519",p.Secp256k1="secp256k1",p))(S||{}),R=(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e[e.Keyless=3]="Keyless",e[e.FederatedKeyless=4]="FederatedKeyless",e))(R||{});function B(t){switch(t){case 0:return"ed25519";case 1:return"secp256k1";case 3:return"keyless";case 4:return"federated_keyless";default:throw new Error("Unknown public key variant")}}var b=(i=>(i[i.Ed25519=0]="Ed25519",i[i.Secp256k1=1]="Secp256k1",i[i.Keyless=3]="Keyless",i))(b||{}),M=(o=>(o[o.Ed25519=0]="Ed25519",o))(M||{}),k=(o=>(o[o.Ed25519=0]="Ed25519",o))(k||{}),f=(o=>(o[o.ZkProof=0]="ZkProof",o))(f||{}),C=(o=>(o[o.Groth16=0]="Groth16",o))(C||{}),T=(g=>(g.Pending="pending_transaction",g.User="user_transaction",g.Genesis="genesis_transaction",g.BlockMetadata="block_metadata_transaction",g.StateCheckpoint="state_checkpoint_transaction",g.Validator="validator_transaction",g.BlockEpilogue="block_epilogue_transaction",g))(T||{});function G(t){return t.type==="pending_transaction"}function O(t){return t.type==="user_transaction"}function P(t){return t.type==="genesis_transaction"}function N(t){return t.type==="block_metadata_transaction"}function D(t){return t.type==="state_checkpoint_transaction"}function q(t){return t.type==="validator_transaction"}function w(t){return t.type==="block_epilogue_transaction"}function H(t){return"signature"in t&&t.type==="ed25519_signature"}function K(t){return"signature"in t&&t.signature==="secp256k1_ecdsa_signature"}function j(t){return t.type==="multi_agent_signature"}function L(t){return t.type==="fee_payer_signature"}function $(t){return t.type==="multi_ed25519_signature"}function z(t){return t.type==="single_sender"}var E=(i=>(i.PRIVATE="private",i.PUBLIC="public",i.FRIEND="friend",i))(E||{}),U=(e=>(e.STORE="store",e.DROP="drop",e.KEY="key",e.COPY="copy",e))(U||{}),I=(p=>(p.VALIDATOR="validator",p.FULL_NODE="full_node",p))(I||{}),W=(e=>(e[e.Ed25519=0]="Ed25519",e[e.MultiEd25519=1]="MultiEd25519",e[e.SingleKey=2]="SingleKey",e[e.MultiKey=3]="MultiKey",e))(W||{}),F=(p=>(p[p.Ed25519=0]="Ed25519",p[p.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",p))(F||{}),A=(r=>(r[r.DeriveAuid=251]="DeriveAuid",r[r.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",r[r.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",r[r.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",r[r.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",r))(A||{});export{u as a,y as b,d as c,c as d,l as e,_ as f,x as g,h,m as i,v as j,S as k,R as l,B as m,b as n,M as o,k as p,f as q,C as r,T as s,G as t,O as u,P as v,N as w,D as x,q as y,w as z,H as A,K as B,j as C,L as D,$ as E,z as F,E as G,U as H,I,W as J,F as K,A as L};
2
- //# sourceMappingURL=chunk-IJE2LVZG.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/types/types.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { AptosConfig } from \"../api\";\nimport { InputSubmitTransactionData } from \"../transactions\";\nimport { Network } from \"../utils/apiEndpoints\";\nimport { OrderBy, TokenStandard } from \"./indexer\";\n\n/**\n * Different MIME types used for data interchange in transactions and responses.\n */\nexport enum MimeType {\n /**\n * JSON representation, used for transaction submission and accept type JSON output\n */\n JSON = \"application/json\",\n /**\n * BCS representation, used for accept type BCS output\n */\n BCS = \"application/x-bcs\",\n /**\n * BCS representation, used for transaction submission in BCS input\n */\n BCS_SIGNED_TRANSACTION = \"application/x.aptos.signed_transaction+bcs\",\n BCS_VIEW_FUNCTION = \"application/x.aptos.view_function+bcs\",\n}\n\n/**\n * Hexadecimal data input for functions, supporting both string and Uint8Array formats.\n */\nexport type HexInput = string | Uint8Array;\n\n/**\n * Variants of type tags used in the system, encompassing various data types and structures.\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-core/types/src/language_storage.rs#L27}\n */\nexport enum TypeTagVariants {\n Bool = 0,\n U8 = 1,\n U64 = 2,\n U128 = 3,\n Address = 4,\n Signer = 5,\n Vector = 6,\n Struct = 7,\n U16 = 8,\n U32 = 9,\n U256 = 10,\n Reference = 254, // This is specifically a placeholder and does not represent a real type\n Generic = 255, // This is specifically a placeholder and does not represent a real type\n}\n\n/**\n * Variants of script transaction arguments used in Rust, encompassing various data types for transaction processing.\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-core/types/src/transaction_argument.rs#L11}\n */\nexport enum ScriptTransactionArgumentVariants {\n U8 = 0,\n U64 = 1,\n U128 = 2,\n Address = 3,\n U8Vector = 4,\n Bool = 5,\n U16 = 6,\n U32 = 7,\n U256 = 8,\n Serialized = 9,\n}\n\n/**\n * The payload for various transaction types in the system.\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/mod.rs#L478}\n */\nexport enum TransactionPayloadVariants {\n Script = 0,\n EntryFunction = 2,\n Multisig = 3,\n Payload = 4,\n}\n\n/**\n * The inner payload type to support orderless transactions and all future transaction types.\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/mod.rs#L478}\n */\nexport enum TransactionInnerPayloadVariants {\n V1 = 0,\n}\n\n/**\n * Executable types for transactions, which can be either a script or an entry function.\n *\n * Empty is reserved for Multisig voting transactions, which do not have an executable payload.\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/mod.rs#L685}\n */\nexport enum TransactionExecutableVariants {\n Script = 0,\n EntryFunction = 1,\n Empty = 2,\n}\n\n/**\n * Variants of transaction extra configurations, which can include additional settings or parameters.\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/mod.rs#L737}\n */\nexport enum TransactionExtraConfigVariants {\n V1 = 0,\n}\n\n/**\n * Variants of transactions used in the system.\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/mod.rs#L440}\n */\nexport enum TransactionVariants {\n MultiAgentTransaction = 0,\n FeePayerTransaction = 1,\n}\n\n/**\n * Variants of transaction authenticators used in the system.\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/authenticator.rs#L44}\n */\nexport enum TransactionAuthenticatorVariant {\n Ed25519 = 0,\n MultiEd25519 = 1,\n MultiAgent = 2,\n FeePayer = 3,\n SingleSender = 4,\n}\n\n/**\n * Variants of account authenticators used in transactions.\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/authenticator.rs#L414}\n */\nexport enum AccountAuthenticatorVariant {\n Ed25519 = 0,\n MultiEd25519 = 1,\n SingleKey = 2,\n MultiKey = 3,\n NoAccountAuthenticator = 4,\n Abstraction = 5,\n}\n\n/**\n * Variants of private keys that can comply with the AIP-80 standard.\n * {@link https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md}\n */\nexport enum PrivateKeyVariants {\n Ed25519 = \"ed25519\",\n Secp256k1 = \"secp256k1\",\n}\n\n/**\n * Variants of public keys used in cryptographic operations.\n */\nexport enum AnyPublicKeyVariant {\n Ed25519 = 0,\n Secp256k1 = 1,\n Keyless = 3,\n FederatedKeyless = 4,\n}\n\nexport function anyPublicKeyVariantToString(variant: AnyPublicKeyVariant): string {\n switch (variant) {\n case AnyPublicKeyVariant.Ed25519:\n return \"ed25519\";\n case AnyPublicKeyVariant.Secp256k1:\n return \"secp256k1\";\n case AnyPublicKeyVariant.Keyless:\n return \"keyless\";\n case AnyPublicKeyVariant.FederatedKeyless:\n return \"federated_keyless\";\n default:\n throw new Error(\"Unknown public key variant\");\n }\n}\n\n/**\n * Variants of signature types used for cryptographic operations.\n */\nexport enum AnySignatureVariant {\n Ed25519 = 0,\n Secp256k1 = 1,\n Keyless = 3,\n}\n\n/**\n * Variants of ephemeral public keys used in cryptographic operations.\n */\nexport enum EphemeralPublicKeyVariant {\n Ed25519 = 0,\n}\n\n/**\n * Variants of ephemeral signatures used for secure communication.\n */\nexport enum EphemeralSignatureVariant {\n Ed25519 = 0,\n}\n\n/**\n * Variants of ephemeral certificates used in secure transactions.\n */\nexport enum EphemeralCertificateVariant {\n ZkProof = 0,\n}\n\n/**\n * Variants of zero-knowledge proofs used in cryptographic operations.\n */\nexport enum ZkpVariant {\n Groth16 = 0,\n}\n\n/**\n * BCS types\n */\nexport type Uint8 = number;\n\n/**\n * A 16-bit unsigned integer.\n */\nexport type Uint16 = number;\n\n/**\n * A 32-bit unsigned integer.\n */\nexport type Uint32 = number;\n\n/**\n * A 64-bit unsigned integer value.\n */\nexport type Uint64 = bigint;\n\n/**\n * A 128-bit unsigned integer used for precise arithmetic operations.\n */\nexport type Uint128 = bigint;\n\n/**\n * A 256-bit unsigned integer used for precise numerical calculations.\n */\nexport type Uint256 = bigint;\n\n/**\n * A number or a bigint value.\n */\nexport type AnyNumber = number | bigint;\n\n/**\n * Configuration options for initializing the SDK, allowing customization of its behavior and interaction with the Aptos network.\n */\nexport type AptosSettings = {\n readonly network?: Network;\n\n readonly fullnode?: string;\n\n readonly faucet?: string;\n\n readonly indexer?: string;\n\n readonly pepper?: string;\n\n readonly prover?: string;\n\n readonly clientConfig?: ClientConfig;\n\n readonly client?: Client;\n\n readonly fullnodeConfig?: FullNodeConfig;\n\n readonly indexerConfig?: IndexerConfig;\n\n readonly faucetConfig?: FaucetConfig;\n\n readonly transactionGenerationConfig?: TransactionGenerationConfig;\n\n readonly pluginSettings?: PluginSettings;\n};\n\n/**\n * Defines the parameters for paginating query results, including the starting position and maximum number of items to return.\n * @param offset Specifies the starting position of the query result. Default is 0.\n * @param limit Specifies the maximum number of items to return. Default is 25.\n */\nexport interface PaginationArgs {\n offset?: AnyNumber;\n limit?: number;\n}\n\n/**\n * Defines the parameters for paginating query results, including the starting position and maximum number of items to return.\n * @param cursor Specifies the starting position of the query result. Default is at the beginning if undefined. This is not a number and must come from the API.\n * @param limit Specifies the maximum number of items to return. Default is 25.\n */\nexport interface CursorPaginationArgs {\n cursor?: string;\n limit?: number;\n}\n\n/**\n * Represents the arguments for specifying a token standard.\n *\n * @param tokenStandard - Optional standard of the token.\n */\nexport interface TokenStandardArg {\n tokenStandard?: TokenStandard;\n}\n\nexport interface OrderByArg<T extends {}> {\n orderBy?: OrderBy<T>;\n}\n\nexport interface WhereArg<T extends {}> {\n where?: T;\n}\n\n/**\n * QUERY TYPES\n */\n\n/**\n * A configuration object for requests to the server, including API key, extra headers, and cookie handling options.\n */\nexport type ClientConfig = ClientHeadersType & {\n WITH_CREDENTIALS?: boolean;\n API_KEY?: string;\n};\n\n/**\n * A configuration object for a Fullnode, allowing for the inclusion of extra headers in requests.\n */\nexport type FullNodeConfig = ClientHeadersType;\n\n/**\n * An Indexer configuration object for sending requests with additional headers.\n */\nexport type IndexerConfig = ClientHeadersType;\n\n/**\n * A configuration object for a faucet, including optional authentication and headers for requests.\n */\nexport type FaucetConfig = ClientHeadersType & {\n AUTH_TOKEN?: string;\n};\n\n/**\n * A configuration object for default parameters for transaction generation.\n */\nexport type TransactionGenerationConfig = {\n defaultMaxGasAmount?: number;\n defaultTxnExpirySecFromNow?: number;\n};\n\n/**\n * General type definition for client headers.\n */\nexport type ClientHeadersType = {\n HEADERS?: Record<string, string | number | boolean>;\n};\n\n/**\n * Config for plugins. This can be used to override certain client behavior.\n */\nexport type PluginConfig = {\n /**\n * If given, this will be used for submitting transactions instead of the default\n * implementation (which submits transactions directly via a node).\n */\n TRANSACTION_SUBMITTER?: TransactionSubmitter;\n\n /**\n * If true, we won't use the TRANSACTION_SUBMITTER if set.\n */\n IGNORE_TRANSACTION_SUBMITTER?: boolean;\n};\n\nexport type PluginSettings = Omit<PluginConfig, \"IGNORE_TRANSACTION_SUBMITTER\">;\n\n/**\n * You can implement this interface and set it in {@link PluginSettings} when building a\n * client to override the default transaction submission behavior. This is useful if\n * you'd like to submit transactions via a gas station for example.\n *\n * @example\n * ```typescript\n * class MyGasStationClient implements TransactionSubmitter {\n * async submitTransaction(\n * args: { aptosConfig: AptosConfig } & InputSubmitTransactionData,\n * ): Promise<PendingTransactionResponse> {\n * // TODO: Implement the logic to submit the transaction to the gas station\n * }\n * }\n *\n * const network = Network.MAINNET;\n * const myGasStationClient = new MyGasStationClient(network);\n * const config = new AptosConfig({\n * network,\n * pluginConfig: {\n * transactionSubmitter: myGasStationClient,\n * },\n * });\n * const aptos = new Aptos(config);\n * ```\n */\nexport interface TransactionSubmitter {\n /**\n * Submit a transaction to the Aptos blockchain or something that will do it on your\n * behalf, for example a gas station. See the comments of {@link TransactionSubmitter} for more.\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 * @param args.pluginParams - Optional. Additional parameters for the plugin.\n * @param args.transactionSubmitter - Optional. An override for the transaction submitter.\n *\n * @returns PendingTransactionResponse - The response containing the status of the submitted transaction.\n * @group Implementation\n */\n submitTransaction(\n args: {\n aptosConfig: AptosConfig;\n } & Omit<InputSubmitTransactionData, \"transactionSubmitter\">,\n ): Promise<PendingTransactionResponse>;\n}\n\n/**\n * Represents a client for making requests to a service provider.\n *\n * @param Req - The type of the request payload.\n * @param Res - The type of the response payload.\n */\nexport interface ClientRequest<Req> {\n url: string;\n method: \"GET\" | \"POST\";\n originMethod?: string;\n body?: Req;\n contentType?: string;\n params?: any;\n overrides?: ClientConfig & FullNodeConfig & IndexerConfig & FaucetConfig;\n headers?: Record<string, any>;\n}\n\nexport interface ClientResponse<Res> {\n status: number;\n statusText: string;\n data: Res;\n config?: any;\n request?: any;\n response?: any;\n headers?: any;\n}\n\nexport interface Client {\n /**\n * Sends a request to the specified URL with the given options.\n *\n * @param requestOptions - The options for the request.\n * @param requestOptions.url - The URL to send the request to.\n * @param requestOptions.method - The HTTP method to use, either \"GET\" or \"POST\".\n * @param requestOptions.path - An optional path to append to the URL.\n * @param requestOptions.body - The body of the request, applicable for POST requests.\n * @param requestOptions.contentType - The content type of the request body.\n * @param requestOptions.acceptType - The expected content type of the response.\n * @param requestOptions.params - Optional parameters to include in the request.\n * @param requestOptions.originMethod - An optional method to specify the origin of the request.\n * @param requestOptions.overrides - Optional configuration overrides for the request.\n */\n provider<Req, Res>(requestOptions: ClientRequest<Req>): Promise<ClientResponse<Res>>;\n}\n\n/**\n * The API request type\n *\n * @param url - the url to make the request to, i.e. https://fullnode.devnet.aptoslabs.com/v1\n * @param method - the request method \"GET\" | \"POST\"\n * @param endpoint (optional) - the endpoint to make the request to, i.e. transactions\n * @param body (optional) - the body of the request\n * @param contentType (optional) - the content type to set the `content-type` header to,\n * by default is set to `application/json`\n * @param params (optional) - query params to add to the request\n * @param originMethod (optional) - the local method the request came from\n * @param overrides (optional) - a `ClientConfig` object type to override request data\n */\nexport type AptosRequest = {\n url: string;\n method: \"GET\" | \"POST\";\n path?: string;\n body?: any;\n contentType?: string;\n acceptType?: string;\n params?: Record<string, string | AnyNumber | boolean | undefined>;\n originMethod?: string;\n overrides?: ClientConfig & FullNodeConfig & IndexerConfig & FaucetConfig;\n};\n\n/**\n * The API response type\n *\n * @param status - the response status. i.e. 200\n * @param statusText - the response message\n * @param data the response data\n * @param url the url the request was made to\n * @param headers the response headers\n * @param config (optional) - the request object\n * @param request (optional) - the request object\n */\nexport interface AptosResponse<Req, Res> {\n status: number;\n statusText: string;\n data: Res;\n url: string;\n headers: any;\n config?: any;\n request?: Req;\n}\n\n/**\n * The ledger version of transactions, defaulting to the latest version if not specified.\n */\nexport type LedgerVersionArg = {\n ledgerVersion?: AnyNumber;\n};\n\n/**\n * RESPONSE TYPES\n */\n\n/**\n * The output of the estimate gas API, including the deprioritized estimate for the gas unit price.\n */\nexport type GasEstimation = {\n /**\n * The deprioritized estimate for the gas unit price\n */\n deprioritized_gas_estimate?: number;\n /**\n * The current estimate for the gas unit price\n */\n gas_estimate: number;\n /**\n * The prioritized estimate for the gas unit price\n */\n prioritized_gas_estimate?: number;\n};\n\nexport type MoveResource<T = {}> = {\n type: MoveStructId;\n data: T;\n};\n\n/**\n * The data associated with an account, including its sequence number.\n */\nexport type AccountData = {\n sequence_number: string;\n authentication_key: string;\n};\n\n/**\n * A Move module containing an address.\n */\nexport type MoveModuleBytecode = {\n bytecode: string;\n abi?: MoveModule;\n};\n\n/**\n * TRANSACTION TYPES\n */\n\n/**\n * Different types of transaction responses that can occur in the system.\n */\nexport enum TransactionResponseType {\n Pending = \"pending_transaction\",\n User = \"user_transaction\",\n Genesis = \"genesis_transaction\",\n BlockMetadata = \"block_metadata_transaction\",\n StateCheckpoint = \"state_checkpoint_transaction\",\n Validator = \"validator_transaction\",\n BlockEpilogue = \"block_epilogue_transaction\",\n}\n\n/**\n * The response for a transaction, which can be either pending or committed.\n */\nexport type TransactionResponse = PendingTransactionResponse | CommittedTransactionResponse;\n\n/**\n * The response for a committed transaction, which can be one of several transaction types.\n */\nexport type CommittedTransactionResponse =\n | UserTransactionResponse\n | GenesisTransactionResponse\n | BlockMetadataTransactionResponse\n | StateCheckpointTransactionResponse\n | ValidatorTransactionResponse\n | BlockEpilogueTransactionResponse;\n\n/**\n * Determine if the given transaction response is currently pending.\n *\n * @param response - The transaction response to evaluate.\n * @returns A boolean indicating whether the transaction is pending.\n */\nexport function isPendingTransactionResponse(response: TransactionResponse): response is PendingTransactionResponse {\n return response.type === TransactionResponseType.Pending;\n}\n\n/**\n * Determines if the given transaction response is a user transaction.\n *\n * @param response - The transaction response to evaluate.\n * @returns A boolean indicating whether the transaction is of type User.\n */\nexport function isUserTransactionResponse(response: TransactionResponse): response is UserTransactionResponse {\n return response.type === TransactionResponseType.User;\n}\n\n/**\n * Determines if the given transaction response is a Genesis transaction.\n *\n * @param response - The transaction response to evaluate.\n * @returns A boolean indicating whether the transaction is a Genesis transaction.\n */\nexport function isGenesisTransactionResponse(response: TransactionResponse): response is GenesisTransactionResponse {\n return response.type === TransactionResponseType.Genesis;\n}\n\n/**\n * Determine if the given transaction response is of type BlockMetadata.\n *\n * @param response - The transaction response to evaluate.\n * @returns A boolean indicating whether the response is a BlockMetadata transaction.\n */\nexport function isBlockMetadataTransactionResponse(\n response: TransactionResponse,\n): response is BlockMetadataTransactionResponse {\n return response.type === TransactionResponseType.BlockMetadata;\n}\n\n/**\n * Determines if the provided transaction response is a state checkpoint transaction.\n *\n * @param response - The transaction response to evaluate.\n * @returns A boolean indicating whether the transaction response is of type StateCheckpoint.\n */\nexport function isStateCheckpointTransactionResponse(\n response: TransactionResponse,\n): response is StateCheckpointTransactionResponse {\n return response.type === TransactionResponseType.StateCheckpoint;\n}\n\n/**\n * Determine if the given transaction response is of type Validator.\n *\n * @param response - The transaction response to evaluate.\n * @returns A boolean indicating whether the transaction response is a Validator type.\n */\nexport function isValidatorTransactionResponse(\n response: TransactionResponse,\n): response is ValidatorTransactionResponse {\n return response.type === TransactionResponseType.Validator;\n}\n\n/**\n * Determines if the given transaction response is of the type Block Epilogue.\n *\n * @param response - The transaction response to evaluate.\n * @returns A boolean indicating whether the response is a Block Epilogue transaction.\n */\nexport function isBlockEpilogueTransactionResponse(\n response: TransactionResponse,\n): response is BlockEpilogueTransactionResponse {\n return response.type === TransactionResponseType.BlockEpilogue;\n}\n\n/**\n * The response for a pending transaction, indicating that the transaction is still being processed.\n */\nexport type PendingTransactionResponse = {\n type: TransactionResponseType.Pending;\n hash: string;\n sender: string;\n sequence_number: string;\n max_gas_amount: string;\n gas_unit_price: string;\n expiration_timestamp_secs: string;\n payload: TransactionPayloadResponse;\n signature?: TransactionSignature;\n};\n\n/**\n * The response structure for a user transaction.\n */\nexport type UserTransactionResponse = {\n type: TransactionResponseType.User;\n version: string;\n hash: string;\n state_change_hash: string;\n event_root_hash: string;\n state_checkpoint_hash: string | null;\n gas_used: string;\n /**\n * Whether the transaction was successful\n */\n success: boolean;\n /**\n * The VM status of the transaction, can tell useful information in a failure\n */\n vm_status: string;\n accumulator_root_hash: string;\n /**\n * Final state of resources changed by the transaction\n */\n changes: Array<WriteSetChange>;\n sender: string;\n sequence_number: string;\n replay_protection_nonce: string;\n max_gas_amount: string;\n gas_unit_price: string;\n expiration_timestamp_secs: string;\n payload: TransactionPayloadResponse;\n signature?: TransactionSignature;\n /**\n * Events generated by the transaction\n */\n events: Array<Event>;\n timestamp: string;\n};\n\n/**\n * The response for a genesis transaction, indicating the type of transaction.\n */\nexport type GenesisTransactionResponse = {\n type: TransactionResponseType.Genesis;\n version: string;\n hash: string;\n state_change_hash: string;\n event_root_hash: string;\n state_checkpoint_hash?: string;\n gas_used: string;\n /**\n * Whether the transaction was successful\n */\n success: boolean;\n /**\n * The VM status of the transaction, can tell useful information in a failure\n */\n vm_status: string;\n accumulator_root_hash: string;\n /**\n * Final state of resources changed by the transaction\n */\n changes: Array<WriteSetChange>;\n payload: GenesisPayload;\n /**\n * Events emitted during genesis\n */\n events: Array<Event>;\n};\n\n/**\n * The structure representing a blockchain block with its height.\n */\nexport type BlockMetadataTransactionResponse = {\n type: TransactionResponseType.BlockMetadata;\n version: string;\n hash: string;\n state_change_hash: string;\n event_root_hash: string;\n state_checkpoint_hash: string | null;\n gas_used: string;\n /**\n * Whether the transaction was successful\n */\n success: boolean;\n /**\n * The VM status of the transaction, can tell useful information in a failure\n */\n vm_status: string;\n accumulator_root_hash: string;\n /**\n * Final state of resources changed by the transaction\n */\n changes: Array<WriteSetChange>;\n id: string;\n epoch: string;\n round: string;\n /**\n * The events emitted at the block creation\n */\n events: Array<Event>;\n /**\n * Previous block votes\n */\n previous_block_votes_bitvec: Array<number>;\n proposer: string;\n /**\n * The indices of the proposers who failed to propose\n */\n failed_proposer_indices: Array<number>;\n timestamp: string;\n};\n\n/**\n * The response for a state checkpoint transaction, indicating the type of transaction.\n */\nexport type StateCheckpointTransactionResponse = {\n type: TransactionResponseType.StateCheckpoint;\n version: string;\n hash: string;\n state_change_hash: string;\n event_root_hash: string;\n state_checkpoint_hash: string | null;\n gas_used: string;\n /**\n * Whether the transaction was successful\n */\n success: boolean;\n /**\n * The VM status of the transaction, can tell useful information in a failure\n */\n vm_status: string;\n accumulator_root_hash: string;\n /**\n * Final state of resources changed by the transaction\n */\n changes: Array<WriteSetChange>;\n timestamp: string;\n};\n\n/**\n * The response for a validator transaction, indicating the type of transaction.\n */\nexport type ValidatorTransactionResponse = {\n type: TransactionResponseType.Validator;\n version: string;\n hash: string;\n state_change_hash: string;\n event_root_hash: string;\n state_checkpoint_hash: string | null;\n gas_used: string;\n /**\n * Whether the transaction was successful\n */\n success: boolean;\n /**\n * The VM status of the transaction, can tell useful information in a failure\n */\n vm_status: string;\n accumulator_root_hash: string;\n /**\n * Final state of resources changed by the transaction\n */\n changes: Array<WriteSetChange>;\n /**\n * The events emitted by the validator transaction\n */\n events: Array<Event>;\n timestamp: string;\n};\n\n/**\n * Describes the gas state of the block, indicating whether the block gas limit has been reached.\n */\nexport type BlockEndInfo = {\n block_gas_limit_reached: boolean;\n block_output_limit_reached: boolean;\n block_effective_block_gas_units: number;\n block_approx_output_size: number;\n};\n\n/**\n * A transaction executed at the end of a block that tracks data from the entire block.\n */\nexport type BlockEpilogueTransactionResponse = {\n type: TransactionResponseType.BlockEpilogue;\n version: string;\n hash: string;\n state_change_hash: string;\n event_root_hash: string;\n state_checkpoint_hash: string | null;\n gas_used: string;\n /**\n * Whether the transaction was successful\n */\n success: boolean;\n /**\n * The VM status of the transaction, can tell useful information in a failure\n */\n vm_status: string;\n accumulator_root_hash: string;\n /**\n * Final state of resources changed by the transaction\n */\n changes: Array<WriteSetChange>;\n timestamp: string;\n block_end_info: BlockEndInfo | null;\n};\n\n/**\n * WRITESET CHANGE TYPES\n */\n\n/**\n * A union type that encompasses both script and direct write sets for data operations.\n */\nexport type WriteSetChange =\n | WriteSetChangeDeleteModule\n | WriteSetChangeDeleteResource\n | WriteSetChangeDeleteTableItem\n | WriteSetChangeWriteModule\n | WriteSetChangeWriteResource\n | WriteSetChangeWriteTableItem;\n\n/**\n * The structure for a module deletion change in a write set.\n */\nexport type WriteSetChangeDeleteModule = {\n type: string;\n address: string;\n /**\n * State key hash\n */\n state_key_hash: string;\n module: MoveModuleId;\n};\n\n/**\n * The payload for a resource deletion in a write set change.\n */\nexport type WriteSetChangeDeleteResource = {\n type: string;\n address: string;\n state_key_hash: string;\n resource: string;\n};\n\n/**\n * The payload for a write set change that deletes a table item.\n */\nexport type WriteSetChangeDeleteTableItem = {\n type: string;\n state_key_hash: string;\n handle: string;\n key: string;\n data?: DeletedTableData;\n};\n\n/**\n * The structure for a write module change in a write set.\n */\nexport type WriteSetChangeWriteModule = {\n type: string;\n address: string;\n state_key_hash: string;\n data: MoveModuleBytecode;\n};\n\n/**\n * The resource associated with a write set change, identified by its type.\n */\nexport type WriteSetChangeWriteResource = {\n type: string;\n address: string;\n state_key_hash: string;\n data: MoveResource;\n};\n\n/**\n * The structure for a write operation on a table in a write set change.\n */\nexport type WriteSetChangeWriteTableItem = {\n type: string;\n state_key_hash: string;\n handle: string;\n key: string;\n value: string;\n data?: DecodedTableData;\n};\n\n/**\n * The decoded data for a table, including its key in JSON format.\n */\nexport type DecodedTableData = {\n /**\n * Key of table in JSON\n */\n key: any;\n /**\n * Type of key\n */\n key_type: string;\n /**\n * Value of table in JSON\n */\n value: any;\n /**\n * Type of value\n */\n value_type: string;\n};\n\n/**\n * Data for a deleted table entry.\n */\nexport type DeletedTableData = {\n /**\n * Deleted key\n */\n key: any;\n /**\n * Deleted key type\n */\n key_type: string;\n};\n\n/**\n * The payload for a transaction response, which can be an entry function, script, or multisig payload.\n */\nexport type TransactionPayloadResponse = EntryFunctionPayloadResponse | ScriptPayloadResponse | MultisigPayloadResponse;\n\n/**\n * The response payload for an entry function, containing the type of the entry.\n */\nexport type EntryFunctionPayloadResponse = {\n type: string;\n function: MoveFunctionId;\n /**\n * Type arguments of the function\n */\n type_arguments: Array<string>;\n /**\n * Arguments of the function\n */\n arguments: Array<any>;\n};\n\n/**\n * The payload for a script response, containing the type of the script.\n */\nexport type ScriptPayloadResponse = {\n type: string;\n code: MoveScriptBytecode;\n /**\n * Type arguments of the function\n */\n type_arguments: Array<string>;\n /**\n * Arguments of the function\n */\n arguments: Array<any>;\n};\n\n/**\n * The response payload for a multisig transaction, containing the type of the transaction.\n */\nexport type MultisigPayloadResponse = {\n type: string;\n multisig_address: string;\n transaction_payload?: EntryFunctionPayloadResponse;\n};\n\n/**\n * The payload for the genesis block containing the type of the payload.\n */\nexport type GenesisPayload = {\n type: string;\n write_set: WriteSet;\n};\n\n/**\n * The bytecode for a Move script.\n */\nexport type MoveScriptBytecode = {\n bytecode: string;\n abi?: MoveFunction;\n};\n\n/**\n * JSON representations of transaction signatures returned from the node API.\n */\nexport type TransactionSignature =\n | TransactionEd25519Signature\n | TransactionSecp256k1Signature\n | TransactionMultiEd25519Signature\n | TransactionMultiAgentSignature\n | TransactionFeePayerSignature\n | TransactionSingleSenderSignature;\n\n/**\n * Determine if the provided signature is an Ed25519 signature.\n * This function checks for the presence of the \"signature\" property\n * and verifies that its value is \"ed25519_signature\".\n *\n * @param signature - The transaction signature to be checked.\n * @returns A boolean indicating whether the signature is an Ed25519 signature.\n */\nexport function isEd25519Signature(signature: TransactionSignature): signature is TransactionEd25519Signature {\n return \"signature\" in signature && signature.type === \"ed25519_signature\";\n}\n\n/**\n * Determine if the provided signature is a valid secp256k1 ECDSA signature.\n *\n * @param signature - The transaction signature to validate.\n * @returns A boolean indicating whether the signature is a secp256k1 ECDSA signature.\n */\nexport function isSecp256k1Signature(signature: TransactionSignature): signature is TransactionFeePayerSignature {\n return \"signature\" in signature && signature.signature === \"secp256k1_ecdsa_signature\";\n}\n\n/**\n * Determine if the provided transaction signature is a multi-agent signature.\n *\n * @param signature - The transaction signature to evaluate.\n * @returns A boolean indicating whether the signature is a multi-agent signature.\n */\nexport function isMultiAgentSignature(signature: TransactionSignature): signature is TransactionMultiAgentSignature {\n return signature.type === \"multi_agent_signature\";\n}\n\n/**\n * Determine if the provided signature is a fee payer signature.\n *\n * @param signature - The transaction signature to evaluate.\n * @returns A boolean indicating whether the signature is a fee payer signature.\n */\nexport function isFeePayerSignature(signature: TransactionSignature): signature is TransactionFeePayerSignature {\n return signature.type === \"fee_payer_signature\";\n}\n\n/**\n * Determine if the provided signature is of type \"multi_ed25519_signature\".\n *\n * @param signature - The transaction signature to check.\n * @returns A boolean indicating whether the signature is a multi-ed25519 signature.\n */\nexport function isMultiEd25519Signature(\n signature: TransactionSignature,\n): signature is TransactionMultiEd25519Signature {\n return signature.type === \"multi_ed25519_signature\";\n}\n\n/**\n * Determine if the provided signature is of type \"single_sender\".\n *\n * @param signature - The transaction signature to check.\n * @returns A boolean indicating whether the signature is a single-sender signature.\n */\nexport function isSingleSenderSignature(\n signature: TransactionSignature,\n): signature is TransactionSingleSenderSignature {\n return signature.type === \"single_sender\";\n}\n\n/**\n * The signature for a transaction using the Ed25519 algorithm.\n */\nexport type TransactionEd25519Signature = {\n type: string;\n public_key: string;\n signature: \"ed25519_signature\";\n};\n\n/**\n * The structure for a Secp256k1 signature in a transaction.\n */\nexport type TransactionSecp256k1Signature = {\n type: string;\n public_key: string;\n signature: \"secp256k1_ecdsa_signature\";\n};\n\n/**\n * The structure for a multi-signature transaction using Ed25519.\n */\nexport type TransactionSingleSenderSignature = {\n type: \"single_sender\";\n public_key: { value: string; type: string };\n signature: { value: string; type: string };\n};\n\n/**\n * The structure for a multi-signature transaction using Ed25519.\n */\nexport type TransactionMultiEd25519Signature = {\n type: \"multi_ed25519_signature\";\n /**\n * The public keys for the Ed25519 signature\n */\n public_keys: Array<string>;\n /**\n * Signature associated with the public keys in the same order\n */\n signatures: Array<string>;\n /**\n * The number of signatures required for a successful transaction\n */\n threshold: number;\n bitmap: string;\n};\n\n/**\n * The structure for a multi-agent signature in a transaction.\n */\nexport type TransactionMultiAgentSignature = {\n type: \"multi_agent_signature\";\n sender: AccountSignature;\n /**\n * The other involved parties' addresses\n */\n secondary_signer_addresses: Array<string>;\n /**\n * The associated signatures, in the same order as the secondary addresses\n */\n secondary_signers: Array<AccountSignature>;\n};\n\n/**\n * The signature of the fee payer in a transaction.\n */\nexport type TransactionFeePayerSignature = {\n type: \"fee_payer_signature\";\n sender: AccountSignature;\n /**\n * The other involved parties' addresses\n */\n secondary_signer_addresses: Array<string>;\n /**\n * The associated signatures, in the same order as the secondary addresses\n */\n secondary_signers: Array<AccountSignature>;\n fee_payer_address: string;\n fee_payer_signer: AccountSignature;\n};\n\n/**\n * The union of all single account signatures, including Ed25519, Secp256k1, and MultiEd25519 signatures.\n */\nexport type AccountSignature =\n | TransactionEd25519Signature\n | TransactionSecp256k1Signature\n | TransactionMultiEd25519Signature;\n\nexport type WriteSet = ScriptWriteSet | DirectWriteSet;\n\n/**\n * The set of properties for writing scripts, including the type of script.\n */\nexport type ScriptWriteSet = {\n type: string;\n execute_as: string;\n script: ScriptPayloadResponse;\n};\n\n/**\n * The set of direct write operations, identified by a type string.\n */\nexport type DirectWriteSet = {\n type: string;\n changes: Array<WriteSetChange>;\n events: Array<Event>;\n};\n\n/**\n * The structure for an event's unique identifier, including its creation number.\n */\n\n/**\n * The structure for an event, identified by a unique GUID.\n */\nexport type EventGuid = {\n creation_number: string;\n account_address: string;\n};\n\nexport type Event = {\n guid: EventGuid;\n sequence_number: string;\n type: string;\n /**\n * The JSON representation of the event\n */\n data: any;\n};\n\n/**\n * A number representing a Move uint8 type.\n */\nexport type MoveUint8Type = number;\n\n/**\n * A 16-bit unsigned integer used in the Move programming language.\n */\nexport type MoveUint16Type = number;\n\n/**\n * A 32-bit unsigned integer type used in Move programming.\n */\nexport type MoveUint32Type = number;\n\n/**\n * A string representation of a 64-bit unsigned integer used in Move programming.\n */\nexport type MoveUint64Type = string;\n\n/**\n * A string representing a 128-bit unsigned integer in the Move programming language.\n */\nexport type MoveUint128Type = string;\n\n/**\n * A string representation of a 256-bit unsigned integer used in Move programming.\n */\nexport type MoveUint256Type = string;\n\n/**\n * A string representing a Move address.\n */\nexport type MoveAddressType = string;\n\n/**\n * The type for identifying objects to be moved within the system.\n */\nexport type MoveObjectType = string;\n\n/**\n * The type for move options, which can be a MoveType, null, or undefined.\n */\nexport type MoveOptionType = MoveType | null | undefined;\n\n/**\n * A structure representing a move with a name.\n */\nexport type MoveStructId = `${string}::${string}::${string}`;\n\n/**\n * The move function containing its name. Same as MoveStructId since it reads weird to take a StructId for a Function.\n */\nexport type MoveFunctionId = MoveStructId;\n\n// TODO: Add support for looking up ABI to add proper typing\nexport type MoveStructType = {};\n\n/**\n * A union type that encompasses various data types used in Move, including primitive types, address types, object types, and\n * arrays of MoveType.\n */\nexport type MoveType =\n | boolean\n | string\n | MoveUint8Type\n | MoveUint16Type\n | MoveUint32Type\n | MoveUint64Type\n | MoveUint128Type\n | MoveUint256Type\n | MoveAddressType\n | MoveObjectType\n | MoveStructType\n | Array<MoveType>;\n\n/**\n * Possible Move values acceptable by move functions (entry, view)\n *\n * Map of a Move value to the corresponding TypeScript value\n *\n * `Bool -> boolean`\n *\n * `u8, u16, u32 -> number`\n *\n * `u64, u128, u256 -> string`\n *\n * `String -> string`\n *\n * `Address -> 0x${string}`\n *\n * `Struct - 0x${string}::${string}::${string}`\n *\n * `Object -> 0x${string}`\n *\n * `Vector -> Array<MoveValue>`\n *\n * `Option -> MoveValue | null | undefined`\n */\nexport type MoveValue =\n | boolean\n | string\n | MoveUint8Type\n | MoveUint16Type\n | MoveUint32Type\n | MoveUint64Type\n | MoveUint128Type\n | MoveUint256Type\n | MoveAddressType\n | MoveObjectType\n | MoveStructId\n | MoveOptionType\n | Array<MoveValue>;\n\n/**\n * A string representation of a Move module, formatted as `module_name::function_name`.\n * Module names are case-sensitive.\n */\nexport type MoveModuleId = `${string}::${string}`;\n\n/**\n * Specifies the visibility levels for move functions, controlling access permissions.\n */\nexport enum MoveFunctionVisibility {\n PRIVATE = \"private\",\n PUBLIC = \"public\",\n FRIEND = \"friend\",\n}\n\n/**\n * Abilities related to moving items within the system.\n */\nexport enum MoveAbility {\n STORE = \"store\",\n DROP = \"drop\",\n KEY = \"key\",\n COPY = \"copy\",\n}\n\n/**\n * Move abilities associated with the generic type parameter of a function.\n */\nexport type MoveFunctionGenericTypeParam = {\n constraints: Array<MoveAbility>;\n};\n\n/**\n * A field in a Move struct, identified by its name.\n */\nexport type MoveStructField = {\n name: string;\n type: string;\n};\n\n/**\n * A Move module\n */\nexport type MoveModule = {\n address: string;\n name: string;\n /**\n * Friends of the module\n */\n friends: Array<MoveModuleId>;\n /**\n * Public functions of the module\n */\n exposed_functions: Array<MoveFunction>;\n /**\n * Structs of the module\n */\n structs: Array<MoveStruct>;\n};\n\n/**\n * A move struct\n */\nexport type MoveStruct = {\n name: string;\n /**\n * Whether the struct is a native struct of Move\n */\n is_native: boolean;\n /**\n * Whether the struct is a module event (aka v2 event). This will be false for v1\n * events because the value is derived from the #[event] attribute on the struct in\n * the Move source code. This attribute is only relevant for v2 events.\n */\n is_event: boolean;\n /**\n * Abilities associated with the struct\n */\n abilities: Array<MoveAbility>;\n /**\n * Generic types associated with the struct\n */\n generic_type_params: Array<MoveFunctionGenericTypeParam>;\n /**\n * Fields associated with the struct\n */\n fields: Array<MoveStructField>;\n};\n\n/**\n * Move function\n */\nexport type MoveFunction = {\n name: string;\n visibility: MoveFunctionVisibility;\n /**\n * Whether the function can be called as an entry function directly in a transaction\n */\n is_entry: boolean;\n /**\n * Whether the function is a view function or not\n */\n is_view: boolean;\n /**\n * Generic type params associated with the Move function\n */\n generic_type_params: Array<MoveFunctionGenericTypeParam>;\n /**\n * Parameters associated with the move function\n */\n params: Array<string>;\n /**\n * Return type of the function\n */\n return: Array<string>;\n};\n\n/**\n * Roles that can be assigned within the system, indicating different levels of access and functionality.\n */\nexport enum RoleType {\n VALIDATOR = \"validator\",\n FULL_NODE = \"full_node\",\n}\n\n/**\n * Information about the current blockchain ledger, including its chain ID.\n */\nexport type LedgerInfo = {\n /**\n * Chain ID of the current chain\n */\n chain_id: number;\n epoch: string;\n ledger_version: string;\n oldest_ledger_version: string;\n ledger_timestamp: string;\n node_role: RoleType;\n oldest_block_height: string;\n block_height: string;\n /**\n * Git hash of the build of the API endpoint. Can be used to determine the exact\n * software version used by the API endpoint.\n */\n git_hash?: string;\n};\n\n/**\n * A Block type\n */\nexport type Block = {\n block_height: string;\n block_hash: string;\n block_timestamp: string;\n first_version: string;\n last_version: string;\n /**\n * The transactions in the block in sequential order\n */\n transactions?: Array<TransactionResponse>;\n};\n\n// REQUEST TYPES\n\n/**\n * The request payload for the GetTableItem API.\n */\nexport type TableItemRequest = {\n key_type: MoveValue;\n value_type: MoveValue;\n /**\n * The value of the table item's key\n */\n key: any;\n};\n\n/**\n * A list of supported Authentication Key schemes in Aptos, consisting of combinations of signing schemes and derive schemes.\n */\nexport type AuthenticationKeyScheme = SigningScheme | DeriveScheme;\n\n/**\n * Different schemes for signing keys used in cryptographic operations.\n */\nexport enum SigningScheme {\n /**\n * For Ed25519PublicKey\n */\n Ed25519 = 0,\n /**\n * For MultiEd25519PublicKey\n */\n MultiEd25519 = 1,\n /**\n * For SingleKey ecdsa\n */\n SingleKey = 2,\n\n MultiKey = 3,\n}\n\n/**\n * Specifies the signing schemes available for cryptographic operations.\n */\nexport enum SigningSchemeInput {\n /**\n * For Ed25519PublicKey\n */\n Ed25519 = 0,\n /**\n * For Secp256k1Ecdsa\n */\n Secp256k1Ecdsa = 2,\n}\n\n/**\n * Specifies the schemes for deriving account addresses from various data sources.\n */\nexport enum DeriveScheme {\n /**\n * Derives an address using an AUID, used for objects\n */\n DeriveAuid = 251,\n /**\n * Derives an address from another object address\n */\n DeriveObjectAddressFromObject = 252,\n /**\n * Derives an address from a GUID, used for objects\n */\n DeriveObjectAddressFromGuid = 253,\n /**\n * Derives an address from seed bytes, used for named objects\n */\n DeriveObjectAddressFromSeed = 254,\n /**\n * Derives an address from seed bytes, used for resource accounts\n */\n DeriveResourceAccountAddress = 255,\n}\n\n/**\n * Options for configuring the behavior of the waitForTransaction() function.\n */\nexport type WaitForTransactionOptions = {\n timeoutSecs?: number;\n checkSuccess?: boolean;\n // Default behavior is to wait for the indexer. Set this to false to disable waiting.\n waitForIndexer?: boolean;\n};\n\n/**\n * Input type to generate an account using the Ed25519 signing scheme.\n */\nexport type GenerateAccountWithEd25519 = {\n scheme: SigningSchemeInput.Ed25519;\n legacy: boolean;\n};\n\n/**\n * Input type to generate an account with a Single Signer using Secp256k1.\n */\nexport type GenerateAccountWithSingleSignerSecp256k1Key = {\n scheme: SigningSchemeInput.Secp256k1Ecdsa;\n legacy?: false;\n};\n\nexport type GenerateAccount = GenerateAccountWithEd25519 | GenerateAccountWithSingleSignerSecp256k1Key;\n"],"mappings":"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","names":["MimeType","TypeTagVariants","ScriptTransactionArgumentVariants","TransactionPayloadVariants","TransactionInnerPayloadVariants","TransactionExecutableVariants","TransactionExtraConfigVariants","TransactionVariants","TransactionAuthenticatorVariant","AccountAuthenticatorVariant","PrivateKeyVariants","AnyPublicKeyVariant","anyPublicKeyVariantToString","variant","AnySignatureVariant","EphemeralPublicKeyVariant","EphemeralSignatureVariant","EphemeralCertificateVariant","ZkpVariant","TransactionResponseType","isPendingTransactionResponse","response","isUserTransactionResponse","isGenesisTransactionResponse","isBlockMetadataTransactionResponse","isStateCheckpointTransactionResponse","isValidatorTransactionResponse","isBlockEpilogueTransactionResponse","isEd25519Signature","signature","isSecp256k1Signature","isMultiAgentSignature","isFeePayerSignature","isMultiEd25519Signature","isSingleSenderSignature","MoveFunctionVisibility","MoveAbility","RoleType","SigningScheme","SigningSchemeInput","DeriveScheme"]}
@@ -1,2 +0,0 @@
1
- var t=(S=>(S.FULLNODE="Fullnode",S.INDEXER="Indexer",S.FAUCET="Faucet",S.PEPPER="Pepper",S.PROVER="Prover",S))(t||{}),E=2e5,R=20,o=20,n="0x1::aptos_coin::AptosCoin",A="0x000000000000000000000000000000000000000000000000000000000000000a",T="APTOS::RawTransaction",a="APTOS::RawTransactionWithData",O=(_=>(_.ACCOUNT_RESTORATION_PROCESSOR="account_restoration_processor",_.ACCOUNT_TRANSACTION_PROCESSOR="account_transactions_processor",_.DEFAULT="default_processor",_.EVENTS_PROCESSOR="events_processor",_.FUNGIBLE_ASSET_PROCESSOR="fungible_asset_processor",_.STAKE_PROCESSOR="stake_processor",_.TOKEN_V2_PROCESSOR="token_v2_processor",_.USER_TRANSACTION_PROCESSOR="user_transaction_processor",_.OBJECT_PROCESSOR="objects_processor",_))(O||{}),r=/^https:\/\/securetoken\.google\.com\/[a-zA-Z0-9-_]+$/;export{t as a,E as b,R as c,o as d,n as e,A as f,T as g,a as h,O as i,r as j};
2
- //# sourceMappingURL=chunk-JCFTAG5Z.mjs.map
@@ -1,2 +0,0 @@
1
- import{a as d}from"./chunk-DPW6ELCQ.mjs";import{a as x}from"./chunk-ROT6S6BM.mjs";import{a as S}from"./chunk-WCMW2L3P.mjs";import{b as K}from"./chunk-WSR5EBJM.mjs";import{d as v,f as P,g as E,h as H,i as b,j as U}from"./chunk-C3Q23D22.mjs";import{a as A}from"./chunk-FGFLPH5K.mjs";import{a as p}from"./chunk-EBMEXURY.mjs";import{b as o}from"./chunk-STY74NUA.mjs";import{ed25519 as y}from"@noble/curves/ed25519";var m=[237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16];function T(I){let e=I.toUint8Array().slice(32);for(let t=m.length-1;t>=0;t-=1){if(e[t]<m[t])return!0;if(e[t]>m[t])return!1}return!1}var n=class n extends K{constructor(e){super();let t=o.fromHexInput(e);if(t.toUint8Array().length!==n.LENGTH)throw new Error(`PublicKey length should be ${n.LENGTH}`);this.key=t}verifySignature(e){let{message:t,signature:i}=e;if(!T(i))return!1;let a=d(t),u=o.fromHexInput(a).toUint8Array(),c=i.toUint8Array(),l=this.key.toUint8Array();return y.verify(c,u,l)}async verifySignatureAsync(e){return this.verifySignature(e)}authKey(){return A.fromSchemeAndBytes({scheme:0,input:this.toUint8Array()})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new n(t)}static isPublicKey(e){return e instanceof n}static isInstance(e){return"key"in e&&e.key?.data?.length===n.LENGTH}};n.LENGTH=32;var f=n,r=class r extends p{constructor(e,t){super();let i=x.parseHexInput(e,"ed25519",t);if(i.toUint8Array().length!==r.LENGTH)throw new Error(`PrivateKey length should be ${r.LENGTH}`);this.signingKey=i}static generate(){let e=y.utils.randomPrivateKey();return new r(e,!1)}static fromDerivationPath(e,t){if(!P(e))throw new Error(`Invalid derivation path ${e}`);return r.fromDerivationPathInner(e,U(t))}static fromDerivationPathInner(e,t,i=v){let{key:a,chainCode:u}=E(r.SLIP_0010_SEED,t),c=b(e).map(g=>parseInt(g,10)),{key:l}=c.reduce((g,w)=>H(g,w+i),{key:a,chainCode:u});return new r(l,!1)}publicKey(){let e=y.getPublicKey(this.signingKey.toUint8Array());return new f(e)}sign(e){let t=d(e),i=o.fromHexInput(t).toUint8Array(),a=y.sign(i,this.signingKey.toUint8Array());return new h(a)}toUint8Array(){return this.signingKey.toUint8Array()}toString(){return this.toAIP80String()}toHexString(){return this.signingKey.toString()}toAIP80String(){return x.formatPrivateKey(this.signingKey.toString(),"ed25519")}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new r(t,!1)}static isPrivateKey(e){return e instanceof r}};r.LENGTH=32,r.SLIP_0010_SEED="ed25519 seed";var z=r,s=class s extends S{constructor(e){super();let t=o.fromHexInput(e);if(t.toUint8Array().length!==s.LENGTH)throw new Error(`Signature length should be ${s.LENGTH}`);this.data=t}toUint8Array(){return this.data.toUint8Array()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new s(t)}};s.LENGTH=64;var h=s;export{T as a,f as b,z as c,h as d};
2
- //# sourceMappingURL=chunk-K43K3YG7.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/core/crypto/ed25519.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { ed25519 } from \"@noble/curves/ed25519\";\nimport { Deserializer } from \"../../bcs/deserializer\";\nimport { Serializable, Serializer } from \"../../bcs/serializer\";\nimport { AuthenticationKey } from \"../authenticationKey\";\nimport { Hex } from \"../hex\";\nimport { HexInput, SigningScheme as AuthenticationKeyScheme, PrivateKeyVariants } from \"../../types\";\nimport { CKDPriv, deriveKey, HARDENED_OFFSET, isValidHardenedPath, mnemonicToSeed, splitPath } from \"./hdKey\";\nimport { PrivateKey } from \"./privateKey\";\nimport { AccountPublicKey, PublicKey, VerifySignatureArgs, VerifySignatureAsyncArgs } from \"./publicKey\";\nimport { Signature } from \"./signature\";\nimport { convertSigningMessage } from \"./utils\";\n\n/**\n * L is the value that greater than or equal to will produce a non-canonical signature, and must be rejected\n * @group Implementation\n * @category Serialization\n */\nconst L: number[] = [\n 0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,\n];\n\n/**\n * Checks if an ED25519 signature is non-canonical.\n * This function helps determine the validity of a signature by verifying its canonical form.\n *\n * @param signature - The signature to be checked for canonicality.\n * @returns A boolean indicating whether the signature is non-canonical.\n *\n * Comes from Aptos Core\n * https://github.com/aptos-labs/aptos-core/blob/main/crates/aptos-crypto/src/ed25519/ed25519_sigs.rs#L47-L85\n * @group Implementation\n * @category Serialization\n */\nexport function isCanonicalEd25519Signature(signature: Signature): boolean {\n const s = signature.toUint8Array().slice(32);\n for (let i = L.length - 1; i >= 0; i -= 1) {\n if (s[i] < L[i]) {\n return true;\n }\n if (s[i] > L[i]) {\n return false;\n }\n }\n // As this stage S == L which implies a non-canonical S.\n return false;\n}\n\n/**\n * Represents the public key of an Ed25519 key pair.\n *\n * Since [AIP-55](https://github.com/aptos-foundation/AIPs/pull/263) Aptos supports\n * `Legacy` and `Unified` authentication keys.\n *\n * Ed25519 scheme is represented in the SDK as `Legacy authentication key` and also\n * as `AnyPublicKey` that represents any `Unified authentication key`.\n * @group Implementation\n * @category Serialization\n */\nexport class Ed25519PublicKey extends AccountPublicKey {\n /**\n * Length of an Ed25519 public key\n * @group Implementation\n * @category Serialization\n */\n static readonly LENGTH: number = 32;\n\n /**\n * Bytes of the public key\n * @private\n * @group Implementation\n * @category Serialization\n */\n private readonly key: Hex;\n\n /**\n * Creates an instance of the Ed25519Signature class from a hex input.\n * This constructor validates the length of the signature to ensure it meets the required specifications.\n *\n * @param hexInput - The hex input representing the Ed25519 signature.\n * @throws Error if the signature length is not equal to Ed25519Signature.LENGTH.\n * @group Implementation\n * @category Serialization\n */\n constructor(hexInput: HexInput) {\n super();\n\n const hex = Hex.fromHexInput(hexInput);\n if (hex.toUint8Array().length !== Ed25519PublicKey.LENGTH) {\n throw new Error(`PublicKey length should be ${Ed25519PublicKey.LENGTH}`);\n }\n this.key = hex;\n }\n\n // region AccountPublicKey\n\n /**\n * Verifies a signed message using a public key.\n *\n * @param args - The arguments for verification.\n * @param args.message - A signed message as a Hex string or Uint8Array.\n * @param args.signature - The signature of the message.\n * @group Implementation\n * @category Serialization\n */\n verifySignature(args: VerifySignatureArgs): boolean {\n const { message, signature } = args;\n // Verify malleability\n if (!isCanonicalEd25519Signature(signature)) {\n return false;\n }\n\n const messageToVerify = convertSigningMessage(message);\n const messageBytes = Hex.fromHexInput(messageToVerify).toUint8Array();\n const signatureBytes = signature.toUint8Array();\n const publicKeyBytes = this.key.toUint8Array();\n return ed25519.verify(signatureBytes, messageBytes, publicKeyBytes);\n }\n\n /**\n * Note: Ed25519Signatures can be verified syncronously.\n *\n * Verifies the provided signature against the given message.\n * This function helps ensure the integrity and authenticity of the message by confirming that the signature is valid.\n *\n * @param args - The arguments for signature verification.\n * @param args.aptosConfig - The configuration object for connecting to the Aptos network\n * @param args.message - The message that was signed.\n * @param args.signature - The signature to verify, which must be an instance of Secp256k1Signature.\n * @returns A boolean indicating whether the signature is valid for the given message.\n * @group Implementation\n * @category Serialization\n */\n async verifySignatureAsync(args: VerifySignatureAsyncArgs): Promise<boolean> {\n return this.verifySignature(args);\n }\n\n /**\n * Generates an authentication key from the public key using the Ed25519 scheme.\n * This function is essential for creating a secure authentication key that can be used for further cryptographic operations.\n *\n * @returns {AuthenticationKey} The generated authentication key.\n * @group Implementation\n * @category Serialization\n */\n authKey(): AuthenticationKey {\n return AuthenticationKey.fromSchemeAndBytes({\n scheme: AuthenticationKeyScheme.Ed25519,\n input: this.toUint8Array(),\n });\n }\n\n /**\n * Convert the internal data representation to a Uint8Array.\n *\n * @returns Uint8Array representation of the data.\n * @group Implementation\n * @category Serialization\n */\n toUint8Array(): Uint8Array {\n return this.key.toUint8Array();\n }\n\n // endregion\n\n // region Serializable\n\n /**\n * Serializes the data into a byte array using the provided serializer.\n * This allows for the conversion of data into a format suitable for transmission or storage.\n *\n * @param serializer - The serializer instance used to perform the serialization.\n * @group Implementation\n * @category Serialization\n */\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.key.toUint8Array());\n }\n\n /**\n * Deserialize bytes into an Ed25519Signature object.\n * This function is used to convert serialized byte data into a usable Ed25519Signature instance.\n *\n * @param deserializer - The deserializer instance used to read the byte data.\n * @group Implementation\n * @category Serialization\n */\n static deserialize(deserializer: Deserializer): Ed25519PublicKey {\n const bytes = deserializer.deserializeBytes();\n return new Ed25519PublicKey(bytes);\n }\n\n // endregion\n\n /**\n * Determine if the provided public key is an instance of Ed25519PublicKey.\n *\n * @param publicKey - The public key to check.\n * @returns True if the public key is an instance of Ed25519PublicKey, otherwise false.\n * @deprecated use `instanceof Ed25519PublicKey` instead.\n * @group Implementation\n * @category Serialization\n */\n static isPublicKey(publicKey: AccountPublicKey): publicKey is Ed25519PublicKey {\n return publicKey instanceof Ed25519PublicKey;\n }\n\n /**\n * Determines if the provided public key is a valid Ed25519 public key.\n * This function checks for the presence of the \"key\" property and verifies that its data length matches the expected length\n * for Ed25519 public keys.\n *\n * @param publicKey - The public key to validate.\n * @returns A boolean indicating whether the public key is a valid Ed25519 public key.\n * @group Implementation\n * @category Serialization\n */\n static isInstance(publicKey: PublicKey): publicKey is Ed25519PublicKey {\n return \"key\" in publicKey && (publicKey.key as any)?.data?.length === Ed25519PublicKey.LENGTH;\n }\n}\n\n/**\n * Represents the private key of an Ed25519 key pair.\n * @group Implementation\n * @category Serialization\n */\nexport class Ed25519PrivateKey extends Serializable implements PrivateKey {\n /**\n * Length of an Ed25519 private key\n * @group Implementation\n * @category Serialization\n */\n static readonly LENGTH: number = 32;\n\n /**\n * The Ed25519 key seed to use for BIP-32 compatibility\n * See more {@link https://github.com/satoshilabs/slips/blob/master/slip-0010.md}\n * @group Implementation\n * @category Serialization\n */\n static readonly SLIP_0010_SEED = \"ed25519 seed\";\n\n /**\n * The Ed25519 signing key\n * @private\n * @group Implementation\n * @category Serialization\n */\n private readonly signingKey: Hex;\n\n // region Constructors\n\n /**\n * Create a new PrivateKey instance from a Uint8Array or String.\n *\n * [Read about AIP-80](https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md)\n *\n * @param hexInput HexInput (string or Uint8Array)\n * @param strict If true, private key must AIP-80 compliant.\n * @group Implementation\n * @category Serialization\n */\n constructor(hexInput: HexInput, strict?: boolean) {\n super();\n\n const privateKeyHex = PrivateKey.parseHexInput(hexInput, PrivateKeyVariants.Ed25519, strict);\n if (privateKeyHex.toUint8Array().length !== Ed25519PrivateKey.LENGTH) {\n throw new Error(`PrivateKey length should be ${Ed25519PrivateKey.LENGTH}`);\n }\n\n // Create keyPair from Private key in Uint8Array format\n this.signingKey = privateKeyHex;\n }\n\n /**\n * Generate a new random private key.\n *\n * @returns Ed25519PrivateKey A newly generated Ed25519 private key.\n * @group Implementation\n * @category Serialization\n */\n static generate(): Ed25519PrivateKey {\n const keyPair = ed25519.utils.randomPrivateKey();\n return new Ed25519PrivateKey(keyPair, false);\n }\n\n /**\n * Derives a private key from a mnemonic seed phrase using a specified BIP44 path.\n * To derive multiple keys from the same phrase, change the path\n *\n * IMPORTANT: Ed25519 supports hardened derivation only, as it lacks a key homomorphism, making non-hardened derivation impossible.\n *\n * @param path - The BIP44 path used for key derivation.\n * @param mnemonics - The mnemonic seed phrase from which the key will be derived.\n * @throws Error if the provided path is not a valid hardened path.\n * @group Implementation\n * @category Serialization\n */\n static fromDerivationPath(path: string, mnemonics: string): Ed25519PrivateKey {\n if (!isValidHardenedPath(path)) {\n throw new Error(`Invalid derivation path ${path}`);\n }\n return Ed25519PrivateKey.fromDerivationPathInner(path, mnemonicToSeed(mnemonics));\n }\n\n /**\n * Derives a child private key from a given BIP44 path and seed.\n * A private inner function so we can separate from the main fromDerivationPath() method\n * to add tests to verify we create the keys correctly.\n *\n * @param path - The BIP44 path used for key derivation.\n * @param seed - The seed phrase created by the mnemonics, represented as a Uint8Array.\n * @param offset - The offset used for key derivation, defaults to HARDENED_OFFSET.\n * @returns An instance of Ed25519PrivateKey derived from the specified path and seed.\n * @group Implementation\n * @category Serialization\n */\n private static fromDerivationPathInner(path: string, seed: Uint8Array, offset = HARDENED_OFFSET): Ed25519PrivateKey {\n const { key, chainCode } = deriveKey(Ed25519PrivateKey.SLIP_0010_SEED, seed);\n\n const segments = splitPath(path).map((el) => parseInt(el, 10));\n\n // Derive the child key based on the path\n const { key: privateKey } = segments.reduce((parentKeys, segment) => CKDPriv(parentKeys, segment + offset), {\n key,\n chainCode,\n });\n return new Ed25519PrivateKey(privateKey, false);\n }\n\n // endregion\n\n // region PrivateKey\n\n /**\n * Derive the Ed25519PublicKey for this private key.\n *\n * @returns Ed25519PublicKey - The derived public key corresponding to the private key.\n * @group Implementation\n * @category Serialization\n */\n publicKey(): Ed25519PublicKey {\n const bytes = ed25519.getPublicKey(this.signingKey.toUint8Array());\n return new Ed25519PublicKey(bytes);\n }\n\n /**\n * Sign the given message with the private key.\n * This function generates a digital signature for the specified message, ensuring its authenticity and integrity.\n *\n * @param message - A message as a string or Uint8Array in HexInput format.\n * @returns A digital signature for the provided message.\n * @group Implementation\n * @category Serialization\n */\n sign(message: HexInput): Ed25519Signature {\n const messageToSign = convertSigningMessage(message);\n const messageBytes = Hex.fromHexInput(messageToSign).toUint8Array();\n const signatureBytes = ed25519.sign(messageBytes, this.signingKey.toUint8Array());\n return new Ed25519Signature(signatureBytes);\n }\n\n /**\n * Get the private key in bytes (Uint8Array).\n *\n * @returns Uint8Array representation of the private key\n * @group Implementation\n * @category Serialization\n */\n toUint8Array(): Uint8Array {\n return this.signingKey.toUint8Array();\n }\n\n /**\n * Get the private key as a hex string with the 0x prefix.\n *\n * @returns string representation of the private key.\n * @group Implementation\n * @category Serialization\n */\n toString(): string {\n return this.toAIP80String();\n }\n\n /**\n * Get the private key as a hex string with the 0x prefix.\n *\n * @returns string representation of the private key.\n */\n toHexString(): string {\n return this.signingKey.toString();\n }\n\n /**\n * Get the private key as a AIP-80 compliant hex string.\n *\n * [Read about AIP-80](https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md)\n *\n * @returns AIP-80 compliant string representation of the private key.\n */\n toAIP80String(): string {\n return PrivateKey.formatPrivateKey(this.signingKey.toString(), PrivateKeyVariants.Ed25519);\n }\n\n // endregion\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.toUint8Array());\n }\n\n static deserialize(deserializer: Deserializer): Ed25519PrivateKey {\n const bytes = deserializer.deserializeBytes();\n return new Ed25519PrivateKey(bytes, false);\n }\n\n // endregion\n\n /**\n * Determines if the provided private key is an instance of Ed25519PrivateKey.\n *\n * @param privateKey - The private key to check.\n * @returns A boolean indicating whether the private key is an Ed25519PrivateKey.\n *\n * @deprecated Use `instanceof Ed25519PrivateKey` instead.\n * @group Implementation\n * @category Serialization\n */\n static isPrivateKey(privateKey: PrivateKey): privateKey is Ed25519PrivateKey {\n return privateKey instanceof Ed25519PrivateKey;\n }\n}\n\n/**\n * Represents a signature of a message signed using an Ed25519 private key.\n * @group Implementation\n * @category Serialization\n */\nexport class Ed25519Signature extends Signature {\n /**\n * Length of an Ed25519 signature, which is 64 bytes.\n * @group Implementation\n * @category Serialization\n */\n static readonly LENGTH = 64;\n\n /**\n * The signature bytes\n * @private\n * @group Implementation\n * @category Serialization\n */\n private readonly data: Hex;\n\n // region Constructors\n\n constructor(hexInput: HexInput) {\n super();\n const data = Hex.fromHexInput(hexInput);\n if (data.toUint8Array().length !== Ed25519Signature.LENGTH) {\n throw new Error(`Signature length should be ${Ed25519Signature.LENGTH}`);\n }\n this.data = data;\n }\n\n // endregion\n\n // region Signature\n\n toUint8Array(): Uint8Array {\n return this.data.toUint8Array();\n }\n\n // endregion\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.data.toUint8Array());\n }\n\n static deserialize(deserializer: Deserializer): Ed25519Signature {\n const bytes = deserializer.deserializeBytes();\n return new Ed25519Signature(bytes);\n }\n\n // endregion\n}\n"],"mappings":"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","names":["ed25519","L","isCanonicalEd25519Signature","signature","s","i","_Ed25519PublicKey","AccountPublicKey","hexInput","hex","Hex","args","message","messageToVerify","convertSigningMessage","messageBytes","signatureBytes","publicKeyBytes","ed25519","AuthenticationKey","serializer","deserializer","bytes","publicKey","Ed25519PublicKey","_Ed25519PrivateKey","Serializable","strict","privateKeyHex","PrivateKey","keyPair","path","mnemonics","isValidHardenedPath","mnemonicToSeed","seed","offset","HARDENED_OFFSET","key","chainCode","deriveKey","segments","splitPath","el","privateKey","parentKeys","segment","CKDPriv","messageToSign","Ed25519Signature","Ed25519PrivateKey","_Ed25519Signature","Signature","data"]}
@@ -1,2 +0,0 @@
1
- var l=(e=>(e[e.V1=0]="V1",e[e.DerivableV1=1]="DerivableV1",e))(l||{});export{l as a};
2
- //# sourceMappingURL=chunk-KJH4KKG6.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/types/abstraction.ts"],"sourcesContent":["/**\n * The variant for the AbstractionAuthData enum.\n */\nexport enum AbstractionAuthDataVariant {\n V1 = 0,\n DerivableV1 = 1,\n}\n"],"mappings":"AAGO,IAAKA,OACVA,IAAA,GAAK,GAAL,KACAA,IAAA,YAAc,GAAd,cAFUA,OAAA","names":["AbstractionAuthDataVariant"]}
@@ -1,2 +0,0 @@
1
- import{b as t,d as n}from"./chunk-K43K3YG7.mjs";import{a as l}from"./chunk-WCMW2L3P.mjs";import{a as u}from"./chunk-WSR5EBJM.mjs";import{a as o}from"./chunk-FLZPUYXQ.mjs";import{b as s}from"./chunk-STY74NUA.mjs";var c=class i extends u{constructor(e){super();let r=e.constructor.name;switch(r){case t.name:this.publicKey=e,this.variant=0;break;default:throw new Error(`Unsupported key for EphemeralPublicKey - ${r}`)}}verifySignature(e){let{message:r,signature:a}=e;return this.publicKey.verifySignature({message:r,signature:a.signature})}async verifySignatureAsync(e){return this.verifySignature(e)}serialize(e){if(this.publicKey instanceof t)e.serializeU32AsUleb128(0),this.publicKey.serialize(e);else throw new Error("Unknown public key type")}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new i(t.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${r}`)}}static isPublicKey(e){return e instanceof i}},p=class i extends l{constructor(e){super();let r=e.constructor.name;switch(r){case n.name:this.signature=e;break;default:throw new Error(`Unsupported signature for EphemeralSignature - ${r}`)}}static fromHex(e){let r=s.fromHexInput(e),a=new o(r.toUint8Array());return i.deserialize(a)}serialize(e){if(this.signature instanceof n)e.serializeU32AsUleb128(0),this.signature.serialize(e);else throw new Error("Unknown signature type")}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new i(n.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralSignature: ${r}`)}}};export{c as a,p as b};
2
- //# sourceMappingURL=chunk-MSMFHPDT.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/core/crypto/ephemeral.ts"],"sourcesContent":["import { Serializer, Deserializer } from \"../../bcs\";\nimport { EphemeralPublicKeyVariant, EphemeralSignatureVariant, HexInput } from \"../../types\";\nimport { PublicKey } from \"./publicKey\";\nimport { Signature } from \"./signature\";\nimport { Ed25519PublicKey, Ed25519Signature } from \"./ed25519\";\nimport { Hex } from \"../hex\";\nimport { AptosConfig } from \"../../api\";\n\n/**\n * Represents ephemeral public keys for Aptos Keyless accounts.\n *\n * These keys are used only temporarily within Keyless accounts and are not utilized as public keys for account identification.\n * @group Implementation\n * @category Serialization\n */\nexport class EphemeralPublicKey extends PublicKey {\n /**\n * The public key itself\n * @group Implementation\n * @category Serialization\n */\n public readonly publicKey: PublicKey;\n\n /**\n * An enum indicating the scheme of the ephemeral public key\n * @group Implementation\n * @category Serialization\n */\n public readonly variant: EphemeralPublicKeyVariant;\n\n /**\n * Creates an instance of EphemeralPublicKey using the provided public key.\n * This constructor ensures that only supported signature types are accepted.\n *\n * @param publicKey - The public key to be used for the ephemeral public key.\n * @throws Error if the signature type is unsupported.\n * @group Implementation\n * @category Serialization\n */\n constructor(publicKey: PublicKey) {\n super();\n const publicKeyType = publicKey.constructor.name;\n switch (publicKeyType) {\n case Ed25519PublicKey.name:\n this.publicKey = publicKey;\n this.variant = EphemeralPublicKeyVariant.Ed25519;\n break;\n default:\n throw new Error(`Unsupported key for EphemeralPublicKey - ${publicKeyType}`);\n }\n }\n\n /**\n * Verifies a signed message using the ephemeral public key.\n *\n * @param args - The arguments for the verification.\n * @param args.message - The message that was signed.\n * @param args.signature - The signature that was signed by the private key of the ephemeral public key.\n * @returns true if the signature is valid, otherwise false.\n * @group Implementation\n * @category Serialization\n */\n verifySignature(args: { message: HexInput; signature: EphemeralSignature }): boolean {\n const { message, signature } = args;\n return this.publicKey.verifySignature({ message, signature: signature.signature });\n }\n\n async verifySignatureAsync(args: {\n aptosConfig: AptosConfig;\n message: HexInput;\n signature: EphemeralSignature;\n }): Promise<boolean> {\n return this.verifySignature(args);\n }\n\n /**\n * Serializes the current instance, specifically handling the Ed25519 signature type.\n * This function ensures that the signature is properly serialized using the provided serializer.\n *\n * @param serializer - The serializer instance used to serialize the signature.\n * @throws Error if the signature type is unknown.\n * @group Implementation\n * @category Serialization\n */\n serialize(serializer: Serializer): void {\n if (this.publicKey instanceof Ed25519PublicKey) {\n serializer.serializeU32AsUleb128(EphemeralPublicKeyVariant.Ed25519);\n this.publicKey.serialize(serializer);\n } else {\n throw new Error(\"Unknown public key type\");\n }\n }\n\n /**\n * Deserializes an EphemeralSignature from the provided deserializer.\n * This function allows you to retrieve an EphemeralSignature based on the deserialized data.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n * @group Implementation\n * @category Serialization\n */\n static deserialize(deserializer: Deserializer): EphemeralPublicKey {\n const index = deserializer.deserializeUleb128AsU32();\n switch (index) {\n case EphemeralPublicKeyVariant.Ed25519:\n return new EphemeralPublicKey(Ed25519PublicKey.deserialize(deserializer));\n default:\n throw new Error(`Unknown variant index for EphemeralPublicKey: ${index}`);\n }\n }\n\n /**\n * Determines if the provided public key is an instance of `EphemeralPublicKey`.\n *\n * @param publicKey - The public key to check.\n * @returns A boolean indicating whether the public key is an ephemeral type.\n * @group Implementation\n * @category Serialization\n */\n static isPublicKey(publicKey: PublicKey): publicKey is EphemeralPublicKey {\n return publicKey instanceof EphemeralPublicKey;\n }\n}\n\n/**\n * Represents ephemeral signatures used in Aptos Keyless accounts.\n *\n * These signatures are utilized within the KeylessSignature framework.\n * @group Implementation\n * @category Serialization\n */\nexport class EphemeralSignature extends Signature {\n /**\n * The signature signed by the private key of an EphemeralKeyPair\n * @group Implementation\n * @category Serialization\n */\n public readonly signature: Signature;\n\n constructor(signature: Signature) {\n super();\n const signatureType = signature.constructor.name;\n switch (signatureType) {\n case Ed25519Signature.name:\n this.signature = signature;\n break;\n default:\n throw new Error(`Unsupported signature for EphemeralSignature - ${signatureType}`);\n }\n }\n\n /**\n * Deserializes an ephemeral signature from a hexadecimal input.\n * This function allows you to convert a hexadecimal representation of an ephemeral signature into its deserialized form for\n * further processing.\n *\n * @param hexInput - The hexadecimal input representing the ephemeral signature.\n * @group Implementation\n * @category Serialization\n */\n static fromHex(hexInput: HexInput): EphemeralSignature {\n const data = Hex.fromHexInput(hexInput);\n const deserializer = new Deserializer(data.toUint8Array());\n return EphemeralSignature.deserialize(deserializer);\n }\n\n serialize(serializer: Serializer): void {\n if (this.signature instanceof Ed25519Signature) {\n serializer.serializeU32AsUleb128(EphemeralSignatureVariant.Ed25519);\n this.signature.serialize(serializer);\n } else {\n throw new Error(\"Unknown signature type\");\n }\n }\n\n static deserialize(deserializer: Deserializer): EphemeralSignature {\n const index = deserializer.deserializeUleb128AsU32();\n switch (index) {\n case EphemeralSignatureVariant.Ed25519:\n return new EphemeralSignature(Ed25519Signature.deserialize(deserializer));\n default:\n throw new Error(`Unknown variant index for EphemeralSignature: ${index}`);\n }\n }\n}\n"],"mappings":"oNAeO,IAAMA,EAAN,MAAMC,UAA2BC,CAAU,CAwBhD,YAAYC,EAAsB,CAChC,MAAM,EACN,IAAMC,EAAgBD,EAAU,YAAY,KAC5C,OAAQC,EAAe,CACrB,KAAKC,EAAiB,KACpB,KAAK,UAAYF,EACjB,KAAK,QAAU,EACf,MACF,QACE,MAAM,IAAI,MAAM,4CAA4CC,CAAa,EAAE,CAC/E,CACF,CAYA,gBAAgBE,EAAqE,CACnF,GAAM,CAAE,QAAAC,EAAS,UAAAC,CAAU,EAAIF,EAC/B,OAAO,KAAK,UAAU,gBAAgB,CAAE,QAAAC,EAAS,UAAWC,EAAU,SAAU,CAAC,CACnF,CAEA,MAAM,qBAAqBF,EAIN,CACnB,OAAO,KAAK,gBAAgBA,CAAI,CAClC,CAWA,UAAUG,EAA8B,CACtC,GAAI,KAAK,qBAAqBJ,EAC5BI,EAAW,uBAAuD,EAClE,KAAK,UAAU,UAAUA,CAAU,MAEnC,OAAM,IAAI,MAAM,yBAAyB,CAE7C,CAUA,OAAO,YAAYC,EAAgD,CACjE,IAAMC,EAAQD,EAAa,wBAAwB,EACnD,OAAQC,EAAO,CACb,OACE,OAAO,IAAIV,EAAmBI,EAAiB,YAAYK,CAAY,CAAC,EAC1E,QACE,MAAM,IAAI,MAAM,iDAAiDC,CAAK,EAAE,CAC5E,CACF,CAUA,OAAO,YAAYR,EAAuD,CACxE,OAAOA,aAAqBF,CAC9B,CACF,EASaW,EAAN,MAAMC,UAA2BC,CAAU,CAQhD,YAAYN,EAAsB,CAChC,MAAM,EACN,IAAMO,EAAgBP,EAAU,YAAY,KAC5C,OAAQO,EAAe,CACrB,KAAKC,EAAiB,KACpB,KAAK,UAAYR,EACjB,MACF,QACE,MAAM,IAAI,MAAM,kDAAkDO,CAAa,EAAE,CACrF,CACF,CAWA,OAAO,QAAQE,EAAwC,CACrD,IAAMC,EAAOC,EAAI,aAAaF,CAAQ,EAChCP,EAAe,IAAIU,EAAaF,EAAK,aAAa,CAAC,EACzD,OAAOL,EAAmB,YAAYH,CAAY,CACpD,CAEA,UAAUD,EAA8B,CACtC,GAAI,KAAK,qBAAqBO,EAC5BP,EAAW,uBAAuD,EAClE,KAAK,UAAU,UAAUA,CAAU,MAEnC,OAAM,IAAI,MAAM,wBAAwB,CAE5C,CAEA,OAAO,YAAYC,EAAgD,CACjE,IAAMC,EAAQD,EAAa,wBAAwB,EACnD,OAAQC,EAAO,CACb,OACE,OAAO,IAAIE,EAAmBG,EAAiB,YAAYN,CAAY,CAAC,EAC1E,QACE,MAAM,IAAI,MAAM,iDAAiDC,CAAK,EAAE,CAC5E,CACF,CACF","names":["EphemeralPublicKey","_EphemeralPublicKey","PublicKey","publicKey","publicKeyType","Ed25519PublicKey","args","message","signature","serializer","deserializer","index","EphemeralSignature","_EphemeralSignature","Signature","signatureType","Ed25519Signature","hexInput","data","Hex","Deserializer"]}
@@ -1,2 +0,0 @@
1
- import{b as r}from"./chunk-STY74NUA.mjs";var a=class a{static formatPrivateKey(i,n){let e=a.AIP80_PREFIXES[n],t=i;return typeof t=="string"&&t.startsWith(e)&&(t=t.split("-")[2]),`${e}${r.fromHexInput(t).toString()}`}static parseHexInput(i,n,e){let t,p=a.AIP80_PREFIXES[n];if(typeof i=="string")if(!e&&!i.startsWith(p))t=r.fromHexInput(i),e!==!1&&console.warn("[Aptos SDK] It is recommended that private keys are AIP-80 compliant (https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md). You can fix the private key by formatting it with `PrivateKey.formatPrivateKey(privateKey: string, type: 'ed25519' | 'secp256k1'): string`.");else if(i.startsWith(p))t=r.fromHexString(i.split("-")[2]);else throw e?new Error("Invalid HexString input while parsing private key. Must AIP-80 compliant string."):new Error("Invalid HexString input while parsing private key.");else t=r.fromHexInput(i);return t}};a.AIP80_PREFIXES={ed25519:"ed25519-priv-",secp256k1:"secp256k1-priv-"};var o=a;export{o as a};
2
- //# sourceMappingURL=chunk-ROT6S6BM.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/core/crypto/privateKey.ts"],"sourcesContent":["/* eslint-disable max-len */\n\nimport { HexInput, PrivateKeyVariants } from \"../../types\";\nimport { Hex } from \"../hex\";\nimport { PublicKey } from \"./publicKey\";\nimport { Signature } from \"./signature\";\n\n/**\n * Represents a private key used for signing messages and deriving the associated public key.\n * @group Implementation\n * @category Serialization\n */\nexport interface PrivateKey {\n /**\n * Sign the given message with the private key to create a signature.\n * @param message - The message to be signed, provided in HexInput format.\n * @returns A Signature object representing the signed message.\n * @group Implementation\n * @category Serialization\n */\n sign(message: HexInput): Signature;\n\n /**\n * Derive the public key associated with the private key.\n * @group Implementation\n * @category Serialization\n */\n publicKey(): PublicKey;\n\n /**\n * Get the private key in bytes (Uint8Array).\n * @group Implementation\n * @category Serialization\n */\n toUint8Array(): Uint8Array;\n}\n\nexport class PrivateKey {\n /**\n * The AIP-80 compliant prefixes for each private key type. Append this to a private key's hex representation\n * to get an AIP-80 compliant string.\n *\n * [Read about AIP-80](https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md)\n */\n public static readonly AIP80_PREFIXES = {\n [PrivateKeyVariants.Ed25519]: \"ed25519-priv-\",\n [PrivateKeyVariants.Secp256k1]: \"secp256k1-priv-\",\n };\n\n /**\n * Format a HexInput to an AIP-80 compliant string.\n *\n * [Read about AIP-80](https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md)\n *\n * @param privateKey - The HexString or Uint8Array format of the private key.\n * @param privateKeyType - The private key type\n */\n public static formatPrivateKey(privateKey: HexInput, type: PrivateKeyVariants): string {\n const aip80Prefix = PrivateKey.AIP80_PREFIXES[type];\n\n // Remove the prefix if it exists\n let formattedPrivateKey = privateKey;\n if (typeof formattedPrivateKey === \"string\" && formattedPrivateKey.startsWith(aip80Prefix)) {\n // eslint-disable-next-line prefer-destructuring\n formattedPrivateKey = formattedPrivateKey.split(\"-\")[2];\n }\n\n return `${aip80Prefix}${Hex.fromHexInput(formattedPrivateKey).toString()}`;\n }\n\n /**\n * Parse a HexInput that may be a HexString, Uint8Array, or a AIP-80 compliant string to a Hex instance.\n *\n * [Read about AIP-80](https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md)\n *\n * @param value - A HexString, Uint8Array, or a AIP-80 compliant string.\n * @param privateKeyType - The private key type\n * @param strict - If true, the value MUST be compliant with AIP-80.\n */\n public static parseHexInput(value: HexInput, type: PrivateKeyVariants, strict?: boolean): Hex {\n let data: Hex;\n\n const aip80Prefix = PrivateKey.AIP80_PREFIXES[type];\n if (typeof value === \"string\") {\n if (!strict && !value.startsWith(aip80Prefix)) {\n // HexString input\n data = Hex.fromHexInput(value);\n // If the strictness is false, the user has opted into non-AIP-80 compliant private keys.\n if (strict !== false) {\n // eslint-disable-next-line no-console\n console.warn(\n \"[Aptos SDK] It is recommended that private keys are AIP-80 compliant (https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md). You can fix the private key by formatting it with `PrivateKey.formatPrivateKey(privateKey: string, type: 'ed25519' | 'secp256k1'): string`.\",\n );\n }\n } else if (value.startsWith(aip80Prefix)) {\n // AIP-80 Compliant String input\n data = Hex.fromHexString(value.split(\"-\")[2]);\n } else {\n if (strict) {\n // The value does not start with the AIP-80 prefix, and strict is true.\n throw new Error(\"Invalid HexString input while parsing private key. Must AIP-80 compliant string.\");\n }\n\n // This condition should never be reached.\n throw new Error(\"Invalid HexString input while parsing private key.\");\n }\n } else {\n // The value is an Uint8Array\n data = Hex.fromHexInput(value);\n }\n\n return data;\n }\n}\n"],"mappings":"yCAqCO,IAAMA,EAAN,MAAMA,CAAW,CAoBtB,OAAc,iBAAiBC,EAAsBC,EAAkC,CACrF,IAAMC,EAAcH,EAAW,eAAeE,CAAI,EAG9CE,EAAsBH,EAC1B,OAAI,OAAOG,GAAwB,UAAYA,EAAoB,WAAWD,CAAW,IAEvFC,EAAsBA,EAAoB,MAAM,GAAG,EAAE,CAAC,GAGjD,GAAGD,CAAW,GAAGE,EAAI,aAAaD,CAAmB,EAAE,SAAS,CAAC,EAC1E,CAWA,OAAc,cAAcE,EAAiBJ,EAA0BK,EAAuB,CAC5F,IAAIC,EAEEL,EAAcH,EAAW,eAAeE,CAAI,EAClD,GAAI,OAAOI,GAAU,SACnB,GAAI,CAACC,GAAU,CAACD,EAAM,WAAWH,CAAW,EAE1CK,EAAOH,EAAI,aAAaC,CAAK,EAEzBC,IAAW,IAEb,QAAQ,KACN,uRACF,UAEOD,EAAM,WAAWH,CAAW,EAErCK,EAAOH,EAAI,cAAcC,EAAM,MAAM,GAAG,EAAE,CAAC,CAAC,MAE5C,OAAIC,EAEI,IAAI,MAAM,kFAAkF,EAI9F,IAAI,MAAM,oDAAoD,OAItEC,EAAOH,EAAI,aAAaC,CAAK,EAG/B,OAAOE,CACT,CACF,EA5EaR,EAOY,eAAiB,CACrC,QAA6B,gBAC7B,UAA+B,iBAClC,EAVK,IAAMS,EAANT","names":["_PrivateKey","privateKey","type","aip80Prefix","formattedPrivateKey","Hex","value","strict","data","PrivateKey"]}