Token factory in apps
The tokenfactory module lets accounts create new native denoms with a factory prefix. Operator CLI details: tokenfactory module.
- Web (TypeScript)
- React Native
- Flutter (CosmJS)
- CLI
// MsgCreateDenom (typeUrl varies by chain version; confirm against your node)
const msg = {
typeUrl: '/safrochain.tokenfactory.v1beta1.MsgCreateDenom',
value: {
sender: address,
subdenom: 'MYTOKEN',
},
};
await client.signAndBroadcast(address, [msg], 'auto');
// Factory denom format: factory/{creator}/MYTOKEN
Verify exact message types against your running safrochaind version and tokenfactory docs.
Same protobuf message as web. Mint and burn msgs follow the same signAndBroadcast pattern after denom creation.
const msg = {
typeUrl: '/safrochain.tokenfactory.v1beta1.MsgCreateDenom',
value: { sender: address, subdenom: 'MYTOKEN' },
};
await client.signAndBroadcast(address, [msg], 'auto');
safrochaind tx tokenfactory create-denom MYTOKEN \
--from creator \
--chain-id safro-testnet-1 \
--node https://rpc.testnet.safrochain.com:443 \
--gas auto --gas-adjustment 1.3 --gas-prices 0.05usaf -y