|
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 |
|
17 | | -import { |
18 | | - MosaicCreationTransaction as MosaicDefinitionTransactionLibrary, |
19 | | - mosaicId as mosaicIdLibrary, |
20 | | - VerifiableTransaction, |
21 | | -} from 'nem2-library'; |
22 | | -import {PublicAccount} from '../account/PublicAccount'; |
23 | | -import {NetworkType} from '../blockchain/NetworkType'; |
24 | | -import {MosaicId} from '../mosaic/MosaicId'; |
25 | | -import {MosaicProperties} from '../mosaic/MosaicProperties'; |
26 | | -import {NamespaceId} from '../namespace/NamespaceId'; |
27 | | -import {UInt64} from '../UInt64'; |
28 | | -import {Deadline} from './Deadline'; |
29 | | -import {Transaction} from './Transaction'; |
30 | | -import {TransactionInfo} from './TransactionInfo'; |
31 | | -import {TransactionType} from './TransactionType'; |
| 17 | +import { MosaicCreationTransaction as MosaicDefinitionTransactionLibrary, mosaicId as mosaicIdLibrary, VerifiableTransaction } from 'nem2-library'; |
| 18 | +import { PublicAccount } from '../account/PublicAccount'; |
| 19 | +import { NetworkType } from '../blockchain/NetworkType'; |
| 20 | +import { MosaicId } from '../mosaic/MosaicId'; |
| 21 | +import { MosaicProperties } from '../mosaic/MosaicProperties'; |
| 22 | +import { NamespaceId } from '../namespace/NamespaceId'; |
| 23 | +import { UInt64 } from '../UInt64'; |
| 24 | +import { Deadline } from './Deadline'; |
| 25 | +import { Transaction } from './Transaction'; |
| 26 | +import { TransactionInfo } from './TransactionInfo'; |
| 27 | +import { TransactionType } from './TransactionType'; |
32 | 28 |
|
33 | 29 | /** |
34 | 30 | * Before a mosaic can be created or transferred, a corresponding definition of the mosaic has to be created and published to the network. |
@@ -129,4 +125,29 @@ export class MosaicDefinitionTransaction extends Transaction { |
129 | 125 |
|
130 | 126 | return mosaicDefinitionTransaction.build(); |
131 | 127 | } |
| 128 | + |
| 129 | + /** |
| 130 | + * @description re-aplly a given value to the transaction in an immutable way |
| 131 | + * @param {Deadline} deadline |
| 132 | + * @returns {Transaction} |
| 133 | + * @memberof Transaction |
| 134 | + */ |
| 135 | + public reaplygiven(newDeadline: Deadline): MosaicDefinitionTransaction { |
| 136 | + |
| 137 | + if (this.isUnannounced) { |
| 138 | + return new MosaicDefinitionTransaction( |
| 139 | + this.networkType, |
| 140 | + this.version, |
| 141 | + newDeadline, |
| 142 | + this.fee, |
| 143 | + this.parentId, |
| 144 | + this.mosaicId, |
| 145 | + this.mosaicName, |
| 146 | + this.mosaicProperties, |
| 147 | + this.signature, |
| 148 | + this.signer); |
| 149 | + } else { |
| 150 | + throw new Error('Should not modify an announced transaction'); |
| 151 | + } |
| 152 | + } |
132 | 153 | } |
0 commit comments