Skip to content

Commit f549100

Browse files
committed
reapply given for aggregate
1 parent 75d0c36 commit f549100

File tree

1 file changed

+36
-12
lines changed

1 file changed

+36
-12
lines changed

src/model/transaction/AggregateTransaction.ts

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@
1414
* limitations under the License.
1515
*/
1616

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';
2929

3030
/**
3131
* Aggregate innerTransactions contain multiple innerTransactions that can be initiated by different accounts.
@@ -145,4 +145,28 @@ export class AggregateTransaction extends Transaction {
145145
|| (this.signer !== undefined && this.signer.equals(publicAccount));
146146
}
147147

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+
148172
}

0 commit comments

Comments
 (0)