@aptos-labs/ts-sdk 3.1.3 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/dist/common/{account-Bb5REyaT.d.ts → account-CmEgDBH6.d.ts} +1 -1
  2. package/dist/common/cli/index.d.ts +1 -1
  3. package/dist/common/index.d.ts +6 -203
  4. package/dist/common/index.js +32 -51
  5. package/dist/common/index.js.map +1 -1
  6. package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
  7. package/dist/esm/account/AbstractedAccount.mjs +1 -1
  8. package/dist/esm/account/Account.mjs +1 -1
  9. package/dist/esm/account/AccountUtils.mjs +1 -1
  10. package/dist/esm/account/DerivableAbstractedAccount.mjs +1 -1
  11. package/dist/esm/account/Ed25519Account.mjs +1 -1
  12. package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
  13. package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
  14. package/dist/esm/account/KeylessAccount.mjs +1 -1
  15. package/dist/esm/account/MultiEd25519Account.mjs +1 -1
  16. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  17. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  18. package/dist/esm/account/index.mjs +1 -1
  19. package/dist/esm/account/utils.mjs +1 -1
  20. package/dist/esm/api/account/abstraction.mjs +1 -1
  21. package/dist/esm/api/account.mjs +1 -1
  22. package/dist/esm/api/ans.mjs +1 -1
  23. package/dist/esm/api/aptos.d.mts +0 -2
  24. package/dist/esm/api/aptos.mjs +1 -1
  25. package/dist/esm/api/coin.mjs +1 -1
  26. package/dist/esm/api/digitalAsset.mjs +1 -1
  27. package/dist/esm/api/faucet.mjs +1 -1
  28. package/dist/esm/api/fungibleAsset.mjs +1 -1
  29. package/dist/esm/api/general.mjs +1 -1
  30. package/dist/esm/api/index.d.mts +0 -1
  31. package/dist/esm/api/index.mjs +1 -1
  32. package/dist/esm/api/keyless.mjs +1 -1
  33. package/dist/esm/api/object.mjs +1 -1
  34. package/dist/esm/api/staking.mjs +1 -1
  35. package/dist/esm/api/table.mjs +1 -1
  36. package/dist/esm/api/transaction.mjs +1 -1
  37. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  38. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  39. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  40. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  41. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  42. package/dist/esm/api/utils.mjs +1 -1
  43. package/dist/esm/bcs/index.mjs +1 -1
  44. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  45. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  46. package/dist/esm/{chunk-JEEUU42Q.mjs → chunk-3BMZKCLH.mjs} +2 -2
  47. package/dist/esm/{chunk-CO67Y6YE.mjs → chunk-4JT5AESZ.mjs} +2 -2
  48. package/dist/esm/chunk-55Q7BSZT.mjs +6 -0
  49. package/dist/esm/chunk-55Q7BSZT.mjs.map +1 -0
  50. package/dist/esm/{chunk-QVLV73OB.mjs → chunk-6JYQ5P36.mjs} +2 -2
  51. package/dist/esm/chunk-6SLY7UV2.mjs +2 -0
  52. package/dist/esm/{chunk-ZIB2TU7B.mjs.map → chunk-6SLY7UV2.mjs.map} +1 -1
  53. package/dist/esm/{chunk-MGMCLJQC.mjs → chunk-BPWSOC2Y.mjs} +2 -2
  54. package/dist/esm/{chunk-RQX6JOEN.mjs → chunk-EF4FA5I6.mjs} +2 -2
  55. package/dist/esm/{chunk-GMEBV7NZ.mjs → chunk-HZVN4JSO.mjs} +2 -2
  56. package/dist/esm/{chunk-UQWF24SS.mjs → chunk-K43K3YG7.mjs} +2 -2
  57. package/dist/esm/{chunk-CFQFFP6N.mjs → chunk-MSMFHPDT.mjs} +2 -2
  58. package/dist/esm/{chunk-KJW3XYRT.mjs → chunk-NF73V673.mjs} +2 -2
  59. package/dist/esm/{chunk-DAGUHPTV.mjs → chunk-PLI53ZU6.mjs} +2 -2
  60. package/dist/esm/{chunk-NIXUOEWL.mjs → chunk-UQZTHVWC.mjs} +2 -2
  61. package/dist/esm/{chunk-XZQAMU5W.mjs → chunk-V6C6NWFU.mjs} +2 -2
  62. package/dist/esm/{chunk-TZRRQMCT.mjs → chunk-XYXBAU4J.mjs} +2 -2
  63. package/dist/esm/cli/index.mjs +1 -1
  64. package/dist/esm/cli/localNode.mjs +1 -1
  65. package/dist/esm/client/core.mjs +1 -1
  66. package/dist/esm/client/get.mjs +1 -1
  67. package/dist/esm/client/index.mjs +1 -1
  68. package/dist/esm/client/post.mjs +1 -1
  69. package/dist/esm/core/account/index.mjs +1 -1
  70. package/dist/esm/core/account/utils/address.mjs +1 -1
  71. package/dist/esm/core/account/utils/index.mjs +1 -1
  72. package/dist/esm/core/accountAddress.mjs +1 -1
  73. package/dist/esm/core/authenticationKey.mjs +1 -1
  74. package/dist/esm/core/crypto/abstraction.mjs +1 -1
  75. package/dist/esm/core/crypto/deserializationUtils.mjs +1 -1
  76. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  77. package/dist/esm/core/crypto/ephemeral.mjs +1 -1
  78. package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
  79. package/dist/esm/core/crypto/index.mjs +1 -1
  80. package/dist/esm/core/crypto/keyless.mjs +1 -1
  81. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  82. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  83. package/dist/esm/core/crypto/privateKey.mjs +1 -1
  84. package/dist/esm/core/crypto/proof.mjs +1 -1
  85. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  86. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  87. package/dist/esm/core/crypto/signature.mjs +1 -1
  88. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  89. package/dist/esm/core/index.mjs +1 -1
  90. package/dist/esm/errors/index.mjs +1 -1
  91. package/dist/esm/index.d.mts +0 -1
  92. package/dist/esm/index.mjs +1 -1
  93. package/dist/esm/internal/abstraction.mjs +1 -1
  94. package/dist/esm/internal/account.mjs +1 -1
  95. package/dist/esm/internal/ans.d.mts +19 -8
  96. package/dist/esm/internal/ans.mjs +1 -1
  97. package/dist/esm/internal/coin.mjs +1 -1
  98. package/dist/esm/internal/digitalAsset.mjs +1 -1
  99. package/dist/esm/internal/faucet.mjs +1 -1
  100. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  101. package/dist/esm/internal/general.mjs +1 -1
  102. package/dist/esm/internal/keyless.mjs +1 -1
  103. package/dist/esm/internal/object.mjs +1 -1
  104. package/dist/esm/internal/staking.mjs +1 -1
  105. package/dist/esm/internal/table.mjs +1 -1
  106. package/dist/esm/internal/transaction.mjs +1 -1
  107. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  108. package/dist/esm/internal/utils/index.mjs +1 -1
  109. package/dist/esm/internal/utils/utils.mjs +1 -1
  110. package/dist/esm/internal/view.mjs +1 -1
  111. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  112. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  113. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  114. package/dist/esm/transactions/index.mjs +1 -1
  115. package/dist/esm/transactions/instances/index.mjs +1 -1
  116. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  117. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  118. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  119. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  120. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  121. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  122. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  123. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  124. package/dist/esm/transactions/management/index.mjs +1 -1
  125. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  126. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  127. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  128. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  129. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  130. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +2 -2
  131. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  132. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  133. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  134. package/dist/esm/types/index.mjs +1 -1
  135. package/dist/esm/types/indexer.d.mts +1 -1
  136. package/dist/esm/utils/helpers.mjs +1 -1
  137. package/dist/esm/utils/index.mjs +1 -1
  138. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  139. package/dist/esm/version.d.mts +1 -1
  140. package/dist/esm/version.mjs +1 -1
  141. package/package.json +1 -1
  142. package/src/api/aptos.ts +10 -9
  143. package/src/internal/ans.ts +19 -8
  144. package/src/version.ts +1 -1
  145. package/dist/esm/api/event.d.mts +0 -193
  146. package/dist/esm/api/event.mjs +0 -2
  147. package/dist/esm/api/event.mjs.map +0 -1
  148. package/dist/esm/chunk-GXDOOLCG.mjs +0 -6
  149. package/dist/esm/chunk-GXDOOLCG.mjs.map +0 -1
  150. package/dist/esm/chunk-ZIB2TU7B.mjs +0 -2
  151. package/dist/esm/internal/event.d.mts +0 -82
  152. package/dist/esm/internal/event.mjs +0 -2
  153. package/dist/esm/internal/event.mjs.map +0 -1
  154. package/src/api/event.ts +0 -230
  155. package/src/internal/event.ts +0 -171
  156. /package/dist/esm/{chunk-JEEUU42Q.mjs.map → chunk-3BMZKCLH.mjs.map} +0 -0
  157. /package/dist/esm/{chunk-CO67Y6YE.mjs.map → chunk-4JT5AESZ.mjs.map} +0 -0
  158. /package/dist/esm/{chunk-QVLV73OB.mjs.map → chunk-6JYQ5P36.mjs.map} +0 -0
  159. /package/dist/esm/{chunk-MGMCLJQC.mjs.map → chunk-BPWSOC2Y.mjs.map} +0 -0
  160. /package/dist/esm/{chunk-RQX6JOEN.mjs.map → chunk-EF4FA5I6.mjs.map} +0 -0
  161. /package/dist/esm/{chunk-GMEBV7NZ.mjs.map → chunk-HZVN4JSO.mjs.map} +0 -0
  162. /package/dist/esm/{chunk-UQWF24SS.mjs.map → chunk-K43K3YG7.mjs.map} +0 -0
  163. /package/dist/esm/{chunk-CFQFFP6N.mjs.map → chunk-MSMFHPDT.mjs.map} +0 -0
  164. /package/dist/esm/{chunk-KJW3XYRT.mjs.map → chunk-NF73V673.mjs.map} +0 -0
  165. /package/dist/esm/{chunk-DAGUHPTV.mjs.map → chunk-PLI53ZU6.mjs.map} +0 -0
  166. /package/dist/esm/{chunk-NIXUOEWL.mjs.map → chunk-UQZTHVWC.mjs.map} +0 -0
  167. /package/dist/esm/{chunk-XZQAMU5W.mjs.map → chunk-V6C6NWFU.mjs.map} +0 -0
  168. /package/dist/esm/{chunk-TZRRQMCT.mjs.map → chunk-XYXBAU4J.mjs.map} +0 -0
@@ -1,2 +0,0 @@
1
- var o="3.1.3";export{o as a};
2
- //# sourceMappingURL=chunk-ZIB2TU7B.mjs.map
@@ -1,82 +0,0 @@
1
- import { A as AptosConfig, d7 as MoveStructId, bO as PaginationArgs, bR as OrderByArg, m as AccountAddressInput, bM as AnyNumber, bS as WhereArg } from '../account--Q9z_xMN.mjs';
2
- import { GetEventsResponse } from '../types/indexer.mjs';
3
- import { EventsBoolExp } from '../types/generated/types.mjs';
4
- import '../utils/apiEndpoints.mjs';
5
- import '../utils/const.mjs';
6
- import '../core/common.mjs';
7
- import '../types/generated/operations.mjs';
8
-
9
- /**
10
- * This file contains the underlying implementations for exposed API surface in
11
- * the {@link api/event}. By moving the methods out into a separate file,
12
- * other namespaces and processes can access these methods without depending on the entire
13
- * event namespace and without having a dependency cycle error.
14
- * @group Implementation
15
- */
16
-
17
- /**
18
- * Retrieves events associated with a specific module event type.
19
- * This function allows you to filter events based on the event type and pagination options.
20
- *
21
- * @param args - The arguments for retrieving module events.
22
- * @param args.aptosConfig - The configuration object for Aptos.
23
- * @param args.eventType - The MoveStructId representing the type of event to retrieve.
24
- * @param [args.options] - Optional pagination and ordering parameters for the event retrieval.
25
- * @group Implementation
26
- */
27
- declare function getModuleEventsByEventType(args: {
28
- aptosConfig: AptosConfig;
29
- eventType: MoveStructId;
30
- options?: PaginationArgs & OrderByArg<GetEventsResponse[0]>;
31
- }): Promise<GetEventsResponse>;
32
- /**
33
- * Retrieve events associated with a specific account and creation number.
34
- *
35
- * @param args - The parameters for retrieving account events.
36
- * @param args.aptosConfig - The configuration settings for the Aptos client.
37
- * @param args.accountAddress - The address of the account for which events are being retrieved.
38
- * @param args.creationNumber - The creation number to filter events.
39
- * @param args.options - Optional pagination and ordering parameters for the event retrieval.
40
- * @group Implementation
41
- */
42
- declare function getAccountEventsByCreationNumber(args: {
43
- aptosConfig: AptosConfig;
44
- accountAddress: AccountAddressInput;
45
- creationNumber: AnyNumber;
46
- options?: PaginationArgs & OrderByArg<GetEventsResponse[0]>;
47
- }): Promise<GetEventsResponse>;
48
- /**
49
- * Retrieves events associated with a specific account and event type.
50
- *
51
- * @param args - The parameters for retrieving account events.
52
- * @param args.aptosConfig - The configuration for connecting to the Aptos blockchain.
53
- * @param args.accountAddress - The address of the account for which to retrieve events.
54
- * @param args.eventType - The type of event to filter by.
55
- * @param args.options - Optional pagination and ordering parameters for the event retrieval.
56
- * @group Implementation
57
- */
58
- declare function getAccountEventsByEventType(args: {
59
- aptosConfig: AptosConfig;
60
- accountAddress: AccountAddressInput;
61
- eventType: MoveStructId;
62
- options?: PaginationArgs & OrderByArg<GetEventsResponse[0]>;
63
- }): Promise<GetEventsResponse>;
64
- /**
65
- * Retrieves a list of events based on specified filtering and pagination options.
66
- *
67
- * @param args - The arguments for retrieving events.
68
- * @param args.aptosConfig - The configuration for connecting to the Aptos network.
69
- * @param [args.options] - Optional parameters for pagination and filtering.
70
- * @param [args.options.offset] - The number of records to skip before starting to collect the result set.
71
- * @param [args.options.limit] - The maximum number of records to return.
72
- * @param [args.options.orderBy] - Defines the order in which to return the events.
73
- * @param [args.options.where] - Conditions to filter the events.
74
- * @param [args.options.where.indexed_type] - Filters events by the indexed type.
75
- * @group Implementation
76
- */
77
- declare function getEvents(args: {
78
- aptosConfig: AptosConfig;
79
- options?: PaginationArgs & OrderByArg<GetEventsResponse[0]> & WhereArg<EventsBoolExp>;
80
- }): Promise<GetEventsResponse>;
81
-
82
- export { getAccountEventsByCreationNumber, getAccountEventsByEventType, getEvents, getModuleEventsByEventType };
@@ -1,2 +0,0 @@
1
- import{hd as a,id as b,jd as c,kd as d}from"../chunk-GXDOOLCG.mjs";import"../chunk-G3MHXDYA.mjs";import"../chunk-NIXUOEWL.mjs";import"../chunk-CO67Y6YE.mjs";import"../chunk-5HXLZHDW.mjs";import"../chunk-A5L76YP7.mjs";import"../chunk-GOXRBEIJ.mjs";import"../chunk-XJJVJOX5.mjs";import"../chunk-NECL5FCQ.mjs";import"../chunk-4QMXOWHP.mjs";import"../chunk-RQX6JOEN.mjs";import"../chunk-CFQFFP6N.mjs";import"../chunk-UQWF24SS.mjs";import"../chunk-DPW6ELCQ.mjs";import"../chunk-C3Q23D22.mjs";import"../chunk-ROT6S6BM.mjs";import"../chunk-WSR5EBJM.mjs";import"../chunk-WCMW2L3P.mjs";import"../chunk-2XQKGWHQ.mjs";import"../chunk-UYVPNUH3.mjs";import"../chunk-XKUIMGKU.mjs";import"../chunk-N6YTF76Q.mjs";import"../chunk-QREVMGQZ.mjs";import"../chunk-KJH4KKG6.mjs";import"../chunk-FGFLPH5K.mjs";import"../chunk-V3MBJJTL.mjs";import"../chunk-GMEBV7NZ.mjs";import"../chunk-JEEUU42Q.mjs";import"../chunk-XZQAMU5W.mjs";import"../chunk-DAGUHPTV.mjs";import"../chunk-YOZBVVKL.mjs";import"../chunk-TZRRQMCT.mjs";import"../chunk-UL777LTI.mjs";import"../chunk-7ECCT6PK.mjs";import"../chunk-MGMCLJQC.mjs";import"../chunk-QVLV73OB.mjs";import"../chunk-KJW3XYRT.mjs";import"../chunk-HGLO5LDS.mjs";import"../chunk-CW35YAMN.mjs";import"../chunk-6WDVDEQZ.mjs";import"../chunk-Y7ZQTLH4.mjs";import"../chunk-4RXKALLC.mjs";import"../chunk-JCFTAG5Z.mjs";import"../chunk-7DQDJ2SA.mjs";import"../chunk-HNBVYE3N.mjs";import"../chunk-RGKRCZ36.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-Q4W3WJ2U.mjs";import"../chunk-ORMOQWWH.mjs";import"../chunk-TOBQ5UE6.mjs";import"../chunk-MT2RJ7H3.mjs";import"../chunk-FD6FGKYY.mjs";import"../chunk-IJE2LVZG.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-FLZPUYXQ.mjs";import"../chunk-EBMEXURY.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-56CNRT2K.mjs";import"../chunk-ZIB2TU7B.mjs";import"../chunk-KDMSOCZY.mjs";export{b as getAccountEventsByCreationNumber,c as getAccountEventsByEventType,d as getEvents,a as getModuleEventsByEventType};
2
- //# sourceMappingURL=event.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/src/api/event.ts DELETED
@@ -1,230 +0,0 @@
1
- // Copyright © Aptos Foundation
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import {
5
- getAccountEventsByCreationNumber,
6
- getAccountEventsByEventType,
7
- getModuleEventsByEventType,
8
- getEvents,
9
- } from "../internal/event";
10
- import { AnyNumber, GetEventsResponse, MoveStructId, OrderByArg, PaginationArgs, WhereArg } from "../types";
11
- import { EventsBoolExp } from "../types/generated/types";
12
- import { AccountAddressInput } from "../core";
13
- import { ProcessorType } from "../utils/const";
14
- import { AptosConfig } from "./aptosConfig";
15
- import { waitForIndexerOnVersion } from "./utils";
16
-
17
- /**
18
- * A class to query all `Event` Aptos related queries.
19
- * @group Event
20
- */
21
- export class Event {
22
- /**
23
- * Initializes a new instance of the Aptos client with the provided configuration.
24
- *
25
- * @param config - The configuration settings for the Aptos client.
26
- * @param config.network - The network to connect to (e.g., Testnet, Mainnet).
27
- * @param config.nodeUrl - The URL of the Aptos node to connect to.
28
- * @param config.faucetUrl - The URL of the faucet to use for funding accounts.
29
- *
30
- * @example
31
- * ```typescript
32
- * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
33
- *
34
- * async function runExample() {
35
- * // Create a new Aptos client with Testnet configuration
36
- * const config = new AptosConfig({ network: Network.TESTNET }); // Specify your own network if needed
37
- * const aptos = new Aptos(config);
38
- *
39
- * console.log("Aptos client initialized:", aptos);
40
- * }
41
- * runExample().catch(console.error);
42
- * ```
43
- * @group Event
44
- */
45
- constructor(readonly config: AptosConfig) {}
46
-
47
- /**
48
- * Retrieve module events based on a specified event type.
49
- * This function allows you to query for events that are associated with a particular module event type in the Aptos blockchain.
50
- *
51
- * @param args - The arguments for retrieving module events.
52
- * @param args.eventType - The event type to filter the results.
53
- * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.
54
- * @param args.options - Optional pagination and ordering parameters for the event results.
55
- *
56
- * @returns Promise<GetEventsResponse> - A promise that resolves to the retrieved events.
57
- *
58
- * @example
59
- * ```typescript
60
- * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
61
- *
62
- * const config = new AptosConfig({ network: Network.TESTNET });
63
- * const aptos = new Aptos(config);
64
- *
65
- * async function runExample() {
66
- * // Retrieve module events for a specific event type
67
- * const events = await aptos.getModuleEventsByEventType({
68
- * eventType: "0x1::transaction_fee::FeeStatement", // specify the event type
69
- * minimumLedgerVersion: 1, // optional: specify minimum ledger version if needed
70
- * });
71
- *
72
- * console.log(events); // log the retrieved events
73
- * }
74
- * runExample().catch(console.error);
75
- * ```
76
- * @group Event
77
- */
78
- async getModuleEventsByEventType(args: {
79
- eventType: MoveStructId;
80
- minimumLedgerVersion?: AnyNumber;
81
- options?: PaginationArgs & OrderByArg<GetEventsResponse[0]>;
82
- }): Promise<GetEventsResponse> {
83
- await waitForIndexerOnVersion({
84
- config: this.config,
85
- minimumLedgerVersion: args.minimumLedgerVersion,
86
- processorType: ProcessorType.EVENTS_PROCESSOR,
87
- });
88
- return getModuleEventsByEventType({ aptosConfig: this.config, ...args });
89
- }
90
-
91
- /**
92
- * Retrieve events associated with a specific account address and creation number.
93
- *
94
- * @param args - The parameters for retrieving account events.
95
- * @param args.accountAddress - The account address to query events for.
96
- * @param args.creationNumber - The event creation number to filter the events.
97
- * @param args.minimumLedgerVersion - Optional minimum ledger version to sync up to before querying.
98
- *
99
- * @returns Promise<GetEventsResponse>
100
- *
101
- * @example
102
- * ```typescript
103
- * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
104
- *
105
- * const config = new AptosConfig({ network: Network.TESTNET });
106
- * const aptos = new Aptos(config);
107
- *
108
- * async function runExample() {
109
- * // Get events for the account at creation number 0
110
- * const events = await aptos.getAccountEventsByCreationNumber({
111
- * accountAddress: "0x1", // replace with a real account address
112
- * creationNumber: 0,
113
- * });
114
- *
115
- * console.log(events);
116
- * }
117
- * runExample().catch(console.error);
118
- * ```
119
- * @group Event
120
- */
121
- async getAccountEventsByCreationNumber(args: {
122
- accountAddress: AccountAddressInput;
123
- creationNumber: AnyNumber;
124
- minimumLedgerVersion?: AnyNumber;
125
- }): Promise<GetEventsResponse> {
126
- await waitForIndexerOnVersion({
127
- config: this.config,
128
- minimumLedgerVersion: args.minimumLedgerVersion,
129
- processorType: ProcessorType.EVENTS_PROCESSOR,
130
- });
131
- return getAccountEventsByCreationNumber({ aptosConfig: this.config, ...args });
132
- }
133
-
134
- /**
135
- * Retrieve events associated with a specific account address and event type.
136
- *
137
- * @param args.accountAddress - The account address to query events for.
138
- * @param args.eventType - The type of event to filter by.
139
- * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.
140
- * @param args.options - Optional pagination and ordering parameters for the event query.
141
- *
142
- * @returns Promise<GetEventsResponse>
143
- *
144
- * @example
145
- * ```typescript
146
- * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
147
- *
148
- * const config = new AptosConfig({ network: Network.TESTNET });
149
- * const aptos = new Aptos(config);
150
- *
151
- * async function runExample() {
152
- * // Get events for a specific account and event type
153
- * const events = await aptos.getAccountEventsByEventType({
154
- * accountAddress: "0x1", // replace with a real account address
155
- * eventType: "0x1::transaction_fee::FeeStatement", // replace with a real event type
156
- * minimumLedgerVersion: 1, // optional, specify if needed
157
- * });
158
- *
159
- * console.log(events);
160
- * }
161
- * runExample().catch(console.error);
162
- * ```
163
- * @group Event
164
- */
165
- async getAccountEventsByEventType(args: {
166
- accountAddress: AccountAddressInput;
167
- eventType: MoveStructId;
168
- minimumLedgerVersion?: AnyNumber;
169
- options?: PaginationArgs & OrderByArg<GetEventsResponse[0]>;
170
- }): Promise<GetEventsResponse> {
171
- await waitForIndexerOnVersion({
172
- config: this.config,
173
- minimumLedgerVersion: args.minimumLedgerVersion,
174
- processorType: ProcessorType.EVENTS_PROCESSOR,
175
- });
176
- return getAccountEventsByEventType({ aptosConfig: this.config, ...args });
177
- }
178
-
179
- /**
180
- * Retrieve all events from the Aptos blockchain.
181
- * An optional `where` clause can be provided to filter the results based on specific criteria.
182
- *
183
- * @param args Optional parameters for the query.
184
- * @param args.minimumLedgerVersion Optional ledger version to sync up to before querying.
185
- * @param args.options Optional pagination and filtering options.
186
- * @param args.options.where Optional condition to filter events.
187
- * @param args.options.offset Optional pagination offset.
188
- * @param args.options.limit Optional maximum number of events to return.
189
- * @param args.options.orderBy Optional ordering of the results.
190
- *
191
- * @returns GetEventsQuery response type containing the events.
192
- *
193
- * @example
194
- * ```typescript
195
- * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
196
- *
197
- * const config = new AptosConfig({ network: Network.TESTNET });
198
- * const aptos = new Aptos(config);
199
- *
200
- * async function runExample() {
201
- * // Retrieve all events
202
- * const events = await aptos.getEvents();
203
- *
204
- * // Retrieve events with filtering by account address
205
- * const whereCondition = {
206
- * account_address: { _eq: "0x123" }, // replace with a real account address
207
- * };
208
- * const filteredEvents = await aptos.getEvents({
209
- * options: { where: whereCondition },
210
- * });
211
- *
212
- * console.log(events);
213
- * console.log(filteredEvents);
214
- * }
215
- * runExample().catch(console.error);
216
- * ```
217
- * @group Event
218
- */
219
- async getEvents(args?: {
220
- minimumLedgerVersion?: AnyNumber;
221
- options?: PaginationArgs & OrderByArg<GetEventsResponse[0]> & WhereArg<EventsBoolExp>;
222
- }): Promise<GetEventsResponse> {
223
- await waitForIndexerOnVersion({
224
- config: this.config,
225
- minimumLedgerVersion: args?.minimumLedgerVersion,
226
- processorType: ProcessorType.EVENTS_PROCESSOR,
227
- });
228
- return getEvents({ aptosConfig: this.config, ...args });
229
- }
230
- }
@@ -1,171 +0,0 @@
1
- // Copyright © Aptos Foundation
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- /**
5
- * This file contains the underlying implementations for exposed API surface in
6
- * the {@link api/event}. By moving the methods out into a separate file,
7
- * other namespaces and processes can access these methods without depending on the entire
8
- * event namespace and without having a dependency cycle error.
9
- * @group Implementation
10
- */
11
-
12
- import { AptosConfig } from "../api/aptosConfig";
13
- import { AccountAddress, AccountAddressInput } from "../core";
14
- import { AnyNumber, GetEventsResponse, PaginationArgs, MoveStructId, OrderByArg, WhereArg } from "../types";
15
- import { GetEventsQuery } from "../types/generated/operations";
16
- import { GetEvents } from "../types/generated/queries";
17
- import { EventsBoolExp, InputMaybe } from "../types/generated/types";
18
- import { queryIndexer } from "./general";
19
-
20
- const MAX_EVENT_TYPE_LENGTH = 300;
21
- const checkEventTypeLength = (eventType?: InputMaybe<string>) => {
22
- if (eventType && eventType.length > MAX_EVENT_TYPE_LENGTH) {
23
- throw new Error(`Event type length exceeds the maximum length of ${MAX_EVENT_TYPE_LENGTH}`);
24
- }
25
- };
26
-
27
- /**
28
- * Retrieves events associated with a specific module event type.
29
- * This function allows you to filter events based on the event type and pagination options.
30
- *
31
- * @param args - The arguments for retrieving module events.
32
- * @param args.aptosConfig - The configuration object for Aptos.
33
- * @param args.eventType - The MoveStructId representing the type of event to retrieve.
34
- * @param [args.options] - Optional pagination and ordering parameters for the event retrieval.
35
- * @group Implementation
36
- */
37
- export async function getModuleEventsByEventType(args: {
38
- aptosConfig: AptosConfig;
39
- eventType: MoveStructId;
40
- options?: PaginationArgs & OrderByArg<GetEventsResponse[0]>;
41
- }): Promise<GetEventsResponse> {
42
- const { aptosConfig, eventType, options } = args;
43
-
44
- const whereCondition: EventsBoolExp = {
45
- _or: [
46
- // EventHandle events
47
- { account_address: { _eq: eventType.split("::")[0] } },
48
- // Module events
49
- {
50
- account_address: { _eq: "0x0000000000000000000000000000000000000000000000000000000000000000" },
51
- sequence_number: { _eq: 0 },
52
- creation_number: { _eq: 0 },
53
- },
54
- ],
55
- indexed_type: { _eq: eventType },
56
- };
57
-
58
- return getEvents({ aptosConfig, options: { ...options, where: whereCondition } });
59
- }
60
-
61
- /**
62
- * Retrieve events associated with a specific account and creation number.
63
- *
64
- * @param args - The parameters for retrieving account events.
65
- * @param args.aptosConfig - The configuration settings for the Aptos client.
66
- * @param args.accountAddress - The address of the account for which events are being retrieved.
67
- * @param args.creationNumber - The creation number to filter events.
68
- * @param args.options - Optional pagination and ordering parameters for the event retrieval.
69
- * @group Implementation
70
- */
71
- export async function getAccountEventsByCreationNumber(args: {
72
- aptosConfig: AptosConfig;
73
- accountAddress: AccountAddressInput;
74
- creationNumber: AnyNumber;
75
- options?: PaginationArgs & OrderByArg<GetEventsResponse[0]>;
76
- }): Promise<GetEventsResponse> {
77
- const { accountAddress, aptosConfig, creationNumber, options } = args;
78
- const address = AccountAddress.from(accountAddress);
79
-
80
- const whereCondition: EventsBoolExp = {
81
- account_address: { _eq: address.toStringLong() },
82
- creation_number: { _eq: creationNumber },
83
- };
84
-
85
- return getEvents({ aptosConfig, options: { ...options, where: whereCondition } });
86
- }
87
-
88
- /**
89
- * Retrieves events associated with a specific account and event type.
90
- *
91
- * @param args - The parameters for retrieving account events.
92
- * @param args.aptosConfig - The configuration for connecting to the Aptos blockchain.
93
- * @param args.accountAddress - The address of the account for which to retrieve events.
94
- * @param args.eventType - The type of event to filter by.
95
- * @param args.options - Optional pagination and ordering parameters for the event retrieval.
96
- * @group Implementation
97
- */
98
- export async function getAccountEventsByEventType(args: {
99
- aptosConfig: AptosConfig;
100
- accountAddress: AccountAddressInput;
101
- eventType: MoveStructId;
102
- options?: PaginationArgs & OrderByArg<GetEventsResponse[0]>;
103
- }): Promise<GetEventsResponse> {
104
- const { accountAddress, aptosConfig, eventType, options } = args;
105
- const address = AccountAddress.from(accountAddress).toStringLong();
106
-
107
- const whereCondition: EventsBoolExp = {
108
- account_address: { _eq: address },
109
- indexed_type: { _eq: eventType },
110
- };
111
-
112
- return getEvents({ aptosConfig, options: { ...options, where: whereCondition } });
113
- }
114
-
115
- /**
116
- * Retrieves a list of events based on specified filtering and pagination options.
117
- *
118
- * @param args - The arguments for retrieving events.
119
- * @param args.aptosConfig - The configuration for connecting to the Aptos network.
120
- * @param [args.options] - Optional parameters for pagination and filtering.
121
- * @param [args.options.offset] - The number of records to skip before starting to collect the result set.
122
- * @param [args.options.limit] - The maximum number of records to return.
123
- * @param [args.options.orderBy] - Defines the order in which to return the events.
124
- * @param [args.options.where] - Conditions to filter the events.
125
- * @param [args.options.where.indexed_type] - Filters events by the indexed type.
126
- * @group Implementation
127
- */
128
- export async function getEvents(args: {
129
- aptosConfig: AptosConfig;
130
- options?: PaginationArgs & OrderByArg<GetEventsResponse[0]> & WhereArg<EventsBoolExp>;
131
- }): Promise<GetEventsResponse> {
132
- // eslint-disable-next-line no-console
133
- console.warn(
134
- // eslint-disable-next-line max-len
135
- `[Aptos SDK] Events queries will be deprecated by the end of July 2025. Follow the details in https://aptoslabs.notion.site/Indexer-Feature-Updates-Events-v1-table-deprecation-and-end-of-support-July-1st-1ec8b846eb7280ffa042c0d3d7f45633?source=copy_link to migrate your events queries.`,
136
- );
137
- const { aptosConfig, options } = args;
138
-
139
- /**
140
- * Checks the length of event types based on the provided filtering options.
141
- *
142
- * @param options - The options for querying event types.
143
- * @param options.where - The conditions to filter the event types.
144
- * @param options.where.indexed_type - The indexed type to filter by.
145
- * @param options.where.indexed_type._eq - The specific value to match for the indexed type.
146
- * @param options.offset - The number of items to skip before starting to collect the result set.
147
- * @param options.limit - The maximum number of items to return.
148
- * @param options.orderBy - The criteria to sort the results.
149
- * @group Implementation
150
- */
151
- // eslint-disable-next-line no-underscore-dangle
152
- checkEventTypeLength(options?.where?.indexed_type?._eq);
153
-
154
- const graphqlQuery = {
155
- query: GetEvents,
156
- variables: {
157
- where_condition: options?.where,
158
- offset: options?.offset,
159
- limit: options?.limit,
160
- order_by: options?.orderBy,
161
- },
162
- };
163
-
164
- const data = await queryIndexer<GetEventsQuery>({
165
- aptosConfig,
166
- query: graphqlQuery,
167
- originMethod: "getEvents",
168
- });
169
-
170
- return data.events;
171
- }