diff --git a/packages/api/src/submittable/Result.ts b/packages/api/src/submittable/Result.ts index 3db258b2388c..7f4e0a7f1af7 100644 --- a/packages/api/src/submittable/Result.ts +++ b/packages/api/src/submittable/Result.ts @@ -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 */ diff --git a/packages/api/src/submittable/types.ts b/packages/api/src/submittable/types.ts index e2fb08eec215..ef8b870f2b0c 100644 --- a/packages/api/src/submittable/types.ts +++ b/packages/api/src/submittable/types.ts @@ -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 {