Allow most recent Result.findRecord (#1559)

* combine values

* findRecord newest

* constructor

* Add filterRecords

* Update interface
This commit is contained in:
Keith Ingram
2019-11-09 11:46:09 +01:00
committed by Jaco Greeff
parent 6aebeec028
commit 5671af8db7
2 changed files with 11 additions and 1 deletions
+9
View File
@@ -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
*/
+2 -1
View File
@@ -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 {