coreum-js
Warning:
This library is still in development and it is not production ready.

A JavaScript/TypeScript library for interacting with the Coreum Blockchain
This is the recommended library for integrating a JavaScript/TypeScript app with the Coreum Blockchain, especially for the use of the modules assetft, assetnft, and more. It supports integration with the most popular Browser-Extension wallets; like Keplr, Cosmostation and Leap.
Warning
IF YOU DECIDE TO USE A MNEMONIC SIGNER, FOR BETTER SECURITY USE ONLY ON THE SERVER-SIDE.
Contents
- Features
- Installation
- Query Clients
- Transaction Modules
- Usage - General
- Usage - Query balances
- Usage - Submit Transaction
- Usage - Event Subscription
Features
- Query the Coreum Blockchain with ease, using the QueryClients.
- Sign and broadcast transactions to the Coreum Blockchain using Transaction Modules
- Subscribe to events that happen on the Coreum Blockchain
- Connect using the most popular Browser-Extension wallets (Keplr, Cosmostation, Leap)
Installation
Installing coreum-js
npm i coreum-js
Query Clients
coreum-js comes with out-of-the-box modules to query the Coreum Blockchain.
Transaction Modules
coreum-js comes with out-of-the-box modules to create transaction messages compatible with the Cosmos-SDK and Coreum Blockchain.
- Authz vesting - Vesting itself
- Authz- Authorization for accounts to perform actions on behalf of other accounts.
- Bank - Token transfer functionalities.
- Coreum Asset-FT - Token issuance and management functionalities.
- Coreum Asset-NFT - Non-Fungible Tokens minting and management functionalities.
- CosmWasm - Smart Contracts functionalities.
- IBC - IBC functionalities
- Distribution - Fee distribution, and staking token provision distribution.
- Feegrant - Grant fee allowances for executing transactions.
- Staking - Proof-of-Stake layer for public blockchains.
General
import { Client } from "coreum-js";
const network = "mainnet" | "testnet" | "devnet";
const coreum: Client = new Client({ network: network });
const connectOptions = {
withWS: true | false,
};
await coreum.connect(connectOptions);
const {
ft,
nft,
staking,
distribution,
mint,
auth,
bank,
ibc,
gov,
feegrant,
nftbeta,
tx,
wasm,
} = coreum.queryClients;
const msgs: readonly EncodeObject[];
const txFee = await coreum.getTxFee(msgs);
const response = await coreum.sendTx(msgs);
const subscription = await coreum.subscribeToEvent($EVENT);
subscription.events.on($EVENT, ({ events, data }) => {
console.log("EVENT HAPPENED");
});
subscription.unsubscribe();
const registry = Client.getRegistry();
Query Balances
const { bank } = coreum.queryClients;
const address = "core1ll9gdh5ur6gyv6swgshcm4zkkw4ttakt4ukjma";
const balances = await bank.allBalances(address);
Submit a Transaction
import { Bank } from "coreum-js";
const send_message = Bank.Send({
fromAddress: $SENDER_ADDRESS,
toAddress: $RECEIVER_ADDRESS,
amount: [
{
denom: "ucore",
amount: "1000000",
},
],
});
const response = await coreum.sendTx([send_message]);
Subscribe to an Event
const event = "message.action='/coreum.assetft.v1.MsgMint'";
const subscription = await coreum.subscribeToEvent(event);
subscription.events.on(event, (eventData) => {
const { data, events } = eventData;
});
subscription.unsubscribe();