|
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 |
|
17 | | -import {HashLockTransaction, VerifiableTransaction} from 'nem2-library'; |
18 | | -import {PublicAccount} from '../account/PublicAccount'; |
19 | | -import {NetworkType} from '../blockchain/NetworkType'; |
20 | | -import {Mosaic} from '../mosaic/Mosaic'; |
21 | | -import {UInt64} from '../UInt64'; |
22 | | -import {Deadline} from './Deadline'; |
23 | | -import {SignedTransaction} from './SignedTransaction'; |
24 | | -import {Transaction} from './Transaction'; |
25 | | -import {TransactionInfo} from './TransactionInfo'; |
26 | | -import {TransactionType} from './TransactionType'; |
| 17 | +import { HashLockTransaction, VerifiableTransaction } from 'nem2-library'; |
| 18 | +import { PublicAccount } from '../account/PublicAccount'; |
| 19 | +import { NetworkType } from '../blockchain/NetworkType'; |
| 20 | +import { Mosaic } from '../mosaic/Mosaic'; |
| 21 | +import { UInt64 } from '../UInt64'; |
| 22 | +import { Deadline } from './Deadline'; |
| 23 | +import { SignedTransaction } from './SignedTransaction'; |
| 24 | +import { Transaction } from './Transaction'; |
| 25 | +import { TransactionInfo } from './TransactionInfo'; |
| 26 | +import { TransactionType } from './TransactionType'; |
27 | 27 |
|
28 | 28 | /** |
29 | 29 | * Lock funds transaction is used before sending an Aggregate bonded transaction, as a deposit to announce the transaction. |
@@ -114,4 +114,28 @@ export class LockFundsTransaction extends Transaction { |
114 | 114 | .build(); |
115 | 115 | } |
116 | 116 |
|
| 117 | + /** |
| 118 | + * @description re-aplly a given value to the transaction in an immutable way |
| 119 | + * @param {Deadline} deadline |
| 120 | + * @returns {Transaction} |
| 121 | + * @memberof Transaction |
| 122 | + */ |
| 123 | + public reaplygiven(deadline: Deadline, signedTransaction: SignedTransaction): LockFundsTransaction { |
| 124 | + |
| 125 | + if (this.isUnannounced) { |
| 126 | + return new LockFundsTransaction( |
| 127 | + this.networkType, |
| 128 | + this.type, |
| 129 | + deadline, |
| 130 | + this.fee, |
| 131 | + this.mosaic, |
| 132 | + this.duration, |
| 133 | + signedTransaction, |
| 134 | + this.signature, |
| 135 | + this.signer); |
| 136 | + } else { |
| 137 | + throw new Error('Should not modify an announced transaction'); |
| 138 | + } |
| 139 | + } |
| 140 | + |
117 | 141 | } |
0 commit comments