|
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 |
|
17 | | -import {TransferTransaction as TransferTransactionLibrary, VerifiableTransaction,} from 'nem2-library'; |
18 | | -import {Address} from '../account/Address'; |
19 | | -import {PublicAccount} from '../account/PublicAccount'; |
20 | | -import {NetworkType} from '../blockchain/NetworkType'; |
21 | | -import {Mosaic} from '../mosaic/Mosaic'; |
22 | | -import {UInt64} from '../UInt64'; |
23 | | -import {Deadline} from './Deadline'; |
24 | | -import {Message} from './Message'; |
25 | | -import {Transaction} from './Transaction'; |
26 | | -import {TransactionInfo} from './TransactionInfo'; |
27 | | -import {TransactionType} from './TransactionType'; |
| 17 | +import { TransferTransaction as TransferTransactionLibrary, VerifiableTransaction } from 'nem2-library'; |
| 18 | +import { Address } from '../account/Address'; |
| 19 | +import { PublicAccount } from '../account/PublicAccount'; |
| 20 | +import { NetworkType } from '../blockchain/NetworkType'; |
| 21 | +import { Mosaic } from '../mosaic/Mosaic'; |
| 22 | +import { UInt64 } from '../UInt64'; |
| 23 | +import { Deadline } from './Deadline'; |
| 24 | +import { Message } from './Message'; |
| 25 | +import { Transaction } from './Transaction'; |
| 26 | +import { TransactionInfo } from './TransactionInfo'; |
| 27 | +import { TransactionType } from './TransactionType'; |
28 | 28 |
|
29 | 29 | /** |
30 | 30 | * Transfer transactions contain data about transfers of mosaics and message to another account. |
@@ -101,4 +101,28 @@ export class TransferTransaction extends Transaction { |
101 | 101 | .addMessage(this.message) |
102 | 102 | .build(); |
103 | 103 | } |
| 104 | + |
| 105 | + /** |
| 106 | + * @description re-aplly a given value to the transaction in an immutable way |
| 107 | + * @param {Deadline} deadline |
| 108 | + * @returns {Transaction} |
| 109 | + * @memberof Transaction |
| 110 | + */ |
| 111 | + public reaplygiven(newDeadline: Deadline): TransferTransaction { |
| 112 | + |
| 113 | + if (this.isUnannounced) { |
| 114 | + return new TransferTransaction( |
| 115 | + this.networkType, |
| 116 | + this.version, |
| 117 | + newDeadline, |
| 118 | + this.fee, |
| 119 | + this.recipient, |
| 120 | + this.mosaics, |
| 121 | + this.message, |
| 122 | + this.signature, |
| 123 | + this.signer); |
| 124 | + } else { |
| 125 | + throw new Error('Should not modify an announced transaction'); |
| 126 | + } |
| 127 | + } |
104 | 128 | } |
0 commit comments