PHP WebShell

Текущая директория: /opt/BitGoJS/node_modules/@aptos-labs/ts-sdk/dist/esm

Просмотр файла: chunk-2MN7DW2J.mjs.map

{"version":3,"sources":["../../src/api/event.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n  getAccountEventsByCreationNumber,\n  getAccountEventsByEventType,\n  getModuleEventsByEventType,\n  getEvents,\n} from \"../internal/event\";\nimport { AnyNumber, GetEventsResponse, MoveStructId, OrderByArg, PaginationArgs, WhereArg } from \"../types\";\nimport { EventsBoolExp } from \"../types/generated/types\";\nimport { AccountAddressInput } from \"../core\";\nimport { ProcessorType } from \"../utils/const\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { waitForIndexerOnVersion } from \"./utils\";\n\n/**\n * A class to query all `Event` Aptos related queries.\n */\nexport class Event {\n  /**\n   * Initializes a new instance of the Aptos client with the provided configuration.\n   *\n   * @param config - The configuration settings for the Aptos client.\n   * @param config.network - The network to connect to (e.g., Testnet, Mainnet).\n   * @param config.nodeUrl - The URL of the Aptos node to connect to.\n   * @param config.faucetUrl - The URL of the faucet to use for funding accounts.\n   *\n   * @example\n   * ```typescript\n   * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n   *\n   * async function runExample() {\n   *     // Create a new Aptos client with Testnet configuration\n   *     const config = new AptosConfig({ network: Network.TESTNET }); // Specify your own network if needed\n   *     const aptos = new Aptos(config);\n   *\n   *     console.log(\"Aptos client initialized:\", aptos);\n   * }\n   * runExample().catch(console.error);\n   * ```\n   */\n  constructor(readonly config: AptosConfig) {}\n\n  /**\n   * Retrieve module events based on a specified event type.\n   * This function allows you to query for events that are associated with a particular module event type in the Aptos blockchain.\n   *\n   * @param args - The arguments for retrieving module events.\n   * @param args.eventType - The event type to filter the results.\n   * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.\n   * @param args.options - Optional pagination and ordering parameters for the event results.\n   *\n   * @returns Promise<GetEventsResponse> - A promise that resolves to the retrieved events.\n   *\n   * @example\n   * ```typescript\n   * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n   *\n   * const config = new AptosConfig({ network: Network.TESTNET });\n   * const aptos = new Aptos(config);\n   *\n   * async function runExample() {\n   *   // Retrieve module events for a specific event type\n   *   const events = await aptos.getModuleEventsByEventType({\n   *     eventType: \"0x1::transaction_fee::FeeStatement\", // specify the event type\n   *     minimumLedgerVersion: 1, // optional: specify minimum ledger version if needed\n   *   });\n   *\n   *   console.log(events); // log the retrieved events\n   * }\n   * runExample().catch(console.error);\n   * ```\n   */\n  async getModuleEventsByEventType(args: {\n    eventType: MoveStructId;\n    minimumLedgerVersion?: AnyNumber;\n    options?: PaginationArgs & OrderByArg<GetEventsResponse[0]>;\n  }): Promise<GetEventsResponse> {\n    await waitForIndexerOnVersion({\n      config: this.config,\n      minimumLedgerVersion: args.minimumLedgerVersion,\n      processorType: ProcessorType.EVENTS_PROCESSOR,\n    });\n    return getModuleEventsByEventType({ aptosConfig: this.config, ...args });\n  }\n\n  /**\n   * Retrieve events associated with a specific account address and creation number.\n   *\n   * @param args - The parameters for retrieving account events.\n   * @param args.accountAddress - The account address to query events for.\n   * @param args.creationNumber - The event creation number to filter the events.\n   * @param args.minimumLedgerVersion - Optional minimum ledger version to sync up to before querying.\n   *\n   * @returns Promise<GetEventsResponse>\n   *\n   * @example\n   * ```typescript\n   * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n   *\n   * const config = new AptosConfig({ network: Network.TESTNET });\n   * const aptos = new Aptos(config);\n   *\n   * async function runExample() {\n   *   // Get events for the account at creation number 0\n   *   const events = await aptos.getAccountEventsByCreationNumber({\n   *     accountAddress: \"0x1\", // replace with a real account address\n   *     creationNumber: 0,\n   *   });\n   *\n   *   console.log(events);\n   * }\n   * runExample().catch(console.error);\n   * ```\n   */\n  async getAccountEventsByCreationNumber(args: {\n    accountAddress: AccountAddressInput;\n    creationNumber: AnyNumber;\n    minimumLedgerVersion?: AnyNumber;\n  }): Promise<GetEventsResponse> {\n    await waitForIndexerOnVersion({\n      config: this.config,\n      minimumLedgerVersion: args.minimumLedgerVersion,\n      processorType: ProcessorType.EVENTS_PROCESSOR,\n    });\n    return getAccountEventsByCreationNumber({ aptosConfig: this.config, ...args });\n  }\n\n  /**\n   * Retrieve events associated with a specific account address and event type.\n   *\n   * @param args.accountAddress - The account address to query events for.\n   * @param args.eventType - The type of event to filter by.\n   * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.\n   * @param args.options - Optional pagination and ordering parameters for the event query.\n   *\n   * @returns Promise<GetEventsResponse>\n   *\n   * @example\n   * ```typescript\n   * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n   *\n   * const config = new AptosConfig({ network: Network.TESTNET });\n   * const aptos = new Aptos(config);\n   *\n   * async function runExample() {\n   *   // Get events for a specific account and event type\n   *   const events = await aptos.getAccountEventsByEventType({\n   *     accountAddress: \"0x1\", // replace with a real account address\n   *     eventType: \"0x1::transaction_fee::FeeStatement\", // replace with a real event type\n   *     minimumLedgerVersion: 1, // optional, specify if needed\n   *   });\n   *\n   *   console.log(events);\n   * }\n   * runExample().catch(console.error);\n   * ```\n   */\n  async getAccountEventsByEventType(args: {\n    accountAddress: AccountAddressInput;\n    eventType: MoveStructId;\n    minimumLedgerVersion?: AnyNumber;\n    options?: PaginationArgs & OrderByArg<GetEventsResponse[0]>;\n  }): Promise<GetEventsResponse> {\n    await waitForIndexerOnVersion({\n      config: this.config,\n      minimumLedgerVersion: args.minimumLedgerVersion,\n      processorType: ProcessorType.EVENTS_PROCESSOR,\n    });\n    return getAccountEventsByEventType({ aptosConfig: this.config, ...args });\n  }\n\n  /**\n   * Retrieve all events from the Aptos blockchain.\n   * An optional `where` clause can be provided to filter the results based on specific criteria.\n   *\n   * @param args Optional parameters for the query.\n   * @param args.minimumLedgerVersion Optional ledger version to sync up to before querying.\n   * @param args.options Optional pagination and filtering options.\n   * @param args.options.where Optional condition to filter events.\n   * @param args.options.offset Optional pagination offset.\n   * @param args.options.limit Optional maximum number of events to return.\n   * @param args.options.orderBy Optional ordering of the results.\n   *\n   * @returns GetEventsQuery response type containing the events.\n   *\n   * @example\n   * ```typescript\n   * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n   *\n   * const config = new AptosConfig({ network: Network.TESTNET });\n   * const aptos = new Aptos(config);\n   *\n   * async function runExample() {\n   *   // Retrieve all events\n   *   const events = await aptos.getEvents();\n   *\n   *   // Retrieve events with filtering by account address\n   *   const whereCondition = {\n   *     account_address: { _eq: \"0x123\" }, // replace with a real account address\n   *   };\n   *   const filteredEvents = await aptos.getEvents({\n   *     options: { where: whereCondition },\n   *   });\n   *\n   *   console.log(events);\n   *   console.log(filteredEvents);\n   * }\n   * runExample().catch(console.error);\n   * ```\n   */\n  async getEvents(args?: {\n    minimumLedgerVersion?: AnyNumber;\n    options?: PaginationArgs & OrderByArg<GetEventsResponse[0]> & WhereArg<EventsBoolExp>;\n  }): Promise<GetEventsResponse> {\n    await waitForIndexerOnVersion({\n      config: this.config,\n      minimumLedgerVersion: args?.minimumLedgerVersion,\n      processorType: ProcessorType.EVENTS_PROCESSOR,\n    });\n    return getEvents({ aptosConfig: this.config, ...args });\n  }\n}\n"],"mappings":"uGAmBO,IAAMA,EAAN,KAAY,CAuBjB,YAAqBC,EAAqB,CAArB,YAAAA,CAAsB,CAgC3C,MAAM,2BAA2BC,EAIF,CAC7B,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,EAAK,qBAC3B,gCACF,CAAC,EACME,EAA2B,CAAE,YAAa,KAAK,OAAQ,GAAGF,CAAK,CAAC,CACzE,CA+BA,MAAM,iCAAiCA,EAIR,CAC7B,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,EAAK,qBAC3B,gCACF,CAAC,EACMG,EAAiC,CAAE,YAAa,KAAK,OAAQ,GAAGH,CAAK,CAAC,CAC/E,CAgCA,MAAM,4BAA4BA,EAKH,CAC7B,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,EAAK,qBAC3B,gCACF,CAAC,EACMI,EAA4B,CAAE,YAAa,KAAK,OAAQ,GAAGJ,CAAK,CAAC,CAC1E,CAyCA,MAAM,UAAUA,EAGe,CAC7B,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,GAAM,qBAC5B,gCACF,CAAC,EACMK,EAAU,CAAE,YAAa,KAAK,OAAQ,GAAGL,CAAK,CAAC,CACxD,CACF","names":["Event","config","args","waitForIndexerOnVersion","getModuleEventsByEventType","getAccountEventsByCreationNumber","getAccountEventsByEventType","getEvents"]}

Выполнить команду


Для локальной разработки. Не используйте в интернете!