@aptos-labs/ts-sdk 5.1.0 → 5.1.1-side-effect-free.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (417) hide show
  1. package/dist/common/{account-BW99GTa5.d.ts → account-Dr4y1uZG.d.ts} +1 -0
  2. package/dist/common/chunk-AWFAHZSB.js +4 -0
  3. package/dist/common/{chunk-A2XB7TVI.js.map → chunk-AWFAHZSB.js.map} +1 -1
  4. package/dist/common/cli/index.d.ts +1 -1
  5. package/dist/common/cli/index.js +1 -1
  6. package/dist/common/cli/index.js.map +1 -1
  7. package/dist/common/index.d.ts +14 -3
  8. package/dist/common/index.js +34 -34
  9. package/dist/common/index.js.map +1 -1
  10. package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
  11. package/dist/esm/account/AbstractKeylessAccount.mjs.map +1 -1
  12. package/dist/esm/account/AbstractedAccount.mjs +1 -1
  13. package/dist/esm/account/AbstractedAccount.mjs.map +1 -1
  14. package/dist/esm/account/Account.mjs +1 -1
  15. package/dist/esm/account/Account.mjs.map +1 -1
  16. package/dist/esm/account/AccountUtils.mjs +1 -1
  17. package/dist/esm/account/AccountUtils.mjs.map +1 -1
  18. package/dist/esm/account/DerivableAbstractedAccount.mjs +1 -1
  19. package/dist/esm/account/DerivableAbstractedAccount.mjs.map +1 -1
  20. package/dist/esm/account/Ed25519Account.mjs +1 -1
  21. package/dist/esm/account/Ed25519Account.mjs.map +1 -1
  22. package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
  23. package/dist/esm/account/EphemeralKeyPair.mjs.map +1 -1
  24. package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
  25. package/dist/esm/account/FederatedKeylessAccount.mjs.map +1 -1
  26. package/dist/esm/account/KeylessAccount.mjs +1 -1
  27. package/dist/esm/account/KeylessAccount.mjs.map +1 -1
  28. package/dist/esm/account/MultiEd25519Account.mjs +1 -1
  29. package/dist/esm/account/MultiEd25519Account.mjs.map +1 -1
  30. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  31. package/dist/esm/account/MultiKeyAccount.mjs.map +1 -1
  32. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  33. package/dist/esm/account/SingleKeyAccount.mjs.map +1 -1
  34. package/dist/esm/account/index.mjs +1 -1
  35. package/dist/esm/account/index.mjs.map +1 -1
  36. package/dist/esm/account/utils.mjs +1 -1
  37. package/dist/esm/account/utils.mjs.map +1 -1
  38. package/dist/esm/api/account/abstraction.mjs +1 -1
  39. package/dist/esm/api/account/abstraction.mjs.map +1 -1
  40. package/dist/esm/api/account.mjs +1 -1
  41. package/dist/esm/api/account.mjs.map +1 -1
  42. package/dist/esm/api/ans.mjs +1 -1
  43. package/dist/esm/api/ans.mjs.map +1 -1
  44. package/dist/esm/api/aptos.mjs +1 -1
  45. package/dist/esm/api/aptos.mjs.map +1 -1
  46. package/dist/esm/api/aptosConfig.mjs +1 -1
  47. package/dist/esm/api/aptosConfig.mjs.map +1 -1
  48. package/dist/esm/api/coin.mjs +1 -1
  49. package/dist/esm/api/coin.mjs.map +1 -1
  50. package/dist/esm/api/digitalAsset.mjs +1 -1
  51. package/dist/esm/api/digitalAsset.mjs.map +1 -1
  52. package/dist/esm/api/faucet.mjs +1 -1
  53. package/dist/esm/api/faucet.mjs.map +1 -1
  54. package/dist/esm/api/fungibleAsset.mjs +1 -1
  55. package/dist/esm/api/fungibleAsset.mjs.map +1 -1
  56. package/dist/esm/api/general.mjs +1 -1
  57. package/dist/esm/api/general.mjs.map +1 -1
  58. package/dist/esm/api/index.mjs +1 -1
  59. package/dist/esm/api/index.mjs.map +1 -1
  60. package/dist/esm/api/keyless.mjs +1 -1
  61. package/dist/esm/api/keyless.mjs.map +1 -1
  62. package/dist/esm/api/object.mjs +1 -1
  63. package/dist/esm/api/object.mjs.map +1 -1
  64. package/dist/esm/api/staking.mjs +1 -1
  65. package/dist/esm/api/staking.mjs.map +1 -1
  66. package/dist/esm/api/table.mjs +1 -1
  67. package/dist/esm/api/table.mjs.map +1 -1
  68. package/dist/esm/api/transaction.mjs +1 -1
  69. package/dist/esm/api/transaction.mjs.map +1 -1
  70. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  71. package/dist/esm/api/transactionSubmission/build.mjs.map +1 -1
  72. package/dist/esm/api/transactionSubmission/helpers.mjs +1 -1
  73. package/dist/esm/api/transactionSubmission/helpers.mjs.map +1 -1
  74. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  75. package/dist/esm/api/transactionSubmission/management.mjs.map +1 -1
  76. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  77. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  78. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  79. package/dist/esm/api/transactionSubmission/simulate.mjs.map +1 -1
  80. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  81. package/dist/esm/api/transactionSubmission/submit.mjs.map +1 -1
  82. package/dist/esm/api/utils.mjs +1 -1
  83. package/dist/esm/api/utils.mjs.map +1 -1
  84. package/dist/esm/bcs/consts.mjs +1 -1
  85. package/dist/esm/bcs/consts.mjs.map +1 -1
  86. package/dist/esm/bcs/deserializer.mjs +1 -1
  87. package/dist/esm/bcs/deserializer.mjs.map +1 -1
  88. package/dist/esm/bcs/index.mjs +1 -1
  89. package/dist/esm/bcs/index.mjs.map +1 -1
  90. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  91. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs.map +1 -1
  92. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  93. package/dist/esm/bcs/serializable/fixedBytes.mjs.map +1 -1
  94. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  95. package/dist/esm/bcs/serializable/movePrimitives.mjs.map +1 -1
  96. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  97. package/dist/esm/bcs/serializable/moveStructs.mjs.map +1 -1
  98. package/dist/esm/bcs/serializer.mjs +1 -1
  99. package/dist/esm/bcs/serializer.mjs.map +1 -1
  100. package/dist/esm/cli/index.mjs +1 -1
  101. package/dist/esm/cli/index.mjs.map +1 -1
  102. package/dist/esm/cli/localNode.mjs +1 -1
  103. package/dist/esm/cli/localNode.mjs.map +1 -1
  104. package/dist/esm/cli/move.mjs +1 -1
  105. package/dist/esm/cli/move.mjs.map +1 -1
  106. package/dist/esm/client/core.mjs +1 -1
  107. package/dist/esm/client/core.mjs.map +1 -1
  108. package/dist/esm/client/get.mjs +1 -1
  109. package/dist/esm/client/get.mjs.map +1 -1
  110. package/dist/esm/client/index.mjs +1 -1
  111. package/dist/esm/client/index.mjs.map +1 -1
  112. package/dist/esm/client/post.mjs +1 -1
  113. package/dist/esm/client/post.mjs.map +1 -1
  114. package/dist/esm/core/account/index.d.mts +1 -1
  115. package/dist/esm/core/account/index.mjs +1 -1
  116. package/dist/esm/core/account/index.mjs.map +1 -1
  117. package/dist/esm/core/account/utils/address.d.mts +12 -1
  118. package/dist/esm/core/account/utils/address.mjs +1 -1
  119. package/dist/esm/core/account/utils/address.mjs.map +1 -1
  120. package/dist/esm/core/account/utils/index.d.mts +1 -1
  121. package/dist/esm/core/account/utils/index.mjs +1 -1
  122. package/dist/esm/core/account/utils/index.mjs.map +1 -1
  123. package/dist/esm/core/accountAddress.mjs +3 -1
  124. package/dist/esm/core/accountAddress.mjs.map +1 -1
  125. package/dist/esm/core/authenticationKey.mjs +1 -1
  126. package/dist/esm/core/authenticationKey.mjs.map +1 -1
  127. package/dist/esm/core/common.mjs +1 -1
  128. package/dist/esm/core/common.mjs.map +1 -1
  129. package/dist/esm/core/crypto/abstraction.mjs +1 -1
  130. package/dist/esm/core/crypto/abstraction.mjs.map +1 -1
  131. package/dist/esm/core/crypto/deserializationUtils.mjs +1 -1
  132. package/dist/esm/core/crypto/deserializationUtils.mjs.map +1 -1
  133. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  134. package/dist/esm/core/crypto/ed25519.mjs.map +1 -1
  135. package/dist/esm/core/crypto/ephemeral.mjs +1 -1
  136. package/dist/esm/core/crypto/ephemeral.mjs.map +1 -1
  137. package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
  138. package/dist/esm/core/crypto/federatedKeyless.mjs.map +1 -1
  139. package/dist/esm/core/crypto/hdKey.mjs +1 -1
  140. package/dist/esm/core/crypto/hdKey.mjs.map +1 -1
  141. package/dist/esm/core/crypto/index.mjs +1 -1
  142. package/dist/esm/core/crypto/index.mjs.map +1 -1
  143. package/dist/esm/core/crypto/keyless.mjs +1 -1
  144. package/dist/esm/core/crypto/keyless.mjs.map +1 -1
  145. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  146. package/dist/esm/core/crypto/multiEd25519.mjs.map +1 -1
  147. package/dist/esm/core/crypto/multiKey.mjs +3 -1
  148. package/dist/esm/core/crypto/multiKey.mjs.map +1 -1
  149. package/dist/esm/core/crypto/poseidon.mjs +1 -1
  150. package/dist/esm/core/crypto/poseidon.mjs.map +1 -1
  151. package/dist/esm/core/crypto/privateKey.mjs +1 -1
  152. package/dist/esm/core/crypto/privateKey.mjs.map +1 -1
  153. package/dist/esm/core/crypto/proof.mjs +1 -1
  154. package/dist/esm/core/crypto/proof.mjs.map +1 -1
  155. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  156. package/dist/esm/core/crypto/publicKey.mjs.map +1 -1
  157. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  158. package/dist/esm/core/crypto/secp256k1.mjs.map +1 -1
  159. package/dist/esm/core/crypto/secp256r1.mjs +1 -1
  160. package/dist/esm/core/crypto/secp256r1.mjs.map +1 -1
  161. package/dist/esm/core/crypto/signature.mjs +1 -1
  162. package/dist/esm/core/crypto/signature.mjs.map +1 -1
  163. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  164. package/dist/esm/core/crypto/singleKey.mjs.map +1 -1
  165. package/dist/esm/core/crypto/types.mjs +0 -1
  166. package/dist/esm/core/crypto/utils.mjs +1 -1
  167. package/dist/esm/core/crypto/utils.mjs.map +1 -1
  168. package/dist/esm/core/hex.mjs +1 -1
  169. package/dist/esm/core/hex.mjs.map +1 -1
  170. package/dist/esm/core/index.d.mts +1 -1
  171. package/dist/esm/core/index.mjs +1 -1
  172. package/dist/esm/core/index.mjs.map +1 -1
  173. package/dist/esm/errors/index.mjs +6 -1
  174. package/dist/esm/errors/index.mjs.map +1 -1
  175. package/dist/esm/index.d.mts +1 -1
  176. package/dist/esm/index.mjs +1 -1
  177. package/dist/esm/index.mjs.map +1 -1
  178. package/dist/esm/internal/abstraction.mjs +1 -1
  179. package/dist/esm/internal/abstraction.mjs.map +1 -1
  180. package/dist/esm/internal/account.mjs +1 -1
  181. package/dist/esm/internal/account.mjs.map +1 -1
  182. package/dist/esm/internal/ans.mjs +1 -1
  183. package/dist/esm/internal/ans.mjs.map +1 -1
  184. package/dist/esm/internal/coin.mjs +1 -1
  185. package/dist/esm/internal/coin.mjs.map +1 -1
  186. package/dist/esm/internal/digitalAsset.mjs +1 -1
  187. package/dist/esm/internal/digitalAsset.mjs.map +1 -1
  188. package/dist/esm/internal/faucet.mjs +1 -1
  189. package/dist/esm/internal/faucet.mjs.map +1 -1
  190. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  191. package/dist/esm/internal/fungibleAsset.mjs.map +1 -1
  192. package/dist/esm/internal/general.mjs +1 -1
  193. package/dist/esm/internal/general.mjs.map +1 -1
  194. package/dist/esm/internal/keyless.mjs +1 -1
  195. package/dist/esm/internal/keyless.mjs.map +1 -1
  196. package/dist/esm/internal/object.mjs +1 -1
  197. package/dist/esm/internal/object.mjs.map +1 -1
  198. package/dist/esm/internal/staking.mjs +1 -1
  199. package/dist/esm/internal/staking.mjs.map +1 -1
  200. package/dist/esm/internal/table.mjs +1 -1
  201. package/dist/esm/internal/table.mjs.map +1 -1
  202. package/dist/esm/internal/transaction.mjs +1 -1
  203. package/dist/esm/internal/transaction.mjs.map +1 -1
  204. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  205. package/dist/esm/internal/transactionSubmission.mjs.map +1 -1
  206. package/dist/esm/internal/utils/index.mjs +1 -1
  207. package/dist/esm/internal/utils/index.mjs.map +1 -1
  208. package/dist/esm/internal/utils/utils.mjs +1 -1
  209. package/dist/esm/internal/utils/utils.mjs.map +1 -1
  210. package/dist/esm/internal/view.mjs +1 -1
  211. package/dist/esm/internal/view.mjs.map +1 -1
  212. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  213. package/dist/esm/transactions/authenticator/account.mjs.map +1 -1
  214. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  215. package/dist/esm/transactions/authenticator/index.mjs.map +1 -1
  216. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  217. package/dist/esm/transactions/authenticator/transaction.mjs.map +1 -1
  218. package/dist/esm/transactions/index.mjs +1 -1
  219. package/dist/esm/transactions/index.mjs.map +1 -1
  220. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  221. package/dist/esm/transactions/instances/chainId.mjs.map +1 -1
  222. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  223. package/dist/esm/transactions/instances/identifier.mjs.map +1 -1
  224. package/dist/esm/transactions/instances/index.mjs +1 -1
  225. package/dist/esm/transactions/instances/index.mjs.map +1 -1
  226. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  227. package/dist/esm/transactions/instances/moduleId.mjs.map +1 -1
  228. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  229. package/dist/esm/transactions/instances/multiAgentTransaction.mjs.map +1 -1
  230. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  231. package/dist/esm/transactions/instances/rawTransaction.mjs.map +1 -1
  232. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  233. package/dist/esm/transactions/instances/rotationProofChallenge.mjs.map +1 -1
  234. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  235. package/dist/esm/transactions/instances/signedTransaction.mjs.map +1 -1
  236. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  237. package/dist/esm/transactions/instances/simpleTransaction.mjs.map +1 -1
  238. package/dist/esm/transactions/instances/transactionArgument.mjs +0 -1
  239. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  240. package/dist/esm/transactions/instances/transactionPayload.mjs.map +1 -1
  241. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  242. package/dist/esm/transactions/management/accountSequenceNumber.mjs.map +1 -1
  243. package/dist/esm/transactions/management/asyncQueue.mjs +1 -1
  244. package/dist/esm/transactions/management/asyncQueue.mjs.map +1 -1
  245. package/dist/esm/transactions/management/index.mjs +1 -1
  246. package/dist/esm/transactions/management/index.mjs.map +1 -1
  247. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  248. package/dist/esm/transactions/management/transactionWorker.mjs.map +1 -1
  249. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  250. package/dist/esm/transactions/transactionBuilder/helpers.mjs.map +1 -1
  251. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  252. package/dist/esm/transactions/transactionBuilder/index.mjs.map +1 -1
  253. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  254. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs.map +1 -1
  255. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  256. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs.map +1 -1
  257. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  258. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs.map +1 -1
  259. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  260. package/dist/esm/transactions/typeTag/index.mjs.map +1 -1
  261. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  262. package/dist/esm/transactions/typeTag/parser.mjs.map +1 -1
  263. package/dist/esm/transactions/types.mjs +0 -1
  264. package/dist/esm/types/abstraction.mjs +1 -1
  265. package/dist/esm/types/abstraction.mjs.map +1 -1
  266. package/dist/esm/types/generated/queries.mjs +493 -1
  267. package/dist/esm/types/generated/queries.mjs.map +1 -1
  268. package/dist/esm/types/generated/types.mjs +1 -1
  269. package/dist/esm/types/generated/types.mjs.map +1 -1
  270. package/dist/esm/types/index.mjs +1 -1
  271. package/dist/esm/types/index.mjs.map +1 -1
  272. package/dist/esm/types/indexer.mjs +0 -1
  273. package/dist/esm/types/types.mjs +1 -1
  274. package/dist/esm/types/types.mjs.map +1 -1
  275. package/dist/esm/utils/apiEndpoints.d.mts +1 -0
  276. package/dist/esm/utils/apiEndpoints.mjs +1 -1
  277. package/dist/esm/utils/apiEndpoints.mjs.map +1 -1
  278. package/dist/esm/utils/const.mjs +1 -1
  279. package/dist/esm/utils/const.mjs.map +1 -1
  280. package/dist/esm/utils/helpers.mjs +1 -1
  281. package/dist/esm/utils/helpers.mjs.map +1 -1
  282. package/dist/esm/utils/index.mjs +1 -1
  283. package/dist/esm/utils/index.mjs.map +1 -1
  284. package/dist/esm/utils/memoize.mjs +1 -1
  285. package/dist/esm/utils/memoize.mjs.map +1 -1
  286. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  287. package/dist/esm/utils/normalizeBundle.mjs.map +1 -1
  288. package/dist/esm/version.d.mts +1 -1
  289. package/dist/esm/version.mjs +1 -1
  290. package/dist/esm/version.mjs.map +1 -1
  291. package/package.json +39 -20
  292. package/src/api/aptos.ts +25 -14
  293. package/src/core/account/utils/address.ts +22 -0
  294. package/src/internal/ans.ts +1 -0
  295. package/src/utils/apiEndpoints.ts +7 -0
  296. package/src/version.ts +1 -1
  297. package/dist/common/chunk-A2XB7TVI.js +0 -4
  298. package/dist/esm/chunk-2PASUPUO.mjs +0 -2
  299. package/dist/esm/chunk-2PASUPUO.mjs.map +0 -1
  300. package/dist/esm/chunk-2XQKGWHQ.mjs +0 -2
  301. package/dist/esm/chunk-2XQKGWHQ.mjs.map +0 -1
  302. package/dist/esm/chunk-35DKMW7Q.mjs +0 -2
  303. package/dist/esm/chunk-35DKMW7Q.mjs.map +0 -1
  304. package/dist/esm/chunk-4AI7KQQ7.mjs +0 -2
  305. package/dist/esm/chunk-4AI7KQQ7.mjs.map +0 -1
  306. package/dist/esm/chunk-4QMXOWHP.mjs +0 -1
  307. package/dist/esm/chunk-4QMXOWHP.mjs.map +0 -1
  308. package/dist/esm/chunk-4RXKALLC.mjs +0 -2
  309. package/dist/esm/chunk-4RXKALLC.mjs.map +0 -1
  310. package/dist/esm/chunk-4WPQQPUF.mjs +0 -1
  311. package/dist/esm/chunk-4WPQQPUF.mjs.map +0 -1
  312. package/dist/esm/chunk-56CNRT2K.mjs +0 -2
  313. package/dist/esm/chunk-56CNRT2K.mjs.map +0 -1
  314. package/dist/esm/chunk-5HXLZHDW.mjs +0 -1
  315. package/dist/esm/chunk-5HXLZHDW.mjs.map +0 -1
  316. package/dist/esm/chunk-6OWBKU7N.mjs +0 -2
  317. package/dist/esm/chunk-6OWBKU7N.mjs.map +0 -1
  318. package/dist/esm/chunk-6WDVDEQZ.mjs +0 -7
  319. package/dist/esm/chunk-6WDVDEQZ.mjs.map +0 -1
  320. package/dist/esm/chunk-7DQDJ2SA.mjs +0 -2
  321. package/dist/esm/chunk-7DQDJ2SA.mjs.map +0 -1
  322. package/dist/esm/chunk-7ECCT6PK.mjs +0 -1
  323. package/dist/esm/chunk-7ECCT6PK.mjs.map +0 -1
  324. package/dist/esm/chunk-7EER7GWV.mjs +0 -2
  325. package/dist/esm/chunk-7EER7GWV.mjs.map +0 -1
  326. package/dist/esm/chunk-A5L76YP7.mjs +0 -2
  327. package/dist/esm/chunk-A5L76YP7.mjs.map +0 -1
  328. package/dist/esm/chunk-AMXZQPUQ.mjs +0 -2
  329. package/dist/esm/chunk-AMXZQPUQ.mjs.map +0 -1
  330. package/dist/esm/chunk-B563XRSZ.mjs +0 -2
  331. package/dist/esm/chunk-B563XRSZ.mjs.map +0 -1
  332. package/dist/esm/chunk-C3Q23D22.mjs +0 -2
  333. package/dist/esm/chunk-C3Q23D22.mjs.map +0 -1
  334. package/dist/esm/chunk-CIJA7ONS.mjs +0 -2
  335. package/dist/esm/chunk-CIJA7ONS.mjs.map +0 -1
  336. package/dist/esm/chunk-CW35YAMN.mjs +0 -2
  337. package/dist/esm/chunk-CW35YAMN.mjs.map +0 -1
  338. package/dist/esm/chunk-EBMEXURY.mjs +0 -2
  339. package/dist/esm/chunk-EBMEXURY.mjs.map +0 -1
  340. package/dist/esm/chunk-EF4FA5I6.mjs +0 -2
  341. package/dist/esm/chunk-EF4FA5I6.mjs.map +0 -1
  342. package/dist/esm/chunk-FD6FGKYY.mjs +0 -1
  343. package/dist/esm/chunk-FD6FGKYY.mjs.map +0 -1
  344. package/dist/esm/chunk-FGFLPH5K.mjs +0 -2
  345. package/dist/esm/chunk-FGFLPH5K.mjs.map +0 -1
  346. package/dist/esm/chunk-FLZPUYXQ.mjs +0 -2
  347. package/dist/esm/chunk-FLZPUYXQ.mjs.map +0 -1
  348. package/dist/esm/chunk-FZY4PMEE.mjs +0 -1
  349. package/dist/esm/chunk-FZY4PMEE.mjs.map +0 -1
  350. package/dist/esm/chunk-G3MHXDYA.mjs +0 -1
  351. package/dist/esm/chunk-G3MHXDYA.mjs.map +0 -1
  352. package/dist/esm/chunk-GOXRBEIJ.mjs +0 -2
  353. package/dist/esm/chunk-GOXRBEIJ.mjs.map +0 -1
  354. package/dist/esm/chunk-HGLO5LDS.mjs +0 -1
  355. package/dist/esm/chunk-HGLO5LDS.mjs.map +0 -1
  356. package/dist/esm/chunk-HNBVYE3N.mjs +0 -2
  357. package/dist/esm/chunk-HNBVYE3N.mjs.map +0 -1
  358. package/dist/esm/chunk-I7XT6L7S.mjs +0 -2
  359. package/dist/esm/chunk-I7XT6L7S.mjs.map +0 -1
  360. package/dist/esm/chunk-IF4UU2MT.mjs +0 -2
  361. package/dist/esm/chunk-IF4UU2MT.mjs.map +0 -1
  362. package/dist/esm/chunk-JABP65XD.mjs +0 -2
  363. package/dist/esm/chunk-JABP65XD.mjs.map +0 -1
  364. package/dist/esm/chunk-KDMSOCZY.mjs +0 -2
  365. package/dist/esm/chunk-KDMSOCZY.mjs.map +0 -1
  366. package/dist/esm/chunk-L72TIN7T.mjs +0 -4
  367. package/dist/esm/chunk-L72TIN7T.mjs.map +0 -1
  368. package/dist/esm/chunk-M3AO73ZL.mjs +0 -2
  369. package/dist/esm/chunk-M3AO73ZL.mjs.map +0 -1
  370. package/dist/esm/chunk-MCFQE4GC.mjs +0 -2
  371. package/dist/esm/chunk-MCFQE4GC.mjs.map +0 -1
  372. package/dist/esm/chunk-MT2RJ7H3.mjs +0 -2
  373. package/dist/esm/chunk-MT2RJ7H3.mjs.map +0 -1
  374. package/dist/esm/chunk-N6YTF76Q.mjs +0 -2
  375. package/dist/esm/chunk-N6YTF76Q.mjs.map +0 -1
  376. package/dist/esm/chunk-NECL5FCQ.mjs +0 -1
  377. package/dist/esm/chunk-NECL5FCQ.mjs.map +0 -1
  378. package/dist/esm/chunk-OLILO7VD.mjs +0 -2
  379. package/dist/esm/chunk-OLILO7VD.mjs.map +0 -1
  380. package/dist/esm/chunk-ORMOQWWH.mjs +0 -2
  381. package/dist/esm/chunk-ORMOQWWH.mjs.map +0 -1
  382. package/dist/esm/chunk-Q4W3WJ2U.mjs +0 -2
  383. package/dist/esm/chunk-Q4W3WJ2U.mjs.map +0 -1
  384. package/dist/esm/chunk-QP2BY4PK.mjs +0 -2
  385. package/dist/esm/chunk-QP2BY4PK.mjs.map +0 -1
  386. package/dist/esm/chunk-QREVMGQZ.mjs +0 -2
  387. package/dist/esm/chunk-QREVMGQZ.mjs.map +0 -1
  388. package/dist/esm/chunk-RCSJFTST.mjs +0 -2
  389. package/dist/esm/chunk-RCSJFTST.mjs.map +0 -1
  390. package/dist/esm/chunk-RGKRCZ36.mjs +0 -4
  391. package/dist/esm/chunk-RGKRCZ36.mjs.map +0 -1
  392. package/dist/esm/chunk-SJDCGNWU.mjs +0 -2
  393. package/dist/esm/chunk-SJDCGNWU.mjs.map +0 -1
  394. package/dist/esm/chunk-STY74NUA.mjs +0 -2
  395. package/dist/esm/chunk-STY74NUA.mjs.map +0 -1
  396. package/dist/esm/chunk-TOBQ5UE6.mjs +0 -2
  397. package/dist/esm/chunk-TOBQ5UE6.mjs.map +0 -1
  398. package/dist/esm/chunk-UL777LTI.mjs +0 -494
  399. package/dist/esm/chunk-UL777LTI.mjs.map +0 -1
  400. package/dist/esm/chunk-UYVPNUH3.mjs +0 -1
  401. package/dist/esm/chunk-UYVPNUH3.mjs.map +0 -1
  402. package/dist/esm/chunk-V3MBJJTL.mjs +0 -1
  403. package/dist/esm/chunk-V3MBJJTL.mjs.map +0 -1
  404. package/dist/esm/chunk-WCMW2L3P.mjs +0 -2
  405. package/dist/esm/chunk-WCMW2L3P.mjs.map +0 -1
  406. package/dist/esm/chunk-WHSTLR3F.mjs +0 -2
  407. package/dist/esm/chunk-WHSTLR3F.mjs.map +0 -1
  408. package/dist/esm/chunk-WSR5EBJM.mjs +0 -2
  409. package/dist/esm/chunk-WSR5EBJM.mjs.map +0 -1
  410. package/dist/esm/chunk-XJJVJOX5.mjs +0 -2
  411. package/dist/esm/chunk-XJJVJOX5.mjs.map +0 -1
  412. package/dist/esm/chunk-XKUIMGKU.mjs +0 -2
  413. package/dist/esm/chunk-XKUIMGKU.mjs.map +0 -1
  414. package/dist/esm/chunk-YOZBVVKL.mjs +0 -2
  415. package/dist/esm/chunk-YOZBVVKL.mjs.map +0 -1
  416. package/dist/esm/chunk-ZP4DWSQA.mjs +0 -2
  417. package/dist/esm/chunk-ZP4DWSQA.mjs.map +0 -1
@@ -1,2 +1,2 @@
1
- import{Ac as j,Bc as k,Cc as l,Dc as m,Ec as n,Fc as o,Gc as p,Hc as q,Ic as r,Jc as s,Kc as t,Lc as u,Mc as v,Nc as w,Oc as x,Pc as y,rc as a,sc as b,tc as c,uc as d,vc as e,wc as f,xc as g,yc as h,zc as i}from"../chunk-L72TIN7T.mjs";import"../chunk-2XQKGWHQ.mjs";import"../chunk-UYVPNUH3.mjs";import"../chunk-XKUIMGKU.mjs";import"../chunk-N6YTF76Q.mjs";import"../chunk-A5L76YP7.mjs";import"../chunk-I7XT6L7S.mjs";import"../chunk-5HXLZHDW.mjs";import"../chunk-G3MHXDYA.mjs";import"../chunk-JABP65XD.mjs";import"../chunk-GOXRBEIJ.mjs";import"../chunk-2PASUPUO.mjs";import"../chunk-XJJVJOX5.mjs";import"../chunk-NECL5FCQ.mjs";import"../chunk-4QMXOWHP.mjs";import"../chunk-EF4FA5I6.mjs";import"../chunk-WCMW2L3P.mjs";import"../chunk-WSR5EBJM.mjs";import"../chunk-C3Q23D22.mjs";import"../chunk-QREVMGQZ.mjs";import"../chunk-V3MBJJTL.mjs";import"../chunk-ZP4DWSQA.mjs";import"../chunk-FGFLPH5K.mjs";import"../chunk-WHSTLR3F.mjs";import"../chunk-M3AO73ZL.mjs";import"../chunk-6OWBKU7N.mjs";import"../chunk-AMXZQPUQ.mjs";import"../chunk-YOZBVVKL.mjs";import"../chunk-SJDCGNWU.mjs";import"../chunk-UL777LTI.mjs";import"../chunk-7ECCT6PK.mjs";import"../chunk-4AI7KQQ7.mjs";import"../chunk-7EER7GWV.mjs";import"../chunk-QP2BY4PK.mjs";import"../chunk-HGLO5LDS.mjs";import"../chunk-CW35YAMN.mjs";import"../chunk-6WDVDEQZ.mjs";import"../chunk-RCSJFTST.mjs";import"../chunk-4RXKALLC.mjs";import"../chunk-OLILO7VD.mjs";import"../chunk-7DQDJ2SA.mjs";import"../chunk-HNBVYE3N.mjs";import"../chunk-RGKRCZ36.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-Q4W3WJ2U.mjs";import"../chunk-TOBQ5UE6.mjs";import"../chunk-MT2RJ7H3.mjs";import"../chunk-ORMOQWWH.mjs";import"../chunk-FD6FGKYY.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-MCFQE4GC.mjs";import"../chunk-FLZPUYXQ.mjs";import"../chunk-EBMEXURY.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-56CNRT2K.mjs";import"../chunk-CIJA7ONS.mjs";import"../chunk-KDMSOCZY.mjs";export{t as deriveAccountFromPrivateKey,y as deriveOwnedAccountsFromSigner,o as getAccountCoinAmount,q as getAccountCoinsCount,p as getAccountCoinsData,m as getAccountCollectionsWithOwnedTokens,s as getAccountOwnedObjects,k as getAccountOwnedTokens,l as getAccountOwnedTokensFromCollectionAddress,j as getAccountTokensCount,n as getAccountTransactionsCount,x as getAccountsForPublicKey,r as getBalance,a as getInfo,d as getModule,b as getModules,c as getModulesPage,h as getResource,f as getResources,g as getResourcesPage,e as getTransactions,u as isAccountExist,i as lookupOriginalAccountAddress,v as rotateAuthKey,w as rotateAuthKeyUnverified};
1
+ import{getAptosFullNode as S,getPageWithObfuscatedCursor as q,paginateWithCursor as L,paginateWithObfuscatedCursor as O}from"../client";import{anyPublicKeyVariantToString as V}from"../types";import{AccountAddress as u}from"../core/accountAddress";import{Account as w,Ed25519Account as I,FederatedKeylessAccount as C,KeylessAccount as G,MultiEd25519Account as x,MultiKeyAccount as K,SingleKeyAccount as N}from"../account";import{AbstractMultiKey as l,AnyPublicKey as y,Ed25519PublicKey as b,MultiEd25519PublicKey as P,MultiKey as v}from"../core/crypto";import{queryIndexer as A}from"./general";import{getModule as D,getInfo as j}from"./utils";import{GetAccountCoinsCount as W,GetAccountCoinsData as $,GetAccountCollectionsWithOwnedTokens as H,GetObjectData as z,GetAccountOwnedTokens as J,GetAccountOwnedTokensFromCollection as X,GetAccountTokensCount as Y,GetAccountTransactionsCount as Z,GetAuthKeysForPublicKey as ee,GetAccountAddressesForAuthKey as te}from"../types/generated/queries";import{Secp256k1PrivateKey as oe,AuthenticationKey as ne,Ed25519PrivateKey as se,createObjectAddress as re,Hex as ie}from"../core";import{getTableItem as ce}from"./table";import{APTOS_COIN as F}from"../utils";import{AptosApiError as ae}from"../errors";import{Deserializer as Q}from"../bcs";import{generateTransaction as R}from"./transactionSubmission";import{RotationProofChallenge as ue,TypeTagU8 as T,TypeTagVector as m}from"../transactions";import{U8 as k,MoveVector as h}from"../bcs";import{accountPublicKeyToBaseAccountPublicKey as de,accountPublicKeyToSigningScheme as ge}from"../core/crypto/utils";async function pe(o){return j(o)}async function Bt(o){const{aptosConfig:n,accountAddress:e,options:t}=o;return O({aptosConfig:n,originMethod:"getModules",path:`accounts/${u.from(e).toString()}/modules`,params:{ledger_version:t?.ledgerVersion,limit:t?.limit??1e3}})}async function Et(o){const{aptosConfig:n,accountAddress:e,options:t}=o,{response:r,cursor:s}=await q({aptosConfig:n,originMethod:"getModulesPage",path:`accounts/${u.from(e).toString()}/modules`,params:{ledger_version:t?.ledgerVersion,cursor:t?.cursor,limit:t?.limit??100}});return{modules:r.data,cursor:s}}async function Ut(o){return D(o)}async function Ae(o){const{aptosConfig:n,accountAddress:e,options:t}=o;return L({aptosConfig:n,originMethod:"getTransactions",path:`accounts/${u.from(e).toString()}/transactions`,params:{start:t?.offset,limit:t?.limit}})}async function fe(o){const{aptosConfig:n,accountAddress:e,options:t}=o;return O({aptosConfig:n,originMethod:"getResources",path:`accounts/${u.from(e).toString()}/resources`,params:{ledger_version:t?.ledgerVersion,limit:t?.limit??999}})}async function Lt(o){const{aptosConfig:n,accountAddress:e,options:t}=o,{response:r,cursor:s}=await q({aptosConfig:n,originMethod:"getResourcesPage",path:`accounts/${u.from(e).toString()}/resources`,params:{ledger_version:t?.ledgerVersion,cursor:t?.cursor,limit:t?.limit??100}});return{resources:r.data,cursor:s}}async function le(o){const{aptosConfig:n,accountAddress:e,resourceType:t,options:r}=o,{data:s}=await S({aptosConfig:n,originMethod:"getResource",path:`accounts/${u.from(e).toString()}/resource/${t}`,params:{ledger_version:r?.ledgerVersion}});return s.data}async function ye(o){const{aptosConfig:n,authenticationKey:e,options:t}=o,r=await le({aptosConfig:n,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:t}),{address_map:{handle:s}}=r,i=u.from(e);try{const c=await ce({aptosConfig:n,handle:s,data:{key:i.toString(),key_type:"address",value_type:"address"},options:t});return u.from(c)}catch(c){if(c instanceof ae&&c.data.error_code==="table_item_not_found")return i;throw c}}async function Vt(o){const{aptosConfig:n,accountAddress:e}=o,r={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}},i=await A({aptosConfig:n,query:{query:Y,variables:{where_condition:r}},originMethod:"getAccountTokensCount"});return i.current_token_ownerships_v2_aggregate.aggregate?i.current_token_ownerships_v2_aggregate.aggregate.count:0}async function Nt(o){const{aptosConfig:n,accountAddress:e,options:t}=o,s={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}};t?.tokenStandard&&(s.token_standard={_eq:t?.tokenStandard});const i={query:J,variables:{where_condition:s,offset:t?.offset,limit:t?.limit,order_by:t?.orderBy}};return(await A({aptosConfig:n,query:i,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function Dt(o){const{aptosConfig:n,accountAddress:e,collectionAddress:t,options:r}=o,s=u.from(e).toStringLong(),i=u.from(t).toStringLong(),c={owner_address:{_eq:s},current_token_data:{collection_id:{_eq:i}},amount:{_gt:0}};r?.tokenStandard&&(c.token_standard={_eq:r?.tokenStandard});const a={query:X,variables:{where_condition:c,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await A({aptosConfig:n,query:a,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function jt(o){const{aptosConfig:n,accountAddress:e,options:t}=o,s={owner_address:{_eq:u.from(e).toStringLong()}};t?.tokenStandard&&(s.current_collection={token_standard:{_eq:t?.tokenStandard}});const i={query:H,variables:{where_condition:s,offset:t?.offset,limit:t?.limit,order_by:t?.orderBy}};return(await A({aptosConfig:n,query:i,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function Wt(o){const{aptosConfig:n,accountAddress:e}=o,t=u.from(e).toStringLong(),s=await A({aptosConfig:n,query:{query:Z,variables:{address:t}},originMethod:"getAccountTransactionsCount"});return s.account_transactions_aggregate.aggregate?s.account_transactions_aggregate.aggregate.count:0}async function $t(o){const{aptosConfig:n,accountAddress:e,coinType:t,faMetadataAddress:r}=o;let s=t,i;if(t!==void 0&&r!==void 0)i=u.from(r).toStringLong();else if(t!==void 0&&r===void 0)t===F?i=u.A.toStringLong():i=re(u.A,t).toStringLong();else if(t===void 0&&r!==void 0){const f=u.from(r);i=f.toStringLong(),f===u.A&&(s=F)}else throw new Error("Either coinType, fungibleAssetAddress, or both must be provided");const c=u.from(e).toStringLong();let a={asset_type:{_eq:i}};s!==void 0&&(a={asset_type:{_in:[s,i]}});const p=await me({aptosConfig:n,accountAddress:c,options:{where:a}});return p[0]?p[0].amount:0}async function me(o){const{aptosConfig:n,accountAddress:e,options:t}=o,r=u.from(e).toStringLong(),s={...t?.where,owner_address:{_eq:r}},i={query:$,variables:{where_condition:s,offset:t?.offset,limit:t?.limit,order_by:t?.orderBy}};return(await A({aptosConfig:n,query:i,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function Ht(o){const{aptosConfig:n,accountAddress:e}=o,t=u.from(e).toStringLong(),s=await A({aptosConfig:n,query:{query:W,variables:{address:t}},originMethod:"getAccountCoinsCount"});if(!s.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return s.current_fungible_asset_balances_aggregate.aggregate.count}async function zt(o){const{aptosConfig:n,accountAddress:e,asset:t}=o,r=await S({aptosConfig:n,originMethod:"getBalance",path:`accounts/${e}/balance/${t}`,params:{accountAddress:e.toString(),asset:t instanceof Uint8Array?u.from(t).toString():t.toString()}});return parseInt(r.data.toString(),10)}async function he(o){const{aptosConfig:n,accountAddress:e,options:t}=o,s={owner_address:{_eq:u.from(e).toStringLong()}},i={query:z,variables:{where_condition:s,offset:t?.offset,limit:t?.limit,order_by:t?.orderBy}};return(await A({aptosConfig:n,query:i,originMethod:"getAccountOwnedObjects"})).current_objects}async function Jt(o){const{aptosConfig:n,privateKey:e,options:t}=o,r=t?.throwIfNoAccountFound??!1,s=await _({aptosConfig:n,privateKey:e});if(s.length===0){if(r)throw new Error("No existing account found for private key.");return w.fromPrivateKey({privateKey:e})}return s[0]}async function Xt(o){const{aptosConfig:n,authKey:e}=o,t=await ye({aptosConfig:n,authenticationKey:e.derivedAddress()});return B({aptosConfig:n,accountAddress:t})}async function B(o){const{aptosConfig:n,accountAddress:e,options:t}=o;try{const[r,s]=await Promise.all([fe({aptosConfig:n,accountAddress:e}),he({aptosConfig:n,accountAddress:e,options:{limit:1}})]),i=r.find(a=>a.type==="0x1::account::Account");if(!i&&s.length===0)return!1;if(!t?.withAuthKey)return!0;let c;return i?c=i.data.authentication_key:c=e.toStringLong(),c===t.withAuthKey.toString()}catch(r){throw new Error(`Error while checking if account exists at ${e.toString()}: ${r}`)}}const we={typeParameters:[],parameters:[new T,m.u8(),new T,m.u8(),m.u8(),m.u8()]};async function Yt(o){const{aptosConfig:n,fromAccount:e,options:t}=o;if("toNewPrivateKey"in o)return M({aptosConfig:n,fromAccount:e,toNewPrivateKey:o.toNewPrivateKey,options:t});if("toAccount"in o)return o.toAccount instanceof I?M({aptosConfig:n,fromAccount:e,toNewPrivateKey:o.toAccount.privateKey,options:t}):M({aptosConfig:n,fromAccount:e,toAccount:o.toAccount,options:t});throw new Error("Invalid arguments")}async function M(o){const{aptosConfig:n,fromAccount:e,options:t}=o,r=await pe({aptosConfig:n,accountAddress:e.accountAddress});let s;"toNewPrivateKey"in o?s=w.fromPrivateKey({privateKey:o.toNewPrivateKey,legacy:!0}):s=o.toAccount;const c=new ue({sequenceNumber:BigInt(r.sequence_number),originator:e.accountAddress,currentAuthKey:u.from(r.authentication_key),newPublicKey:s.publicKey}).bcsToBytes(),a=e.sign(c),p=s.sign(c);return R({aptosConfig:n,sender:e.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new k(e.signingScheme),h.U8(e.publicKey.toUint8Array()),new k(s.signingScheme),h.U8(s.publicKey.toUint8Array()),h.U8(a.toUint8Array()),h.U8(p.toUint8Array())],abi:we},options:t})}const _e={typeParameters:[],parameters:[new T,m.u8()]};async function Zt(o){const{aptosConfig:n,fromAccount:e,toNewPublicKey:t,options:r}=o;return R({aptosConfig:n,sender:e.accountAddress,data:{function:"0x1::account::rotate_authentication_key_from_public_key",functionArguments:[new k(ge(t)),h.U8(de(t).toUint8Array())],abi:_e},options:r})}async function E(o){const{aptosConfig:n,publicKey:e,options:t}=o,r=t?.noMultiKey??!1;if(r&&e instanceof l)throw new Error("Multi-key accounts are not supported when noMultiKey is true.");const s=[e];e instanceof y&&e.publicKey instanceof b?s.push(e.publicKey):e instanceof b&&s.push(new y(e));const[i,c]=await Promise.all([Promise.all(s.map(async d=>{const g=await Te({aptosConfig:n,publicKey:d});if(g)return{...g,publicKey:d}})),!(e instanceof l)&&!r?be({aptosConfig:n,publicKey:e,options:t}):Promise.resolve([])]),a=[];for(const d of i)d&&a.push(d);s.push(...c);const p=new Map(s.map(d=>[d.authKey().toString(),d])),f=await Pe({aptosConfig:n,authKeys:s.map(d=>d.authKey()),options:t});for(const d of f){if(a.find(U=>U.accountAddress===d.accountAddress))continue;const g=p.get(d.authKey.toString());if(!g)throw new Error(`No publicKey found for authentication key ${d.authKey}. This should never happen.`);a.push({accountAddress:d.accountAddress,publicKey:g,lastTransactionVersion:d.lastTransactionVersion})}return a.sort((d,g)=>g.lastTransactionVersion-d.lastTransactionVersion)}async function Ce(o){const{aptosConfig:n,signer:e,options:t}=o;if(e instanceof se||e instanceof oe)return _({aptosConfig:n,privateKey:e,options:t});if(e instanceof I||e instanceof N)return _({aptosConfig:n,privateKey:e.privateKey,options:t});if(e instanceof G||e instanceof C)return Ke({aptosConfig:n,keylessAccount:e,options:t});if(e instanceof K&&e.signers.length===1)return Ce({aptosConfig:n,signer:e.signers[0],options:t});if(e instanceof x&&e.signers.length===1)return _({aptosConfig:n,privateKey:e.signers[0],options:t});throw new Error("Unknown signer type")}async function Ke(o){const{aptosConfig:n,keylessAccount:e,options:t}=o,r=await E({aptosConfig:n,publicKey:e.getAnyPublicKey(),options:t}),s={proof:e.proofOrPromise,jwt:e.jwt,ephemeralKeyPair:e.ephemeralKeyPair,pepper:e.pepper,verificationKeyHash:e.verificationKeyHash},i=[];for(const{accountAddress:c,publicKey:a}of r)if(a instanceof l){if(a.getSignaturesRequired()>1)continue;if(a instanceof P)throw new Error("Keyless authentication cannot be used for multi-ed25519 accounts. This should never happen.");a instanceof v&&i.push(new K({multiKey:a,signers:[e],address:c}))}else e instanceof C?i.push(C.create({...s,address:c,jwkAddress:e.publicKey.jwkAddress})):i.push(G.create({...s,address:c}));return i}async function _(o){const{aptosConfig:n,privateKey:e,options:t}=o,r=w.fromPrivateKey({privateKey:e,legacy:!1}),s=await E({aptosConfig:n,publicKey:new y(e.publicKey()),options:t}),i=[];for(const{accountAddress:c,publicKey:a}of s)if(a instanceof l){if(a.getSignaturesRequired()>1)continue;a instanceof P?i.push(new x({publicKey:a,signers:[e],address:c})):a instanceof v&&i.push(new K({multiKey:a,signers:[r],address:c}))}else{const p=a instanceof b;i.push(w.fromPrivateKey({privateKey:e,address:c,legacy:p}))}return i}async function be(o){const{aptosConfig:n,publicKey:e,options:t}=o;if(e instanceof l)throw new Error("Public key is a multi-key.");const r=t?.includeUnverified??!1,s=e instanceof y?e:new y(e),i=s.publicKey,c=V(s.variant),a={public_key:{_eq:i.toString()},public_key_type:{_eq:c},...r?{}:{is_public_key_used:{_eq:!0}}},p={query:ee,variables:{where_condition:a}},{public_key_auth_keys:f}=await A({aptosConfig:n,query:p,originMethod:"getMultiKeysForPublicKey"});return f.map(g=>{switch(g.signature_type){case"multi_ed25519_signature":return P.deserializeWithoutLength(Q.fromHex(g.account_public_key));case"multi_key_signature":return v.deserialize(Q.fromHex(g.account_public_key));default:throw new Error(`Unknown multi-signature type: ${g.signature_type}`)}})}async function Pe(o){const{aptosConfig:n,authKeys:e,options:t}=o,r=t?.includeUnverified??!1;if(e.length===0)throw new Error("No authentication keys provided");const s={auth_key:{_in:e.map(a=>a.toString())},...r?{}:{is_auth_key_used:{_eq:!0}}},i={query:te,variables:{where_condition:s,order_by:[{last_transaction_version:"desc"}]}},{auth_key_account_addresses:c}=await A({aptosConfig:n,query:i,originMethod:"getAccountAddressesForAuthKeys"});return c.map(a=>({authKey:new ne({data:a.auth_key}),accountAddress:new u(ie.hexInputToUint8Array(a.account_address)),lastTransactionVersion:Number(a.last_transaction_version)}))}async function ve(o){const{aptosConfig:n,accountAddress:e}=o,t=await Ae({aptosConfig:n,accountAddress:e,options:{limit:1}});return t.length===0?0:Number(t[0].version)}async function Te(o){const{aptosConfig:n,publicKey:e}=o,t=e.authKey().derivedAddress(),[r,s]=await Promise.all([ve({aptosConfig:n,accountAddress:t}),B({aptosConfig:n,accountAddress:t,options:{withAuthKey:e.authKey()}})]);if(s)return{accountAddress:t,lastTransactionVersion:r}}export{Jt as deriveAccountFromPrivateKey,Ce as deriveOwnedAccountsFromSigner,$t as getAccountCoinAmount,Ht as getAccountCoinsCount,me as getAccountCoinsData,jt as getAccountCollectionsWithOwnedTokens,he as getAccountOwnedObjects,Nt as getAccountOwnedTokens,Dt as getAccountOwnedTokensFromCollectionAddress,Vt as getAccountTokensCount,Wt as getAccountTransactionsCount,E as getAccountsForPublicKey,zt as getBalance,pe as getInfo,Ut as getModule,Bt as getModules,Et as getModulesPage,le as getResource,fe as getResources,Lt as getResourcesPage,Ae as getTransactions,Xt as isAccountExist,ye as lookupOriginalAccountAddress,Yt as rotateAuthKey,Zt as rotateAuthKeyUnverified};
2
2
  //# sourceMappingURL=account.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"sources":["../../../src/internal/account.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file contains the underlying implementations for exposed API surface in\n * the {@link api/account}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * account namespace and without having a dependency cycle error.\n * @group Implementation\n */\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport {\n getAptosFullNode,\n getPageWithObfuscatedCursor,\n paginateWithCursor,\n paginateWithObfuscatedCursor,\n} from \"../client\";\nimport {\n AccountData,\n AnyNumber,\n anyPublicKeyVariantToString,\n CommittedTransactionResponse,\n CursorPaginationArgs,\n GetAccountCoinsDataResponse,\n GetAccountCollectionsWithOwnedTokenResponse,\n GetAccountOwnedTokensFromCollectionResponse,\n GetAccountOwnedTokensQueryResponse,\n GetObjectDataQueryResponse,\n LedgerVersionArg,\n MoveModuleBytecode,\n MoveResource,\n MoveStructId,\n OrderByArg,\n PaginationArgs,\n PendingTransactionResponse,\n TokenStandardArg,\n WhereArg,\n} from \"../types\";\nimport { AccountAddress, AccountAddressInput } from \"../core/accountAddress\";\nimport {\n Account,\n Ed25519Account,\n FederatedKeylessAccount,\n KeylessAccount,\n MultiEd25519Account,\n MultiKeyAccount,\n SingleKeyAccount,\n} from \"../account\";\nimport {\n AbstractMultiKey,\n AccountPublicKey,\n AnyPublicKey,\n BaseAccountPublicKey,\n Ed25519PublicKey,\n MultiEd25519PublicKey,\n MultiKey,\n PrivateKeyInput,\n} from \"../core/crypto\";\nimport { queryIndexer } from \"./general\";\nimport { getModule as getModuleUtil, getInfo as getInfoUtil } from \"./utils\";\nimport {\n GetAccountCoinsCountQuery,\n GetAccountCoinsDataQuery,\n GetAccountCollectionsWithOwnedTokensQuery,\n GetObjectDataQuery,\n GetAccountOwnedTokensFromCollectionQuery,\n GetAccountOwnedTokensQuery,\n GetAccountTokensCountQuery,\n GetAccountTransactionsCountQuery,\n GetAuthKeysForPublicKeyQuery,\n GetAccountAddressesForAuthKeyQuery,\n} from \"../types/generated/operations\";\nimport {\n GetAccountCoinsCount,\n GetAccountCoinsData,\n GetAccountCollectionsWithOwnedTokens,\n GetObjectData,\n GetAccountOwnedTokens,\n GetAccountOwnedTokensFromCollection,\n GetAccountTokensCount,\n GetAccountTransactionsCount,\n GetAuthKeysForPublicKey,\n GetAccountAddressesForAuthKey,\n} from \"../types/generated/queries\";\nimport { Secp256k1PrivateKey, AuthenticationKey, Ed25519PrivateKey, createObjectAddress, Hex } from \"../core\";\nimport { CurrentFungibleAssetBalancesBoolExp } from \"../types/generated/types\";\nimport { getTableItem } from \"./table\";\nimport { APTOS_COIN } from \"../utils\";\nimport { AptosApiError } from \"../errors\";\nimport { Deserializer } from \"../bcs\";\nimport { signAndSubmitTransaction, generateTransaction } from \"./transactionSubmission\";\nimport {\n EntryFunctionABI,\n InputGenerateTransactionOptions,\n RotationProofChallenge,\n SimpleTransaction,\n TypeTagU8,\n TypeTagVector,\n} from \"../transactions\";\nimport { U8, MoveVector } from \"../bcs\";\nimport { waitForTransaction, waitForIndexer } from \"./transaction\";\nimport { view } from \"./view\";\nimport { getLedgerInfo } from \"./general\";\nimport { accountPublicKeyToBaseAccountPublicKey, accountPublicKeyToSigningScheme } from \"../core/crypto/utils\";\n\n/**\n * Retrieves account information for a specified account address.\n *\n * @param args - The arguments for retrieving account information.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.accountAddress - The address of the account to retrieve information for.\n * @group Implementation\n */\nexport async function getInfo(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n}): Promise<AccountData> {\n return getInfoUtil(args);\n}\n\n/**\n * Retrieves the modules associated with a specified account address.\n *\n * @param args - The arguments for retrieving modules.\n * @param args.aptosConfig - The configuration for connecting to the Aptos blockchain.\n * @param args.accountAddress - The address of the account whose modules are to be retrieved.\n * @param args.options - Optional parameters for pagination and ledger version.\n * @param args.options.limit - The maximum number of modules to retrieve (default is 1000).\n * @param args.options.offset - The starting point for pagination. Note, this is obfuscated and is not an index.\n * @param args.options.ledgerVersion - The specific ledger version to query.\n * @group Implementation\n */\nexport async function getModules(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: { limit?: number } & LedgerVersionArg;\n}): Promise<MoveModuleBytecode[]> {\n const { aptosConfig, accountAddress, options } = args;\n return paginateWithObfuscatedCursor<{}, MoveModuleBytecode[]>({\n aptosConfig,\n originMethod: \"getModules\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/modules`,\n params: {\n ledger_version: options?.ledgerVersion,\n limit: options?.limit ?? 1000,\n },\n });\n}\n\n/**\n * Retrieves the modules associated with a specified account address.\n *\n * @param args - The arguments for retrieving modules.\n * @param args.aptosConfig - The configuration for connecting to the Aptos blockchain.\n * @param args.accountAddress - The address of the account whose modules are to be retrieved.\n * @param args.options - Optional parameters for pagination and ledger version.\n * @param args.options.cursor - The starting point for pagination. Note, this is obfuscated and is not an index.\n * @param args.options.limit - The maximum number of modules to retrieve (default is 100).\n * @param args.options.ledgerVersion - The specific ledger version to query.\n * @group Implementation\n */\nexport async function getModulesPage(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: CursorPaginationArgs & LedgerVersionArg;\n}): Promise<{ modules: MoveModuleBytecode[]; cursor: string | undefined }> {\n const { aptosConfig, accountAddress, options } = args;\n const { response, cursor } = await getPageWithObfuscatedCursor<{}, MoveModuleBytecode[]>({\n aptosConfig,\n originMethod: \"getModulesPage\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/modules`,\n params: {\n ledger_version: options?.ledgerVersion,\n cursor: options?.cursor,\n limit: options?.limit ?? 100,\n },\n });\n\n return { modules: response.data, cursor };\n}\n\n/**\n * Queries for a move module given an account address and module name.\n * This function can help you retrieve the module's ABI and other relevant information.\n *\n * @param args - The arguments for retrieving the module.\n * @param args.aptosConfig - The configuration for the Aptos client.\n * @param args.accountAddress - The account address in hex-encoded 32 byte format.\n * @param args.moduleName - The name of the module to retrieve.\n * @param args.options - Optional parameters for the request.\n * @param args.options.ledgerVersion - Specifies the ledger version of transactions. By default, the latest version will be used.\n * @returns The move module.\n * @group Implementation\n */\nexport async function getModule(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n moduleName: string;\n options?: LedgerVersionArg;\n}): Promise<MoveModuleBytecode> {\n return getModuleUtil(args);\n}\n\n/**\n * Retrieves a list of transactions associated with a specific account address.\n * This function allows you to paginate through the transactions for better performance and usability.\n *\n * @param args - The arguments for retrieving transactions.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.accountAddress - The account address for which to retrieve transactions.\n * @param args.options - Optional pagination parameters.\n * @param args.options.offset - The starting point for pagination.\n * @param args.options.limit - The maximum number of transactions to retrieve.\n * @group Implementation\n */\nexport async function getTransactions(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: PaginationArgs;\n}): Promise<CommittedTransactionResponse[]> {\n const { aptosConfig, accountAddress, options } = args;\n return paginateWithCursor<{}, CommittedTransactionResponse[]>({\n aptosConfig,\n originMethod: \"getTransactions\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/transactions`,\n params: { start: options?.offset, limit: options?.limit },\n });\n}\n\n/**\n * Retrieves a list of resources associated with a specific account address.\n *\n * @param args - The arguments for retrieving resources.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.accountAddress - The address of the account to fetch resources for.\n * @param args.options - Optional pagination and ledger version parameters.\n * @param args.options.limit - The maximum number of resources to retrieve (default is 999).\n * @param args.options.ledgerVersion - The specific ledger version to query.\n * @group Implementation\n */\nexport async function getResources(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: { limit?: number } & LedgerVersionArg;\n}): Promise<MoveResource[]> {\n const { aptosConfig, accountAddress, options } = args;\n return paginateWithObfuscatedCursor<{}, MoveResource[]>({\n aptosConfig,\n originMethod: \"getResources\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/resources`,\n params: {\n ledger_version: options?.ledgerVersion,\n limit: options?.limit ?? 999,\n },\n });\n}\n\n/**\n * Retrieves a page of resources associated with a specific account address.\n *\n * @param args - The arguments for retrieving resources.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.accountAddress - The address of the account to fetch resources for.\n * @param args.options - Optional pagination and ledger version parameters.\n * @param args.options.cursor - The starting point for pagination. Note, this is obfuscated and is not an index.\n * @param args.options.limit - The maximum number of resources to retrieve (default is 100).\n * @param args.options.ledgerVersion - The specific ledger version to query.\n * @group Implementation\n */\nexport async function getResourcesPage(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: CursorPaginationArgs & LedgerVersionArg;\n}): Promise<{ resources: MoveResource[]; cursor: string | undefined }> {\n const { aptosConfig, accountAddress, options } = args;\n const { response, cursor } = await getPageWithObfuscatedCursor<{}, MoveResource[]>({\n aptosConfig,\n originMethod: \"getResourcesPage\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/resources`,\n params: {\n ledger_version: options?.ledgerVersion,\n cursor: options?.cursor,\n limit: options?.limit ?? 100,\n },\n });\n\n return { resources: response.data, cursor };\n}\n\n/**\n * Retrieves a specific resource of a given type for the specified account address.\n *\n * @param args - The arguments for retrieving the resource.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.accountAddress - The address of the account from which to retrieve the resource.\n * @param args.resourceType - The type of the resource to retrieve, specified as a MoveStructId.\n * @param args.options - Optional parameters for specifying the ledger version.\n * @group Implementation\n */\nexport async function getResource<T extends {}>(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n resourceType: MoveStructId;\n options?: LedgerVersionArg;\n}): Promise<T> {\n const { aptosConfig, accountAddress, resourceType, options } = args;\n const { data } = await getAptosFullNode<{}, MoveResource>({\n aptosConfig,\n originMethod: \"getResource\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/resource/${resourceType}`,\n params: { ledger_version: options?.ledgerVersion },\n });\n return data.data as T;\n}\n\n/**\n * Retrieves the original account address associated with a given authentication key, which is useful for handling key rotations.\n *\n * @param args - The arguments for the lookup.\n * @param args.aptosConfig - The configuration for the Aptos client.\n * @param args.authenticationKey - The authentication key for which to look up the original address.\n * @param args.options - Optional parameters for specifying the ledger version.\n * @returns The original account address or the provided authentication key address if not found.\n * @throws Throws an error if the lookup fails for reasons other than the address not being found.\n * @group Implementation\n */\nexport async function lookupOriginalAccountAddress(args: {\n aptosConfig: AptosConfig;\n authenticationKey: AccountAddressInput;\n options?: LedgerVersionArg;\n}): Promise<AccountAddress> {\n const { aptosConfig, authenticationKey, options } = args;\n type OriginatingAddress = {\n address_map: { handle: string };\n };\n const resource = await getResource<OriginatingAddress>({\n aptosConfig,\n accountAddress: \"0x1\",\n resourceType: \"0x1::account::OriginatingAddress\",\n options,\n });\n\n const {\n address_map: { handle },\n } = resource;\n\n const authKeyAddress = AccountAddress.from(authenticationKey);\n\n // If the address is not found in the address map, which means its not rotated\n // then return the address as is\n try {\n const originalAddress = await getTableItem<string>({\n aptosConfig,\n handle,\n data: {\n key: authKeyAddress.toString(),\n key_type: \"address\",\n value_type: \"address\",\n },\n options,\n });\n\n return AccountAddress.from(originalAddress);\n } catch (err) {\n if (err instanceof AptosApiError && err.data.error_code === \"table_item_not_found\") {\n return authKeyAddress;\n }\n\n throw err;\n }\n}\n\n/**\n * Retrieves the count of tokens owned by a specific account address.\n *\n * @param args - The arguments for retrieving the account tokens count.\n * @param args.aptosConfig - The configuration settings for the Aptos network.\n * @param args.accountAddress - The address of the account for which to count the tokens.\n * @returns The count of tokens owned by the specified account.\n * @group Implementation\n */\nexport async function getAccountTokensCount(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, accountAddress } = args;\n\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: { owner_address: { _eq: string }; amount: { _gt: number } } = {\n owner_address: { _eq: address },\n amount: { _gt: 0 },\n };\n\n const graphqlQuery = {\n query: GetAccountTokensCount,\n variables: { where_condition: whereCondition },\n };\n\n const data = await queryIndexer<GetAccountTokensCountQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountTokensCount\",\n });\n\n // commonjs (aka cjs) doesn't handle Nullish Coalescing for some reason\n // might be because of how ts infer the graphql generated scheme type\n return data.current_token_ownerships_v2_aggregate.aggregate\n ? data.current_token_ownerships_v2_aggregate.aggregate.count\n : 0;\n}\n\n/**\n * Retrieves the tokens owned by a specified account address.\n *\n * @param args - The arguments for retrieving the account's tokens.\n * @param args.aptosConfig - The configuration for the Aptos client.\n * @param args.accountAddress - The address of the account whose tokens are being queried.\n * @param args.options - Optional parameters for filtering and pagination.\n * @param args.options.tokenStandard - The specific token standard to filter the results.\n * @param args.options.offset - The number of records to skip before starting to collect the result set.\n * @param args.options.limit - The maximum number of records to return.\n * @param args.options.orderBy - The criteria for ordering the results.\n * @returns A promise that resolves to the current token ownerships of the specified account.\n * @group Implementation\n */\nexport async function getAccountOwnedTokens(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensQueryResponse[0]>;\n}): Promise<GetAccountOwnedTokensQueryResponse> {\n const { aptosConfig, accountAddress, options } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: { owner_address: { _eq: string }; amount: { _gt: number }; token_standard?: { _eq: string } } =\n {\n owner_address: { _eq: address },\n amount: { _gt: 0 },\n };\n\n if (options?.tokenStandard) {\n whereCondition.token_standard = { _eq: options?.tokenStandard };\n }\n\n const graphqlQuery = {\n query: GetAccountOwnedTokens,\n variables: {\n where_condition: whereCondition,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetAccountOwnedTokensQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountOwnedTokens\",\n });\n\n return data.current_token_ownerships_v2;\n}\n\n/**\n * Retrieves the tokens owned by a specific account from a particular collection address.\n *\n * @param args - The parameters required to fetch the owned tokens.\n * @param args.aptosConfig - The Aptos configuration object.\n * @param args.accountAddress - The address of the account whose tokens are being queried.\n * @param args.collectionAddress - The address of the collection from which tokens are being retrieved.\n * @param args.options - Optional parameters for filtering and pagination, including token standard, pagination arguments, and\n * order by options.\n * @group Implementation\n */\nexport async function getAccountOwnedTokensFromCollectionAddress(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n collectionAddress: AccountAddressInput;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensFromCollectionResponse[0]>;\n}): Promise<GetAccountOwnedTokensFromCollectionResponse> {\n const { aptosConfig, accountAddress, collectionAddress, options } = args;\n const ownerAddress = AccountAddress.from(accountAddress).toStringLong();\n const collAddress = AccountAddress.from(collectionAddress).toStringLong();\n\n const whereCondition: {\n owner_address: { _eq: string };\n current_token_data: { collection_id: { _eq: string } };\n amount: { _gt: number };\n token_standard?: { _eq: string };\n } = {\n owner_address: { _eq: ownerAddress },\n current_token_data: { collection_id: { _eq: collAddress } },\n amount: { _gt: 0 },\n };\n\n if (options?.tokenStandard) {\n whereCondition.token_standard = { _eq: options?.tokenStandard };\n }\n\n const graphqlQuery = {\n query: GetAccountOwnedTokensFromCollection,\n variables: {\n where_condition: whereCondition,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetAccountOwnedTokensFromCollectionQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountOwnedTokensFromCollectionAddress\",\n });\n\n return data.current_token_ownerships_v2;\n}\n\n/**\n * Retrieves the collections owned by a specified account along with the tokens in those collections.\n *\n * @param args - The arguments for the function.\n * @param args.aptosConfig - The configuration for the Aptos client.\n * @param args.accountAddress - The address of the account whose collections are being queried.\n * @param args.options - Optional parameters for filtering and pagination.\n * @param args.options.tokenStandard - An optional token standard to filter the collections.\n * @param args.options.offset - An optional offset for pagination.\n * @param args.options.limit - An optional limit for the number of results returned.\n * @param args.options.orderBy - An optional parameter to specify the order of the results.\n * @group Implementation\n */\nexport async function getAccountCollectionsWithOwnedTokens(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountCollectionsWithOwnedTokenResponse[0]>;\n}): Promise<GetAccountCollectionsWithOwnedTokenResponse> {\n const { aptosConfig, accountAddress, options } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: {\n owner_address: { _eq: string };\n current_collection?: { token_standard: { _eq: string } };\n } = {\n owner_address: { _eq: address },\n };\n\n if (options?.tokenStandard) {\n whereCondition.current_collection = {\n token_standard: { _eq: options?.tokenStandard },\n };\n }\n\n const graphqlQuery = {\n query: GetAccountCollectionsWithOwnedTokens,\n variables: {\n where_condition: whereCondition,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetAccountCollectionsWithOwnedTokensQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountCollectionsWithOwnedTokens\",\n });\n\n return data.current_collection_ownership_v2_view;\n}\n\n/**\n * Retrieves the count of transactions associated with a specified account.\n *\n * @param args - The arguments for the function.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.accountAddress - The address of the account for which to retrieve the transaction count.\n * @returns The number of transactions associated with the specified account.\n * @group Implementation\n */\nexport async function getAccountTransactionsCount(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, accountAddress } = args;\n\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const graphqlQuery = {\n query: GetAccountTransactionsCount,\n variables: { address },\n };\n\n const data = await queryIndexer<GetAccountTransactionsCountQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountTransactionsCount\",\n });\n\n // commonjs (aka cjs) doesn't handle Nullish Coalescing for some reason\n // might be because of how ts infer the graphql generated scheme type\n return data.account_transactions_aggregate.aggregate ? data.account_transactions_aggregate.aggregate.count : 0;\n}\n\n/**\n * Retrieves the amount of a specific coin held by an account.\n *\n * @param args - The parameters for the request.\n * @param args.aptosConfig - The Aptos configuration object.\n * @param args.accountAddress - The address of the account to query.\n * @param args.coinType - Optional; the type of coin to check the amount for.\n * @param args.faMetadataAddress - Optional; the address of the fungible asset metadata.\n * @returns The amount of the specified coin held by the account, or 0 if none is found.\n * @throws Error if neither coinType nor faMetadataAddress is provided.\n * @group Implementation\n */\nexport async function getAccountCoinAmount(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n coinType?: MoveStructId;\n faMetadataAddress?: AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, accountAddress, coinType, faMetadataAddress } = args;\n\n let coinAssetType: string | undefined = coinType;\n let faAddress: string;\n\n if (coinType !== undefined && faMetadataAddress !== undefined) {\n faAddress = AccountAddress.from(faMetadataAddress).toStringLong();\n } else if (coinType !== undefined && faMetadataAddress === undefined) {\n // TODO Move to a separate function as defined in the AIP for coin migration\n if (coinType === APTOS_COIN) {\n faAddress = AccountAddress.A.toStringLong();\n } else {\n faAddress = createObjectAddress(AccountAddress.A, coinType).toStringLong();\n }\n } else if (coinType === undefined && faMetadataAddress !== undefined) {\n const addr = AccountAddress.from(faMetadataAddress);\n faAddress = addr.toStringLong();\n if (addr === AccountAddress.A) {\n coinAssetType = APTOS_COIN;\n }\n // The paired CoinType should be populated outside of this function in another\n // async call. We cannot do this internally due to dependency cycles issue.\n } else {\n throw new Error(\"Either coinType, fungibleAssetAddress, or both must be provided\");\n }\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n // Search by fungible asset address, unless it has a coin it migrated from\n let where: any = { asset_type: { _eq: faAddress } };\n if (coinAssetType !== undefined) {\n where = { asset_type: { _in: [coinAssetType, faAddress] } };\n }\n\n const data = await getAccountCoinsData({\n aptosConfig,\n accountAddress: address,\n options: {\n where,\n },\n });\n\n // commonjs (aka cjs) doesn't handle Nullish Coalescing for some reason\n // might be because of how ts infer the graphql generated scheme type\n return data[0] ? data[0].amount : 0;\n}\n\n/**\n * Retrieves the current fungible asset balances for a specified account.\n *\n * @param args - The arguments for retrieving account coins data.\n * @param args.aptosConfig - The configuration for connecting to the Aptos network.\n * @param args.accountAddress - The address of the account for which to retrieve coin data.\n * @param args.options - Optional parameters for pagination and filtering the results.\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.orderBy - The criteria for ordering the results.\n * @param args.options.where - Conditions to filter the results based on the current fungible asset balances.\n * @group Implementation\n */\nexport async function getAccountCoinsData(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & OrderByArg<GetAccountCoinsDataResponse[0]> & WhereArg<CurrentFungibleAssetBalancesBoolExp>;\n}): Promise<GetAccountCoinsDataResponse> {\n const { aptosConfig, accountAddress, options } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: { owner_address: { _eq: string } } = {\n ...options?.where,\n owner_address: { _eq: address },\n };\n\n const graphqlQuery = {\n query: GetAccountCoinsData,\n variables: {\n where_condition: whereCondition,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetAccountCoinsDataQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountCoinsData\",\n });\n\n return data.current_fungible_asset_balances;\n}\n\n/**\n * Retrieves the count of fungible asset coins held by a specified account.\n *\n * @param args - The arguments for the function.\n * @param args.aptosConfig - The configuration settings for the Aptos network.\n * @param args.accountAddress - The address of the account for which to retrieve the coin count.\n * @throws Error if the count of account coins cannot be retrieved.\n * @group Implementation\n */\nexport async function getAccountCoinsCount(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, accountAddress } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const graphqlQuery = {\n query: GetAccountCoinsCount,\n variables: { address },\n };\n\n const data = await queryIndexer<GetAccountCoinsCountQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountCoinsCount\",\n });\n\n if (!data.current_fungible_asset_balances_aggregate.aggregate) {\n throw Error(\"Failed to get the count of account coins\");\n }\n\n return data.current_fungible_asset_balances_aggregate.aggregate.count;\n}\n\n/**\n * Retrieves an account's balance for the given asset via the fullnode REST API.\n *\n * - `asset` may be a coin type (Move struct ID, e.g. `0x1::aptos_coin::AptosCoin`) or an FA metadata address.\n * - Calls: `GET /accounts/{accountAddress}/balance/{asset}` and returns the numeric balance.\n *\n * @param args - The parameters for the request.\n * @param args.aptosConfig - The Aptos configuration object.\n * @param args.accountAddress - The account address to query.\n * @param args.asset - The asset identifier (coin type or FA metadata address).\n * @returns The balance as a number.\n * @group Implementation\n */\nexport async function getBalance(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n asset: MoveStructId | AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, accountAddress, asset } = args;\n\n const response = await getAptosFullNode<{}, number>({\n aptosConfig,\n originMethod: \"getBalance\",\n path: `accounts/${accountAddress}/balance/${asset}`,\n params: {\n accountAddress: accountAddress.toString(),\n asset: asset instanceof Uint8Array ? AccountAddress.from(asset).toString() : asset.toString(),\n },\n });\n\n return parseInt(response.data.toString(), 10);\n}\n\n/**\n * Retrieves the objects owned by a specified account.\n *\n * @param args - The parameters for the request.\n * @param args.aptosConfig - The configuration for the Aptos client.\n * @param args.accountAddress - The address of the account whose owned objects are to be retrieved.\n * @param args.options - Optional parameters for pagination and ordering of the results.\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.orderBy - The criteria to order the results by.\n * @returns A promise that resolves to the current objects owned by the specified account.\n * @group Implementation\n */\nexport async function getAccountOwnedObjects(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & OrderByArg<GetObjectDataQueryResponse[0]>;\n}): Promise<GetObjectDataQueryResponse> {\n const { aptosConfig, accountAddress, options } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: { owner_address: { _eq: string } } = {\n owner_address: { _eq: address },\n };\n const graphqlQuery = {\n query: GetObjectData,\n variables: {\n where_condition: whereCondition,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n const data = await queryIndexer<GetObjectDataQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountOwnedObjects\",\n });\n\n return data.current_objects;\n}\n\n/**\n * Derives an account from the provided private key and Aptos configuration.\n *\n * This function queries all owned accounts for the provided private key and returns the most\n * recently used account. If no account is found, it will throw an error unless `throwIfNoAccountFound` is set to false.\n *\n * If `throwIfNoAccountFound` is set to false, the function will return the default account for the private key via `Account.fromPrivateKey`.\n *\n * NOTE: There is a potential issue once the unified single signer scheme is adopted by the community.\n * Because one could create two accounts with the same private key with this new authenticator type,\n * we'll need to determine the order in which we look up the accounts: first unified scheme and then legacy scheme,\n * or first legacy scheme and then unified scheme.\n *\n * @param args - The arguments for deriving the account.\n * @param args.aptosConfig - The Aptos configuration used for account lookup.\n * @param args.privateKey - The private key used to derive the account.\n * @param args.options.throwIfNoAccountFound - If true, throw an error if no existing account is found on chain. Default is false.\n * @throws Error if the account cannot be derived from the private key.\n * @group Implementation\n * @deprecated Note that more inspection is needed by the user to determine which account exists on-chain\n */\nexport async function deriveAccountFromPrivateKey(args: {\n aptosConfig: AptosConfig;\n privateKey: PrivateKeyInput;\n options?: {\n throwIfNoAccountFound?: boolean;\n };\n}): Promise<Account> {\n const { aptosConfig, privateKey, options } = args;\n const throwIfNoAccountFound = options?.throwIfNoAccountFound ?? false;\n\n const accounts = await deriveOwnedAccountsFromPrivateKey({ aptosConfig, privateKey });\n if (accounts.length === 0) {\n if (throwIfNoAccountFound) {\n throw new Error(`No existing account found for private key.`);\n }\n // If no account is found, return the default account. This is a legacy account for Ed25519 private keys.\n return Account.fromPrivateKey({ privateKey });\n }\n return accounts[0];\n}\n\n/**\n * Checks if an account exists by verifying its information against the Aptos blockchain.\n *\n * @param args - The arguments for the function.\n * @param args.aptosConfig - The configuration for connecting to the Aptos blockchain.\n * @param args.authKey - The authentication key used to derive the account address.\n * @returns A promise that resolves to a boolean indicating whether the account exists.\n *\n * @throws Throws an Error if there is an issue while looking for account information.\n * @group Implementation\n */\nexport async function isAccountExist(args: { aptosConfig: AptosConfig; authKey: AuthenticationKey }): Promise<boolean> {\n const { aptosConfig, authKey } = args;\n const accountAddress = await lookupOriginalAccountAddress({\n aptosConfig,\n authenticationKey: authKey.derivedAddress(),\n });\n\n return doesAccountExistAtAddress({ aptosConfig, accountAddress });\n}\n\n/**\n * Checks if an account exists at a given address.\n *\n * @param args - The arguments for checking account existence.\n * @param args.aptosConfig - The configuration for the Aptos client.\n * @param args.accountAddress - The address of the account to check.\n * @param args.options.withAuthKey - An optional authentication key which will also be checked against if provided.\n * @returns A promise that resolves to a boolean indicating whether the account exists.\n * @group Implementation\n */\nasync function doesAccountExistAtAddress(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddress;\n options?: { withAuthKey?: AuthenticationKey };\n}): Promise<boolean> {\n const { aptosConfig, accountAddress, options } = args;\n try {\n // Get the account resources and the balance of the account. We need to check both because\n // an account resource can exist with 0 balance and a balance can exist without an account resource (light accounts).\n const [resources, ownedObjects] = await Promise.all([\n getResources({\n aptosConfig,\n accountAddress,\n }),\n getAccountOwnedObjects({\n aptosConfig,\n accountAddress,\n options: {\n limit: 1,\n },\n }),\n ]);\n\n const accountResource: MoveResource<{ authentication_key: string }> | undefined = resources.find(\n (r) => r.type === \"0x1::account::Account\",\n ) as MoveResource<{ authentication_key: string }> | undefined;\n\n // If the account resource is not found and the balance is 0, then the account does not exist.\n if (!accountResource && ownedObjects.length === 0) {\n return false;\n }\n\n // If no auth key is provided as an argument, return true.\n if (!options?.withAuthKey) {\n return true;\n }\n\n // Get the auth key from the account resource if it exists. If the account resource does not exist,\n // then the auth key is the account address by default.\n let authKey;\n if (accountResource) {\n authKey = accountResource.data.authentication_key;\n } else {\n authKey = accountAddress.toStringLong();\n }\n\n if (authKey !== options.withAuthKey.toString()) {\n return false;\n }\n\n // Else the account exists and the auth key matches.\n return true;\n } catch (error: any) {\n throw new Error(`Error while checking if account exists at ${accountAddress.toString()}: ${error}`);\n }\n}\n\nconst rotateAuthKeyAbi: EntryFunctionABI = {\n typeParameters: [],\n parameters: [\n new TypeTagU8(),\n TypeTagVector.u8(),\n new TypeTagU8(),\n TypeTagVector.u8(),\n TypeTagVector.u8(),\n TypeTagVector.u8(),\n ],\n};\n\n/**\n * Rotates the authentication key for a given account.\n *\n * @param args - The arguments for rotating the authentication key.\n * @param args.aptosConfig - The configuration settings for the Aptos network.\n * @param args.fromAccount - The account from which the authentication key will be rotated.\n * @param args.toAccount - (Optional) The target account to rotate to. Required if not using toNewPrivateKey.\n * @param args.toNewPrivateKey - (Optional) The new private key to rotate to. Required if not using toAccount.\n *\n * @remarks\n * This function supports three modes of rotation:\n * 1. Using a target Account object (toAccount)\n * 2. Using a new private key (toNewPrivateKey)\n *\n * @returns A simple transaction object that can be submitted to the network.\n * @throws Error if the rotation fails or verification fails.\n *\n * @group Implementation\n */\nexport async function rotateAuthKey(\n args: {\n aptosConfig: AptosConfig;\n fromAccount: Account;\n options?: InputGenerateTransactionOptions;\n } & ({ toAccount: Ed25519Account | MultiEd25519Account } | { toNewPrivateKey: Ed25519PrivateKey }),\n): Promise<SimpleTransaction> {\n const { aptosConfig, fromAccount, options } = args;\n if (\"toNewPrivateKey\" in args) {\n return rotateAuthKeyWithChallenge({\n aptosConfig,\n fromAccount,\n toNewPrivateKey: args.toNewPrivateKey,\n options,\n });\n } else if (\"toAccount\" in args) {\n if (args.toAccount instanceof Ed25519Account) {\n return rotateAuthKeyWithChallenge({\n aptosConfig,\n fromAccount,\n toNewPrivateKey: args.toAccount.privateKey,\n options,\n });\n } else {\n return rotateAuthKeyWithChallenge({ aptosConfig, fromAccount, toAccount: args.toAccount, options });\n }\n } else {\n throw new Error(\"Invalid arguments\");\n }\n}\n\nasync function rotateAuthKeyWithChallenge(\n args: {\n aptosConfig: AptosConfig;\n fromAccount: Account;\n options?: InputGenerateTransactionOptions;\n } & ({ toNewPrivateKey: Ed25519PrivateKey } | { toAccount: MultiEd25519Account }),\n): Promise<SimpleTransaction> {\n const { aptosConfig, fromAccount, options } = args;\n const accountInfo = await getInfo({\n aptosConfig,\n accountAddress: fromAccount.accountAddress,\n });\n\n let newAccount: Account;\n if (\"toNewPrivateKey\" in args) {\n newAccount = Account.fromPrivateKey({ privateKey: args.toNewPrivateKey, legacy: true });\n } else {\n newAccount = args.toAccount;\n }\n\n const challenge = new RotationProofChallenge({\n sequenceNumber: BigInt(accountInfo.sequence_number),\n originator: fromAccount.accountAddress,\n currentAuthKey: AccountAddress.from(accountInfo.authentication_key),\n newPublicKey: newAccount.publicKey,\n });\n\n // Sign the challenge\n const challengeHex = challenge.bcsToBytes();\n const proofSignedByCurrentKey = fromAccount.sign(challengeHex);\n const proofSignedByNewKey = newAccount.sign(challengeHex);\n\n // Generate transaction\n return generateTransaction({\n aptosConfig,\n sender: fromAccount.accountAddress,\n data: {\n function: \"0x1::account::rotate_authentication_key\",\n functionArguments: [\n new U8(fromAccount.signingScheme), // from scheme\n MoveVector.U8(fromAccount.publicKey.toUint8Array()),\n new U8(newAccount.signingScheme), // to scheme\n MoveVector.U8(newAccount.publicKey.toUint8Array()),\n MoveVector.U8(proofSignedByCurrentKey.toUint8Array()),\n MoveVector.U8(proofSignedByNewKey.toUint8Array()),\n ],\n abi: rotateAuthKeyAbi,\n },\n options,\n });\n}\n\nconst rotateAuthKeyUnverifiedAbi: EntryFunctionABI = {\n typeParameters: [],\n parameters: [new TypeTagU8(), TypeTagVector.u8()],\n};\n\n/**\n * Rotates the authentication key for a given account without verifying the new key.\n *\n * @param args - The arguments for rotating the authentication key.\n * @param args.aptosConfig - The configuration settings for the Aptos network.\n * @param args.fromAccount - The account from which the authentication key will be rotated.\n * @param args.toNewPublicKey - The new public key to rotate to.\n * @returns A simple transaction object that can be submitted to the network.\n * @throws Error if the rotation fails or verification fails.\n *\n * @group Implementation\n */\nexport async function rotateAuthKeyUnverified(args: {\n aptosConfig: AptosConfig;\n fromAccount: Account;\n toNewPublicKey: AccountPublicKey;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, fromAccount, toNewPublicKey, options } = args;\n\n return generateTransaction({\n aptosConfig,\n sender: fromAccount.accountAddress,\n data: {\n function: \"0x1::account::rotate_authentication_key_from_public_key\",\n functionArguments: [\n new U8(accountPublicKeyToSigningScheme(toNewPublicKey)), // to scheme\n MoveVector.U8(accountPublicKeyToBaseAccountPublicKey(toNewPublicKey).toUint8Array()),\n ],\n abi: rotateAuthKeyUnverifiedAbi,\n },\n options,\n });\n}\n\nexport type AccountInfo = {\n accountAddress: AccountAddress;\n publicKey: BaseAccountPublicKey;\n lastTransactionVersion: number;\n};\n\nexport async function getAccountsForPublicKey(args: {\n aptosConfig: AptosConfig;\n publicKey: BaseAccountPublicKey;\n options?: { includeUnverified?: boolean; noMultiKey?: boolean };\n}): Promise<AccountInfo[]> {\n const { aptosConfig, publicKey, options } = args;\n const noMultiKey = options?.noMultiKey ?? false;\n if (noMultiKey && publicKey instanceof AbstractMultiKey) {\n throw new Error(\"Multi-key accounts are not supported when noMultiKey is true.\");\n }\n const allPublicKeys: BaseAccountPublicKey[] = [publicKey];\n\n // For Ed25519, we add the both the legacy Ed25519PublicKey and the new AnyPublicKey form.\n if (publicKey instanceof AnyPublicKey && publicKey.publicKey instanceof Ed25519PublicKey) {\n allPublicKeys.push(publicKey.publicKey);\n } else if (publicKey instanceof Ed25519PublicKey) {\n allPublicKeys.push(new AnyPublicKey(publicKey));\n }\n\n // Run both operations in parallel\n const [defaultAccountData, multiPublicKeys] = await Promise.all([\n // Check the provided public key for the default account. In the case of Ed25519, this will check both the legacy Ed25519PublicKey\n // and the AnyPublicKey form and may an existing account for each.\n Promise.all(\n allPublicKeys.map(async (publicKey) => {\n const addressAndLastTxnVersion = await getDefaultAccountInfoForPublicKey({ aptosConfig, publicKey });\n if (addressAndLastTxnVersion) {\n return { ...addressAndLastTxnVersion, publicKey };\n }\n return undefined;\n }),\n ),\n // Get multi-keys for the provided public key if not already a multi-key.\n !(publicKey instanceof AbstractMultiKey) && !noMultiKey\n ? getMultiKeysForPublicKey({ aptosConfig, publicKey, options })\n : Promise.resolve([]),\n ]);\n\n const result: {\n accountAddress: AccountAddress;\n publicKey: BaseAccountPublicKey;\n lastTransactionVersion: number;\n }[] = [];\n\n // Add any default accounts that exist to the result.\n for (const data of defaultAccountData) {\n if (data) {\n result.push(data);\n }\n }\n\n // Add any multi-keys to allPublicKeys\n allPublicKeys.push(...multiPublicKeys);\n\n // Get a map of the auth key to the public key for all public keys.\n const authKeyToPublicKey = new Map(allPublicKeys.map((key) => [key.authKey().toString(), key]));\n\n // Get the account addresses for the auth keys.\n const authKeyAccountAddressPairs = await getAccountAddressesForAuthKeys({\n aptosConfig,\n authKeys: allPublicKeys.map((key) => key.authKey()),\n options,\n });\n\n for (const authKeyAccountAddressPair of authKeyAccountAddressPairs) {\n // Skip if the account address is already in the result.\n // This can happen in the rare edge case where the default account has been rotated but has been rotated back to the original auth key.\n if (result.find((r) => r.accountAddress === authKeyAccountAddressPair.accountAddress)) {\n continue;\n }\n // Get the public key for the auth key using the map we created earlier.\n const publicKey = authKeyToPublicKey.get(authKeyAccountAddressPair.authKey.toString());\n if (!publicKey) {\n throw new Error(\n `No publicKey found for authentication key ${authKeyAccountAddressPair.authKey}. This should never happen.`,\n );\n }\n result.push({\n accountAddress: authKeyAccountAddressPair.accountAddress,\n publicKey,\n lastTransactionVersion: authKeyAccountAddressPair.lastTransactionVersion,\n });\n }\n // Sort the result by the last transaction version in descending order (most recent first).\n return result.sort((a, b) => b.lastTransactionVersion - a.lastTransactionVersion);\n}\n\nexport async function deriveOwnedAccountsFromSigner(args: {\n aptosConfig: AptosConfig;\n signer: Account | PrivateKeyInput;\n options?: { includeUnverified?: boolean; noMultiKey?: boolean };\n}): Promise<Account[]> {\n const { aptosConfig, signer, options } = args;\n\n if (signer instanceof Ed25519PrivateKey || signer instanceof Secp256k1PrivateKey) {\n return deriveOwnedAccountsFromPrivateKey({ aptosConfig, privateKey: signer, options });\n }\n\n if (signer instanceof Ed25519Account || signer instanceof SingleKeyAccount) {\n return deriveOwnedAccountsFromPrivateKey({ aptosConfig, privateKey: signer.privateKey, options });\n }\n\n if (signer instanceof KeylessAccount || signer instanceof FederatedKeylessAccount) {\n return deriveOwnedAccountsFromKeylessSigner({ aptosConfig, keylessAccount: signer, options });\n }\n\n if (signer instanceof MultiKeyAccount) {\n if (signer.signers.length === 1) {\n return deriveOwnedAccountsFromSigner({ aptosConfig, signer: signer.signers[0], options });\n }\n }\n\n if (signer instanceof MultiEd25519Account) {\n if (signer.signers.length === 1) {\n return deriveOwnedAccountsFromPrivateKey({ aptosConfig, privateKey: signer.signers[0], options });\n }\n }\n\n throw new Error(\"Unknown signer type\");\n}\n\nasync function deriveOwnedAccountsFromKeylessSigner(args: {\n aptosConfig: AptosConfig;\n keylessAccount: KeylessAccount | FederatedKeylessAccount;\n options?: { includeUnverified?: boolean; noMultiKey?: boolean };\n}): Promise<Account[]> {\n const { aptosConfig, keylessAccount, options } = args;\n const addressesAndPublicKeys = await getAccountsForPublicKey({\n aptosConfig,\n publicKey: keylessAccount.getAnyPublicKey(),\n options,\n });\n\n const keylessAccountParams = {\n proof: keylessAccount.proofOrPromise,\n jwt: keylessAccount.jwt,\n ephemeralKeyPair: keylessAccount.ephemeralKeyPair,\n pepper: keylessAccount.pepper,\n verificationKeyHash: keylessAccount.verificationKeyHash,\n };\n\n const accounts: Account[] = [];\n for (const { accountAddress, publicKey } of addressesAndPublicKeys) {\n if (publicKey instanceof AbstractMultiKey) {\n if (publicKey.getSignaturesRequired() > 1) {\n continue;\n }\n if (publicKey instanceof MultiEd25519PublicKey) {\n throw new Error(\"Keyless authentication cannot be used for multi-ed25519 accounts. This should never happen.\");\n } else if (publicKey instanceof MultiKey) {\n accounts.push(new MultiKeyAccount({ multiKey: publicKey, signers: [keylessAccount], address: accountAddress }));\n }\n } else {\n if (keylessAccount instanceof FederatedKeylessAccount) {\n accounts.push(\n FederatedKeylessAccount.create({\n ...keylessAccountParams,\n address: accountAddress,\n jwkAddress: keylessAccount.publicKey.jwkAddress,\n }),\n );\n } else {\n accounts.push(\n KeylessAccount.create({\n ...keylessAccountParams,\n address: accountAddress,\n }),\n );\n }\n }\n }\n return accounts;\n}\n\nasync function deriveOwnedAccountsFromPrivateKey(args: {\n aptosConfig: AptosConfig;\n privateKey: Ed25519PrivateKey | Secp256k1PrivateKey;\n options?: { includeUnverified?: boolean; noMultiKey?: boolean };\n}): Promise<Account[]> {\n const { aptosConfig, privateKey, options } = args;\n const singleKeyAccount = Account.fromPrivateKey({ privateKey, legacy: false });\n const addressesAndPublicKeys = await getAccountsForPublicKey({\n aptosConfig,\n publicKey: new AnyPublicKey(privateKey.publicKey()),\n options,\n });\n\n const accounts: Account[] = [];\n\n // Iterate through the addressesAndPublicKeys and construct the accounts.\n for (const { accountAddress, publicKey } of addressesAndPublicKeys) {\n if (publicKey instanceof AbstractMultiKey) {\n // Skip multi-key accounts with more than 1 signature required as the user does not have full ownership with just 1 private key.\n if (publicKey.getSignaturesRequired() > 1) {\n continue;\n }\n // Construct the appropriate multi-key type.\n if (publicKey instanceof MultiEd25519PublicKey) {\n accounts.push(\n new MultiEd25519Account({ publicKey, signers: [privateKey as Ed25519PrivateKey], address: accountAddress }),\n );\n } else if (publicKey instanceof MultiKey) {\n accounts.push(\n new MultiKeyAccount({ multiKey: publicKey, signers: [singleKeyAccount], address: accountAddress }),\n );\n }\n } else {\n // Check if the public key is a legacy Ed25519PublicKey, if so, we need to use the legacy account constructor.\n const isLegacy = publicKey instanceof Ed25519PublicKey;\n accounts.push(Account.fromPrivateKey({ privateKey, address: accountAddress, legacy: isLegacy }));\n }\n }\n return accounts;\n}\n\n/**\n * Gets the multi-keys for a given public key.\n *\n * This function retrieves the multi-keys that contain the provided public key.\n * It performs the following steps:\n * 1. Constructs a where condition for the public key where the public key matches the provided public key.\n * 2. Queries the indexer for the multi-keys.\n * 3. Returns the multi-keys.\n *\n * @param args.aptosConfig - The configuration settings for the Aptos network.\n * @param args.publicKey - The public key to get the multi-keys for. This public key cannot itself be a multi-key.\n * @returns The multi-keys (MultiKey or MultiEd25519PublicKey) that contain the given public key.\n */\nasync function getMultiKeysForPublicKey(args: {\n aptosConfig: AptosConfig;\n publicKey: Ed25519PublicKey | AnyPublicKey;\n options?: { includeUnverified?: boolean };\n}): Promise<(MultiKey | MultiEd25519PublicKey)[]> {\n const { aptosConfig, publicKey, options } = args;\n if (publicKey instanceof AbstractMultiKey) {\n throw new Error(\"Public key is a multi-key.\");\n }\n const includeUnverified = options?.includeUnverified ?? false;\n const anyPublicKey = publicKey instanceof AnyPublicKey ? publicKey : new AnyPublicKey(publicKey);\n const baseKey = anyPublicKey.publicKey;\n const variant = anyPublicKeyVariantToString(anyPublicKey.variant);\n\n const whereCondition: any = {\n public_key: { _eq: baseKey.toString() },\n public_key_type: { _eq: variant },\n ...(includeUnverified ? {} : { is_public_key_used: { _eq: true } }),\n };\n\n const graphqlQuery = {\n query: GetAuthKeysForPublicKey,\n variables: {\n where_condition: whereCondition,\n },\n };\n\n const { public_key_auth_keys: data } = await queryIndexer<GetAuthKeysForPublicKeyQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getMultiKeysForPublicKey\",\n });\n\n const authKeys = data.map((entry) => {\n switch (entry.signature_type) {\n case \"multi_ed25519_signature\":\n return MultiEd25519PublicKey.deserializeWithoutLength(Deserializer.fromHex(entry.account_public_key!));\n case \"multi_key_signature\":\n return MultiKey.deserialize(Deserializer.fromHex(entry.account_public_key!));\n default:\n throw new Error(`Unknown multi-signature type: ${entry.signature_type}`);\n }\n });\n return authKeys;\n}\n\n/**\n * Gets the account addresses for the given authentication keys.\n *\n * This function retrieves the account addresses that are associated with the provided authentication keys.\n * It performs the following steps:\n * 1. Constructs a where condition for the authentication keys where auth key matches any of the provided auth keys.\n * 2. Queries the indexer for the account addresses and gets the results ordered by the last transaction version (most recent first).\n * 3. Returns the account addresses.\n *\n * @param args.aptosConfig - The configuration settings for the Aptos network.\n * @param args.authKeys - The authentication keys to get the account addresses for.\n * @param args.options.includeUnverified - Whether to include unverified accounts in the results. Unverified accounts\n * are accounts that can be authenticated with the signer, but there is no history of the signer using the account.\n * Default is false.\n * @returns The account addresses associated with the given authentication keys.\n */\nasync function getAccountAddressesForAuthKeys(args: {\n aptosConfig: AptosConfig;\n authKeys: AuthenticationKey[];\n options?: { includeUnverified?: boolean };\n}): Promise<{ authKey: AuthenticationKey; accountAddress: AccountAddress; lastTransactionVersion: number }[]> {\n const { aptosConfig, authKeys, options } = args;\n const includeUnverified = options?.includeUnverified ?? false;\n if (authKeys.length === 0) {\n throw new Error(\"No authentication keys provided\");\n }\n const whereCondition: any = {\n auth_key: { _in: authKeys.map((authKey) => authKey.toString()) },\n ...(includeUnverified ? {} : { is_auth_key_used: { _eq: true } }),\n };\n\n const graphqlQuery = {\n query: GetAccountAddressesForAuthKey,\n variables: {\n where_condition: whereCondition,\n order_by: [{ last_transaction_version: \"desc\" }],\n },\n };\n const { auth_key_account_addresses: data } = await queryIndexer<GetAccountAddressesForAuthKeyQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountAddressesForAuthKeys\",\n });\n return data.map((entry) => ({\n authKey: new AuthenticationKey({ data: entry.auth_key }),\n accountAddress: new AccountAddress(Hex.hexInputToUint8Array(entry.account_address)),\n lastTransactionVersion: Number(entry.last_transaction_version),\n }));\n}\n\n/**\n * Returns the last transaction version that was signed by an account.\n *\n * If an account was created but has not signed any transactions, the last transaction version will be 0.\n *\n * @param args.aptosConfig - The configuration settings for the Aptos network.\n * @param args.accountAddress - The account address to get the latest transaction version for.\n * @returns The last transaction version that was signed by the account.\n */\nasync function getLatestTransactionVersionForAddress(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, accountAddress } = args;\n const transactions = await getTransactions({ aptosConfig, accountAddress, options: { limit: 1 } });\n if (transactions.length === 0) {\n return 0;\n }\n return Number(transactions[0].version);\n}\n\n/**\n * Gets the default account info for a given public key. 'Default account' means the account\n * is address is the same as the auth key derived from the public key and the account auth key has\n * not been rotated.\n *\n * @param args - The arguments for getting the default account info for a given public key.\n * @param args.aptosConfig - The configuration settings for the Aptos network.\n * @param args.publicKey - The public key to use to derive the address.\n * @returns An object containing the account address and the last transaction version, or undefined if the account does not exist.\n */\nasync function getDefaultAccountInfoForPublicKey(args: {\n aptosConfig: AptosConfig;\n publicKey: AccountPublicKey;\n}): Promise<{ accountAddress: AccountAddress; lastTransactionVersion: number } | undefined> {\n const { aptosConfig, publicKey } = args;\n const derivedAddress = publicKey.authKey().derivedAddress();\n\n const [lastTransactionVersion, exists] = await Promise.all([\n getLatestTransactionVersionForAddress({\n aptosConfig,\n accountAddress: derivedAddress,\n }),\n doesAccountExistAtAddress({\n aptosConfig,\n accountAddress: derivedAddress,\n options: { withAuthKey: publicKey.authKey() },\n }),\n ]);\n if (exists) {\n return { accountAddress: derivedAddress, lastTransactionVersion };\n }\n return undefined;\n}\n"],"mappings":"AAWA,OACE,oBAAAA,EACA,+BAAAC,EACA,sBAAAC,EACA,gCAAAC,MACK,YACP,OAGE,+BAAAC,MAiBK,WACP,OAAS,kBAAAC,MAA2C,yBACpD,OACE,WAAAC,EACA,kBAAAC,EACA,2BAAAC,EACA,kBAAAC,EACA,uBAAAC,EACA,mBAAAC,EACA,oBAAAC,MACK,aACP,OACE,oBAAAC,EAEA,gBAAAC,EAEA,oBAAAC,EACA,yBAAAC,EACA,YAAAC,MAEK,iBACP,OAAS,gBAAAC,MAAoB,YAC7B,OAAS,aAAaC,EAAe,WAAWC,MAAmB,UAanE,OACE,wBAAAC,EACA,uBAAAC,EACA,wCAAAC,EACA,iBAAAC,EACA,yBAAAC,EACA,uCAAAC,EACA,yBAAAC,EACA,+BAAAC,EACA,2BAAAC,GACA,iCAAAC,OACK,6BACP,OAAS,uBAAAC,GAAqB,qBAAAC,GAAmB,qBAAAC,GAAmB,uBAAAC,GAAqB,OAAAC,OAAW,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AE,CAAE,CAAC,EACjG,OAAImG,EAAa,SAAW,EACnB,EAEF,OAAOA,EAAa,CAAC,EAAE,OAAO,CACvC,CAYA,eAAezB,GAAkC7E,EAG2C,CAC1F,KAAM,CAAE,YAAAE,EAAa,UAAAqE,CAAU,EAAIvE,EAC7BuG,EAAiBhC,EAAU,QAAQ,EAAE,eAAe,EAEpD,CAACiC,EAAwBC,CAAM,EAAI,MAAM,QAAQ,IAAI,CACzDJ,GAAsC,CACpC,YAAAnG,EACA,eAAgBqG,CAClB,CAAC,EACDnD,EAA0B,CACxB,YAAAlD,EACA,eAAgBqG,EAChB,QAAS,CAAE,YAAahC,EAAU,QAAQ,CAAE,CAC9C,CAAC,CACH,CAAC,EACD,GAAIkC,EACF,MAAO,CAAE,eAAgBF,EAAgB,uBAAAC,CAAuB,CAGpE","names":["getAptosFullNode","getPageWithObfuscatedCursor","paginateWithCursor","paginateWithObfuscatedCursor","anyPublicKeyVariantToString","AccountAddress","Account","Ed25519Account","FederatedKeylessAccount","KeylessAccount","MultiEd25519Account","MultiKeyAccount","SingleKeyAccount","AbstractMultiKey","AnyPublicKey","Ed25519PublicKey","MultiEd25519PublicKey","MultiKey","queryIndexer","getModuleUtil","getInfoUtil","GetAccountCoinsCount","GetAccountCoinsData","GetAccountCollectionsWithOwnedTokens","GetObjectData","GetAccountOwnedTokens","GetAccountOwnedTokensFromCollection","GetAccountTokensCount","GetAccountTransactionsCount","GetAuthKeysForPublicKey","GetAccountAddressesForAuthKey","Secp256k1PrivateKey","AuthenticationKey","Ed25519PrivateKey","createObjectAddress","Hex","getTableItem","APTOS_COIN","AptosApiError","Deserializer","generateTransaction","RotationProofChallenge","TypeTagU8","TypeTagVector","U8","MoveVector","accountPublicKeyToBaseAccountPublicKey","accountPublicKeyToSigningScheme","getInfo","args","getModules","aptosConfig","accountAddress","options","getModulesPage","response","cursor","getModule","getTransactions","getResources","getResourcesPage","getResource","resourceType","data","lookupOriginalAccountAddress","authenticationKey","resource","handle","authKeyAddress","originalAddress","err","getAccountTokensCount","whereCondition","getAccountOwnedTokens","graphqlQuery","getAccountOwnedTokensFromCollectionAddress","collectionAddress","ownerAddress","collAddress","getAccountCollectionsWithOwnedTokens","getAccountTransactionsCount","address","getAccountCoinAmount","coinType","faMetadataAddress","coinAssetType","faAddress","addr","where","getAccountCoinsData","getAccountCoinsCount","getBalance","asset","getAccountOwnedObjects","deriveAccountFromPrivateKey","privateKey","throwIfNoAccountFound","accounts","deriveOwnedAccountsFromPrivateKey","isAccountExist","authKey","doesAccountExistAtAddress","resources","ownedObjects","accountResource","r","error","rotateAuthKeyAbi","rotateAuthKey","fromAccount","rotateAuthKeyWithChallenge","accountInfo","newAccount","challengeHex","proofSignedByCurrentKey","proofSignedByNewKey","rotateAuthKeyUnverifiedAbi","rotateAuthKeyUnverified","toNewPublicKey","getAccountsForPublicKey","publicKey","noMultiKey","allPublicKeys","defaultAccountData","multiPublicKeys","addressAndLastTxnVersion","getDefaultAccountInfoForPublicKey","getMultiKeysForPublicKey","result","authKeyToPublicKey","key","authKeyAccountAddressPairs","getAccountAddressesForAuthKeys","authKeyAccountAddressPair","a","b","deriveOwnedAccountsFromSigner","signer","deriveOwnedAccountsFromKeylessSigner","keylessAccount","addressesAndPublicKeys","keylessAccountParams","singleKeyAccount","isLegacy","includeUnverified","anyPublicKey","baseKey","variant","entry","authKeys","getLatestTransactionVersionForAddress","transactions","derivedAddress","lastTransactionVersion","exists"]}
@@ -1,2 +1,2 @@
1
- import{Fd as a,Gd as b,Hd as c,Id as d,Jd as e,Kd as f,Ld as g,Md as h,Nd as i,Od as j,Pd as k,Qd as l,Rd as m,Sd as n,Td as o,Ud as p,Vd as q,Wd as r,Xd as s,Yd as t}from"../chunk-L72TIN7T.mjs";import"../chunk-2XQKGWHQ.mjs";import"../chunk-UYVPNUH3.mjs";import"../chunk-XKUIMGKU.mjs";import"../chunk-N6YTF76Q.mjs";import"../chunk-A5L76YP7.mjs";import"../chunk-I7XT6L7S.mjs";import"../chunk-5HXLZHDW.mjs";import"../chunk-G3MHXDYA.mjs";import"../chunk-JABP65XD.mjs";import"../chunk-GOXRBEIJ.mjs";import"../chunk-2PASUPUO.mjs";import"../chunk-XJJVJOX5.mjs";import"../chunk-NECL5FCQ.mjs";import"../chunk-4QMXOWHP.mjs";import"../chunk-EF4FA5I6.mjs";import"../chunk-WCMW2L3P.mjs";import"../chunk-WSR5EBJM.mjs";import"../chunk-C3Q23D22.mjs";import"../chunk-QREVMGQZ.mjs";import"../chunk-V3MBJJTL.mjs";import"../chunk-ZP4DWSQA.mjs";import"../chunk-FGFLPH5K.mjs";import"../chunk-WHSTLR3F.mjs";import"../chunk-M3AO73ZL.mjs";import"../chunk-6OWBKU7N.mjs";import"../chunk-AMXZQPUQ.mjs";import"../chunk-YOZBVVKL.mjs";import"../chunk-SJDCGNWU.mjs";import"../chunk-UL777LTI.mjs";import"../chunk-7ECCT6PK.mjs";import"../chunk-4AI7KQQ7.mjs";import"../chunk-7EER7GWV.mjs";import"../chunk-QP2BY4PK.mjs";import"../chunk-HGLO5LDS.mjs";import"../chunk-CW35YAMN.mjs";import"../chunk-6WDVDEQZ.mjs";import"../chunk-RCSJFTST.mjs";import"../chunk-4RXKALLC.mjs";import"../chunk-OLILO7VD.mjs";import"../chunk-7DQDJ2SA.mjs";import"../chunk-HNBVYE3N.mjs";import"../chunk-RGKRCZ36.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-Q4W3WJ2U.mjs";import"../chunk-TOBQ5UE6.mjs";import"../chunk-MT2RJ7H3.mjs";import"../chunk-ORMOQWWH.mjs";import"../chunk-FD6FGKYY.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-MCFQE4GC.mjs";import"../chunk-FLZPUYXQ.mjs";import"../chunk-EBMEXURY.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-56CNRT2K.mjs";import"../chunk-CIJA7ONS.mjs";import"../chunk-KDMSOCZY.mjs";export{g as LOCAL_ANS_ACCOUNT_ADDRESS,f as LOCAL_ANS_ACCOUNT_PK,d as SubdomainExpirationPolicy,a as VALIDATION_RULES_DESCRIPTION,q as getAccountDomains,p as getAccountNames,r as getAccountSubdomains,s as getDomainSubdomains,j as getExpiration,o as getName,h as getOwnerAddress,k as getPrimaryName,m as getTargetAddress,e as isActiveANSName,c as isValidANSName,b as isValidANSSegment,i as registerName,t as renewDomain,l as setPrimaryName,n as setTargetAddress};
1
+ import{AccountAddress as C}from"../core";import{GetNames as A}from"../types/generated/queries";import{Network as p}from"../utils/apiEndpoints";import{queryIndexer as g}from"./general";import{view as l}from"./view";import{generateTransaction as f}from"./transactionSubmission";const D=["A name must be between 3 and 63 characters long,","and can only contain lowercase a-z, 0-9, and hyphens.","A name may not start or end with a hyphen."].join(" ");function E(e){return!(!e||e.length<3||e.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(e))}function c(e){const[t,n,...o]=e.replace(/\.apt$/,"").split(".");if(o.length>0)throw new Error(`${e} is invalid. A name can only have two parts, a domain and a subdomain separated by a "."`);if(!E(t))throw new Error(`${t} is not valid. ${D}`);if(n&&!E(n))throw new Error(`${n} is not valid. ${D}`);return{domainName:n||t,subdomainName:n?t:void 0}}var v=(n=>(n[n.Independent=0]="Independent",n[n.FollowsDomain=1]="FollowsDomain",n))(v||{});function G(e){if(!e)return!1;const t=new Date(e.domain_expiration_timestamp).getTime()<Date.now(),n=new Date(e.expiration_timestamp).getTime()<Date.now();return e.subdomain&&t?!1:e.subdomain&&e.subdomain_expiration_policy===1?!0:!n}const ce="0x37368b46ce665362562c6d1d4ec01a08c8644c488690df5a17e13ba163e20221",O="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",P={[p.TESTNET]:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",[p.MAINNET]:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",[p.LOCAL]:O,[p.CUSTOM]:null,[p.DEVNET]:null,[p.SHELBYNET]:null};function d(e){const t=P[e.network];if(!t)throw new Error(`The ANS contract is not deployed to ${e.network}`);return t}const b=e=>{if(e&&typeof e=="object"&&"vec"in e&&Array.isArray(e.vec))return e.vec[0]};async function me(e){const{aptosConfig:t,name:n}=e,o=d(t),{domainName:r,subdomainName:s}=c(n),i=await l({aptosConfig:t,payload:{function:`${o}::router::get_owner_addr`,functionArguments:[r,s]}}),a=b(i[0]);return a?C.from(a):void 0}async function ue(e){const{aptosConfig:t,expiration:n,name:o,sender:r,targetAddress:s,toAddress:i,options:a,transferable:m}=e,u=d(t),{domainName:y,subdomainName:w}=c(o),S=n.policy==="subdomain:independent"||n.policy==="subdomain:follow-domain";if(w&&!S)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(S&&!w)throw new Error(`Policy is set to ${n.policy} but no subdomain was provided`);if(n.policy==="domain"){const T=n.years??1;if(T!==1)throw new Error("For now, names can only be registered for 1 year at a time");const I=T*31536e3;return await f({aptosConfig:t,sender:r.accountAddress.toString(),data:{function:`${u}::router::register_domain`,functionArguments:[y,I,s,i]},options:a})}if(!w)throw new Error(`${n.policy} requires a subdomain to be provided.`);const _=await q({aptosConfig:t,name:y});if(!_)throw new Error("The domain does not exist");const h=n.policy==="subdomain:independent"?n.expirationDate:_;if(h>_)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await f({aptosConfig:t,sender:r.accountAddress.toString(),data:{function:`${u}::router::register_subdomain`,functionArguments:[y,w,Math.round(h/1e3),n.policy==="subdomain:follow-domain"?1:0,!!m,s,i]},options:a})}async function q(e){const{aptosConfig:t,name:n}=e,o=d(t),{domainName:r,subdomainName:s}=c(n);try{const i=await l({aptosConfig:t,payload:{function:`${o}::router::get_expiration`,functionArguments:[r,s]}});return Number(i[0])*1e3}catch{return}}async function pe(e){const{aptosConfig:t,address:n}=e,o=d(t),r=await l({aptosConfig:t,payload:{function:`${o}::router::get_primary_name`,functionArguments:[C.from(n).toString()]}}),s=b(r[1]),i=b(r[0]);if(s)return[i,s].filter(Boolean).join(".")}async function fe(e){const{aptosConfig:t,sender:n,name:o,options:r}=e,s=d(t);if(!o)return await f({aptosConfig:t,sender:n.accountAddress.toString(),data:{function:`${s}::router::clear_primary_name`,functionArguments:[]},options:r});const{domainName:i,subdomainName:a}=c(o);return await f({aptosConfig:t,sender:n.accountAddress.toString(),data:{function:`${s}::router::set_primary_name`,functionArguments:[i,a]},options:r})}async function Ae(e){const{aptosConfig:t,name:n}=e,o=d(t),{domainName:r,subdomainName:s}=c(n),i=await l({aptosConfig:t,payload:{function:`${o}::router::get_target_addr`,functionArguments:[r,s]}}),a=b(i[0]);return a?C.from(a):void 0}async function ge(e){const{aptosConfig:t,sender:n,name:o,address:r,options:s}=e,i=d(t),{domainName:a,subdomainName:m}=c(o);return await f({aptosConfig:t,sender:n.accountAddress.toString(),data:{function:`${i}::router::set_target_addr`,functionArguments:[a,m,r]},options:s})}async function le(e){const{aptosConfig:t,name:n}=e,{domainName:o,subdomainName:r=""}=c(n);let a=(await g({aptosConfig:t,query:{query:A,variables:{where_condition:{domain:{_eq:o},subdomain:{_eq:r}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=N(a)),G(a)?a:void 0}async function Ne(e){const{aptosConfig:t,options:n,accountAddress:o}=e,r=await x({aptosConfig:t});return(await g({aptosConfig:t,originMethod:"getAccountNames",query:{query:A,variables:{limit:n?.limit,offset:n?.offset,order_by:n?.orderBy,where_condition:{...e.options?.where??{},owner_address:{_eq:o.toString()},expiration_timestamp:{_gte:r}}}}})).current_aptos_names.map(N)}async function ye(e){const{aptosConfig:t,options:n,accountAddress:o}=e,r=await x({aptosConfig:t});return(await g({aptosConfig:t,originMethod:"getAccountDomains",query:{query:A,variables:{limit:n?.limit,offset:n?.offset,order_by:n?.orderBy,where_condition:{...e.options?.where??{},owner_address:{_eq:o.toString()},expiration_timestamp:{_gte:r},subdomain:{_eq:""}}}}})).current_aptos_names.map(N)}async function we(e){const{aptosConfig:t,options:n,accountAddress:o}=e,r=await x({aptosConfig:t});return(await g({aptosConfig:t,originMethod:"getAccountSubdomains",query:{query:A,variables:{limit:n?.limit,offset:n?.offset,order_by:n?.orderBy,where_condition:{...e.options?.where??{},owner_address:{_eq:o.toString()},expiration_timestamp:{_gte:r},subdomain:{_neq:""}}}}})).current_aptos_names.map(N)}async function be(e){const{aptosConfig:t,options:n,domain:o}=e;return(await g({aptosConfig:t,originMethod:"getDomainSubdomains",query:{query:A,variables:{limit:n?.limit,offset:n?.offset,order_by:n?.orderBy,where_condition:{...e.options?.where??{},domain:{_eq:o},subdomain:{_neq:""}}}}})).current_aptos_names.map(N).filter(G)}async function x(e){const{aptosConfig:t}=e,n=d(t),[o]=await l({aptosConfig:t,payload:{function:`${n}::config::reregistration_grace_sec`,functionArguments:[]}}),r=o/60/60/24,s=()=>new Date;return new Date(s().setDate(s().getDate()-r)).toISOString()}async function _e(e){const{aptosConfig:t,sender:n,name:o,years:r=1,options:s}=e,i=d(t),a=r*31536e3,{domainName:m,subdomainName:u}=c(o);if(u)throw new Error("Subdomains cannot be renewed");if(r!==1)throw new Error("Currently, only 1 year renewals are supported");return await f({aptosConfig:t,sender:n.accountAddress.toString(),data:{function:`${i}::router::renew_domain`,functionArguments:[m,a]},options:s})}function N(e){return{...e,expiration_timestamp:new Date(e.expiration_timestamp).getTime()}}export{O as LOCAL_ANS_ACCOUNT_ADDRESS,ce as LOCAL_ANS_ACCOUNT_PK,v as SubdomainExpirationPolicy,D as VALIDATION_RULES_DESCRIPTION,ye as getAccountDomains,Ne as getAccountNames,we as getAccountSubdomains,be as getDomainSubdomains,q as getExpiration,le as getName,me as getOwnerAddress,pe as getPrimaryName,Ae as getTargetAddress,G as isActiveANSName,c as isValidANSName,E as isValidANSSegment,ue as registerName,_e as renewDomain,fe as setPrimaryName,ge as setTargetAddress};
2
2
  //# sourceMappingURL=ans.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"sources":["../../../src/internal/ans.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file contains the underlying implementations for exposed API surface in\n * the {@link api/name}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * name namespace and without having a dependency cycle error.\n * @group Implementation\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { Account } from \"../account\";\nimport { AccountAddress, AccountAddressInput } from \"../core\";\nimport { InputGenerateTransactionOptions } from \"../transactions/types\";\nimport { GetANSNameResponse, MoveAddressType, OrderByArg, PaginationArgs, WhereArg } from \"../types\";\nimport { GetNamesQuery } from \"../types/generated/operations\";\nimport { GetNames } from \"../types/generated/queries\";\nimport { CurrentAptosNamesBoolExp } from \"../types/generated/types\";\nimport { Network } from \"../utils/apiEndpoints\";\nimport { queryIndexer } from \"./general\";\nimport { view } from \"./view\";\nimport { generateTransaction } from \"./transactionSubmission\";\nimport { SimpleTransaction } from \"../transactions/instances/simpleTransaction\";\n\nexport const VALIDATION_RULES_DESCRIPTION = [\n \"A name must be between 3 and 63 characters long,\",\n \"and can only contain lowercase a-z, 0-9, and hyphens.\",\n \"A name may not start or end with a hyphen.\",\n].join(\" \");\n\n/**\n * Validate if a given fragment is a valid ANS segment.\n * This function checks the length and character constraints of the fragment to ensure it meets the ANS standards.\n *\n * @param fragment - A fragment of a name, either the domain or subdomain.\n * @returns A boolean indicating if the fragment is a valid fragment.\n * @group Implementation\n */\nexport function isValidANSSegment(fragment: string): boolean {\n if (!fragment) return false;\n if (fragment.length < 3) return false;\n if (fragment.length > 63) return false;\n // only lowercase a-z and 0-9 are allowed, along with -. a domain may not start or end with a hyphen\n if (!/^[a-z\\d][a-z\\d-]{1,61}[a-z\\d]$/.test(fragment)) return false;\n return true;\n}\n\n/**\n * Checks if an ANS name is valid or not.\n *\n * @param name - A string of the domain name, which can include or exclude the .apt suffix.\n * @group Implementation\n */\nexport function isValidANSName(name: string): { domainName: string; subdomainName?: string } {\n const [first, second, ...rest] = name.replace(/\\.apt$/, \"\").split(\".\");\n\n if (rest.length > 0) {\n throw new Error(`${name} is invalid. A name can only have two parts, a domain and a subdomain separated by a \".\"`);\n }\n\n if (!isValidANSSegment(first)) {\n throw new Error(`${first} is not valid. ${VALIDATION_RULES_DESCRIPTION}`);\n }\n\n if (second && !isValidANSSegment(second)) {\n throw new Error(`${second} is not valid. ${VALIDATION_RULES_DESCRIPTION}`);\n }\n\n return {\n domainName: second || first,\n subdomainName: second ? first : undefined,\n };\n}\n\n/**\n * Policy for determining how subdomains expire in relation to their parent domain.\n * @group Implementation\n */\nexport enum SubdomainExpirationPolicy {\n Independent = 0,\n FollowsDomain = 1,\n}\n\n/**\n * Determine if a given ANS name is considered active based on its expiration dates.\n * Domains are active if their expiration date is in the future, while subdomains may\n * follow their parent's expiration policy (1) or expire independently (0).\n * If the subdomain is expiring independently, it can expire before their parent, but not after.\n *\n * @param name - An ANS name returned from one of the functions of the SDK.\n * @returns A boolean indicating whether the contract considers the name active or not.\n * @group Implementation\n */\nexport function isActiveANSName(name: GetANSNameResponse[0]): boolean {\n if (!name) return false;\n\n const isTLDExpired = new Date(name.domain_expiration_timestamp).getTime() < Date.now();\n const isExpired = new Date(name.expiration_timestamp).getTime() < Date.now();\n\n // If we are a subdomain, if our parent is expired we are always expired\n if (name.subdomain && isTLDExpired) return false;\n\n // If we are a subdomain and our expiration policy is to follow the domain, we\n // are active (since we know our parent is not expired by this point)\n if (name.subdomain && name.subdomain_expiration_policy === SubdomainExpirationPolicy.FollowsDomain) return true;\n\n // At this point, we are either a TLD or a subdomain with an independent\n // expiration policy, we are active as long as we the expiration timestamp\n return !isExpired;\n}\n\nexport const LOCAL_ANS_ACCOUNT_PK =\n process.env.ANS_TEST_ACCOUNT_PRIVATE_KEY ??\n \"ed25519-priv-0x37368b46ce665362562c6d1d4ec01a08c8644c488690df5a17e13ba163e20221\";\nexport const LOCAL_ANS_ACCOUNT_ADDRESS =\n process.env.ANS_TEST_ACCOUNT_ADDRESS ?? \"0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82\";\n\nconst NetworkToAnsContract: Record<Network, string | null> = {\n [Network.TESTNET]: \"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c\",\n [Network.MAINNET]: \"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c\",\n [Network.LOCAL]: LOCAL_ANS_ACCOUNT_ADDRESS,\n [Network.CUSTOM]: null,\n [Network.DEVNET]: null,\n [Network.SHELBYNET]: null,\n};\n\n/**\n * Retrieves the address of the ANS contract based on the specified Aptos network configuration.\n *\n * @param aptosConfig - The configuration object for the Aptos network.\n * @param aptosConfig.network - The network for which to retrieve the ANS contract address.\n *\n * @throws Throws an error if the ANS contract is not deployed to the specified network.\n * @group Implementation\n */\nfunction getRouterAddress(aptosConfig: AptosConfig): string {\n const address = NetworkToAnsContract[aptosConfig.network];\n if (!address) throw new Error(`The ANS contract is not deployed to ${aptosConfig.network}`);\n return address;\n}\n\nconst unwrapOption = <T>(option: any): T | undefined => {\n if (!!option && typeof option === \"object\" && \"vec\" in option && Array.isArray(option.vec)) {\n return option.vec[0];\n }\n\n return undefined;\n};\n\n/**\n * Retrieve the owner address of a specified domain or subdomain.\n *\n * @param args - The arguments for retrieving the owner address.\n * @param args.aptosConfig - The Aptos configuration object.\n * @param args.name - The name of the domain or subdomain to query.\n * @returns The account address of the owner, or undefined if not found.\n * @group Implementation\n */\nexport async function getOwnerAddress(args: {\n aptosConfig: AptosConfig;\n name: string;\n}): Promise<AccountAddress | undefined> {\n const { aptosConfig, name } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n const { domainName, subdomainName } = isValidANSName(name);\n\n const res = await view({\n aptosConfig,\n payload: {\n function: `${routerAddress}::router::get_owner_addr`,\n functionArguments: [domainName, subdomainName],\n },\n });\n\n const owner = unwrapOption<MoveAddressType>(res[0]);\n\n return owner ? AccountAddress.from(owner) : undefined;\n}\n\n/**\n * Parameters for registering a name in the Aptos network.\n *\n * @param aptosConfig - Configuration settings for the Aptos network.\n * @param sender - The account initiating the name registration.\n * @param name - The name to be registered.\n * @param expiration - The expiration policy for the name registration.\n * @param transferable - Whether the name can be transferred to another owner.\n * @param toAddress - The address that will be set as the owner_address of the name.\n * @param targetAddress - The address that this name will resolve to.\n * @group Implementation\n */\nexport interface RegisterNameParameters {\n aptosConfig: AptosConfig;\n sender: Account;\n name: string;\n expiration:\n | { policy: \"domain\"; years?: 1 }\n | { policy: \"subdomain:follow-domain\" }\n | { policy: \"subdomain:independent\"; expirationDate: number };\n transferable?: boolean;\n toAddress?: AccountAddressInput;\n targetAddress?: AccountAddressInput;\n options?: InputGenerateTransactionOptions;\n}\n\n/**\n * Registers a domain or subdomain with the specified parameters. This function ensures that the provided names and expiration\n * policies are valid before proceeding with the registration process.\n *\n * @param args - The parameters required for registering a name.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.expiration - The expiration details for the registration.\n * @param args.name - The name to be registered, which can be a domain or subdomain.\n * @param args.sender - The account details of the sender initiating the registration.\n * @param args.targetAddress - The target address for the registration, which is the address the name will resolve to.\n * @param args.toAddress - The address that will be set as the owner_address in records, defaults to sender if not provided.\n * @param args.options - Additional options for the registration process.\n * @param args.transferable - Indicates whether the registered name is transferable to another account.\n *\n * @throws Error if the provided expiration policy is invalid for subdomains.\n * @throws Error if the domain does not exist.\n * @throws Error if the subdomain expiration time exceeds the domain expiration time.\n *\n * @returns A transaction object representing the registration process.\n * @group Implementation\n */\nexport async function registerName(args: RegisterNameParameters): Promise<SimpleTransaction> {\n const { aptosConfig, expiration, name, sender, targetAddress, toAddress, options, transferable } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n const { domainName, subdomainName } = isValidANSName(name);\n\n const hasSubdomainPolicy =\n expiration.policy === \"subdomain:independent\" || expiration.policy === \"subdomain:follow-domain\";\n\n if (subdomainName && !hasSubdomainPolicy) {\n throw new Error(\n \"Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'\",\n );\n }\n\n if (hasSubdomainPolicy && !subdomainName) {\n throw new Error(`Policy is set to ${expiration.policy} but no subdomain was provided`);\n }\n\n if (expiration.policy === \"domain\") {\n const years = expiration.years ?? 1;\n if (years !== 1) {\n throw new Error(\"For now, names can only be registered for 1 year at a time\");\n }\n\n const secondsInYear = 31536000;\n const registrationDuration = years * secondsInYear;\n\n const transaction = await generateTransaction({\n aptosConfig,\n sender: sender.accountAddress.toString(),\n data: {\n function: `${routerAddress}::router::register_domain`,\n functionArguments: [domainName, registrationDuration, targetAddress, toAddress],\n },\n options,\n });\n\n return transaction;\n }\n\n // We are a subdomain\n if (!subdomainName) {\n throw new Error(`${expiration.policy} requires a subdomain to be provided.`);\n }\n\n const tldExpiration = await getExpiration({ aptosConfig, name: domainName });\n if (!tldExpiration) {\n throw new Error(\"The domain does not exist\");\n }\n\n const expirationDateInMillisecondsSinceEpoch =\n expiration.policy === \"subdomain:independent\" ? expiration.expirationDate : tldExpiration;\n\n if (expirationDateInMillisecondsSinceEpoch > tldExpiration) {\n throw new Error(\"The subdomain expiration time cannot be greater than the domain expiration time\");\n }\n\n const transaction = await generateTransaction({\n aptosConfig,\n sender: sender.accountAddress.toString(),\n data: {\n function: `${routerAddress}::router::register_subdomain`,\n functionArguments: [\n domainName,\n subdomainName,\n Math.round(expirationDateInMillisecondsSinceEpoch / 1000),\n expiration.policy === \"subdomain:follow-domain\" ? 1 : 0,\n !!transferable,\n targetAddress,\n toAddress,\n ],\n },\n options,\n });\n\n return transaction;\n}\n\n/**\n * Retrieves the expiration time of a specified domain or subdomain in epoch milliseconds.\n *\n * @param args - The arguments for the function.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.name - The name of the domain or subdomain to check.\n * @returns The expiration time in epoch milliseconds, or undefined if an error occurs.\n * @group Implementation\n */\nexport async function getExpiration(args: { aptosConfig: AptosConfig; name: string }): Promise<number | undefined> {\n const { aptosConfig, name } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n const { domainName, subdomainName } = isValidANSName(name);\n\n try {\n const res = await view({\n aptosConfig,\n payload: {\n function: `${routerAddress}::router::get_expiration`,\n functionArguments: [domainName, subdomainName],\n },\n });\n\n // Normalize expiration time from epoch seconds to epoch milliseconds\n return Number(res[0]) * 1000;\n } catch (e) {\n return undefined;\n }\n}\n\n/**\n * Retrieves the primary name associated with a given account address.\n * This function helps in obtaining the complete domain name by combining the subdomain and domain names.\n *\n * @param args - The arguments for retrieving the primary name.\n * @param args.aptosConfig - The Aptos configuration object.\n * @param args.address - The account address for which to retrieve the primary name.\n * @returns The primary name as a string, or undefined if no domain name exists.\n * @group Implementation\n */\nexport async function getPrimaryName(args: {\n aptosConfig: AptosConfig;\n address: AccountAddressInput;\n}): Promise<string | undefined> {\n const { aptosConfig, address } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n\n const res = await view({\n aptosConfig,\n payload: {\n function: `${routerAddress}::router::get_primary_name`,\n functionArguments: [AccountAddress.from(address).toString()],\n },\n });\n\n const domainName = unwrapOption<MoveAddressType>(res[1]);\n const subdomainName = unwrapOption<MoveAddressType>(res[0]);\n\n if (!domainName) return undefined;\n\n return [subdomainName, domainName].filter(Boolean).join(\".\");\n}\n\n/**\n * Sets the primary name for the specified account, allowing for the association of a domain or subdomain with the account.\n * If no name is provided, it clears the existing primary name.\n *\n * @param args - The arguments for setting the primary name.\n * @param args.aptosConfig - The Aptos configuration object.\n * @param args.sender - The account that is sending the transaction.\n * @param args.name - The name to set as the primary name. If omitted, the function will clear the primary name.\n * @param args.options - Optional transaction generation options.\n * @returns A transaction object representing the operation.\n * @group Implementation\n */\nexport async function setPrimaryName(args: {\n aptosConfig: AptosConfig;\n sender: Account;\n name?: string;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, sender, name, options } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n\n if (!name) {\n const transaction = await generateTransaction({\n aptosConfig,\n sender: sender.accountAddress.toString(),\n data: {\n function: `${routerAddress}::router::clear_primary_name`,\n functionArguments: [],\n },\n options,\n });\n\n return transaction;\n }\n\n const { domainName, subdomainName } = isValidANSName(name);\n\n const transaction = await generateTransaction({\n aptosConfig,\n sender: sender.accountAddress.toString(),\n data: {\n function: `${routerAddress}::router::set_primary_name`,\n functionArguments: [domainName, subdomainName],\n },\n options,\n });\n\n return transaction;\n}\n\n/**\n * Retrieves the target address associated with a given domain name and subdomain name.\n * The target address is different from the owner address - it's the address this name\n * resolves to, which may be different from who owns the name.\n *\n * @param args - The arguments for retrieving the target address.\n * @param args.aptosConfig - The Aptos configuration object.\n * @param args.name - The name of the domain, which may include a subdomain.\n * @returns The target address as an AccountAddress, or undefined if not found.\n * @group Implementation\n */\nexport async function getTargetAddress(args: {\n aptosConfig: AptosConfig;\n name: string;\n}): Promise<AccountAddress | undefined> {\n const { aptosConfig, name } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n const { domainName, subdomainName } = isValidANSName(name);\n\n const res = await view({\n aptosConfig,\n payload: {\n function: `${routerAddress}::router::get_target_addr`,\n functionArguments: [domainName, subdomainName],\n },\n });\n\n const target = unwrapOption<MoveAddressType>(res[0]);\n return target ? AccountAddress.from(target) : undefined;\n}\n\n/**\n * Sets the target address for a specified domain and subdomain in the Aptos network.\n * This function helps to associate a given address with a domain name, allowing for easier access and management of resources.\n *\n * @param args - The arguments for setting the target address.\n * @param args.aptosConfig - The configuration settings for the Aptos network.\n * @param args.sender - The account that is sending the transaction.\n * @param args.name - The name of the domain or subdomain to be set.\n * @param args.address - The address to be associated with the domain or subdomain.\n * @param args.options - Optional parameters for generating the transaction.\n *\n * @returns A transaction object representing the set target address operation.\n * @group Implementation\n */\nexport async function setTargetAddress(args: {\n aptosConfig: AptosConfig;\n sender: Account;\n name: string;\n address: AccountAddressInput;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, sender, name, address, options } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n const { domainName, subdomainName } = isValidANSName(name);\n\n const transaction = await generateTransaction({\n aptosConfig,\n sender: sender.accountAddress.toString(),\n data: {\n function: `${routerAddress}::router::set_target_addr`,\n functionArguments: [domainName, subdomainName, address],\n },\n options,\n });\n\n return transaction;\n}\n\n/**\n * Retrieves the active Aptos name associated with the specified domain and subdomain.\n *\n * @param args - The parameters for the function.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.name - The name to look up, which includes the domain and optional subdomain.\n * @returns The active Aptos name if it exists; otherwise, returns undefined.\n * @group Implementation\n */\nexport async function getName(args: {\n aptosConfig: AptosConfig;\n name: string;\n}): Promise<GetANSNameResponse[0] | undefined> {\n const { aptosConfig, name } = args;\n const { domainName, subdomainName = \"\" } = isValidANSName(name);\n\n const where: CurrentAptosNamesBoolExp = {\n domain: { _eq: domainName },\n subdomain: { _eq: subdomainName },\n };\n\n const data = await queryIndexer<GetNamesQuery>({\n aptosConfig,\n query: {\n query: GetNames,\n variables: {\n where_condition: where,\n limit: 1,\n },\n },\n originMethod: \"getName\",\n });\n\n // Convert the expiration_timestamp from an ISO string to milliseconds since epoch\n let res = data.current_aptos_names[0];\n if (res) {\n res = sanitizeANSName(res);\n }\n\n return isActiveANSName(res) ? res : undefined;\n}\n\n/**\n * Options for querying names, including pagination, ordering, and filtering criteria.\n *\n * @param options - Pagination and filtering options for the query.\n * @group Implementation\n */\ninterface QueryNamesOptions {\n options?: PaginationArgs & OrderByArg<GetANSNameResponse[0]> & WhereArg<CurrentAptosNamesBoolExp>;\n}\n\n/**\n * Arguments for retrieving account names based on the specified account address.\n *\n * @param accountAddress - The address of the account for which names are to be retrieved.\n * @group Implementation\n */\nexport interface GetAccountNamesArgs extends QueryNamesOptions {\n accountAddress: AccountAddressInput;\n}\n\n/**\n * Retrieves all the current Aptos names owned by an account. This uses the\n * owner_address field, not the registered_address field.\n *\n * @param args - The arguments for retrieving account names.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.options - Optional parameters for querying account names.\n * @param args.options.limit - The maximum number of names to retrieve.\n * @param args.options.offset - The number of names to skip before starting to collect the result set.\n * @param args.options.orderBy - The field by which to order the results.\n * @param args.options.where - Additional conditions to filter the results.\n * @param args.accountAddress - The address of the account for which to retrieve names.\n *\n * @returns An array of sanitized Aptos names associated with the specified account address.\n * @group Implementation\n */\nexport async function getAccountNames(\n args: { aptosConfig: AptosConfig } & GetAccountNamesArgs,\n): Promise<GetANSNameResponse> {\n const { aptosConfig, options, accountAddress } = args;\n\n const expirationDate = await getANSExpirationDate({ aptosConfig });\n\n const data = await queryIndexer<GetNamesQuery>({\n aptosConfig,\n originMethod: \"getAccountNames\",\n query: {\n query: GetNames,\n variables: {\n limit: options?.limit,\n offset: options?.offset,\n order_by: options?.orderBy,\n where_condition: {\n ...(args.options?.where ?? {}),\n owner_address: { _eq: accountAddress.toString() },\n expiration_timestamp: { _gte: expirationDate },\n },\n },\n },\n });\n\n return data.current_aptos_names.map(sanitizeANSName);\n}\n\n/**\n * Arguments for retrieving the domains associated with a specific account.\n *\n * @param accountAddress - The address of the account for which to fetch domains.\n * @group Implementation\n */\nexport interface GetAccountDomainsArgs extends QueryNamesOptions {\n accountAddress: AccountAddressInput;\n}\n\n/**\n * Retrieves the list of top-level domains owned by a specified account,\n * using the owner_address field.\n *\n * @param args - The arguments for retrieving account domains.\n * @param args.aptosConfig - The Aptos configuration object.\n * @param args.options - Optional parameters for the query.\n * @param args.options.limit - The maximum number of results to return.\n * @param args.options.offset - The number of results to skip before starting to collect the result set.\n * @param args.options.orderBy - The field by which to order the results.\n * @param args.options.where - Additional conditions to filter the results.\n * @param args.options.where.owner_address - The address of the account whose domains are being queried.\n * @param args.options.where.expiration_timestamp - The minimum expiration timestamp for the domains.\n * @param args.options.where.subdomain - The specific subdomain to filter by.\n *\n * @returns An array of sanitized domain names owned by the specified account.\n * @group Implementation\n */\nexport async function getAccountDomains(\n args: { aptosConfig: AptosConfig } & GetAccountDomainsArgs,\n): Promise<GetANSNameResponse> {\n const { aptosConfig, options, accountAddress } = args;\n\n const expirationDate = await getANSExpirationDate({ aptosConfig });\n\n const data = await queryIndexer<GetNamesQuery>({\n aptosConfig,\n originMethod: \"getAccountDomains\",\n query: {\n query: GetNames,\n variables: {\n limit: options?.limit,\n offset: options?.offset,\n order_by: options?.orderBy,\n where_condition: {\n ...(args.options?.where ?? {}),\n owner_address: { _eq: accountAddress.toString() },\n expiration_timestamp: { _gte: expirationDate },\n subdomain: { _eq: \"\" },\n },\n },\n },\n });\n\n return data.current_aptos_names.map(sanitizeANSName);\n}\n\n/**\n * Arguments for retrieving subdomains associated with a specific account.\n *\n * @param accountAddress - The address of the account for which to fetch subdomains.\n * @group Implementation\n */\nexport interface GetAccountSubdomainsArgs extends QueryNamesOptions {\n accountAddress: AccountAddressInput;\n}\n\n/**\n * Retrieves a list of subdomains owned by a specified account address, determined\n * by the owner_address field.\n *\n * @param args - The arguments for retrieving account subdomains.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.options - Optional parameters for the query.\n * @param args.options.limit - The maximum number of results to return.\n * @param args.options.offset - The number of results to skip before starting to collect the result set.\n * @param args.options.orderBy - The field by which to order the results.\n * @param args.options.where - Additional conditions to filter the results.\n * @param args.options.where.owner_address - The address of the account to filter by.\n * @param args.options.where.expiration_timestamp - The expiration timestamp to filter by.\n * @param args.options.where.subdomain - The subdomain condition to filter by.\n * @param args.accountAddress - The address of the account whose subdomains are being queried.\n * @group Implementation\n */\nexport async function getAccountSubdomains(\n args: { aptosConfig: AptosConfig } & GetAccountSubdomainsArgs,\n): Promise<GetANSNameResponse> {\n const { aptosConfig, options, accountAddress } = args;\n\n const expirationDate = await getANSExpirationDate({ aptosConfig });\n\n const data = await queryIndexer<GetNamesQuery>({\n aptosConfig,\n originMethod: \"getAccountSubdomains\",\n query: {\n query: GetNames,\n variables: {\n limit: options?.limit,\n offset: options?.offset,\n order_by: options?.orderBy,\n where_condition: {\n ...(args.options?.where ?? {}),\n owner_address: { _eq: accountAddress.toString() },\n expiration_timestamp: { _gte: expirationDate },\n subdomain: { _neq: \"\" },\n },\n },\n },\n });\n\n return data.current_aptos_names.map(sanitizeANSName);\n}\n\n/**\n * Arguments for retrieving subdomains associated with a specific domain.\n *\n * @param domain - The domain for which to fetch subdomains.\n * @group Implementation\n */\nexport interface GetDomainSubdomainsArgs extends QueryNamesOptions {\n domain: string;\n}\n\n/**\n * Retrieve the active subdomains associated with a specified domain,\n * regardless of who is in possession of the domain.\n *\n * This function queries by domain name only, not by owner, so it will return\n * all subdomains of a domain even if they're owned by different accounts.\n *\n * @param args - The arguments for retrieving subdomains.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.options - Optional parameters for the query.\n * @param args.options.limit - The maximum number of results to return.\n * @param args.options.offset - The number of results to skip before starting to collect the results.\n * @param args.options.orderBy - The field by which to order the results.\n * @param args.options.where - Additional conditions to filter the results.\n * @param args.domain - The domain for which to retrieve subdomains.\n *\n * @returns An array of active subdomain names.\n * @group Implementation\n */\nexport async function getDomainSubdomains(\n args: { aptosConfig: AptosConfig } & GetDomainSubdomainsArgs,\n): Promise<GetANSNameResponse> {\n const { aptosConfig, options, domain } = args;\n\n const data = await queryIndexer<GetNamesQuery>({\n aptosConfig,\n originMethod: \"getDomainSubdomains\",\n query: {\n query: GetNames,\n variables: {\n limit: options?.limit,\n offset: options?.offset,\n order_by: options?.orderBy,\n where_condition: {\n ...(args.options?.where ?? {}),\n domain: { _eq: domain },\n subdomain: { _neq: \"\" },\n },\n },\n },\n });\n\n return data.current_aptos_names.map(sanitizeANSName).filter(isActiveANSName);\n}\n\n/**\n * This function returns the expiration date in which a name is fully expired as\n * defined by the contract. The grace period allows for names to be past\n * expiration for a certain amount of time before they are released to the\n * public. The names will not function as normal, but the owner can renew\n * without others taking ownership of the name. At the time of writing, the\n * contract specified 30 days.\n *\n * @param args - The arguments for the function.\n * @param args.aptosConfig - An AptosConfig object containing the configuration settings.\n * @returns The expiration date in ISO 8601 format.\n * @group Implementation\n */\nasync function getANSExpirationDate(args: { aptosConfig: AptosConfig }): Promise<string> {\n const { aptosConfig } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n\n const [gracePeriodInSeconds] = await view<[number]>({\n aptosConfig,\n payload: {\n function: `${routerAddress}::config::reregistration_grace_sec`,\n functionArguments: [],\n },\n });\n\n const gracePeriodInDays = gracePeriodInSeconds / 60 / 60 / 24;\n const now = () => new Date();\n return new Date(now().setDate(now().getDate() - gracePeriodInDays)).toISOString();\n}\n\n/**\n * Renews a domain for a specified duration. This function allows you to extend the registration of a domain for one year.\n *\n * @param args - The parameters required to renew the domain.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.sender - The account that is sending the renewal transaction.\n * @param args.name - The name of the domain to renew.\n * @param args.years - The number of years to renew the domain for. Currently, only 1 year renewals are supported. (optional, default is 1)\n * @param args.options - Additional options for generating the transaction. (optional)\n * @throws Error if the name contains a subdomain or if the years parameter is not equal to 1.\n * @group Implementation\n */\nexport async function renewDomain(args: {\n aptosConfig: AptosConfig;\n sender: Account;\n name: string;\n years?: 1;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, sender, name, years = 1, options } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n const renewalDuration = years * 31536000;\n const { domainName, subdomainName } = isValidANSName(name);\n\n if (subdomainName) {\n throw new Error(\"Subdomains cannot be renewed\");\n }\n\n if (years !== 1) {\n throw new Error(\"Currently, only 1 year renewals are supported\");\n }\n\n const transaction = await generateTransaction({\n aptosConfig,\n sender: sender.accountAddress.toString(),\n data: {\n function: `${routerAddress}::router::renew_domain`,\n functionArguments: [domainName, renewalDuration],\n },\n options,\n });\n\n return transaction;\n}\n\n/**\n * The indexer returns ISO strings for expiration, however the contract works in\n * epoch milliseconds. This function converts the ISO string to epoch\n * milliseconds. In the future, if other properties need sanitization, this can\n * be extended.\n *\n * @param name - The ANS name response to sanitize.\n * @param name.expiration_timestamp - The expiration timestamp in ISO string format.\n * @group Implementation\n */\nfunction sanitizeANSName(name: GetANSNameResponse[0]): GetANSNameResponse[0] {\n return {\n ...name,\n expiration_timestamp: new Date(name.expiration_timestamp).getTime(),\n };\n}\n"],"mappings":"AAaA,OAAS,kBAAAA,MAA2C,UAIpD,OAAS,YAAAC,MAAgB,6BAEzB,OAAS,WAAAC,MAAe,wBACxB,OAAS,gBAAAC,MAAoB,YAC7B,OAAS,QAAAC,MAAY,SACrB,OAAS,uBAAAC,MAA2B,0BAG7B,MAAMC,EAA+B,CAC1C,mDACA,wDACA,4CACF,EAAE,KAAK,GAAG,EAUH,SAASC,EAAkBC,EAA2B,CAK3D,MAJI,GAACA,GACDA,EAAS,OAAS,GAClBA,EAAS,OAAS,IAElB,CAAC,iCAAiC,KAAKA,CAAQ,EAErD,CAQO,SAASC,EAAeC,EAA8D,CAC3F,KAAM,CAACC,EAAOC,EAAQ,GAAGC,CAAI,EAAIH,EAAK,QAAQ,SAAU,EAAE,EAAE,MAAM,GAAG,EAErE,GAAIG,EAAK,OAAS,EAChB,MAAM,IAAI,MAAM,GAAGH,CAAI,0FAA0F,EAGnH,GAAI,CAACH,EAAkBI,CAAK,EAC1B,MAAM,IAAI,MAAM,GAAGA,CAAK,kBAAkBL,CAA4B,EAAE,EAG1E,GAAIM,GAAU,CAACL,EAAkBK,CAAM,EACrC,MAAM,IAAI,MAAM,GAAGA,CAAM,kBAAkBN,CAA4B,EAAE,EAG3E,MAAO,CACL,WAAYM,GAAUD,EACtB,cAAeC,EAASD,EAAQ,MAClC,CACF,CAMO,IAAKG,OACVA,IAAA,YAAc,GAAd,cACAA,IAAA,cAAgB,GAAhB,gBAFUA,OAAA,IAeL,SAASC,EAAgBL,EAAsC,CACpE,GAAI,CAACA,EAAM,MAAO,GAElB,MAAMM,EAAe,IAAI,KAAKN,EAAK,2BAA2B,EAAE,QAAQ,EAAI,KAAK,IAAI,EAC/EO,EAAY,IAAI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,CAAa,qCAC1B,kBAAmB,CAAC,CACtB,CACF,CAAC,EAEKkC,EAAoBD,EAAuB,GAAK,GAAK,GACrDE,EAAM,IAAM,IAAI,KACtB,OAAO,IAAI,KAAKA,EAAI,EAAE,QAAQA,EAAI,EAAE,QAAQ,EAAID,CAAiB,CAAC,EAAE,YAAY,CAClF,CAcA,eAAsBE,GAAYrC,EAMH,CAC7B,KAAM,CAAE,YAAAL,EAAa,OAAAa,EAAQ,KAAAzB,EAAM,MAAA+B,EAAQ,EAAG,QAAAH,CAAQ,EAAIX,EACpDC,EAAgBP,EAAiBC,CAAW,EAC5C2C,EAAkBxB,EAAQ,QAC1B,CAAE,WAAAZ,EAAY,cAAAC,CAAc,EAAIrB,EAAeC,CAAI,EAEzD,GAAIoB,EACF,MAAM,IAAI,MAAM,8BAA8B,EAGhD,GAAIW,IAAU,EACZ,MAAM,IAAI,MAAM,+CAA+C,EAajE,OAVoB,MAAMpC,EAAoB,CAC5C,YAAAiB,EACA,OAAQa,EAAO,eAAe,SAAS,EACvC,KAAM,CACJ,SAAU,GAAGP,CAAa,yBAC1B,kBAAmB,CAACC,EAAYoC,CAAe,CACjD,EACA,QAAA3B,CACF,CAAC,CAGH,CAYA,SAASc,EAAgB1C,EAAoD,CAC3E,MAAO,CACL,GAAGA,EACH,qBAAsB,IAAI,KAAKA,EAAK,oBAAoB,EAAE,QAAQ,CACpE,CACF","names":["AccountAddress","GetNames","Network","queryIndexer","view","generateTransaction","VALIDATION_RULES_DESCRIPTION","isValidANSSegment","fragment","isValidANSName","name","first","second","rest","SubdomainExpirationPolicy","isActiveANSName","isTLDExpired","isExpired","LOCAL_ANS_ACCOUNT_PK","LOCAL_ANS_ACCOUNT_ADDRESS","NetworkToAnsContract","getRouterAddress","aptosConfig","address","unwrapOption","option","getOwnerAddress","args","routerAddress","domainName","subdomainName","res","owner","registerName","expiration","sender","targetAddress","toAddress","options","transferable","hasSubdomainPolicy","years","registrationDuration","tldExpiration","getExpiration","expirationDateInMillisecondsSinceEpoch","getPrimaryName","setPrimaryName","getTargetAddress","target","setTargetAddress","getName","sanitizeANSName","getAccountNames","accountAddress","expirationDate","getANSExpirationDate","getAccountDomains","getAccountSubdomains","getDomainSubdomains","domain","gracePeriodInSeconds","gracePeriodInDays","now","renewDomain","renewalDuration"]}
@@ -1,2 +1,2 @@
1
- import{Xc as a}from"../chunk-L72TIN7T.mjs";import"../chunk-2XQKGWHQ.mjs";import"../chunk-UYVPNUH3.mjs";import"../chunk-XKUIMGKU.mjs";import"../chunk-N6YTF76Q.mjs";import"../chunk-A5L76YP7.mjs";import"../chunk-I7XT6L7S.mjs";import"../chunk-5HXLZHDW.mjs";import"../chunk-G3MHXDYA.mjs";import"../chunk-JABP65XD.mjs";import"../chunk-GOXRBEIJ.mjs";import"../chunk-2PASUPUO.mjs";import"../chunk-XJJVJOX5.mjs";import"../chunk-NECL5FCQ.mjs";import"../chunk-4QMXOWHP.mjs";import"../chunk-EF4FA5I6.mjs";import"../chunk-WCMW2L3P.mjs";import"../chunk-WSR5EBJM.mjs";import"../chunk-C3Q23D22.mjs";import"../chunk-QREVMGQZ.mjs";import"../chunk-V3MBJJTL.mjs";import"../chunk-ZP4DWSQA.mjs";import"../chunk-FGFLPH5K.mjs";import"../chunk-WHSTLR3F.mjs";import"../chunk-M3AO73ZL.mjs";import"../chunk-6OWBKU7N.mjs";import"../chunk-AMXZQPUQ.mjs";import"../chunk-YOZBVVKL.mjs";import"../chunk-SJDCGNWU.mjs";import"../chunk-UL777LTI.mjs";import"../chunk-7ECCT6PK.mjs";import"../chunk-4AI7KQQ7.mjs";import"../chunk-7EER7GWV.mjs";import"../chunk-QP2BY4PK.mjs";import"../chunk-HGLO5LDS.mjs";import"../chunk-CW35YAMN.mjs";import"../chunk-6WDVDEQZ.mjs";import"../chunk-RCSJFTST.mjs";import"../chunk-4RXKALLC.mjs";import"../chunk-OLILO7VD.mjs";import"../chunk-7DQDJ2SA.mjs";import"../chunk-HNBVYE3N.mjs";import"../chunk-RGKRCZ36.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-Q4W3WJ2U.mjs";import"../chunk-TOBQ5UE6.mjs";import"../chunk-MT2RJ7H3.mjs";import"../chunk-ORMOQWWH.mjs";import"../chunk-FD6FGKYY.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-MCFQE4GC.mjs";import"../chunk-FLZPUYXQ.mjs";import"../chunk-EBMEXURY.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-56CNRT2K.mjs";import"../chunk-CIJA7ONS.mjs";import"../chunk-KDMSOCZY.mjs";export{a as transferCoinTransaction};
1
+ import{APTOS_COIN as c}from"../utils/const";import{generateTransaction as p}from"./transactionSubmission";import{TypeTagAddress as a,TypeTagU64 as m}from"../transactions";const u={typeParameters:[{constraints:[]}],parameters:[new a,new m]};async function w(n){const{aptosConfig:t,sender:o,recipient:r,amount:e,coinType:i,options:s}=n;return p({aptosConfig:t,sender:o,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[i??c],functionArguments:[r,e],abi:u},options:s})}export{w as transferCoinTransaction};
2
2
  //# sourceMappingURL=coin.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"sources":["../../../src/internal/coin.ts"],"sourcesContent":["import { AptosConfig } from \"../api/aptosConfig\";\nimport { AccountAddressInput } from \"../core\";\nimport { EntryFunctionABI, InputGenerateTransactionOptions } from \"../transactions/types\";\nimport { AnyNumber, MoveStructId } from \"../types\";\nimport { APTOS_COIN } from \"../utils/const\";\nimport { generateTransaction } from \"./transactionSubmission\";\nimport { TypeTagAddress, TypeTagU64 } from \"../transactions\";\nimport { SimpleTransaction } from \"../transactions/instances/simpleTransaction\";\n\nconst coinTransferAbi: EntryFunctionABI = {\n typeParameters: [{ constraints: [] }],\n parameters: [new TypeTagAddress(), new TypeTagU64()],\n};\n\n/**\n * Generates a transaction to transfer coins from one account to another.\n * This function allows you to specify the sender, recipient, amount, and coin type for the transaction.\n *\n * @param args - The parameters for the transaction.\n * @param args.aptosConfig - The Aptos configuration object.\n * @param args.sender - The address of the account sending the coins.\n * @param args.recipient - The address of the account receiving the coins.\n * @param args.amount - The amount of coins to transfer.\n * @param args.coinType - (Optional) The type of coin to transfer, defaults to Aptos Coin if not specified.\n * @param args.options - (Optional) Options for generating the transaction.\n * @group Implementation\n */\nexport async function transferCoinTransaction(args: {\n aptosConfig: AptosConfig;\n sender: AccountAddressInput;\n recipient: AccountAddressInput;\n amount: AnyNumber;\n coinType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, sender, recipient, amount, coinType, options } = args;\n const coinStructType = coinType ?? APTOS_COIN;\n return generateTransaction({\n aptosConfig,\n sender,\n data: {\n function: \"0x1::aptos_account::transfer_coins\",\n typeArguments: [coinStructType],\n functionArguments: [recipient, amount],\n abi: coinTransferAbi,\n },\n options,\n });\n}\n"],"mappings":"AAIA,OAAS,cAAAA,MAAkB,iBAC3B,OAAS,uBAAAC,MAA2B,0BACpC,OAAS,kBAAAC,EAAgB,cAAAC,MAAkB,kBAG3C,MAAMC,EAAoC,CACxC,eAAgB,CAAC,CAAE,YAAa,CAAC,CAAE,CAAC,EACpC,WAAY,CAAC,IAAIF,EAAkB,IAAIC,CAAY,CACrD,EAeA,eAAsBE,EAAwBC,EAOf,CAC7B,KAAM,CAAE,YAAAC,EAAa,OAAAC,EAAQ,UAAAC,EAAW,OAAAC,EAAQ,SAAAC,EAAU,QAAAC,CAAQ,EAAIN,EAEtE,OAAOL,EAAoB,CACzB,YAAAM,EACA,OAAAC,EACA,KAAM,CACJ,SAAU,qCACV,cAAe,CANIG,GAAYX,CAMD,EAC9B,kBAAmB,CAACS,EAAWC,CAAM,EACrC,IAAKN,CACP,EACA,QAAAQ,CACF,CAAC,CACH","names":["APTOS_COIN","generateTransaction","TypeTagAddress","TypeTagU64","coinTransferAbi","transferCoinTransaction","args","aptosConfig","sender","recipient","amount","coinType","options"]}
@@ -1,2 +1,2 @@
1
- import{$c as c,Zc as a,_c as b,ad as d,bd as e,cd as f,dd as g,ed as h,fd as i,gd as j,hd as k,id as l,jd as m,kd as n,ld as o,md as p,nd as q,od as r,pd as s,qd as t,rd as u,sd as v,td as w,ud as x}from"../chunk-L72TIN7T.mjs";import"../chunk-2XQKGWHQ.mjs";import"../chunk-UYVPNUH3.mjs";import"../chunk-XKUIMGKU.mjs";import"../chunk-N6YTF76Q.mjs";import"../chunk-A5L76YP7.mjs";import"../chunk-I7XT6L7S.mjs";import"../chunk-5HXLZHDW.mjs";import"../chunk-G3MHXDYA.mjs";import"../chunk-JABP65XD.mjs";import"../chunk-GOXRBEIJ.mjs";import"../chunk-2PASUPUO.mjs";import"../chunk-XJJVJOX5.mjs";import"../chunk-NECL5FCQ.mjs";import"../chunk-4QMXOWHP.mjs";import"../chunk-EF4FA5I6.mjs";import"../chunk-WCMW2L3P.mjs";import"../chunk-WSR5EBJM.mjs";import"../chunk-C3Q23D22.mjs";import"../chunk-QREVMGQZ.mjs";import"../chunk-V3MBJJTL.mjs";import"../chunk-ZP4DWSQA.mjs";import"../chunk-FGFLPH5K.mjs";import"../chunk-WHSTLR3F.mjs";import"../chunk-M3AO73ZL.mjs";import"../chunk-6OWBKU7N.mjs";import"../chunk-AMXZQPUQ.mjs";import"../chunk-YOZBVVKL.mjs";import"../chunk-SJDCGNWU.mjs";import"../chunk-UL777LTI.mjs";import"../chunk-7ECCT6PK.mjs";import"../chunk-4AI7KQQ7.mjs";import"../chunk-7EER7GWV.mjs";import"../chunk-QP2BY4PK.mjs";import"../chunk-HGLO5LDS.mjs";import"../chunk-CW35YAMN.mjs";import"../chunk-6WDVDEQZ.mjs";import"../chunk-RCSJFTST.mjs";import"../chunk-4RXKALLC.mjs";import"../chunk-OLILO7VD.mjs";import"../chunk-7DQDJ2SA.mjs";import"../chunk-HNBVYE3N.mjs";import"../chunk-RGKRCZ36.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-Q4W3WJ2U.mjs";import"../chunk-TOBQ5UE6.mjs";import"../chunk-MT2RJ7H3.mjs";import"../chunk-ORMOQWWH.mjs";import"../chunk-FD6FGKYY.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-MCFQE4GC.mjs";import"../chunk-FLZPUYXQ.mjs";import"../chunk-EBMEXURY.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-56CNRT2K.mjs";import"../chunk-CIJA7ONS.mjs";import"../chunk-KDMSOCZY.mjs";export{t as addDigitalAssetPropertyTransaction,w as addDigitalAssetTypedPropertyTransaction,n as burnDigitalAssetTransaction,e as createCollectionTransaction,o as freezeDigitalAssetTransferTransaction,f as getCollectionData,i as getCollectionDataByCollectionId,h as getCollectionDataByCreatorAddress,g as getCollectionDataByCreatorAddressAndCollectionName,j as getCollectionId,b as getCurrentDigitalAssetOwnership,d as getDigitalAssetActivity,a as getDigitalAssetData,c as getOwnedDigitalAssets,k as mintDigitalAssetTransaction,m as mintSoulBoundTransaction,u as removeDigitalAssetPropertyTransaction,q as setDigitalAssetDescriptionTransaction,r as setDigitalAssetNameTransaction,s as setDigitalAssetURITransaction,l as transferDigitalAssetTransaction,p as unfreezeDigitalAssetTransferTransaction,v as updateDigitalAssetPropertyTransaction,x as updateDigitalAssetTypedPropertyTransaction};
1
+ import{Bool as w,MoveString as d,MoveVector as I,U64 as v}from"../bcs";import{AccountAddress as c}from"../core";import{MoveAbility as g}from"../types";import{GetCollectionData as V,GetCurrentTokenOwnership as B,GetTokenActivity as R,GetTokenData as M}from"../types/generated/queries";import{queryIndexer as P}from"./general";import{generateTransaction as u}from"./transactionSubmission";import{MAX_U64_BIG_INT as K}from"../bcs/consts";import{checkOrConvertArgument as U,objectStructTag as l,parseTypeTag as F,stringStructTag as p,TypeTagAddress as E,TypeTagBool as C,TypeTagGeneric as A,TypeTagStruct as i,TypeTagU64 as x,TypeTagVector as T}from"../transactions";const _={BOOLEAN:"bool",U8:"u8",U16:"u16",U32:"u32",U64:"u64",U128:"u128",U256:"u256",ADDRESS:"address",STRING:"0x1::string::String",ARRAY:"vector<u8>"},m="0x4::token::Token";async function Ft(t){const{aptosConfig:o,digitalAssetAddress:n}=t,e={token_data_id:{_eq:c.from(n).toStringLong()}};return(await P({aptosConfig:o,query:{query:M,variables:{where_condition:e}},originMethod:"getDigitalAssetData"})).current_token_datas_v2[0]}async function Nt(t){const{aptosConfig:o,digitalAssetAddress:n}=t,e={token_data_id:{_eq:c.from(n).toStringLong()},amount:{_gt:0}};return(await P({aptosConfig:o,query:{query:B,variables:{where_condition:e}},originMethod:"getCurrentDigitalAssetOwnership"})).current_token_ownerships_v2[0]}async function Qt(t){const{aptosConfig:o,ownerAddress:n,options:e}=t,r={owner_address:{_eq:c.from(n).toStringLong()},amount:{_gt:0}},s={query:B,variables:{where_condition:r,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await P({aptosConfig:o,query:s,originMethod:"getOwnedDigitalAssets"})).current_token_ownerships_v2}async function Yt(t){const{aptosConfig:o,digitalAssetAddress:n,options:e}=t,r={token_data_id:{_eq:c.from(n).toStringLong()}},s={query:R,variables:{where_condition:r,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await P({aptosConfig:o,query:s,originMethod:"getDigitalAssetActivity"})).token_activities_v2}const N={typeParameters:[],parameters:[new i(p()),new x,new i(p()),new i(p()),new C,new C,new C,new C,new C,new C,new C,new C,new C,new x,new x]};async function Lt(t){const{aptosConfig:o,options:n,creator:e}=t;return u({aptosConfig:o,sender:e.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new d(t.description),new v(t.maxSupply??K),new d(t.name),new d(t.uri),new w(t.mutableDescription??!0),new w(t.mutableRoyalty??!0),new w(t.mutableURI??!0),new w(t.mutableTokenDescription??!0),new w(t.mutableTokenName??!0),new w(t.mutableTokenProperties??!0),new w(t.mutableTokenURI??!0),new w(t.tokensBurnableByCreator??!0),new w(t.tokensFreezableByCreator??!0),new v(t.royaltyNumerator??0),new v(t.royaltyDenominator??1)],abi:N},options:n})}async function h(t){const{aptosConfig:o,options:n}=t,e=n?.where;n?.tokenStandard&&(e.token_standard={_eq:n?.tokenStandard??"v2"});const r={query:V,variables:{where_condition:e,offset:n?.offset,limit:n?.limit}};return(await P({aptosConfig:o,query:r,originMethod:"getCollectionData"})).current_collections_v2[0]}async function zt(t){const{aptosConfig:o,creatorAddress:n,collectionName:e,options:r}=t,s=c.from(n),a={collection_name:{_eq:e},creator_address:{_eq:s.toStringLong()}};return r?.tokenStandard&&(a.token_standard={_eq:r?.tokenStandard??"v2"}),h({aptosConfig:o,options:{...r,where:a}})}async function jt(t){const{aptosConfig:o,creatorAddress:n,options:e}=t,s={creator_address:{_eq:c.from(n).toStringLong()}};return e?.tokenStandard&&(s.token_standard={_eq:e?.tokenStandard??"v2"}),h({aptosConfig:o,options:{...e,where:s}})}async function Wt(t){const{aptosConfig:o,collectionId:n,options:e}=t,s={collection_id:{_eq:c.from(n).toStringLong()}};return e?.tokenStandard&&(s.token_standard={_eq:e?.tokenStandard??"v2"}),h({aptosConfig:o,options:{...e,where:s}})}async function Xt(t){const{creatorAddress:o,collectionName:n,options:e,aptosConfig:r}=t,s=c.from(o),a={collection_name:{_eq:n},creator_address:{_eq:s.toStringLong()}};return e?.tokenStandard&&(a.token_standard={_eq:e?.tokenStandard??"v2"}),(await h({aptosConfig:r,options:{where:a}})).collection_id}const Q={typeParameters:[],parameters:[new i(p()),new i(p()),new i(p()),new i(p()),new T(new i(p())),new T(new i(p())),new T(T.u8())]};async function Ht(t){const{aptosConfig:o,options:n,creator:e,collection:r,description:s,name:a,uri:f,propertyKeys:y,propertyTypes:b,propertyValues:k}=t,S=b?.map(D=>_[D]);return u({aptosConfig:o,sender:e.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new d(r),new d(s),new d(a),new d(f),I.MoveString(y??[]),I.MoveString(S??[]),O(k??[],S??[])],abi:Q},options:n})}const Y={typeParameters:[{constraints:[g.KEY]}],parameters:[new i(l(new A(0))),new E]};async function Jt(t){const{aptosConfig:o,sender:n,digitalAssetAddress:e,recipient:r,digitalAssetType:s,options:a}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x1::object::transfer",typeArguments:[s??m],functionArguments:[c.from(e),c.from(r)],abi:Y},options:a})}const L={typeParameters:[],parameters:[new i(p()),new i(p()),new i(p()),new i(p()),new T(new i(p())),new T(new i(p())),new T(T.u8()),new E]};async function Zt(t){const{aptosConfig:o,account:n,collection:e,description:r,name:s,uri:a,recipient:f,propertyKeys:y,propertyTypes:b,propertyValues:k,options:S}=t;if(y?.length!==k?.length)throw new Error("Property keys and property values counts do not match");if(b?.length!==k?.length)throw new Error("Property types and property values counts do not match");const D=b?.map(q=>_[q]);return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::mint_soul_bound",functionArguments:[e,r,s,a,I.MoveString(y??[]),I.MoveString(D??[]),O(k??[],D??[]),f],abi:L},options:S})}const z={typeParameters:[{constraints:[g.KEY]}],parameters:[new i(l(new A(0)))]};async function $t(t){const{aptosConfig:o,creator:n,digitalAssetAddress:e,digitalAssetType:r,options:s}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::burn",typeArguments:[r??m],functionArguments:[c.from(e)],abi:z},options:s})}const j={typeParameters:[{constraints:[g.KEY]}],parameters:[new i(l(new A(0)))]};async function te(t){const{aptosConfig:o,creator:n,digitalAssetAddress:e,digitalAssetType:r,options:s}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::freeze_transfer",typeArguments:[r??m],functionArguments:[e],abi:j},options:s})}const W={typeParameters:[{constraints:[g.KEY]}],parameters:[new i(l(new A(0)))]};async function ee(t){const{aptosConfig:o,creator:n,digitalAssetAddress:e,digitalAssetType:r,options:s}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::unfreeze_transfer",typeArguments:[r??m],functionArguments:[e],abi:W},options:s})}const X={typeParameters:[{constraints:[g.KEY]}],parameters:[new i(l(new A(0))),new i(p())]};async function ne(t){const{aptosConfig:o,creator:n,description:e,digitalAssetAddress:r,digitalAssetType:s,options:a}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::set_description",typeArguments:[s??m],functionArguments:[c.from(r),new d(e)],abi:X},options:a})}const H={typeParameters:[{constraints:[g.KEY]}],parameters:[new i(l(new A(0))),new i(p())]};async function oe(t){const{aptosConfig:o,creator:n,name:e,digitalAssetAddress:r,digitalAssetType:s,options:a}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::set_name",typeArguments:[s??m],functionArguments:[c.from(r),new d(e)],abi:H},options:a})}const J={typeParameters:[{constraints:[g.KEY]}],parameters:[new i(l(new A(0))),new i(p())]};async function re(t){const{aptosConfig:o,creator:n,uri:e,digitalAssetAddress:r,digitalAssetType:s,options:a}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::set_uri",typeArguments:[s??m],functionArguments:[c.from(r),new d(e)],abi:J},options:a})}const Z={typeParameters:[{constraints:[g.KEY]}],parameters:[new i(l(new A(0))),new i(p()),new i(p()),T.u8()]};async function se(t){const{aptosConfig:o,creator:n,propertyKey:e,propertyType:r,propertyValue:s,digitalAssetAddress:a,digitalAssetType:f,options:y}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::add_property",typeArguments:[f??m],functionArguments:[c.from(a),new d(e),new d(_[r]),I.U8(G(s,_[r]))],abi:Z},options:y})}const $={typeParameters:[{constraints:[g.KEY]}],parameters:[new i(l(new A(0))),new i(p())]};async function ie(t){const{aptosConfig:o,creator:n,propertyKey:e,digitalAssetAddress:r,digitalAssetType:s,options:a}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::remove_property",typeArguments:[s??m],functionArguments:[c.from(r),new d(e)],abi:$},options:a})}const tt={typeParameters:[{constraints:[g.KEY]}],parameters:[new i(l(new A(0))),new i(p()),new i(p()),T.u8()]};async function ae(t){const{aptosConfig:o,creator:n,propertyKey:e,propertyType:r,propertyValue:s,digitalAssetAddress:a,digitalAssetType:f,options:y}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::update_property",typeArguments:[f??m],functionArguments:[c.from(a),new d(e),new d(_[r]),G(s,_[r])],abi:tt},options:y})}const et={typeParameters:[{constraints:[g.KEY]},{constraints:[]}],parameters:[new i(l(new A(0))),new i(p()),new A(1)]};async function pe(t){const{aptosConfig:o,creator:n,propertyKey:e,propertyType:r,propertyValue:s,digitalAssetAddress:a,digitalAssetType:f,options:y}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::add_typed_property",typeArguments:[f??m,_[r]],functionArguments:[c.from(a),new d(e),s],abi:et},options:y})}const nt={typeParameters:[{constraints:[g.KEY]},{constraints:[]}],parameters:[new i(l(new A(0))),new i(p()),new A(1)]};async function ce(t){const{aptosConfig:o,creator:n,propertyKey:e,propertyType:r,propertyValue:s,digitalAssetAddress:a,digitalAssetType:f,options:y}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::update_typed_property",typeArguments:[f??m,_[r]],functionArguments:[c.from(a),new d(e),s],abi:nt},options:y})}function O(t,o){const n=new Array;return o.forEach((e,r)=>{n.push(G(t[r],e))}),n}function G(t,o){const n=F(o);return U(t,n,0,[]).bcsToBytes()}export{se as addDigitalAssetPropertyTransaction,pe as addDigitalAssetTypedPropertyTransaction,$t as burnDigitalAssetTransaction,Lt as createCollectionTransaction,te as freezeDigitalAssetTransferTransaction,h as getCollectionData,Wt as getCollectionDataByCollectionId,jt as getCollectionDataByCreatorAddress,zt as getCollectionDataByCreatorAddressAndCollectionName,Xt as getCollectionId,Nt as getCurrentDigitalAssetOwnership,Yt as getDigitalAssetActivity,Ft as getDigitalAssetData,Qt as getOwnedDigitalAssets,Ht as mintDigitalAssetTransaction,Zt as mintSoulBoundTransaction,ie as removeDigitalAssetPropertyTransaction,ne as setDigitalAssetDescriptionTransaction,oe as setDigitalAssetNameTransaction,re as setDigitalAssetURITransaction,Jt as transferDigitalAssetTransaction,ee as unfreezeDigitalAssetTransferTransaction,ae as updateDigitalAssetPropertyTransaction,ce as updateDigitalAssetTypedPropertyTransaction};
2
2
  //# sourceMappingURL=digitalAsset.mjs.map