import {
MsgSetDenomMetadata,
} from "@injectivelabs/sdk-ts";
import { BigNumberInBase } from "@injectivelabs/utils";
import { Network } from "@injectivelabs/networks";
const injectiveAddress = "inj1...";
const privateKey = "0x...";
const subdenom = 'inj-test'
const denom = `factory/${injectiveAddress}/${subdenom}`;
const amount = 1_000_000_000
const msgCreateDenom = MsgCreateDenom.fromJSON({
subdenom,
sender: injectiveAddress,
});
const msgMint = MsgMint.fromJSON({
sender: injectiveAddress,
amount: {
denom: `factory/${injectiveAddress}/${subdenom}`,
amount: amount
}
});
const msgChangeAdmin = MsgChangeAdmin.fromJSON({
denom: `factory/${injectiveAddress}/${subdenom}`,
sender: injectiveAddress,
newAdmin: 'inj1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqe2hm49' /** SET TO ZERO ADDRESS */
});
const msgSetDenomMetadata = MsgSetDenomMetadata.fromJSON({
sender: injectiveAddress,
metadata: {
base: denom, /** the base denom */
description: '', /** description of your token */
display: '', /** the displayed name of your token on UIs */,
name: '', /** the name of your token */,
symbol: '' /** the symbol of your token */,
uri: '' /** the logo of your token, should be hosted on IPFS and should be a small webp image */
denomUnits: [
{
denom: denom,
exponent: 0,
aliases: [subdenom]
},
{
denom: subdenom,
exponent: 6, /** if you want your token to have 6 decimals */
aliases: []
},
]
}
});
const txHash = await new MsgBroadcasterWithPk({
privateKey,
network: Network.Testnet
}).broadcast({
msgs: [msgCreateDenom, msgMint, msgSetDenomMetadata, msgChangeAdmin]
});
console.log(txHash);