Getting the mosaic information

Get the ownership, divisibility, duration, and flags for a given mosaic identifier.

Prerequisites

Method #01: Using the SDK

// replace with mosaic id
const mosaicIdHex = '71415AC19C818709';
const mosaicId = new MosaicId(mosaicIdHex);

// replace with node endpoint
const nodeUrl = 'http://api-01.ap-northeast-1.testnet-0951-v1.symboldev.network:3000';
const repositoryFactory = new RepositoryFactoryHttp(nodeUrl);
const mosaicHttp = repositoryFactory.createMosaicRepository();

mosaicHttp
    .getMosaic(mosaicId)
    .subscribe((mosaicInfo) => console.log(mosaicInfo), (err) => console.error(err));
// replace with mosaic id
const mosaicIdHex = '71415AC19C818709';
const mosaicId = new symbol_sdk_1.MosaicId(mosaicIdHex);
// replace with node endpoint
const nodeUrl = 'http://api-01.ap-northeast-1.testnet-0951-v1.symboldev.network:3000';
const repositoryFactory = new symbol_sdk_1.RepositoryFactoryHttp(nodeUrl);
const mosaicHttp = repositoryFactory.createMosaicRepository();
mosaicHttp
    .getMosaic(mosaicId)
    .subscribe((mosaicInfo) => console.log(mosaicInfo), (err) => console.error(err));
        try (final RepositoryFactory repositoryFactory = new RepositoryFactoryVertxImpl(
                "http://api-01.ap-northeast-1.testnet-0951-v1.symboldev.network:3000")) {
            // replace with mosaic id
            final String mosaicIdHex = "71415AC19C818709";
            final MosaicId mosaicId = new MosaicId(mosaicIdHex);

            final MosaicRepository mosaicRepository = repositoryFactory
                    .createMosaicRepository();

            final MosaicInfo mosaicInfo = mosaicRepository.getMosaic(mosaicId)
                    .toFuture()
                    .get();
            final JsonHelper helper = new JsonHelperJackson2();
            System.out.println(helper.prettyPrint(mosaicInfo));
        }

Method #02: Using the CLI

symbol-cli mosaic info --mosaic-id 71415AC19C818709