|
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 |
|
17 | | -import {AggregateTransaction as AggregateTransactionLibrary} from 'nem2-library'; |
18 | | -import {Account} from '../account/Account'; |
19 | | -import {PublicAccount} from '../account/PublicAccount'; |
20 | | -import {NetworkType} from '../blockchain/NetworkType'; |
21 | | -import {UInt64} from '../UInt64'; |
22 | | -import {AggregateTransactionCosignature} from './AggregateTransactionCosignature'; |
23 | | -import {Deadline} from './Deadline'; |
24 | | -import {InnerTransaction} from './InnerTransaction'; |
25 | | -import {SignedTransaction} from './SignedTransaction'; |
26 | | -import {Transaction} from './Transaction'; |
27 | | -import {TransactionInfo} from './TransactionInfo'; |
28 | | -import {TransactionType} from './TransactionType'; |
| 17 | +import { AggregateTransaction as AggregateTransactionLibrary } from 'nem2-library'; |
| 18 | +import { Account } from '../account/Account'; |
| 19 | +import { PublicAccount } from '../account/PublicAccount'; |
| 20 | +import { NetworkType } from '../blockchain/NetworkType'; |
| 21 | +import { UInt64 } from '../UInt64'; |
| 22 | +import { AggregateTransactionCosignature } from './AggregateTransactionCosignature'; |
| 23 | +import { Deadline } from './Deadline'; |
| 24 | +import { InnerTransaction } from './InnerTransaction'; |
| 25 | +import { SignedTransaction } from './SignedTransaction'; |
| 26 | +import { Transaction } from './Transaction'; |
| 27 | +import { TransactionInfo } from './TransactionInfo'; |
| 28 | +import { TransactionType } from './TransactionType'; |
29 | 29 |
|
30 | 30 | /** |
31 | 31 | * Aggregate innerTransactions contain multiple innerTransactions that can be initiated by different accounts. |
@@ -145,4 +145,28 @@ export class AggregateTransaction extends Transaction { |
145 | 145 | || (this.signer !== undefined && this.signer.equals(publicAccount)); |
146 | 146 | } |
147 | 147 |
|
| 148 | + /** |
| 149 | + * @description re-aplly a given value to the transaction in an immutable way |
| 150 | + * @param {Deadline} deadline |
| 151 | + * @returns {Transaction} |
| 152 | + * @memberof Transaction |
| 153 | + */ |
| 154 | + public reaplygiven(newDeadline: Deadline): AggregateTransaction { |
| 155 | + |
| 156 | + if (this.isUnannounced) { |
| 157 | + return new AggregateTransaction( |
| 158 | + this.networkType, |
| 159 | + this.type, |
| 160 | + this.version, |
| 161 | + newDeadline, |
| 162 | + this.fee, |
| 163 | + this.innerTransactions, |
| 164 | + this.cosignatures, |
| 165 | + this.signature, |
| 166 | + this.signer); |
| 167 | + } else { |
| 168 | + throw new Error('Should not modify an announced transaction'); |
| 169 | + } |
| 170 | + } |
| 171 | + |
148 | 172 | } |
0 commit comments