Skip to content

Commit

Permalink
Add support for EventHandle events to getModuleEventsByEventType (#500)
Browse files Browse the repository at this point in the history
  • Loading branch information
GhostWalker562 authored Sep 17, 2024
1 parent 684570d commit 3c79efd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ All notable changes to the Aptos TypeScript SDK will be captured in this file. T

- Support `Serialized Type` to Script txn. Now can use vector<String> for example.
- Populate `coinType` for `getAccountCoinAmount` if only `faMetadataAddress` is provided.
- [`Fix`] `getModuleEventsByEventType` will also account for EventHandle events.

# 1.27.1 (2024-08-23)

Expand Down
13 changes: 10 additions & 3 deletions src/internal/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,16 @@ export async function getModuleEventsByEventType(args: {
const { aptosConfig, eventType, options } = args;

const whereCondition: EventsBoolExp = {
account_address: { _eq: "0x0000000000000000000000000000000000000000000000000000000000000000" },
creation_number: { _eq: "0" },
sequence_number: { _eq: "0" },
_or: [
// EventHandle events
{ account_address: { _eq: eventType.split("::")[0] } },
// Module events
{
account_address: { _eq: "0x0000000000000000000000000000000000000000000000000000000000000000" },
sequence_number: { _eq: 0 },
creation_number: { _eq: 0 },
},
],
indexed_type: { _eq: eventType },
};

Expand Down

0 comments on commit 3c79efd

Please sign in to comment.