@aptos-labs/ts-sdk 6.2.0 → 6.3.1

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 (344) hide show
  1. package/dist/common/{account-DGpxrkAn.d.ts → account-2FUAPVPW.d.ts} +15 -4
  2. package/dist/common/chunk-L5DUJTE3.js +4 -0
  3. package/dist/common/chunk-L5DUJTE3.js.map +1 -0
  4. package/dist/common/cli/index.d.ts +1 -1
  5. package/dist/common/cli/index.js +1 -1
  6. package/dist/common/index.d.ts +22 -20
  7. package/dist/common/index.js +34 -34
  8. package/dist/common/index.js.map +1 -1
  9. package/dist/esm/{Ed25519Account-BCt2cu_M.d.mts → Ed25519Account-DpZh3fRy.d.mts} +1 -1
  10. package/dist/esm/account/AbstractKeylessAccount.d.mts +3 -3
  11. package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
  12. package/dist/esm/account/AbstractedAccount.d.mts +2 -2
  13. package/dist/esm/account/AbstractedAccount.mjs +1 -1
  14. package/dist/esm/account/Account.d.mts +2 -2
  15. package/dist/esm/account/Account.mjs +1 -1
  16. package/dist/esm/account/AccountUtils.d.mts +3 -3
  17. package/dist/esm/account/AccountUtils.mjs +1 -1
  18. package/dist/esm/account/DerivableAbstractedAccount.d.mts +2 -2
  19. package/dist/esm/account/DerivableAbstractedAccount.mjs +1 -1
  20. package/dist/esm/account/Ed25519Account.d.mts +2 -2
  21. package/dist/esm/account/Ed25519Account.mjs +1 -1
  22. package/dist/esm/account/EphemeralKeyPair.d.mts +1 -1
  23. package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
  24. package/dist/esm/account/FederatedKeylessAccount.d.mts +3 -3
  25. package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
  26. package/dist/esm/account/KeylessAccount.d.mts +3 -3
  27. package/dist/esm/account/KeylessAccount.mjs +1 -1
  28. package/dist/esm/account/MultiEd25519Account.d.mts +2 -2
  29. package/dist/esm/account/MultiEd25519Account.mjs +1 -1
  30. package/dist/esm/account/MultiKeyAccount.d.mts +3 -3
  31. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  32. package/dist/esm/account/SingleKeyAccount.d.mts +2 -2
  33. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  34. package/dist/esm/account/index.d.mts +3 -3
  35. package/dist/esm/account/index.mjs +1 -1
  36. package/dist/esm/account/utils.d.mts +1 -1
  37. package/dist/esm/account/utils.mjs +1 -1
  38. package/dist/esm/{account-Dg0ejXHy.d.mts → account-sIOs_9XJ.d.mts} +15 -4
  39. package/dist/esm/api/account/abstraction.d.mts +1 -1
  40. package/dist/esm/api/account/abstraction.mjs +1 -1
  41. package/dist/esm/api/account.d.mts +2 -2
  42. package/dist/esm/api/account.mjs +1 -1
  43. package/dist/esm/api/ans.d.mts +1 -1
  44. package/dist/esm/api/ans.mjs +1 -1
  45. package/dist/esm/api/aptos.d.mts +3 -3
  46. package/dist/esm/api/aptos.mjs +1 -1
  47. package/dist/esm/api/aptosConfig.d.mts +1 -1
  48. package/dist/esm/api/aptosConfig.mjs +1 -1
  49. package/dist/esm/api/coin.d.mts +1 -1
  50. package/dist/esm/api/coin.mjs +1 -1
  51. package/dist/esm/api/digitalAsset.d.mts +2 -2
  52. package/dist/esm/api/digitalAsset.mjs +1 -1
  53. package/dist/esm/api/faucet.d.mts +1 -1
  54. package/dist/esm/api/faucet.mjs +1 -1
  55. package/dist/esm/api/fungibleAsset.d.mts +2 -2
  56. package/dist/esm/api/fungibleAsset.mjs +1 -1
  57. package/dist/esm/api/general.d.mts +1 -1
  58. package/dist/esm/api/general.mjs +1 -1
  59. package/dist/esm/api/index.d.mts +3 -3
  60. package/dist/esm/api/index.mjs +1 -1
  61. package/dist/esm/api/keyless.d.mts +3 -3
  62. package/dist/esm/api/keyless.mjs +1 -1
  63. package/dist/esm/api/object.d.mts +1 -1
  64. package/dist/esm/api/object.mjs +1 -1
  65. package/dist/esm/api/staking.d.mts +1 -1
  66. package/dist/esm/api/staking.mjs +1 -1
  67. package/dist/esm/api/table.d.mts +1 -1
  68. package/dist/esm/api/table.mjs +1 -1
  69. package/dist/esm/api/transaction.d.mts +21 -19
  70. package/dist/esm/api/transaction.mjs +1 -1
  71. package/dist/esm/api/transactionSubmission/build.d.mts +1 -1
  72. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  73. package/dist/esm/api/transactionSubmission/helpers.d.mts +1 -1
  74. package/dist/esm/api/transactionSubmission/management.d.mts +2 -2
  75. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  76. package/dist/esm/api/transactionSubmission/sign.d.mts +2 -2
  77. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  78. package/dist/esm/api/transactionSubmission/simulate.d.mts +1 -1
  79. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  80. package/dist/esm/api/transactionSubmission/submit.d.mts +1 -1
  81. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  82. package/dist/esm/api/utils.d.mts +1 -1
  83. package/dist/esm/api/utils.mjs +1 -1
  84. package/dist/esm/bcs/consts.d.mts +1 -1
  85. package/dist/esm/bcs/deserializer.d.mts +1 -1
  86. package/dist/esm/bcs/index.d.mts +1 -1
  87. package/dist/esm/bcs/index.mjs +1 -1
  88. package/dist/esm/bcs/serializable/entryFunctionBytes.d.mts +1 -1
  89. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  90. package/dist/esm/bcs/serializable/fixedBytes.d.mts +1 -1
  91. package/dist/esm/bcs/serializable/fixedBytes.mjs +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/bcs/serializer.mjs +1 -1
  98. package/dist/esm/{chunk-LDK76MDN.mjs → chunk-226FBOWQ.mjs} +2 -2
  99. package/dist/esm/{chunk-Q4KYBAYN.mjs → chunk-2DQRUJUC.mjs} +2 -2
  100. package/dist/esm/chunk-2EBXCCLB.mjs +2 -0
  101. package/dist/esm/chunk-2EBXCCLB.mjs.map +1 -0
  102. package/dist/esm/{chunk-R7PCBRRT.mjs → chunk-2YA4KQUV.mjs} +2 -2
  103. package/dist/esm/{chunk-POQ4FT4E.mjs → chunk-3ZC6F5SJ.mjs} +2 -2
  104. package/dist/esm/{chunk-X4IR6WX6.mjs → chunk-4KEZEYCV.mjs} +2 -2
  105. package/dist/esm/chunk-6T2OBPIF.mjs +4 -0
  106. package/dist/esm/chunk-6T2OBPIF.mjs.map +1 -0
  107. package/dist/esm/{chunk-2VBY2V4Z.mjs → chunk-A5H5VKUI.mjs} +2 -2
  108. package/dist/esm/{chunk-NWP2VEMB.mjs → chunk-DPHBSAZQ.mjs} +2 -2
  109. package/dist/esm/{chunk-CD3EZCI5.mjs → chunk-F4RJMSAW.mjs} +2 -2
  110. package/dist/esm/{chunk-UYG4XVVO.mjs → chunk-FAOLAKLJ.mjs} +2 -2
  111. package/dist/esm/{chunk-5LMLIRGK.mjs → chunk-GJYLYE6R.mjs} +2 -2
  112. package/dist/esm/{chunk-C2KVLMPH.mjs → chunk-GYYSHYO5.mjs} +2 -2
  113. package/dist/esm/{chunk-ASFFADWS.mjs → chunk-IEW452EO.mjs} +2 -2
  114. package/dist/esm/chunk-IZF6POVR.mjs +4 -0
  115. package/dist/esm/chunk-IZF6POVR.mjs.map +1 -0
  116. package/dist/esm/chunk-KKPH2JUV.mjs +2 -0
  117. package/dist/esm/chunk-KKPH2JUV.mjs.map +1 -0
  118. package/dist/esm/{chunk-F4LHBGG2.mjs → chunk-LVZ7QMUH.mjs} +2 -2
  119. package/dist/esm/{chunk-T32P4APJ.mjs → chunk-MKTR4U2R.mjs} +2 -2
  120. package/dist/esm/{chunk-EIWPAECI.mjs → chunk-NHRPXEUE.mjs} +2 -2
  121. package/dist/esm/{chunk-YTFJ5W7U.mjs → chunk-NNXTS2GB.mjs} +2 -2
  122. package/dist/esm/{chunk-UPHD2B4I.mjs → chunk-NPWYZVHE.mjs} +2 -2
  123. package/dist/esm/{chunk-KOVWYU53.mjs → chunk-NTMFADQ7.mjs} +2 -2
  124. package/dist/esm/{chunk-A7SQEK23.mjs → chunk-QE5MOGUI.mjs} +2 -2
  125. package/dist/esm/chunk-RB2GC7FW.mjs +2 -0
  126. package/dist/esm/chunk-RUKFK3OC.mjs +2 -0
  127. package/dist/esm/chunk-RUKFK3OC.mjs.map +1 -0
  128. package/dist/esm/chunk-RYCI4VKO.mjs +2 -0
  129. package/dist/esm/{chunk-AUGTNOKZ.mjs.map → chunk-RYCI4VKO.mjs.map} +1 -1
  130. package/dist/esm/{chunk-TSPG5VED.mjs → chunk-RZNP3WG4.mjs} +2 -2
  131. package/dist/esm/{chunk-2VHA77EO.mjs → chunk-TBIK7DML.mjs} +2 -2
  132. package/dist/esm/chunk-UVNAHETD.mjs +2 -0
  133. package/dist/esm/{chunk-YJVBGKWM.mjs.map → chunk-UVNAHETD.mjs.map} +1 -1
  134. package/dist/esm/{chunk-E3DHFXN4.mjs → chunk-WOPHK7LB.mjs} +2 -2
  135. package/dist/esm/{chunk-H2T2SU5O.mjs → chunk-WZZ7PJ3X.mjs} +2 -2
  136. package/dist/esm/{chunk-QRW7MQDA.mjs → chunk-ZOSOF6ST.mjs} +2 -2
  137. package/dist/esm/cli/index.d.mts +1 -1
  138. package/dist/esm/cli/index.mjs +1 -1
  139. package/dist/esm/cli/localNode.mjs +1 -1
  140. package/dist/esm/cli/move.d.mts +1 -1
  141. package/dist/esm/client/core.d.mts +1 -1
  142. package/dist/esm/client/core.mjs +1 -1
  143. package/dist/esm/client/get.d.mts +1 -1
  144. package/dist/esm/client/get.mjs +1 -1
  145. package/dist/esm/client/index.d.mts +1 -1
  146. package/dist/esm/client/index.mjs +1 -1
  147. package/dist/esm/client/post.d.mts +1 -1
  148. package/dist/esm/client/post.mjs +1 -1
  149. package/dist/esm/core/account/index.d.mts +1 -1
  150. package/dist/esm/core/account/index.mjs +1 -1
  151. package/dist/esm/core/account/utils/address.d.mts +1 -1
  152. package/dist/esm/core/account/utils/address.mjs +1 -1
  153. package/dist/esm/core/account/utils/index.d.mts +1 -1
  154. package/dist/esm/core/account/utils/index.mjs +1 -1
  155. package/dist/esm/core/accountAddress.d.mts +1 -1
  156. package/dist/esm/core/accountAddress.mjs +1 -1
  157. package/dist/esm/core/authenticationKey.d.mts +1 -1
  158. package/dist/esm/core/authenticationKey.mjs +1 -1
  159. package/dist/esm/core/crypto/abstraction.d.mts +1 -1
  160. package/dist/esm/core/crypto/abstraction.mjs +1 -1
  161. package/dist/esm/core/crypto/deserializationUtils.d.mts +1 -1
  162. package/dist/esm/core/crypto/deserializationUtils.mjs +1 -1
  163. package/dist/esm/core/crypto/ed25519.d.mts +1 -1
  164. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  165. package/dist/esm/core/crypto/ephemeral.d.mts +1 -1
  166. package/dist/esm/core/crypto/ephemeral.mjs +1 -1
  167. package/dist/esm/core/crypto/federatedKeyless.d.mts +2 -2
  168. package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
  169. package/dist/esm/core/crypto/index.d.mts +2 -2
  170. package/dist/esm/core/crypto/index.mjs +1 -1
  171. package/dist/esm/core/crypto/keyless.d.mts +2 -2
  172. package/dist/esm/core/crypto/keyless.mjs +1 -1
  173. package/dist/esm/core/crypto/multiEd25519.d.mts +1 -1
  174. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  175. package/dist/esm/core/crypto/multiKey.d.mts +1 -1
  176. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  177. package/dist/esm/core/crypto/privateKey.d.mts +1 -1
  178. package/dist/esm/core/crypto/privateKey.mjs +1 -1
  179. package/dist/esm/core/crypto/proof.d.mts +1 -1
  180. package/dist/esm/core/crypto/proof.mjs +1 -1
  181. package/dist/esm/core/crypto/publicKey.d.mts +1 -1
  182. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  183. package/dist/esm/core/crypto/secp256k1.d.mts +1 -1
  184. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  185. package/dist/esm/core/crypto/secp256r1.d.mts +1 -1
  186. package/dist/esm/core/crypto/secp256r1.mjs +1 -1
  187. package/dist/esm/core/crypto/signature.d.mts +1 -1
  188. package/dist/esm/core/crypto/signature.mjs +1 -1
  189. package/dist/esm/core/crypto/singleKey.d.mts +1 -1
  190. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  191. package/dist/esm/core/crypto/types.d.mts +1 -1
  192. package/dist/esm/core/crypto/utils.d.mts +1 -1
  193. package/dist/esm/core/crypto/utils.mjs +1 -1
  194. package/dist/esm/core/hex.d.mts +1 -1
  195. package/dist/esm/core/index.d.mts +2 -2
  196. package/dist/esm/core/index.mjs +1 -1
  197. package/dist/esm/errors/index.d.mts +1 -1
  198. package/dist/esm/errors/index.mjs +1 -1
  199. package/dist/esm/{federatedKeyless-BYLu31Sa.d.mts → federatedKeyless-Cuo0IGJ6.d.mts} +1 -1
  200. package/dist/esm/index.d.mts +3 -3
  201. package/dist/esm/index.mjs +1 -1
  202. package/dist/esm/internal/abstraction.d.mts +1 -1
  203. package/dist/esm/internal/abstraction.mjs +1 -1
  204. package/dist/esm/internal/account.d.mts +2 -2
  205. package/dist/esm/internal/account.mjs +1 -1
  206. package/dist/esm/internal/ans.d.mts +1 -1
  207. package/dist/esm/internal/ans.mjs +1 -1
  208. package/dist/esm/internal/coin.d.mts +1 -1
  209. package/dist/esm/internal/coin.mjs +1 -1
  210. package/dist/esm/internal/digitalAsset.d.mts +2 -2
  211. package/dist/esm/internal/digitalAsset.mjs +1 -1
  212. package/dist/esm/internal/faucet.d.mts +1 -1
  213. package/dist/esm/internal/faucet.mjs +1 -1
  214. package/dist/esm/internal/fungibleAsset.d.mts +2 -2
  215. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  216. package/dist/esm/internal/general.d.mts +1 -1
  217. package/dist/esm/internal/general.mjs +1 -1
  218. package/dist/esm/internal/keyless.d.mts +3 -3
  219. package/dist/esm/internal/keyless.mjs +1 -1
  220. package/dist/esm/internal/object.d.mts +1 -1
  221. package/dist/esm/internal/object.mjs +1 -1
  222. package/dist/esm/internal/staking.d.mts +1 -1
  223. package/dist/esm/internal/staking.mjs +1 -1
  224. package/dist/esm/internal/table.d.mts +1 -1
  225. package/dist/esm/internal/table.mjs +1 -1
  226. package/dist/esm/internal/transaction.d.mts +1 -1
  227. package/dist/esm/internal/transaction.mjs +1 -1
  228. package/dist/esm/internal/transactionSubmission.d.mts +2 -2
  229. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  230. package/dist/esm/internal/utils/index.d.mts +1 -1
  231. package/dist/esm/internal/utils/index.mjs +1 -1
  232. package/dist/esm/internal/utils/utils.d.mts +1 -1
  233. package/dist/esm/internal/utils/utils.mjs +1 -1
  234. package/dist/esm/internal/view.d.mts +1 -1
  235. package/dist/esm/internal/view.mjs +1 -1
  236. package/dist/esm/transactions/authenticator/account.d.mts +1 -1
  237. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  238. package/dist/esm/transactions/authenticator/index.d.mts +1 -1
  239. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  240. package/dist/esm/transactions/authenticator/transaction.d.mts +1 -1
  241. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  242. package/dist/esm/transactions/index.d.mts +1 -1
  243. package/dist/esm/transactions/index.mjs +1 -1
  244. package/dist/esm/transactions/instances/chainId.d.mts +1 -1
  245. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  246. package/dist/esm/transactions/instances/identifier.d.mts +1 -1
  247. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  248. package/dist/esm/transactions/instances/index.d.mts +1 -1
  249. package/dist/esm/transactions/instances/index.mjs +1 -1
  250. package/dist/esm/transactions/instances/moduleId.d.mts +1 -1
  251. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  252. package/dist/esm/transactions/instances/multiAgentTransaction.d.mts +1 -1
  253. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  254. package/dist/esm/transactions/instances/rawTransaction.d.mts +1 -1
  255. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  256. package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +1 -1
  257. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  258. package/dist/esm/transactions/instances/signedTransaction.d.mts +1 -1
  259. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  260. package/dist/esm/transactions/instances/simpleTransaction.d.mts +1 -1
  261. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  262. package/dist/esm/transactions/instances/transactionArgument.d.mts +1 -1
  263. package/dist/esm/transactions/instances/transactionPayload.d.mts +1 -1
  264. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  265. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +2 -2
  266. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  267. package/dist/esm/transactions/management/index.d.mts +2 -2
  268. package/dist/esm/transactions/management/index.mjs +1 -1
  269. package/dist/esm/transactions/management/transactionWorker.d.mts +2 -2
  270. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  271. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +1 -1
  272. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  273. package/dist/esm/transactions/transactionBuilder/index.d.mts +1 -1
  274. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  275. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +1 -1
  276. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  277. package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +1 -1
  278. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  279. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +1 -1
  280. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  281. package/dist/esm/transactions/typeTag/index.d.mts +1 -1
  282. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  283. package/dist/esm/transactions/typeTag/parser.d.mts +1 -1
  284. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  285. package/dist/esm/transactions/types.d.mts +1 -1
  286. package/dist/esm/types/index.d.mts +1 -1
  287. package/dist/esm/types/index.mjs +1 -1
  288. package/dist/esm/types/types.d.mts +1 -1
  289. package/dist/esm/utils/helpers.d.mts +1 -1
  290. package/dist/esm/utils/helpers.mjs +1 -1
  291. package/dist/esm/utils/index.d.mts +1 -1
  292. package/dist/esm/utils/index.mjs +1 -1
  293. package/dist/esm/utils/normalizeBundle.d.mts +1 -1
  294. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  295. package/dist/esm/version.d.mts +1 -1
  296. package/dist/esm/version.mjs +1 -1
  297. package/package.json +1 -1
  298. package/src/api/transaction.ts +19 -17
  299. package/src/bcs/serializable/movePrimitives.ts +21 -15
  300. package/src/bcs/serializable/moveStructs.ts +5 -5
  301. package/src/bcs/serializer.ts +19 -0
  302. package/src/core/accountAddress.ts +3 -3
  303. package/src/transactions/transactionBuilder/remoteAbi.ts +10 -14
  304. package/src/version.ts +1 -1
  305. package/dist/common/chunk-2VR6ONNW.js +0 -4
  306. package/dist/common/chunk-2VR6ONNW.js.map +0 -1
  307. package/dist/esm/chunk-5HHC2YG4.mjs +0 -2
  308. package/dist/esm/chunk-66F7RP7K.mjs +0 -2
  309. package/dist/esm/chunk-66F7RP7K.mjs.map +0 -1
  310. package/dist/esm/chunk-6CD6PDFJ.mjs +0 -4
  311. package/dist/esm/chunk-6CD6PDFJ.mjs.map +0 -1
  312. package/dist/esm/chunk-AUGTNOKZ.mjs +0 -2
  313. package/dist/esm/chunk-BT742BFQ.mjs +0 -2
  314. package/dist/esm/chunk-BT742BFQ.mjs.map +0 -1
  315. package/dist/esm/chunk-FDHHQUS3.mjs +0 -4
  316. package/dist/esm/chunk-FDHHQUS3.mjs.map +0 -1
  317. package/dist/esm/chunk-WFZFTRRS.mjs +0 -2
  318. package/dist/esm/chunk-WFZFTRRS.mjs.map +0 -1
  319. package/dist/esm/chunk-YJVBGKWM.mjs +0 -2
  320. /package/dist/esm/{chunk-LDK76MDN.mjs.map → chunk-226FBOWQ.mjs.map} +0 -0
  321. /package/dist/esm/{chunk-Q4KYBAYN.mjs.map → chunk-2DQRUJUC.mjs.map} +0 -0
  322. /package/dist/esm/{chunk-R7PCBRRT.mjs.map → chunk-2YA4KQUV.mjs.map} +0 -0
  323. /package/dist/esm/{chunk-POQ4FT4E.mjs.map → chunk-3ZC6F5SJ.mjs.map} +0 -0
  324. /package/dist/esm/{chunk-X4IR6WX6.mjs.map → chunk-4KEZEYCV.mjs.map} +0 -0
  325. /package/dist/esm/{chunk-2VBY2V4Z.mjs.map → chunk-A5H5VKUI.mjs.map} +0 -0
  326. /package/dist/esm/{chunk-NWP2VEMB.mjs.map → chunk-DPHBSAZQ.mjs.map} +0 -0
  327. /package/dist/esm/{chunk-CD3EZCI5.mjs.map → chunk-F4RJMSAW.mjs.map} +0 -0
  328. /package/dist/esm/{chunk-UYG4XVVO.mjs.map → chunk-FAOLAKLJ.mjs.map} +0 -0
  329. /package/dist/esm/{chunk-5LMLIRGK.mjs.map → chunk-GJYLYE6R.mjs.map} +0 -0
  330. /package/dist/esm/{chunk-C2KVLMPH.mjs.map → chunk-GYYSHYO5.mjs.map} +0 -0
  331. /package/dist/esm/{chunk-ASFFADWS.mjs.map → chunk-IEW452EO.mjs.map} +0 -0
  332. /package/dist/esm/{chunk-F4LHBGG2.mjs.map → chunk-LVZ7QMUH.mjs.map} +0 -0
  333. /package/dist/esm/{chunk-T32P4APJ.mjs.map → chunk-MKTR4U2R.mjs.map} +0 -0
  334. /package/dist/esm/{chunk-EIWPAECI.mjs.map → chunk-NHRPXEUE.mjs.map} +0 -0
  335. /package/dist/esm/{chunk-YTFJ5W7U.mjs.map → chunk-NNXTS2GB.mjs.map} +0 -0
  336. /package/dist/esm/{chunk-UPHD2B4I.mjs.map → chunk-NPWYZVHE.mjs.map} +0 -0
  337. /package/dist/esm/{chunk-KOVWYU53.mjs.map → chunk-NTMFADQ7.mjs.map} +0 -0
  338. /package/dist/esm/{chunk-A7SQEK23.mjs.map → chunk-QE5MOGUI.mjs.map} +0 -0
  339. /package/dist/esm/{chunk-5HHC2YG4.mjs.map → chunk-RB2GC7FW.mjs.map} +0 -0
  340. /package/dist/esm/{chunk-TSPG5VED.mjs.map → chunk-RZNP3WG4.mjs.map} +0 -0
  341. /package/dist/esm/{chunk-2VHA77EO.mjs.map → chunk-TBIK7DML.mjs.map} +0 -0
  342. /package/dist/esm/{chunk-E3DHFXN4.mjs.map → chunk-WOPHK7LB.mjs.map} +0 -0
  343. /package/dist/esm/{chunk-H2T2SU5O.mjs.map → chunk-WZZ7PJ3X.mjs.map} +0 -0
  344. /package/dist/esm/{chunk-QRW7MQDA.mjs.map → chunk-ZOSOF6ST.mjs.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/greg/git/aptos-ts-sdk/dist/common/index.js","../../src/bcs/deserializer.ts","../../src/errors/index.ts","../../src/client/core.ts","../../src/core/crypto/multiKey.ts","../../src/types/generated/queries.ts","../../src/internal/table.ts"],"names":["TEXT_DECODER","MAX_DESERIALIZE_BYTES_LENGTH","Deserializer","_Deserializer","data","hex","Hex","length","bytes","value","type","len"],"mappings":"AAAA,2sCAAo4B,ICU93BA,EAAAA,CAAe,IAAI,WAAA,CAOnBC,EAAAA,CAA+B,EAAA,CAAK,IAAA,CAAO,IAAA,CAuCpCC,CAAAA,wBAAN,MAAMC,CAAa,CAaxB,WAAA,CAAYC,CAAAA,CAAkB,CAE5B,IAAA,CAAK,MAAA,CAAS,IAAI,WAAA,CAAYA,CAAAA,CAAK,MAAM,CAAA,CACzC,IAAI,UAAA,CAAW,IAAA,CAAK,MAAM,CAAA,CAAE,GAAA,CAAIA,CAAAA,CAAM,CAAC,CAAA,CACvC,IAAA,CAAK,MAAA,CAAS,CAChB,CAEA,OAAO,OAAA,CAAQC,CAAAA,CAA6B,CAC1C,IAAMD,CAAAA,CAAOE,kBAAAA,CAAI,oBAAA,CAAqBD,CAAG,CAAA,CACzC,OAAO,IAAIF,CAAAA,CAAaC,CAAI,CAC9B,CAgBQ,IAAA,CAAKG,CAAAA,CAA4B,CACvC,EAAA,CAAI,IAAA,CAAK,MAAA,CAASA,CAAAA,CAAS,IAAA,CAAK,MAAA,CAAO,UAAA,CACrC,MAAM,IAAI,KAAA,CAAM,8BAA8B,CAAA,CAMhD,IAAMC,CAAAA,CAAQ,IAAI,UAAA,CAAW,IAAA,CAAK,MAAA,CAAQ,IAAA,CAAK,MAAA,CAAQD,CAAM,CAAA,CAC7D,OAAA,IAAA,CAAK,MAAA,EAAUA,CAAAA,CACRC,CACT,CAWA,SAAA,CAAA,CAAoB,CAClB,OAAO,IAAA,CAAK,MAAA,CAAO,UAAA,CAAa,IAAA,CAAK,MACvC,CASA,cAAA,CAAA,CAAuB,CACrB,EAAA,CAAI,IAAA,CAAK,SAAA,CAAU,CAAA,GAAM,CAAA,CACvB,MAAM,IAAI,KAAA,CAAM,4BAA4B,CAEhD,CAiBA,cAAA,CAAA,CAAyB,CACvB,IAAMC,CAAAA,CAAQ,IAAA,CAAK,gBAAA,CAAiB,CAAA,CACpC,OAAOT,EAAAA,CAAa,MAAA,CAAOS,CAAK,CAClC,CAeA,oBAAA,CAAA,CAA2C,CACzC,OAAO,IAAA,CAAK,iBAAA,CAAkB,QAAQ,CACxC,CA4CA,iBAAA,CACEC,CAAAA,CACAC,CAAAA,CACqC,CAErC,EAAA,CADe,IAAA,CAAK,eAAA,CAAgB,CAAA,CAGpC,CAAA,EAAA,CAAID,CAAAA,GAAS,QAAA,CACX,OAAO,IAAA,CAAK,cAAA,CAAe,CAAA,CAE7B,EAAA,CAAIA,CAAAA,GAAS,OAAA,CACX,OAAO,IAAA,CAAK,gBAAA,CAAiB,CAAA,CAE/B,EAAA,CAAIA,CAAAA,GAAS,YAAA,CAAc,CACzB,EAAA,CAAIC,CAAAA,GAAQ,KAAA,CAAA,CACV,MAAM,IAAI,KAAA,CAAM,iCAAiC,CAAA,CAEnD,OAAO,IAAA,CAAK,qBAAA,CAAsBA,CAAG,CACvC,CAEA,OAAO,IAAA,CAAK,WAAA,CAAYD,CAAI,CAAA,CAC9B,CAaA,gBAAA,CAAA,CAA+B,CAC7B,IAAMC,CAAAA,CAAM,IAAA,CAAK,uBAAA,CAAwB,CAAA,CAEzC,EAAA,CAAIA,CAAAA,CAAMV,EAAAA,CACR,MAAM,IAAI,KAAA,CACR,CAAA,yCAAA,EAA4CU,CAAG,CAAA,yBAAA,EAA4BV,EAA4B,CAAA,CAAA;AC2D/F,SAAA;AAGA,SAAA;AAEA,eAAA;AAEF,OAAA;AChN2B,2BAAA;AC0DuB,0BAAA;AAyOlB,sCAAA;AC7YE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmBL,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaW,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgDT,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUT,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWD,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkCiB,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmCf,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYW,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYG,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYd,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaM,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASJ,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaI,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOV,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBc,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmBF,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkCH,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0BF,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBhB,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBa,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQR,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASD,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBI,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAcL,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYQ,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYZ,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACpZV,IAAA","file":"/Users/greg/git/aptos-ts-sdk/dist/common/index.js","sourcesContent":[null,"// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { MAX_U32_NUMBER } from \"./consts\";\nimport { Uint8, Uint16, Uint32, Uint64, Uint128, Uint256, HexInput } from \"../types\";\nimport { Hex } from \"../core/hex\";\n\n/**\n * Shared TextDecoder instance for string deserialization to avoid repeated instantiation.\n */\nconst TEXT_DECODER = new TextDecoder();\n\n/**\n * Maximum allowed length for deserialized byte arrays and strings.\n * This prevents memory exhaustion attacks from malformed BCS data.\n * Set to 10MB which should be sufficient for any legitimate use case.\n */\nconst MAX_DESERIALIZE_BYTES_LENGTH = 10 * 1024 * 1024; // 10MB\n\n/**\n * This interface exists to define Deserializable<T> inputs for functions that\n * deserialize a byte buffer into a type T.\n * It is not intended to be implemented or extended, because Typescript has no support\n * for static methods in interfaces.\n *\n * @template T - The type that this will deserialize into.\n * @group Implementation\n * @category BCS\n */\nexport interface Deserializable<T> {\n /**\n * Deserializes the buffered bytes into an instance of the specified class type.\n * This function provides an alternative syntax for deserialization, allowing users to call\n * `deserializer.deserialize(MyClass)` instead of `MyClass.deserialize(deserializer)`.\n *\n * @param deserializer - The deserializer instance with the buffered bytes.\n * @returns The deserialized value of class type T.\n * @example\n * ```typescript\n * const deserializer = new Deserializer(new Uint8Array([1, 2, 3]));\n * const value = deserializer.deserialize(MyClass); // where MyClass has a `deserialize` function\n * // value is now an instance of MyClass\n * // equivalent to `const value = MyClass.deserialize(deserializer)`\n * ```\n * @group Implementation\n * @category BCS\n */\n deserialize(deserializer: Deserializer): T;\n}\n\n/**\n * A class that provides methods for deserializing various data types from a byte buffer.\n * It supports deserialization of primitive types, strings, and complex objects using a BCS (Binary Common Serialization) layout.\n * @group Implementation\n * @category BCS\n */\nexport class Deserializer {\n private buffer: ArrayBuffer;\n\n private offset: number;\n\n /**\n * Creates a new instance of the class with a copy of the provided data buffer.\n * This prevents outside mutation of the buffer.\n *\n * @param data - The data to be copied into the internal buffer as a Uint8Array.\n * @group Implementation\n * @category BCS\n */\n constructor(data: Uint8Array) {\n // copies data to prevent outside mutation of buffer.\n this.buffer = new ArrayBuffer(data.length);\n new Uint8Array(this.buffer).set(data, 0);\n this.offset = 0;\n }\n\n static fromHex(hex: HexInput): Deserializer {\n const data = Hex.hexInputToUint8Array(hex);\n return new Deserializer(data);\n }\n\n /**\n * Reads a specified number of bytes from the buffer and advances the offset.\n * Returns a view into the buffer rather than copying for better performance.\n *\n * SECURITY NOTE: This returns a view, not a copy. Callers that expose the result\n * externally MUST call .slice() to create a copy. Internal numeric deserializers\n * (deserializeU8, deserializeU16, etc.) only read values and don't expose the view.\n * deserializeBytes() and deserializeFixedBytes() call .slice() before returning.\n *\n * @param length - The number of bytes to read from the buffer.\n * @throws Throws an error if the read operation exceeds the buffer's length.\n * @group Implementation\n * @category BCS\n */\n private read(length: number): Uint8Array {\n if (this.offset + length > this.buffer.byteLength) {\n throw new Error(\"Reached to the end of buffer\");\n }\n\n // Use subarray to return a view instead of slice which copies\n // SECURITY: View is safe because numeric deserializers only read values,\n // and byte deserializers call .slice() before returning to caller\n const bytes = new Uint8Array(this.buffer, this.offset, length);\n this.offset += length;\n return bytes;\n }\n\n /**\n * Returns the number of bytes remaining in the buffer.\n *\n * This information is useful to determine if there's more data to be read.\n *\n * @returns The number of bytes remaining in the buffer.\n * @group Implementation\n * @category BCS\n */\n remaining(): number {\n return this.buffer.byteLength - this.offset;\n }\n\n /**\n * Asserts that the buffer has no remaining bytes.\n *\n * @throws {Error} Throws an error if there are remaining bytes in the buffer.\n * @group Implementation\n * @category BCS\n */\n assertFinished(): void {\n if (this.remaining() !== 0) {\n throw new Error(\"Buffer has remaining bytes\");\n }\n }\n\n /**\n * Deserializes a UTF-8 encoded string from a byte array. It first reads the length of the string in bytes,\n * followed by the actual byte content, and decodes it into a string.\n *\n * BCS layout for \"string\": string_length | string_content\n * where string_length is a u32 integer encoded as a uleb128 integer, equal to the number of bytes in string_content.\n *\n * @example\n * ```typescript\n * const deserializer = new Deserializer(new Uint8Array([8, 49, 50, 51, 52, 97, 98, 99, 100]));\n * assert(deserializer.deserializeStr() === \"1234abcd\");\n * ```\n * @group Implementation\n * @category BCS\n */\n deserializeStr(): string {\n const value = this.deserializeBytes();\n return TEXT_DECODER.decode(value);\n }\n\n /**\n * @deprecated use `deserializeOption(\"string\")` instead.\n *\n * The BCS layout for Optional<String> is 0 if none, else 1 followed by the string length and string content.\n * @returns The deserialized string if it exists, otherwise undefined.\n * @example\n * ```typescript\n * const deserializer = new Deserializer(new Uint8Array([0x00]));\n * assert(deserializer.deserializeOptionStr() === undefined);\n * const deserializer = new Deserializer(new Uint8Array([1, 8, 49, 50, 51, 52, 97, 98, 99, 100]));\n * assert(deserializer.deserializeOptionStr() === \"1234abcd\");\n * ```\n */\n deserializeOptionStr(): string | undefined {\n return this.deserializeOption(\"string\");\n }\n\n /**\n * Deserializes an optional value from the buffer.\n *\n * The BCS layout for Optional<T> starts with a boolean byte (0 if none, 1 if some),\n * followed by the value if present.\n *\n * @template T - The type of the value to deserialize\n * @param type - Either a Deserializable class or one of the string literals: \"string\", \"bytes\", or \"fixedBytes\"\n * @param len - Required length when type is \"fixedBytes\", ignored otherwise\n * @returns The deserialized value if present, undefined otherwise\n *\n * @throws {Error} When \"fixedBytes\" is specified without a length\n *\n * @example\n * ```typescript\n * // Deserialize an optional string\n * const deserializer = new Deserializer(new Uint8Array([1, 3, 97, 98, 99]));\n * const optStr = deserializer.deserializeOption(\"string\");\n * // optStr === \"abc\"\n *\n * // Deserialize an optional custom type\n * const deserializer = new Deserializer(new Uint8Array([0]));\n * const optValue = deserializer.deserializeOption(MyClass);\n * // optValue === undefined\n *\n * // Deserialize optional bytes\n * const deserializer = new Deserializer(new Uint8Array([1, 3, 1, 2, 3]));\n * const optBytes = deserializer.deserializeOption(\"bytes\");\n * // optBytes === Uint8Array[1, 2, 3]\n *\n * // Deserialize optional fixed bytes\n * const deserializer = new Deserializer(new Uint8Array([1, 1, 2, 3, 4]));\n * const optBytes = deserializer.deserializeOption(\"fixedBytes\", 4);\n * // optBytes === Uint8Array[1, 2, 3, 4]\n * ```\n * @group Implementation\n * @category BCS\n */\n deserializeOption(type: \"string\"): string | undefined;\n deserializeOption(type: \"bytes\"): Uint8Array | undefined;\n deserializeOption(type: \"fixedBytes\", len: number): Uint8Array | undefined;\n deserializeOption<T>(type: Deserializable<T>): T | undefined;\n deserializeOption<T>(\n type: Deserializable<T> | \"string\" | \"bytes\" | \"fixedBytes\",\n len?: number,\n ): T | string | Uint8Array | undefined {\n const exists = this.deserializeBool();\n if (!exists) return undefined;\n\n if (type === \"string\") {\n return this.deserializeStr();\n }\n if (type === \"bytes\") {\n return this.deserializeBytes();\n }\n if (type === \"fixedBytes\") {\n if (len === undefined) {\n throw new Error(\"Fixed bytes length not provided\");\n }\n return this.deserializeFixedBytes(len);\n }\n\n return this.deserialize(type);\n }\n\n /**\n * Deserializes an array of bytes.\n *\n * The BCS layout for \"bytes\" consists of a bytes_length followed by the bytes themselves, where bytes_length is a u32 integer\n * encoded as a uleb128 integer, indicating the length of the bytes array.\n *\n * @returns {Uint8Array} The deserialized array of bytes (a copy, safe to modify).\n * @throws {Error} If the length exceeds the maximum allowed (10MB) to prevent memory exhaustion.\n * @group Implementation\n * @category BCS\n */\n deserializeBytes(): Uint8Array {\n const len = this.deserializeUleb128AsU32();\n // Security: Prevent memory exhaustion from malformed data\n if (len > MAX_DESERIALIZE_BYTES_LENGTH) {\n throw new Error(\n `Deserialization error: byte array length ${len} exceeds maximum allowed ${MAX_DESERIALIZE_BYTES_LENGTH}`,\n );\n }\n // Return a copy so caller can safely modify without affecting buffer\n return this.read(len).slice();\n }\n\n /**\n * Deserializes an array of bytes of a specified length.\n *\n * @param len - The number of bytes to read from the source.\n * @returns {Uint8Array} The deserialized array of bytes (a copy, safe to modify).\n * @group Implementation\n * @category BCS\n */\n deserializeFixedBytes(len: number): Uint8Array {\n // Return a copy so caller can safely modify without affecting buffer\n return this.read(len).slice();\n }\n\n /**\n * Deserializes a boolean value from a byte stream.\n *\n * The BCS layout for a boolean uses one byte, where \"0x01\" represents true and \"0x00\" represents false.\n * An error is thrown if the byte value is not valid.\n *\n * @returns The deserialized boolean value.\n * @throws Throws an error if the boolean value is invalid.\n * @group Implementation\n * @category BCS\n */\n deserializeBool(): boolean {\n const bool = this.read(1)[0];\n if (bool !== 1 && bool !== 0) {\n throw new Error(\"Invalid boolean value\");\n }\n return bool === 1;\n }\n\n /**\n * Deserializes a uint8 number from the binary data.\n *\n * BCS layout for \"uint8\": One byte. Binary format in little-endian representation.\n *\n * @returns {number} The deserialized uint8 number.\n * @group Implementation\n * @category BCS\n */\n deserializeU8(): Uint8 {\n return this.read(1)[0];\n }\n\n /**\n * Deserializes a uint16 number from a binary format in little-endian representation.\n *\n * BCS layout for \"uint16\": Two bytes.\n * @example\n * ```typescript\n * const deserializer = new Deserializer(new Uint8Array([0x34, 0x12]));\n * assert(deserializer.deserializeU16() === 4660);\n * ```\n * @group Implementation\n * @category BCS\n */\n deserializeU16(): Uint16 {\n const bytes = this.read(2);\n return new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength).getUint16(0, true);\n }\n\n /**\n * Deserializes a uint32 number from a binary format in little-endian representation.\n *\n * BCS layout for \"uint32\": Four bytes.\n * @example\n * ```typescript\n * const deserializer = new Deserializer(new Uint8Array([0x78, 0x56, 0x34, 0x12]));\n * assert(deserializer.deserializeU32() === 305419896);\n * ```\n * @group Implementation\n * @category BCS\n */\n deserializeU32(): Uint32 {\n const bytes = this.read(4);\n return new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength).getUint32(0, true);\n }\n\n /**\n * Deserializes a uint64 number.\n *\n * This function combines two 32-bit values to return a 64-bit unsigned integer in little-endian representation.\n * @example\n * ```typescript\n * const deserializer = new Deserializer(new Uint8Array([0x00, 0xEF, 0xCD, 0xAB, 0x78, 0x56, 0x34, 0x12]));\n * assert(deserializer.deserializeU64() === 1311768467750121216);\n * ```\n * @group Implementation\n * @category BCS\n */\n deserializeU64(): Uint64 {\n const low = this.deserializeU32();\n const high = this.deserializeU32();\n\n // combine the two 32-bit values and return (little endian)\n return BigInt((BigInt(high) << BigInt(32)) | BigInt(low));\n }\n\n /**\n * Deserializes a uint128 number from its binary representation.\n * This function combines two 64-bit values to return a single uint128 value in little-endian format.\n *\n * @returns {BigInt} The deserialized uint128 number.\n * @group Implementation\n * @category BCS\n */\n deserializeU128(): Uint128 {\n const low = this.deserializeU64();\n const high = this.deserializeU64();\n\n // combine the two 64-bit values and return (little endian)\n return BigInt((high << BigInt(64)) | low);\n }\n\n /**\n * Deserializes a uint256 number from its binary representation.\n *\n * The BCS layout for \"uint256\" consists of thirty-two bytes in little-endian format.\n *\n * @returns {BigInt} The deserialized uint256 number.\n * @group Implementation\n * @category BCS\n */\n deserializeU256(): Uint256 {\n const low = this.deserializeU128();\n const high = this.deserializeU128();\n\n // combine the two 128-bit values and return (little endian)\n return BigInt((high << BigInt(128)) | low);\n }\n\n /**\n * Deserializes an 8-bit signed integer from the binary data.\n * BCS layout for \"int8\": One byte. Binary format in little-endian representation.\n *\n * @returns {number} The deserialized int8 number.\n * @group Implementation\n * @category BCS\n */\n deserializeI8(): number {\n const bytes = this.read(1);\n return new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength).getInt8(0);\n }\n\n /**\n * Deserializes a 16-bit signed integer from a binary format in little-endian representation.\n * BCS layout for \"int16\": Two bytes.\n *\n * @returns {number} The deserialized int16 number.\n * @group Implementation\n * @category BCS\n */\n deserializeI16(): number {\n const bytes = this.read(2);\n return new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength).getInt16(0, true);\n }\n\n /**\n * Deserializes a 32-bit signed integer from a binary format in little-endian representation.\n * BCS layout for \"int32\": Four bytes.\n *\n * @returns {number} The deserialized int32 number.\n * @group Implementation\n * @category BCS\n */\n deserializeI32(): number {\n const bytes = this.read(4);\n return new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength).getInt32(0, true);\n }\n\n /**\n * Deserializes a 64-bit signed integer.\n * This function combines two 32-bit values to return a 64-bit signed integer in little-endian representation.\n *\n * @returns {bigint} The deserialized int64 number.\n * @group Implementation\n * @category BCS\n */\n deserializeI64(): bigint {\n const low = this.deserializeU32();\n const high = this.deserializeU32();\n\n // combine the two 32-bit values (little endian)\n const unsigned = BigInt((BigInt(high) << BigInt(32)) | BigInt(low));\n\n // Convert from unsigned to signed using two's complement\n const signBit = BigInt(1) << BigInt(63);\n if (unsigned >= signBit) {\n return unsigned - (BigInt(1) << BigInt(64));\n }\n return unsigned;\n }\n\n /**\n * Deserializes a 128-bit signed integer from its binary representation.\n * This function combines two 64-bit values to return a single int128 value in little-endian format.\n *\n * @returns {bigint} The deserialized int128 number.\n * @group Implementation\n * @category BCS\n */\n deserializeI128(): bigint {\n const low = this.deserializeU64();\n const high = this.deserializeU64();\n\n // combine the two 64-bit values (little endian)\n const unsigned = BigInt((high << BigInt(64)) | low);\n\n // Convert from unsigned to signed using two's complement\n const signBit = BigInt(1) << BigInt(127);\n if (unsigned >= signBit) {\n return unsigned - (BigInt(1) << BigInt(128));\n }\n return unsigned;\n }\n\n /**\n * Deserializes a 256-bit signed integer from its binary representation.\n * BCS layout for \"int256\": Thirty-two bytes in little-endian format.\n *\n * @returns {bigint} The deserialized int256 number.\n * @group Implementation\n * @category BCS\n */\n deserializeI256(): bigint {\n const low = this.deserializeU128();\n const high = this.deserializeU128();\n\n // combine the two 128-bit values (little endian)\n const unsigned = BigInt((high << BigInt(128)) | low);\n\n // Convert from unsigned to signed using two's complement\n const signBit = BigInt(1) << BigInt(255);\n if (unsigned >= signBit) {\n return unsigned - (BigInt(1) << BigInt(256));\n }\n return unsigned;\n }\n\n /**\n * Deserializes a uleb128 encoded uint32 number.\n *\n * This function is used for interpreting lengths of variable-length sequences and tags of enum values in BCS encoding.\n *\n * @throws {Error} Throws an error if the parsed value exceeds the maximum uint32 number.\n * @throws {Error} Throws an error if the uleb128 encoding is malformed (too many bytes).\n * @returns {number} The deserialized uint32 value.\n * @group Implementation\n * @category BCS\n */\n deserializeUleb128AsU32(): Uint32 {\n let value: bigint = BigInt(0);\n let shift = 0;\n // Maximum 5 bytes for uleb128-encoded u32 (7 bits per byte, 5*7=35 bits > 32 bits needed)\n const MAX_ULEB128_BYTES = 5;\n let bytesRead = 0;\n\n while (bytesRead < MAX_ULEB128_BYTES) {\n const byte = this.deserializeU8();\n bytesRead += 1;\n\n value |= BigInt(byte & 0x7f) << BigInt(shift);\n\n // Early overflow check before continuing\n if (value > MAX_U32_NUMBER) {\n throw new Error(\"Overflow while parsing uleb128-encoded uint32 value\");\n }\n\n if ((byte & 0x80) === 0) {\n break;\n }\n\n shift += 7;\n }\n\n // If we read MAX_ULEB128_BYTES and the last byte had continuation bit set, it's malformed\n if (bytesRead === MAX_ULEB128_BYTES && value > MAX_U32_NUMBER) {\n throw new Error(\"Overflow while parsing uleb128-encoded uint32 value\");\n }\n\n return Number(value);\n }\n\n /**\n * Helper function that primarily exists to support alternative syntax for deserialization.\n * That is, if we have a `const deserializer: new Deserializer(...)`, instead of having to use\n * `MyClass.deserialize(deserializer)`, we can call `deserializer.deserialize(MyClass)`.\n *\n * @example const deserializer = new Deserializer(new Uint8Array([1, 2, 3]));\n * const value = deserializer.deserialize(MyClass); // where MyClass has a `deserialize` function\n * // value is now an instance of MyClass\n * // equivalent to `const value = MyClass.deserialize(deserializer)`\n * @param cls The BCS-deserializable class to deserialize the buffered bytes into.\n *\n * @returns the deserialized value of class type T\n * @group Implementation\n * @category BCS\n */\n deserialize<T>(cls: Deserializable<T>): T {\n // NOTE: `deserialize` in `cls.deserialize(this)` here is a static method defined in `cls`,\n // It is separate from the `deserialize` instance method defined here in Deserializer.\n return cls.deserialize(this);\n }\n\n /**\n * Deserializes an array of BCS Deserializable values given an existing Deserializer instance with a loaded byte buffer.\n *\n * @param cls The BCS-deserializable class to deserialize the buffered bytes into.\n * @returns An array of deserialized values of type T.\n * @example\n * // serialize a vector of addresses\n * const addresses = new Array<AccountAddress>(\n * AccountAddress.from(\"0x1\"),\n * AccountAddress.from(\"0x2\"),\n * AccountAddress.from(\"0xa\"),\n * AccountAddress.from(\"0xb\"),\n * );\n * const serializer = new Serializer();\n * serializer.serializeVector(addresses);\n * const serializedBytes = serializer.toUint8Array();\n *\n * // deserialize the bytes into an array of addresses\n * const deserializer = new Deserializer(serializedBytes);\n * const deserializedAddresses = deserializer.deserializeVector(AccountAddress);\n * // deserializedAddresses is now an array of AccountAddress instances\n * @group Implementation\n * @category BCS\n */\n deserializeVector<T>(cls: Deserializable<T>): Array<T> {\n const length = this.deserializeUleb128AsU32();\n const vector = new Array<T>();\n for (let i = 0; i < length; i += 1) {\n vector.push(this.deserialize(cls));\n }\n return vector;\n }\n}\n","import { AptosApiType } from \"../utils/const\";\nimport { getErrorMessage } from \"../utils/helpers\";\nimport { AptosRequest, AptosResponse } from \"../types\";\n\nexport enum KeylessErrorCategory {\n API_ERROR,\n EXTERNAL_API_ERROR,\n SESSION_EXPIRED,\n INVALID_STATE,\n INVALID_SIGNATURE,\n UNKNOWN,\n}\n\nexport enum KeylessErrorResolutionTip {\n REAUTHENTICATE = \"Re-authentiate to continue using your keyless account\",\n\n REAUTHENTICATE_UNSURE = \"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support\",\n UPDATE_REQUEST_PARAMS = \"Update the invalid request parameters and reauthenticate.\",\n\n RATE_LIMIT_EXCEEDED = \"Cache the keyless account and reuse it to avoid making too many requests. Keyless accounts are valid until either the EphemeralKeyPair expires, when the JWK is rotated, or when the proof verifying key is changed, whichever comes soonest.\",\n\n SERVER_ERROR = \"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx\",\n\n CALL_PRECHECK = \"Call `await account.checkKeylessAccountValidity()` to wait for asyncronous changes and check for account validity before signing or serializing.\",\n REINSTANTIATE = \"Try instantiating the account again. Avoid manipulating the account object directly\",\n JOIN_SUPPORT_GROUP = \"For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx\",\n UNKNOWN = \"Error unknown. For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx\",\n}\n\nexport enum KeylessErrorType {\n EPHEMERAL_KEY_PAIR_EXPIRED,\n\n PROOF_NOT_FOUND,\n\n ASYNC_PROOF_FETCH_FAILED,\n\n INVALID_PROOF_VERIFICATION_FAILED,\n\n INVALID_PROOF_VERIFICATION_KEY_NOT_FOUND,\n\n INVALID_JWT_SIG,\n\n INVALID_JWT_JWK_NOT_FOUND,\n\n INVALID_JWT_ISS_NOT_RECOGNIZED,\n\n INVALID_JWT_FEDERATED_ISS_NOT_SUPPORTED,\n\n INVALID_TW_SIG_VERIFICATION_FAILED,\n\n INVALID_TW_SIG_PUBLIC_KEY_NOT_FOUND,\n\n INVALID_EXPIRY_HORIZON,\n\n JWT_PARSING_ERROR,\n\n JWK_FETCH_FAILED,\n\n JWK_FETCH_FAILED_FEDERATED,\n\n RATE_LIMIT_EXCEEDED,\n\n PEPPER_SERVICE_INTERNAL_ERROR,\n\n PEPPER_SERVICE_BAD_REQUEST,\n\n PEPPER_SERVICE_OTHER,\n\n PROVER_SERVICE_INTERNAL_ERROR,\n\n PROVER_SERVICE_BAD_REQUEST,\n\n PROVER_SERVICE_OTHER,\n\n FULL_NODE_CONFIG_LOOKUP_ERROR,\n\n FULL_NODE_VERIFICATION_KEY_LOOKUP_ERROR,\n\n FULL_NODE_JWKS_LOOKUP_ERROR,\n\n FULL_NODE_OTHER,\n\n SIGNATURE_TYPE_INVALID,\n\n SIGNATURE_EXPIRED,\n\n MAX_EXPIRY_HORIZON_EXCEEDED,\n\n EPHEMERAL_SIGNATURE_VERIFICATION_FAILED,\n\n TRAINING_WHEELS_SIGNATURE_MISSING,\n\n TRAINING_WHEELS_SIGNATURE_VERIFICATION_FAILED,\n\n PROOF_VERIFICATION_FAILED,\n\n UNKNOWN,\n}\n\nconst KeylessErrors: { [key in KeylessErrorType]: [string, KeylessErrorCategory, KeylessErrorResolutionTip] } = {\n [KeylessErrorType.EPHEMERAL_KEY_PAIR_EXPIRED]: [\n \"The ephemeral keypair has expired.\",\n KeylessErrorCategory.SESSION_EXPIRED,\n KeylessErrorResolutionTip.REAUTHENTICATE,\n ],\n [KeylessErrorType.PROOF_NOT_FOUND]: [\n \"The required proof could not be found.\",\n KeylessErrorCategory.INVALID_STATE,\n KeylessErrorResolutionTip.CALL_PRECHECK,\n ],\n [KeylessErrorType.ASYNC_PROOF_FETCH_FAILED]: [\n \"The required proof failed to fetch.\",\n KeylessErrorCategory.INVALID_STATE,\n KeylessErrorResolutionTip.REAUTHENTICATE_UNSURE,\n ],\n [KeylessErrorType.INVALID_PROOF_VERIFICATION_FAILED]: [\n \"The provided proof is invalid.\",\n KeylessErrorCategory.INVALID_STATE,\n KeylessErrorResolutionTip.REAUTHENTICATE_UNSURE,\n ],\n [KeylessErrorType.INVALID_PROOF_VERIFICATION_KEY_NOT_FOUND]: [\n \"The verification key used to authenticate was updated.\",\n KeylessErrorCategory.SESSION_EXPIRED,\n KeylessErrorResolutionTip.REAUTHENTICATE,\n ],\n [KeylessErrorType.INVALID_JWT_SIG]: [\n \"The JWK was found, but JWT failed verification\",\n KeylessErrorCategory.INVALID_STATE,\n KeylessErrorResolutionTip.REAUTHENTICATE_UNSURE,\n ],\n [KeylessErrorType.INVALID_JWT_JWK_NOT_FOUND]: [\n \"The JWK required to verify the JWT could not be found. The JWK may have been rotated out.\",\n KeylessErrorCategory.SESSION_EXPIRED,\n KeylessErrorResolutionTip.REAUTHENTICATE,\n ],\n [KeylessErrorType.INVALID_JWT_ISS_NOT_RECOGNIZED]: [\n \"The JWT issuer is not recognized.\",\n KeylessErrorCategory.INVALID_STATE,\n KeylessErrorResolutionTip.UPDATE_REQUEST_PARAMS,\n ],\n [KeylessErrorType.INVALID_JWT_FEDERATED_ISS_NOT_SUPPORTED]: [\n \"The JWT issuer is not supported by the Federated Keyless \",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.REAUTHENTICATE_UNSURE,\n ],\n [KeylessErrorType.INVALID_TW_SIG_VERIFICATION_FAILED]: [\n \"The training wheels signature is invalid.\",\n KeylessErrorCategory.INVALID_STATE,\n KeylessErrorResolutionTip.REAUTHENTICATE_UNSURE,\n ],\n [KeylessErrorType.INVALID_TW_SIG_PUBLIC_KEY_NOT_FOUND]: [\n \"The public key used to verify the training wheels signature was not found.\",\n KeylessErrorCategory.SESSION_EXPIRED,\n KeylessErrorResolutionTip.REAUTHENTICATE,\n ],\n [KeylessErrorType.INVALID_EXPIRY_HORIZON]: [\n \"The expiry horizon is invalid.\",\n KeylessErrorCategory.SESSION_EXPIRED,\n KeylessErrorResolutionTip.REAUTHENTICATE,\n ],\n [KeylessErrorType.JWK_FETCH_FAILED]: [\n \"Failed to fetch JWKS.\",\n KeylessErrorCategory.EXTERNAL_API_ERROR,\n KeylessErrorResolutionTip.JOIN_SUPPORT_GROUP,\n ],\n [KeylessErrorType.JWK_FETCH_FAILED_FEDERATED]: [\n \"Failed to fetch JWKS for Federated Keyless provider.\",\n KeylessErrorCategory.EXTERNAL_API_ERROR,\n KeylessErrorResolutionTip.JOIN_SUPPORT_GROUP,\n ],\n [KeylessErrorType.RATE_LIMIT_EXCEEDED]: [\n \"Rate limit exceeded. Too many requests in a short period.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.RATE_LIMIT_EXCEEDED,\n ],\n [KeylessErrorType.PEPPER_SERVICE_INTERNAL_ERROR]: [\n \"Internal error from Pepper service.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.SERVER_ERROR,\n ],\n [KeylessErrorType.PEPPER_SERVICE_BAD_REQUEST]: [\n \"Bad request sent to Pepper service.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.UPDATE_REQUEST_PARAMS,\n ],\n [KeylessErrorType.PEPPER_SERVICE_OTHER]: [\n \"Unknown error from Pepper service.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.SERVER_ERROR,\n ],\n [KeylessErrorType.PROVER_SERVICE_INTERNAL_ERROR]: [\n \"Internal error from Prover service.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.SERVER_ERROR,\n ],\n [KeylessErrorType.PROVER_SERVICE_BAD_REQUEST]: [\n \"Bad request sent to Prover service.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.UPDATE_REQUEST_PARAMS,\n ],\n [KeylessErrorType.PROVER_SERVICE_OTHER]: [\n \"Unknown error from Prover service.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.SERVER_ERROR,\n ],\n [KeylessErrorType.JWT_PARSING_ERROR]: [\n \"Error when parsing JWT. This should never happen. Join https://t.me/+h5CN-W35yUFiYzkx for support\",\n KeylessErrorCategory.INVALID_STATE,\n KeylessErrorResolutionTip.REINSTANTIATE,\n ],\n [KeylessErrorType.FULL_NODE_CONFIG_LOOKUP_ERROR]: [\n \"Error when looking up on-chain keyless configuration.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.SERVER_ERROR,\n ],\n [KeylessErrorType.FULL_NODE_VERIFICATION_KEY_LOOKUP_ERROR]: [\n \"Error when looking up on-chain verification key.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.SERVER_ERROR,\n ],\n [KeylessErrorType.FULL_NODE_JWKS_LOOKUP_ERROR]: [\n \"Error when looking up on-chain JWKS.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.SERVER_ERROR,\n ],\n [KeylessErrorType.FULL_NODE_OTHER]: [\n \"Unknown error from full node.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.SERVER_ERROR,\n ],\n [KeylessErrorType.SIGNATURE_TYPE_INVALID]: [\n \"The signature is not a valid Keyless signature.\",\n KeylessErrorCategory.INVALID_SIGNATURE,\n KeylessErrorResolutionTip.JOIN_SUPPORT_GROUP,\n ],\n [KeylessErrorType.SIGNATURE_EXPIRED]: [\n \"The ephemeral key pair used to sign the message has expired.\",\n KeylessErrorCategory.INVALID_SIGNATURE,\n KeylessErrorResolutionTip.REAUTHENTICATE,\n ],\n [KeylessErrorType.MAX_EXPIRY_HORIZON_EXCEEDED]: [\n \"The expiry horizon on the signature exceeds the maximum allowed value.\",\n KeylessErrorCategory.INVALID_SIGNATURE,\n KeylessErrorResolutionTip.REAUTHENTICATE,\n ],\n [KeylessErrorType.EPHEMERAL_SIGNATURE_VERIFICATION_FAILED]: [\n \"Failed to verify the ephemeral signature with the ephemeral public key.\",\n KeylessErrorCategory.INVALID_SIGNATURE,\n KeylessErrorResolutionTip.REAUTHENTICATE,\n ],\n [KeylessErrorType.TRAINING_WHEELS_SIGNATURE_MISSING]: [\n \"The training wheels signature is missing but is required by the Keyless configuration.\",\n KeylessErrorCategory.INVALID_SIGNATURE,\n KeylessErrorResolutionTip.REAUTHENTICATE,\n ],\n [KeylessErrorType.TRAINING_WHEELS_SIGNATURE_VERIFICATION_FAILED]: [\n \"Failed to verify the training wheels signature with the training wheels public key.\",\n KeylessErrorCategory.INVALID_SIGNATURE,\n KeylessErrorResolutionTip.REAUTHENTICATE,\n ],\n [KeylessErrorType.PROOF_VERIFICATION_FAILED]: [\n \"The proof verification failed.\",\n KeylessErrorCategory.INVALID_SIGNATURE,\n KeylessErrorResolutionTip.REAUTHENTICATE,\n ],\n [KeylessErrorType.UNKNOWN]: [\n \"An unknown error has occurred.\",\n KeylessErrorCategory.UNKNOWN,\n KeylessErrorResolutionTip.UNKNOWN,\n ],\n};\n\nexport class KeylessError extends Error {\n readonly innerError?: unknown;\n\n readonly category: KeylessErrorCategory;\n\n readonly resolutionTip: KeylessErrorResolutionTip;\n\n readonly type: KeylessErrorType;\n\n readonly details?: string;\n\n /** @internal this constructor is for sdk internal use - do not instantiate outside of the SDK codebase */\n constructor(args: {\n innerError?: unknown;\n category: KeylessErrorCategory;\n resolutionTip: KeylessErrorResolutionTip;\n type: KeylessErrorType;\n message?: string;\n details?: string;\n }) {\n const { innerError, category, resolutionTip, type, message = KeylessErrors[type][0], details } = args;\n super(message);\n this.name = \"KeylessError\";\n this.innerError = innerError;\n this.category = category;\n this.resolutionTip = resolutionTip;\n this.type = type;\n this.details = details;\n this.message = KeylessError.constructMessage(message, resolutionTip, innerError, details);\n }\n\n static constructMessage(\n message: string,\n tip: KeylessErrorResolutionTip,\n innerError?: unknown,\n details?: string,\n ): string {\n let result = `\\nMessage: ${message}`;\n if (details) {\n result += `\\nDetails: ${details}`;\n }\n if (innerError instanceof AptosApiError) {\n result += `\\nAptosApiError: ${innerError.message}`;\n } else if (innerError !== undefined) {\n result += `\\nError: ${getErrorMessage(innerError)}`;\n }\n result += `\\nKeylessErrorResolutionTip: ${tip}`;\n return result;\n }\n\n /**\n * Static constructor that creates a KeylessError instance using the KeylessErrors constant\n * @param args.type The type of KeylessError\n * @param args.aptosApiError optional AptosApiError supplied for api errors\n * @param args.details optional details to include in the error message\n * @returns A new KeylessError instance\n */\n static fromErrorType(args: { type: KeylessErrorType; error?: unknown; details?: string }): KeylessError {\n const { error, type, details } = args;\n\n const [message, category, resolutionTip] = KeylessErrors[type];\n return new KeylessError({\n message,\n details,\n innerError: error,\n category,\n resolutionTip,\n type,\n });\n }\n}\n\n/**\n * Options for handling errors in the Aptos API.\n */\ntype AptosApiErrorOpts = {\n apiType: AptosApiType;\n aptosRequest: AptosRequest;\n aptosResponse: AptosResponse<any, any>;\n};\n\n/**\n * Represents an error returned from the Aptos API.\n * This class encapsulates the details of the error, including the request URL, response status, and additional data.\n *\n * @param name - The name of the error, which is always \"AptosApiError\".\n * @param url - The URL to which the request was made.\n * @param status - The HTTP response status code (e.g., 400).\n * @param statusText - The message associated with the response status.\n * @param data - The response data returned from the API.\n * @param request - The original AptosRequest that triggered the error.\n */\nexport class AptosApiError extends Error {\n readonly url: string;\n\n readonly status: number;\n\n readonly statusText: string;\n\n readonly data: any;\n\n readonly request: AptosRequest;\n\n /**\n * Constructs an instance of AptosApiError with relevant error details.\n *\n * @param opts - The options for creating the AptosApiError.\n * @param opts.apiType - The type of API that generated the error.\n * @param opts.aptosRequest - The request object that caused the error.\n * @param opts.aptosResponse - The response object containing error details.\n *\n * @internal This constructor is for SDK internal use - do not instantiate outside the SDK codebase.\n */\n constructor({ apiType, aptosRequest, aptosResponse }: AptosApiErrorOpts) {\n super(deriveErrorMessage({ apiType, aptosRequest, aptosResponse }));\n\n this.name = \"AptosApiError\";\n this.url = aptosResponse.url;\n this.status = aptosResponse.status;\n this.statusText = aptosResponse.statusText;\n this.data = aptosResponse.data;\n this.request = aptosRequest;\n }\n}\n\n/**\n * Derives an error message from the Aptos API response, providing context for debugging.\n * This function helps in understanding the nature of the error encountered during an API request.\n *\n * @param {AptosApiErrorOpts} opts - The options for deriving the error message.\n * @param {AptosApiType} opts.apiType - The type of API being called.\n * @param {AptosRequest} opts.aptosRequest - The original request made to the Aptos API.\n * @param {AptosResponse} opts.aptosResponse - The response received from the Aptos API.\n */\nfunction deriveErrorMessage({ apiType, aptosRequest, aptosResponse }: AptosApiErrorOpts): string {\n // extract the W3C trace_id from the response headers if it exists. Some services set this in the response, and it's useful for debugging.\n // See https://www.w3.org/TR/trace-context/#relationship-between-the-headers .\n const traceId = aptosResponse.headers?.traceparent?.split(\"-\")[1];\n const traceIdString = traceId ? `(trace_id:${traceId}) ` : \"\";\n\n const errorPrelude: string = `Request to [${apiType}]: ${aptosRequest.method} ${\n aptosResponse.url ?? aptosRequest.url\n } ${traceIdString}failed with`;\n\n // handle graphql responses from indexer api and extract the error message of the first error\n if (apiType === AptosApiType.INDEXER && aptosResponse.data?.errors?.[0]?.message != null) {\n return `${errorPrelude}: ${aptosResponse.data.errors[0].message}`;\n }\n\n // Received well-known structured error response body - simply serialize and return it.\n // We don't need http status codes etc. in this case.\n if (aptosResponse.data?.message != null && aptosResponse.data?.error_code != null) {\n return `${errorPrelude}: ${JSON.stringify(aptosResponse.data)}`;\n }\n\n // This is the generic/catch-all case. We received some response from the API, but it doesn't appear to be a well-known structure.\n // We print http status codes and the response body (after some trimming),\n // in the hope that this gives enough context what went wrong without printing overly huge messages.\n return `${errorPrelude} status: ${aptosResponse.statusText}(code:${\n aptosResponse.status\n }) and response body: ${serializeAnyPayloadForErrorMessage(aptosResponse.data)}`;\n}\n\nconst SERIALIZED_PAYLOAD_TRIM_TO_MAX_LENGTH = 400;\n\n/**\n * This function accepts a payload of any type (probably an object) and serializes it to a string\n * Since we don't know the type or size of the payload, and we don't want to add a huge object in full to the error message\n * we limit the to the first 200 and last 200 characters of the serialized payload and put a \"...\" in the middle.\n * @param payload - The payload to serialize, which can be of any type.\n *\n * @returns A string representation of the serialized payload, potentially truncated.\n */\nfunction serializeAnyPayloadForErrorMessage(payload: any): string {\n const serializedPayload = JSON.stringify(payload);\n if (serializedPayload.length <= SERIALIZED_PAYLOAD_TRIM_TO_MAX_LENGTH) {\n return serializedPayload;\n }\n return `truncated(original_size:${serializedPayload.length}): ${serializedPayload.slice(\n 0,\n SERIALIZED_PAYLOAD_TRIM_TO_MAX_LENGTH / 2,\n )}...${serializedPayload.slice(-SERIALIZED_PAYLOAD_TRIM_TO_MAX_LENGTH / 2)}`;\n}\n","// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { VERSION } from \"../version\";\nimport { AnyNumber, AptosRequest, AptosResponse, Client, ClientRequest, ClientResponse, MimeType } from \"../types\";\nimport { AptosApiType } from \"../utils\";\nimport { AptosApiError } from \"../errors\";\n\n/**\n * Sends a request using the specified options and returns the response.\n *\n * @param options - The options for the request.\n * @param options.url - The URL to send the request to.\n * @param options.method - The HTTP method to use for the request.\n * @param options.body - The body of the request.\n * @param options.contentType - The content type of the request.\n * @param options.params - The query parameters to include in the request.\n * @param options.overrides - Additional overrides for the request.\n * @param options.overrides.HEADERS - Custom headers to include in the request.\n * @param options.overrides.AUTH_TOKEN - The authorization token for the request.\n * @param options.overrides.API_KEY - The API key for the request.\n * @param options.overrides.http2 - Whether to use HTTP/2 for the request.\n * @param options.originMethod - The origin method for the request.\n * @param client - The client used to make the request.\n *\n * @returns The response from the request.\n * @group Implementation\n * @category Client\n */\nexport async function request<Req, Res>(options: ClientRequest<Req>, client: Client): Promise<ClientResponse<Res>> {\n const { url, method, body, contentType, params, overrides, originMethod } = options;\n const headers: Record<string, string | AnyNumber | boolean | undefined> = {\n ...overrides?.HEADERS,\n \"x-aptos-client\": `aptos-typescript-sdk/${VERSION}`,\n \"content-type\": contentType ?? MimeType.JSON,\n \"x-aptos-typescript-sdk-origin-method\": originMethod,\n };\n\n if (overrides?.AUTH_TOKEN) {\n headers.Authorization = `Bearer ${overrides?.AUTH_TOKEN}`;\n }\n if (overrides?.API_KEY) {\n headers.Authorization = `Bearer ${overrides?.API_KEY}`;\n }\n\n /*\n * make a call using the @aptos-labs/aptos-client package\n * {@link https://www.npmjs.com/package/@aptos-labs/aptos-client}\n */\n return client.provider<Req, Res>({\n url,\n method,\n body,\n params,\n headers,\n overrides,\n http2: overrides?.http2,\n });\n}\n\n/**\n * The main function to use when making an API request, returning the response or throwing an AptosApiError on failure.\n *\n * @param aptosRequestOpts - Options for the Aptos request, including the URL and path.\n * @param aptosConfig - The configuration information for the SDK client instance.\n * @param apiType - The type of API being accessed, which determines how the response is handled.\n * @returns The response from the API request or throws an AptosApiError if the request fails.\n * @group Implementation\n * @category Client\n */\nexport async function aptosRequest<Req extends {}, Res extends {}>(\n aptosRequestOpts: AptosRequest,\n aptosConfig: AptosConfig,\n apiType: AptosApiType,\n): Promise<AptosResponse<Req, Res>> {\n const { url, path } = aptosRequestOpts;\n const fullUrl = path ? `${url}/${path}` : url;\n const clientResponse = await request<Req, Res>({ ...aptosRequestOpts, url: fullUrl }, aptosConfig.client);\n\n const aptosResponse: AptosResponse<Req, Res> = {\n status: clientResponse.status,\n statusText: clientResponse.statusText ?? \"No status text provided\",\n data: clientResponse.data,\n headers: clientResponse.headers,\n config: clientResponse.config,\n request: clientResponse.request,\n url: fullUrl,\n };\n\n // Handle case for `Unauthorized` error (i.e. API_KEY error)\n if (aptosResponse.status === 401) {\n throw new AptosApiError({ apiType, aptosRequest: aptosRequestOpts, aptosResponse });\n }\n\n // to support both fullnode and indexer responses,\n // check if it is an indexer query, and adjust response.data\n if (apiType === AptosApiType.INDEXER) {\n const indexerResponse = aptosResponse.data as any;\n // Handle Indexer general errors\n if (indexerResponse.errors) {\n throw new AptosApiError({\n apiType,\n aptosRequest: aptosRequestOpts,\n aptosResponse,\n });\n }\n aptosResponse.data = indexerResponse.data as Res;\n } else if (apiType === AptosApiType.PEPPER || apiType === AptosApiType.PROVER) {\n if (aptosResponse.status >= 400) {\n throw new AptosApiError({ apiType, aptosRequest: aptosRequestOpts, aptosResponse });\n }\n }\n\n if (aptosResponse.status >= 200 && aptosResponse.status < 300) {\n return aptosResponse;\n }\n\n // We have to explicitly check for all request types, because if the error is a non-indexer error, but\n // comes from an indexer request (e.g. 404), we'll need to mention it appropriately\n throw new AptosApiError({ apiType, aptosRequest: aptosRequestOpts, aptosResponse });\n}\n","import { AnyPublicKeyVariant, SigningScheme as AuthenticationKeyScheme, HexInput } from \"../../types\";\nimport { Deserializer } from \"../../bcs/deserializer\";\nimport { Serializer } from \"../../bcs/serializer\";\nimport { AuthenticationKey } from \"../authenticationKey\";\nimport { AccountPublicKey, PublicKey } from \"./publicKey\";\nimport { Signature } from \"./signature\";\nimport { AnyPublicKey, AnySignature } from \"./singleKey\";\nimport { AptosConfig } from \"../../api\";\n\n/**\n * Counts the number of set bits (1s) in a byte.\n * This function can help you determine the population count of a given byte value.\n *\n * @param byte - The byte value for which to count the number of set bits.\n * @group Implementation\n * @category Serialization\n */\n\nfunction bitCount(byte: number) {\n let n = byte;\n n -= (n >> 1) & 0x55555555;\n n = (n & 0x33333333) + ((n >> 2) & 0x33333333);\n return (((n + (n >> 4)) & 0xf0f0f0f) * 0x1010101) >> 24;\n}\n\nconst MAX_NUM_KEYLESS_PUBLIC_FOR_MULTI_KEY = 3;\nexport abstract class AbstractMultiKey extends AccountPublicKey {\n publicKeys: PublicKey[];\n\n constructor(args: { publicKeys: PublicKey[] }) {\n super();\n this.publicKeys = args.publicKeys;\n }\n\n /**\n * Create a bitmap that holds the mapping from the original public keys\n * to the signatures passed in\n *\n * @param args.bits array of the index mapping to the matching public keys\n * @returns Uint8array bit map\n * @group Implementation\n * @category Serialization\n */\n createBitmap(args: { bits: number[] }): Uint8Array {\n const { bits } = args;\n // Bits are read from left to right. e.g. 0b10000000 represents the first bit is set in one byte.\n // The decimal value of 0b10000000 is 128.\n const firstBitInByte = 128;\n const bitmap = new Uint8Array([0, 0, 0, 0]);\n\n // Check if duplicates exist in bits\n const dupCheckSet = new Set();\n\n bits.forEach((bit: number, idx: number) => {\n if (idx + 1 > this.publicKeys.length) {\n throw new Error(`Signature index ${idx + 1} is out of public keys range, ${this.publicKeys.length}.`);\n }\n\n if (dupCheckSet.has(bit)) {\n throw new Error(`Duplicate bit ${bit} detected.`);\n }\n\n dupCheckSet.add(bit);\n\n const byteOffset = Math.floor(bit / 8);\n\n let byte = bitmap[byteOffset];\n\n byte |= firstBitInByte >> (bit % 8);\n\n bitmap[byteOffset] = byte;\n });\n\n return bitmap;\n }\n\n /**\n * Get the index of the provided public key.\n *\n * This function retrieves the index of a specified public key within the MultiKey.\n * If the public key does not exist, it throws an error.\n *\n * @param publicKey - The public key to find the index for.\n * @returns The corresponding index of the public key, if it exists.\n * @throws Error - If the public key is not found in the MultiKey.\n * @group Implementation\n * @category Serialization\n */\n getIndex(publicKey: PublicKey): number {\n const index = this.publicKeys.findIndex((pk) => pk.toString() === publicKey.toString());\n\n if (index !== -1) {\n return index;\n }\n throw new Error(`Public key ${publicKey} not found in multi key set ${this.publicKeys}`);\n }\n\n abstract getSignaturesRequired(): number;\n}\n\n/**\n * Represents a multi-key authentication scheme for accounts, allowing multiple public keys\n * to be associated with a single account. This class enforces a minimum number of valid signatures\n * required to authorize actions, ensuring enhanced security for multi-agent accounts.\n *\n * The public keys of each individual agent can be any type of public key supported by Aptos.\n * Since [AIP-55](https://github.com/aptos-foundation/AIPs/pull/263), Aptos supports\n * `Legacy` and `Unified` authentication keys.\n * @group Implementation\n * @category Serialization\n */\nexport class MultiKey extends AbstractMultiKey {\n /**\n * List of any public keys\n * @group Implementation\n * @category Serialization\n */\n public readonly publicKeys: AnyPublicKey[];\n\n /**\n * The minimum number of valid signatures required, for the number of public keys specified\n * @group Implementation\n * @category Serialization\n */\n public readonly signaturesRequired: number;\n\n /**\n * Signature for a K-of-N multi-sig transaction.\n * This constructor initializes a multi-signature transaction with the provided signatures and bitmap.\n *\n * @param args An object containing the parameters for the multi-signature transaction.\n * @param args.signatures A list of signatures.\n * @param args.bitmap A bitmap represented as a Uint8Array or an array of numbers, where each bit indicates whether a\n * corresponding signature is present. A maximum of 32 signatures is supported, and the length of the bitmap must be 4 bytes.\n *\n * @throws Error if the number of signatures exceeds the maximum supported, if the bitmap length is incorrect, or if the number\n * of signatures does not match the bitmap.\n * @group Implementation\n * @category Serialization\n */\n // region Constructors\n constructor(args: { publicKeys: Array<PublicKey>; signaturesRequired: number }) {\n const { publicKeys, signaturesRequired } = args;\n super({ publicKeys });\n\n // Validate number of public keys is greater than signature required\n if (signaturesRequired < 1) {\n throw new Error(\"The number of required signatures needs to be greater than 0\");\n }\n\n // Validate number of public keys is greater than signature required\n if (publicKeys.length < signaturesRequired) {\n throw new Error(\n `Provided ${publicKeys.length} public keys is smaller than the ${signaturesRequired} required signatures`,\n );\n }\n\n // Make sure that all keys are normalized to the SingleKey authentication scheme\n this.publicKeys = publicKeys.map((publicKey) =>\n publicKey instanceof AnyPublicKey ? publicKey : new AnyPublicKey(publicKey),\n );\n if (signaturesRequired > MAX_NUM_KEYLESS_PUBLIC_FOR_MULTI_KEY) {\n const keylessCount = this.publicKeys.filter(\n (pk) => pk.variant === AnyPublicKeyVariant.Keyless || pk.variant === AnyPublicKeyVariant.FederatedKeyless,\n ).length;\n if (keylessCount > MAX_NUM_KEYLESS_PUBLIC_FOR_MULTI_KEY) {\n throw new Error(\n `Construction of MultiKey with more than ${MAX_NUM_KEYLESS_PUBLIC_FOR_MULTI_KEY} keyless public keys is not allowed when signaturesRequired \n is greater than ${MAX_NUM_KEYLESS_PUBLIC_FOR_MULTI_KEY}. This is because a maximum of 3 keyless signatures are supported for a \n K-of-N MultiKey transaction.`,\n );\n }\n }\n\n this.signaturesRequired = signaturesRequired;\n }\n\n getSignaturesRequired(): number {\n return this.signaturesRequired;\n }\n\n // endregion\n\n // region AccountPublicKey\n\n /**\n * Verifies the provided signature against the given message.\n * This function helps ensure the integrity and authenticity of the message by checking if the signature is valid.\n *\n * Note: This function will fail if a keyless signature is used. Use `verifySignatureAsync` instead.\n *\n * @param args - The arguments for verifying the signature.\n * @param args.message - The message that was signed.\n * @param args.signature - The signature to verify.\n * @group Implementation\n * @category Serialization\n */\n verifySignature(args: { message: HexInput; signature: MultiKeySignature }): boolean {\n const { message, signature } = args;\n if (signature.signatures.length !== this.signaturesRequired) {\n throw new Error(\"The number of signatures does not match the number of required signatures\");\n }\n const signerIndices = signature.bitMapToSignerIndices();\n for (let i = 0; i < signature.signatures.length; i += 1) {\n const singleSignature = signature.signatures[i];\n const publicKey = this.publicKeys[signerIndices[i]];\n if (!publicKey.verifySignature({ message, signature: singleSignature })) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Verifies the provided signature against the given message.\n * This function helps ensure the integrity and authenticity of the message by checking if the signature is valid.\n *\n * @param args - The arguments for verifying the signature.\n * @param args.aptosConfig - The Aptos configuration to use\n * @param args.message - The message that was signed.\n * @param args.signature - The signature to verify.\n * @group Implementation\n * @category Serialization\n */\n async verifySignatureAsync(args: {\n aptosConfig: AptosConfig;\n message: HexInput;\n signature: Signature;\n options?: { throwErrorWithReason?: boolean };\n }): Promise<boolean> {\n const { signature } = args;\n try {\n if (!(signature instanceof MultiKeySignature)) {\n throw new Error(\"Signature is not a MultiKeySignature\");\n }\n if (signature.signatures.length !== this.signaturesRequired) {\n throw new Error(\"The number of signatures does not match the number of required signatures\");\n }\n const signerIndices = signature.bitMapToSignerIndices();\n for (let i = 0; i < signature.signatures.length; i += 1) {\n const singleSignature = signature.signatures[i];\n const publicKey = this.publicKeys[signerIndices[i]];\n if (!(await publicKey.verifySignatureAsync({ ...args, signature: singleSignature }))) {\n return false;\n }\n }\n return true;\n } catch (error) {\n if (args.options?.throwErrorWithReason) {\n throw error;\n }\n return false;\n }\n }\n\n /**\n * Generates an authentication key based on the current instance's byte representation.\n * This key can be used for secure authentication processes within the system.\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.MultiKey,\n input: this.toUint8Array(),\n });\n }\n\n // endregion\n\n // region Serializable\n\n /**\n * Serializes the object by writing its signatures and bitmap to the provided serializer.\n * This allows the object to be converted 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.serializeVector(this.publicKeys);\n serializer.serializeU8(this.signaturesRequired);\n }\n\n /**\n * Deserializes a MultiKeySignature from the provided deserializer.\n * This function retrieves the signatures and bitmap necessary for creating a MultiKeySignature object.\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): MultiKey {\n const keys = deserializer.deserializeVector(AnyPublicKey);\n const signaturesRequired = deserializer.deserializeU8();\n\n return new MultiKey({ publicKeys: keys, signaturesRequired });\n }\n\n // endregion\n\n /**\n * Get the index of the provided public key.\n *\n * This function retrieves the index of a specified public key within the MultiKey.\n * If the public key does not exist, it throws an error.\n *\n * @param publicKey - The public key to find the index for.\n * @returns The corresponding index of the public key, if it exists.\n * @throws Error - If the public key is not found in the MultiKey.\n * @group Implementation\n */\n getIndex(publicKey: PublicKey): number {\n const anyPublicKey = publicKey instanceof AnyPublicKey ? publicKey : new AnyPublicKey(publicKey);\n return super.getIndex(anyPublicKey);\n }\n\n public static isInstance(value: PublicKey): value is MultiKey {\n return \"publicKeys\" in value && \"signaturesRequired\" in value;\n }\n}\n\n/**\n * Represents a multi-signature transaction using Ed25519 signatures.\n * This class allows for the creation and management of a K-of-N multi-signature scheme,\n * where a specified number of signatures are required to authorize a transaction.\n *\n * It includes functionality to validate the number of signatures against a bitmap,\n * which indicates which public keys have signed the transaction.\n * @group Implementation\n * @category Serialization\n */\nexport class MultiKeySignature extends Signature {\n /**\n * Number of bytes in the bitmap representing who signed the transaction (32-bits)\n * @group Implementation\n * @category Serialization\n */\n static BITMAP_LEN: number = 4;\n\n /**\n * Maximum number of Ed25519 signatures supported\n * @group Implementation\n * @category Serialization\n */\n static MAX_SIGNATURES_SUPPORTED = MultiKeySignature.BITMAP_LEN * 8;\n\n /**\n * The list of underlying Ed25519 signatures\n * @group Implementation\n * @category Serialization\n */\n public readonly signatures: AnySignature[];\n\n /**\n * 32-bit Bitmap representing who signed the transaction\n *\n * This is represented where each public key can be masked to determine whether the message was signed by that key.\n * @group Implementation\n * @category Serialization\n */\n public readonly bitmap: Uint8Array;\n\n /**\n * Signature for a K-of-N multi-sig transaction.\n *\n * @see {@link\n * https://aptos.dev/integration/creating-a-signed-transaction/#multisignature-transactions | Creating a Signed Transaction}\n *\n * @param args.signatures A list of signatures\n * @param args.bitmap 4 bytes, at most 32 signatures are supported. If Nth bit value is `1`, the Nth\n * signature should be provided in `signatures`. Bits are read from left to right\n * @group Implementation\n * @category Serialization\n */\n constructor(args: { signatures: Array<Signature | AnySignature>; bitmap: Uint8Array | number[] }) {\n super();\n const { signatures, bitmap } = args;\n\n if (signatures.length > MultiKeySignature.MAX_SIGNATURES_SUPPORTED) {\n throw new Error(`The number of signatures cannot be greater than ${MultiKeySignature.MAX_SIGNATURES_SUPPORTED}`);\n }\n\n // Make sure that all signatures are normalized to the SingleKey authentication scheme\n this.signatures = signatures.map((signature) =>\n signature instanceof AnySignature ? signature : new AnySignature(signature),\n );\n\n if (!(bitmap instanceof Uint8Array)) {\n this.bitmap = MultiKeySignature.createBitmap({ bits: bitmap });\n } else if (bitmap.length !== MultiKeySignature.BITMAP_LEN) {\n throw new Error(`\"bitmap\" length should be ${MultiKeySignature.BITMAP_LEN}`);\n } else {\n this.bitmap = bitmap;\n }\n\n const nSignatures = this.bitmap.reduce((acc, byte) => acc + bitCount(byte), 0);\n if (nSignatures !== this.signatures.length) {\n throw new Error(`Expecting ${nSignatures} signatures from the bitmap, but got ${this.signatures.length}`);\n }\n }\n\n /**\n * Helper method to create a bitmap out of the specified bit positions\n * @param args.bits The bitmap positions that should be set. A position starts at index 0.\n * Valid position should range between 0 and 31.\n * @example\n * Here's an example of valid `bits`\n * ```\n * [0, 2, 31]\n * ```\n * `[0, 2, 31]` means the 1st, 3rd and 32nd bits should be set in the bitmap.\n * The result bitmap should be 0b1010000000000000000000000000001\n *\n * @returns bitmap that is 32bit long\n * @group Implementation\n * @category Serialization\n */\n static createBitmap(args: { bits: number[] }): Uint8Array {\n const { bits } = args;\n // Bits are read from left to right. e.g. 0b10000000 represents the first bit is set in one byte.\n // The decimal value of 0b10000000 is 128.\n const firstBitInByte = 128;\n const bitmap = new Uint8Array([0, 0, 0, 0]);\n\n // Check if duplicates exist in bits\n const dupCheckSet = new Set();\n\n bits.forEach((bit: number) => {\n if (bit >= MultiKeySignature.MAX_SIGNATURES_SUPPORTED) {\n throw new Error(`Cannot have a signature larger than ${MultiKeySignature.MAX_SIGNATURES_SUPPORTED - 1}.`);\n }\n\n if (dupCheckSet.has(bit)) {\n throw new Error(\"Duplicate bits detected.\");\n }\n\n dupCheckSet.add(bit);\n\n const byteOffset = Math.floor(bit / 8);\n\n let byte = bitmap[byteOffset];\n\n byte |= firstBitInByte >> (bit % 8);\n\n bitmap[byteOffset] = byte;\n });\n\n return bitmap;\n }\n\n /**\n * Converts the bitmap to an array of signer indices.\n *\n * Example:\n *\n * bitmap: [0b10001000, 0b01000000, 0b00000000, 0b00000000]\n * signerIndices: [0, 4, 9]\n *\n * @returns An array of signer indices.\n * @group Implementation\n * @category Serialization\n */\n bitMapToSignerIndices(): number[] {\n const signerIndices: number[] = [];\n for (let i = 0; i < this.bitmap.length; i += 1) {\n const byte = this.bitmap[i];\n for (let bit = 0; bit < 8; bit += 1) {\n if ((byte & (128 >> bit)) !== 0) {\n signerIndices.push(i * 8 + bit);\n }\n }\n }\n return signerIndices;\n }\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n // Note: we should not need to serialize the vector length, as it can be derived from the bitmap\n serializer.serializeVector(this.signatures);\n serializer.serializeBytes(this.bitmap);\n }\n\n static deserialize(deserializer: Deserializer): MultiKeySignature {\n const signatures = deserializer.deserializeVector(AnySignature);\n const bitmap = deserializer.deserializeBytes();\n return new MultiKeySignature({ signatures, bitmap });\n }\n\n // endregion\n}\n","import * as Types from \"./operations\";\n\nimport { GraphQLClient, RequestOptions } from \"graphql-request\";\ntype GraphQLClientRequestHeaders = RequestOptions[\"requestHeaders\"];\nexport const TokenActivitiesFieldsFragmentDoc = `\n fragment TokenActivitiesFields on token_activities_v2 {\n after_value\n before_value\n entry_function_id_str\n event_account_address\n event_index\n from_address\n is_fungible_v2\n property_version_v1\n to_address\n token_amount\n token_data_id\n token_standard\n transaction_timestamp\n transaction_version\n type\n}\n `;\nexport const AnsTokenFragmentFragmentDoc = `\n fragment AnsTokenFragment on current_aptos_names {\n domain\n expiration_timestamp\n registered_address\n subdomain\n token_standard\n is_primary\n owner_address\n subdomain_expiration_policy\n domain_expiration_timestamp\n}\n `;\nexport const CurrentTokenOwnershipFieldsFragmentDoc = `\n fragment CurrentTokenOwnershipFields on current_token_ownerships_v2 {\n token_standard\n token_properties_mutated_v1\n token_data_id\n table_type_v1\n storage_id\n property_version_v1\n owner_address\n last_transaction_version\n last_transaction_timestamp\n is_soulbound_v2\n is_fungible_v2\n amount\n current_token_data {\n collection_id\n description\n is_fungible_v2\n largest_property_version_v1\n last_transaction_timestamp\n last_transaction_version\n maximum\n supply\n token_data_id\n token_name\n token_properties\n token_standard\n token_uri\n decimals\n current_collection {\n collection_id\n collection_name\n creator_address\n current_supply\n description\n last_transaction_timestamp\n last_transaction_version\n max_supply\n mutable_description\n mutable_uri\n table_handle_v1\n token_standard\n total_minted_v2\n uri\n }\n }\n}\n `;\nexport const GetAccountAddressesForAuthKey = `\n query getAccountAddressesForAuthKey($where_condition: auth_key_account_addresses_bool_exp, $order_by: [auth_key_account_addresses_order_by!]) {\n auth_key_account_addresses(where: $where_condition, order_by: $order_by) {\n auth_key\n account_address\n last_transaction_version\n is_auth_key_used\n }\n}\n `;\nexport const GetAccountCoinsCount = `\n query getAccountCoinsCount($address: String) {\n current_fungible_asset_balances_aggregate(\n where: {owner_address: {_eq: $address}}\n ) {\n aggregate {\n count\n }\n }\n}\n `;\nexport const GetAccountCoinsData = `\n query getAccountCoinsData($where_condition: current_fungible_asset_balances_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_fungible_asset_balances_order_by!]) {\n current_fungible_asset_balances(\n where: $where_condition\n offset: $offset\n limit: $limit\n order_by: $order_by\n ) {\n amount\n asset_type\n is_frozen\n is_primary\n last_transaction_timestamp\n last_transaction_version\n owner_address\n storage_id\n token_standard\n metadata {\n token_standard\n symbol\n supply_aggregator_table_key_v1\n supply_aggregator_table_handle_v1\n project_uri\n name\n last_transaction_version\n last_transaction_timestamp\n icon_uri\n decimals\n creator_address\n asset_type\n }\n }\n}\n `;\nexport const GetAccountCollectionsWithOwnedTokens = `\n query getAccountCollectionsWithOwnedTokens($where_condition: current_collection_ownership_v2_view_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_collection_ownership_v2_view_order_by!]) {\n current_collection_ownership_v2_view(\n where: $where_condition\n offset: $offset\n limit: $limit\n order_by: $order_by\n ) {\n current_collection {\n collection_id\n collection_name\n creator_address\n current_supply\n description\n last_transaction_timestamp\n last_transaction_version\n mutable_description\n max_supply\n mutable_uri\n table_handle_v1\n token_standard\n total_minted_v2\n uri\n }\n collection_id\n collection_name\n collection_uri\n creator_address\n distinct_tokens\n last_transaction_version\n owner_address\n single_token_uri\n }\n}\n `;\nexport const GetAccountOwnedTokens = `\n query getAccountOwnedTokens($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {\n current_token_ownerships_v2(\n where: $where_condition\n offset: $offset\n limit: $limit\n order_by: $order_by\n ) {\n ...CurrentTokenOwnershipFields\n }\n}\n ${CurrentTokenOwnershipFieldsFragmentDoc}`;\nexport const GetAccountOwnedTokensByTokenData = `\n query getAccountOwnedTokensByTokenData($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {\n current_token_ownerships_v2(\n where: $where_condition\n offset: $offset\n limit: $limit\n order_by: $order_by\n ) {\n ...CurrentTokenOwnershipFields\n }\n}\n ${CurrentTokenOwnershipFieldsFragmentDoc}`;\nexport const GetAccountOwnedTokensFromCollection = `\n query getAccountOwnedTokensFromCollection($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {\n current_token_ownerships_v2(\n where: $where_condition\n offset: $offset\n limit: $limit\n order_by: $order_by\n ) {\n ...CurrentTokenOwnershipFields\n }\n}\n ${CurrentTokenOwnershipFieldsFragmentDoc}`;\nexport const GetAccountTokensCount = `\n query getAccountTokensCount($where_condition: current_token_ownerships_v2_bool_exp, $offset: Int, $limit: Int) {\n current_token_ownerships_v2_aggregate(\n where: $where_condition\n offset: $offset\n limit: $limit\n ) {\n aggregate {\n count\n }\n }\n}\n `;\nexport const GetAccountTransactionsCount = `\n query getAccountTransactionsCount($address: String) {\n account_transactions_aggregate(where: {account_address: {_eq: $address}}) {\n aggregate {\n count\n }\n }\n}\n `;\nexport const GetAuthKeysForPublicKey = `\n query getAuthKeysForPublicKey($where_condition: public_key_auth_keys_bool_exp, $order_by: [public_key_auth_keys_order_by!]) {\n public_key_auth_keys(where: $where_condition, order_by: $order_by) {\n public_key\n public_key_type\n auth_key\n account_public_key\n last_transaction_version\n is_public_key_used\n signature_type\n }\n}\n `;\nexport const GetChainTopUserTransactions = `\n query getChainTopUserTransactions($limit: Int) {\n user_transactions(limit: $limit, order_by: {version: desc}) {\n version\n }\n}\n `;\nexport const GetCollectionData = `\n query getCollectionData($where_condition: current_collections_v2_bool_exp!) {\n current_collections_v2(where: $where_condition) {\n uri\n total_minted_v2\n token_standard\n table_handle_v1\n mutable_uri\n mutable_description\n max_supply\n collection_id\n collection_name\n creator_address\n current_supply\n description\n last_transaction_timestamp\n last_transaction_version\n }\n}\n `;\nexport const GetCurrentFungibleAssetBalances = `\n query getCurrentFungibleAssetBalances($where_condition: current_fungible_asset_balances_bool_exp, $offset: Int, $limit: Int) {\n current_fungible_asset_balances(\n where: $where_condition\n offset: $offset\n limit: $limit\n ) {\n amount\n asset_type\n is_frozen\n is_primary\n last_transaction_timestamp\n last_transaction_version\n owner_address\n storage_id\n token_standard\n }\n}\n `;\nexport const GetDelegatedStakingActivities = `\n query getDelegatedStakingActivities($delegatorAddress: String, $poolAddress: String) {\n delegated_staking_activities(\n where: {delegator_address: {_eq: $delegatorAddress}, pool_address: {_eq: $poolAddress}}\n ) {\n amount\n delegator_address\n event_index\n event_type\n pool_address\n transaction_version\n }\n}\n `;\nexport const GetEvents = `\n query getEvents($where_condition: events_bool_exp, $offset: Int, $limit: Int, $order_by: [events_order_by!]) {\n events(\n where: $where_condition\n offset: $offset\n limit: $limit\n order_by: $order_by\n ) {\n account_address\n creation_number\n data\n event_index\n sequence_number\n transaction_block_height\n transaction_version\n type\n indexed_type\n }\n}\n `;\nexport const GetFungibleAssetActivities = `\n query getFungibleAssetActivities($where_condition: fungible_asset_activities_bool_exp, $offset: Int, $limit: Int) {\n fungible_asset_activities(\n where: $where_condition\n offset: $offset\n limit: $limit\n ) {\n amount\n asset_type\n block_height\n entry_function_id_str\n event_index\n gas_fee_payer_address\n is_frozen\n is_gas_fee\n is_transaction_success\n owner_address\n storage_id\n storage_refund_amount\n token_standard\n transaction_timestamp\n transaction_version\n type\n }\n}\n `;\nexport const GetFungibleAssetMetadata = `\n query getFungibleAssetMetadata($where_condition: fungible_asset_metadata_bool_exp, $offset: Int, $limit: Int) {\n fungible_asset_metadata(where: $where_condition, offset: $offset, limit: $limit) {\n icon_uri\n project_uri\n supply_aggregator_table_handle_v1\n supply_aggregator_table_key_v1\n creator_address\n asset_type\n decimals\n last_transaction_timestamp\n last_transaction_version\n name\n symbol\n token_standard\n supply_v2\n maximum_v2\n }\n}\n `;\nexport const GetNames = `\n query getNames($offset: Int, $limit: Int, $where_condition: current_aptos_names_bool_exp, $order_by: [current_aptos_names_order_by!]) {\n current_aptos_names(\n limit: $limit\n where: $where_condition\n order_by: $order_by\n offset: $offset\n ) {\n ...AnsTokenFragment\n }\n current_aptos_names_aggregate(where: $where_condition) {\n aggregate {\n count\n }\n }\n}\n ${AnsTokenFragmentFragmentDoc}`;\nexport const GetNumberOfDelegators = `\n query getNumberOfDelegators($where_condition: num_active_delegator_per_pool_bool_exp, $order_by: [num_active_delegator_per_pool_order_by!]) {\n num_active_delegator_per_pool(where: $where_condition, order_by: $order_by) {\n num_active_delegator\n pool_address\n }\n}\n `;\nexport const GetObjectData = `\n query getObjectData($where_condition: current_objects_bool_exp, $offset: Int, $limit: Int, $order_by: [current_objects_order_by!]) {\n current_objects(\n where: $where_condition\n offset: $offset\n limit: $limit\n order_by: $order_by\n ) {\n allow_ungated_transfer\n state_key_hash\n owner_address\n object_address\n last_transaction_version\n last_guid_creation_num\n is_deleted\n }\n}\n `;\nexport const GetProcessorStatus = `\n query getProcessorStatus($where_condition: processor_status_bool_exp) {\n processor_status(where: $where_condition) {\n last_success_version\n processor\n last_updated\n }\n}\n `;\nexport const GetTableItemsData = `\n query getTableItemsData($where_condition: table_items_bool_exp!, $offset: Int, $limit: Int, $order_by: [table_items_order_by!]) {\n table_items(\n where: $where_condition\n offset: $offset\n limit: $limit\n order_by: $order_by\n ) {\n decoded_key\n decoded_value\n key\n table_handle\n transaction_version\n write_set_change_index\n }\n}\n `;\nexport const GetTableItemsMetadata = `\n query getTableItemsMetadata($where_condition: table_metadatas_bool_exp!, $offset: Int, $limit: Int, $order_by: [table_metadatas_order_by!]) {\n table_metadatas(\n where: $where_condition\n offset: $offset\n limit: $limit\n order_by: $order_by\n ) {\n handle\n key_type\n value_type\n }\n}\n `;\nexport const GetTokenActivity = `\n query getTokenActivity($where_condition: token_activities_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [token_activities_v2_order_by!]) {\n token_activities_v2(\n where: $where_condition\n order_by: $order_by\n offset: $offset\n limit: $limit\n ) {\n ...TokenActivitiesFields\n }\n}\n ${TokenActivitiesFieldsFragmentDoc}`;\nexport const GetCurrentTokenOwnership = `\n query getCurrentTokenOwnership($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {\n current_token_ownerships_v2(\n where: $where_condition\n offset: $offset\n limit: $limit\n order_by: $order_by\n ) {\n ...CurrentTokenOwnershipFields\n }\n}\n ${CurrentTokenOwnershipFieldsFragmentDoc}`;\nexport const GetTokenData = `\n query getTokenData($where_condition: current_token_datas_v2_bool_exp, $offset: Int, $limit: Int, $order_by: [current_token_datas_v2_order_by!]) {\n current_token_datas_v2(\n where: $where_condition\n offset: $offset\n limit: $limit\n order_by: $order_by\n ) {\n collection_id\n description\n is_fungible_v2\n largest_property_version_v1\n last_transaction_timestamp\n last_transaction_version\n maximum\n supply\n token_data_id\n token_name\n token_properties\n token_standard\n token_uri\n decimals\n current_collection {\n collection_id\n collection_name\n creator_address\n current_supply\n description\n last_transaction_timestamp\n last_transaction_version\n max_supply\n mutable_description\n mutable_uri\n table_handle_v1\n token_standard\n total_minted_v2\n uri\n }\n }\n}\n `;\n\nexport type SdkFunctionWrapper = <T>(\n action: (requestHeaders?: Record<string, string>) => Promise<T>,\n operationName: string,\n operationType?: string,\n variables?: any,\n) => Promise<T>;\n\nconst defaultWrapper: SdkFunctionWrapper = (action, _operationName, _operationType, _variables) => action();\n\nexport function getSdk(client: GraphQLClient, withWrapper: SdkFunctionWrapper = defaultWrapper) {\n return {\n getAccountAddressesForAuthKey(\n variables?: Types.GetAccountAddressesForAuthKeyQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetAccountAddressesForAuthKeyQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetAccountAddressesForAuthKeyQuery>({\n document: GetAccountAddressesForAuthKey,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getAccountAddressesForAuthKey\",\n \"query\",\n variables,\n );\n },\n getAccountCoinsCount(\n variables?: Types.GetAccountCoinsCountQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetAccountCoinsCountQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetAccountCoinsCountQuery>({\n document: GetAccountCoinsCount,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getAccountCoinsCount\",\n \"query\",\n variables,\n );\n },\n getAccountCoinsData(\n variables: Types.GetAccountCoinsDataQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetAccountCoinsDataQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetAccountCoinsDataQuery>({\n document: GetAccountCoinsData,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getAccountCoinsData\",\n \"query\",\n variables,\n );\n },\n getAccountCollectionsWithOwnedTokens(\n variables: Types.GetAccountCollectionsWithOwnedTokensQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetAccountCollectionsWithOwnedTokensQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetAccountCollectionsWithOwnedTokensQuery>({\n document: GetAccountCollectionsWithOwnedTokens,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getAccountCollectionsWithOwnedTokens\",\n \"query\",\n variables,\n );\n },\n getAccountOwnedTokens(\n variables: Types.GetAccountOwnedTokensQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetAccountOwnedTokensQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetAccountOwnedTokensQuery>({\n document: GetAccountOwnedTokens,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getAccountOwnedTokens\",\n \"query\",\n variables,\n );\n },\n getAccountOwnedTokensByTokenData(\n variables: Types.GetAccountOwnedTokensByTokenDataQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetAccountOwnedTokensByTokenDataQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetAccountOwnedTokensByTokenDataQuery>({\n document: GetAccountOwnedTokensByTokenData,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getAccountOwnedTokensByTokenData\",\n \"query\",\n variables,\n );\n },\n getAccountOwnedTokensFromCollection(\n variables: Types.GetAccountOwnedTokensFromCollectionQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetAccountOwnedTokensFromCollectionQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetAccountOwnedTokensFromCollectionQuery>({\n document: GetAccountOwnedTokensFromCollection,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getAccountOwnedTokensFromCollection\",\n \"query\",\n variables,\n );\n },\n getAccountTokensCount(\n variables?: Types.GetAccountTokensCountQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetAccountTokensCountQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetAccountTokensCountQuery>({\n document: GetAccountTokensCount,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getAccountTokensCount\",\n \"query\",\n variables,\n );\n },\n getAccountTransactionsCount(\n variables?: Types.GetAccountTransactionsCountQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetAccountTransactionsCountQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetAccountTransactionsCountQuery>({\n document: GetAccountTransactionsCount,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getAccountTransactionsCount\",\n \"query\",\n variables,\n );\n },\n getAuthKeysForPublicKey(\n variables?: Types.GetAuthKeysForPublicKeyQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetAuthKeysForPublicKeyQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetAuthKeysForPublicKeyQuery>({\n document: GetAuthKeysForPublicKey,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getAuthKeysForPublicKey\",\n \"query\",\n variables,\n );\n },\n getChainTopUserTransactions(\n variables?: Types.GetChainTopUserTransactionsQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetChainTopUserTransactionsQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetChainTopUserTransactionsQuery>({\n document: GetChainTopUserTransactions,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getChainTopUserTransactions\",\n \"query\",\n variables,\n );\n },\n getCollectionData(\n variables: Types.GetCollectionDataQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetCollectionDataQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetCollectionDataQuery>({\n document: GetCollectionData,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getCollectionData\",\n \"query\",\n variables,\n );\n },\n getCurrentFungibleAssetBalances(\n variables?: Types.GetCurrentFungibleAssetBalancesQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetCurrentFungibleAssetBalancesQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetCurrentFungibleAssetBalancesQuery>({\n document: GetCurrentFungibleAssetBalances,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getCurrentFungibleAssetBalances\",\n \"query\",\n variables,\n );\n },\n getDelegatedStakingActivities(\n variables?: Types.GetDelegatedStakingActivitiesQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetDelegatedStakingActivitiesQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetDelegatedStakingActivitiesQuery>({\n document: GetDelegatedStakingActivities,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getDelegatedStakingActivities\",\n \"query\",\n variables,\n );\n },\n getEvents(\n variables?: Types.GetEventsQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetEventsQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetEventsQuery>({\n document: GetEvents,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getEvents\",\n \"query\",\n variables,\n );\n },\n getFungibleAssetActivities(\n variables?: Types.GetFungibleAssetActivitiesQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetFungibleAssetActivitiesQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetFungibleAssetActivitiesQuery>({\n document: GetFungibleAssetActivities,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getFungibleAssetActivities\",\n \"query\",\n variables,\n );\n },\n getFungibleAssetMetadata(\n variables?: Types.GetFungibleAssetMetadataQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetFungibleAssetMetadataQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetFungibleAssetMetadataQuery>({\n document: GetFungibleAssetMetadata,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getFungibleAssetMetadata\",\n \"query\",\n variables,\n );\n },\n getNames(\n variables?: Types.GetNamesQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetNamesQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetNamesQuery>({\n document: GetNames,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getNames\",\n \"query\",\n variables,\n );\n },\n getNumberOfDelegators(\n variables?: Types.GetNumberOfDelegatorsQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetNumberOfDelegatorsQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetNumberOfDelegatorsQuery>({\n document: GetNumberOfDelegators,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getNumberOfDelegators\",\n \"query\",\n variables,\n );\n },\n getObjectData(\n variables?: Types.GetObjectDataQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetObjectDataQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetObjectDataQuery>({\n document: GetObjectData,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getObjectData\",\n \"query\",\n variables,\n );\n },\n getProcessorStatus(\n variables?: Types.GetProcessorStatusQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetProcessorStatusQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetProcessorStatusQuery>({\n document: GetProcessorStatus,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getProcessorStatus\",\n \"query\",\n variables,\n );\n },\n getTableItemsData(\n variables: Types.GetTableItemsDataQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetTableItemsDataQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetTableItemsDataQuery>({\n document: GetTableItemsData,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getTableItemsData\",\n \"query\",\n variables,\n );\n },\n getTableItemsMetadata(\n variables: Types.GetTableItemsMetadataQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetTableItemsMetadataQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetTableItemsMetadataQuery>({\n document: GetTableItemsMetadata,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getTableItemsMetadata\",\n \"query\",\n variables,\n );\n },\n getTokenActivity(\n variables: Types.GetTokenActivityQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetTokenActivityQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetTokenActivityQuery>({\n document: GetTokenActivity,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getTokenActivity\",\n \"query\",\n variables,\n );\n },\n getCurrentTokenOwnership(\n variables: Types.GetCurrentTokenOwnershipQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetCurrentTokenOwnershipQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetCurrentTokenOwnershipQuery>({\n document: GetCurrentTokenOwnership,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getCurrentTokenOwnership\",\n \"query\",\n variables,\n );\n },\n getTokenData(\n variables?: Types.GetTokenDataQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetTokenDataQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetTokenDataQuery>({\n document: GetTokenData,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getTokenData\",\n \"query\",\n variables,\n );\n },\n };\n}\nexport type Sdk = ReturnType<typeof getSdk>;\n","import { AptosConfig } from \"../api/aptosConfig\";\nimport { postAptosFullNode } from \"../client\";\nimport {\n TableItemRequest,\n LedgerVersionArg,\n PaginationArgs,\n WhereArg,\n OrderByArg,\n GetTableItemsDataResponse,\n GetTableItemsMetadataResponse,\n} from \"../types\";\nimport { GetTableItemsDataQuery, GetTableItemsMetadataQuery } from \"../types/generated/operations\";\nimport { GetTableItemsData, GetTableItemsMetadata } from \"../types/generated/queries\";\nimport { TableItemsBoolExp, TableMetadatasBoolExp } from \"../types/generated/types\";\nimport { queryIndexer } from \"./general\";\n\n/**\n * Retrieves a specific item from a table in the Aptos blockchain.\n *\n * @param args - The arguments for retrieving the table item.\n * @param args.aptosConfig - The configuration for connecting to the Aptos blockchain.\n * @param args.handle - The identifier for the table from which to retrieve the item.\n * @param args.data - The request data for the table item.\n * @param args.options - Optional parameters for the request, including ledger version.\n * @group Implementation\n */\nexport async function getTableItem<T>(args: {\n aptosConfig: AptosConfig;\n handle: string;\n data: TableItemRequest;\n options?: LedgerVersionArg;\n}): Promise<T> {\n const { aptosConfig, handle, data, options } = args;\n const response = await postAptosFullNode<TableItemRequest, any>({\n aptosConfig,\n originMethod: \"getTableItem\",\n path: `tables/${handle}/item`,\n params: { ledger_version: options?.ledgerVersion },\n body: data,\n });\n return response.data as T;\n}\n\n/**\n * Retrieves table items data based on specified conditions and pagination options.\n *\n * @param args - The arguments for retrieving table items data.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.options - Optional parameters for pagination and filtering.\n * @param args.options.offset - The number of items to skip before starting to collect the result set.\n * @param args.options.limit - The maximum number of items to return.\n * @param args.options.where - Conditions to filter the table items.\n * @param args.options.orderBy - The criteria to sort the results.\n * @group Implementation\n */\nexport async function getTableItemsData(args: {\n aptosConfig: AptosConfig;\n options?: PaginationArgs & WhereArg<TableItemsBoolExp> & OrderByArg<GetTableItemsDataResponse[0]>;\n}) {\n const { aptosConfig, options } = args;\n\n const graphqlQuery = {\n query: GetTableItemsData,\n variables: {\n where_condition: options?.where,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetTableItemsDataQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getTableItemsData\",\n });\n\n return data.table_items;\n}\n\n/**\n * Retrieves metadata for table items based on specified options.\n *\n * @param args - The arguments for retrieving table items metadata.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.options - Optional parameters for pagination and filtering.\n * @param args.options.offset - The number of items to skip before starting to collect the result set.\n * @param args.options.limit - The maximum number of items to return.\n * @param args.options.where - Conditions to filter the results.\n * @param args.options.orderBy - The order in which to return the results.\n * @returns A promise that resolves to an array of table metadata.\n * @group Implementation\n */\nexport async function getTableItemsMetadata(args: {\n aptosConfig: AptosConfig;\n options?: PaginationArgs & WhereArg<TableMetadatasBoolExp> & OrderByArg<GetTableItemsMetadataResponse[0]>;\n}): Promise<GetTableItemsMetadataResponse> {\n const { aptosConfig, options } = args;\n\n const graphqlQuery = {\n query: GetTableItemsMetadata,\n variables: {\n where_condition: options?.where,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetTableItemsMetadataQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getTableItemsMetadata\",\n });\n\n return data.table_metadatas;\n}\n"]}
1
+ {"version":3,"sources":["/Users/greg/git/aptos-ts-sdk/dist/common/index.js","../../src/bcs/deserializer.ts","../../src/errors/index.ts","../../src/client/core.ts","../../src/core/crypto/multiKey.ts","../../src/types/generated/queries.ts","../../src/internal/table.ts"],"names":["TEXT_DECODER","MAX_DESERIALIZE_BYTES_LENGTH","Deserializer","_Deserializer","data","hex","Hex","length","bytes","value","type","len"],"mappings":"AAAA,2sCAA64B,ICUv4BA,EAAAA,CAAe,IAAI,WAAA,CAOnBC,EAAAA,CAA+B,EAAA,CAAK,IAAA,CAAO,IAAA,CAuCpCC,CAAAA,wBAAN,MAAMC,CAAa,CAaxB,WAAA,CAAYC,CAAAA,CAAkB,CAE5B,IAAA,CAAK,MAAA,CAAS,IAAI,WAAA,CAAYA,CAAAA,CAAK,MAAM,CAAA,CACzC,IAAI,UAAA,CAAW,IAAA,CAAK,MAAM,CAAA,CAAE,GAAA,CAAIA,CAAAA,CAAM,CAAC,CAAA,CACvC,IAAA,CAAK,MAAA,CAAS,CAChB,CAEA,OAAO,OAAA,CAAQC,CAAAA,CAA6B,CAC1C,IAAMD,CAAAA,CAAOE,kBAAAA,CAAI,oBAAA,CAAqBD,CAAG,CAAA,CACzC,OAAO,IAAIF,CAAAA,CAAaC,CAAI,CAC9B,CAgBQ,IAAA,CAAKG,CAAAA,CAA4B,CACvC,EAAA,CAAI,IAAA,CAAK,MAAA,CAASA,CAAAA,CAAS,IAAA,CAAK,MAAA,CAAO,UAAA,CACrC,MAAM,IAAI,KAAA,CAAM,8BAA8B,CAAA,CAMhD,IAAMC,CAAAA,CAAQ,IAAI,UAAA,CAAW,IAAA,CAAK,MAAA,CAAQ,IAAA,CAAK,MAAA,CAAQD,CAAM,CAAA,CAC7D,OAAA,IAAA,CAAK,MAAA,EAAUA,CAAAA,CACRC,CACT,CAWA,SAAA,CAAA,CAAoB,CAClB,OAAO,IAAA,CAAK,MAAA,CAAO,UAAA,CAAa,IAAA,CAAK,MACvC,CASA,cAAA,CAAA,CAAuB,CACrB,EAAA,CAAI,IAAA,CAAK,SAAA,CAAU,CAAA,GAAM,CAAA,CACvB,MAAM,IAAI,KAAA,CAAM,4BAA4B,CAEhD,CAiBA,cAAA,CAAA,CAAyB,CACvB,IAAMC,CAAAA,CAAQ,IAAA,CAAK,gBAAA,CAAiB,CAAA,CACpC,OAAOT,EAAAA,CAAa,MAAA,CAAOS,CAAK,CAClC,CAeA,oBAAA,CAAA,CAA2C,CACzC,OAAO,IAAA,CAAK,iBAAA,CAAkB,QAAQ,CACxC,CA4CA,iBAAA,CACEC,CAAAA,CACAC,CAAAA,CACqC,CAErC,EAAA,CADe,IAAA,CAAK,eAAA,CAAgB,CAAA,CAGpC,CAAA,EAAA,CAAID,CAAAA,GAAS,QAAA,CACX,OAAO,IAAA,CAAK,cAAA,CAAe,CAAA,CAE7B,EAAA,CAAIA,CAAAA,GAAS,OAAA,CACX,OAAO,IAAA,CAAK,gBAAA,CAAiB,CAAA,CAE/B,EAAA,CAAIA,CAAAA,GAAS,YAAA,CAAc,CACzB,EAAA,CAAIC,CAAAA,GAAQ,KAAA,CAAA,CACV,MAAM,IAAI,KAAA,CAAM,iCAAiC,CAAA,CAEnD,OAAO,IAAA,CAAK,qBAAA,CAAsBA,CAAG,CACvC,CAEA,OAAO,IAAA,CAAK,WAAA,CAAYD,CAAI,CAAA,CAC9B,CAaA,gBAAA,CAAA,CAA+B,CAC7B,IAAMC,CAAAA,CAAM,IAAA,CAAK,uBAAA,CAAwB,CAAA,CAEzC,EAAA,CAAIA,CAAAA,CAAMV,EAAAA,CACR,MAAM,IAAI,KAAA,CACR,CAAA,yCAAA,EAA4CU,CAAG,CAAA,yBAAA,EAA4BV,EAA4B,CAAA,CAAA;AC2D/F,SAAA;AAGA,SAAA;AAEA,eAAA;AAEF,OAAA;AChN2D,2BAAA;AC0DT,0BAAA;AAyOlB,sCAAA;AC7YE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmBL,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaW,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgDT,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUT,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWD,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkCiB,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmCf,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYW,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYG,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYd,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaM,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASJ,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaI,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOV,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBc,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmBF,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkCH,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0BF,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBhB,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBa,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQR,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASD,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBI,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAcL,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYQ,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYZ,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACnZzB,IAAA","file":"/Users/greg/git/aptos-ts-sdk/dist/common/index.js","sourcesContent":[null,"// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { MAX_U32_NUMBER } from \"./consts\";\nimport { Uint8, Uint16, Uint32, Uint64, Uint128, Uint256, HexInput } from \"../types\";\nimport { Hex } from \"../core/hex\";\n\n/**\n * Shared TextDecoder instance for string deserialization to avoid repeated instantiation.\n */\nconst TEXT_DECODER = new TextDecoder();\n\n/**\n * Maximum allowed length for deserialized byte arrays and strings.\n * This prevents memory exhaustion attacks from malformed BCS data.\n * Set to 10MB which should be sufficient for any legitimate use case.\n */\nconst MAX_DESERIALIZE_BYTES_LENGTH = 10 * 1024 * 1024; // 10MB\n\n/**\n * This interface exists to define Deserializable<T> inputs for functions that\n * deserialize a byte buffer into a type T.\n * It is not intended to be implemented or extended, because Typescript has no support\n * for static methods in interfaces.\n *\n * @template T - The type that this will deserialize into.\n * @group Implementation\n * @category BCS\n */\nexport interface Deserializable<T> {\n /**\n * Deserializes the buffered bytes into an instance of the specified class type.\n * This function provides an alternative syntax for deserialization, allowing users to call\n * `deserializer.deserialize(MyClass)` instead of `MyClass.deserialize(deserializer)`.\n *\n * @param deserializer - The deserializer instance with the buffered bytes.\n * @returns The deserialized value of class type T.\n * @example\n * ```typescript\n * const deserializer = new Deserializer(new Uint8Array([1, 2, 3]));\n * const value = deserializer.deserialize(MyClass); // where MyClass has a `deserialize` function\n * // value is now an instance of MyClass\n * // equivalent to `const value = MyClass.deserialize(deserializer)`\n * ```\n * @group Implementation\n * @category BCS\n */\n deserialize(deserializer: Deserializer): T;\n}\n\n/**\n * A class that provides methods for deserializing various data types from a byte buffer.\n * It supports deserialization of primitive types, strings, and complex objects using a BCS (Binary Common Serialization) layout.\n * @group Implementation\n * @category BCS\n */\nexport class Deserializer {\n private buffer: ArrayBuffer;\n\n private offset: number;\n\n /**\n * Creates a new instance of the class with a copy of the provided data buffer.\n * This prevents outside mutation of the buffer.\n *\n * @param data - The data to be copied into the internal buffer as a Uint8Array.\n * @group Implementation\n * @category BCS\n */\n constructor(data: Uint8Array) {\n // copies data to prevent outside mutation of buffer.\n this.buffer = new ArrayBuffer(data.length);\n new Uint8Array(this.buffer).set(data, 0);\n this.offset = 0;\n }\n\n static fromHex(hex: HexInput): Deserializer {\n const data = Hex.hexInputToUint8Array(hex);\n return new Deserializer(data);\n }\n\n /**\n * Reads a specified number of bytes from the buffer and advances the offset.\n * Returns a view into the buffer rather than copying for better performance.\n *\n * SECURITY NOTE: This returns a view, not a copy. Callers that expose the result\n * externally MUST call .slice() to create a copy. Internal numeric deserializers\n * (deserializeU8, deserializeU16, etc.) only read values and don't expose the view.\n * deserializeBytes() and deserializeFixedBytes() call .slice() before returning.\n *\n * @param length - The number of bytes to read from the buffer.\n * @throws Throws an error if the read operation exceeds the buffer's length.\n * @group Implementation\n * @category BCS\n */\n private read(length: number): Uint8Array {\n if (this.offset + length > this.buffer.byteLength) {\n throw new Error(\"Reached to the end of buffer\");\n }\n\n // Use subarray to return a view instead of slice which copies\n // SECURITY: View is safe because numeric deserializers only read values,\n // and byte deserializers call .slice() before returning to caller\n const bytes = new Uint8Array(this.buffer, this.offset, length);\n this.offset += length;\n return bytes;\n }\n\n /**\n * Returns the number of bytes remaining in the buffer.\n *\n * This information is useful to determine if there's more data to be read.\n *\n * @returns The number of bytes remaining in the buffer.\n * @group Implementation\n * @category BCS\n */\n remaining(): number {\n return this.buffer.byteLength - this.offset;\n }\n\n /**\n * Asserts that the buffer has no remaining bytes.\n *\n * @throws {Error} Throws an error if there are remaining bytes in the buffer.\n * @group Implementation\n * @category BCS\n */\n assertFinished(): void {\n if (this.remaining() !== 0) {\n throw new Error(\"Buffer has remaining bytes\");\n }\n }\n\n /**\n * Deserializes a UTF-8 encoded string from a byte array. It first reads the length of the string in bytes,\n * followed by the actual byte content, and decodes it into a string.\n *\n * BCS layout for \"string\": string_length | string_content\n * where string_length is a u32 integer encoded as a uleb128 integer, equal to the number of bytes in string_content.\n *\n * @example\n * ```typescript\n * const deserializer = new Deserializer(new Uint8Array([8, 49, 50, 51, 52, 97, 98, 99, 100]));\n * assert(deserializer.deserializeStr() === \"1234abcd\");\n * ```\n * @group Implementation\n * @category BCS\n */\n deserializeStr(): string {\n const value = this.deserializeBytes();\n return TEXT_DECODER.decode(value);\n }\n\n /**\n * @deprecated use `deserializeOption(\"string\")` instead.\n *\n * The BCS layout for Optional<String> is 0 if none, else 1 followed by the string length and string content.\n * @returns The deserialized string if it exists, otherwise undefined.\n * @example\n * ```typescript\n * const deserializer = new Deserializer(new Uint8Array([0x00]));\n * assert(deserializer.deserializeOptionStr() === undefined);\n * const deserializer = new Deserializer(new Uint8Array([1, 8, 49, 50, 51, 52, 97, 98, 99, 100]));\n * assert(deserializer.deserializeOptionStr() === \"1234abcd\");\n * ```\n */\n deserializeOptionStr(): string | undefined {\n return this.deserializeOption(\"string\");\n }\n\n /**\n * Deserializes an optional value from the buffer.\n *\n * The BCS layout for Optional<T> starts with a boolean byte (0 if none, 1 if some),\n * followed by the value if present.\n *\n * @template T - The type of the value to deserialize\n * @param type - Either a Deserializable class or one of the string literals: \"string\", \"bytes\", or \"fixedBytes\"\n * @param len - Required length when type is \"fixedBytes\", ignored otherwise\n * @returns The deserialized value if present, undefined otherwise\n *\n * @throws {Error} When \"fixedBytes\" is specified without a length\n *\n * @example\n * ```typescript\n * // Deserialize an optional string\n * const deserializer = new Deserializer(new Uint8Array([1, 3, 97, 98, 99]));\n * const optStr = deserializer.deserializeOption(\"string\");\n * // optStr === \"abc\"\n *\n * // Deserialize an optional custom type\n * const deserializer = new Deserializer(new Uint8Array([0]));\n * const optValue = deserializer.deserializeOption(MyClass);\n * // optValue === undefined\n *\n * // Deserialize optional bytes\n * const deserializer = new Deserializer(new Uint8Array([1, 3, 1, 2, 3]));\n * const optBytes = deserializer.deserializeOption(\"bytes\");\n * // optBytes === Uint8Array[1, 2, 3]\n *\n * // Deserialize optional fixed bytes\n * const deserializer = new Deserializer(new Uint8Array([1, 1, 2, 3, 4]));\n * const optBytes = deserializer.deserializeOption(\"fixedBytes\", 4);\n * // optBytes === Uint8Array[1, 2, 3, 4]\n * ```\n * @group Implementation\n * @category BCS\n */\n deserializeOption(type: \"string\"): string | undefined;\n deserializeOption(type: \"bytes\"): Uint8Array | undefined;\n deserializeOption(type: \"fixedBytes\", len: number): Uint8Array | undefined;\n deserializeOption<T>(type: Deserializable<T>): T | undefined;\n deserializeOption<T>(\n type: Deserializable<T> | \"string\" | \"bytes\" | \"fixedBytes\",\n len?: number,\n ): T | string | Uint8Array | undefined {\n const exists = this.deserializeBool();\n if (!exists) return undefined;\n\n if (type === \"string\") {\n return this.deserializeStr();\n }\n if (type === \"bytes\") {\n return this.deserializeBytes();\n }\n if (type === \"fixedBytes\") {\n if (len === undefined) {\n throw new Error(\"Fixed bytes length not provided\");\n }\n return this.deserializeFixedBytes(len);\n }\n\n return this.deserialize(type);\n }\n\n /**\n * Deserializes an array of bytes.\n *\n * The BCS layout for \"bytes\" consists of a bytes_length followed by the bytes themselves, where bytes_length is a u32 integer\n * encoded as a uleb128 integer, indicating the length of the bytes array.\n *\n * @returns {Uint8Array} The deserialized array of bytes (a copy, safe to modify).\n * @throws {Error} If the length exceeds the maximum allowed (10MB) to prevent memory exhaustion.\n * @group Implementation\n * @category BCS\n */\n deserializeBytes(): Uint8Array {\n const len = this.deserializeUleb128AsU32();\n // Security: Prevent memory exhaustion from malformed data\n if (len > MAX_DESERIALIZE_BYTES_LENGTH) {\n throw new Error(\n `Deserialization error: byte array length ${len} exceeds maximum allowed ${MAX_DESERIALIZE_BYTES_LENGTH}`,\n );\n }\n // Return a copy so caller can safely modify without affecting buffer\n return this.read(len).slice();\n }\n\n /**\n * Deserializes an array of bytes of a specified length.\n *\n * @param len - The number of bytes to read from the source.\n * @returns {Uint8Array} The deserialized array of bytes (a copy, safe to modify).\n * @group Implementation\n * @category BCS\n */\n deserializeFixedBytes(len: number): Uint8Array {\n // Return a copy so caller can safely modify without affecting buffer\n return this.read(len).slice();\n }\n\n /**\n * Deserializes a boolean value from a byte stream.\n *\n * The BCS layout for a boolean uses one byte, where \"0x01\" represents true and \"0x00\" represents false.\n * An error is thrown if the byte value is not valid.\n *\n * @returns The deserialized boolean value.\n * @throws Throws an error if the boolean value is invalid.\n * @group Implementation\n * @category BCS\n */\n deserializeBool(): boolean {\n const bool = this.read(1)[0];\n if (bool !== 1 && bool !== 0) {\n throw new Error(\"Invalid boolean value\");\n }\n return bool === 1;\n }\n\n /**\n * Deserializes a uint8 number from the binary data.\n *\n * BCS layout for \"uint8\": One byte. Binary format in little-endian representation.\n *\n * @returns {number} The deserialized uint8 number.\n * @group Implementation\n * @category BCS\n */\n deserializeU8(): Uint8 {\n return this.read(1)[0];\n }\n\n /**\n * Deserializes a uint16 number from a binary format in little-endian representation.\n *\n * BCS layout for \"uint16\": Two bytes.\n * @example\n * ```typescript\n * const deserializer = new Deserializer(new Uint8Array([0x34, 0x12]));\n * assert(deserializer.deserializeU16() === 4660);\n * ```\n * @group Implementation\n * @category BCS\n */\n deserializeU16(): Uint16 {\n const bytes = this.read(2);\n return new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength).getUint16(0, true);\n }\n\n /**\n * Deserializes a uint32 number from a binary format in little-endian representation.\n *\n * BCS layout for \"uint32\": Four bytes.\n * @example\n * ```typescript\n * const deserializer = new Deserializer(new Uint8Array([0x78, 0x56, 0x34, 0x12]));\n * assert(deserializer.deserializeU32() === 305419896);\n * ```\n * @group Implementation\n * @category BCS\n */\n deserializeU32(): Uint32 {\n const bytes = this.read(4);\n return new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength).getUint32(0, true);\n }\n\n /**\n * Deserializes a uint64 number.\n *\n * This function combines two 32-bit values to return a 64-bit unsigned integer in little-endian representation.\n * @example\n * ```typescript\n * const deserializer = new Deserializer(new Uint8Array([0x00, 0xEF, 0xCD, 0xAB, 0x78, 0x56, 0x34, 0x12]));\n * assert(deserializer.deserializeU64() === 1311768467750121216);\n * ```\n * @group Implementation\n * @category BCS\n */\n deserializeU64(): Uint64 {\n const low = this.deserializeU32();\n const high = this.deserializeU32();\n\n // combine the two 32-bit values and return (little endian)\n return BigInt((BigInt(high) << BigInt(32)) | BigInt(low));\n }\n\n /**\n * Deserializes a uint128 number from its binary representation.\n * This function combines two 64-bit values to return a single uint128 value in little-endian format.\n *\n * @returns {BigInt} The deserialized uint128 number.\n * @group Implementation\n * @category BCS\n */\n deserializeU128(): Uint128 {\n const low = this.deserializeU64();\n const high = this.deserializeU64();\n\n // combine the two 64-bit values and return (little endian)\n return BigInt((high << BigInt(64)) | low);\n }\n\n /**\n * Deserializes a uint256 number from its binary representation.\n *\n * The BCS layout for \"uint256\" consists of thirty-two bytes in little-endian format.\n *\n * @returns {BigInt} The deserialized uint256 number.\n * @group Implementation\n * @category BCS\n */\n deserializeU256(): Uint256 {\n const low = this.deserializeU128();\n const high = this.deserializeU128();\n\n // combine the two 128-bit values and return (little endian)\n return BigInt((high << BigInt(128)) | low);\n }\n\n /**\n * Deserializes an 8-bit signed integer from the binary data.\n * BCS layout for \"int8\": One byte. Binary format in little-endian representation.\n *\n * @returns {number} The deserialized int8 number.\n * @group Implementation\n * @category BCS\n */\n deserializeI8(): number {\n const bytes = this.read(1);\n return new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength).getInt8(0);\n }\n\n /**\n * Deserializes a 16-bit signed integer from a binary format in little-endian representation.\n * BCS layout for \"int16\": Two bytes.\n *\n * @returns {number} The deserialized int16 number.\n * @group Implementation\n * @category BCS\n */\n deserializeI16(): number {\n const bytes = this.read(2);\n return new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength).getInt16(0, true);\n }\n\n /**\n * Deserializes a 32-bit signed integer from a binary format in little-endian representation.\n * BCS layout for \"int32\": Four bytes.\n *\n * @returns {number} The deserialized int32 number.\n * @group Implementation\n * @category BCS\n */\n deserializeI32(): number {\n const bytes = this.read(4);\n return new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength).getInt32(0, true);\n }\n\n /**\n * Deserializes a 64-bit signed integer.\n * This function combines two 32-bit values to return a 64-bit signed integer in little-endian representation.\n *\n * @returns {bigint} The deserialized int64 number.\n * @group Implementation\n * @category BCS\n */\n deserializeI64(): bigint {\n const low = this.deserializeU32();\n const high = this.deserializeU32();\n\n // combine the two 32-bit values (little endian)\n const unsigned = BigInt((BigInt(high) << BigInt(32)) | BigInt(low));\n\n // Convert from unsigned to signed using two's complement\n const signBit = BigInt(1) << BigInt(63);\n if (unsigned >= signBit) {\n return unsigned - (BigInt(1) << BigInt(64));\n }\n return unsigned;\n }\n\n /**\n * Deserializes a 128-bit signed integer from its binary representation.\n * This function combines two 64-bit values to return a single int128 value in little-endian format.\n *\n * @returns {bigint} The deserialized int128 number.\n * @group Implementation\n * @category BCS\n */\n deserializeI128(): bigint {\n const low = this.deserializeU64();\n const high = this.deserializeU64();\n\n // combine the two 64-bit values (little endian)\n const unsigned = BigInt((high << BigInt(64)) | low);\n\n // Convert from unsigned to signed using two's complement\n const signBit = BigInt(1) << BigInt(127);\n if (unsigned >= signBit) {\n return unsigned - (BigInt(1) << BigInt(128));\n }\n return unsigned;\n }\n\n /**\n * Deserializes a 256-bit signed integer from its binary representation.\n * BCS layout for \"int256\": Thirty-two bytes in little-endian format.\n *\n * @returns {bigint} The deserialized int256 number.\n * @group Implementation\n * @category BCS\n */\n deserializeI256(): bigint {\n const low = this.deserializeU128();\n const high = this.deserializeU128();\n\n // combine the two 128-bit values (little endian)\n const unsigned = BigInt((high << BigInt(128)) | low);\n\n // Convert from unsigned to signed using two's complement\n const signBit = BigInt(1) << BigInt(255);\n if (unsigned >= signBit) {\n return unsigned - (BigInt(1) << BigInt(256));\n }\n return unsigned;\n }\n\n /**\n * Deserializes a uleb128 encoded uint32 number.\n *\n * This function is used for interpreting lengths of variable-length sequences and tags of enum values in BCS encoding.\n *\n * @throws {Error} Throws an error if the parsed value exceeds the maximum uint32 number.\n * @throws {Error} Throws an error if the uleb128 encoding is malformed (too many bytes).\n * @returns {number} The deserialized uint32 value.\n * @group Implementation\n * @category BCS\n */\n deserializeUleb128AsU32(): Uint32 {\n let value: bigint = BigInt(0);\n let shift = 0;\n // Maximum 5 bytes for uleb128-encoded u32 (7 bits per byte, 5*7=35 bits > 32 bits needed)\n const MAX_ULEB128_BYTES = 5;\n let bytesRead = 0;\n\n while (bytesRead < MAX_ULEB128_BYTES) {\n const byte = this.deserializeU8();\n bytesRead += 1;\n\n value |= BigInt(byte & 0x7f) << BigInt(shift);\n\n // Early overflow check before continuing\n if (value > MAX_U32_NUMBER) {\n throw new Error(\"Overflow while parsing uleb128-encoded uint32 value\");\n }\n\n if ((byte & 0x80) === 0) {\n break;\n }\n\n shift += 7;\n }\n\n // If we read MAX_ULEB128_BYTES and the last byte had continuation bit set, it's malformed\n if (bytesRead === MAX_ULEB128_BYTES && value > MAX_U32_NUMBER) {\n throw new Error(\"Overflow while parsing uleb128-encoded uint32 value\");\n }\n\n return Number(value);\n }\n\n /**\n * Helper function that primarily exists to support alternative syntax for deserialization.\n * That is, if we have a `const deserializer: new Deserializer(...)`, instead of having to use\n * `MyClass.deserialize(deserializer)`, we can call `deserializer.deserialize(MyClass)`.\n *\n * @example const deserializer = new Deserializer(new Uint8Array([1, 2, 3]));\n * const value = deserializer.deserialize(MyClass); // where MyClass has a `deserialize` function\n * // value is now an instance of MyClass\n * // equivalent to `const value = MyClass.deserialize(deserializer)`\n * @param cls The BCS-deserializable class to deserialize the buffered bytes into.\n *\n * @returns the deserialized value of class type T\n * @group Implementation\n * @category BCS\n */\n deserialize<T>(cls: Deserializable<T>): T {\n // NOTE: `deserialize` in `cls.deserialize(this)` here is a static method defined in `cls`,\n // It is separate from the `deserialize` instance method defined here in Deserializer.\n return cls.deserialize(this);\n }\n\n /**\n * Deserializes an array of BCS Deserializable values given an existing Deserializer instance with a loaded byte buffer.\n *\n * @param cls The BCS-deserializable class to deserialize the buffered bytes into.\n * @returns An array of deserialized values of type T.\n * @example\n * // serialize a vector of addresses\n * const addresses = new Array<AccountAddress>(\n * AccountAddress.from(\"0x1\"),\n * AccountAddress.from(\"0x2\"),\n * AccountAddress.from(\"0xa\"),\n * AccountAddress.from(\"0xb\"),\n * );\n * const serializer = new Serializer();\n * serializer.serializeVector(addresses);\n * const serializedBytes = serializer.toUint8Array();\n *\n * // deserialize the bytes into an array of addresses\n * const deserializer = new Deserializer(serializedBytes);\n * const deserializedAddresses = deserializer.deserializeVector(AccountAddress);\n * // deserializedAddresses is now an array of AccountAddress instances\n * @group Implementation\n * @category BCS\n */\n deserializeVector<T>(cls: Deserializable<T>): Array<T> {\n const length = this.deserializeUleb128AsU32();\n const vector = new Array<T>();\n for (let i = 0; i < length; i += 1) {\n vector.push(this.deserialize(cls));\n }\n return vector;\n }\n}\n","import { AptosApiType } from \"../utils/const\";\nimport { getErrorMessage } from \"../utils/helpers\";\nimport { AptosRequest, AptosResponse } from \"../types\";\n\nexport enum KeylessErrorCategory {\n API_ERROR,\n EXTERNAL_API_ERROR,\n SESSION_EXPIRED,\n INVALID_STATE,\n INVALID_SIGNATURE,\n UNKNOWN,\n}\n\nexport enum KeylessErrorResolutionTip {\n REAUTHENTICATE = \"Re-authentiate to continue using your keyless account\",\n\n REAUTHENTICATE_UNSURE = \"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support\",\n UPDATE_REQUEST_PARAMS = \"Update the invalid request parameters and reauthenticate.\",\n\n RATE_LIMIT_EXCEEDED = \"Cache the keyless account and reuse it to avoid making too many requests. Keyless accounts are valid until either the EphemeralKeyPair expires, when the JWK is rotated, or when the proof verifying key is changed, whichever comes soonest.\",\n\n SERVER_ERROR = \"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx\",\n\n CALL_PRECHECK = \"Call `await account.checkKeylessAccountValidity()` to wait for asyncronous changes and check for account validity before signing or serializing.\",\n REINSTANTIATE = \"Try instantiating the account again. Avoid manipulating the account object directly\",\n JOIN_SUPPORT_GROUP = \"For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx\",\n UNKNOWN = \"Error unknown. For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx\",\n}\n\nexport enum KeylessErrorType {\n EPHEMERAL_KEY_PAIR_EXPIRED,\n\n PROOF_NOT_FOUND,\n\n ASYNC_PROOF_FETCH_FAILED,\n\n INVALID_PROOF_VERIFICATION_FAILED,\n\n INVALID_PROOF_VERIFICATION_KEY_NOT_FOUND,\n\n INVALID_JWT_SIG,\n\n INVALID_JWT_JWK_NOT_FOUND,\n\n INVALID_JWT_ISS_NOT_RECOGNIZED,\n\n INVALID_JWT_FEDERATED_ISS_NOT_SUPPORTED,\n\n INVALID_TW_SIG_VERIFICATION_FAILED,\n\n INVALID_TW_SIG_PUBLIC_KEY_NOT_FOUND,\n\n INVALID_EXPIRY_HORIZON,\n\n JWT_PARSING_ERROR,\n\n JWK_FETCH_FAILED,\n\n JWK_FETCH_FAILED_FEDERATED,\n\n RATE_LIMIT_EXCEEDED,\n\n PEPPER_SERVICE_INTERNAL_ERROR,\n\n PEPPER_SERVICE_BAD_REQUEST,\n\n PEPPER_SERVICE_OTHER,\n\n PROVER_SERVICE_INTERNAL_ERROR,\n\n PROVER_SERVICE_BAD_REQUEST,\n\n PROVER_SERVICE_OTHER,\n\n FULL_NODE_CONFIG_LOOKUP_ERROR,\n\n FULL_NODE_VERIFICATION_KEY_LOOKUP_ERROR,\n\n FULL_NODE_JWKS_LOOKUP_ERROR,\n\n FULL_NODE_OTHER,\n\n SIGNATURE_TYPE_INVALID,\n\n SIGNATURE_EXPIRED,\n\n MAX_EXPIRY_HORIZON_EXCEEDED,\n\n EPHEMERAL_SIGNATURE_VERIFICATION_FAILED,\n\n TRAINING_WHEELS_SIGNATURE_MISSING,\n\n TRAINING_WHEELS_SIGNATURE_VERIFICATION_FAILED,\n\n PROOF_VERIFICATION_FAILED,\n\n UNKNOWN,\n}\n\nconst KeylessErrors: { [key in KeylessErrorType]: [string, KeylessErrorCategory, KeylessErrorResolutionTip] } = {\n [KeylessErrorType.EPHEMERAL_KEY_PAIR_EXPIRED]: [\n \"The ephemeral keypair has expired.\",\n KeylessErrorCategory.SESSION_EXPIRED,\n KeylessErrorResolutionTip.REAUTHENTICATE,\n ],\n [KeylessErrorType.PROOF_NOT_FOUND]: [\n \"The required proof could not be found.\",\n KeylessErrorCategory.INVALID_STATE,\n KeylessErrorResolutionTip.CALL_PRECHECK,\n ],\n [KeylessErrorType.ASYNC_PROOF_FETCH_FAILED]: [\n \"The required proof failed to fetch.\",\n KeylessErrorCategory.INVALID_STATE,\n KeylessErrorResolutionTip.REAUTHENTICATE_UNSURE,\n ],\n [KeylessErrorType.INVALID_PROOF_VERIFICATION_FAILED]: [\n \"The provided proof is invalid.\",\n KeylessErrorCategory.INVALID_STATE,\n KeylessErrorResolutionTip.REAUTHENTICATE_UNSURE,\n ],\n [KeylessErrorType.INVALID_PROOF_VERIFICATION_KEY_NOT_FOUND]: [\n \"The verification key used to authenticate was updated.\",\n KeylessErrorCategory.SESSION_EXPIRED,\n KeylessErrorResolutionTip.REAUTHENTICATE,\n ],\n [KeylessErrorType.INVALID_JWT_SIG]: [\n \"The JWK was found, but JWT failed verification\",\n KeylessErrorCategory.INVALID_STATE,\n KeylessErrorResolutionTip.REAUTHENTICATE_UNSURE,\n ],\n [KeylessErrorType.INVALID_JWT_JWK_NOT_FOUND]: [\n \"The JWK required to verify the JWT could not be found. The JWK may have been rotated out.\",\n KeylessErrorCategory.SESSION_EXPIRED,\n KeylessErrorResolutionTip.REAUTHENTICATE,\n ],\n [KeylessErrorType.INVALID_JWT_ISS_NOT_RECOGNIZED]: [\n \"The JWT issuer is not recognized.\",\n KeylessErrorCategory.INVALID_STATE,\n KeylessErrorResolutionTip.UPDATE_REQUEST_PARAMS,\n ],\n [KeylessErrorType.INVALID_JWT_FEDERATED_ISS_NOT_SUPPORTED]: [\n \"The JWT issuer is not supported by the Federated Keyless \",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.REAUTHENTICATE_UNSURE,\n ],\n [KeylessErrorType.INVALID_TW_SIG_VERIFICATION_FAILED]: [\n \"The training wheels signature is invalid.\",\n KeylessErrorCategory.INVALID_STATE,\n KeylessErrorResolutionTip.REAUTHENTICATE_UNSURE,\n ],\n [KeylessErrorType.INVALID_TW_SIG_PUBLIC_KEY_NOT_FOUND]: [\n \"The public key used to verify the training wheels signature was not found.\",\n KeylessErrorCategory.SESSION_EXPIRED,\n KeylessErrorResolutionTip.REAUTHENTICATE,\n ],\n [KeylessErrorType.INVALID_EXPIRY_HORIZON]: [\n \"The expiry horizon is invalid.\",\n KeylessErrorCategory.SESSION_EXPIRED,\n KeylessErrorResolutionTip.REAUTHENTICATE,\n ],\n [KeylessErrorType.JWK_FETCH_FAILED]: [\n \"Failed to fetch JWKS.\",\n KeylessErrorCategory.EXTERNAL_API_ERROR,\n KeylessErrorResolutionTip.JOIN_SUPPORT_GROUP,\n ],\n [KeylessErrorType.JWK_FETCH_FAILED_FEDERATED]: [\n \"Failed to fetch JWKS for Federated Keyless provider.\",\n KeylessErrorCategory.EXTERNAL_API_ERROR,\n KeylessErrorResolutionTip.JOIN_SUPPORT_GROUP,\n ],\n [KeylessErrorType.RATE_LIMIT_EXCEEDED]: [\n \"Rate limit exceeded. Too many requests in a short period.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.RATE_LIMIT_EXCEEDED,\n ],\n [KeylessErrorType.PEPPER_SERVICE_INTERNAL_ERROR]: [\n \"Internal error from Pepper service.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.SERVER_ERROR,\n ],\n [KeylessErrorType.PEPPER_SERVICE_BAD_REQUEST]: [\n \"Bad request sent to Pepper service.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.UPDATE_REQUEST_PARAMS,\n ],\n [KeylessErrorType.PEPPER_SERVICE_OTHER]: [\n \"Unknown error from Pepper service.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.SERVER_ERROR,\n ],\n [KeylessErrorType.PROVER_SERVICE_INTERNAL_ERROR]: [\n \"Internal error from Prover service.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.SERVER_ERROR,\n ],\n [KeylessErrorType.PROVER_SERVICE_BAD_REQUEST]: [\n \"Bad request sent to Prover service.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.UPDATE_REQUEST_PARAMS,\n ],\n [KeylessErrorType.PROVER_SERVICE_OTHER]: [\n \"Unknown error from Prover service.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.SERVER_ERROR,\n ],\n [KeylessErrorType.JWT_PARSING_ERROR]: [\n \"Error when parsing JWT. This should never happen. Join https://t.me/+h5CN-W35yUFiYzkx for support\",\n KeylessErrorCategory.INVALID_STATE,\n KeylessErrorResolutionTip.REINSTANTIATE,\n ],\n [KeylessErrorType.FULL_NODE_CONFIG_LOOKUP_ERROR]: [\n \"Error when looking up on-chain keyless configuration.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.SERVER_ERROR,\n ],\n [KeylessErrorType.FULL_NODE_VERIFICATION_KEY_LOOKUP_ERROR]: [\n \"Error when looking up on-chain verification key.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.SERVER_ERROR,\n ],\n [KeylessErrorType.FULL_NODE_JWKS_LOOKUP_ERROR]: [\n \"Error when looking up on-chain JWKS.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.SERVER_ERROR,\n ],\n [KeylessErrorType.FULL_NODE_OTHER]: [\n \"Unknown error from full node.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.SERVER_ERROR,\n ],\n [KeylessErrorType.SIGNATURE_TYPE_INVALID]: [\n \"The signature is not a valid Keyless signature.\",\n KeylessErrorCategory.INVALID_SIGNATURE,\n KeylessErrorResolutionTip.JOIN_SUPPORT_GROUP,\n ],\n [KeylessErrorType.SIGNATURE_EXPIRED]: [\n \"The ephemeral key pair used to sign the message has expired.\",\n KeylessErrorCategory.INVALID_SIGNATURE,\n KeylessErrorResolutionTip.REAUTHENTICATE,\n ],\n [KeylessErrorType.MAX_EXPIRY_HORIZON_EXCEEDED]: [\n \"The expiry horizon on the signature exceeds the maximum allowed value.\",\n KeylessErrorCategory.INVALID_SIGNATURE,\n KeylessErrorResolutionTip.REAUTHENTICATE,\n ],\n [KeylessErrorType.EPHEMERAL_SIGNATURE_VERIFICATION_FAILED]: [\n \"Failed to verify the ephemeral signature with the ephemeral public key.\",\n KeylessErrorCategory.INVALID_SIGNATURE,\n KeylessErrorResolutionTip.REAUTHENTICATE,\n ],\n [KeylessErrorType.TRAINING_WHEELS_SIGNATURE_MISSING]: [\n \"The training wheels signature is missing but is required by the Keyless configuration.\",\n KeylessErrorCategory.INVALID_SIGNATURE,\n KeylessErrorResolutionTip.REAUTHENTICATE,\n ],\n [KeylessErrorType.TRAINING_WHEELS_SIGNATURE_VERIFICATION_FAILED]: [\n \"Failed to verify the training wheels signature with the training wheels public key.\",\n KeylessErrorCategory.INVALID_SIGNATURE,\n KeylessErrorResolutionTip.REAUTHENTICATE,\n ],\n [KeylessErrorType.PROOF_VERIFICATION_FAILED]: [\n \"The proof verification failed.\",\n KeylessErrorCategory.INVALID_SIGNATURE,\n KeylessErrorResolutionTip.REAUTHENTICATE,\n ],\n [KeylessErrorType.UNKNOWN]: [\n \"An unknown error has occurred.\",\n KeylessErrorCategory.UNKNOWN,\n KeylessErrorResolutionTip.UNKNOWN,\n ],\n};\n\nexport class KeylessError extends Error {\n readonly innerError?: unknown;\n\n readonly category: KeylessErrorCategory;\n\n readonly resolutionTip: KeylessErrorResolutionTip;\n\n readonly type: KeylessErrorType;\n\n readonly details?: string;\n\n /** @internal this constructor is for sdk internal use - do not instantiate outside of the SDK codebase */\n constructor(args: {\n innerError?: unknown;\n category: KeylessErrorCategory;\n resolutionTip: KeylessErrorResolutionTip;\n type: KeylessErrorType;\n message?: string;\n details?: string;\n }) {\n const { innerError, category, resolutionTip, type, message = KeylessErrors[type][0], details } = args;\n super(message);\n this.name = \"KeylessError\";\n this.innerError = innerError;\n this.category = category;\n this.resolutionTip = resolutionTip;\n this.type = type;\n this.details = details;\n this.message = KeylessError.constructMessage(message, resolutionTip, innerError, details);\n }\n\n static constructMessage(\n message: string,\n tip: KeylessErrorResolutionTip,\n innerError?: unknown,\n details?: string,\n ): string {\n let result = `\\nMessage: ${message}`;\n if (details) {\n result += `\\nDetails: ${details}`;\n }\n if (innerError instanceof AptosApiError) {\n result += `\\nAptosApiError: ${innerError.message}`;\n } else if (innerError !== undefined) {\n result += `\\nError: ${getErrorMessage(innerError)}`;\n }\n result += `\\nKeylessErrorResolutionTip: ${tip}`;\n return result;\n }\n\n /**\n * Static constructor that creates a KeylessError instance using the KeylessErrors constant\n * @param args.type The type of KeylessError\n * @param args.aptosApiError optional AptosApiError supplied for api errors\n * @param args.details optional details to include in the error message\n * @returns A new KeylessError instance\n */\n static fromErrorType(args: { type: KeylessErrorType; error?: unknown; details?: string }): KeylessError {\n const { error, type, details } = args;\n\n const [message, category, resolutionTip] = KeylessErrors[type];\n return new KeylessError({\n message,\n details,\n innerError: error,\n category,\n resolutionTip,\n type,\n });\n }\n}\n\n/**\n * Options for handling errors in the Aptos API.\n */\ntype AptosApiErrorOpts = {\n apiType: AptosApiType;\n aptosRequest: AptosRequest;\n aptosResponse: AptosResponse<any, any>;\n};\n\n/**\n * Represents an error returned from the Aptos API.\n * This class encapsulates the details of the error, including the request URL, response status, and additional data.\n *\n * @param name - The name of the error, which is always \"AptosApiError\".\n * @param url - The URL to which the request was made.\n * @param status - The HTTP response status code (e.g., 400).\n * @param statusText - The message associated with the response status.\n * @param data - The response data returned from the API.\n * @param request - The original AptosRequest that triggered the error.\n */\nexport class AptosApiError extends Error {\n readonly url: string;\n\n readonly status: number;\n\n readonly statusText: string;\n\n readonly data: any;\n\n readonly request: AptosRequest;\n\n /**\n * Constructs an instance of AptosApiError with relevant error details.\n *\n * @param opts - The options for creating the AptosApiError.\n * @param opts.apiType - The type of API that generated the error.\n * @param opts.aptosRequest - The request object that caused the error.\n * @param opts.aptosResponse - The response object containing error details.\n *\n * @internal This constructor is for SDK internal use - do not instantiate outside the SDK codebase.\n */\n constructor({ apiType, aptosRequest, aptosResponse }: AptosApiErrorOpts) {\n super(deriveErrorMessage({ apiType, aptosRequest, aptosResponse }));\n\n this.name = \"AptosApiError\";\n this.url = aptosResponse.url;\n this.status = aptosResponse.status;\n this.statusText = aptosResponse.statusText;\n this.data = aptosResponse.data;\n this.request = aptosRequest;\n }\n}\n\n/**\n * Derives an error message from the Aptos API response, providing context for debugging.\n * This function helps in understanding the nature of the error encountered during an API request.\n *\n * @param {AptosApiErrorOpts} opts - The options for deriving the error message.\n * @param {AptosApiType} opts.apiType - The type of API being called.\n * @param {AptosRequest} opts.aptosRequest - The original request made to the Aptos API.\n * @param {AptosResponse} opts.aptosResponse - The response received from the Aptos API.\n */\nfunction deriveErrorMessage({ apiType, aptosRequest, aptosResponse }: AptosApiErrorOpts): string {\n // extract the W3C trace_id from the response headers if it exists. Some services set this in the response, and it's useful for debugging.\n // See https://www.w3.org/TR/trace-context/#relationship-between-the-headers .\n const traceId = aptosResponse.headers?.traceparent?.split(\"-\")[1];\n const traceIdString = traceId ? `(trace_id:${traceId}) ` : \"\";\n\n const errorPrelude: string = `Request to [${apiType}]: ${aptosRequest.method} ${\n aptosResponse.url ?? aptosRequest.url\n } ${traceIdString}failed with`;\n\n // handle graphql responses from indexer api and extract the error message of the first error\n if (apiType === AptosApiType.INDEXER && aptosResponse.data?.errors?.[0]?.message != null) {\n return `${errorPrelude}: ${aptosResponse.data.errors[0].message}`;\n }\n\n // Received well-known structured error response body - simply serialize and return it.\n // We don't need http status codes etc. in this case.\n if (aptosResponse.data?.message != null && aptosResponse.data?.error_code != null) {\n return `${errorPrelude}: ${JSON.stringify(aptosResponse.data)}`;\n }\n\n // This is the generic/catch-all case. We received some response from the API, but it doesn't appear to be a well-known structure.\n // We print http status codes and the response body (after some trimming),\n // in the hope that this gives enough context what went wrong without printing overly huge messages.\n return `${errorPrelude} status: ${aptosResponse.statusText}(code:${\n aptosResponse.status\n }) and response body: ${serializeAnyPayloadForErrorMessage(aptosResponse.data)}`;\n}\n\nconst SERIALIZED_PAYLOAD_TRIM_TO_MAX_LENGTH = 400;\n\n/**\n * This function accepts a payload of any type (probably an object) and serializes it to a string\n * Since we don't know the type or size of the payload, and we don't want to add a huge object in full to the error message\n * we limit the to the first 200 and last 200 characters of the serialized payload and put a \"...\" in the middle.\n * @param payload - The payload to serialize, which can be of any type.\n *\n * @returns A string representation of the serialized payload, potentially truncated.\n */\nfunction serializeAnyPayloadForErrorMessage(payload: any): string {\n const serializedPayload = JSON.stringify(payload);\n if (serializedPayload.length <= SERIALIZED_PAYLOAD_TRIM_TO_MAX_LENGTH) {\n return serializedPayload;\n }\n return `truncated(original_size:${serializedPayload.length}): ${serializedPayload.slice(\n 0,\n SERIALIZED_PAYLOAD_TRIM_TO_MAX_LENGTH / 2,\n )}...${serializedPayload.slice(-SERIALIZED_PAYLOAD_TRIM_TO_MAX_LENGTH / 2)}`;\n}\n","// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { VERSION } from \"../version\";\nimport { AnyNumber, AptosRequest, AptosResponse, Client, ClientRequest, ClientResponse, MimeType } from \"../types\";\nimport { AptosApiType } from \"../utils\";\nimport { AptosApiError } from \"../errors\";\n\n/**\n * Sends a request using the specified options and returns the response.\n *\n * @param options - The options for the request.\n * @param options.url - The URL to send the request to.\n * @param options.method - The HTTP method to use for the request.\n * @param options.body - The body of the request.\n * @param options.contentType - The content type of the request.\n * @param options.params - The query parameters to include in the request.\n * @param options.overrides - Additional overrides for the request.\n * @param options.overrides.HEADERS - Custom headers to include in the request.\n * @param options.overrides.AUTH_TOKEN - The authorization token for the request.\n * @param options.overrides.API_KEY - The API key for the request.\n * @param options.overrides.http2 - Whether to use HTTP/2 for the request.\n * @param options.originMethod - The origin method for the request.\n * @param client - The client used to make the request.\n *\n * @returns The response from the request.\n * @group Implementation\n * @category Client\n */\nexport async function request<Req, Res>(options: ClientRequest<Req>, client: Client): Promise<ClientResponse<Res>> {\n const { url, method, body, contentType, params, overrides, originMethod } = options;\n const headers: Record<string, string | AnyNumber | boolean | undefined> = {\n ...overrides?.HEADERS,\n \"x-aptos-client\": `aptos-typescript-sdk/${VERSION}`,\n \"content-type\": contentType ?? MimeType.JSON,\n \"x-aptos-typescript-sdk-origin-method\": originMethod,\n };\n\n if (overrides?.AUTH_TOKEN) {\n headers.Authorization = `Bearer ${overrides?.AUTH_TOKEN}`;\n }\n if (overrides?.API_KEY) {\n headers.Authorization = `Bearer ${overrides?.API_KEY}`;\n }\n\n /*\n * make a call using the @aptos-labs/aptos-client package\n * {@link https://www.npmjs.com/package/@aptos-labs/aptos-client}\n */\n return client.provider<Req, Res>({\n url,\n method,\n body,\n params,\n headers,\n overrides,\n http2: overrides?.http2,\n });\n}\n\n/**\n * The main function to use when making an API request, returning the response or throwing an AptosApiError on failure.\n *\n * @param aptosRequestOpts - Options for the Aptos request, including the URL and path.\n * @param aptosConfig - The configuration information for the SDK client instance.\n * @param apiType - The type of API being accessed, which determines how the response is handled.\n * @returns The response from the API request or throws an AptosApiError if the request fails.\n * @group Implementation\n * @category Client\n */\nexport async function aptosRequest<Req extends {}, Res extends {}>(\n aptosRequestOpts: AptosRequest,\n aptosConfig: AptosConfig,\n apiType: AptosApiType,\n): Promise<AptosResponse<Req, Res>> {\n const { url, path } = aptosRequestOpts;\n const fullUrl = path ? `${url}/${path}` : url;\n const clientResponse = await request<Req, Res>({ ...aptosRequestOpts, url: fullUrl }, aptosConfig.client);\n\n const aptosResponse: AptosResponse<Req, Res> = {\n status: clientResponse.status,\n statusText: clientResponse.statusText ?? \"No status text provided\",\n data: clientResponse.data,\n headers: clientResponse.headers,\n config: clientResponse.config,\n request: clientResponse.request,\n url: fullUrl,\n };\n\n // Handle case for `Unauthorized` error (i.e. API_KEY error)\n if (aptosResponse.status === 401) {\n throw new AptosApiError({ apiType, aptosRequest: aptosRequestOpts, aptosResponse });\n }\n\n // to support both fullnode and indexer responses,\n // check if it is an indexer query, and adjust response.data\n if (apiType === AptosApiType.INDEXER) {\n const indexerResponse = aptosResponse.data as any;\n // Handle Indexer general errors\n if (indexerResponse.errors) {\n throw new AptosApiError({\n apiType,\n aptosRequest: aptosRequestOpts,\n aptosResponse,\n });\n }\n aptosResponse.data = indexerResponse.data as Res;\n } else if (apiType === AptosApiType.PEPPER || apiType === AptosApiType.PROVER) {\n if (aptosResponse.status >= 400) {\n throw new AptosApiError({ apiType, aptosRequest: aptosRequestOpts, aptosResponse });\n }\n }\n\n if (aptosResponse.status >= 200 && aptosResponse.status < 300) {\n return aptosResponse;\n }\n\n // We have to explicitly check for all request types, because if the error is a non-indexer error, but\n // comes from an indexer request (e.g. 404), we'll need to mention it appropriately\n throw new AptosApiError({ apiType, aptosRequest: aptosRequestOpts, aptosResponse });\n}\n","import { AnyPublicKeyVariant, SigningScheme as AuthenticationKeyScheme, HexInput } from \"../../types\";\nimport { Deserializer } from \"../../bcs/deserializer\";\nimport { Serializer } from \"../../bcs/serializer\";\nimport { AuthenticationKey } from \"../authenticationKey\";\nimport { AccountPublicKey, PublicKey } from \"./publicKey\";\nimport { Signature } from \"./signature\";\nimport { AnyPublicKey, AnySignature } from \"./singleKey\";\nimport { AptosConfig } from \"../../api\";\n\n/**\n * Counts the number of set bits (1s) in a byte.\n * This function can help you determine the population count of a given byte value.\n *\n * @param byte - The byte value for which to count the number of set bits.\n * @group Implementation\n * @category Serialization\n */\n\nfunction bitCount(byte: number) {\n let n = byte;\n n -= (n >> 1) & 0x55555555;\n n = (n & 0x33333333) + ((n >> 2) & 0x33333333);\n return (((n + (n >> 4)) & 0xf0f0f0f) * 0x1010101) >> 24;\n}\n\nconst MAX_NUM_KEYLESS_PUBLIC_FOR_MULTI_KEY = 3;\nexport abstract class AbstractMultiKey extends AccountPublicKey {\n publicKeys: PublicKey[];\n\n constructor(args: { publicKeys: PublicKey[] }) {\n super();\n this.publicKeys = args.publicKeys;\n }\n\n /**\n * Create a bitmap that holds the mapping from the original public keys\n * to the signatures passed in\n *\n * @param args.bits array of the index mapping to the matching public keys\n * @returns Uint8array bit map\n * @group Implementation\n * @category Serialization\n */\n createBitmap(args: { bits: number[] }): Uint8Array {\n const { bits } = args;\n // Bits are read from left to right. e.g. 0b10000000 represents the first bit is set in one byte.\n // The decimal value of 0b10000000 is 128.\n const firstBitInByte = 128;\n const bitmap = new Uint8Array([0, 0, 0, 0]);\n\n // Check if duplicates exist in bits\n const dupCheckSet = new Set();\n\n bits.forEach((bit: number, idx: number) => {\n if (idx + 1 > this.publicKeys.length) {\n throw new Error(`Signature index ${idx + 1} is out of public keys range, ${this.publicKeys.length}.`);\n }\n\n if (dupCheckSet.has(bit)) {\n throw new Error(`Duplicate bit ${bit} detected.`);\n }\n\n dupCheckSet.add(bit);\n\n const byteOffset = Math.floor(bit / 8);\n\n let byte = bitmap[byteOffset];\n\n byte |= firstBitInByte >> (bit % 8);\n\n bitmap[byteOffset] = byte;\n });\n\n return bitmap;\n }\n\n /**\n * Get the index of the provided public key.\n *\n * This function retrieves the index of a specified public key within the MultiKey.\n * If the public key does not exist, it throws an error.\n *\n * @param publicKey - The public key to find the index for.\n * @returns The corresponding index of the public key, if it exists.\n * @throws Error - If the public key is not found in the MultiKey.\n * @group Implementation\n * @category Serialization\n */\n getIndex(publicKey: PublicKey): number {\n const index = this.publicKeys.findIndex((pk) => pk.toString() === publicKey.toString());\n\n if (index !== -1) {\n return index;\n }\n throw new Error(`Public key ${publicKey} not found in multi key set ${this.publicKeys}`);\n }\n\n abstract getSignaturesRequired(): number;\n}\n\n/**\n * Represents a multi-key authentication scheme for accounts, allowing multiple public keys\n * to be associated with a single account. This class enforces a minimum number of valid signatures\n * required to authorize actions, ensuring enhanced security for multi-agent accounts.\n *\n * The public keys of each individual agent can be any type of public key supported by Aptos.\n * Since [AIP-55](https://github.com/aptos-foundation/AIPs/pull/263), Aptos supports\n * `Legacy` and `Unified` authentication keys.\n * @group Implementation\n * @category Serialization\n */\nexport class MultiKey extends AbstractMultiKey {\n /**\n * List of any public keys\n * @group Implementation\n * @category Serialization\n */\n public readonly publicKeys: AnyPublicKey[];\n\n /**\n * The minimum number of valid signatures required, for the number of public keys specified\n * @group Implementation\n * @category Serialization\n */\n public readonly signaturesRequired: number;\n\n /**\n * Signature for a K-of-N multi-sig transaction.\n * This constructor initializes a multi-signature transaction with the provided signatures and bitmap.\n *\n * @param args An object containing the parameters for the multi-signature transaction.\n * @param args.signatures A list of signatures.\n * @param args.bitmap A bitmap represented as a Uint8Array or an array of numbers, where each bit indicates whether a\n * corresponding signature is present. A maximum of 32 signatures is supported, and the length of the bitmap must be 4 bytes.\n *\n * @throws Error if the number of signatures exceeds the maximum supported, if the bitmap length is incorrect, or if the number\n * of signatures does not match the bitmap.\n * @group Implementation\n * @category Serialization\n */\n // region Constructors\n constructor(args: { publicKeys: Array<PublicKey>; signaturesRequired: number }) {\n const { publicKeys, signaturesRequired } = args;\n super({ publicKeys });\n\n // Validate number of public keys is greater than signature required\n if (signaturesRequired < 1) {\n throw new Error(\"The number of required signatures needs to be greater than 0\");\n }\n\n // Validate number of public keys is greater than signature required\n if (publicKeys.length < signaturesRequired) {\n throw new Error(\n `Provided ${publicKeys.length} public keys is smaller than the ${signaturesRequired} required signatures`,\n );\n }\n\n // Make sure that all keys are normalized to the SingleKey authentication scheme\n this.publicKeys = publicKeys.map((publicKey) =>\n publicKey instanceof AnyPublicKey ? publicKey : new AnyPublicKey(publicKey),\n );\n if (signaturesRequired > MAX_NUM_KEYLESS_PUBLIC_FOR_MULTI_KEY) {\n const keylessCount = this.publicKeys.filter(\n (pk) => pk.variant === AnyPublicKeyVariant.Keyless || pk.variant === AnyPublicKeyVariant.FederatedKeyless,\n ).length;\n if (keylessCount > MAX_NUM_KEYLESS_PUBLIC_FOR_MULTI_KEY) {\n throw new Error(\n `Construction of MultiKey with more than ${MAX_NUM_KEYLESS_PUBLIC_FOR_MULTI_KEY} keyless public keys is not allowed when signaturesRequired \n is greater than ${MAX_NUM_KEYLESS_PUBLIC_FOR_MULTI_KEY}. This is because a maximum of 3 keyless signatures are supported for a \n K-of-N MultiKey transaction.`,\n );\n }\n }\n\n this.signaturesRequired = signaturesRequired;\n }\n\n getSignaturesRequired(): number {\n return this.signaturesRequired;\n }\n\n // endregion\n\n // region AccountPublicKey\n\n /**\n * Verifies the provided signature against the given message.\n * This function helps ensure the integrity and authenticity of the message by checking if the signature is valid.\n *\n * Note: This function will fail if a keyless signature is used. Use `verifySignatureAsync` instead.\n *\n * @param args - The arguments for verifying the signature.\n * @param args.message - The message that was signed.\n * @param args.signature - The signature to verify.\n * @group Implementation\n * @category Serialization\n */\n verifySignature(args: { message: HexInput; signature: MultiKeySignature }): boolean {\n const { message, signature } = args;\n if (signature.signatures.length !== this.signaturesRequired) {\n throw new Error(\"The number of signatures does not match the number of required signatures\");\n }\n const signerIndices = signature.bitMapToSignerIndices();\n for (let i = 0; i < signature.signatures.length; i += 1) {\n const singleSignature = signature.signatures[i];\n const publicKey = this.publicKeys[signerIndices[i]];\n if (!publicKey.verifySignature({ message, signature: singleSignature })) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Verifies the provided signature against the given message.\n * This function helps ensure the integrity and authenticity of the message by checking if the signature is valid.\n *\n * @param args - The arguments for verifying the signature.\n * @param args.aptosConfig - The Aptos configuration to use\n * @param args.message - The message that was signed.\n * @param args.signature - The signature to verify.\n * @group Implementation\n * @category Serialization\n */\n async verifySignatureAsync(args: {\n aptosConfig: AptosConfig;\n message: HexInput;\n signature: Signature;\n options?: { throwErrorWithReason?: boolean };\n }): Promise<boolean> {\n const { signature } = args;\n try {\n if (!(signature instanceof MultiKeySignature)) {\n throw new Error(\"Signature is not a MultiKeySignature\");\n }\n if (signature.signatures.length !== this.signaturesRequired) {\n throw new Error(\"The number of signatures does not match the number of required signatures\");\n }\n const signerIndices = signature.bitMapToSignerIndices();\n for (let i = 0; i < signature.signatures.length; i += 1) {\n const singleSignature = signature.signatures[i];\n const publicKey = this.publicKeys[signerIndices[i]];\n if (!(await publicKey.verifySignatureAsync({ ...args, signature: singleSignature }))) {\n return false;\n }\n }\n return true;\n } catch (error) {\n if (args.options?.throwErrorWithReason) {\n throw error;\n }\n return false;\n }\n }\n\n /**\n * Generates an authentication key based on the current instance's byte representation.\n * This key can be used for secure authentication processes within the system.\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.MultiKey,\n input: this.toUint8Array(),\n });\n }\n\n // endregion\n\n // region Serializable\n\n /**\n * Serializes the object by writing its signatures and bitmap to the provided serializer.\n * This allows the object to be converted 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.serializeVector(this.publicKeys);\n serializer.serializeU8(this.signaturesRequired);\n }\n\n /**\n * Deserializes a MultiKeySignature from the provided deserializer.\n * This function retrieves the signatures and bitmap necessary for creating a MultiKeySignature object.\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): MultiKey {\n const keys = deserializer.deserializeVector(AnyPublicKey);\n const signaturesRequired = deserializer.deserializeU8();\n\n return new MultiKey({ publicKeys: keys, signaturesRequired });\n }\n\n // endregion\n\n /**\n * Get the index of the provided public key.\n *\n * This function retrieves the index of a specified public key within the MultiKey.\n * If the public key does not exist, it throws an error.\n *\n * @param publicKey - The public key to find the index for.\n * @returns The corresponding index of the public key, if it exists.\n * @throws Error - If the public key is not found in the MultiKey.\n * @group Implementation\n */\n getIndex(publicKey: PublicKey): number {\n const anyPublicKey = publicKey instanceof AnyPublicKey ? publicKey : new AnyPublicKey(publicKey);\n return super.getIndex(anyPublicKey);\n }\n\n public static isInstance(value: PublicKey): value is MultiKey {\n return \"publicKeys\" in value && \"signaturesRequired\" in value;\n }\n}\n\n/**\n * Represents a multi-signature transaction using Ed25519 signatures.\n * This class allows for the creation and management of a K-of-N multi-signature scheme,\n * where a specified number of signatures are required to authorize a transaction.\n *\n * It includes functionality to validate the number of signatures against a bitmap,\n * which indicates which public keys have signed the transaction.\n * @group Implementation\n * @category Serialization\n */\nexport class MultiKeySignature extends Signature {\n /**\n * Number of bytes in the bitmap representing who signed the transaction (32-bits)\n * @group Implementation\n * @category Serialization\n */\n static BITMAP_LEN: number = 4;\n\n /**\n * Maximum number of Ed25519 signatures supported\n * @group Implementation\n * @category Serialization\n */\n static MAX_SIGNATURES_SUPPORTED = MultiKeySignature.BITMAP_LEN * 8;\n\n /**\n * The list of underlying Ed25519 signatures\n * @group Implementation\n * @category Serialization\n */\n public readonly signatures: AnySignature[];\n\n /**\n * 32-bit Bitmap representing who signed the transaction\n *\n * This is represented where each public key can be masked to determine whether the message was signed by that key.\n * @group Implementation\n * @category Serialization\n */\n public readonly bitmap: Uint8Array;\n\n /**\n * Signature for a K-of-N multi-sig transaction.\n *\n * @see {@link\n * https://aptos.dev/integration/creating-a-signed-transaction/#multisignature-transactions | Creating a Signed Transaction}\n *\n * @param args.signatures A list of signatures\n * @param args.bitmap 4 bytes, at most 32 signatures are supported. If Nth bit value is `1`, the Nth\n * signature should be provided in `signatures`. Bits are read from left to right\n * @group Implementation\n * @category Serialization\n */\n constructor(args: { signatures: Array<Signature | AnySignature>; bitmap: Uint8Array | number[] }) {\n super();\n const { signatures, bitmap } = args;\n\n if (signatures.length > MultiKeySignature.MAX_SIGNATURES_SUPPORTED) {\n throw new Error(`The number of signatures cannot be greater than ${MultiKeySignature.MAX_SIGNATURES_SUPPORTED}`);\n }\n\n // Make sure that all signatures are normalized to the SingleKey authentication scheme\n this.signatures = signatures.map((signature) =>\n signature instanceof AnySignature ? signature : new AnySignature(signature),\n );\n\n if (!(bitmap instanceof Uint8Array)) {\n this.bitmap = MultiKeySignature.createBitmap({ bits: bitmap });\n } else if (bitmap.length !== MultiKeySignature.BITMAP_LEN) {\n throw new Error(`\"bitmap\" length should be ${MultiKeySignature.BITMAP_LEN}`);\n } else {\n this.bitmap = bitmap;\n }\n\n const nSignatures = this.bitmap.reduce((acc, byte) => acc + bitCount(byte), 0);\n if (nSignatures !== this.signatures.length) {\n throw new Error(`Expecting ${nSignatures} signatures from the bitmap, but got ${this.signatures.length}`);\n }\n }\n\n /**\n * Helper method to create a bitmap out of the specified bit positions\n * @param args.bits The bitmap positions that should be set. A position starts at index 0.\n * Valid position should range between 0 and 31.\n * @example\n * Here's an example of valid `bits`\n * ```\n * [0, 2, 31]\n * ```\n * `[0, 2, 31]` means the 1st, 3rd and 32nd bits should be set in the bitmap.\n * The result bitmap should be 0b1010000000000000000000000000001\n *\n * @returns bitmap that is 32bit long\n * @group Implementation\n * @category Serialization\n */\n static createBitmap(args: { bits: number[] }): Uint8Array {\n const { bits } = args;\n // Bits are read from left to right. e.g. 0b10000000 represents the first bit is set in one byte.\n // The decimal value of 0b10000000 is 128.\n const firstBitInByte = 128;\n const bitmap = new Uint8Array([0, 0, 0, 0]);\n\n // Check if duplicates exist in bits\n const dupCheckSet = new Set();\n\n bits.forEach((bit: number) => {\n if (bit >= MultiKeySignature.MAX_SIGNATURES_SUPPORTED) {\n throw new Error(`Cannot have a signature larger than ${MultiKeySignature.MAX_SIGNATURES_SUPPORTED - 1}.`);\n }\n\n if (dupCheckSet.has(bit)) {\n throw new Error(\"Duplicate bits detected.\");\n }\n\n dupCheckSet.add(bit);\n\n const byteOffset = Math.floor(bit / 8);\n\n let byte = bitmap[byteOffset];\n\n byte |= firstBitInByte >> (bit % 8);\n\n bitmap[byteOffset] = byte;\n });\n\n return bitmap;\n }\n\n /**\n * Converts the bitmap to an array of signer indices.\n *\n * Example:\n *\n * bitmap: [0b10001000, 0b01000000, 0b00000000, 0b00000000]\n * signerIndices: [0, 4, 9]\n *\n * @returns An array of signer indices.\n * @group Implementation\n * @category Serialization\n */\n bitMapToSignerIndices(): number[] {\n const signerIndices: number[] = [];\n for (let i = 0; i < this.bitmap.length; i += 1) {\n const byte = this.bitmap[i];\n for (let bit = 0; bit < 8; bit += 1) {\n if ((byte & (128 >> bit)) !== 0) {\n signerIndices.push(i * 8 + bit);\n }\n }\n }\n return signerIndices;\n }\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n // Note: we should not need to serialize the vector length, as it can be derived from the bitmap\n serializer.serializeVector(this.signatures);\n serializer.serializeBytes(this.bitmap);\n }\n\n static deserialize(deserializer: Deserializer): MultiKeySignature {\n const signatures = deserializer.deserializeVector(AnySignature);\n const bitmap = deserializer.deserializeBytes();\n return new MultiKeySignature({ signatures, bitmap });\n }\n\n // endregion\n}\n","import * as Types from \"./operations\";\n\nimport { GraphQLClient, RequestOptions } from \"graphql-request\";\ntype GraphQLClientRequestHeaders = RequestOptions[\"requestHeaders\"];\nexport const TokenActivitiesFieldsFragmentDoc = `\n fragment TokenActivitiesFields on token_activities_v2 {\n after_value\n before_value\n entry_function_id_str\n event_account_address\n event_index\n from_address\n is_fungible_v2\n property_version_v1\n to_address\n token_amount\n token_data_id\n token_standard\n transaction_timestamp\n transaction_version\n type\n}\n `;\nexport const AnsTokenFragmentFragmentDoc = `\n fragment AnsTokenFragment on current_aptos_names {\n domain\n expiration_timestamp\n registered_address\n subdomain\n token_standard\n is_primary\n owner_address\n subdomain_expiration_policy\n domain_expiration_timestamp\n}\n `;\nexport const CurrentTokenOwnershipFieldsFragmentDoc = `\n fragment CurrentTokenOwnershipFields on current_token_ownerships_v2 {\n token_standard\n token_properties_mutated_v1\n token_data_id\n table_type_v1\n storage_id\n property_version_v1\n owner_address\n last_transaction_version\n last_transaction_timestamp\n is_soulbound_v2\n is_fungible_v2\n amount\n current_token_data {\n collection_id\n description\n is_fungible_v2\n largest_property_version_v1\n last_transaction_timestamp\n last_transaction_version\n maximum\n supply\n token_data_id\n token_name\n token_properties\n token_standard\n token_uri\n decimals\n current_collection {\n collection_id\n collection_name\n creator_address\n current_supply\n description\n last_transaction_timestamp\n last_transaction_version\n max_supply\n mutable_description\n mutable_uri\n table_handle_v1\n token_standard\n total_minted_v2\n uri\n }\n }\n}\n `;\nexport const GetAccountAddressesForAuthKey = `\n query getAccountAddressesForAuthKey($where_condition: auth_key_account_addresses_bool_exp, $order_by: [auth_key_account_addresses_order_by!]) {\n auth_key_account_addresses(where: $where_condition, order_by: $order_by) {\n auth_key\n account_address\n last_transaction_version\n is_auth_key_used\n }\n}\n `;\nexport const GetAccountCoinsCount = `\n query getAccountCoinsCount($address: String) {\n current_fungible_asset_balances_aggregate(\n where: {owner_address: {_eq: $address}}\n ) {\n aggregate {\n count\n }\n }\n}\n `;\nexport const GetAccountCoinsData = `\n query getAccountCoinsData($where_condition: current_fungible_asset_balances_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_fungible_asset_balances_order_by!]) {\n current_fungible_asset_balances(\n where: $where_condition\n offset: $offset\n limit: $limit\n order_by: $order_by\n ) {\n amount\n asset_type\n is_frozen\n is_primary\n last_transaction_timestamp\n last_transaction_version\n owner_address\n storage_id\n token_standard\n metadata {\n token_standard\n symbol\n supply_aggregator_table_key_v1\n supply_aggregator_table_handle_v1\n project_uri\n name\n last_transaction_version\n last_transaction_timestamp\n icon_uri\n decimals\n creator_address\n asset_type\n }\n }\n}\n `;\nexport const GetAccountCollectionsWithOwnedTokens = `\n query getAccountCollectionsWithOwnedTokens($where_condition: current_collection_ownership_v2_view_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_collection_ownership_v2_view_order_by!]) {\n current_collection_ownership_v2_view(\n where: $where_condition\n offset: $offset\n limit: $limit\n order_by: $order_by\n ) {\n current_collection {\n collection_id\n collection_name\n creator_address\n current_supply\n description\n last_transaction_timestamp\n last_transaction_version\n mutable_description\n max_supply\n mutable_uri\n table_handle_v1\n token_standard\n total_minted_v2\n uri\n }\n collection_id\n collection_name\n collection_uri\n creator_address\n distinct_tokens\n last_transaction_version\n owner_address\n single_token_uri\n }\n}\n `;\nexport const GetAccountOwnedTokens = `\n query getAccountOwnedTokens($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {\n current_token_ownerships_v2(\n where: $where_condition\n offset: $offset\n limit: $limit\n order_by: $order_by\n ) {\n ...CurrentTokenOwnershipFields\n }\n}\n ${CurrentTokenOwnershipFieldsFragmentDoc}`;\nexport const GetAccountOwnedTokensByTokenData = `\n query getAccountOwnedTokensByTokenData($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {\n current_token_ownerships_v2(\n where: $where_condition\n offset: $offset\n limit: $limit\n order_by: $order_by\n ) {\n ...CurrentTokenOwnershipFields\n }\n}\n ${CurrentTokenOwnershipFieldsFragmentDoc}`;\nexport const GetAccountOwnedTokensFromCollection = `\n query getAccountOwnedTokensFromCollection($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {\n current_token_ownerships_v2(\n where: $where_condition\n offset: $offset\n limit: $limit\n order_by: $order_by\n ) {\n ...CurrentTokenOwnershipFields\n }\n}\n ${CurrentTokenOwnershipFieldsFragmentDoc}`;\nexport const GetAccountTokensCount = `\n query getAccountTokensCount($where_condition: current_token_ownerships_v2_bool_exp, $offset: Int, $limit: Int) {\n current_token_ownerships_v2_aggregate(\n where: $where_condition\n offset: $offset\n limit: $limit\n ) {\n aggregate {\n count\n }\n }\n}\n `;\nexport const GetAccountTransactionsCount = `\n query getAccountTransactionsCount($address: String) {\n account_transactions_aggregate(where: {account_address: {_eq: $address}}) {\n aggregate {\n count\n }\n }\n}\n `;\nexport const GetAuthKeysForPublicKey = `\n query getAuthKeysForPublicKey($where_condition: public_key_auth_keys_bool_exp, $order_by: [public_key_auth_keys_order_by!]) {\n public_key_auth_keys(where: $where_condition, order_by: $order_by) {\n public_key\n public_key_type\n auth_key\n account_public_key\n last_transaction_version\n is_public_key_used\n signature_type\n }\n}\n `;\nexport const GetChainTopUserTransactions = `\n query getChainTopUserTransactions($limit: Int) {\n user_transactions(limit: $limit, order_by: {version: desc}) {\n version\n }\n}\n `;\nexport const GetCollectionData = `\n query getCollectionData($where_condition: current_collections_v2_bool_exp!) {\n current_collections_v2(where: $where_condition) {\n uri\n total_minted_v2\n token_standard\n table_handle_v1\n mutable_uri\n mutable_description\n max_supply\n collection_id\n collection_name\n creator_address\n current_supply\n description\n last_transaction_timestamp\n last_transaction_version\n }\n}\n `;\nexport const GetCurrentFungibleAssetBalances = `\n query getCurrentFungibleAssetBalances($where_condition: current_fungible_asset_balances_bool_exp, $offset: Int, $limit: Int) {\n current_fungible_asset_balances(\n where: $where_condition\n offset: $offset\n limit: $limit\n ) {\n amount\n asset_type\n is_frozen\n is_primary\n last_transaction_timestamp\n last_transaction_version\n owner_address\n storage_id\n token_standard\n }\n}\n `;\nexport const GetDelegatedStakingActivities = `\n query getDelegatedStakingActivities($delegatorAddress: String, $poolAddress: String) {\n delegated_staking_activities(\n where: {delegator_address: {_eq: $delegatorAddress}, pool_address: {_eq: $poolAddress}}\n ) {\n amount\n delegator_address\n event_index\n event_type\n pool_address\n transaction_version\n }\n}\n `;\nexport const GetEvents = `\n query getEvents($where_condition: events_bool_exp, $offset: Int, $limit: Int, $order_by: [events_order_by!]) {\n events(\n where: $where_condition\n offset: $offset\n limit: $limit\n order_by: $order_by\n ) {\n account_address\n creation_number\n data\n event_index\n sequence_number\n transaction_block_height\n transaction_version\n type\n indexed_type\n }\n}\n `;\nexport const GetFungibleAssetActivities = `\n query getFungibleAssetActivities($where_condition: fungible_asset_activities_bool_exp, $offset: Int, $limit: Int) {\n fungible_asset_activities(\n where: $where_condition\n offset: $offset\n limit: $limit\n ) {\n amount\n asset_type\n block_height\n entry_function_id_str\n event_index\n gas_fee_payer_address\n is_frozen\n is_gas_fee\n is_transaction_success\n owner_address\n storage_id\n storage_refund_amount\n token_standard\n transaction_timestamp\n transaction_version\n type\n }\n}\n `;\nexport const GetFungibleAssetMetadata = `\n query getFungibleAssetMetadata($where_condition: fungible_asset_metadata_bool_exp, $offset: Int, $limit: Int) {\n fungible_asset_metadata(where: $where_condition, offset: $offset, limit: $limit) {\n icon_uri\n project_uri\n supply_aggregator_table_handle_v1\n supply_aggregator_table_key_v1\n creator_address\n asset_type\n decimals\n last_transaction_timestamp\n last_transaction_version\n name\n symbol\n token_standard\n supply_v2\n maximum_v2\n }\n}\n `;\nexport const GetNames = `\n query getNames($offset: Int, $limit: Int, $where_condition: current_aptos_names_bool_exp, $order_by: [current_aptos_names_order_by!]) {\n current_aptos_names(\n limit: $limit\n where: $where_condition\n order_by: $order_by\n offset: $offset\n ) {\n ...AnsTokenFragment\n }\n current_aptos_names_aggregate(where: $where_condition) {\n aggregate {\n count\n }\n }\n}\n ${AnsTokenFragmentFragmentDoc}`;\nexport const GetNumberOfDelegators = `\n query getNumberOfDelegators($where_condition: num_active_delegator_per_pool_bool_exp, $order_by: [num_active_delegator_per_pool_order_by!]) {\n num_active_delegator_per_pool(where: $where_condition, order_by: $order_by) {\n num_active_delegator\n pool_address\n }\n}\n `;\nexport const GetObjectData = `\n query getObjectData($where_condition: current_objects_bool_exp, $offset: Int, $limit: Int, $order_by: [current_objects_order_by!]) {\n current_objects(\n where: $where_condition\n offset: $offset\n limit: $limit\n order_by: $order_by\n ) {\n allow_ungated_transfer\n state_key_hash\n owner_address\n object_address\n last_transaction_version\n last_guid_creation_num\n is_deleted\n }\n}\n `;\nexport const GetProcessorStatus = `\n query getProcessorStatus($where_condition: processor_status_bool_exp) {\n processor_status(where: $where_condition) {\n last_success_version\n processor\n last_updated\n }\n}\n `;\nexport const GetTableItemsData = `\n query getTableItemsData($where_condition: table_items_bool_exp!, $offset: Int, $limit: Int, $order_by: [table_items_order_by!]) {\n table_items(\n where: $where_condition\n offset: $offset\n limit: $limit\n order_by: $order_by\n ) {\n decoded_key\n decoded_value\n key\n table_handle\n transaction_version\n write_set_change_index\n }\n}\n `;\nexport const GetTableItemsMetadata = `\n query getTableItemsMetadata($where_condition: table_metadatas_bool_exp!, $offset: Int, $limit: Int, $order_by: [table_metadatas_order_by!]) {\n table_metadatas(\n where: $where_condition\n offset: $offset\n limit: $limit\n order_by: $order_by\n ) {\n handle\n key_type\n value_type\n }\n}\n `;\nexport const GetTokenActivity = `\n query getTokenActivity($where_condition: token_activities_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [token_activities_v2_order_by!]) {\n token_activities_v2(\n where: $where_condition\n order_by: $order_by\n offset: $offset\n limit: $limit\n ) {\n ...TokenActivitiesFields\n }\n}\n ${TokenActivitiesFieldsFragmentDoc}`;\nexport const GetCurrentTokenOwnership = `\n query getCurrentTokenOwnership($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {\n current_token_ownerships_v2(\n where: $where_condition\n offset: $offset\n limit: $limit\n order_by: $order_by\n ) {\n ...CurrentTokenOwnershipFields\n }\n}\n ${CurrentTokenOwnershipFieldsFragmentDoc}`;\nexport const GetTokenData = `\n query getTokenData($where_condition: current_token_datas_v2_bool_exp, $offset: Int, $limit: Int, $order_by: [current_token_datas_v2_order_by!]) {\n current_token_datas_v2(\n where: $where_condition\n offset: $offset\n limit: $limit\n order_by: $order_by\n ) {\n collection_id\n description\n is_fungible_v2\n largest_property_version_v1\n last_transaction_timestamp\n last_transaction_version\n maximum\n supply\n token_data_id\n token_name\n token_properties\n token_standard\n token_uri\n decimals\n current_collection {\n collection_id\n collection_name\n creator_address\n current_supply\n description\n last_transaction_timestamp\n last_transaction_version\n max_supply\n mutable_description\n mutable_uri\n table_handle_v1\n token_standard\n total_minted_v2\n uri\n }\n }\n}\n `;\n\nexport type SdkFunctionWrapper = <T>(\n action: (requestHeaders?: Record<string, string>) => Promise<T>,\n operationName: string,\n operationType?: string,\n variables?: any,\n) => Promise<T>;\n\nconst defaultWrapper: SdkFunctionWrapper = (action, _operationName, _operationType, _variables) => action();\n\nexport function getSdk(client: GraphQLClient, withWrapper: SdkFunctionWrapper = defaultWrapper) {\n return {\n getAccountAddressesForAuthKey(\n variables?: Types.GetAccountAddressesForAuthKeyQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetAccountAddressesForAuthKeyQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetAccountAddressesForAuthKeyQuery>({\n document: GetAccountAddressesForAuthKey,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getAccountAddressesForAuthKey\",\n \"query\",\n variables,\n );\n },\n getAccountCoinsCount(\n variables?: Types.GetAccountCoinsCountQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetAccountCoinsCountQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetAccountCoinsCountQuery>({\n document: GetAccountCoinsCount,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getAccountCoinsCount\",\n \"query\",\n variables,\n );\n },\n getAccountCoinsData(\n variables: Types.GetAccountCoinsDataQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetAccountCoinsDataQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetAccountCoinsDataQuery>({\n document: GetAccountCoinsData,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getAccountCoinsData\",\n \"query\",\n variables,\n );\n },\n getAccountCollectionsWithOwnedTokens(\n variables: Types.GetAccountCollectionsWithOwnedTokensQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetAccountCollectionsWithOwnedTokensQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetAccountCollectionsWithOwnedTokensQuery>({\n document: GetAccountCollectionsWithOwnedTokens,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getAccountCollectionsWithOwnedTokens\",\n \"query\",\n variables,\n );\n },\n getAccountOwnedTokens(\n variables: Types.GetAccountOwnedTokensQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetAccountOwnedTokensQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetAccountOwnedTokensQuery>({\n document: GetAccountOwnedTokens,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getAccountOwnedTokens\",\n \"query\",\n variables,\n );\n },\n getAccountOwnedTokensByTokenData(\n variables: Types.GetAccountOwnedTokensByTokenDataQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetAccountOwnedTokensByTokenDataQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetAccountOwnedTokensByTokenDataQuery>({\n document: GetAccountOwnedTokensByTokenData,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getAccountOwnedTokensByTokenData\",\n \"query\",\n variables,\n );\n },\n getAccountOwnedTokensFromCollection(\n variables: Types.GetAccountOwnedTokensFromCollectionQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetAccountOwnedTokensFromCollectionQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetAccountOwnedTokensFromCollectionQuery>({\n document: GetAccountOwnedTokensFromCollection,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getAccountOwnedTokensFromCollection\",\n \"query\",\n variables,\n );\n },\n getAccountTokensCount(\n variables?: Types.GetAccountTokensCountQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetAccountTokensCountQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetAccountTokensCountQuery>({\n document: GetAccountTokensCount,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getAccountTokensCount\",\n \"query\",\n variables,\n );\n },\n getAccountTransactionsCount(\n variables?: Types.GetAccountTransactionsCountQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetAccountTransactionsCountQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetAccountTransactionsCountQuery>({\n document: GetAccountTransactionsCount,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getAccountTransactionsCount\",\n \"query\",\n variables,\n );\n },\n getAuthKeysForPublicKey(\n variables?: Types.GetAuthKeysForPublicKeyQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetAuthKeysForPublicKeyQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetAuthKeysForPublicKeyQuery>({\n document: GetAuthKeysForPublicKey,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getAuthKeysForPublicKey\",\n \"query\",\n variables,\n );\n },\n getChainTopUserTransactions(\n variables?: Types.GetChainTopUserTransactionsQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetChainTopUserTransactionsQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetChainTopUserTransactionsQuery>({\n document: GetChainTopUserTransactions,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getChainTopUserTransactions\",\n \"query\",\n variables,\n );\n },\n getCollectionData(\n variables: Types.GetCollectionDataQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetCollectionDataQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetCollectionDataQuery>({\n document: GetCollectionData,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getCollectionData\",\n \"query\",\n variables,\n );\n },\n getCurrentFungibleAssetBalances(\n variables?: Types.GetCurrentFungibleAssetBalancesQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetCurrentFungibleAssetBalancesQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetCurrentFungibleAssetBalancesQuery>({\n document: GetCurrentFungibleAssetBalances,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getCurrentFungibleAssetBalances\",\n \"query\",\n variables,\n );\n },\n getDelegatedStakingActivities(\n variables?: Types.GetDelegatedStakingActivitiesQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetDelegatedStakingActivitiesQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetDelegatedStakingActivitiesQuery>({\n document: GetDelegatedStakingActivities,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getDelegatedStakingActivities\",\n \"query\",\n variables,\n );\n },\n getEvents(\n variables?: Types.GetEventsQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetEventsQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetEventsQuery>({\n document: GetEvents,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getEvents\",\n \"query\",\n variables,\n );\n },\n getFungibleAssetActivities(\n variables?: Types.GetFungibleAssetActivitiesQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetFungibleAssetActivitiesQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetFungibleAssetActivitiesQuery>({\n document: GetFungibleAssetActivities,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getFungibleAssetActivities\",\n \"query\",\n variables,\n );\n },\n getFungibleAssetMetadata(\n variables?: Types.GetFungibleAssetMetadataQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetFungibleAssetMetadataQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetFungibleAssetMetadataQuery>({\n document: GetFungibleAssetMetadata,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getFungibleAssetMetadata\",\n \"query\",\n variables,\n );\n },\n getNames(\n variables?: Types.GetNamesQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetNamesQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetNamesQuery>({\n document: GetNames,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getNames\",\n \"query\",\n variables,\n );\n },\n getNumberOfDelegators(\n variables?: Types.GetNumberOfDelegatorsQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetNumberOfDelegatorsQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetNumberOfDelegatorsQuery>({\n document: GetNumberOfDelegators,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getNumberOfDelegators\",\n \"query\",\n variables,\n );\n },\n getObjectData(\n variables?: Types.GetObjectDataQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetObjectDataQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetObjectDataQuery>({\n document: GetObjectData,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getObjectData\",\n \"query\",\n variables,\n );\n },\n getProcessorStatus(\n variables?: Types.GetProcessorStatusQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetProcessorStatusQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetProcessorStatusQuery>({\n document: GetProcessorStatus,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getProcessorStatus\",\n \"query\",\n variables,\n );\n },\n getTableItemsData(\n variables: Types.GetTableItemsDataQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetTableItemsDataQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetTableItemsDataQuery>({\n document: GetTableItemsData,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getTableItemsData\",\n \"query\",\n variables,\n );\n },\n getTableItemsMetadata(\n variables: Types.GetTableItemsMetadataQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetTableItemsMetadataQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetTableItemsMetadataQuery>({\n document: GetTableItemsMetadata,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getTableItemsMetadata\",\n \"query\",\n variables,\n );\n },\n getTokenActivity(\n variables: Types.GetTokenActivityQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetTokenActivityQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetTokenActivityQuery>({\n document: GetTokenActivity,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getTokenActivity\",\n \"query\",\n variables,\n );\n },\n getCurrentTokenOwnership(\n variables: Types.GetCurrentTokenOwnershipQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetCurrentTokenOwnershipQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetCurrentTokenOwnershipQuery>({\n document: GetCurrentTokenOwnership,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getCurrentTokenOwnership\",\n \"query\",\n variables,\n );\n },\n getTokenData(\n variables?: Types.GetTokenDataQueryVariables,\n requestHeaders?: GraphQLClientRequestHeaders,\n signal?: RequestInit[\"signal\"],\n ): Promise<Types.GetTokenDataQuery> {\n return withWrapper(\n (wrappedRequestHeaders) =>\n client.request<Types.GetTokenDataQuery>({\n document: GetTokenData,\n variables,\n requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders },\n signal,\n }),\n \"getTokenData\",\n \"query\",\n variables,\n );\n },\n };\n}\nexport type Sdk = ReturnType<typeof getSdk>;\n","import { AptosConfig } from \"../api/aptosConfig\";\nimport { postAptosFullNode } from \"../client\";\nimport {\n TableItemRequest,\n LedgerVersionArg,\n PaginationArgs,\n WhereArg,\n OrderByArg,\n GetTableItemsDataResponse,\n GetTableItemsMetadataResponse,\n} from \"../types\";\nimport { GetTableItemsDataQuery, GetTableItemsMetadataQuery } from \"../types/generated/operations\";\nimport { GetTableItemsData, GetTableItemsMetadata } from \"../types/generated/queries\";\nimport { TableItemsBoolExp, TableMetadatasBoolExp } from \"../types/generated/types\";\nimport { queryIndexer } from \"./general\";\n\n/**\n * Retrieves a specific item from a table in the Aptos blockchain.\n *\n * @param args - The arguments for retrieving the table item.\n * @param args.aptosConfig - The configuration for connecting to the Aptos blockchain.\n * @param args.handle - The identifier for the table from which to retrieve the item.\n * @param args.data - The request data for the table item.\n * @param args.options - Optional parameters for the request, including ledger version.\n * @group Implementation\n */\nexport async function getTableItem<T>(args: {\n aptosConfig: AptosConfig;\n handle: string;\n data: TableItemRequest;\n options?: LedgerVersionArg;\n}): Promise<T> {\n const { aptosConfig, handle, data, options } = args;\n const response = await postAptosFullNode<TableItemRequest, any>({\n aptosConfig,\n originMethod: \"getTableItem\",\n path: `tables/${handle}/item`,\n params: { ledger_version: options?.ledgerVersion },\n body: data,\n });\n return response.data as T;\n}\n\n/**\n * Retrieves table items data based on specified conditions and pagination options.\n *\n * @param args - The arguments for retrieving table items data.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.options - Optional parameters for pagination and filtering.\n * @param args.options.offset - The number of items to skip before starting to collect the result set.\n * @param args.options.limit - The maximum number of items to return.\n * @param args.options.where - Conditions to filter the table items.\n * @param args.options.orderBy - The criteria to sort the results.\n * @group Implementation\n */\nexport async function getTableItemsData(args: {\n aptosConfig: AptosConfig;\n options?: PaginationArgs & WhereArg<TableItemsBoolExp> & OrderByArg<GetTableItemsDataResponse[0]>;\n}) {\n const { aptosConfig, options } = args;\n\n const graphqlQuery = {\n query: GetTableItemsData,\n variables: {\n where_condition: options?.where,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetTableItemsDataQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getTableItemsData\",\n });\n\n return data.table_items;\n}\n\n/**\n * Retrieves metadata for table items based on specified options.\n *\n * @param args - The arguments for retrieving table items metadata.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.options - Optional parameters for pagination and filtering.\n * @param args.options.offset - The number of items to skip before starting to collect the result set.\n * @param args.options.limit - The maximum number of items to return.\n * @param args.options.where - Conditions to filter the results.\n * @param args.options.orderBy - The order in which to return the results.\n * @returns A promise that resolves to an array of table metadata.\n * @group Implementation\n */\nexport async function getTableItemsMetadata(args: {\n aptosConfig: AptosConfig;\n options?: PaginationArgs & WhereArg<TableMetadatasBoolExp> & OrderByArg<GetTableItemsMetadataResponse[0]>;\n}): Promise<GetTableItemsMetadataResponse> {\n const { aptosConfig, options } = args;\n\n const graphqlQuery = {\n query: GetTableItemsMetadata,\n variables: {\n where_condition: options?.where,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetTableItemsMetadataQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getTableItemsMetadata\",\n });\n\n return data.table_metadatas;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { q as AnyPublicKey, bQ as PrivateKeyInput, b as AccountAddress, c7 as SigningScheme, c as AccountAddressInput, c8 as SigningSchemeInput, ak as HexInput, u as AnySignature, x as AptosConfig, c6 as Signature, j as AccountAuthenticatorSingleKey, s as AnyRawTransaction, m as AccountPublicKey, X as Ed25519PrivateKey, C as AuthenticationKey, d as AccountAuthenticator, di as VerifySignatureArgs, Y as Ed25519PublicKey, Z as Ed25519Signature, f as AccountAuthenticatorEd25519 } from './account-Dg0ejXHy.mjs';
1
+ import { q as AnyPublicKey, bQ as PrivateKeyInput, b as AccountAddress, c7 as SigningScheme, c as AccountAddressInput, c8 as SigningSchemeInput, ak as HexInput, u as AnySignature, x as AptosConfig, c6 as Signature, j as AccountAuthenticatorSingleKey, s as AnyRawTransaction, m as AccountPublicKey, X as Ed25519PrivateKey, C as AuthenticationKey, d as AccountAuthenticator, di as VerifySignatureArgs, Y as Ed25519PublicKey, Z as Ed25519Signature, f as AccountAuthenticatorEd25519 } from './account-sIOs_9XJ.mjs';
2
2
 
3
3
  /**
4
4
  * An interface which defines if an Account utilizes SingleKey signing.
@@ -1,7 +1,7 @@
1
- import { c3 as Serializable, x as AptosConfig, b as AccountAddress, c7 as SigningScheme, ak as HexInput, q as AnyPublicKey, c5 as Serializer, V as Deserializer, j as AccountAuthenticatorSingleKey, s as AnyRawTransaction, t as AnyRawTransactionInstance } from '../account-Dg0ejXHy.mjs';
2
- import { A as Account, i as SingleKeySigner } from '../Ed25519Account-BCt2cu_M.mjs';
1
+ import { c3 as Serializable, x as AptosConfig, b as AccountAddress, c7 as SigningScheme, ak as HexInput, q as AnyPublicKey, c5 as Serializer, V as Deserializer, j as AccountAuthenticatorSingleKey, s as AnyRawTransaction, t as AnyRawTransactionInstance } from '../account-sIOs_9XJ.mjs';
2
+ import { A as Account, i as SingleKeySigner } from '../Ed25519Account-DpZh3fRy.mjs';
3
3
  import { EphemeralKeyPair } from './EphemeralKeyPair.mjs';
4
- import { d as KeylessPublicKey, F as FederatedKeylessPublicKey, Z as ZeroKnowledgeSig, e as KeylessSignature, l as MoveJWK, K as KeylessConfiguration, m as ZkProof } from '../federatedKeyless-BYLu31Sa.mjs';
4
+ import { d as KeylessPublicKey, F as FederatedKeylessPublicKey, Z as ZeroKnowledgeSig, e as KeylessSignature, l as MoveJWK, K as KeylessConfiguration, m as ZkProof } from '../federatedKeyless-Cuo0IGJ6.mjs';
5
5
  import '../types/indexer.mjs';
6
6
  import '../types/generated/operations.mjs';
7
7
  import '../types/generated/types.mjs';
@@ -1,2 +1,2 @@
1
- import{mb as a,nb as b,ob as c}from"../chunk-6CD6PDFJ.mjs";import"../chunk-A5L76YP7.mjs";import"../chunk-UPHD2B4I.mjs";import"../chunk-UYVPNUH3.mjs";import"../chunk-POQ4FT4E.mjs";import"../chunk-R7PCBRRT.mjs";import"../chunk-YJVBGKWM.mjs";import"../chunk-5HXLZHDW.mjs";import"../chunk-G3MHXDYA.mjs";import"../chunk-YTFJ5W7U.mjs";import"../chunk-F45HI7LU.mjs";import"../chunk-F4LHBGG2.mjs";import"../chunk-5HHC2YG4.mjs";import"../chunk-NECL5FCQ.mjs";import"../chunk-4QMXOWHP.mjs";import"../chunk-QRW7MQDA.mjs";import"../chunk-EIWPAECI.mjs";import"../chunk-2VBY2V4Z.mjs";import"../chunk-C3Q23D22.mjs";import"../chunk-UVJW4DPP.mjs";import"../chunk-ZP4DWSQA.mjs";import"../chunk-V3MBJJTL.mjs";import"../chunk-LDK76MDN.mjs";import"../chunk-X4IR6WX6.mjs";import"../chunk-KOVWYU53.mjs";import"../chunk-H2T2SU5O.mjs";import"../chunk-T32P4APJ.mjs";import"../chunk-G5OONGWS.mjs";import"../chunk-ODNZJSOC.mjs";import"../chunk-TSPG5VED.mjs";import"../chunk-7ECCT6PK.mjs";import"../chunk-2VHA77EO.mjs";import"../chunk-NWP2VEMB.mjs";import"../chunk-UYG4XVVO.mjs";import"../chunk-Q4KYBAYN.mjs";import"../chunk-HGLO5LDS.mjs";import"../chunk-ITZN23GU.mjs";import"../chunk-ASFFADWS.mjs";import"../chunk-P5HCJN3A.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-WFZFTRRS.mjs";import"../chunk-BT742BFQ.mjs";import"../chunk-E3DHFXN4.mjs";import"../chunk-CD3EZCI5.mjs";import"../chunk-M65PXVDO.mjs";import"../chunk-5LMLIRGK.mjs";import"../chunk-C2KVLMPH.mjs";import"../chunk-FDHHQUS3.mjs";import"../chunk-DE5K76I2.mjs";import"../chunk-NP2IAUME.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-Q5ESW36C.mjs";import"../chunk-66F7RP7K.mjs";import"../chunk-TAHLOBRG.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-X2TPNKLV.mjs";import"../chunk-AUGTNOKZ.mjs";import"../chunk-KDMSOCZY.mjs";export{b as AbstractKeylessAccount,c as TransactionAndProof,a as isKeylessSigner};
1
+ import{mb as a,nb as b,ob as c}from"../chunk-IZF6POVR.mjs";import"../chunk-G3MHXDYA.mjs";import"../chunk-NNXTS2GB.mjs";import"../chunk-UYVPNUH3.mjs";import"../chunk-A5L76YP7.mjs";import"../chunk-3ZC6F5SJ.mjs";import"../chunk-2YA4KQUV.mjs";import"../chunk-NPWYZVHE.mjs";import"../chunk-UVNAHETD.mjs";import"../chunk-5HXLZHDW.mjs";import"../chunk-F45HI7LU.mjs";import"../chunk-LVZ7QMUH.mjs";import"../chunk-RB2GC7FW.mjs";import"../chunk-NECL5FCQ.mjs";import"../chunk-4QMXOWHP.mjs";import"../chunk-ZOSOF6ST.mjs";import"../chunk-NHRPXEUE.mjs";import"../chunk-A5H5VKUI.mjs";import"../chunk-C3Q23D22.mjs";import"../chunk-UVJW4DPP.mjs";import"../chunk-V3MBJJTL.mjs";import"../chunk-ZP4DWSQA.mjs";import"../chunk-RZNP3WG4.mjs";import"../chunk-226FBOWQ.mjs";import"../chunk-4KEZEYCV.mjs";import"../chunk-NTMFADQ7.mjs";import"../chunk-WZZ7PJ3X.mjs";import"../chunk-MKTR4U2R.mjs";import"../chunk-G5OONGWS.mjs";import"../chunk-ODNZJSOC.mjs";import"../chunk-7ECCT6PK.mjs";import"../chunk-TBIK7DML.mjs";import"../chunk-DPHBSAZQ.mjs";import"../chunk-2DQRUJUC.mjs";import"../chunk-HGLO5LDS.mjs";import"../chunk-ITZN23GU.mjs";import"../chunk-IEW452EO.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-2EBXCCLB.mjs";import"../chunk-WOPHK7LB.mjs";import"../chunk-F4RJMSAW.mjs";import"../chunk-KKPH2JUV.mjs";import"../chunk-M65PXVDO.mjs";import"../chunk-FAOLAKLJ.mjs";import"../chunk-P5HCJN3A.mjs";import"../chunk-GJYLYE6R.mjs";import"../chunk-GYYSHYO5.mjs";import"../chunk-6T2OBPIF.mjs";import"../chunk-DE5K76I2.mjs";import"../chunk-Q5ESW36C.mjs";import"../chunk-NP2IAUME.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-RUKFK3OC.mjs";import"../chunk-TAHLOBRG.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-X2TPNKLV.mjs";import"../chunk-RYCI4VKO.mjs";import"../chunk-KDMSOCZY.mjs";export{b as AbstractKeylessAccount,c as TransactionAndProof,a as isKeylessSigner};
2
2
  //# sourceMappingURL=AbstractKeylessAccount.mjs.map
@@ -1,6 +1,6 @@
1
- import { b as AccountAddress, c7 as SigningScheme, ak as HexInput, e as AccountAuthenticatorAbstraction, s as AnyRawTransaction } from '../account-Dg0ejXHy.mjs';
1
+ import { b as AccountAddress, c7 as SigningScheme, ak as HexInput, e as AccountAuthenticatorAbstraction, s as AnyRawTransaction } from '../account-sIOs_9XJ.mjs';
2
2
  import { AbstractPublicKey, AbstractSignature } from '../core/crypto/abstraction.mjs';
3
- import { A as Account, E as Ed25519Account } from '../Ed25519Account-BCt2cu_M.mjs';
3
+ import { A as Account, E as Ed25519Account } from '../Ed25519Account-DpZh3fRy.mjs';
4
4
  import '../types/indexer.mjs';
5
5
  import '../types/generated/operations.mjs';
6
6
  import '../types/generated/types.mjs';
@@ -1,2 +1,2 @@
1
- import{vb as a}from"../chunk-6CD6PDFJ.mjs";import"../chunk-A5L76YP7.mjs";import"../chunk-UPHD2B4I.mjs";import"../chunk-UYVPNUH3.mjs";import"../chunk-POQ4FT4E.mjs";import"../chunk-R7PCBRRT.mjs";import"../chunk-YJVBGKWM.mjs";import"../chunk-5HXLZHDW.mjs";import"../chunk-G3MHXDYA.mjs";import"../chunk-YTFJ5W7U.mjs";import"../chunk-F45HI7LU.mjs";import"../chunk-F4LHBGG2.mjs";import"../chunk-5HHC2YG4.mjs";import"../chunk-NECL5FCQ.mjs";import"../chunk-4QMXOWHP.mjs";import"../chunk-QRW7MQDA.mjs";import"../chunk-EIWPAECI.mjs";import"../chunk-2VBY2V4Z.mjs";import"../chunk-C3Q23D22.mjs";import"../chunk-UVJW4DPP.mjs";import"../chunk-ZP4DWSQA.mjs";import"../chunk-V3MBJJTL.mjs";import"../chunk-LDK76MDN.mjs";import"../chunk-X4IR6WX6.mjs";import"../chunk-KOVWYU53.mjs";import"../chunk-H2T2SU5O.mjs";import"../chunk-T32P4APJ.mjs";import"../chunk-G5OONGWS.mjs";import"../chunk-ODNZJSOC.mjs";import"../chunk-TSPG5VED.mjs";import"../chunk-7ECCT6PK.mjs";import"../chunk-2VHA77EO.mjs";import"../chunk-NWP2VEMB.mjs";import"../chunk-UYG4XVVO.mjs";import"../chunk-Q4KYBAYN.mjs";import"../chunk-HGLO5LDS.mjs";import"../chunk-ITZN23GU.mjs";import"../chunk-ASFFADWS.mjs";import"../chunk-P5HCJN3A.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-WFZFTRRS.mjs";import"../chunk-BT742BFQ.mjs";import"../chunk-E3DHFXN4.mjs";import"../chunk-CD3EZCI5.mjs";import"../chunk-M65PXVDO.mjs";import"../chunk-5LMLIRGK.mjs";import"../chunk-C2KVLMPH.mjs";import"../chunk-FDHHQUS3.mjs";import"../chunk-DE5K76I2.mjs";import"../chunk-NP2IAUME.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-Q5ESW36C.mjs";import"../chunk-66F7RP7K.mjs";import"../chunk-TAHLOBRG.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-X2TPNKLV.mjs";import"../chunk-AUGTNOKZ.mjs";import"../chunk-KDMSOCZY.mjs";export{a as AbstractedAccount};
1
+ import{vb as a}from"../chunk-IZF6POVR.mjs";import"../chunk-G3MHXDYA.mjs";import"../chunk-NNXTS2GB.mjs";import"../chunk-UYVPNUH3.mjs";import"../chunk-A5L76YP7.mjs";import"../chunk-3ZC6F5SJ.mjs";import"../chunk-2YA4KQUV.mjs";import"../chunk-NPWYZVHE.mjs";import"../chunk-UVNAHETD.mjs";import"../chunk-5HXLZHDW.mjs";import"../chunk-F45HI7LU.mjs";import"../chunk-LVZ7QMUH.mjs";import"../chunk-RB2GC7FW.mjs";import"../chunk-NECL5FCQ.mjs";import"../chunk-4QMXOWHP.mjs";import"../chunk-ZOSOF6ST.mjs";import"../chunk-NHRPXEUE.mjs";import"../chunk-A5H5VKUI.mjs";import"../chunk-C3Q23D22.mjs";import"../chunk-UVJW4DPP.mjs";import"../chunk-V3MBJJTL.mjs";import"../chunk-ZP4DWSQA.mjs";import"../chunk-RZNP3WG4.mjs";import"../chunk-226FBOWQ.mjs";import"../chunk-4KEZEYCV.mjs";import"../chunk-NTMFADQ7.mjs";import"../chunk-WZZ7PJ3X.mjs";import"../chunk-MKTR4U2R.mjs";import"../chunk-G5OONGWS.mjs";import"../chunk-ODNZJSOC.mjs";import"../chunk-7ECCT6PK.mjs";import"../chunk-TBIK7DML.mjs";import"../chunk-DPHBSAZQ.mjs";import"../chunk-2DQRUJUC.mjs";import"../chunk-HGLO5LDS.mjs";import"../chunk-ITZN23GU.mjs";import"../chunk-IEW452EO.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-2EBXCCLB.mjs";import"../chunk-WOPHK7LB.mjs";import"../chunk-F4RJMSAW.mjs";import"../chunk-KKPH2JUV.mjs";import"../chunk-M65PXVDO.mjs";import"../chunk-FAOLAKLJ.mjs";import"../chunk-P5HCJN3A.mjs";import"../chunk-GJYLYE6R.mjs";import"../chunk-GYYSHYO5.mjs";import"../chunk-6T2OBPIF.mjs";import"../chunk-DE5K76I2.mjs";import"../chunk-Q5ESW36C.mjs";import"../chunk-NP2IAUME.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-RUKFK3OC.mjs";import"../chunk-TAHLOBRG.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-X2TPNKLV.mjs";import"../chunk-RYCI4VKO.mjs";import"../chunk-KDMSOCZY.mjs";export{a as AbstractedAccount};
2
2
  //# sourceMappingURL=AbstractedAccount.mjs.map
@@ -1,5 +1,5 @@
1
- import '../account-Dg0ejXHy.mjs';
2
- export { A as Account, C as CreateAccountFromPrivateKeyArgs, a as CreateEd25519AccountFromPrivateKeyArgs, b as CreateEd25519SingleKeyAccountFromPrivateKeyArgs, c as CreateSingleKeyAccountFromPrivateKeyArgs, G as GenerateAccountArgs, f as GenerateEd25519AccountArgs, g as GenerateEd25519SingleKeyAccountArgs, h as GenerateSingleKeyAccountArgs, P as PrivateKeyFromDerivationPathArgs } from '../Ed25519Account-BCt2cu_M.mjs';
1
+ import '../account-sIOs_9XJ.mjs';
2
+ export { A as Account, C as CreateAccountFromPrivateKeyArgs, a as CreateEd25519AccountFromPrivateKeyArgs, b as CreateEd25519SingleKeyAccountFromPrivateKeyArgs, c as CreateSingleKeyAccountFromPrivateKeyArgs, G as GenerateAccountArgs, f as GenerateEd25519AccountArgs, g as GenerateEd25519SingleKeyAccountArgs, h as GenerateSingleKeyAccountArgs, P as PrivateKeyFromDerivationPathArgs } from '../Ed25519Account-DpZh3fRy.mjs';
3
3
  import '../types/indexer.mjs';
4
4
  import '../types/generated/operations.mjs';
5
5
  import '../types/generated/types.mjs';