Skip to content

Commit b804926

Browse files
committed
reapply given for supply
1 parent c99bad3 commit b804926

File tree

1 file changed

+34
-10
lines changed

1 file changed

+34
-10
lines changed

src/model/transaction/MosaicSupplyChangeTransaction.ts

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@
1414
* limitations under the License.
1515
*/
1616

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';
2727

2828
/**
2929
* 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 {
103103
.addDelta(this.delta.toDTO())
104104
.build();
105105
}
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+
}
106130
}

0 commit comments

Comments
 (0)