@aptos-labs/ts-sdk 1.7.0 → 1.9.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 (370) hide show
  1. package/dist/browser/index.d.ts +1226 -975
  2. package/dist/browser/index.global.js +32 -30
  3. package/dist/browser/index.global.js.map +1 -1
  4. package/dist/common/index.d.ts +1226 -975
  5. package/dist/common/index.js +27 -25
  6. package/dist/common/index.js.map +1 -1
  7. package/dist/esm/api/account.d.mts +12 -6
  8. package/dist/esm/api/account.mjs +1 -1
  9. package/dist/esm/api/ans.d.mts +11 -12
  10. package/dist/esm/api/ans.mjs +1 -1
  11. package/dist/esm/api/aptos.d.mts +13 -14
  12. package/dist/esm/api/aptos.mjs +1 -1
  13. package/dist/esm/api/aptosConfig.mjs +1 -1
  14. package/dist/esm/api/coin.d.mts +13 -13
  15. package/dist/esm/api/coin.mjs +1 -1
  16. package/dist/esm/api/digitalAsset.d.mts +20 -10
  17. package/dist/esm/api/digitalAsset.mjs +1 -1
  18. package/dist/esm/api/event.d.mts +14 -1
  19. package/dist/esm/api/event.mjs +1 -1
  20. package/dist/esm/api/faucet.mjs +1 -1
  21. package/dist/esm/api/fungibleAsset.d.mts +9 -10
  22. package/dist/esm/api/fungibleAsset.mjs +1 -1
  23. package/dist/esm/api/general.mjs +1 -1
  24. package/dist/esm/api/index.d.mts +13 -14
  25. package/dist/esm/api/index.mjs +1 -1
  26. package/dist/esm/api/staking.mjs +1 -1
  27. package/dist/esm/api/transaction.d.mts +5 -6
  28. package/dist/esm/api/transaction.mjs +1 -1
  29. package/dist/esm/api/transactionSubmission/build.d.mts +8 -8
  30. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  31. package/dist/esm/api/transactionSubmission/management.d.mts +11 -12
  32. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  33. package/dist/esm/api/transactionSubmission/sign.d.mts +11 -12
  34. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  35. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  36. package/dist/esm/api/transactionSubmission/simulate.d.mts +11 -11
  37. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  38. package/dist/esm/api/transactionSubmission/submit.d.mts +6 -6
  39. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  40. package/dist/esm/api/utils.mjs +1 -1
  41. package/dist/esm/bcs/index.mjs +1 -1
  42. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  43. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  44. package/dist/esm/chunk-2E2JOGE5.mjs +2 -0
  45. package/dist/esm/chunk-2E2JOGE5.mjs.map +1 -0
  46. package/dist/esm/chunk-3EUOBVCT.mjs +2 -0
  47. package/dist/esm/{chunk-A2QH4A6D.mjs.map → chunk-3EUOBVCT.mjs.map} +1 -1
  48. package/dist/esm/{chunk-RNO5ZG3C.mjs → chunk-52RTAMN7.mjs} +2 -2
  49. package/dist/esm/chunk-7BDYKJXX.mjs +2 -0
  50. package/dist/esm/chunk-7BDYKJXX.mjs.map +1 -0
  51. package/dist/esm/{chunk-WQI2RH2S.mjs → chunk-7U36LMP4.mjs} +2 -2
  52. package/dist/esm/{chunk-NWRKJFHV.mjs → chunk-ARIC32W7.mjs} +2 -2
  53. package/dist/esm/{chunk-RIL4SHXC.mjs → chunk-B7M3OWHV.mjs} +2 -2
  54. package/dist/esm/{chunk-C7ZX475J.mjs → chunk-BBUAAJRA.mjs} +2 -2
  55. package/dist/esm/chunk-C3HM7HQP.mjs +2 -0
  56. package/dist/esm/chunk-C3HM7HQP.mjs.map +1 -0
  57. package/dist/esm/{chunk-DRF6AMEZ.mjs → chunk-CHA5DSSD.mjs} +2 -2
  58. package/dist/esm/chunk-CVEJHRAU.mjs +2 -0
  59. package/dist/esm/chunk-CVEJHRAU.mjs.map +1 -0
  60. package/dist/esm/chunk-DE5OOOVY.mjs +2 -0
  61. package/dist/esm/{chunk-3UYBNX3P.mjs.map → chunk-DE5OOOVY.mjs.map} +1 -1
  62. package/dist/esm/{chunk-IKCBGNRD.mjs → chunk-DGOT2VR5.mjs} +2 -2
  63. package/dist/esm/{chunk-GVHOHNHT.mjs → chunk-EF2F7NWO.mjs} +2 -2
  64. package/dist/esm/{chunk-J6RCCKOA.mjs → chunk-EQZ757ES.mjs} +2 -2
  65. package/dist/esm/{chunk-CX5ULWJQ.mjs → chunk-F67Y7YH6.mjs} +2 -2
  66. package/dist/esm/{chunk-JLL7BCD4.mjs → chunk-FVMVV4V3.mjs} +2 -2
  67. package/dist/esm/chunk-FWDKABRW.mjs +2 -0
  68. package/dist/esm/chunk-FWDKABRW.mjs.map +1 -0
  69. package/dist/esm/chunk-G62HQC77.mjs +2 -0
  70. package/dist/esm/chunk-G62HQC77.mjs.map +1 -0
  71. package/dist/esm/{chunk-ESX5X52V.mjs → chunk-GQOOXOTN.mjs} +2 -2
  72. package/dist/esm/chunk-GRJJBGHT.mjs +2 -0
  73. package/dist/esm/chunk-GRJJBGHT.mjs.map +1 -0
  74. package/dist/esm/chunk-HEPV52CH.mjs +2 -0
  75. package/dist/esm/chunk-HEPV52CH.mjs.map +1 -0
  76. package/dist/esm/{chunk-XQIWF5HY.mjs → chunk-I3TCHVQQ.mjs} +2 -2
  77. package/dist/esm/{chunk-3NOQE6U3.mjs → chunk-ILJWEPDW.mjs} +2 -2
  78. package/dist/esm/chunk-INORE66K.mjs +2 -0
  79. package/dist/esm/chunk-INORE66K.mjs.map +1 -0
  80. package/dist/esm/{chunk-5L6SRCJP.mjs → chunk-J6MWD4XN.mjs} +2 -2
  81. package/dist/esm/{chunk-YGMT4GQ5.mjs → chunk-JEHR6GKW.mjs} +2 -2
  82. package/dist/esm/chunk-JEHR6GKW.mjs.map +1 -0
  83. package/dist/esm/chunk-KUX6GQ2E.mjs +1 -0
  84. package/dist/esm/{chunk-6UNBJAV6.mjs → chunk-KWJTVJ7C.mjs} +2 -2
  85. package/dist/esm/chunk-KWJTVJ7C.mjs.map +1 -0
  86. package/dist/esm/{chunk-WK36MJRI.mjs → chunk-LLL2LFYH.mjs} +2 -2
  87. package/dist/esm/chunk-LMXP3JUU.mjs +2 -0
  88. package/dist/esm/chunk-LMXP3JUU.mjs.map +1 -0
  89. package/dist/esm/{chunk-5WXR2O3T.mjs → chunk-N65SOKJQ.mjs} +2 -2
  90. package/dist/esm/{chunk-XOBXX273.mjs → chunk-NL3XVNS5.mjs} +2 -2
  91. package/dist/esm/{chunk-Q7JKS6WV.mjs → chunk-NURFZOR4.mjs} +2 -2
  92. package/dist/esm/{chunk-MKERJNYN.mjs → chunk-OG56TYZE.mjs} +2 -2
  93. package/dist/esm/chunk-Q6WOHF4A.mjs +2 -0
  94. package/dist/esm/chunk-Q6WOHF4A.mjs.map +1 -0
  95. package/dist/esm/chunk-QA4XWNIH.mjs +2 -0
  96. package/dist/esm/chunk-QA4XWNIH.mjs.map +1 -0
  97. package/dist/esm/chunk-QE4ASJ5K.mjs +1 -0
  98. package/dist/esm/chunk-QR72RXBS.mjs +2 -0
  99. package/dist/esm/chunk-QR72RXBS.mjs.map +1 -0
  100. package/dist/esm/{chunk-TVURQPLA.mjs → chunk-R4VJDSIP.mjs} +2 -2
  101. package/dist/esm/{chunk-O57QZZF2.mjs → chunk-S2F6CSH4.mjs} +2 -2
  102. package/dist/esm/chunk-S2F6CSH4.mjs.map +1 -0
  103. package/dist/esm/{chunk-BQSE5HHW.mjs → chunk-S4SEFF4K.mjs} +3 -1
  104. package/dist/esm/chunk-S4SEFF4K.mjs.map +1 -0
  105. package/dist/esm/{chunk-OVSV4Y32.mjs → chunk-SXIFL5DQ.mjs} +2 -2
  106. package/dist/esm/{chunk-OVSV4Y32.mjs.map → chunk-SXIFL5DQ.mjs.map} +1 -1
  107. package/dist/esm/{chunk-Z6XNTGNK.mjs → chunk-TN5BUH4F.mjs} +2 -2
  108. package/dist/esm/chunk-TNVR7SNR.mjs +2 -0
  109. package/dist/esm/chunk-TNVR7SNR.mjs.map +1 -0
  110. package/dist/esm/chunk-TX7UK75Q.mjs +2 -0
  111. package/dist/esm/chunk-TX7UK75Q.mjs.map +1 -0
  112. package/dist/esm/{chunk-YE3DZD6T.mjs → chunk-UIUSDBCL.mjs} +2 -2
  113. package/dist/esm/{chunk-7JTOGYO7.mjs → chunk-UMLDKLDL.mjs} +2 -2
  114. package/dist/esm/chunk-UVSRX4SV.mjs +1 -0
  115. package/dist/esm/{chunk-6Y3VBRMN.mjs → chunk-VEVBHH3M.mjs} +2 -2
  116. package/dist/esm/{chunk-T5IFXLOP.mjs → chunk-VMXBMAYK.mjs} +2 -2
  117. package/dist/esm/chunk-WKUXBIYB.mjs +2 -0
  118. package/dist/esm/chunk-WKUXBIYB.mjs.map +1 -0
  119. package/dist/esm/chunk-WME5D6YR.mjs +2 -0
  120. package/dist/esm/chunk-WME5D6YR.mjs.map +1 -0
  121. package/dist/esm/chunk-WTHNSNAX.mjs +2 -0
  122. package/dist/esm/chunk-WTHNSNAX.mjs.map +1 -0
  123. package/dist/esm/{chunk-WC2WSKYZ.mjs → chunk-X5C3LYI7.mjs} +2 -2
  124. package/dist/esm/chunk-XKD7W5NO.mjs +2 -0
  125. package/dist/esm/{chunk-UJAX75ON.mjs.map → chunk-XKD7W5NO.mjs.map} +1 -1
  126. package/dist/esm/{chunk-OWZLBIDD.mjs → chunk-XTPFQ4MH.mjs} +2 -2
  127. package/dist/esm/{chunk-D2GNCG27.mjs → chunk-Y5AJLNUD.mjs} +2 -2
  128. package/dist/esm/chunk-YDAA4RG4.mjs +2 -0
  129. package/dist/esm/chunk-YDAA4RG4.mjs.map +1 -0
  130. package/dist/esm/{chunk-ZFPA45OK.mjs → chunk-YR2R3LW4.mjs} +2 -2
  131. package/dist/esm/chunk-YZZO6VDC.mjs +2 -0
  132. package/dist/esm/chunk-YZZO6VDC.mjs.map +1 -0
  133. package/dist/esm/client/core.mjs +1 -1
  134. package/dist/esm/client/get.mjs +1 -1
  135. package/dist/esm/client/index.mjs +1 -1
  136. package/dist/esm/client/post.mjs +1 -1
  137. package/dist/esm/core/account/Account.d.mts +20 -0
  138. package/dist/esm/core/account/Account.mjs +2 -0
  139. package/dist/esm/core/account/Ed25519Account.d.mts +20 -0
  140. package/dist/esm/core/account/Ed25519Account.mjs +2 -0
  141. package/dist/esm/core/account/SingleKeyAccount.d.mts +20 -0
  142. package/dist/esm/core/account/SingleKeyAccount.mjs +2 -0
  143. package/dist/esm/core/account/SingleKeyAccount.mjs.map +1 -0
  144. package/dist/esm/core/account/index.d.mts +305 -0
  145. package/dist/esm/core/account/index.mjs +2 -0
  146. package/dist/esm/core/account/index.mjs.map +1 -0
  147. package/dist/esm/core/accountAddress.mjs +1 -1
  148. package/dist/esm/core/authenticationKey.d.mts +7 -68
  149. package/dist/esm/core/authenticationKey.mjs +1 -1
  150. package/dist/esm/core/crypto/ed25519.d.mts +49 -61
  151. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  152. package/dist/esm/core/crypto/index.d.mts +9 -6
  153. package/dist/esm/core/crypto/index.mjs +1 -1
  154. package/dist/esm/core/crypto/multiEd25519.d.mts +17 -14
  155. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  156. package/dist/esm/core/crypto/multiKey.d.mts +70 -17
  157. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  158. package/dist/esm/core/crypto/privateKey.d.mts +35 -0
  159. package/dist/esm/core/crypto/privateKey.mjs +2 -0
  160. package/dist/esm/core/crypto/privateKey.mjs.map +1 -0
  161. package/dist/esm/core/crypto/publicKey.d.mts +13 -0
  162. package/dist/esm/core/crypto/publicKey.mjs +2 -0
  163. package/dist/esm/core/crypto/publicKey.mjs.map +1 -0
  164. package/dist/esm/core/crypto/secp256k1.d.mts +43 -67
  165. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  166. package/dist/esm/core/crypto/signature.d.mts +28 -0
  167. package/dist/esm/core/crypto/signature.mjs +2 -0
  168. package/dist/esm/core/crypto/signature.mjs.map +1 -0
  169. package/dist/esm/core/crypto/singleKey.d.mts +68 -0
  170. package/dist/esm/core/crypto/singleKey.mjs +2 -0
  171. package/dist/esm/core/crypto/singleKey.mjs.map +1 -0
  172. package/dist/esm/core/index.d.mts +9 -8
  173. package/dist/esm/core/index.mjs +1 -1
  174. package/dist/esm/index.d.mts +9 -9
  175. package/dist/esm/index.mjs +1 -1
  176. package/dist/esm/internal/account.d.mts +9 -3
  177. package/dist/esm/internal/account.mjs +1 -1
  178. package/dist/esm/internal/ans.d.mts +10 -11
  179. package/dist/esm/internal/ans.mjs +1 -1
  180. package/dist/esm/internal/coin.d.mts +9 -9
  181. package/dist/esm/internal/coin.mjs +1 -1
  182. package/dist/esm/internal/digitalAsset.d.mts +15 -12
  183. package/dist/esm/internal/digitalAsset.mjs +1 -1
  184. package/dist/esm/internal/event.d.mts +7 -2
  185. package/dist/esm/internal/event.mjs +1 -1
  186. package/dist/esm/internal/faucet.d.mts +1 -1
  187. package/dist/esm/internal/faucet.mjs +1 -1
  188. package/dist/esm/internal/fungibleAsset.d.mts +9 -10
  189. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  190. package/dist/esm/internal/general.mjs +1 -1
  191. package/dist/esm/internal/staking.d.mts +1 -1
  192. package/dist/esm/internal/staking.mjs +1 -1
  193. package/dist/esm/internal/transaction.mjs +1 -1
  194. package/dist/esm/internal/transactionSubmission.d.mts +10 -11
  195. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  196. package/dist/esm/publicKey-lq5djCIY.d.mts +113 -0
  197. package/dist/esm/transactions/authenticator/account.d.mts +6 -4
  198. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  199. package/dist/esm/transactions/authenticator/index.d.mts +6 -6
  200. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  201. package/dist/esm/transactions/authenticator/transaction.d.mts +5 -5
  202. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  203. package/dist/esm/transactions/index.d.mts +6 -7
  204. package/dist/esm/transactions/index.mjs +1 -1
  205. package/dist/esm/transactions/instances/index.d.mts +4 -4
  206. package/dist/esm/transactions/instances/index.mjs +1 -1
  207. package/dist/esm/transactions/instances/moduleId.d.mts +1 -1
  208. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  209. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  210. package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +2 -1
  211. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  212. package/dist/esm/transactions/instances/signedTransaction.d.mts +8 -8
  213. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  214. package/dist/esm/transactions/instances/transactionPayload.d.mts +1 -1
  215. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  216. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +11 -5
  217. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  218. package/dist/esm/transactions/management/index.d.mts +11 -12
  219. package/dist/esm/transactions/management/index.mjs +1 -1
  220. package/dist/esm/transactions/management/transactionWorker.d.mts +11 -12
  221. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  222. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +10 -10
  223. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  224. package/dist/esm/transactions/transactionBuilder/index.d.mts +9 -10
  225. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  226. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +8 -8
  227. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  228. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +9 -10
  229. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  230. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  231. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  232. package/dist/esm/transactions/types.d.mts +9 -9
  233. package/dist/esm/types/generated/operations.d.mts +6 -0
  234. package/dist/esm/types/generated/queries.d.mts +6 -6
  235. package/dist/esm/types/generated/queries.mjs +1 -1
  236. package/dist/esm/types/generated/types.d.mts +594 -56
  237. package/dist/esm/types/generated/types.mjs +1 -1
  238. package/dist/esm/types/generated/types.mjs.map +1 -1
  239. package/dist/esm/types/index.d.mts +35 -6
  240. package/dist/esm/types/index.mjs +1 -1
  241. package/dist/esm/utils/const.d.mts +1 -2
  242. package/dist/esm/utils/const.mjs +1 -1
  243. package/dist/esm/utils/index.d.mts +1 -1
  244. package/dist/esm/utils/index.mjs +1 -1
  245. package/dist/esm/version.d.mts +1 -1
  246. package/dist/esm/version.mjs +1 -1
  247. package/package.json +16 -16
  248. package/src/api/aptosConfig.ts +2 -2
  249. package/src/api/digitalAsset.ts +20 -0
  250. package/src/api/event.ts +27 -1
  251. package/src/core/account/Account.ts +245 -0
  252. package/src/core/account/Ed25519Account.ts +88 -0
  253. package/src/core/account/SingleKeyAccount.ts +120 -0
  254. package/src/core/account/index.ts +3 -0
  255. package/src/core/authenticationKey.ts +18 -52
  256. package/src/core/crypto/ed25519.ts +118 -104
  257. package/src/core/crypto/index.ts +6 -5
  258. package/src/core/crypto/multiEd25519.ts +98 -44
  259. package/src/core/crypto/multiKey.ts +192 -34
  260. package/src/core/crypto/privateKey.ts +25 -0
  261. package/src/core/crypto/publicKey.ts +52 -0
  262. package/src/core/crypto/secp256k1.ts +108 -111
  263. package/src/core/crypto/signature.ts +46 -0
  264. package/src/core/crypto/singleKey.ts +180 -0
  265. package/src/internal/account.ts +5 -3
  266. package/src/internal/digitalAsset.ts +26 -0
  267. package/src/internal/event.ts +33 -1
  268. package/src/internal/queries/currentTokenOwnershipFieldsFragment.graphql +1 -0
  269. package/src/internal/queries/getTokenData.graphql +1 -0
  270. package/src/transactions/authenticator/account.ts +1 -2
  271. package/src/transactions/instances/rotationProofChallenge.ts +1 -1
  272. package/src/transactions/transactionBuilder/transactionBuilder.ts +3 -21
  273. package/src/transactions/types.ts +1 -1
  274. package/src/types/generated/operations.ts +6 -0
  275. package/src/types/generated/queries.ts +2 -0
  276. package/src/types/generated/types.ts +662 -55
  277. package/src/types/index.ts +40 -4
  278. package/src/utils/const.ts +0 -4
  279. package/src/version.ts +1 -1
  280. package/dist/esm/chunk-2QV6HI3M.mjs +0 -2
  281. package/dist/esm/chunk-2QV6HI3M.mjs.map +0 -1
  282. package/dist/esm/chunk-3UYBNX3P.mjs +0 -2
  283. package/dist/esm/chunk-4SAUEZTN.mjs +0 -2
  284. package/dist/esm/chunk-4SAUEZTN.mjs.map +0 -1
  285. package/dist/esm/chunk-6UNBJAV6.mjs.map +0 -1
  286. package/dist/esm/chunk-7IGH7N52.mjs +0 -2
  287. package/dist/esm/chunk-7IGH7N52.mjs.map +0 -1
  288. package/dist/esm/chunk-A2QH4A6D.mjs +0 -2
  289. package/dist/esm/chunk-AA3GRJNL.mjs +0 -2
  290. package/dist/esm/chunk-AA3GRJNL.mjs.map +0 -1
  291. package/dist/esm/chunk-ALFESCPU.mjs +0 -2
  292. package/dist/esm/chunk-ALFESCPU.mjs.map +0 -1
  293. package/dist/esm/chunk-BQSE5HHW.mjs.map +0 -1
  294. package/dist/esm/chunk-CCUD52OF.mjs +0 -2
  295. package/dist/esm/chunk-CCUD52OF.mjs.map +0 -1
  296. package/dist/esm/chunk-ERWQOVBF.mjs +0 -2
  297. package/dist/esm/chunk-ERWQOVBF.mjs.map +0 -1
  298. package/dist/esm/chunk-FBFMQZTM.mjs +0 -2
  299. package/dist/esm/chunk-FBFMQZTM.mjs.map +0 -1
  300. package/dist/esm/chunk-FP5DPRYL.mjs +0 -2
  301. package/dist/esm/chunk-FP5DPRYL.mjs.map +0 -1
  302. package/dist/esm/chunk-HHJBCGAQ.mjs +0 -2
  303. package/dist/esm/chunk-HHJBCGAQ.mjs.map +0 -1
  304. package/dist/esm/chunk-I7WRJY7K.mjs +0 -2
  305. package/dist/esm/chunk-I7WRJY7K.mjs.map +0 -1
  306. package/dist/esm/chunk-INV6U3KS.mjs +0 -2
  307. package/dist/esm/chunk-INV6U3KS.mjs.map +0 -1
  308. package/dist/esm/chunk-O57QZZF2.mjs.map +0 -1
  309. package/dist/esm/chunk-SBMJNU2O.mjs +0 -2
  310. package/dist/esm/chunk-SBMJNU2O.mjs.map +0 -1
  311. package/dist/esm/chunk-SZYATFM7.mjs +0 -2
  312. package/dist/esm/chunk-SZYATFM7.mjs.map +0 -1
  313. package/dist/esm/chunk-UCHGKGCF.mjs +0 -2
  314. package/dist/esm/chunk-UCHGKGCF.mjs.map +0 -1
  315. package/dist/esm/chunk-UIVJXLRM.mjs +0 -1
  316. package/dist/esm/chunk-UJAX75ON.mjs +0 -2
  317. package/dist/esm/chunk-V6JFR2CB.mjs +0 -2
  318. package/dist/esm/chunk-V6JFR2CB.mjs.map +0 -1
  319. package/dist/esm/chunk-YGMT4GQ5.mjs.map +0 -1
  320. package/dist/esm/chunk-ZFIMVSCR.mjs +0 -2
  321. package/dist/esm/chunk-ZFIMVSCR.mjs.map +0 -1
  322. package/dist/esm/chunk-ZIZ7PVK2.mjs +0 -2
  323. package/dist/esm/chunk-ZIZ7PVK2.mjs.map +0 -1
  324. package/dist/esm/core/account.d.mts +0 -184
  325. package/dist/esm/core/account.mjs +0 -2
  326. package/dist/esm/core/crypto/anyPublicKey.d.mts +0 -59
  327. package/dist/esm/core/crypto/anyPublicKey.mjs +0 -2
  328. package/dist/esm/core/crypto/anySignature.d.mts +0 -31
  329. package/dist/esm/core/crypto/anySignature.mjs +0 -2
  330. package/dist/esm/core/crypto/asymmetricCrypto.d.mts +0 -74
  331. package/dist/esm/core/crypto/asymmetricCrypto.mjs +0 -2
  332. package/src/core/account.ts +0 -282
  333. package/src/core/crypto/anyPublicKey.ts +0 -92
  334. package/src/core/crypto/anySignature.ts +0 -56
  335. package/src/core/crypto/asymmetricCrypto.ts +0 -77
  336. /package/dist/esm/{chunk-RNO5ZG3C.mjs.map → chunk-52RTAMN7.mjs.map} +0 -0
  337. /package/dist/esm/{chunk-WQI2RH2S.mjs.map → chunk-7U36LMP4.mjs.map} +0 -0
  338. /package/dist/esm/{chunk-NWRKJFHV.mjs.map → chunk-ARIC32W7.mjs.map} +0 -0
  339. /package/dist/esm/{chunk-RIL4SHXC.mjs.map → chunk-B7M3OWHV.mjs.map} +0 -0
  340. /package/dist/esm/{chunk-C7ZX475J.mjs.map → chunk-BBUAAJRA.mjs.map} +0 -0
  341. /package/dist/esm/{chunk-DRF6AMEZ.mjs.map → chunk-CHA5DSSD.mjs.map} +0 -0
  342. /package/dist/esm/{chunk-IKCBGNRD.mjs.map → chunk-DGOT2VR5.mjs.map} +0 -0
  343. /package/dist/esm/{chunk-GVHOHNHT.mjs.map → chunk-EF2F7NWO.mjs.map} +0 -0
  344. /package/dist/esm/{chunk-J6RCCKOA.mjs.map → chunk-EQZ757ES.mjs.map} +0 -0
  345. /package/dist/esm/{chunk-CX5ULWJQ.mjs.map → chunk-F67Y7YH6.mjs.map} +0 -0
  346. /package/dist/esm/{chunk-JLL7BCD4.mjs.map → chunk-FVMVV4V3.mjs.map} +0 -0
  347. /package/dist/esm/{chunk-ESX5X52V.mjs.map → chunk-GQOOXOTN.mjs.map} +0 -0
  348. /package/dist/esm/{chunk-XQIWF5HY.mjs.map → chunk-I3TCHVQQ.mjs.map} +0 -0
  349. /package/dist/esm/{chunk-3NOQE6U3.mjs.map → chunk-ILJWEPDW.mjs.map} +0 -0
  350. /package/dist/esm/{chunk-5L6SRCJP.mjs.map → chunk-J6MWD4XN.mjs.map} +0 -0
  351. /package/dist/esm/{chunk-UIVJXLRM.mjs.map → chunk-KUX6GQ2E.mjs.map} +0 -0
  352. /package/dist/esm/{chunk-WK36MJRI.mjs.map → chunk-LLL2LFYH.mjs.map} +0 -0
  353. /package/dist/esm/{chunk-5WXR2O3T.mjs.map → chunk-N65SOKJQ.mjs.map} +0 -0
  354. /package/dist/esm/{chunk-XOBXX273.mjs.map → chunk-NL3XVNS5.mjs.map} +0 -0
  355. /package/dist/esm/{chunk-Q7JKS6WV.mjs.map → chunk-NURFZOR4.mjs.map} +0 -0
  356. /package/dist/esm/{chunk-MKERJNYN.mjs.map → chunk-OG56TYZE.mjs.map} +0 -0
  357. /package/dist/esm/{core/account.mjs.map → chunk-QE4ASJ5K.mjs.map} +0 -0
  358. /package/dist/esm/{chunk-TVURQPLA.mjs.map → chunk-R4VJDSIP.mjs.map} +0 -0
  359. /package/dist/esm/{chunk-Z6XNTGNK.mjs.map → chunk-TN5BUH4F.mjs.map} +0 -0
  360. /package/dist/esm/{chunk-YE3DZD6T.mjs.map → chunk-UIUSDBCL.mjs.map} +0 -0
  361. /package/dist/esm/{chunk-7JTOGYO7.mjs.map → chunk-UMLDKLDL.mjs.map} +0 -0
  362. /package/dist/esm/{core/crypto/anyPublicKey.mjs.map → chunk-UVSRX4SV.mjs.map} +0 -0
  363. /package/dist/esm/{chunk-6Y3VBRMN.mjs.map → chunk-VEVBHH3M.mjs.map} +0 -0
  364. /package/dist/esm/{chunk-T5IFXLOP.mjs.map → chunk-VMXBMAYK.mjs.map} +0 -0
  365. /package/dist/esm/{chunk-WC2WSKYZ.mjs.map → chunk-X5C3LYI7.mjs.map} +0 -0
  366. /package/dist/esm/{chunk-OWZLBIDD.mjs.map → chunk-XTPFQ4MH.mjs.map} +0 -0
  367. /package/dist/esm/{chunk-D2GNCG27.mjs.map → chunk-Y5AJLNUD.mjs.map} +0 -0
  368. /package/dist/esm/{chunk-ZFPA45OK.mjs.map → chunk-YR2R3LW4.mjs.map} +0 -0
  369. /package/dist/esm/core/{crypto/anySignature.mjs.map → account/Account.mjs.map} +0 -0
  370. /package/dist/esm/core/{crypto/asymmetricCrypto.mjs.map → account/Ed25519Account.mjs.map} +0 -0
@@ -4,11 +4,13 @@
4
4
  import { sha3_256 } from "@noble/hashes/sha3";
5
5
  import { secp256k1 } from "@noble/curves/secp256k1";
6
6
  import { HDKey } from "@scure/bip32";
7
- import { PrivateKey, PublicKey, Signature } from "./asymmetricCrypto";
8
- import { Deserializer, Serializer } from "../../bcs";
7
+ import { Serializable, Deserializer, Serializer } from "../../bcs";
9
8
  import { Hex } from "../hex";
10
9
  import { HexInput } from "../../types";
11
10
  import { isValidBIP44Path, mnemonicToSeed } from "./hdKey";
11
+ import { PrivateKey } from "./privateKey";
12
+ import { PublicKey, VerifySignatureArgs } from "./publicKey";
13
+ import { Signature } from "./signature";
12
14
 
13
15
  /**
14
16
  * Represents the Secp256k1 ecdsa public key
@@ -37,38 +39,27 @@ export class Secp256k1PublicKey extends PublicKey {
37
39
  this.key = hex;
38
40
  }
39
41
 
40
- /**
41
- * Get the public key in bytes (Uint8Array).
42
- *
43
- * @returns Uint8Array representation of the public key
44
- */
42
+ // region PublicKey
43
+
44
+ verifySignature(args: VerifySignatureArgs): boolean {
45
+ const { message, signature } = args;
46
+ if (!(signature instanceof Secp256k1Signature)) {
47
+ return false;
48
+ }
49
+
50
+ const messageBytes = Hex.fromHexInput(message).toUint8Array();
51
+ const messageSha3Bytes = sha3_256(messageBytes);
52
+ const signatureBytes = signature.toUint8Array();
53
+ return secp256k1.verify(signatureBytes, messageSha3Bytes, this.key.toUint8Array());
54
+ }
55
+
45
56
  toUint8Array(): Uint8Array {
46
57
  return this.key.toUint8Array();
47
58
  }
48
59
 
49
- /**
50
- * Get the public key as a hex string with the 0x prefix.
51
- *
52
- * @returns string representation of the public key
53
- */
54
- toString(): string {
55
- return this.key.toString();
56
- }
60
+ // endregion
57
61
 
58
- /**
59
- * Verifies a signed data with a public key
60
- *
61
- * @param args.message message
62
- * @param args.signature The signature
63
- * @returns true if the signature is valid
64
- */
65
- verifySignature(args: { message: HexInput; signature: Secp256k1Signature }): boolean {
66
- const { message, signature } = args;
67
- const msgHex = Hex.fromHexInput(message).toUint8Array();
68
- const sha3Message = sha3_256(msgHex);
69
- const rawSignature = signature.toUint8Array();
70
- return secp256k1.verify(rawSignature, sha3Message, this.toUint8Array());
71
- }
62
+ // region Serializable
72
63
 
73
64
  serialize(serializer: Serializer): void {
74
65
  serializer.serializeBytes(this.key.toUint8Array());
@@ -79,11 +70,12 @@ export class Secp256k1PublicKey extends PublicKey {
79
70
  return new Secp256k1PublicKey(bytes);
80
71
  }
81
72
 
82
- static load(deserializer: Deserializer): Secp256k1PublicKey {
83
- const bytes = deserializer.deserializeBytes();
84
- return new Secp256k1PublicKey(bytes);
85
- }
73
+ // endregion
86
74
 
75
+ /**
76
+ * @deprecated use `instanceof Secp256k1PublicKey` instead
77
+ * @param publicKey
78
+ */
87
79
  static isPublicKey(publicKey: PublicKey): publicKey is Secp256k1PublicKey {
88
80
  return publicKey instanceof Secp256k1PublicKey;
89
81
  }
@@ -92,7 +84,7 @@ export class Secp256k1PublicKey extends PublicKey {
92
84
  /**
93
85
  * A Secp256k1 ecdsa private key
94
86
  */
95
- export class Secp256k1PrivateKey extends PrivateKey {
87
+ export class Secp256k1PrivateKey extends Serializable implements PrivateKey {
96
88
  /**
97
89
  * Length of Secp256k1 ecdsa private key
98
90
  */
@@ -104,6 +96,8 @@ export class Secp256k1PrivateKey extends PrivateKey {
104
96
  */
105
97
  private readonly key: Hex;
106
98
 
99
+ // region Constructors
100
+
107
101
  /**
108
102
  * Create a new PrivateKey instance from a Uint8Array or String.
109
103
  *
@@ -120,46 +114,6 @@ export class Secp256k1PrivateKey extends PrivateKey {
120
114
  this.key = privateKeyHex;
121
115
  }
122
116
 
123
- /**
124
- * Get the private key in bytes (Uint8Array).
125
- *
126
- * @returns
127
- */
128
- toUint8Array(): Uint8Array {
129
- return this.key.toUint8Array();
130
- }
131
-
132
- /**
133
- * Get the private key as a hex string with the 0x prefix.
134
- *
135
- * @returns string representation of the private key
136
- */
137
- toString(): string {
138
- return this.key.toString();
139
- }
140
-
141
- /**
142
- * Sign the given message with the private key.
143
- *
144
- * @param message in HexInput format
145
- * @returns Signature
146
- */
147
- sign(message: HexInput): Secp256k1Signature {
148
- const msgHex = Hex.fromHexInput(message);
149
- const sha3Message = sha3_256(msgHex.toUint8Array());
150
- const signature = secp256k1.sign(sha3Message, this.key.toUint8Array());
151
- return new Secp256k1Signature(signature.toCompactRawBytes());
152
- }
153
-
154
- serialize(serializer: Serializer): void {
155
- serializer.serializeBytes(this.toUint8Array());
156
- }
157
-
158
- static deserialize(deserializer: Deserializer): Secp256k1PrivateKey {
159
- const bytes = deserializer.deserializeBytes();
160
- return new Secp256k1PrivateKey(bytes);
161
- }
162
-
163
117
  /**
164
118
  * Generate a new random private key.
165
119
  *
@@ -170,16 +124,6 @@ export class Secp256k1PrivateKey extends PrivateKey {
170
124
  return new Secp256k1PrivateKey(hexInput);
171
125
  }
172
126
 
173
- /**
174
- * Derive the Secp256k1PublicKey from this private key.
175
- *
176
- * @returns Secp256k1PublicKey
177
- */
178
- publicKey(): Secp256k1PublicKey {
179
- const bytes = secp256k1.getPublicKey(this.key.toUint8Array(), false);
180
- return new Secp256k1PublicKey(bytes);
181
- }
182
-
183
127
  /**
184
128
  * Derives a private key from a mnemonic seed phrase.
185
129
  *
@@ -214,13 +158,76 @@ export class Secp256k1PrivateKey extends PrivateKey {
214
158
  return new Secp256k1PrivateKey(privateKey);
215
159
  }
216
160
 
161
+ // endregion
162
+
163
+ // region PrivateKey
164
+
165
+ /**
166
+ * Sign the given message with the private key.
167
+ *
168
+ * @param message in HexInput format
169
+ * @returns Signature
170
+ */
171
+ sign(message: HexInput): Secp256k1Signature {
172
+ const messageBytes = Hex.fromHexInput(message);
173
+ const messageHashBytes = sha3_256(messageBytes.toUint8Array());
174
+ const signature = secp256k1.sign(messageHashBytes, this.key.toUint8Array());
175
+ return new Secp256k1Signature(signature.toCompactRawBytes());
176
+ }
177
+
178
+ /**
179
+ * Derive the Secp256k1PublicKey from this private key.
180
+ *
181
+ * @returns Secp256k1PublicKey
182
+ */
183
+ publicKey(): Secp256k1PublicKey {
184
+ const bytes = secp256k1.getPublicKey(this.key.toUint8Array(), false);
185
+ return new Secp256k1PublicKey(bytes);
186
+ }
187
+
188
+ /**
189
+ * Get the private key in bytes (Uint8Array).
190
+ *
191
+ * @returns
192
+ */
193
+ toUint8Array(): Uint8Array {
194
+ return this.key.toUint8Array();
195
+ }
196
+
197
+ /**
198
+ * Get the private key as a hex string with the 0x prefix.
199
+ *
200
+ * @returns string representation of the private key
201
+ */
202
+ toString(): string {
203
+ return this.key.toString();
204
+ }
205
+
206
+ // endregion
207
+
208
+ // region Serializable
209
+
210
+ serialize(serializer: Serializer): void {
211
+ serializer.serializeBytes(this.toUint8Array());
212
+ }
213
+
214
+ static deserialize(deserializer: Deserializer): Secp256k1PrivateKey {
215
+ const bytes = deserializer.deserializeBytes();
216
+ return new Secp256k1PrivateKey(bytes);
217
+ }
218
+
219
+ // endregion
220
+
221
+ /**
222
+ * @deprecated use `instanceof Secp256k1PrivateKey` instead
223
+ */
217
224
  static isPrivateKey(privateKey: PrivateKey): privateKey is Secp256k1PrivateKey {
218
225
  return privateKey instanceof Secp256k1PrivateKey;
219
226
  }
220
227
  }
221
228
 
222
229
  /**
223
- * A signature of a message signed using an Secp256k1 ecdsa private key
230
+ * A signature of a message signed using a Secp256k1 ecdsa private key
224
231
  */
225
232
  export class Secp256k1Signature extends Signature {
226
233
  /**
@@ -234,6 +241,8 @@ export class Secp256k1Signature extends Signature {
234
241
  */
235
242
  private readonly data: Hex;
236
243
 
244
+ // region Constructors
245
+
237
246
  /**
238
247
  * Create a new Signature instance from a Uint8Array or String.
239
248
  *
@@ -241,31 +250,26 @@ export class Secp256k1Signature extends Signature {
241
250
  */
242
251
  constructor(hexInput: HexInput) {
243
252
  super();
244
-
245
- const hex = Hex.fromHexInput(hexInput);
246
- if (hex.toUint8Array().length !== Secp256k1Signature.LENGTH) {
247
- throw new Error(`Signature length should be ${Secp256k1Signature.LENGTH}, recieved ${hex.toUint8Array().length}`);
253
+ const data = Hex.fromHexInput(hexInput);
254
+ if (data.toUint8Array().length !== Secp256k1Signature.LENGTH) {
255
+ throw new Error(
256
+ `Signature length should be ${Secp256k1Signature.LENGTH}, received ${data.toUint8Array().length}`,
257
+ );
248
258
  }
249
- this.data = hex;
259
+ this.data = data;
250
260
  }
251
261
 
252
- /**
253
- * Get the signature in bytes (Uint8Array).
254
- *
255
- * @returns Uint8Array representation of the signature
256
- */
262
+ // endregion
263
+
264
+ // region Signature
265
+
257
266
  toUint8Array(): Uint8Array {
258
267
  return this.data.toUint8Array();
259
268
  }
260
269
 
261
- /**
262
- * Get the signature as a hex string with the 0x prefix.
263
- *
264
- * @returns string representation of the signature
265
- */
266
- toString(): string {
267
- return this.data.toString();
268
- }
270
+ // endregion
271
+
272
+ // region Serializable
269
273
 
270
274
  serialize(serializer: Serializer): void {
271
275
  serializer.serializeBytes(this.data.toUint8Array());
@@ -276,12 +280,5 @@ export class Secp256k1Signature extends Signature {
276
280
  return new Secp256k1Signature(hex);
277
281
  }
278
282
 
279
- static load(deserializer: Deserializer): Secp256k1Signature {
280
- const bytes = deserializer.deserializeBytes();
281
- return new Secp256k1Signature(bytes);
282
- }
283
-
284
- static isSignature(signature: Signature): signature is Secp256k1Signature {
285
- return signature instanceof Secp256k1Signature;
286
- }
283
+ // endregion
287
284
  }
@@ -0,0 +1,46 @@
1
+ import { Serializable } from "../../bcs";
2
+ import { Hex } from "../hex";
3
+
4
+ /**
5
+ * An abstract representation of a crypto signature,
6
+ * associated to a specific signature scheme e.g. Ed25519 or Secp256k1
7
+ *
8
+ * This is the product of signing a message directly from a PrivateKey
9
+ * and can be verified against a CryptoPublicKey.
10
+ */
11
+ export abstract class Signature extends Serializable {
12
+ /**
13
+ * Get the raw signature bytes
14
+ */
15
+ abstract toUint8Array(): Uint8Array;
16
+
17
+ /**
18
+ * Get the signature as a hex string with a 0x prefix e.g. 0x123456...
19
+ */
20
+ toString(): string {
21
+ const bytes = this.toUint8Array();
22
+ return Hex.fromHexInput(bytes).toString();
23
+ }
24
+ }
25
+
26
+ /**
27
+ * An abstract representation of an account signature,
28
+ * associated to a specific authentication scheme e.g. Ed25519 or SingleKey
29
+ *
30
+ * This is the product of signing a message through an account,
31
+ * and can be verified against an AccountPublicKey.
32
+ */
33
+ // export abstract class AccountSignature extends Serializable {
34
+ // /**
35
+ // * Get the raw signature bytes
36
+ // */
37
+ // abstract toUint8Array(): Uint8Array;
38
+ //
39
+ // /**
40
+ // * Get the signature as a hex string with a 0x prefix e.g. 0x123456...
41
+ // */
42
+ // toString(): string {
43
+ // const bytes = this.toUint8Array();
44
+ // return Hex.fromHexInput(bytes).toString();
45
+ // }
46
+ // }
@@ -0,0 +1,180 @@
1
+ import { Deserializer, Serializer } from "../../bcs";
2
+ import { AnyPublicKeyVariant, AnySignatureVariant, SigningScheme as AuthenticationKeyScheme } from "../../types";
3
+ import { AuthenticationKey } from "../authenticationKey";
4
+ import { Ed25519PublicKey, Ed25519Signature } from "./ed25519";
5
+ import { AccountPublicKey, PublicKey, VerifySignatureArgs } from "./publicKey";
6
+ import { Secp256k1PublicKey, Secp256k1Signature } from "./secp256k1";
7
+ import { Signature } from "./signature";
8
+
9
+ /**
10
+ * Represents any public key supported by Aptos.
11
+ *
12
+ * Since [AIP-55](https://github.com/aptos-foundation/AIPs/pull/263) Aptos supports
13
+ * `Legacy` and `Unified` authentication keys.
14
+ *
15
+ * Any unified authentication key is represented in the SDK as `AnyPublicKey`.
16
+ */
17
+ export class AnyPublicKey extends AccountPublicKey {
18
+ /**
19
+ * Reference to the inner public key
20
+ */
21
+ public readonly publicKey: PublicKey;
22
+
23
+ /**
24
+ * Index of the underlying enum variant
25
+ */
26
+ public readonly variant: AnyPublicKeyVariant;
27
+
28
+ // region Constructors
29
+
30
+ constructor(publicKey: PublicKey) {
31
+ super();
32
+ this.publicKey = publicKey;
33
+ if (publicKey instanceof Ed25519PublicKey) {
34
+ this.variant = AnyPublicKeyVariant.Ed25519;
35
+ } else if (publicKey instanceof Secp256k1PublicKey) {
36
+ this.variant = AnyPublicKeyVariant.Secp256k1;
37
+ } else {
38
+ throw new Error("Unsupported public key type");
39
+ }
40
+ }
41
+
42
+ // endregion
43
+
44
+ // region AccountPublicKey
45
+
46
+ verifySignature(args: VerifySignatureArgs): boolean {
47
+ const { message, signature } = args;
48
+ if (!(signature instanceof AnySignature)) {
49
+ return false;
50
+ }
51
+
52
+ return this.publicKey.verifySignature({
53
+ message,
54
+ signature: signature.signature,
55
+ });
56
+ }
57
+
58
+ authKey(): AuthenticationKey {
59
+ return AuthenticationKey.fromSchemeAndBytes({
60
+ scheme: AuthenticationKeyScheme.SingleKey,
61
+ input: this.toUint8Array(),
62
+ });
63
+ }
64
+
65
+ toUint8Array() {
66
+ return this.bcsToBytes();
67
+ }
68
+
69
+ // endregion
70
+
71
+ // region Serializable
72
+
73
+ serialize(serializer: Serializer): void {
74
+ serializer.serializeU32AsUleb128(this.variant);
75
+ this.publicKey.serialize(serializer);
76
+ }
77
+
78
+ static deserialize(deserializer: Deserializer): AnyPublicKey {
79
+ const variantIndex = deserializer.deserializeUleb128AsU32();
80
+ let publicKey: PublicKey;
81
+ switch (variantIndex) {
82
+ case AnyPublicKeyVariant.Ed25519:
83
+ publicKey = Ed25519PublicKey.deserialize(deserializer);
84
+ break;
85
+ case AnyPublicKeyVariant.Secp256k1:
86
+ publicKey = Secp256k1PublicKey.deserialize(deserializer);
87
+ break;
88
+ default:
89
+ throw new Error(`Unknown variant index for AnyPublicKey: ${variantIndex}`);
90
+ }
91
+ return new AnyPublicKey(publicKey);
92
+ }
93
+
94
+ // endregion
95
+
96
+ /**
97
+ * @deprecated use `instanceof AnyPublicKey` instead.
98
+ */
99
+ static isPublicKey(publicKey: AccountPublicKey): publicKey is AnyPublicKey {
100
+ return publicKey instanceof AnyPublicKey;
101
+ }
102
+
103
+ /**
104
+ * @deprecated use `publicKey instanceof Ed25519PublicKey` instead.
105
+ */
106
+ isEd25519(): boolean {
107
+ return this.publicKey instanceof Ed25519PublicKey;
108
+ }
109
+
110
+ /**
111
+ * @deprecated use `publicKey instanceof Secp256k1PublicKey` instead.
112
+ */
113
+ isSecp256k1PublicKey(): boolean {
114
+ return this.publicKey instanceof Secp256k1PublicKey;
115
+ }
116
+ }
117
+
118
+ /**
119
+ * Instance of signature that uses the SingleKey authentication scheme.
120
+ * This signature can only be generated by a `SingleKeySigner`, since it uses the
121
+ * same authentication scheme.
122
+ */
123
+ export class AnySignature extends Signature {
124
+ public readonly signature: Signature;
125
+
126
+ /**
127
+ * Index of the underlying enum variant
128
+ */
129
+ private readonly variant: AnySignatureVariant;
130
+
131
+ // region Constructors
132
+
133
+ constructor(signature: Signature) {
134
+ super();
135
+ this.signature = signature;
136
+
137
+ if (signature instanceof Ed25519Signature) {
138
+ this.variant = AnySignatureVariant.Ed25519;
139
+ } else if (signature instanceof Secp256k1Signature) {
140
+ this.variant = AnySignatureVariant.Secp256k1;
141
+ } else {
142
+ throw new Error("Unsupported signature type");
143
+ }
144
+ }
145
+
146
+ // endregion
147
+
148
+ // region AccountSignature
149
+
150
+ toUint8Array() {
151
+ return this.bcsToBytes();
152
+ }
153
+
154
+ // endregion
155
+
156
+ // region Serializable
157
+
158
+ serialize(serializer: Serializer): void {
159
+ serializer.serializeU32AsUleb128(this.variant);
160
+ this.signature.serialize(serializer);
161
+ }
162
+
163
+ static deserialize(deserializer: Deserializer): AnySignature {
164
+ const variantIndex = deserializer.deserializeUleb128AsU32();
165
+ let signature: Signature;
166
+ switch (variantIndex) {
167
+ case AnySignatureVariant.Ed25519:
168
+ signature = Ed25519Signature.deserialize(deserializer);
169
+ break;
170
+ case AnySignatureVariant.Secp256k1:
171
+ signature = Secp256k1Signature.deserialize(deserializer);
172
+ break;
173
+ default:
174
+ throw new Error(`Unknown variant index for AnySignature: ${variantIndex}`);
175
+ }
176
+ return new AnySignature(signature);
177
+ }
178
+
179
+ // endregion
180
+ }
@@ -12,7 +12,7 @@ import { AptosConfig } from "../api/aptosConfig";
12
12
  import { AptosApiError, getAptosFullNode, paginateWithCursor } from "../client";
13
13
  import { AccountAddress, AccountAddressInput } from "../core/accountAddress";
14
14
  import { Account } from "../core/account";
15
- import { PrivateKey } from "../core/crypto/asymmetricCrypto";
15
+ import { AnyPublicKey, Ed25519PublicKey, PrivateKey } from "../core/crypto";
16
16
  import { getTableItem, queryIndexer } from "./general";
17
17
  import {
18
18
  AccountData,
@@ -54,7 +54,6 @@ import {
54
54
  } from "../types/generated/queries";
55
55
  import { memoizeAsync } from "../utils/memoize";
56
56
  import { Secp256k1PrivateKey, AuthenticationKey, Ed25519PrivateKey } from "../core";
57
- import { AnyPublicKey } from "../core/crypto/anyPublicKey";
58
57
  import { CurrentFungibleAssetBalancesBoolExp } from "../types/generated/types";
59
58
 
60
59
  export async function getInfo(args: {
@@ -549,7 +548,10 @@ export async function deriveAccountFromPrivateKey(args: {
549
548
  return Account.fromPrivateKeyAndAddress({ privateKey, address, legacy: false });
550
549
  }
551
550
  // lookup legacy ed25519
552
- const legacyAuthKey = AuthenticationKey.fromPublicKeyAndScheme({ publicKey, scheme: SigningScheme.Ed25519 });
551
+ const legacyAuthKey = AuthenticationKey.fromPublicKeyAndScheme({
552
+ publicKey: publicKey.publicKey as Ed25519PublicKey,
553
+ scheme: SigningScheme.Ed25519,
554
+ });
553
555
  const isLegacyEd25519 = await isAccountExist({ authKey: legacyAuthKey, aptosConfig });
554
556
  if (isLegacyEd25519) {
555
557
  const address = legacyAuthKey.derivedAddress();
@@ -302,6 +302,32 @@ export async function getCollectionData(args: {
302
302
  return data.current_collections_v2[0];
303
303
  }
304
304
 
305
+ export async function getCollectionDataByCollectionId(args: {
306
+ aptosConfig: AptosConfig;
307
+ collectionId: AccountAddressInput;
308
+ }): Promise<GetCollectionDataResponse> {
309
+ const { aptosConfig, collectionId } = args;
310
+ const address = AccountAddress.from(collectionId);
311
+
312
+ const whereCondition: any = {
313
+ collection_id: { _eq: address.toStringLong() },
314
+ };
315
+
316
+ const graphqlQuery = {
317
+ query: GetCollectionData,
318
+ variables: {
319
+ where_condition: whereCondition,
320
+ },
321
+ };
322
+ const data = await queryIndexer<GetCollectionDataQuery>({
323
+ aptosConfig,
324
+ query: graphqlQuery,
325
+ originMethod: "getCollectionData",
326
+ });
327
+
328
+ return data.current_collections_v2[0];
329
+ }
330
+
305
331
  export async function getCollectionId(args: {
306
332
  aptosConfig: AptosConfig;
307
333
  creatorAddress: AccountAddressInput;
@@ -13,9 +13,39 @@ import { AccountAddress, AccountAddressInput } from "../core";
13
13
  import { AnyNumber, GetEventsResponse, PaginationArgs, MoveStructId, OrderByArg, WhereArg } from "../types";
14
14
  import { GetEventsQuery } from "../types/generated/operations";
15
15
  import { GetEvents } from "../types/generated/queries";
16
- import { EventsBoolExp } from "../types/generated/types";
16
+ import { EventsBoolExp, InputMaybe } from "../types/generated/types";
17
17
  import { queryIndexer } from "./general";
18
18
 
19
+ const MAX_EVENT_TYPE_LENGTH = 300;
20
+ const checkEventTypeLength = (eventType?: InputMaybe<string>) => {
21
+ if (eventType && eventType.length > MAX_EVENT_TYPE_LENGTH) {
22
+ throw new Error(`Event type length exceeds the maximum length of ${MAX_EVENT_TYPE_LENGTH}`);
23
+ }
24
+ };
25
+
26
+ export async function getModuleEventsByEventType(args: {
27
+ aptosConfig: AptosConfig;
28
+ eventType: MoveStructId;
29
+ options?: PaginationArgs & OrderByArg<GetEventsResponse[0]>;
30
+ }): Promise<GetEventsResponse> {
31
+ const { aptosConfig, eventType, options } = args;
32
+
33
+ const whereCondition: EventsBoolExp = {
34
+ account_address: { _eq: "0x0000000000000000000000000000000000000000000000000000000000000000" },
35
+ creation_number: { _eq: "0" },
36
+ sequence_number: { _eq: "0" },
37
+ indexed_type: { _eq: eventType },
38
+ };
39
+
40
+ const customOptions = {
41
+ where: whereCondition,
42
+ pagination: options,
43
+ orderBy: options?.orderBy,
44
+ };
45
+
46
+ return getEvents({ aptosConfig, options: customOptions });
47
+ }
48
+
19
49
  export async function getAccountEventsByCreationNumber(args: {
20
50
  aptosConfig: AptosConfig;
21
51
  accountAddress: AccountAddressInput;
@@ -67,6 +97,8 @@ export async function getEvents(args: {
67
97
  options?: PaginationArgs & OrderByArg<GetEventsResponse[0]> & WhereArg<EventsBoolExp>;
68
98
  }): Promise<GetEventsResponse> {
69
99
  const { aptosConfig, options } = args;
100
+ // eslint-disable-next-line no-underscore-dangle
101
+ checkEventTypeLength(options?.where?.indexed_type?._eq);
70
102
 
71
103
  const graphqlQuery = {
72
104
  query: GetEvents,
@@ -25,6 +25,7 @@ fragment CurrentTokenOwnershipFields on current_token_ownerships_v2 {
25
25
  token_properties
26
26
  token_standard
27
27
  token_uri
28
+ decimals
28
29
  current_collection {
29
30
  collection_id
30
31
  collection_name
@@ -18,6 +18,7 @@ query getTokenData(
18
18
  token_properties
19
19
  token_standard
20
20
  token_uri
21
+ decimals
21
22
  current_collection {
22
23
  collection_id
23
24
  collection_name
@@ -4,8 +4,7 @@
4
4
  /* eslint-disable @typescript-eslint/naming-convention */
5
5
 
6
6
  import { Serializer, Deserializer, Serializable } from "../../bcs";
7
- import { AnyPublicKey } from "../../core/crypto/anyPublicKey";
8
- import { AnySignature } from "../../core/crypto/anySignature";
7
+ import { AnyPublicKey, AnySignature } from "../../core/crypto";
9
8
  import { Ed25519PublicKey, Ed25519Signature } from "../../core/crypto/ed25519";
10
9
  import { MultiEd25519PublicKey, MultiEd25519Signature } from "../../core/crypto/multiEd25519";
11
10
  import { MultiKey } from "../../core/crypto/multiKey";
@@ -4,7 +4,7 @@
4
4
  import { Serializer, Serializable } from "../../bcs/serializer";
5
5
  import { AccountAddress } from "../../core/accountAddress";
6
6
  import { AnyNumber } from "../../types";
7
- import { PublicKey } from "../../core/crypto/asymmetricCrypto";
7
+ import { PublicKey } from "../../core/crypto";
8
8
  import { MoveString, MoveVector, U64, U8 } from "../../bcs";
9
9
 
10
10
  /**