Skip to content

likecoin/iscn-message-types

Repository files navigation

ISCN-Message-Types

Provides javascript/typescript protobuf message definition for ISCN messsage.

NPM Version

Install

npm i -S @likecoin/iscn-message-types

Usage

With cosmjs SigningStargateClient

import { MsgCreateIscnRecord } from '@likecoin/iscn-message-types/dist/iscn/tx';

const registry = new Registry([
  ...defaultRegistryTypes,
  ['/likechain.iscn.MsgCreateIscnRecord', MsgCreateIscnRecord],
]);

const client = await SigningStargateClient.connectWithSigner(
  RPC_URL,
  signer,
  { registry }
);

...

const message = {
  typeUrl: '/likechain.iscn.MsgCreateIscnRecord',
  value: {
    from: address,
    record,
  },
};

...

const response = await client.signAndBroadcast(address, [message], fee, '');
assertIsBroadcastTxSuccess(response);

With cosmjs QueryClient

Please refer to iscn-js's ISCNQueryExtension and cosmjs documentation

Development

  • Fetch cosmos .proto files needed to ./cosmos
./scripts/1_clone_cosmos_proto.sh
  • Build typescript definition in ./src
./scripts/2_generate_typescript.sh
  • Build javascript definition to ./dist
npm run build