Skip to content

Commit e6136e0

Browse files
committed
Added more test cases and fixed a few bugs
1 parent 6a01621 commit e6136e0

File tree

2 files changed

+307
-10
lines changed

2 files changed

+307
-10
lines changed

src/service/AggregatedTransactionService.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
import {from as observableFrom , Observable, of as observableOf} from 'rxjs';
18-
import { map, mergeMap} from 'rxjs/operators';
18+
import { flatMap, map, mergeMap, toArray} from 'rxjs/operators';
1919
import { TransactionMapping } from '../core/utils/TransactionMapping';
2020
import { AccountHttp } from '../infrastructure/AccountHttp';
2121
import { MultisigAccountGraphInfo } from '../model/account/MultisigAccountGraphInfo';
@@ -52,7 +52,6 @@ export class AggregatedTransactionService {
5252
if (signedTransaction.signer) {
5353
signers.push(signedTransaction.signer);
5454
}
55-
5655
return observableFrom(aggregateTransaction.innerTransactions).pipe(
5756
mergeMap((innerTransaction) => this.accountHttp.getMultisigAccountInfo(innerTransaction.signer.address)
5857
.pipe(
@@ -63,11 +62,16 @@ export class AggregatedTransactionService {
6362
this.accountHttp.getMultisigAccountGraphInfo(_.account.address)
6463
.pipe(
6564
map((graphInfo) => this.validateCosignatories(graphInfo, signers, innerTransaction)),
66-
) : observableOf(true),
65+
) : observableOf(signers.find((s) => s === _.account.publicKey ) !== undefined),
6766
),
6867
),
6968
),
70-
);
69+
toArray(),
70+
).pipe(
71+
flatMap((results) => {
72+
return observableOf(results.every((isComplete) => isComplete));
73+
}),
74+
);
7175
}
7276

7377
/**

0 commit comments

Comments
 (0)