0.0.22 • Published 6 years ago
@lunie/cosmos-js v0.0.22
Cosmos JS - Wrapper for Cosmos REST API
Install
yarn add @lunie/cosmos-js
Use
Simple example of how to send tokens.
import Cosmos from "@lunie/cosmos-js"
const STARGATE_URL = "https://stargate.cosmos.network"
const ADDRESS = "cosmos1abcd1234"
const cosmos = Cosmos(STARGATE_URL, ADDRESS)
// create the transaction object
const msg = cosmos
.MsgSend({toAddress: 'cosmos1abcd09876', amounts: [{ denom: 'stake', amount: 10 }})
// estimate the needed gas amount
const gasEstimate = await msg.simulate()
// create a signer
const ledgerSigner = ... // async (signMessage: string) => { signature: Buffer, publicKey: Buffer }
// send the transaction
const { included }= await msg.send({ gas: gasEstimate }, ledgerSigner)
// await tx to be included in a block
await included()
API
If you want to query data only, you don't need to specify an address.
import { API } from "@lunie/cosmos-js"
const STARGATE_URL = "https://stargate.cosmos.network"
const api = API(STARGATE_URL)
const validators = await api.validators()
0.0.22
6 years ago
0.0.21
6 years ago
0.0.20
6 years ago
0.0.19
6 years ago
0.0.18
6 years ago
0.0.17
6 years ago
0.0.16
6 years ago
0.0.15
6 years ago
0.0.14
6 years ago
0.0.13
6 years ago
0.0.12
6 years ago
0.0.11
6 years ago
0.0.6
6 years ago
0.0.5
6 years ago
0.0.4
6 years ago
0.0.3
6 years ago
0.0.2
6 years ago
0.0.1
6 years ago