Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/api/src/submittable/Result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ export default class SubmittableResult implements SubmittableResultImpl {
return this.status.isFinalized;
}

/**
* @description Filters EventRecords for the specified method & section (there could be multiple)
*/
public filterRecords (section: string, method: string): EventRecord[] {
return this.events.filter(({ event }): boolean =>
event.section === section && event.method === method
);
}

/**
* @description Finds an EventRecord for the specified method & section
*/
Expand Down
3 changes: 2 additions & 1 deletion packages/api/src/submittable/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export interface SubmittableResultImpl {
readonly isError: boolean;
readonly isFinalized: boolean;

findRecord(section: string, method: string): EventRecord | undefined;
filterRecords (section: string, method: string): EventRecord[];
findRecord (section: string, method: string): EventRecord | undefined;
}

export interface SubmittableResultValue {
Expand Down