cosmos-client-ts
JavaScript / TypeScript client for Cosmos SDK blockchain.
Install
npm install --save cosmos-client
Example
import { CosmosSDK, AccAddress, PrivKeyEd25519 } from "cosmos-client";
import { auth, StdTx } from "cosmos-client/x/auth";
import { bank } from "cosmos-client/x/bank";
const sdk = new CosmosSDK(hostURL, chainID);
let fromAddress: AccAddress;
let privKey: PrivKeyEd25519;
const account = await auth
.accountsAddressGet(sdk, fromAddress)
.then((res) => res.data);
let toAddress: AccAddress;
const unsignedStdTx = await bank
.accountsAddressTransfersPost(sdk, toAddress, { ... })
.then((res) => res.data);
const signedStdTx = auth.signStdTx(
sdk,
privKey,
unsignedStdTx,
account.account_number,
account.sequence + 1,
);
await auth.txsPost(sdk, signedStdTx, "sync");
For library developlers
swagger.yml
openapi-generator generate -g typescript-axios -i swagger.yaml -o ./src