Skip to content

Commit 8da5886

Browse files
committed
Added resolveAliases for AggregateTransaction
1 parent e0df5c2 commit 8da5886

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

src/model/transaction/AggregateTransaction.ts

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { sha3_256 } from 'js-sha3';
1817
import { Observable } from 'rxjs/internal/Observable';
1918
import {KeyPair, MerkleHashBuilder, SHA3Hasher, SignSchema} from '../../core/crypto';
20-
import {Convert, RawArray} from '../../core/format';
19+
import {Convert} from '../../core/format';
2120
import {AggregateBondedTransactionBuilder} from '../../infrastructure/catbuffer/AggregateBondedTransactionBuilder';
2221
import {AggregateCompleteTransactionBuilder} from '../../infrastructure/catbuffer/AggregateCompleteTransactionBuilder';
2322
import {AmountDto} from '../../infrastructure/catbuffer/AmountDto';
@@ -42,6 +41,8 @@ import {Transaction} from './Transaction';
4241
import {TransactionInfo} from './TransactionInfo';
4342
import {TransactionType} from './TransactionType';
4443
import {TransactionVersion} from './TransactionVersion';
44+
import { of, from } from 'rxjs';
45+
import { map, mergeMap, toArray } from 'rxjs/operators';
4546

4647
/**
4748
* Aggregate innerTransactions contain multiple innerTransactions that can be initiated by different accounts.
@@ -409,6 +410,24 @@ export class AggregateTransaction extends Transaction {
409410
* @returns {TransferTransaction}
410411
*/
411412
resolveAliases(receiptHttp: ReceiptHttp): Observable<AggregateTransaction> {
412-
throw new Error('Not implemented');
413+
return from(this.innerTransactions).pipe(
414+
mergeMap((transaction) => transaction.resolveAliases(receiptHttp)),
415+
map((transaction) => transaction as InnerTransaction),
416+
toArray(),
417+
).pipe(
418+
map((innerTransactions) => new AggregateTransaction(
419+
this.networkType,
420+
this.type,
421+
this.version,
422+
this.deadline,
423+
this.maxFee,
424+
innerTransactions,
425+
this.cosignatures,
426+
this.signature,
427+
this.signer,
428+
this.transactionInfo,
429+
),
430+
),
431+
);
413432
}
414433
}

0 commit comments

Comments
 (0)