|
14 | 14 | * limitations under the License.
|
15 | 15 | */
|
16 | 16 |
|
17 |
| -import {MosaicSupplyChangeTransaction as MosaicSupplyChangeTransactionLibrary, VerifiableTransaction} from 'nem2-library'; |
18 |
| -import {PublicAccount} from '../account/PublicAccount'; |
19 |
| -import {NetworkType} from '../blockchain/NetworkType'; |
20 |
| -import {MosaicId} from '../mosaic/MosaicId'; |
21 |
| -import {MosaicSupplyType} from '../mosaic/MosaicSupplyType'; |
22 |
| -import {UInt64} from '../UInt64'; |
23 |
| -import {Deadline} from './Deadline'; |
24 |
| -import {Transaction} from './Transaction'; |
25 |
| -import {TransactionInfo} from './TransactionInfo'; |
26 |
| -import {TransactionType} from './TransactionType'; |
| 17 | +import { MosaicSupplyChangeTransaction as MosaicSupplyChangeTransactionLibrary, VerifiableTransaction } from 'nem2-library'; |
| 18 | +import { PublicAccount } from '../account/PublicAccount'; |
| 19 | +import { NetworkType } from '../blockchain/NetworkType'; |
| 20 | +import { MosaicId } from '../mosaic/MosaicId'; |
| 21 | +import { MosaicSupplyType } from '../mosaic/MosaicSupplyType'; |
| 22 | +import { UInt64 } from '../UInt64'; |
| 23 | +import { Deadline } from './Deadline'; |
| 24 | +import { Transaction } from './Transaction'; |
| 25 | +import { TransactionInfo } from './TransactionInfo'; |
| 26 | +import { TransactionType } from './TransactionType'; |
27 | 27 |
|
28 | 28 | /**
|
29 | 29 | * In case a mosaic has the flag 'supplyMutable' set to true, the creator of the mosaic can change the supply,
|
@@ -103,4 +103,28 @@ export class MosaicSupplyChangeTransaction extends Transaction {
|
103 | 103 | .addDelta(this.delta.toDTO())
|
104 | 104 | .build();
|
105 | 105 | }
|
| 106 | + |
| 107 | + /** |
| 108 | + * @description re-aplly a given value to the transaction in an immutable way |
| 109 | + * @param {Deadline} deadline |
| 110 | + * @returns {Transaction} |
| 111 | + * @memberof Transaction |
| 112 | + */ |
| 113 | + public reaplygiven(newDeadline: Deadline): MosaicSupplyChangeTransaction { |
| 114 | + |
| 115 | + if (this.isUnannounced) { |
| 116 | + return new MosaicSupplyChangeTransaction( |
| 117 | + this.networkType, |
| 118 | + this.version, |
| 119 | + newDeadline, |
| 120 | + this.fee, |
| 121 | + this.mosaicId, |
| 122 | + this.direction, |
| 123 | + this.delta, |
| 124 | + this.signature, |
| 125 | + this.signer); |
| 126 | + } else { |
| 127 | + throw new Error('Should not modify an announced transaction'); |
| 128 | + } |
| 129 | + } |
106 | 130 | }
|
0 commit comments