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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (421) 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 +94 -16
  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.d.mts +1 -1
  41. package/dist/esm/api/account.mjs +1 -1
  42. package/dist/esm/api/account.mjs.map +1 -1
  43. package/dist/esm/api/ans.mjs +1 -1
  44. package/dist/esm/api/ans.mjs.map +1 -1
  45. package/dist/esm/api/aptos.d.mts +81 -14
  46. package/dist/esm/api/aptos.mjs +1 -1
  47. package/dist/esm/api/aptos.mjs.map +1 -1
  48. package/dist/esm/api/aptosConfig.mjs +1 -1
  49. package/dist/esm/api/aptosConfig.mjs.map +1 -1
  50. package/dist/esm/api/coin.mjs +1 -1
  51. package/dist/esm/api/coin.mjs.map +1 -1
  52. package/dist/esm/api/digitalAsset.mjs +1 -1
  53. package/dist/esm/api/digitalAsset.mjs.map +1 -1
  54. package/dist/esm/api/faucet.mjs +1 -1
  55. package/dist/esm/api/faucet.mjs.map +1 -1
  56. package/dist/esm/api/fungibleAsset.mjs +1 -1
  57. package/dist/esm/api/fungibleAsset.mjs.map +1 -1
  58. package/dist/esm/api/general.mjs +1 -1
  59. package/dist/esm/api/general.mjs.map +1 -1
  60. package/dist/esm/api/index.d.mts +2 -2
  61. package/dist/esm/api/index.mjs +1 -1
  62. package/dist/esm/api/index.mjs.map +1 -1
  63. package/dist/esm/api/keyless.mjs +1 -1
  64. package/dist/esm/api/keyless.mjs.map +1 -1
  65. package/dist/esm/api/object.mjs +1 -1
  66. package/dist/esm/api/object.mjs.map +1 -1
  67. package/dist/esm/api/staking.mjs +1 -1
  68. package/dist/esm/api/staking.mjs.map +1 -1
  69. package/dist/esm/api/table.mjs +1 -1
  70. package/dist/esm/api/table.mjs.map +1 -1
  71. package/dist/esm/api/transaction.mjs +1 -1
  72. package/dist/esm/api/transaction.mjs.map +1 -1
  73. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  74. package/dist/esm/api/transactionSubmission/build.mjs.map +1 -1
  75. package/dist/esm/api/transactionSubmission/helpers.mjs +1 -1
  76. package/dist/esm/api/transactionSubmission/helpers.mjs.map +1 -1
  77. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  78. package/dist/esm/api/transactionSubmission/management.mjs.map +1 -1
  79. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  80. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  81. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  82. package/dist/esm/api/transactionSubmission/simulate.mjs.map +1 -1
  83. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  84. package/dist/esm/api/transactionSubmission/submit.mjs.map +1 -1
  85. package/dist/esm/api/utils.mjs +1 -1
  86. package/dist/esm/api/utils.mjs.map +1 -1
  87. package/dist/esm/bcs/consts.mjs +1 -1
  88. package/dist/esm/bcs/consts.mjs.map +1 -1
  89. package/dist/esm/bcs/deserializer.mjs +1 -1
  90. package/dist/esm/bcs/deserializer.mjs.map +1 -1
  91. package/dist/esm/bcs/index.mjs +1 -1
  92. package/dist/esm/bcs/index.mjs.map +1 -1
  93. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  94. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs.map +1 -1
  95. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  96. package/dist/esm/bcs/serializable/fixedBytes.mjs.map +1 -1
  97. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  98. package/dist/esm/bcs/serializable/movePrimitives.mjs.map +1 -1
  99. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  100. package/dist/esm/bcs/serializable/moveStructs.mjs.map +1 -1
  101. package/dist/esm/bcs/serializer.mjs +1 -1
  102. package/dist/esm/bcs/serializer.mjs.map +1 -1
  103. package/dist/esm/cli/index.mjs +1 -1
  104. package/dist/esm/cli/index.mjs.map +1 -1
  105. package/dist/esm/cli/localNode.mjs +1 -1
  106. package/dist/esm/cli/localNode.mjs.map +1 -1
  107. package/dist/esm/cli/move.mjs +1 -1
  108. package/dist/esm/cli/move.mjs.map +1 -1
  109. package/dist/esm/client/core.mjs +1 -1
  110. package/dist/esm/client/core.mjs.map +1 -1
  111. package/dist/esm/client/get.mjs +1 -1
  112. package/dist/esm/client/get.mjs.map +1 -1
  113. package/dist/esm/client/index.mjs +1 -1
  114. package/dist/esm/client/index.mjs.map +1 -1
  115. package/dist/esm/client/post.mjs +1 -1
  116. package/dist/esm/client/post.mjs.map +1 -1
  117. package/dist/esm/core/account/index.d.mts +1 -1
  118. package/dist/esm/core/account/index.mjs +1 -1
  119. package/dist/esm/core/account/index.mjs.map +1 -1
  120. package/dist/esm/core/account/utils/address.d.mts +12 -1
  121. package/dist/esm/core/account/utils/address.mjs +1 -1
  122. package/dist/esm/core/account/utils/address.mjs.map +1 -1
  123. package/dist/esm/core/account/utils/index.d.mts +1 -1
  124. package/dist/esm/core/account/utils/index.mjs +1 -1
  125. package/dist/esm/core/account/utils/index.mjs.map +1 -1
  126. package/dist/esm/core/accountAddress.mjs +3 -1
  127. package/dist/esm/core/accountAddress.mjs.map +1 -1
  128. package/dist/esm/core/authenticationKey.mjs +1 -1
  129. package/dist/esm/core/authenticationKey.mjs.map +1 -1
  130. package/dist/esm/core/common.mjs +1 -1
  131. package/dist/esm/core/common.mjs.map +1 -1
  132. package/dist/esm/core/crypto/abstraction.mjs +1 -1
  133. package/dist/esm/core/crypto/abstraction.mjs.map +1 -1
  134. package/dist/esm/core/crypto/deserializationUtils.mjs +1 -1
  135. package/dist/esm/core/crypto/deserializationUtils.mjs.map +1 -1
  136. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  137. package/dist/esm/core/crypto/ed25519.mjs.map +1 -1
  138. package/dist/esm/core/crypto/ephemeral.mjs +1 -1
  139. package/dist/esm/core/crypto/ephemeral.mjs.map +1 -1
  140. package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
  141. package/dist/esm/core/crypto/federatedKeyless.mjs.map +1 -1
  142. package/dist/esm/core/crypto/hdKey.mjs +1 -1
  143. package/dist/esm/core/crypto/hdKey.mjs.map +1 -1
  144. package/dist/esm/core/crypto/index.mjs +1 -1
  145. package/dist/esm/core/crypto/index.mjs.map +1 -1
  146. package/dist/esm/core/crypto/keyless.mjs +1 -1
  147. package/dist/esm/core/crypto/keyless.mjs.map +1 -1
  148. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  149. package/dist/esm/core/crypto/multiEd25519.mjs.map +1 -1
  150. package/dist/esm/core/crypto/multiKey.mjs +3 -1
  151. package/dist/esm/core/crypto/multiKey.mjs.map +1 -1
  152. package/dist/esm/core/crypto/poseidon.mjs +1 -1
  153. package/dist/esm/core/crypto/poseidon.mjs.map +1 -1
  154. package/dist/esm/core/crypto/privateKey.mjs +1 -1
  155. package/dist/esm/core/crypto/privateKey.mjs.map +1 -1
  156. package/dist/esm/core/crypto/proof.mjs +1 -1
  157. package/dist/esm/core/crypto/proof.mjs.map +1 -1
  158. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  159. package/dist/esm/core/crypto/publicKey.mjs.map +1 -1
  160. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  161. package/dist/esm/core/crypto/secp256k1.mjs.map +1 -1
  162. package/dist/esm/core/crypto/secp256r1.mjs +1 -1
  163. package/dist/esm/core/crypto/secp256r1.mjs.map +1 -1
  164. package/dist/esm/core/crypto/signature.mjs +1 -1
  165. package/dist/esm/core/crypto/signature.mjs.map +1 -1
  166. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  167. package/dist/esm/core/crypto/singleKey.mjs.map +1 -1
  168. package/dist/esm/core/crypto/types.mjs +0 -1
  169. package/dist/esm/core/crypto/utils.mjs +1 -1
  170. package/dist/esm/core/crypto/utils.mjs.map +1 -1
  171. package/dist/esm/core/hex.mjs +1 -1
  172. package/dist/esm/core/hex.mjs.map +1 -1
  173. package/dist/esm/core/index.d.mts +1 -1
  174. package/dist/esm/core/index.mjs +1 -1
  175. package/dist/esm/core/index.mjs.map +1 -1
  176. package/dist/esm/errors/index.mjs +6 -1
  177. package/dist/esm/errors/index.mjs.map +1 -1
  178. package/dist/esm/index.d.mts +2 -2
  179. package/dist/esm/index.mjs +1 -1
  180. package/dist/esm/index.mjs.map +1 -1
  181. package/dist/esm/internal/abstraction.mjs +1 -1
  182. package/dist/esm/internal/abstraction.mjs.map +1 -1
  183. package/dist/esm/internal/account.mjs +1 -1
  184. package/dist/esm/internal/account.mjs.map +1 -1
  185. package/dist/esm/internal/ans.mjs +1 -1
  186. package/dist/esm/internal/ans.mjs.map +1 -1
  187. package/dist/esm/internal/coin.mjs +1 -1
  188. package/dist/esm/internal/coin.mjs.map +1 -1
  189. package/dist/esm/internal/digitalAsset.mjs +1 -1
  190. package/dist/esm/internal/digitalAsset.mjs.map +1 -1
  191. package/dist/esm/internal/faucet.mjs +1 -1
  192. package/dist/esm/internal/faucet.mjs.map +1 -1
  193. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  194. package/dist/esm/internal/fungibleAsset.mjs.map +1 -1
  195. package/dist/esm/internal/general.mjs +1 -1
  196. package/dist/esm/internal/general.mjs.map +1 -1
  197. package/dist/esm/internal/keyless.mjs +1 -1
  198. package/dist/esm/internal/keyless.mjs.map +1 -1
  199. package/dist/esm/internal/object.mjs +1 -1
  200. package/dist/esm/internal/object.mjs.map +1 -1
  201. package/dist/esm/internal/staking.mjs +1 -1
  202. package/dist/esm/internal/staking.mjs.map +1 -1
  203. package/dist/esm/internal/table.mjs +1 -1
  204. package/dist/esm/internal/table.mjs.map +1 -1
  205. package/dist/esm/internal/transaction.mjs +1 -1
  206. package/dist/esm/internal/transaction.mjs.map +1 -1
  207. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  208. package/dist/esm/internal/transactionSubmission.mjs.map +1 -1
  209. package/dist/esm/internal/utils/index.mjs +1 -1
  210. package/dist/esm/internal/utils/index.mjs.map +1 -1
  211. package/dist/esm/internal/utils/utils.mjs +1 -1
  212. package/dist/esm/internal/utils/utils.mjs.map +1 -1
  213. package/dist/esm/internal/view.mjs +1 -1
  214. package/dist/esm/internal/view.mjs.map +1 -1
  215. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  216. package/dist/esm/transactions/authenticator/account.mjs.map +1 -1
  217. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  218. package/dist/esm/transactions/authenticator/index.mjs.map +1 -1
  219. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  220. package/dist/esm/transactions/authenticator/transaction.mjs.map +1 -1
  221. package/dist/esm/transactions/index.mjs +1 -1
  222. package/dist/esm/transactions/index.mjs.map +1 -1
  223. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  224. package/dist/esm/transactions/instances/chainId.mjs.map +1 -1
  225. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  226. package/dist/esm/transactions/instances/identifier.mjs.map +1 -1
  227. package/dist/esm/transactions/instances/index.mjs +1 -1
  228. package/dist/esm/transactions/instances/index.mjs.map +1 -1
  229. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  230. package/dist/esm/transactions/instances/moduleId.mjs.map +1 -1
  231. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  232. package/dist/esm/transactions/instances/multiAgentTransaction.mjs.map +1 -1
  233. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  234. package/dist/esm/transactions/instances/rawTransaction.mjs.map +1 -1
  235. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  236. package/dist/esm/transactions/instances/rotationProofChallenge.mjs.map +1 -1
  237. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  238. package/dist/esm/transactions/instances/signedTransaction.mjs.map +1 -1
  239. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  240. package/dist/esm/transactions/instances/simpleTransaction.mjs.map +1 -1
  241. package/dist/esm/transactions/instances/transactionArgument.mjs +0 -1
  242. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  243. package/dist/esm/transactions/instances/transactionPayload.mjs.map +1 -1
  244. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  245. package/dist/esm/transactions/management/accountSequenceNumber.mjs.map +1 -1
  246. package/dist/esm/transactions/management/asyncQueue.mjs +1 -1
  247. package/dist/esm/transactions/management/asyncQueue.mjs.map +1 -1
  248. package/dist/esm/transactions/management/index.mjs +1 -1
  249. package/dist/esm/transactions/management/index.mjs.map +1 -1
  250. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  251. package/dist/esm/transactions/management/transactionWorker.mjs.map +1 -1
  252. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  253. package/dist/esm/transactions/transactionBuilder/helpers.mjs.map +1 -1
  254. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  255. package/dist/esm/transactions/transactionBuilder/index.mjs.map +1 -1
  256. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  257. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs.map +1 -1
  258. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  259. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs.map +1 -1
  260. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +2 -2
  261. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  262. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs.map +1 -1
  263. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  264. package/dist/esm/transactions/typeTag/index.mjs.map +1 -1
  265. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  266. package/dist/esm/transactions/typeTag/parser.mjs.map +1 -1
  267. package/dist/esm/transactions/types.mjs +0 -1
  268. package/dist/esm/types/abstraction.mjs +1 -1
  269. package/dist/esm/types/abstraction.mjs.map +1 -1
  270. package/dist/esm/types/generated/queries.mjs +493 -1
  271. package/dist/esm/types/generated/queries.mjs.map +1 -1
  272. package/dist/esm/types/generated/types.mjs +1 -1
  273. package/dist/esm/types/generated/types.mjs.map +1 -1
  274. package/dist/esm/types/index.mjs +1 -1
  275. package/dist/esm/types/index.mjs.map +1 -1
  276. package/dist/esm/types/indexer.mjs +0 -1
  277. package/dist/esm/types/types.mjs +1 -1
  278. package/dist/esm/types/types.mjs.map +1 -1
  279. package/dist/esm/utils/apiEndpoints.d.mts +1 -0
  280. package/dist/esm/utils/apiEndpoints.mjs +1 -1
  281. package/dist/esm/utils/apiEndpoints.mjs.map +1 -1
  282. package/dist/esm/utils/const.mjs +1 -1
  283. package/dist/esm/utils/const.mjs.map +1 -1
  284. package/dist/esm/utils/helpers.mjs +1 -1
  285. package/dist/esm/utils/helpers.mjs.map +1 -1
  286. package/dist/esm/utils/index.mjs +1 -1
  287. package/dist/esm/utils/index.mjs.map +1 -1
  288. package/dist/esm/utils/memoize.mjs +1 -1
  289. package/dist/esm/utils/memoize.mjs.map +1 -1
  290. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  291. package/dist/esm/utils/normalizeBundle.mjs.map +1 -1
  292. package/dist/esm/version.d.mts +1 -1
  293. package/dist/esm/version.mjs +1 -1
  294. package/dist/esm/version.mjs.map +1 -1
  295. package/package.json +39 -20
  296. package/src/api/aptos.ts +193 -51
  297. package/src/core/account/utils/address.ts +22 -0
  298. package/src/internal/ans.ts +1 -0
  299. package/src/utils/apiEndpoints.ts +7 -0
  300. package/src/version.ts +1 -1
  301. package/dist/common/chunk-A2XB7TVI.js +0 -4
  302. package/dist/esm/chunk-2PASUPUO.mjs +0 -2
  303. package/dist/esm/chunk-2PASUPUO.mjs.map +0 -1
  304. package/dist/esm/chunk-2XQKGWHQ.mjs +0 -2
  305. package/dist/esm/chunk-2XQKGWHQ.mjs.map +0 -1
  306. package/dist/esm/chunk-35DKMW7Q.mjs +0 -2
  307. package/dist/esm/chunk-35DKMW7Q.mjs.map +0 -1
  308. package/dist/esm/chunk-4AI7KQQ7.mjs +0 -2
  309. package/dist/esm/chunk-4AI7KQQ7.mjs.map +0 -1
  310. package/dist/esm/chunk-4QMXOWHP.mjs +0 -1
  311. package/dist/esm/chunk-4QMXOWHP.mjs.map +0 -1
  312. package/dist/esm/chunk-4RXKALLC.mjs +0 -2
  313. package/dist/esm/chunk-4RXKALLC.mjs.map +0 -1
  314. package/dist/esm/chunk-4WPQQPUF.mjs +0 -1
  315. package/dist/esm/chunk-4WPQQPUF.mjs.map +0 -1
  316. package/dist/esm/chunk-56CNRT2K.mjs +0 -2
  317. package/dist/esm/chunk-56CNRT2K.mjs.map +0 -1
  318. package/dist/esm/chunk-5HXLZHDW.mjs +0 -1
  319. package/dist/esm/chunk-5HXLZHDW.mjs.map +0 -1
  320. package/dist/esm/chunk-6OWBKU7N.mjs +0 -2
  321. package/dist/esm/chunk-6OWBKU7N.mjs.map +0 -1
  322. package/dist/esm/chunk-6WDVDEQZ.mjs +0 -7
  323. package/dist/esm/chunk-6WDVDEQZ.mjs.map +0 -1
  324. package/dist/esm/chunk-7DQDJ2SA.mjs +0 -2
  325. package/dist/esm/chunk-7DQDJ2SA.mjs.map +0 -1
  326. package/dist/esm/chunk-7ECCT6PK.mjs +0 -1
  327. package/dist/esm/chunk-7ECCT6PK.mjs.map +0 -1
  328. package/dist/esm/chunk-7EER7GWV.mjs +0 -2
  329. package/dist/esm/chunk-7EER7GWV.mjs.map +0 -1
  330. package/dist/esm/chunk-A5L76YP7.mjs +0 -2
  331. package/dist/esm/chunk-A5L76YP7.mjs.map +0 -1
  332. package/dist/esm/chunk-AMXZQPUQ.mjs +0 -2
  333. package/dist/esm/chunk-AMXZQPUQ.mjs.map +0 -1
  334. package/dist/esm/chunk-B563XRSZ.mjs +0 -2
  335. package/dist/esm/chunk-B563XRSZ.mjs.map +0 -1
  336. package/dist/esm/chunk-C3Q23D22.mjs +0 -2
  337. package/dist/esm/chunk-C3Q23D22.mjs.map +0 -1
  338. package/dist/esm/chunk-CIJA7ONS.mjs +0 -2
  339. package/dist/esm/chunk-CIJA7ONS.mjs.map +0 -1
  340. package/dist/esm/chunk-CW35YAMN.mjs +0 -2
  341. package/dist/esm/chunk-CW35YAMN.mjs.map +0 -1
  342. package/dist/esm/chunk-EBMEXURY.mjs +0 -2
  343. package/dist/esm/chunk-EBMEXURY.mjs.map +0 -1
  344. package/dist/esm/chunk-EF4FA5I6.mjs +0 -2
  345. package/dist/esm/chunk-EF4FA5I6.mjs.map +0 -1
  346. package/dist/esm/chunk-FD6FGKYY.mjs +0 -1
  347. package/dist/esm/chunk-FD6FGKYY.mjs.map +0 -1
  348. package/dist/esm/chunk-FGFLPH5K.mjs +0 -2
  349. package/dist/esm/chunk-FGFLPH5K.mjs.map +0 -1
  350. package/dist/esm/chunk-FLZPUYXQ.mjs +0 -2
  351. package/dist/esm/chunk-FLZPUYXQ.mjs.map +0 -1
  352. package/dist/esm/chunk-FZY4PMEE.mjs +0 -1
  353. package/dist/esm/chunk-FZY4PMEE.mjs.map +0 -1
  354. package/dist/esm/chunk-G3MHXDYA.mjs +0 -1
  355. package/dist/esm/chunk-G3MHXDYA.mjs.map +0 -1
  356. package/dist/esm/chunk-GOXRBEIJ.mjs +0 -2
  357. package/dist/esm/chunk-GOXRBEIJ.mjs.map +0 -1
  358. package/dist/esm/chunk-HGLO5LDS.mjs +0 -1
  359. package/dist/esm/chunk-HGLO5LDS.mjs.map +0 -1
  360. package/dist/esm/chunk-HNBVYE3N.mjs +0 -2
  361. package/dist/esm/chunk-HNBVYE3N.mjs.map +0 -1
  362. package/dist/esm/chunk-I7XT6L7S.mjs +0 -2
  363. package/dist/esm/chunk-I7XT6L7S.mjs.map +0 -1
  364. package/dist/esm/chunk-IF4UU2MT.mjs +0 -2
  365. package/dist/esm/chunk-IF4UU2MT.mjs.map +0 -1
  366. package/dist/esm/chunk-JABP65XD.mjs +0 -2
  367. package/dist/esm/chunk-JABP65XD.mjs.map +0 -1
  368. package/dist/esm/chunk-KDMSOCZY.mjs +0 -2
  369. package/dist/esm/chunk-KDMSOCZY.mjs.map +0 -1
  370. package/dist/esm/chunk-L72TIN7T.mjs +0 -4
  371. package/dist/esm/chunk-L72TIN7T.mjs.map +0 -1
  372. package/dist/esm/chunk-M3AO73ZL.mjs +0 -2
  373. package/dist/esm/chunk-M3AO73ZL.mjs.map +0 -1
  374. package/dist/esm/chunk-MCFQE4GC.mjs +0 -2
  375. package/dist/esm/chunk-MCFQE4GC.mjs.map +0 -1
  376. package/dist/esm/chunk-MT2RJ7H3.mjs +0 -2
  377. package/dist/esm/chunk-MT2RJ7H3.mjs.map +0 -1
  378. package/dist/esm/chunk-N6YTF76Q.mjs +0 -2
  379. package/dist/esm/chunk-N6YTF76Q.mjs.map +0 -1
  380. package/dist/esm/chunk-NECL5FCQ.mjs +0 -1
  381. package/dist/esm/chunk-NECL5FCQ.mjs.map +0 -1
  382. package/dist/esm/chunk-OLILO7VD.mjs +0 -2
  383. package/dist/esm/chunk-OLILO7VD.mjs.map +0 -1
  384. package/dist/esm/chunk-ORMOQWWH.mjs +0 -2
  385. package/dist/esm/chunk-ORMOQWWH.mjs.map +0 -1
  386. package/dist/esm/chunk-Q4W3WJ2U.mjs +0 -2
  387. package/dist/esm/chunk-Q4W3WJ2U.mjs.map +0 -1
  388. package/dist/esm/chunk-QP2BY4PK.mjs +0 -2
  389. package/dist/esm/chunk-QP2BY4PK.mjs.map +0 -1
  390. package/dist/esm/chunk-QREVMGQZ.mjs +0 -2
  391. package/dist/esm/chunk-QREVMGQZ.mjs.map +0 -1
  392. package/dist/esm/chunk-RCSJFTST.mjs +0 -2
  393. package/dist/esm/chunk-RCSJFTST.mjs.map +0 -1
  394. package/dist/esm/chunk-RGKRCZ36.mjs +0 -4
  395. package/dist/esm/chunk-RGKRCZ36.mjs.map +0 -1
  396. package/dist/esm/chunk-SJDCGNWU.mjs +0 -2
  397. package/dist/esm/chunk-SJDCGNWU.mjs.map +0 -1
  398. package/dist/esm/chunk-STY74NUA.mjs +0 -2
  399. package/dist/esm/chunk-STY74NUA.mjs.map +0 -1
  400. package/dist/esm/chunk-TOBQ5UE6.mjs +0 -2
  401. package/dist/esm/chunk-TOBQ5UE6.mjs.map +0 -1
  402. package/dist/esm/chunk-UL777LTI.mjs +0 -494
  403. package/dist/esm/chunk-UL777LTI.mjs.map +0 -1
  404. package/dist/esm/chunk-UYVPNUH3.mjs +0 -1
  405. package/dist/esm/chunk-UYVPNUH3.mjs.map +0 -1
  406. package/dist/esm/chunk-V3MBJJTL.mjs +0 -1
  407. package/dist/esm/chunk-V3MBJJTL.mjs.map +0 -1
  408. package/dist/esm/chunk-WCMW2L3P.mjs +0 -2
  409. package/dist/esm/chunk-WCMW2L3P.mjs.map +0 -1
  410. package/dist/esm/chunk-WHSTLR3F.mjs +0 -2
  411. package/dist/esm/chunk-WHSTLR3F.mjs.map +0 -1
  412. package/dist/esm/chunk-WSR5EBJM.mjs +0 -2
  413. package/dist/esm/chunk-WSR5EBJM.mjs.map +0 -1
  414. package/dist/esm/chunk-XJJVJOX5.mjs +0 -2
  415. package/dist/esm/chunk-XJJVJOX5.mjs.map +0 -1
  416. package/dist/esm/chunk-XKUIMGKU.mjs +0 -2
  417. package/dist/esm/chunk-XKUIMGKU.mjs.map +0 -1
  418. package/dist/esm/chunk-YOZBVVKL.mjs +0 -2
  419. package/dist/esm/chunk-YOZBVVKL.mjs.map +0 -1
  420. package/dist/esm/chunk-ZP4DWSQA.mjs +0 -2
  421. package/dist/esm/chunk-ZP4DWSQA.mjs.map +0 -1
@@ -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]): GetANSNameRes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AI,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
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"sources":["../../../src/internal/digitalAsset.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/digitalAsset}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * digitalAsset namespace and without having a dependency cycle error.\n * @group Implementation\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { Bool, MoveString, MoveVector, U64 } from \"../bcs\";\nimport { AccountAddress, AccountAddressInput } from \"../core\";\nimport { Account } from \"../account\";\nimport { EntryFunctionABI, InputGenerateTransactionOptions } from \"../transactions/types\";\nimport {\n AnyNumber,\n GetCollectionDataResponse,\n GetCurrentTokenOwnershipResponse,\n GetOwnedTokensResponse,\n GetTokenActivityResponse,\n GetTokenDataResponse,\n MoveAbility,\n MoveStructId,\n OrderByArg,\n PaginationArgs,\n TokenStandardArg,\n WhereArg,\n} from \"../types\";\nimport {\n GetCollectionDataQuery,\n GetCurrentTokenOwnershipQuery,\n GetTokenActivityQuery,\n GetTokenDataQuery,\n} from \"../types/generated/operations\";\nimport {\n GetCollectionData,\n GetCurrentTokenOwnership,\n GetTokenActivity,\n GetTokenData,\n} from \"../types/generated/queries\";\nimport { queryIndexer } from \"./general\";\nimport { generateTransaction } from \"./transactionSubmission\";\nimport { MAX_U64_BIG_INT } from \"../bcs/consts\";\nimport {\n CurrentCollectionsV2BoolExp,\n CurrentTokenOwnershipsV2BoolExp,\n TokenActivitiesV2BoolExp,\n} from \"../types/generated/types\";\nimport {\n checkOrConvertArgument,\n objectStructTag,\n parseTypeTag,\n stringStructTag,\n TypeTagAddress,\n TypeTagBool,\n TypeTagGeneric,\n TypeTagStruct,\n TypeTagU64,\n TypeTagVector,\n} from \"../transactions\";\nimport { SimpleTransaction } from \"../transactions/instances/simpleTransaction\";\n\n// A property type map for the user input and what Move expects\nconst PropertyTypeMap = {\n BOOLEAN: \"bool\",\n U8: \"u8\",\n U16: \"u16\",\n U32: \"u32\",\n U64: \"u64\",\n U128: \"u128\",\n U256: \"u256\",\n ADDRESS: \"address\",\n STRING: \"0x1::string::String\",\n ARRAY: \"vector<u8>\",\n};\n\n/**\n * The keys of the PropertyTypeMap, representing different property types.\n * @group Implementation\n */\nexport type PropertyType = keyof typeof PropertyTypeMap;\n\n/**\n * Accepted property value types for user input, including boolean, number, bigint, string, AccountAddress, and Uint8Array.\n * To pass in an Array, use Uint8Array type\n * for example `new MoveVector([new MoveString(\"hello\"), new MoveString(\"world\")]).bcsToBytes()`\n * @group Implementation\n */\nexport type PropertyValue = boolean | number | bigint | string | AccountAddress | Uint8Array;\n\n// The default digital asset type to use if non provided\nconst defaultDigitalAssetType = \"0x4::token::Token\";\n\n// FETCH QUERIES\n\n/**\n * Retrieves data for a specific digital asset using its address.\n *\n * @param args - The arguments for fetching digital asset data.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.digitalAssetAddress - The address of the digital asset to retrieve data for.\n * @returns The data of the specified digital asset.\n * @group Implementation\n */\nexport async function getDigitalAssetData(args: {\n aptosConfig: AptosConfig;\n digitalAssetAddress: AccountAddressInput;\n}): Promise<GetTokenDataResponse> {\n const { aptosConfig, digitalAssetAddress } = args;\n\n const whereCondition: { token_data_id: { _eq: string } } = {\n token_data_id: { _eq: AccountAddress.from(digitalAssetAddress).toStringLong() },\n };\n\n const graphqlQuery = {\n query: GetTokenData,\n variables: {\n where_condition: whereCondition,\n },\n };\n\n const data = await queryIndexer<GetTokenDataQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getDigitalAssetData\",\n });\n\n return data.current_token_datas_v2[0];\n}\n\n/**\n * Retrieves the current ownership details of a specified digital asset.\n *\n * @param args - The arguments for the function.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.digitalAssetAddress - The address of the digital asset to query ownership for.\n * @returns The current ownership details of the specified digital asset.\n * @group Implementation\n */\nexport async function getCurrentDigitalAssetOwnership(args: {\n aptosConfig: AptosConfig;\n digitalAssetAddress: AccountAddressInput;\n}): Promise<GetCurrentTokenOwnershipResponse> {\n const { aptosConfig, digitalAssetAddress } = args;\n\n const whereCondition: CurrentTokenOwnershipsV2BoolExp = {\n token_data_id: { _eq: AccountAddress.from(digitalAssetAddress).toStringLong() },\n amount: { _gt: 0 },\n };\n\n const graphqlQuery = {\n query: GetCurrentTokenOwnership,\n variables: {\n where_condition: whereCondition,\n },\n };\n\n const data = await queryIndexer<GetCurrentTokenOwnershipQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getCurrentDigitalAssetOwnership\",\n });\n\n return data.current_token_ownerships_v2[0];\n}\n\n/**\n * Retrieves the digital assets owned by a specified account address.\n *\n * @param args - The arguments for retrieving owned digital assets.\n * @param args.aptosConfig - The configuration for connecting to the Aptos network.\n * @param args.ownerAddress - The address of the account whose owned digital assets are being queried.\n * @param args.options - Optional pagination and ordering parameters for the query.\n * @param args.options.offset - The number of records to skip for pagination.\n * @param args.options.limit - The maximum number of records to return.\n * @param args.options.orderBy - The criteria for ordering the results.\n *\n * @returns An array of digital assets currently owned by the specified account.\n * @group Implementation\n */\nexport async function getOwnedDigitalAssets(args: {\n aptosConfig: AptosConfig;\n ownerAddress: AccountAddressInput;\n options?: PaginationArgs & OrderByArg<GetTokenActivityResponse[0]>;\n}): Promise<GetOwnedTokensResponse> {\n const { aptosConfig, ownerAddress, options } = args;\n\n const whereCondition: CurrentTokenOwnershipsV2BoolExp = {\n owner_address: { _eq: AccountAddress.from(ownerAddress).toStringLong() },\n amount: { _gt: 0 },\n };\n\n const graphqlQuery = {\n query: GetCurrentTokenOwnership,\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<GetCurrentTokenOwnershipQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getOwnedDigitalAssets\",\n });\n\n return data.current_token_ownerships_v2;\n}\n\n/**\n * Retrieves the activity associated with a specific digital asset.\n * This function allows you to track the token activities for a given digital asset address.\n *\n * @param args - The arguments for retrieving digital asset activity.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.digitalAssetAddress - The address of the digital asset to query.\n * @param args.options - Optional parameters for pagination and ordering.\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 to order the results by.\n * @returns A promise that resolves to an array of token activities for the specified digital asset.\n * @group Implementation\n */\nexport async function getDigitalAssetActivity(args: {\n aptosConfig: AptosConfig;\n digitalAssetAddress: AccountAddressInput;\n options?: PaginationArgs & OrderByArg<GetTokenActivityResponse[0]>;\n}): Promise<GetTokenActivityResponse> {\n const { aptosConfig, digitalAssetAddress, options } = args;\n\n const whereCondition: TokenActivitiesV2BoolExp = {\n token_data_id: { _eq: AccountAddress.from(digitalAssetAddress).toStringLong() },\n };\n\n const graphqlQuery = {\n query: GetTokenActivity,\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<GetTokenActivityQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getDigitalAssetActivity\",\n });\n\n return data.token_activities_v2;\n}\n\n/**\n * Options for creating a collection, allowing customization of various attributes such as supply limits, mutability of metadata,\n * and royalty settings.\n *\n * @param maxSupply - Maximum number of tokens that can be minted in the collection.\n * @param mutableDescription - Indicates if the collection description can be changed after creation.\n * @param mutableRoyalty - Indicates if the royalty settings can be modified after creation.\n * @param mutableURI - Indicates if the collection URI can be updated.\n * @param mutableTokenDescription - Indicates if individual token descriptions can be modified.\n * @param mutableTokenName - Indicates if individual token names can be changed.\n * @param mutableTokenProperties - Indicates if individual token properties can be altered.\n * @param mutableTokenURI - Indicates if individual token URIs can be updated.\n * @param tokensBurnableByCreator - Indicates if the creator can burn tokens from the collection.\n * @param tokensFreezableByCreator - Indicates if the creator can freeze tokens in the collection.\n * @param royaltyNumerator - The numerator for calculating royalties.\n * @param royaltyDenominator - The denominator for calculating royalties.\n * @group Implementation\n */\nexport interface CreateCollectionOptions {\n maxSupply?: AnyNumber;\n mutableDescription?: boolean;\n mutableRoyalty?: boolean;\n mutableURI?: boolean;\n mutableTokenDescription?: boolean;\n mutableTokenName?: boolean;\n mutableTokenProperties?: boolean;\n mutableTokenURI?: boolean;\n tokensBurnableByCreator?: boolean;\n tokensFreezableByCreator?: boolean;\n royaltyNumerator?: number;\n royaltyDenominator?: number;\n}\n\nconst createCollectionAbi: EntryFunctionABI = {\n typeParameters: [],\n parameters: [\n new TypeTagStruct(stringStructTag()),\n new TypeTagU64(),\n new TypeTagStruct(stringStructTag()),\n new TypeTagStruct(stringStructTag()),\n new TypeTagBool(),\n new TypeTagBool(),\n new TypeTagBool(),\n new TypeTagBool(),\n new TypeTagBool(),\n new TypeTagBool(),\n new TypeTagBool(),\n new TypeTagBool(),\n new TypeTagBool(),\n new TypeTagU64(),\n new TypeTagU64(),\n ],\n};\n\n/**\n * Creates a new collection transaction on the Aptos blockchain.\n * This function allows you to define the properties of the collection, including its name, description, and URI.\n *\n * @param args - The parameters for creating the collection transaction.\n * @param args.aptosConfig - The configuration settings for the Aptos network.\n * @param args.creator - The account that will create the collection.\n * @param args.description - A description of the collection.\n * @param args.name - The name of the collection.\n * @param args.uri - The URI associated with the collection.\n * @param args.options - Optional parameters for generating the transaction.\n * @param args.maxSupply - The maximum supply of tokens in the collection (optional).\n * @param args.mutableDescription - Indicates if the collection description can be changed (optional, defaults to true).\n * @param args.mutableRoyalty - Indicates if the royalty settings can be changed (optional, defaults to true).\n * @param args.mutableURI - Indicates if the URI can be changed (optional, defaults to true).\n * @param args.mutableTokenDescription - Indicates if the token description can be changed (optional, defaults to true).\n * @param args.mutableTokenName - Indicates if the token name can be changed (optional, defaults to true).\n * @param args.mutableTokenProperties - Indicates if the token properties can be changed (optional, defaults to true).\n * @param args.mutableTokenURI - Indicates if the token URI can be changed (optional, defaults to true).\n * @param args.tokensBurnableByCreator - Indicates if tokens can be burned by the creator (optional, defaults to true).\n * @param args.tokensFreezableByCreator - Indicates if tokens can be frozen by the creator (optional, defaults to true).\n * @param args.royaltyNumerator - The numerator for calculating royalties (optional, defaults to 0).\n * @param args.royaltyDenominator - The denominator for calculating royalties (optional, defaults to 1).\n * @group Implementation\n */\nexport async function createCollectionTransaction(\n args: {\n aptosConfig: AptosConfig;\n creator: Account;\n description: string;\n name: string;\n uri: string;\n options?: InputGenerateTransactionOptions;\n } & CreateCollectionOptions,\n): Promise<SimpleTransaction> {\n const { aptosConfig, options, creator } = args;\n return generateTransaction({\n aptosConfig,\n sender: creator.accountAddress,\n data: {\n function: \"0x4::aptos_token::create_collection\",\n functionArguments: [\n // Do not change the order\n new MoveString(args.description),\n new U64(args.maxSupply ?? MAX_U64_BIG_INT),\n new MoveString(args.name),\n new MoveString(args.uri),\n new Bool(args.mutableDescription ?? true),\n new Bool(args.mutableRoyalty ?? true),\n new Bool(args.mutableURI ?? true),\n new Bool(args.mutableTokenDescription ?? true),\n new Bool(args.mutableTokenName ?? true),\n new Bool(args.mutableTokenProperties ?? true),\n new Bool(args.mutableTokenURI ?? true),\n new Bool(args.tokensBurnableByCreator ?? true),\n new Bool(args.tokensFreezableByCreator ?? true),\n new U64(args.royaltyNumerator ?? 0),\n new U64(args.royaltyDenominator ?? 1),\n ],\n abi: createCollectionAbi,\n },\n options,\n });\n}\n\n/**\n * Retrieves data for the current collections based on specified options.\n *\n * @param args - The arguments for the function.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.options - Optional parameters for filtering and pagination.\n * @param args.options.tokenStandard - The token standard to filter the collections (default is \"v2\").\n * @param args.options.offset - The offset for pagination.\n * @param args.options.limit - The limit for pagination.\n * @param args.options.where - The conditions to filter the collections.\n * @returns The data of the current collections.\n * @group Implementation\n */\nexport async function getCollectionData(args: {\n aptosConfig: AptosConfig;\n options?: TokenStandardArg & PaginationArgs & WhereArg<CurrentCollectionsV2BoolExp>;\n}): Promise<GetCollectionDataResponse> {\n const { aptosConfig, options } = args;\n\n const whereCondition: any = options?.where;\n\n if (options?.tokenStandard) {\n whereCondition.token_standard = { _eq: options?.tokenStandard ?? \"v2\" };\n }\n\n const graphqlQuery = {\n query: GetCollectionData,\n variables: {\n where_condition: whereCondition,\n offset: options?.offset,\n limit: options?.limit,\n },\n };\n const data = await queryIndexer<GetCollectionDataQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getCollectionData\",\n });\n\n return data.current_collections_v2[0];\n}\n\n/**\n * Retrieves collection data based on the creator's address and the collection name.\n *\n * @param args - The arguments for retrieving the collection data.\n * @param args.aptosConfig - The Aptos configuration object.\n * @param args.creatorAddress - The address of the creator whose collection data is being retrieved.\n * @param args.collectionName - The name of the collection to fetch data for.\n * @param args.options - Optional parameters for filtering the results, including token standard and pagination options.\n * @param args.options.tokenStandard - The token standard to filter the results by (optional).\n * @param args.options.pagination - Pagination options for the results (optional).\n * @group Implementation\n */\nexport async function getCollectionDataByCreatorAddressAndCollectionName(args: {\n aptosConfig: AptosConfig;\n creatorAddress: AccountAddressInput;\n collectionName: string;\n options?: TokenStandardArg & PaginationArgs;\n}): Promise<GetCollectionDataResponse> {\n const { aptosConfig, creatorAddress, collectionName, options } = args;\n const address = AccountAddress.from(creatorAddress);\n\n const whereCondition: any = {\n collection_name: { _eq: collectionName },\n creator_address: { _eq: address.toStringLong() },\n };\n if (options?.tokenStandard) {\n whereCondition.token_standard = { _eq: options?.tokenStandard ?? \"v2\" };\n }\n\n return getCollectionData({ aptosConfig, options: { ...options, where: whereCondition } });\n}\n\n/**\n * Retrieves collection data associated with a specific creator's address.\n * This function allows you to filter the collections based on the creator's address and optional token standards.\n *\n * @param args - The arguments for retrieving collection data.\n * @param args.aptosConfig - The configuration for the Aptos network.\n * @param args.creatorAddress - The address of the creator whose collection data is being retrieved.\n * @param args.options - Optional parameters for filtering the results.\n * @param args.options.tokenStandard - The token standard to filter the collections by.\n * @param args.options.pagination - Pagination options for the results.\n * @group Implementation\n */\nexport async function getCollectionDataByCreatorAddress(args: {\n aptosConfig: AptosConfig;\n creatorAddress: AccountAddressInput;\n options?: TokenStandardArg & PaginationArgs;\n}): Promise<GetCollectionDataResponse> {\n const { aptosConfig, creatorAddress, options } = args;\n const address = AccountAddress.from(creatorAddress);\n\n const whereCondition: any = {\n creator_address: { _eq: address.toStringLong() },\n };\n if (options?.tokenStandard) {\n whereCondition.token_standard = { _eq: options?.tokenStandard ?? \"v2\" };\n }\n\n return getCollectionData({ aptosConfig, options: { ...options, where: whereCondition } });\n}\n\n/**\n * Retrieves data for a specific collection using its unique identifier.\n * This function allows you to filter the collection data based on the token standard and pagination options.\n *\n * @param args - The arguments for retrieving collection data.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.collectionId - The unique identifier for the collection.\n * @param args.options - Optional parameters for filtering by token standard and pagination.\n * @param args.options.tokenStandard - The standard of the token to filter the collection data.\n * @param args.options.page - The page number for pagination.\n * @param args.options.limit - The number of items per page for pagination.\n * @group Implementation\n */\nexport async function getCollectionDataByCollectionId(args: {\n aptosConfig: AptosConfig;\n collectionId: AccountAddressInput;\n options?: TokenStandardArg & PaginationArgs;\n}): Promise<GetCollectionDataResponse> {\n const { aptosConfig, collectionId, options } = args;\n const address = AccountAddress.from(collectionId);\n\n const whereCondition: any = {\n collection_id: { _eq: address.toStringLong() },\n };\n\n if (options?.tokenStandard) {\n whereCondition.token_standard = { _eq: options?.tokenStandard ?? \"v2\" };\n }\n\n return getCollectionData({ aptosConfig, options: { ...options, where: whereCondition } });\n}\n\n/**\n * Retrieves the collection ID based on the creator's address and the collection name.\n * This function helps in identifying a specific collection within the Aptos ecosystem.\n *\n * @param args - The parameters for retrieving the collection ID.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.creatorAddress - The address of the creator of the collection.\n * @param args.collectionName - The name of the collection to look up.\n * @param args.options - Optional parameters for additional filtering.\n * @param args.options.tokenStandard - The token standard to filter the collection (default is \"v2\").\n * @returns The ID of the specified collection.\n * @group Implementation\n */\nexport async function getCollectionId(args: {\n aptosConfig: AptosConfig;\n creatorAddress: AccountAddressInput;\n collectionName: string;\n options?: TokenStandardArg;\n}): Promise<string> {\n const { creatorAddress, collectionName, options, aptosConfig } = args;\n const address = AccountAddress.from(creatorAddress);\n\n const whereCondition: any = {\n collection_name: { _eq: collectionName },\n creator_address: { _eq: address.toStringLong() },\n };\n if (options?.tokenStandard) {\n whereCondition.token_standard = { _eq: options?.tokenStandard ?? \"v2\" };\n }\n\n return (await getCollectionData({ aptosConfig, options: { where: whereCondition } })).collection_id;\n}\n\n// TRANSACTIONS\n\nconst mintDigitalAssetAbi: EntryFunctionABI = {\n typeParameters: [],\n parameters: [\n new TypeTagStruct(stringStructTag()),\n new TypeTagStruct(stringStructTag()),\n new TypeTagStruct(stringStructTag()),\n new TypeTagStruct(stringStructTag()),\n new TypeTagVector(new TypeTagStruct(stringStructTag())),\n new TypeTagVector(new TypeTagStruct(stringStructTag())),\n new TypeTagVector(TypeTagVector.u8()),\n ],\n};\n\n/**\n * Creates a transaction to mint a digital asset on the Aptos blockchain.\n * This function allows you to specify various attributes of the asset, including its collection, description, name, and URI.\n *\n * @param args - The arguments for minting the digital asset.\n * @param args.aptosConfig - The configuration settings for the Aptos network.\n * @param args.creator - The account that will create the digital asset.\n * @param args.collection - The name of the collection to which the asset belongs.\n * @param args.description - A brief description of the digital asset.\n * @param args.name - The name of the digital asset.\n * @param args.uri - The URI pointing to the asset's metadata.\n * @param [args.propertyKeys] - Optional array of property keys associated with the asset.\n * @param [args.propertyTypes] - Optional array of property types corresponding to the asset's properties.\n * @param [args.propertyValues] - Optional array of property values for the asset's properties.\n * @param [args.options] - Optional transaction generation options.\n * @group Implementation\n */\nexport async function mintDigitalAssetTransaction(args: {\n aptosConfig: AptosConfig;\n creator: Account;\n collection: string;\n description: string;\n name: string;\n uri: string;\n propertyKeys?: Array<string>;\n propertyTypes?: Array<PropertyType>;\n propertyValues?: Array<PropertyValue>;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const {\n aptosConfig,\n options,\n creator,\n collection,\n description,\n name,\n uri,\n propertyKeys,\n propertyTypes,\n propertyValues,\n } = args;\n const convertedPropertyType = propertyTypes?.map((type) => PropertyTypeMap[type]);\n return generateTransaction({\n aptosConfig,\n sender: creator.accountAddress,\n data: {\n function: \"0x4::aptos_token::mint\",\n functionArguments: [\n new MoveString(collection),\n new MoveString(description),\n new MoveString(name),\n new MoveString(uri),\n MoveVector.MoveString(propertyKeys ?? []),\n MoveVector.MoveString(convertedPropertyType ?? []),\n\n /**\n * Retrieves the raw values of specified properties from an array of property values based on their types.\n *\n * @param propertyValues - An array of property values from which to extract the raw data.\n * @param propertyTypes - An array of strings representing the types of properties to retrieve.\n * @returns An array of Uint8Array containing the raw values for the specified property types.\n * @group Implementation\n */\n getPropertyValueRaw(propertyValues ?? [], convertedPropertyType ?? []),\n ],\n abi: mintDigitalAssetAbi,\n },\n options,\n });\n}\n\nconst transferDigitalAssetAbi: EntryFunctionABI = {\n typeParameters: [{ constraints: [MoveAbility.KEY] }],\n parameters: [new TypeTagStruct(objectStructTag(new TypeTagGeneric(0))), new TypeTagAddress()],\n};\n\n/**\n * Initiates a transaction to transfer a digital asset from one account to another.\n * This function helps in executing the transfer of digital assets securely and efficiently.\n *\n * @param args - The arguments required to perform the transfer.\n * @param args.aptosConfig - Configuration settings for the Aptos client.\n * @param args.sender - The account initiating the transfer.\n * @param args.digitalAssetAddress - The address of the digital asset being transferred.\n * @param args.recipient - The address of the account receiving the digital asset.\n * @param args.digitalAssetType - (Optional) The type of the digital asset being transferred.\n * @param args.options - (Optional) Additional options for generating the transaction.\n * @group Implementation\n */\nexport async function transferDigitalAssetTransaction(args: {\n aptosConfig: AptosConfig;\n sender: Account;\n digitalAssetAddress: AccountAddressInput;\n recipient: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, sender, digitalAssetAddress, recipient, digitalAssetType, options } = args;\n return generateTransaction({\n aptosConfig,\n sender: sender.accountAddress,\n data: {\n function: \"0x1::object::transfer\",\n typeArguments: [digitalAssetType ?? defaultDigitalAssetType],\n functionArguments: [AccountAddress.from(digitalAssetAddress), AccountAddress.from(recipient)],\n abi: transferDigitalAssetAbi,\n },\n options,\n });\n}\n\nconst mintSoulBoundAbi: EntryFunctionABI = {\n typeParameters: [],\n parameters: [\n new TypeTagStruct(stringStructTag()),\n new TypeTagStruct(stringStructTag()),\n new TypeTagStruct(stringStructTag()),\n new TypeTagStruct(stringStructTag()),\n new TypeTagVector(new TypeTagStruct(stringStructTag())),\n new TypeTagVector(new TypeTagStruct(stringStructTag())),\n new TypeTagVector(TypeTagVector.u8()),\n new TypeTagAddress(),\n ],\n};\n\n/**\n * Creates a transaction to mint a soul-bound token.\n * This function allows you to specify the token's attributes and recipient, facilitating the creation of unique digital assets.\n *\n * @param args - The parameters required to mint the soul-bound token.\n * @param args.aptosConfig - The configuration settings for the Aptos network.\n * @param args.account - The account initiating the minting transaction.\n * @param args.collection - The name of the collection to which the token belongs.\n * @param args.description - A description of the token being minted.\n * @param args.name - The name of the token.\n * @param args.uri - The URI pointing to the token's metadata.\n * @param args.recipient - The address of the account that will receive the minted token.\n * @param [args.propertyKeys] - Optional array of property keys associated with the token.\n * @param [args.propertyTypes] - Optional array of property types corresponding to the property keys.\n * @param [args.propertyValues] - Optional array of property values that match the property keys and types.\n * @param [args.options] - Optional transaction generation options.\n * @throws Error if the counts of property keys, property types, and property values do not match.\n * @group Implementation\n */\nexport async function mintSoulBoundTransaction(args: {\n aptosConfig: AptosConfig;\n account: Account;\n collection: string;\n description: string;\n name: string;\n uri: string;\n recipient: AccountAddressInput;\n propertyKeys?: Array<string>;\n propertyTypes?: Array<PropertyType>;\n propertyValues?: Array<PropertyValue>;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const {\n aptosConfig,\n account,\n collection,\n description,\n name,\n uri,\n recipient,\n propertyKeys,\n propertyTypes,\n propertyValues,\n options,\n } = args;\n if (propertyKeys?.length !== propertyValues?.length) {\n throw new Error(\"Property keys and property values counts do not match\");\n }\n if (propertyTypes?.length !== propertyValues?.length) {\n throw new Error(\"Property types and property values counts do not match\");\n }\n const convertedPropertyType = propertyTypes?.map((type) => PropertyTypeMap[type]);\n return generateTransaction({\n aptosConfig,\n sender: account.accountAddress,\n data: {\n function: \"0x4::aptos_token::mint_soul_bound\",\n functionArguments: [\n collection,\n description,\n name,\n uri,\n MoveVector.MoveString(propertyKeys ?? []),\n MoveVector.MoveString(convertedPropertyType ?? []),\n getPropertyValueRaw(propertyValues ?? [], convertedPropertyType ?? []),\n recipient,\n ],\n abi: mintSoulBoundAbi,\n },\n options,\n });\n}\n\nconst burnDigitalAssetAbi: EntryFunctionABI = {\n typeParameters: [{ constraints: [MoveAbility.KEY] }],\n parameters: [new TypeTagStruct(objectStructTag(new TypeTagGeneric(0)))],\n};\n\n/**\n * Creates a transaction to burn a specified digital asset.\n * This function allows users to permanently remove a digital asset from their account.\n *\n * @param args - The arguments for the transaction.\n * @param args.aptosConfig - The configuration settings for the Aptos network.\n * @param args.creator - The account that is initiating the burn transaction.\n * @param args.digitalAssetAddress - The address of the digital asset to be burned.\n * @param args.digitalAssetType - Optional; the type of the digital asset being burned.\n * @param args.options - Optional; additional options for generating the transaction.\n * @group Implementation\n */\nexport async function burnDigitalAssetTransaction(args: {\n aptosConfig: AptosConfig;\n creator: Account;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, creator, digitalAssetAddress, digitalAssetType, options } = args;\n return generateTransaction({\n aptosConfig,\n sender: creator.accountAddress,\n data: {\n function: \"0x4::aptos_token::burn\",\n typeArguments: [digitalAssetType ?? defaultDigitalAssetType],\n functionArguments: [AccountAddress.from(digitalAssetAddress)],\n abi: burnDigitalAssetAbi,\n },\n options,\n });\n}\n\nconst freezeDigitalAssetAbi: EntryFunctionABI = {\n typeParameters: [{ constraints: [MoveAbility.KEY] }],\n parameters: [new TypeTagStruct(objectStructTag(new TypeTagGeneric(0)))],\n};\n\n/**\n * Creates a transaction to freeze the transfer of a digital asset.\n * This function helps you prevent the transfer of a specified digital asset by generating the appropriate transaction.\n *\n * @param args - The parameters for the transaction.\n * @param args.aptosConfig - The configuration settings for the Aptos client.\n * @param args.creator - The account that is creating the transaction.\n * @param args.digitalAssetAddress - The address of the digital asset to be frozen.\n * @param args.digitalAssetType - (Optional) The type of the digital asset as a Move struct ID.\n * @param args.options - (Optional) Additional options for generating the transaction.\n * @group Implementation\n */\nexport async function freezeDigitalAssetTransferTransaction(args: {\n aptosConfig: AptosConfig;\n creator: Account;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, creator, digitalAssetAddress, digitalAssetType, options } = args;\n return generateTransaction({\n aptosConfig,\n sender: creator.accountAddress,\n data: {\n function: \"0x4::aptos_token::freeze_transfer\",\n typeArguments: [digitalAssetType ?? defaultDigitalAssetType],\n functionArguments: [digitalAssetAddress],\n abi: freezeDigitalAssetAbi,\n },\n options,\n });\n}\n\nconst unfreezeDigitalAssetAbi: EntryFunctionABI = {\n typeParameters: [{ constraints: [MoveAbility.KEY] }],\n parameters: [new TypeTagStruct(objectStructTag(new TypeTagGeneric(0)))],\n};\n\n/**\n * Unfreezes a digital asset transfer transaction, allowing the transfer of the specified digital asset.\n *\n * @param args - The arguments for unfreezing the digital asset transfer transaction.\n * @param args.aptosConfig - The Aptos configuration settings.\n * @param args.creator - The account that is initiating the unfreeze transaction.\n * @param args.digitalAssetAddress - The address of the digital asset to be unfrozen.\n * @param args.digitalAssetType - (Optional) The type of the digital asset being unfrozen.\n * @param args.options - (Optional) Additional options for generating the transaction.\n * @group Implementation\n */\nexport async function unfreezeDigitalAssetTransferTransaction(args: {\n aptosConfig: AptosConfig;\n creator: Account;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, creator, digitalAssetAddress, digitalAssetType, options } = args;\n return generateTransaction({\n aptosConfig,\n sender: creator.accountAddress,\n data: {\n function: \"0x4::aptos_token::unfreeze_transfer\",\n typeArguments: [digitalAssetType ?? defaultDigitalAssetType],\n functionArguments: [digitalAssetAddress],\n abi: unfreezeDigitalAssetAbi,\n },\n options,\n });\n}\n\nconst setDigitalAssetDescriptionAbi: EntryFunctionABI = {\n typeParameters: [{ constraints: [MoveAbility.KEY] }],\n parameters: [new TypeTagStruct(objectStructTag(new TypeTagGeneric(0))), new TypeTagStruct(stringStructTag())],\n};\n\n/**\n * Sets the description for a digital asset, allowing users to provide additional context or information about the asset.\n *\n * @param args - The arguments for setting the digital asset description.\n * @param args.aptosConfig - The Aptos configuration to use for the transaction.\n * @param args.creator - The account that is creating the transaction.\n * @param args.description - The new description for the digital asset.\n * @param args.digitalAssetAddress - The address of the digital asset whose description is being set.\n * @param args.digitalAssetType - (Optional) The type of the digital asset.\n * @param args.options - (Optional) Additional options for generating the transaction.\n * @group Implementation\n */\nexport async function setDigitalAssetDescriptionTransaction(args: {\n aptosConfig: AptosConfig;\n creator: Account;\n description: string;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, creator, description, digitalAssetAddress, digitalAssetType, options } = args;\n return generateTransaction({\n aptosConfig,\n sender: creator.accountAddress,\n data: {\n function: \"0x4::aptos_token::set_description\",\n typeArguments: [digitalAssetType ?? defaultDigitalAssetType],\n functionArguments: [AccountAddress.from(digitalAssetAddress), new MoveString(description)],\n abi: setDigitalAssetDescriptionAbi,\n },\n options,\n });\n}\n\nconst setDigitalAssetNameAbi: EntryFunctionABI = {\n typeParameters: [{ constraints: [MoveAbility.KEY] }],\n parameters: [new TypeTagStruct(objectStructTag(new TypeTagGeneric(0))), new TypeTagStruct(stringStructTag())],\n};\n\n/**\n * Sets the name of a digital asset on the Aptos blockchain.\n * This function allows you to update the name of a specified digital asset, enabling better identification and categorization.\n *\n * @param args - The parameters for setting the digital asset name.\n * @param args.aptosConfig - The configuration settings for the Aptos network.\n * @param args.creator - The account that is creating the transaction.\n * @param args.name - The new name to assign to the digital asset.\n * @param args.digitalAssetAddress - The address of the digital asset to update.\n * @param args.digitalAssetType - (Optional) The type of the digital asset, represented as a Move struct ID.\n * @param args.options - (Optional) Additional options for generating the transaction.\n * @group Implementation\n */\nexport async function setDigitalAssetNameTransaction(args: {\n aptosConfig: AptosConfig;\n creator: Account;\n name: string;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, creator, name, digitalAssetAddress, digitalAssetType, options } = args;\n return generateTransaction({\n aptosConfig,\n sender: creator.accountAddress,\n data: {\n function: \"0x4::aptos_token::set_name\",\n typeArguments: [digitalAssetType ?? defaultDigitalAssetType],\n functionArguments: [AccountAddress.from(digitalAssetAddress), new MoveString(name)],\n abi: setDigitalAssetNameAbi,\n },\n options,\n });\n}\n\nconst setDigitalAssetURIAbi: EntryFunctionABI = {\n typeParameters: [{ constraints: [MoveAbility.KEY] }],\n parameters: [new TypeTagStruct(objectStructTag(new TypeTagGeneric(0))), new TypeTagStruct(stringStructTag())],\n};\n\n/**\n * Sets the URI for a digital asset, allowing you to update the metadata associated with it.\n *\n * @param args - The arguments for setting the digital asset URI.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.creator - The account that is creating the transaction.\n * @param args.uri - The new URI to be set for the digital asset.\n * @param args.digitalAssetAddress - The address of the digital asset whose URI is being set.\n * @param args.digitalAssetType - The optional type of the digital asset; defaults to a predefined type if not provided.\n * @param args.options - Optional settings for generating the transaction.\n * @group Implementation\n */\nexport async function setDigitalAssetURITransaction(args: {\n aptosConfig: AptosConfig;\n creator: Account;\n uri: string;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, creator, uri, digitalAssetAddress, digitalAssetType, options } = args;\n return generateTransaction({\n aptosConfig,\n sender: creator.accountAddress,\n data: {\n function: \"0x4::aptos_token::set_uri\",\n typeArguments: [digitalAssetType ?? defaultDigitalAssetType],\n functionArguments: [AccountAddress.from(digitalAssetAddress), new MoveString(uri)],\n abi: setDigitalAssetURIAbi,\n },\n options,\n });\n}\n\nconst addDigitalAssetPropertyAbi: EntryFunctionABI = {\n typeParameters: [{ constraints: [MoveAbility.KEY] }],\n parameters: [\n new TypeTagStruct(objectStructTag(new TypeTagGeneric(0))),\n new TypeTagStruct(stringStructTag()),\n new TypeTagStruct(stringStructTag()),\n TypeTagVector.u8(),\n ],\n};\n\n/**\n * Creates a transaction to add a property to a digital asset.\n * This function helps in enhancing the metadata associated with a digital asset by allowing the addition of custom properties.\n *\n * @param args - The arguments for the transaction.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.creator - The account that is creating the transaction.\n * @param args.propertyKey - The key for the property being added.\n * @param args.propertyType - The type of the property being added.\n * @param args.propertyValue - The value of the property being added.\n * @param args.digitalAssetAddress - The address of the digital asset to which the property is being added.\n * @param args.digitalAssetType - The optional type of the digital asset.\n * @param args.options - Optional transaction generation options.\n * @group Implementation\n */\nexport async function addDigitalAssetPropertyTransaction(args: {\n aptosConfig: AptosConfig;\n creator: Account;\n propertyKey: string;\n propertyType: PropertyType;\n propertyValue: PropertyValue;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const {\n aptosConfig,\n creator,\n propertyKey,\n propertyType,\n propertyValue,\n digitalAssetAddress,\n digitalAssetType,\n options,\n } = args;\n return generateTransaction({\n aptosConfig,\n sender: creator.accountAddress,\n data: {\n function: \"0x4::aptos_token::add_property\",\n typeArguments: [digitalAssetType ?? defaultDigitalAssetType],\n functionArguments: [\n AccountAddress.from(digitalAssetAddress),\n new MoveString(propertyKey),\n new MoveString(PropertyTypeMap[propertyType]),\n MoveVector.U8(getSinglePropertyValueRaw(propertyValue, PropertyTypeMap[propertyType])),\n ],\n abi: addDigitalAssetPropertyAbi,\n },\n options,\n });\n}\n\nconst removeDigitalAssetPropertyAbi: EntryFunctionABI = {\n typeParameters: [{ constraints: [MoveAbility.KEY] }],\n parameters: [new TypeTagStruct(objectStructTag(new TypeTagGeneric(0))), new TypeTagStruct(stringStructTag())],\n};\n\n/**\n * Removes a property from a digital asset on the Aptos blockchain.\n * This function helps in managing the attributes of digital assets by allowing the removal of specific properties.\n *\n * @param args - The arguments for the transaction.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.creator - The account that is creating the transaction.\n * @param args.propertyKey - The key of the property to be removed.\n * @param args.digitalAssetAddress - The address of the digital asset from which the property will be removed.\n * @param args.digitalAssetType - The type of the digital asset (optional).\n * @param args.options - Additional options for generating the transaction (optional).\n * @group Implementation\n */\nexport async function removeDigitalAssetPropertyTransaction(args: {\n aptosConfig: AptosConfig;\n creator: Account;\n propertyKey: string;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, creator, propertyKey, digitalAssetAddress, digitalAssetType, options } = args;\n return generateTransaction({\n aptosConfig,\n sender: creator.accountAddress,\n data: {\n function: \"0x4::aptos_token::remove_property\",\n typeArguments: [digitalAssetType ?? defaultDigitalAssetType],\n functionArguments: [AccountAddress.from(digitalAssetAddress), new MoveString(propertyKey)],\n abi: removeDigitalAssetPropertyAbi,\n },\n options,\n });\n}\n\nconst updateDigitalAssetPropertyAbi: EntryFunctionABI = {\n typeParameters: [{ constraints: [MoveAbility.KEY] }],\n parameters: [\n new TypeTagStruct(objectStructTag(new TypeTagGeneric(0))),\n new TypeTagStruct(stringStructTag()),\n new TypeTagStruct(stringStructTag()),\n TypeTagVector.u8(),\n ],\n};\n\n/**\n * Updates a property of a digital asset by generating a transaction for the Aptos blockchain.\n * This function allows you to modify attributes of a digital asset, facilitating dynamic changes to its properties.\n *\n * @param args - The arguments for updating the digital asset property.\n * @param args.aptosConfig - The configuration settings for the Aptos blockchain.\n * @param args.creator - The account that is creating the transaction.\n * @param args.propertyKey - The key of the property to be updated.\n * @param args.propertyType - The type of the property being updated.\n * @param args.propertyValue - The new value for the property.\n * @param args.digitalAssetAddress - The address of the digital asset to update.\n * @param args.digitalAssetType - (Optional) The type of the digital asset.\n * @param args.options - (Optional) Additional options for generating the transaction.\n * @group Implementation\n */\nexport async function updateDigitalAssetPropertyTransaction(args: {\n aptosConfig: AptosConfig;\n creator: Account;\n propertyKey: string;\n propertyType: PropertyType;\n propertyValue: PropertyValue;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const {\n aptosConfig,\n creator,\n propertyKey,\n propertyType,\n propertyValue,\n digitalAssetAddress,\n digitalAssetType,\n options,\n } = args;\n return generateTransaction({\n aptosConfig,\n sender: creator.accountAddress,\n data: {\n function: \"0x4::aptos_token::update_property\",\n typeArguments: [digitalAssetType ?? defaultDigitalAssetType],\n functionArguments: [\n AccountAddress.from(digitalAssetAddress),\n new MoveString(propertyKey),\n new MoveString(PropertyTypeMap[propertyType]),\n\n /**\n * Retrieves the raw byte representation of a single property value based on its type.\n *\n * @param propertyValue - The value of the property to convert.\n * @param propertyType - The type of the property, which determines how the value is processed.\n * @returns The raw byte representation of the property value.\n * @group Implementation\n */\n getSinglePropertyValueRaw(propertyValue, PropertyTypeMap[propertyType]),\n ],\n abi: updateDigitalAssetPropertyAbi,\n },\n options,\n });\n}\n\nconst addDigitalAssetTypedPropertyAbi: EntryFunctionABI = {\n typeParameters: [{ constraints: [MoveAbility.KEY] }, { constraints: [] }],\n parameters: [\n new TypeTagStruct(objectStructTag(new TypeTagGeneric(0))),\n new TypeTagStruct(stringStructTag()),\n new TypeTagGeneric(1),\n ],\n};\n\n/**\n * Creates a transaction to add a typed property to a digital asset.\n * This function helps in customizing digital assets by associating them with specific properties.\n *\n * @param args - The arguments required to create the transaction.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.creator - The account that is creating the transaction.\n * @param args.propertyKey - The key for the property being added.\n * @param args.propertyType - The type of the property being added.\n * @param args.propertyValue - The value of the property being added.\n * @param args.digitalAssetAddress - The address of the digital asset to which the property is being added.\n * @param args.digitalAssetType - (Optional) The type of the digital asset.\n * @param args.options - (Optional) Additional options for generating the transaction.\n * @group Implementation\n */\nexport async function addDigitalAssetTypedPropertyTransaction(args: {\n aptosConfig: AptosConfig;\n creator: Account;\n propertyKey: string;\n propertyType: PropertyType;\n propertyValue: PropertyValue;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const {\n aptosConfig,\n creator,\n propertyKey,\n propertyType,\n propertyValue,\n digitalAssetAddress,\n digitalAssetType,\n options,\n } = args;\n return generateTransaction({\n aptosConfig,\n sender: creator.accountAddress,\n data: {\n function: \"0x4::aptos_token::add_typed_property\",\n typeArguments: [digitalAssetType ?? defaultDigitalAssetType, PropertyTypeMap[propertyType]],\n functionArguments: [AccountAddress.from(digitalAssetAddress), new MoveString(propertyKey), propertyValue],\n abi: addDigitalAssetTypedPropertyAbi,\n },\n options,\n });\n}\n\nconst updateDigitalAssetTypedPropertyAbi: EntryFunctionABI = {\n typeParameters: [{ constraints: [MoveAbility.KEY] }, { constraints: [] }],\n parameters: [\n new TypeTagStruct(objectStructTag(new TypeTagGeneric(0))),\n new TypeTagStruct(stringStructTag()),\n new TypeTagGeneric(1),\n ],\n};\n\n/**\n * Updates the typed property of a digital asset by generating a transaction for the Aptos blockchain.\n *\n * @param args - The arguments for updating the digital asset typed property.\n * @param args.aptosConfig - The configuration settings for the Aptos network.\n * @param args.creator - The account that is creating the transaction.\n * @param args.propertyKey - The key of the property to be updated.\n * @param args.propertyType - The type of the property being updated.\n * @param args.propertyValue - The new value for the property.\n * @param args.digitalAssetAddress - The address of the digital asset to be updated.\n * @param args.digitalAssetType - Optional. The type of the digital asset, if not provided, defaults to the standard type.\n * @param args.options - Optional. Additional options for generating the transaction.\n * @group Implementation\n */\nexport async function updateDigitalAssetTypedPropertyTransaction(args: {\n aptosConfig: AptosConfig;\n creator: Account;\n propertyKey: string;\n propertyType: PropertyType;\n propertyValue: PropertyValue;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const {\n aptosConfig,\n creator,\n propertyKey,\n propertyType,\n propertyValue,\n digitalAssetAddress,\n digitalAssetType,\n options,\n } = args;\n return generateTransaction({\n aptosConfig,\n sender: creator.accountAddress,\n data: {\n function: \"0x4::aptos_token::update_typed_property\",\n typeArguments: [digitalAssetType ?? defaultDigitalAssetType, PropertyTypeMap[propertyType]],\n functionArguments: [AccountAddress.from(digitalAssetAddress), new MoveString(propertyKey), propertyValue],\n abi: updateDigitalAssetTypedPropertyAbi,\n },\n options,\n });\n}\n\nfunction getPropertyValueRaw(propertyValues: Array<PropertyValue>, propertyTypes: Array<string>): Array<Uint8Array> {\n const results = new Array<Uint8Array>();\n propertyTypes.forEach((typ, index) => {\n results.push(getSinglePropertyValueRaw(propertyValues[index], typ));\n });\n\n return results;\n}\n\nfunction getSinglePropertyValueRaw(propertyValue: PropertyValue, propertyType: string): Uint8Array {\n const typeTag = parseTypeTag(propertyType);\n const res = checkOrConvertArgument(propertyValue, typeTag, 0, []);\n return res.bcsToBytes();\n}\n"],"mappings":"AAYA,OAAS,QAAAA,EAAM,cAAAC,EAAY,cAAAC,EAAY,OAAAC,MAAW,SAClD,OAAS,kBAAAC,MAA2C,UAGpD,OAOE,eAAAC,MAMK,WAOP,OACE,qBAAAC,EACA,4BAAAC,EACA,oBAAAC,EACA,gBAAAC,MACK,6BACP,OAAS,gBAAAC,MAAoB,YAC7B,OAAS,uBAAAC,MAA2B,0BACpC,OAAS,mBAAAC,MAAuB,gBAMhC,OACE,0BAAAC,EACA,mBAAAC,EACA,gBAAAC,EACA,mBAAAC,EACA,kBAAAC,EACA,eAAAC,EACA,kBAAAC,EACA,iBAAAC,EACA,cAAAC,EACA,iBAAAC,MACK,kBAIP,MAAMC,EAAkB,CACtB,QAAS,OACT,GAAI,KACJ,IAAK,MACL,IAAK,MACL,IAAK,MACL,KAAM,OACN,KAAM,OACN,QAAS,UACT,OAAQ,sBACR,MAAO,YACT,EAiBMC,EAA0B,oBAahC,eAAsBC,GAAoBC,EAGR,CAChC,KAAM,CAAE,YAAAC,EAAa,oBAAAC,CAAoB,EAAIF,EAEvCG,EAAqD,CACzD,cAAe,CAAE,IAAKzB,EAAe,KAAKwB,CAAmB,EAAE,aAAa,CAAE,CAChF,EAeA,OANa,MAAMlB,EAAgC,CACjD,YAAAiB,EACA,MATmB,CACnB,MAAOlB,EACP,UAAW,CACT,gBAAiBoB,CACnB,CACF,EAKE,aAAc,qBAChB,CAAC,GAEW,uBAAuB,CAAC,CACtC,CAWA,eAAsBC,GAAgCJ,EAGR,CAC5C,KAAM,CAAE,YAAAC,EAAa,oBAAAC,CAAoB,EAAIF,EAEvCG,EAAkD,CACtD,cAAe,CAAE,IAAKzB,EAAe,KAAKwB,CAAmB,EAAE,aAAa,CAAE,EAC9E,OAAQ,CAAE,IAAK,CAAE,CACnB,EAeA,OANa,MAAMlB,EAA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AsCD,EAAiD,CAClH,MAAMuC,EAAU,IAAI,MACpB,OAAAvC,EAAc,QAAQ,CAACwC,EAAKC,IAAU,CACpCF,EAAQ,KAAKT,EAA0B7B,EAAewC,CAAK,EAAGD,CAAG,CAAC,CACpE,CAAC,EAEMD,CACT,CAEA,SAAST,EAA0BD,EAA8BD,EAAkC,CACjG,MAAMc,EAAUlF,EAAaoE,CAAY,EAEzC,OADYtE,EAAuBuE,EAAea,EAAS,EAAG,CAAC,CAAC,EACrD,WAAW,CACxB","names":["Bool","MoveString","MoveVector","U64","AccountAddress","MoveAbility","GetCollectionData","GetCurrentTokenOwnership","GetTokenActivity","GetTokenData","queryIndexer","generateTransaction","MAX_U64_BIG_INT","checkOrConvertArgument","objectStructTag","parseTypeTag","stringStructTag","TypeTagAddress","TypeTagBool","TypeTagGeneric","TypeTagStruct","TypeTagU64","TypeTagVector","PropertyTypeMap","defaultDigitalAssetType","getDigitalAssetData","args","aptosConfig","digitalAssetAddress","whereCondition","getCurrentDigitalAssetOwnership","getOwnedDigitalAssets","ownerAddress","options","graphqlQuery","getDigitalAssetActivity","createCollectionAbi","createCollectionTransaction","creator","getCollectionData","getCollectionDataByCreatorAddressAndCollectionName","creatorAddress","collectionName","address","getCollectionDataByCreatorAddress","getCollectionDataByCollectionId","collectionId","getCollectionId","mintDigitalAssetAbi","mintDigitalAssetTransaction","collection","description","name","uri","propertyKeys","propertyTypes","propertyValues","convertedPropertyType","type","getPropertyValueRaw","transferDigitalAssetAbi","transferDigitalAssetTransaction","sender","recipient","digitalAssetType","mintSoulBoundAbi","mintSoulBoundTransaction","account","burnDigitalAssetAbi","burnDigitalAssetTransaction","freezeDigitalAssetAbi","freezeDigitalAssetTransferTransaction","unfreezeDigitalAssetAbi","unfreezeDigitalAssetTransferTransaction","setDigitalAssetDescriptionAbi","setDigitalAssetDescriptionTransaction","setDigitalAssetNameAbi","setDigitalAssetNameTransaction","setDigitalAssetURIAbi","setDigitalAssetURITransaction","addDigitalAssetPropertyAbi","addDigitalAssetPropertyTransaction","propertyKey","propertyType","propertyValue","getSinglePropertyValueRaw","removeDigitalAssetPropertyAbi","removeDigitalAssetPropertyTransaction","updateDigitalAssetPropertyAbi","updateDigitalAssetPropertyTransaction","addDigitalAssetTypedPropertyAbi","addDigitalAssetTypedPropertyTransaction","updateDigitalAssetTypedPropertyAbi","updateDigitalAssetTypedPropertyTransaction","results","typ","index","typeTag"]}
@@ -1,2 +1,2 @@
1
- import{wd 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 fundAccount};
1
+ import{postAptosFaucet as p}from"../client";import{AccountAddress as u}from"../core";import{TransactionResponseType as d}from"../types";import{DEFAULT_TXN_TIMEOUT_SEC as m}from"../utils/const";import{waitForTransaction as f}from"./transaction";async function F(s){const{aptosConfig:t,accountAddress:r,amount:c,options:n}=s,e=n?.timeoutSecs||m,{data:a}=await p({aptosConfig:t,path:"fund",body:{address:u.from(r).toString(),amount:c},originMethod:"fundAccount"}),i=a.txn_hashes[0],o=await f({aptosConfig:t,transactionHash:i,options:{timeoutSecs:e,checkSuccess:n?.checkSuccess}});if(o.type===d.User)return o;throw new Error(`Unexpected transaction received for fund account: ${o.type}`)}export{F as fundAccount};
2
2
  //# sourceMappingURL=faucet.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"sources":["../../../src/internal/faucet.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/faucet}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * faucet namespace and without having a dependency cycle error.\n * @group Implementation\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { postAptosFaucet } from \"../client\";\nimport { AccountAddress, AccountAddressInput } from \"../core\";\nimport { TransactionResponseType, UserTransactionResponse, WaitForTransactionOptions } from \"../types\";\nimport { DEFAULT_TXN_TIMEOUT_SEC } from \"../utils/const\";\nimport { waitForTransaction } from \"./transaction\";\n\n/**\n * Funds an account with a specified amount of tokens from the Aptos faucet.\n * This function is useful for quickly providing a new or existing account with tokens to facilitate transactions.\n *\n * Note that only devnet has a publicly accessible faucet. For testnet, you must use\n * the minting page at https://aptos.dev/network/faucet.\n *\n * @param args - The arguments for funding the account.\n * @param args.aptosConfig - The configuration settings for connecting to the Aptos network.\n * @param args.accountAddress - The address of the account to be funded.\n * @param args.amount - The amount of tokens to fund the account with.\n * @param args.options - Optional parameters for the transaction.\n * @param args.options.timeoutSecs - The maximum time to wait for the transaction to complete, in seconds.\n * @param args.options.checkSuccess - A flag indicating whether to check if the transaction was successful.\n *\n * @throws Error if the transaction does not return a user transaction type.\n * @group Implementation\n */\nexport async function fundAccount(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n amount: number;\n options?: WaitForTransactionOptions;\n}): Promise<UserTransactionResponse> {\n const { aptosConfig, accountAddress, amount, options } = args;\n const timeout = options?.timeoutSecs || DEFAULT_TXN_TIMEOUT_SEC;\n const { data } = await postAptosFaucet<any, { txn_hashes: Array<string> }>({\n aptosConfig,\n path: \"fund\",\n body: {\n address: AccountAddress.from(accountAddress).toString(),\n amount,\n },\n originMethod: \"fundAccount\",\n });\n\n const txnHash = data.txn_hashes[0];\n\n const res = await waitForTransaction({\n aptosConfig,\n transactionHash: txnHash,\n options: {\n timeoutSecs: timeout,\n checkSuccess: options?.checkSuccess,\n },\n });\n\n // Response is always User transaction for a user submitted transaction\n if (res.type === TransactionResponseType.User) {\n return res;\n }\n\n throw new Error(`Unexpected transaction received for fund account: ${res.type}`);\n}\n"],"mappings":"AAYA,OAAS,mBAAAA,MAAuB,YAChC,OAAS,kBAAAC,MAA2C,UACpD,OAAS,2BAAAC,MAAmF,WAC5F,OAAS,2BAAAC,MAA+B,iBACxC,OAAS,sBAAAC,MAA0B,gBAoBnC,eAAsBC,EAAYC,EAKG,CACnC,KAAM,CAAE,YAAAC,EAAa,eAAAC,EAAgB,OAAAC,EAAQ,QAAAC,CAAQ,EAAIJ,EACnDK,EAAUD,GAAS,aAAeP,EAClC,CAAE,KAAAS,CAAK,EAAI,MAAMZ,EAAoD,CACzE,YAAAO,EACA,KAAM,OACN,KAAM,CACJ,QAASN,EAAe,KAAKO,CAAc,EAAE,SAAS,EACtD,OAAAC,CACF,EACA,aAAc,aAChB,CAAC,EAEKI,EAAUD,EAAK,WAAW,CAAC,EAE3BE,EAAM,MAAMV,EAAmB,CACnC,YAAAG,EACA,gBAAiBM,EACjB,QAAS,CACP,YAAaF,EACb,aAAcD,GAAS,YACzB,CACF,CAAC,EAGD,GAAII,EAAI,OAASZ,EAAwB,KACvC,OAAOY,EAGT,MAAM,IAAI,MAAM,qDAAqDA,EAAI,IAAI,EAAE,CACjF","names":["postAptosFaucet","AccountAddress","TransactionResponseType","DEFAULT_TXN_TIMEOUT_SEC","waitForTransaction","fundAccount","args","aptosConfig","accountAddress","amount","options","timeout","data","txnHash","res"]}
@@ -1,2 +1,2 @@
1
- import{Ad as c,Bd as d,Cd as e,yd as a,zd as b}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{c as getCurrentFungibleAssetBalances,b as getFungibleAssetActivities,a as getFungibleAssetMetadata,d as transferFungibleAsset,e as transferFungibleAssetBetweenStores};
1
+ import{queryIndexer as a}from"./general";import{GetCurrentFungibleAssetBalances as c,GetFungibleAssetActivities as p,GetFungibleAssetMetadata as A}from"../types/generated/queries";import{parseTypeTag as l,TypeTagAddress as f,TypeTagU64 as d}from"../transactions";import{generateTransaction as u}from"./transactionSubmission";async function H(t){const{aptosConfig:n,options:e}=t,s={query:A,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await a({aptosConfig:n,query:s,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function J(t){const{aptosConfig:n,options:e}=t,s={query:p,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await a({aptosConfig:n,query:s,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function K(t){const{aptosConfig:n,options:e}=t,s={query:c,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await a({aptosConfig:n,query:s,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}const g={typeParameters:[{constraints:[]}],parameters:[l("0x1::object::Object"),new f,new d]};async function L(t){const{aptosConfig:n,sender:e,fungibleAssetMetadataAddress:s,recipient:o,amount:i,options:r}=t;return u({aptosConfig:n,sender:e.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[s,o,i],abi:g},options:r})}async function V(t){const{aptosConfig:n,sender:e,fromStore:s,toStore:o,amount:i,options:r}=t;return u({aptosConfig:n,sender:e.accountAddress,data:{function:"0x1::dispatchable_fungible_asset::transfer",typeArguments:["0x1::fungible_asset::FungibleStore"],functionArguments:[s,o,i],abi:g},options:r})}export{K as getCurrentFungibleAssetBalances,J as getFungibleAssetActivities,H as getFungibleAssetMetadata,L as transferFungibleAsset,V as transferFungibleAssetBetweenStores};
2
2
  //# sourceMappingURL=fungibleAsset.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"sources":["../../../src/internal/fungibleAsset.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/fungible_asset}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * fungible_asset namespace and without having a dependency cycle error.\n * @group Implementation\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport {\n AnyNumber,\n GetCurrentFungibleAssetBalancesResponse,\n GetFungibleAssetActivitiesResponse,\n GetFungibleAssetMetadataResponse,\n PaginationArgs,\n WhereArg,\n} from \"../types\";\nimport { queryIndexer } from \"./general\";\nimport {\n GetCurrentFungibleAssetBalances,\n GetFungibleAssetActivities,\n GetFungibleAssetMetadata,\n} from \"../types/generated/queries\";\nimport {\n GetCurrentFungibleAssetBalancesQuery,\n GetFungibleAssetActivitiesQuery,\n GetFungibleAssetMetadataQuery,\n} from \"../types/generated/operations\";\nimport {\n CurrentFungibleAssetBalancesBoolExp,\n FungibleAssetActivitiesBoolExp,\n FungibleAssetMetadataBoolExp,\n} from \"../types/generated/types\";\nimport { AccountAddressInput } from \"../core\";\nimport { Account } from \"../account\";\nimport {\n EntryFunctionABI,\n InputGenerateTransactionOptions,\n parseTypeTag,\n TypeTagAddress,\n TypeTagU64,\n} from \"../transactions\";\nimport { generateTransaction } from \"./transactionSubmission\";\nimport { SimpleTransaction } from \"../transactions/instances/simpleTransaction\";\n\n/**\n * Retrieves metadata for fungible assets based on specified criteria.\n * This function allows you to filter and paginate through fungible asset metadata.\n *\n * @param args - The arguments for the function.\n * @param args.aptosConfig - The configuration for Aptos.\n * @param [args.options] - Optional parameters for pagination and filtering.\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.where] - Conditions to filter the results.\n * @group Implementation\n */\nexport async function getFungibleAssetMetadata(args: {\n aptosConfig: AptosConfig;\n options?: PaginationArgs & WhereArg<FungibleAssetMetadataBoolExp>;\n}): Promise<GetFungibleAssetMetadataResponse> {\n const { aptosConfig, options } = args;\n\n const graphqlQuery = {\n query: GetFungibleAssetMetadata,\n variables: {\n where_condition: options?.where,\n limit: options?.limit,\n offset: options?.offset,\n },\n };\n\n const data = await queryIndexer<GetFungibleAssetMetadataQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getFungibleAssetMetadata\",\n });\n\n return data.fungible_asset_metadata;\n}\n\n/**\n * Retrieves the activities associated with fungible assets.\n * This function allows you to filter and paginate through the activities based on specified conditions.\n *\n * @param args - The arguments for retrieving fungible asset activities.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param [args.options] - Optional parameters for pagination and filtering.\n * @param [args.options.limit] - The maximum number of activities to retrieve.\n * @param [args.options.offset] - The number of activities to skip before starting to collect the result set.\n * @param [args.options.where] - Conditions to filter the activities.\n * @returns A promise that resolves to an array of fungible asset activities.\n * @group Implementation\n */\nexport async function getFungibleAssetActivities(args: {\n aptosConfig: AptosConfig;\n options?: PaginationArgs & WhereArg<FungibleAssetActivitiesBoolExp>;\n}): Promise<GetFungibleAssetActivitiesResponse> {\n const { aptosConfig, options } = args;\n\n const graphqlQuery = {\n query: GetFungibleAssetActivities,\n variables: {\n where_condition: options?.where,\n limit: options?.limit,\n offset: options?.offset,\n },\n };\n\n const data = await queryIndexer<GetFungibleAssetActivitiesQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getFungibleAssetActivities\",\n });\n\n return data.fungible_asset_activities;\n}\n\n/**\n * Retrieves the current balances of fungible assets for a specified configuration.\n *\n * @param args - The arguments for retrieving fungible asset balances.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.options - Optional parameters for pagination and filtering.\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.where - Conditions to filter the results based on specific criteria.\n * @returns The current balances of fungible assets.\n * @group Implementation\n */\nexport async function getCurrentFungibleAssetBalances(args: {\n aptosConfig: AptosConfig;\n options?: PaginationArgs & WhereArg<CurrentFungibleAssetBalancesBoolExp>;\n}): Promise<GetCurrentFungibleAssetBalancesResponse> {\n const { aptosConfig, options } = args;\n\n const graphqlQuery = {\n query: GetCurrentFungibleAssetBalances,\n variables: {\n where_condition: options?.where,\n limit: options?.limit,\n offset: options?.offset,\n },\n };\n\n const data = await queryIndexer<GetCurrentFungibleAssetBalancesQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getCurrentFungibleAssetBalances\",\n });\n\n return data.current_fungible_asset_balances;\n}\n\nconst faTransferAbi: EntryFunctionABI = {\n typeParameters: [{ constraints: [] }],\n parameters: [parseTypeTag(\"0x1::object::Object\"), new TypeTagAddress(), new TypeTagU64()],\n};\n\n/**\n * Transfers a specified amount of a fungible asset from the sender to the recipient.\n * This function helps facilitate the transfer of digital assets between accounts on the Aptos blockchain.\n *\n * @param args - The parameters for the transfer operation.\n * @param args.aptosConfig - The configuration settings for the Aptos network.\n * @param args.sender - The account initiating the transfer.\n * @param args.fungibleAssetMetadataAddress - The address of the fungible asset's metadata.\n * @param args.recipient - The address of the account receiving the asset.\n * @param args.amount - The amount of the fungible asset to transfer.\n * @param args.options - Optional settings for generating the transaction.\n * @group Implementation\n */\nexport async function transferFungibleAsset(args: {\n aptosConfig: AptosConfig;\n sender: Account;\n fungibleAssetMetadataAddress: AccountAddressInput;\n recipient: AccountAddressInput;\n amount: AnyNumber;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, sender, fungibleAssetMetadataAddress, recipient, amount, options } = args;\n return generateTransaction({\n aptosConfig,\n sender: sender.accountAddress,\n data: {\n function: \"0x1::primary_fungible_store::transfer\",\n typeArguments: [\"0x1::fungible_asset::Metadata\"],\n functionArguments: [fungibleAssetMetadataAddress, recipient, amount],\n abi: faTransferAbi,\n },\n options,\n });\n}\n\n/**\n * Transfers a specified amount of a fungible asset from any (primary or secondary) fungible store to any (primary or secondary) fungible store.\n * This function helps facilitate the transfer of digital assets between fungible stores on the Aptos blockchain.\n *\n * @param args - The parameters for the transfer operation.\n * @param args.aptosConfig - The configuration settings for the Aptos network.\n * @param args.sender - The account initiating the transfer.\n * @param args.fromStore - The address of the fungible store initiating the transfer.\n * @param args.toStore - The address of the fungible store receiving the asset.\n * @param args.amount - The amount of the fungible asset to transfer. Must be a positive number.\n * @param args.options - Optional settings for generating the transaction.\n * @returns A SimpleTransaction that can be submitted to the blockchain.\n * @throws Error if the transaction generation fails or if the input parameters are invalid.\n * @group Implementation\n */\nexport async function transferFungibleAssetBetweenStores(args: {\n aptosConfig: AptosConfig;\n sender: Account;\n fromStore: AccountAddressInput;\n toStore: AccountAddressInput;\n amount: AnyNumber;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, sender, fromStore, toStore, amount, options } = args;\n return generateTransaction({\n aptosConfig,\n sender: sender.accountAddress,\n data: {\n function: \"0x1::dispatchable_fungible_asset::transfer\",\n typeArguments: [\"0x1::fungible_asset::FungibleStore\"],\n functionArguments: [fromStore, toStore, amount],\n abi: faTransferAbi,\n },\n options,\n });\n}\n"],"mappings":"AAoBA,OAAS,gBAAAA,MAAoB,YAC7B,OACE,mCAAAC,EACA,8BAAAC,EACA,4BAAAC,MACK,6BAaP,OAGE,gBAAAC,EACA,kBAAAC,EACA,cAAAC,MACK,kBACP,OAAS,uBAAAC,MAA2B,0BAepC,eAAsBC,EAAyBC,EAGD,CAC5C,KAAM,CAAE,YAAAC,EAAa,QAAAC,CAAQ,EAAIF,EAE3BG,EAAe,CACnB,MAAOT,EACP,UAAW,CACT,gBAAiBQ,GAAS,MAC1B,MAAOA,GAAS,MAChB,OAAQA,GAAS,MACnB,CACF,EAQA,OANa,MAAMX,EAA4C,CAC7D,YAAAU,EACA,MAAOE,EACP,aAAc,0BAChB,CAAC,GAEW,uBACd,CAeA,eAAsBC,EAA2BJ,EAGD,CAC9C,KAAM,CAAE,YAAAC,EAAa,QAAAC,CAAQ,EAAIF,EAE3BG,EAAe,CACnB,MAAOV,EACP,UAAW,CACT,gBAAiBS,GAAS,MAC1B,MAAOA,GAAS,MAChB,OAAQA,GAAS,MACnB,CACF,EAQA,OANa,MAAMX,EAA8C,CAC/D,YAAAU,EACA,MAAOE,EACP,aAAc,4BAChB,CAAC,GAEW,yBACd,CAcA,eAAsBE,EAAgCL,EAGD,CACnD,KAAM,CAAE,YAAAC,EAAa,QAAAC,CAAQ,EAAIF,EAE3BG,EAAe,CACnB,MAAOX,EACP,UAAW,CACT,gBAAiBU,GAAS,MAC1B,MAAOA,GAAS,MAChB,OAAQA,GAAS,MACnB,CACF,EAQA,OANa,MAAMX,EAAmD,CACpE,YAAAU,EACA,MAAOE,EACP,aAAc,iCAChB,CAAC,GAEW,+BACd,CAEA,MAAMG,EAAkC,CACtC,eAAgB,CAAC,CAAE,YAAa,CAAC,CAAE,CAAC,EACpC,WAAY,CAACX,EAAa,qBAAqB,EAAG,IAAIC,EAAkB,IAAIC,CAAY,CAC1F,EAeA,eAAsBU,EAAsBP,EAOb,CAC7B,KAAM,CAAE,YAAAC,EAAa,OAAAO,EAAQ,6BAAAC,EAA8B,UAAAC,EAAW,OAAAC,EAAQ,QAAAT,CAAQ,EAAIF,EAC1F,OAAOF,EAAoB,CACzB,YAAAG,EACA,OAAQO,EAAO,eACf,KAAM,CACJ,SAAU,wCACV,cAAe,CAAC,+BAA+B,EAC/C,kBAAmB,CAACC,EAA8BC,EAAWC,CAAM,EACnE,IAAKL,CACP,EACA,QAAAJ,CACF,CAAC,CACH,CAiBA,eAAsBU,EAAmCZ,EAO1B,CAC7B,KAAM,CAAE,YAAAC,EAAa,OAAAO,EAAQ,UAAAK,EAAW,QAAAC,EAAS,OAAAH,EAAQ,QAAAT,CAAQ,EAAIF,EACrE,OAAOF,EAAoB,CACzB,YAAAG,EACA,OAAQO,EAAO,eACf,KAAM,CACJ,SAAU,6CACV,cAAe,CAAC,oCAAoC,EACpD,kBAAmB,CAACK,EAAWC,EAASH,CAAM,EAC9C,IAAKL,CACP,EACA,QAAAJ,CACF,CAAC,CACH","names":["queryIndexer","GetCurrentFungibleAssetBalances","GetFungibleAssetActivities","GetFungibleAssetMetadata","parseTypeTag","TypeTagAddress","TypeTagU64","generateTransaction","getFungibleAssetMetadata","args","aptosConfig","options","graphqlQuery","getFungibleAssetActivities","getCurrentFungibleAssetBalances","faTransferAbi","transferFungibleAsset","sender","fungibleAssetMetadataAddress","recipient","amount","transferFungibleAssetBetweenStores","fromStore","toStore"]}
@@ -1,2 +1,2 @@
1
- import{a,b,c,d,e,f}from"../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-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{b as getChainTopUserTransactions,e as getIndexerLastSuccessVersion,a as getLedgerInfo,f as getProcessorStatus,d as getProcessorStatuses,c as queryIndexer};
1
+ import{getAptosFullNode as i,postAptosIndexer as p}from"../client";import{GetChainTopUserTransactions as c,GetProcessorStatus as a}from"../types/generated/queries";async function x(o){const{aptosConfig:s}=o,{data:e}=await i({aptosConfig:s,originMethod:"getLedgerInfo",path:""});return e}async function A(o){const{aptosConfig:s,limit:e}=o;return(await n({aptosConfig:s,query:{query:c,variables:{limit:e}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function n(o){const{aptosConfig:s,query:e,originMethod:t}=o,{data:r}=await p({aptosConfig:s,originMethod:t??"queryIndexer",path:"",body:e,overrides:{WITH_CREDENTIALS:!1}});return r}async function u(o){const{aptosConfig:s}=o;return(await n({aptosConfig:s,query:{query:a},originMethod:"getProcessorStatuses"})).processor_status}async function w(o){const s=await u({aptosConfig:o.aptosConfig});return BigInt(s[0].last_success_version)}async function _(o){const{aptosConfig:s,processorType:e}=o;return(await n({aptosConfig:s,query:{query:a,variables:{where_condition:{processor:{_eq:e}}}},originMethod:"getProcessorStatus"})).processor_status[0]}export{A as getChainTopUserTransactions,w as getIndexerLastSuccessVersion,x as getLedgerInfo,_ as getProcessorStatus,u as getProcessorStatuses,n as queryIndexer};
2
2
  //# sourceMappingURL=general.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"sources":["../../../src/internal/general.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/general}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * general namespace and without having a dependency cycle error.\n * @group Implementation\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { getAptosFullNode, postAptosIndexer } from \"../client\";\nimport { GetChainTopUserTransactionsResponse, GetProcessorStatusResponse, GraphqlQuery, LedgerInfo } from \"../types\";\nimport { GetChainTopUserTransactionsQuery, GetProcessorStatusQuery } from \"../types/generated/operations\";\nimport { GetChainTopUserTransactions, GetProcessorStatus } from \"../types/generated/queries\";\nimport { ProcessorType } from \"../utils/const\";\n\n/**\n * Retrieves information about the current ledger.\n *\n * @param args - The arguments for retrieving ledger information.\n * @param args.aptosConfig - The configuration object for connecting to the Aptos network.\n * @group Implementation\n */\nexport async function getLedgerInfo(args: { aptosConfig: AptosConfig }): Promise<LedgerInfo> {\n const { aptosConfig } = args;\n const { data } = await getAptosFullNode<{}, LedgerInfo>({\n aptosConfig,\n originMethod: \"getLedgerInfo\",\n path: \"\",\n });\n return data;\n}\n\n/**\n * Retrieves the top user transactions for a specific blockchain chain.\n *\n * @param args - The arguments for the function.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.limit - The maximum number of transactions to retrieve.\n * @returns An array of user transactions.\n * @group Implementation\n */\nexport async function getChainTopUserTransactions(args: {\n aptosConfig: AptosConfig;\n limit: number;\n}): Promise<GetChainTopUserTransactionsResponse> {\n const { aptosConfig, limit } = args;\n const graphqlQuery = {\n query: GetChainTopUserTransactions,\n variables: { limit },\n };\n\n const data = await queryIndexer<GetChainTopUserTransactionsQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getChainTopUserTransactions\",\n });\n\n return data.user_transactions;\n}\n\n/**\n * Executes a GraphQL query against the Aptos indexer and retrieves the resulting data.\n *\n * @param args - The arguments for the query.\n * @param args.aptosConfig - The configuration settings for the Aptos client.\n * @param args.query - The GraphQL query to be executed.\n * @param args.originMethod - An optional string to specify the origin method for tracking purposes.\n * @returns The data returned from the query execution.\n * @group Implementation\n */\nexport async function queryIndexer<T extends {}>(args: {\n aptosConfig: AptosConfig;\n query: GraphqlQuery;\n originMethod?: string;\n}): Promise<T> {\n const { aptosConfig, query, originMethod } = args;\n const { data } = await postAptosIndexer<GraphqlQuery, T>({\n aptosConfig,\n originMethod: originMethod ?? \"queryIndexer\",\n path: \"\",\n body: query,\n overrides: { WITH_CREDENTIALS: false },\n });\n return data;\n}\n\n/**\n * Retrieves the current statuses of processors.\n *\n * @param args - The arguments for the function.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @returns The statuses of the processors.\n * @group Implementation\n */\nexport async function getProcessorStatuses(args: { aptosConfig: AptosConfig }): Promise<GetProcessorStatusResponse> {\n const { aptosConfig } = args;\n\n const graphqlQuery = {\n query: GetProcessorStatus,\n };\n\n const data = await queryIndexer<GetProcessorStatusQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getProcessorStatuses\",\n });\n\n return data.processor_status;\n}\n\n/**\n * Retrieves the last success version from the indexer.\n *\n * @param args - The arguments for the function.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @returns The last success version as a BigInt.\n * @group Implementation\n */\nexport async function getIndexerLastSuccessVersion(args: { aptosConfig: AptosConfig }): Promise<bigint> {\n const response = await getProcessorStatuses({ aptosConfig: args.aptosConfig });\n return BigInt(response[0].last_success_version);\n}\n\n/**\n * Retrieves the status of a specified processor in the Aptos network.\n * This function allows you to check the current operational status of a processor, which can be useful for monitoring and troubleshooting.\n *\n * @param args - The arguments for the function.\n * @param args.aptosConfig - The configuration object for connecting to the Aptos network.\n * @param args.processorType - The type of processor whose status you want to retrieve.\n * @returns The status of the specified processor.\n * @group Implementation\n */\nexport async function getProcessorStatus(args: {\n aptosConfig: AptosConfig;\n processorType: ProcessorType;\n}): Promise<GetProcessorStatusResponse[0]> {\n const { aptosConfig, processorType } = args;\n\n const whereCondition: { processor: { _eq: string } } = {\n processor: { _eq: processorType },\n };\n\n const graphqlQuery = {\n query: GetProcessorStatus,\n variables: {\n where_condition: whereCondition,\n },\n };\n\n const data = await queryIndexer<GetProcessorStatusQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getProcessorStatus\",\n });\n\n return data.processor_status[0];\n}\n"],"mappings":"AAYA,OAAS,oBAAAA,EAAkB,oBAAAC,MAAwB,YAGnD,OAAS,+BAAAC,EAA6B,sBAAAC,MAA0B,6BAUhE,eAAsBC,EAAcC,EAAyD,CAC3F,KAAM,CAAE,YAAAC,CAAY,EAAID,EAClB,CAAE,KAAAE,CAAK,EAAI,MAAMP,EAAiC,CACtD,YAAAM,EACA,aAAc,gBACd,KAAM,EACR,CAAC,EACD,OAAOC,CACT,CAWA,eAAsBC,EAA4BH,EAGD,CAC/C,KAAM,CAAE,YAAAC,EAAa,MAAAG,CAAM,EAAIJ,EAY/B,OANa,MAAMK,EAA+C,CAChE,YAAAJ,EACA,MAPmB,CACnB,MAAOJ,EACP,UAAW,CAAE,MAAAO,CAAM,CACrB,EAKE,aAAc,6BAChB,CAAC,GAEW,iBACd,CAYA,eAAsBC,EAA2BL,EAIlC,CACb,KAAM,CAAE,YAAAC,EAAa,MAAAK,EAAO,aAAAC,CAAa,EAAIP,EACvC,CAAE,KAAAE,CAAK,EAAI,MAAMN,EAAkC,CACvD,YAAAK,EACA,aAAcM,GAAgB,eAC9B,KAAM,GACN,KAAMD,EACN,UAAW,CAAE,iBAAkB,EAAM,CACvC,CAAC,EACD,OAAOJ,CACT,CAUA,eAAsBM,EAAqBR,EAAyE,CAClH,KAAM,CAAE,YAAAC,CAAY,EAAID,EAYxB,OANa,MAAMK,EAAsC,CACvD,YAAAJ,EACA,MANmB,CACnB,MAAOH,CACT,EAKE,aAAc,sBAChB,CAAC,GAEW,gBACd,CAUA,eAAsBW,EAA6BT,EAAqD,CACtG,MAAMU,EAAW,MAAMF,EAAqB,CAAE,YAAaR,EAAK,WAAY,CAAC,EAC7E,OAAO,OAAOU,EAAS,CAAC,EAAE,oBAAoB,CAChD,CAYA,eAAsBC,EAAmBX,EAGE,CACzC,KAAM,CAAE,YAAAC,EAAa,cAAAW,CAAc,EAAIZ,EAmBvC,OANa,MAAMK,EAAsC,CACvD,YAAAJ,EACA,MATmB,CACnB,MAAOH,EACP,UAAW,CACT,gBAPmD,CACrD,UAAW,CAAE,IAAKc,CAAc,CAClC,CAME,CACF,EAKE,aAAc,oBAChB,CAAC,GAEW,iBAAiB,CAAC,CAChC","names":["getAptosFullNode","postAptosIndexer","GetChainTopUserTransactions","GetProcessorStatus","getLedgerInfo","args","aptosConfig","data","getChainTopUserTransactions","limit","queryIndexer","query","originMethod","getProcessorStatuses","getIndexerLastSuccessVersion","response","getProcessorStatus","processorType"]}
@@ -1,2 +1,2 @@
1
- import{le as a,me as b,ne as c,oe as d}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{c as deriveKeylessAccount,a as getPepper,b as getProof,d as updateFederatedKeylessJwkSetTransaction};
1
+ import{jwtDecode as A}from"jwt-decode";import{postAptosPepperService as k,postAptosProvingService as x}from"../client";import{EphemeralSignature as E,Groth16Zkp as b,Hex as u,KeylessPublicKey as S,ZeroKnowledgeSig as C,ZkProof as v,getKeylessConfig as g}from"../core";import{ZkpVariant as _}from"../types";import{KeylessAccount as y}from"../account";import{lookupOriginalAccountAddress as P}from"./account";import{FederatedKeylessPublicKey as j}from"../core/crypto/federatedKeyless";import{FederatedKeylessAccount as H}from"../account/FederatedKeylessAccount";import{MoveVector as f}from"../bcs";import{generateTransaction as F}from"./transactionSubmission";import{KeylessError as I,KeylessErrorType as T}from"../errors";import{FIREBASE_AUTH_ISS_PATTERN as R}from"../utils/const";async function h(r){const{aptosConfig:i,jwt:a,ephemeralKeyPair:e,uidKey:p="sub",derivationPath:s}=r,t={jwt_b64:a,epk:e.getPublicKey().bcsToHex().toStringWithoutPrefix(),exp_date_secs:e.expiryDateSecs,epk_blinder:u.fromHexInput(e.blinder).toStringWithoutPrefix(),uid_key:p,derivation_path:s},{data:n}=await k({aptosConfig:i,path:"fetch",body:t,originMethod:"getPepper",overrides:{WITH_CREDENTIALS:!1}});return u.fromHexInput(n.pepper).toUint8Array()}async function W(r){const{aptosConfig:i,jwt:a,ephemeralKeyPair:e,pepper:p=await h(r),uidKey:s="sub",maxExpHorizonSecs:t=(await g({aptosConfig:i})).maxExpHorizonSecs}=r;if(u.fromHexInput(p).toUint8Array().length!==y.PEPPER_LENGTH)throw new Error(`Pepper needs to be ${y.PEPPER_LENGTH} bytes`);const n=A(a);if(typeof n.iat!="number")throw new Error("iat was not found");if(t<e.expiryDateSecs-n.iat)throw Error(`The EphemeralKeyPair is too long lived. It's lifespan must be less than ${t}`);const o={jwt_b64:a,epk:e.getPublicKey().bcsToHex().toStringWithoutPrefix(),epk_blinder:u.fromHexInput(e.blinder).toStringWithoutPrefix(),exp_date_secs:e.expiryDateSecs,exp_horizon_secs:t,pepper:u.fromHexInput(p).toStringWithoutPrefix(),uid_key:s},{data:c}=await x({aptosConfig:i,path:"prove",body:o,originMethod:"getProof",overrides:{WITH_CREDENTIALS:!1}}),d=c.proof,l=new b({a:d.a,b:d.b,c:d.c});return new C({proof:new v(l,_.Groth16),trainingWheelsSignature:E.fromHex(c.training_wheels_signature),expHorizonSecs:t})}async function fe(r){const{aptosConfig:i,jwt:a,jwkAddress:e,uidKey:p,proofFetchCallback:s,pepper:t=await h(r)}=r,{verificationKey:n,maxExpHorizonSecs:o}=await g({aptosConfig:i}),c=W({...r,pepper:t,maxExpHorizonSecs:o}),d=s?c:await c;if(e!==void 0){const w=j.fromJwtAndPepper({jwt:a,pepper:t,jwkAddress:e,uidKey:p}),K=await P({aptosConfig:i,authenticationKey:w.authKey().derivedAddress()});return H.create({...r,address:K,proof:d,pepper:t,proofFetchCallback:s,jwkAddress:e,verificationKey:n})}const l=S.fromJwtAndPepper({jwt:a,pepper:t,uidKey:p}),m=await P({aptosConfig:i,authenticationKey:l.authKey().derivedAddress()});return y.create({...r,address:m,proof:d,pepper:t,proofFetchCallback:s,verificationKey:n})}async function le(r){const{aptosConfig:i,sender:a,iss:e,options:p}=r;let{jwksUrl:s}=r;s===void 0&&(R.test(e)?s="https://www.googleapis.com/service_accounts/v1/jwk/securetoken@system.gserviceaccount.com":s=e.endsWith("/")?`${e}.well-known/jwks.json`:`${e}/.well-known/jwks.json`);let t;try{if(t=await fetch(s),!t.ok)throw new Error(`${t.status} ${t.statusText}`)}catch(o){let c;throw o instanceof Error?c=`${o.message}`:c=`error unknown - ${o}`,I.fromErrorType({type:T.JWK_FETCH_FAILED_FEDERATED,details:`Failed to fetch JWKS at ${s}: ${c}`})}const n=await t.json();return F({aptosConfig:i,sender:a.accountAddress,data:{function:"0x1::jwks::update_federated_jwk_set",functionArguments:[e,f.MoveString(n.keys.map(o=>o.kid)),f.MoveString(n.keys.map(o=>o.alg)),f.MoveString(n.keys.map(o=>o.e)),f.MoveString(n.keys.map(o=>o.n))]},options:p})}export{fe as deriveKeylessAccount,h as getPepper,W as getProof,le as updateFederatedKeylessJwkSetTransaction};
2
2
  //# sourceMappingURL=keyless.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"sources":["../../../src/internal/keyless.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file contains the underlying implementations for exposed API surface in\n * the {@link api/keyless}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * keyless namespace and without having a dependency cycle error.\n * @group Implementation\n */\nimport { jwtDecode, JwtPayload } from \"jwt-decode\";\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { postAptosPepperService, postAptosProvingService } from \"../client\";\nimport {\n AccountAddressInput,\n EphemeralSignature,\n Groth16Zkp,\n Hex,\n KeylessPublicKey,\n MoveJWK,\n ZeroKnowledgeSig,\n ZkProof,\n getKeylessConfig,\n} from \"../core\";\nimport { HexInput, ZkpVariant } from \"../types\";\nimport { Account, EphemeralKeyPair, KeylessAccount, ProofFetchCallback } from \"../account\";\nimport { PepperFetchRequest, PepperFetchResponse, ProverRequest, ProverResponse } from \"../types/keyless\";\nimport { lookupOriginalAccountAddress } from \"./account\";\nimport { FederatedKeylessPublicKey } from \"../core/crypto/federatedKeyless\";\nimport { FederatedKeylessAccount } from \"../account/FederatedKeylessAccount\";\nimport { MoveVector } from \"../bcs\";\nimport { generateTransaction } from \"./transactionSubmission\";\nimport { InputGenerateTransactionOptions, SimpleTransaction } from \"../transactions\";\nimport { KeylessError, KeylessErrorType } from \"../errors\";\nimport { FIREBASE_AUTH_ISS_PATTERN } from \"../utils/const\";\n\n/**\n * Retrieves a pepper value based on the provided configuration and authentication details.\n *\n * @param args - The arguments required to fetch the pepper.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.jwt - The JSON Web Token used for authentication.\n * @param args.ephemeralKeyPair - The ephemeral key pair used for the operation.\n * @param args.uidKey - An optional unique identifier key (defaults to \"sub\").\n * @param args.derivationPath - An optional derivation path for the key.\n * @returns A Uint8Array containing the fetched pepper value.\n * @group Implementation\n */\nexport async function getPepper(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n uidKey?: string;\n derivationPath?: string;\n}): Promise<Uint8Array> {\n const { aptosConfig, jwt, ephemeralKeyPair, uidKey = \"sub\", derivationPath } = args;\n\n const body = {\n jwt_b64: jwt,\n epk: ephemeralKeyPair.getPublicKey().bcsToHex().toStringWithoutPrefix(),\n exp_date_secs: ephemeralKeyPair.expiryDateSecs,\n epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),\n uid_key: uidKey,\n derivation_path: derivationPath,\n };\n const { data } = await postAptosPepperService<PepperFetchRequest, PepperFetchResponse>({\n aptosConfig,\n path: \"fetch\",\n body,\n originMethod: \"getPepper\",\n overrides: { WITH_CREDENTIALS: false },\n });\n return Hex.fromHexInput(data.pepper).toUint8Array();\n}\n\n/**\n * Generates a zero-knowledge proof based on the provided parameters.\n * This function is essential for creating a signed proof that can be used in various cryptographic operations.\n *\n * @param args - The parameters required to generate the proof.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.jwt - The JSON Web Token used for authentication.\n * @param args.ephemeralKeyPair - The ephemeral key pair used for generating the proof.\n * @param args.pepper - An optional hex input used to enhance security (default is generated if not provided).\n * @param args.uidKey - An optional string that specifies the unique identifier key (defaults to \"sub\").\n * @throws Error if the pepper length is not valid or if the ephemeral key pair's lifespan exceeds the maximum allowed.\n * @group Implementation\n */\nexport async function getProof(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n pepper?: HexInput;\n uidKey?: string;\n maxExpHorizonSecs?: number;\n}): Promise<ZeroKnowledgeSig> {\n const {\n aptosConfig,\n jwt,\n ephemeralKeyPair,\n pepper = await getPepper(args),\n uidKey = \"sub\",\n maxExpHorizonSecs = (await getKeylessConfig({ aptosConfig })).maxExpHorizonSecs,\n } = args;\n if (Hex.fromHexInput(pepper).toUint8Array().length !== KeylessAccount.PEPPER_LENGTH) {\n throw new Error(`Pepper needs to be ${KeylessAccount.PEPPER_LENGTH} bytes`);\n }\n const decodedJwt = jwtDecode<JwtPayload>(jwt);\n if (typeof decodedJwt.iat !== \"number\") {\n throw new Error(\"iat was not found\");\n }\n if (maxExpHorizonSecs < ephemeralKeyPair.expiryDateSecs - decodedJwt.iat) {\n throw Error(`The EphemeralKeyPair is too long lived. It's lifespan must be less than ${maxExpHorizonSecs}`);\n }\n const json = {\n jwt_b64: jwt,\n epk: ephemeralKeyPair.getPublicKey().bcsToHex().toStringWithoutPrefix(),\n epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),\n exp_date_secs: ephemeralKeyPair.expiryDateSecs,\n exp_horizon_secs: maxExpHorizonSecs,\n pepper: Hex.fromHexInput(pepper).toStringWithoutPrefix(),\n uid_key: uidKey,\n };\n\n const { data } = await postAptosProvingService<ProverRequest, ProverResponse>({\n aptosConfig,\n path: \"prove\",\n body: json,\n originMethod: \"getProof\",\n overrides: { WITH_CREDENTIALS: false },\n });\n\n const proofPoints = data.proof;\n const groth16Zkp = new Groth16Zkp({\n a: proofPoints.a,\n b: proofPoints.b,\n c: proofPoints.c,\n });\n\n const signedProof = new ZeroKnowledgeSig({\n proof: new ZkProof(groth16Zkp, ZkpVariant.Groth16),\n trainingWheelsSignature: EphemeralSignature.fromHex(data.training_wheels_signature),\n expHorizonSecs: maxExpHorizonSecs,\n });\n return signedProof;\n}\n\n/**\n * Derives a keyless account by fetching the necessary proof and looking up the original account address.\n * This function helps in creating a keyless account that can be used without managing private keys directly.\n *\n * @param args - The arguments required to derive the keyless account.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.jwt - The JSON Web Token used for authentication.\n * @param args.ephemeralKeyPair - The ephemeral key pair used for cryptographic operations.\n * @param args.uidKey - An optional unique identifier key for the user.\n * @param args.pepper - An optional hexadecimal input used for additional security.\n * @param args.proofFetchCallback - An optional callback function to handle the proof fetch outcome.\n * @returns A keyless account object.\n * @group Implementation\n */\nexport async function deriveKeylessAccount(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n uidKey?: string;\n pepper?: HexInput;\n proofFetchCallback?: ProofFetchCallback;\n}): Promise<KeylessAccount>;\n\nexport async function deriveKeylessAccount(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n jwkAddress: AccountAddressInput;\n uidKey?: string;\n pepper?: HexInput;\n proofFetchCallback?: ProofFetchCallback;\n}): Promise<FederatedKeylessAccount>;\n\nexport async function deriveKeylessAccount(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n jwkAddress?: AccountAddressInput;\n uidKey?: string;\n pepper?: HexInput;\n proofFetchCallback?: ProofFetchCallback;\n}): Promise<KeylessAccount | FederatedKeylessAccount>;\n\nexport async function deriveKeylessAccount(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n jwkAddress?: AccountAddressInput;\n uidKey?: string;\n pepper?: HexInput;\n proofFetchCallback?: ProofFetchCallback;\n}): Promise<KeylessAccount | FederatedKeylessAccount> {\n const { aptosConfig, jwt, jwkAddress, uidKey, proofFetchCallback, pepper = await getPepper(args) } = args;\n const { verificationKey, maxExpHorizonSecs } = await getKeylessConfig({ aptosConfig });\n\n const proofPromise = getProof({ ...args, pepper, maxExpHorizonSecs });\n // If a callback is provided, pass in the proof as a promise to KeylessAccount.create. This will make the proof be fetched in the\n // background and the callback will handle the outcome of the fetch. This allows the developer to not have to block on the proof fetch\n // allowing for faster rendering of UX.\n //\n // If no callback is provided, the just await the proof fetch and continue synchronously.\n const proof = proofFetchCallback ? proofPromise : await proofPromise;\n\n // Look up the original address to handle key rotations and then instantiate the account.\n if (jwkAddress !== undefined) {\n const publicKey = FederatedKeylessPublicKey.fromJwtAndPepper({ jwt, pepper, jwkAddress, uidKey });\n const address = await lookupOriginalAccountAddress({\n aptosConfig,\n authenticationKey: publicKey.authKey().derivedAddress(),\n });\n\n return FederatedKeylessAccount.create({\n ...args,\n address,\n proof,\n pepper,\n proofFetchCallback,\n jwkAddress,\n verificationKey,\n });\n }\n\n const publicKey = KeylessPublicKey.fromJwtAndPepper({ jwt, pepper, uidKey });\n const address = await lookupOriginalAccountAddress({\n aptosConfig,\n authenticationKey: publicKey.authKey().derivedAddress(),\n });\n return KeylessAccount.create({ ...args, address, proof, pepper, proofFetchCallback, verificationKey });\n}\n\nexport interface JWKS {\n keys: MoveJWK[];\n}\n\nexport async function updateFederatedKeylessJwkSetTransaction(args: {\n aptosConfig: AptosConfig;\n sender: Account;\n iss: string;\n jwksUrl?: string;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, sender, iss, options } = args;\n\n let { jwksUrl } = args;\n\n if (jwksUrl === undefined) {\n if (FIREBASE_AUTH_ISS_PATTERN.test(iss)) {\n jwksUrl = \"https://www.googleapis.com/service_accounts/v1/jwk/securetoken@system.gserviceaccount.com\";\n } else {\n jwksUrl = iss.endsWith(\"/\") ? `${iss}.well-known/jwks.json` : `${iss}/.well-known/jwks.json`;\n }\n }\n\n let response: Response;\n\n try {\n response = await fetch(jwksUrl);\n if (!response.ok) {\n throw new Error(`${response.status} ${response.statusText}`);\n }\n } catch (error) {\n let errorMessage: string;\n if (error instanceof Error) {\n errorMessage = `${error.message}`;\n } else {\n errorMessage = `error unknown - ${error}`;\n }\n throw KeylessError.fromErrorType({\n type: KeylessErrorType.JWK_FETCH_FAILED_FEDERATED,\n details: `Failed to fetch JWKS at ${jwksUrl}: ${errorMessage}`,\n });\n }\n\n const jwks: JWKS = await response.json();\n return generateTransaction({\n aptosConfig,\n sender: sender.accountAddress,\n data: {\n function: \"0x1::jwks::update_federated_jwk_set\",\n functionArguments: [\n iss,\n MoveVector.MoveString(jwks.keys.map((key) => key.kid)),\n MoveVector.MoveString(jwks.keys.map((key) => key.alg)),\n MoveVector.MoveString(jwks.keys.map((key) => key.e)),\n MoveVector.MoveString(jwks.keys.map((key) => key.n)),\n ],\n },\n options,\n });\n}\n"],"mappings":"AAUA,OAAS,aAAAA,MAA6B,aAEtC,OAAS,0BAAAC,EAAwB,2BAAAC,MAA+B,YAChE,OAEE,sBAAAC,EACA,cAAAC,EACA,OAAAC,EACA,oBAAAC,EAEA,oBAAAC,EACA,WAAAC,EACA,oBAAAC,MACK,UACP,OAAmB,cAAAC,MAAkB,WACrC,OAAoC,kBAAAC,MAA0C,aAE9E,OAAS,gCAAAC,MAAoC,YAC7C,OAAS,6BAAAC,MAAiC,kCAC1C,OAAS,2BAAAC,MAA+B,qCACxC,OAAS,cAAAC,MAAkB,SAC3B,OAAS,uBAAAC,MAA2B,0BAEpC,OAAS,gBAAAC,EAAc,oBAAAC,MAAwB,YAC/C,OAAS,6BAAAC,MAAiC,iBAc1C,eAAsBC,EAAUC,EAMR,CACtB,KAAM,CAAE,YAAAC,EAAa,IAAAC,EAAK,iBAAAC,EAAkB,OAAAC,EAAS,MAAO,eAAAC,CAAe,EAAIL,EAEzEM,EAAO,CACX,QAASJ,EACT,IAAKC,EAAiB,aAAa,EAAE,SAAS,EAAE,sBAAsB,EACtE,cAAeA,EAAiB,eAChC,YAAanB,EAAI,aAAamB,EAAiB,OAAO,EAAE,sBAAsB,EAC9E,QAASC,EACT,gBAAiBC,CACnB,EACM,CAAE,KAAAE,CAAK,EAAI,MAAM3B,EAAgE,CACrF,YAAAqB,EACA,KAAM,QACN,KAAAK,EACA,aAAc,YACd,UAAW,CAAE,iBAAkB,EAAM,CACvC,CAAC,EACD,OAAOtB,EAAI,aAAauB,EAAK,MAAM,EAAE,aAAa,CACpD,CAeA,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SAAS,GAAG,EAAI,GAAGA,CAAG,wBAA0B,GAAGA,CAAG,0BAIxE,IAAIG,EAEJ,GAAI,CAEF,GADAA,EAAW,MAAM,MAAMD,CAAO,EAC1B,CAACC,EAAS,GACZ,MAAM,IAAI,MAAM,GAAGA,EAAS,MAAM,IAAIA,EAAS,UAAU,EAAE,CAE/D,OAASC,EAAO,CACd,IAAIC,EACJ,MAAID,aAAiB,MACnBC,EAAe,GAAGD,EAAM,OAAO,GAE/BC,EAAe,mBAAmBD,CAAK,GAEnCjC,EAAa,cAAc,CAC/B,KAAMC,EAAiB,2BACvB,QAAS,2BAA2B8B,CAAO,KAAKG,CAAY,EAC9D,CAAC,CACH,CAEA,MAAMC,EAAa,MAAMH,EAAS,KAAK,EACvC,OAAOjC,EAAoB,CACzB,YAAAM,EACA,OAAQuB,EAAO,eACf,KAAM,CACJ,SAAU,sCACV,kBAAmB,CACjBC,EACA/B,EAAW,WAAWqC,EAAK,KAAK,IAAKC,GAAQA,EAAI,GAAG,CAAC,EACrDtC,EAAW,WAAWqC,EAAK,KAAK,IAAKC,GAAQA,EAAI,GAAG,CAAC,EACrDtC,EAAW,WAAWqC,EAAK,KAAK,IAAKC,GAAQA,EAAI,CAAC,CAAC,EACnDtC,EAAW,WAAWqC,EAAK,KAAK,IAAKC,GAAQA,EAAI,CAAC,CAAC,CACrD,CACF,EACA,QAAAN,CACF,CAAC,CACH","names":["jwtDecode","postAptosPepperService","postAptosProvingService","EphemeralSignature","Groth16Zkp","Hex","KeylessPublicKey","ZeroKnowledgeSig","ZkProof","getKeylessConfig","ZkpVariant","KeylessAccount","lookupOriginalAccountAddress","FederatedKeylessPublicKey","FederatedKeylessAccount","MoveVector","generateTransaction","KeylessError","KeylessErrorType","FIREBASE_AUTH_ISS_PATTERN","getPepper","args","aptosConfig","jwt","ephemeralKeyPair","uidKey","derivationPath","body","data","getProof","pepper","maxExpHorizonSecs","decodedJwt","json","proofPoints","groth16Zkp","deriveKeylessAccount","jwkAddress","proofFetchCallback","verificationKey","proofPromise","proof","publicKey","address","updateFederatedKeylessJwkSetTransaction","sender","iss","options","jwksUrl","response","error","errorMessage","jwks","key"]}
@@ -1,2 +1,2 @@
1
- import{qe as a,re as b}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 getObjectData,b as getObjectDataByObjectAddress};
1
+ import{AccountAddress as a}from"../core";import{GetObjectData as i}from"../types/generated/queries";import{queryIndexer as c}from"./general";async function d(e){const{aptosConfig:o,options:t}=e,r={query:i,variables:{where_condition:t?.where,offset:t?.offset,limit:t?.limit,order_by:t?.orderBy}};return(await c({aptosConfig:o,query:r,originMethod:"getObjectData"})).current_objects}async function B(e){const{aptosConfig:o,objectAddress:t,options:r}=e,n={object_address:{_eq:a.from(t).toStringLong()}};return(await d({aptosConfig:o,options:{...r,where:n}}))[0]}export{d as getObjectData,B as getObjectDataByObjectAddress};
2
2
  //# sourceMappingURL=object.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"sources":["../../../src/internal/object.ts"],"sourcesContent":["import { AptosConfig } from \"../api/aptosConfig\";\nimport { AccountAddressInput, AccountAddress } from \"../core\";\nimport { PaginationArgs, OrderByArg, GetObjectDataQueryResponse, WhereArg } from \"../types\";\nimport { GetObjectDataQuery } from \"../types/generated/operations\";\nimport { GetObjectData } from \"../types/generated/queries\";\nimport { CurrentObjectsBoolExp } from \"../types/generated/types\";\nimport { queryIndexer } from \"./general\";\n\n/**\n * Retrieves the current objects based on specified filtering and pagination options.\n *\n * @param args - The arguments for retrieving object data.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param [args.options] - Optional parameters for pagination and filtering.\n * @param [args.options.offset] - The number of items to skip before starting to collect the result set.\n * @param [args.options.limit] - The maximum number of items to return.\n * @param [args.options.orderBy] - The criteria for ordering the results.\n * @param [args.options.where] - The conditions to filter the results.\n * @returns The current objects that match the specified criteria.\n * @group Implementation\n */\nexport async function getObjectData(args: {\n aptosConfig: AptosConfig;\n options?: PaginationArgs & OrderByArg<GetObjectDataQueryResponse[0]> & WhereArg<CurrentObjectsBoolExp>;\n}): Promise<GetObjectDataQueryResponse> {\n const { aptosConfig, options } = args;\n\n const graphqlQuery = {\n query: GetObjectData,\n variables: {\n where_condition: options?.where,\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: \"getObjectData\",\n });\n\n return data.current_objects;\n}\n\n/**\n * Retrieves the object data associated with a specific object address.\n * This function allows you to access detailed information about an object in the Aptos blockchain.\n *\n * @param args - The arguments for retrieving object data.\n * @param args.aptosConfig - The configuration for connecting to the Aptos blockchain.\n * @param args.objectAddress - The address of the object whose data is being retrieved.\n * @param args.options - Optional parameters for pagination and ordering of the results.\n * @group Implementation\n */\nexport async function getObjectDataByObjectAddress(args: {\n aptosConfig: AptosConfig;\n objectAddress: AccountAddressInput;\n options?: PaginationArgs & OrderByArg<GetObjectDataQueryResponse[0]>;\n}): Promise<GetObjectDataQueryResponse[0]> {\n const { aptosConfig, objectAddress, options } = args;\n const address = AccountAddress.from(objectAddress).toStringLong();\n\n const whereCondition: { object_address: { _eq: string } } = {\n object_address: { _eq: address },\n };\n return (await getObjectData({ aptosConfig, options: { ...options, where: whereCondition } }))[0];\n}\n"],"mappings":"AACA,OAA8B,kBAAAA,MAAsB,UAGpD,OAAS,iBAAAC,MAAqB,6BAE9B,OAAS,gBAAAC,MAAoB,YAe7B,eAAsBC,EAAcC,EAGI,CACtC,KAAM,CAAE,YAAAC,EAAa,QAAAC,CAAQ,EAAIF,EAE3BG,EAAe,CACnB,MAAON,EACP,UAAW,CACT,gBAAiBK,GAAS,MAC1B,OAAQA,GAAS,OACjB,MAAOA,GAAS,MAChB,SAAUA,GAAS,OACrB,CACF,EAOA,OANa,MAAMJ,EAAiC,CAClD,YAAAG,EACA,MAAOE,EACP,aAAc,eAChB,CAAC,GAEW,eACd,CAYA,eAAsBC,EAA6BJ,EAIR,CACzC,KAAM,CAAE,YAAAC,EAAa,cAAAI,EAAe,QAAAH,CAAQ,EAAIF,EAG1CM,EAAsD,CAC1D,eAAgB,CAAE,IAHJV,EAAe,KAAKS,CAAa,EAAE,aAAa,CAG/B,CACjC,EACA,OAAQ,MAAMN,EAAc,CAAE,YAAAE,EAAa,QAAS,CAAE,GAAGC,EAAS,MAAOI,CAAe,CAAE,CAAC,GAAG,CAAC,CACjG","names":["AccountAddress","GetObjectData","queryIndexer","getObjectData","args","aptosConfig","options","graphqlQuery","getObjectDataByObjectAddress","objectAddress","whereCondition"]}
@@ -1,2 +1,2 @@
1
- import{$d as b,_d as a,ae as c}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{c as getDelegatedStakingActivities,a as getNumberOfDelegators,b as getNumberOfDelegatorsForAllPools};
1
+ import{AccountAddress as a}from"../core";import{GetDelegatedStakingActivities as g,GetNumberOfDelegators as d}from"../types/generated/queries";import{queryIndexer as i}from"./general";async function O(e){const{aptosConfig:t,poolAddress:o}=e,r=a.from(o).toStringLong(),n=await i({aptosConfig:t,query:{query:d,variables:{where_condition:{pool_address:{_eq:r}}}}});return n.num_active_delegator_per_pool[0]?n.num_active_delegator_per_pool[0].num_active_delegator:0}async function C(e){const{aptosConfig:t,options:o}=e,r={query:d,variables:{order_by:o?.orderBy}};return(await i({aptosConfig:t,query:r})).num_active_delegator_per_pool}async function q(e){const{aptosConfig:t,delegatorAddress:o,poolAddress:r}=e,s={query:g,variables:{delegatorAddress:a.from(o).toStringLong(),poolAddress:a.from(r).toStringLong()}};return(await i({aptosConfig:t,query:s})).delegated_staking_activities}export{q as getDelegatedStakingActivities,O as getNumberOfDelegators,C as getNumberOfDelegatorsForAllPools};
2
2
  //# sourceMappingURL=staking.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"sources":["../../../src/internal/staking.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/staking}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * staking namespace and without having a dependency cycle error.\n * @group Implementation\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { AccountAddress, AccountAddressInput } from \"../core\";\nimport { GetDelegatedStakingActivitiesResponse, GetNumberOfDelegatorsResponse, OrderByArg } from \"../types\";\nimport { GetDelegatedStakingActivitiesQuery, GetNumberOfDelegatorsQuery } from \"../types/generated/operations\";\nimport { GetDelegatedStakingActivities, GetNumberOfDelegators } from \"../types/generated/queries\";\nimport { queryIndexer } from \"./general\";\n\n/**\n * Retrieves the number of active delegators for a specified pool address.\n *\n * @param args - The arguments for the function.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.poolAddress - The address of the pool for which to retrieve the number of delegators.\n * @returns The number of active delegators for the specified pool address.\n * @group Implementation\n */\nexport async function getNumberOfDelegators(args: {\n aptosConfig: AptosConfig;\n poolAddress: AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, poolAddress } = args;\n const address = AccountAddress.from(poolAddress).toStringLong();\n const query = {\n query: GetNumberOfDelegators,\n variables: { where_condition: { pool_address: { _eq: address } } },\n };\n const data = await queryIndexer<GetNumberOfDelegatorsQuery>({ aptosConfig, query });\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.num_active_delegator_per_pool[0] ? data.num_active_delegator_per_pool[0].num_active_delegator : 0;\n}\n\n/**\n * Retrieves the number of active delegators for all pools.\n *\n * @param args - The arguments for the function.\n * @param args.aptosConfig - The configuration for the Aptos client.\n * @param [args.options] - Optional parameters for ordering the results.\n * @param args.options.orderBy - Specifies the order in which to return the results.\n * @returns The number of active delegators per pool.\n * @group Implementation\n */\nexport async function getNumberOfDelegatorsForAllPools(args: {\n aptosConfig: AptosConfig;\n options?: OrderByArg<GetNumberOfDelegatorsResponse[0]>;\n}): Promise<GetNumberOfDelegatorsResponse> {\n const { aptosConfig, options } = args;\n const query = {\n query: GetNumberOfDelegators,\n variables: { order_by: options?.orderBy },\n };\n const data = await queryIndexer<GetNumberOfDelegatorsQuery>({\n aptosConfig,\n query,\n });\n return data.num_active_delegator_per_pool;\n}\n\n/**\n * Retrieves the delegated staking activities for a specified delegator and pool.\n *\n * @param args - The parameters for the query.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.delegatorAddress - The address of the delegator whose activities are being queried.\n * @param args.poolAddress - The address of the pool associated with the delegated staking activities.\n * @returns The delegated staking activities for the specified delegator and pool.\n * @group Implementation\n */\nexport async function getDelegatedStakingActivities(args: {\n aptosConfig: AptosConfig;\n delegatorAddress: AccountAddressInput;\n poolAddress: AccountAddressInput;\n}): Promise<GetDelegatedStakingActivitiesResponse> {\n const { aptosConfig, delegatorAddress, poolAddress } = args;\n const query = {\n query: GetDelegatedStakingActivities,\n variables: {\n delegatorAddress: AccountAddress.from(delegatorAddress).toStringLong(),\n poolAddress: AccountAddress.from(poolAddress).toStringLong(),\n },\n };\n const data = await queryIndexer<GetDelegatedStakingActivitiesQuery>({ aptosConfig, query });\n return data.delegated_staking_activities;\n}\n"],"mappings":"AAYA,OAAS,kBAAAA,MAA2C,UAGpD,OAAS,iCAAAC,EAA+B,yBAAAC,MAA6B,6BACrE,OAAS,gBAAAC,MAAoB,YAW7B,eAAsBC,EAAsBC,EAGxB,CAClB,KAAM,CAAE,YAAAC,EAAa,YAAAC,CAAY,EAAIF,EAC/BG,EAAUR,EAAe,KAAKO,CAAW,EAAE,aAAa,EAKxDE,EAAO,MAAMN,EAAyC,CAAE,YAAAG,EAAa,MAJ7D,CACZ,MAAOJ,EACP,UAAW,CAAE,gBAAiB,CAAE,aAAc,CAAE,IAAKM,CAAQ,CAAE,CAAE,CACnE,CACiF,CAAC,EAIlF,OAAOC,EAAK,8BAA8B,CAAC,EAAIA,EAAK,8BAA8B,CAAC,EAAE,qBAAuB,CAC9G,CAYA,eAAsBC,EAAiCL,EAGZ,CACzC,KAAM,CAAE,YAAAC,EAAa,QAAAK,CAAQ,EAAIN,EAC3BO,EAAQ,CACZ,MAAOV,EACP,UAAW,CAAE,SAAUS,GAAS,OAAQ,CAC1C,EAKA,OAJa,MAAMR,EAAyC,CAC1D,YAAAG,EACA,MAAAM,CACF,CAAC,GACW,6BACd,CAYA,eAAsBC,EAA8BR,EAID,CACjD,KAAM,CAAE,YAAAC,EAAa,iBAAAQ,EAAkB,YAAAP,CAAY,EAAIF,EACjDO,EAAQ,CACZ,MAAOX,EACP,UAAW,CACT,iBAAkBD,EAAe,KAAKc,CAAgB,EAAE,aAAa,EACrE,YAAad,EAAe,KAAKO,CAAW,EAAE,aAAa,CAC7D,CACF,EAEA,OADa,MAAMJ,EAAiD,CAAE,YAAAG,EAAa,MAAAM,CAAM,CAAC,GAC9E,4BACd","names":["AccountAddress","GetDelegatedStakingActivities","GetNumberOfDelegators","queryIndexer","getNumberOfDelegators","args","aptosConfig","poolAddress","address","data","getNumberOfDelegatorsForAllPools","options","query","getDelegatedStakingActivities","delegatorAddress"]}
@@ -1,2 +1,2 @@
1
- import{a,b,c}from"../chunk-M3AO73ZL.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-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 getTableItem,b as getTableItemsData,c as getTableItemsMetadata};
1
+ import{postAptosFullNode as n}from"../client";import{GetTableItemsData as i,GetTableItemsMetadata as m}from"../types/generated/queries";import{queryIndexer as s}from"./general";async function w(t){const{aptosConfig:a,handle:e,data:o,options:r}=t;return(await n({aptosConfig:a,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:r?.ledgerVersion},body:o})).data}async function D(t){const{aptosConfig:a,options:e}=t,o={query:i,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await s({aptosConfig:a,query:o,originMethod:"getTableItemsData"})).table_items}async function _(t){const{aptosConfig:a,options:e}=t,o={query:m,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await s({aptosConfig:a,query:o,originMethod:"getTableItemsMetadata"})).table_metadatas}export{w as getTableItem,D as getTableItemsData,_ as getTableItemsMetadata};
2
2
  //# sourceMappingURL=table.mjs.map