@interchainjs/cosmos-types
v0.0.1-beta.9
Published
Cosmos message codecs and query implementation generated by telescope for cosmos chains
Downloads
919
Readme
@interchainjs/cosmos-types
Cosmos message codecs (including Cosmos( Stargate ) and CosmWasm messages) and query implementation generated by telescope for cosmos chains
Usage
npm install @interchainjs/cosmos-types
Message
Make Encoder
and Converter
used by Cosmos
signers (taking MsgSend
as example)
import { MsgSend } from "@interchainjs/cosmos-types/cosmos/bank/v1beta1/tx";
import { toConverter, toEncoder } from "@interchainjs/cosmos/utils";
import { AminoSigner } from "@interchainjs/cosmos/signers/amino";
const encoder = toEncoder(MsgSend);
const converter = toConverter(MsgSend);
const signer = new AminoSigner(<AUTH>, [encoder], [converter], <rpc-endpoint>);
- See @interchainjs/auth to construct
<AUTH>
- See @interchainjs/cosmos to construct different
<signer>
s
Message groups
import { Msgs } from "@interchainjs/cosmos-types/cosmos";
import { CosmWasmMsgs } from "@interchainjs/cosmos-types/cosmwasm";
Query
Make queries (taking querying validators
as example)
import { RpcQuery } from "@interchainjs/cosmos-types/rpc";
const rpcQuery = new RpcQuery(<rpc-endpoint>);
const { validators } = await rpcQuery.validators({
status: bondStatusToJSON(BondStatus.BOND_STATUS_BONDED),
});
Implementations
- query
- rpc query client from
@interchainjs/cosmos-types/rpc
- rpc query client from
License
MIT License (MIT) & Apache License
Copyright (c) 2024 Cosmology (https://cosmology.zone/)