Skip to main content

Stargate

atmon3rLess than 1 minute

πŸ›  Install

yarn add @cosmjs/stargate

πŸš€ Usage

Create an app.js and put this code base:

import { StargateClient } from "@cosmjs/stargate"
const client = await StargateClient.connect('https://rpc.cosmos.directory/cosmoshub')

// Add you call here 

getBlock()

const getBlock = await client.getBlock()
console.log(getBlock.header)

getBalance()

const getBalance = await client.getBalance('cosmos13jawsn574rf3f0u5rhu7e8n6sayx5gkwjvqrkr', 'uatom')
console.log(getBalance)

getAllBalances()

const getAllBalances = await client.getAllBalances('cosmos13jawsn574rf3f0u5rhu7e8n6sayx5gkwjvqrkr')
console.log(getAllBalances)

getBalanceStaked()

const getBalanceStaked = await client.getBalanceStaked('cosmos13jawsn574rf3f0u5rhu7e8n6sayx5gkwjvqrkr')
console.log(getBalanceStaked)