Skip to content

Mosaic supply change transaction

Chun Lam edited this page Feb 21, 2024 · 4 revisions
import { Deadline, Account, NetworkType, UInt64, MosaicId, 
    MosaicSupplyChangeTransaction, MosaicSupplyType 
} from 'tsjs-xpx-chain-sdk';
import { Network } from '../utils';

const network = new Network('http://localhost:3000');

const sender = Account.createFromPrivateKey(
    '28FCECEA252231D2C86E1BCF7DD541552BDBBEFBB09324758B3AC199B4AA7B78',
    NetworkType.MIJIN_TEST, 1);

const mosaicSupplyChangeTransaction = MosaicSupplyChangeTransaction.create(
    Deadline.create(),
    new MosaicId([2441356910,72797447]), // or you can use hexadecimal string
    MosaicSupplyType.Increase,
    UInt64.fromUint(1000),
    NetworkType.MIJIN_TEST
)

network.networkProperties.then(networkProperties => {
    const signedMosaicSupplyChangeTransaction = sender.preV2Sign(mosaicSupplyChangeTransaction, networkProperties.generationHash);

    network.announceAndWaitForConfirmation(signedMosaicSupplyChangeTransaction).then(tx => {
        console.log('Confirmed:');
        console.log(tx);
    });
});