|
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 |
|
17 | | -import {VerifiableTransaction} 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 {AggregateTransactionInfo} from './AggregateTransactionInfo'; |
23 | | -import {Deadline} from './Deadline'; |
24 | | -import {InnerTransaction} from './InnerTransaction'; |
25 | | -import {SignedTransaction} from './SignedTransaction'; |
26 | | -import {TransactionInfo} from './TransactionInfo'; |
| 17 | +import { VerifiableTransaction } 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 { AggregateTransactionInfo } from './AggregateTransactionInfo'; |
| 23 | +import { Deadline } from './Deadline'; |
| 24 | +import { InnerTransaction } from './InnerTransaction'; |
| 25 | +import { SignedTransaction } from './SignedTransaction'; |
| 26 | +import { TransactionInfo } from './TransactionInfo'; |
27 | 27 |
|
28 | 28 | /** |
29 | 29 | * An abstract transaction class that serves as the base class of all NEM transactions. |
@@ -156,4 +156,17 @@ export abstract class Transaction { |
156 | 156 | const versionDTO = this.networkType.toString(16) + '0' + this.version.toString(16); |
157 | 157 | return parseInt(versionDTO, 16); |
158 | 158 | } |
| 159 | + |
| 160 | + /** |
| 161 | + * @description re-aplly a given value to the transaction in an immutable way |
| 162 | + * @param {Deadline} deadline |
| 163 | + * @returns {Transaction} |
| 164 | + * @memberof Transaction |
| 165 | + */ |
| 166 | + public replyGiven(deadline: Deadline = Deadline.create()): Transaction { |
| 167 | + if (this.isUnannounced()) { |
| 168 | + return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, {deadline}); |
| 169 | + } |
| 170 | + throw new Error('an Announced transaction can\'t be modified'); |
| 171 | + } |
159 | 172 | } |
0 commit comments