Skip to content

Latest commit

 

History

History
72 lines (49 loc) · 1.65 KB

README.md

File metadata and controls

72 lines (49 loc) · 1.65 KB

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