XchainJS
  • Overview
  • Installation
  • Examples instructions
  • Clients
    • xchain-evm
      • xchain-avax
        • How to Use
      • xchain-arbitrum
        • How to Use
      • xchain-bsc
        • How to Use
      • xchain-ethereum
        • How to Use
    • xchain-utxo
      • xchain-bitcoin
        • How to use
      • xchain-bitcoincash
        • How to Use
      • xchain-dash
      • xchain-doge
        • How to Use
      • xchain-litecoin
        • How to Use
    • xchain-cosmos-sdk
      • xchain-cosmos
        • How to Use
      • xchain-kujira
        • How to Use
      • xchain-mayachain
        • How to Use
      • xchain-thorchain
        • How to Use
    • xchain-binance
      • How to Use
    • xchain-solana
      • How to use
      • Examples
        • Generate address
        • Get balances
        • Get token balance
        • Prepare transaction
        • Make transaction
        • Make token transaction
  • Wallet
  • Protocols
    • THORChain
      • xchain-thorchain-amm
        • How to Use
        • Make swap using THORChain
        • Handle liquidity and savers
        • Open and close loans
      • xchain-thorchain-query
        • How to Use
        • Check transaction status
        • Estimate a swap
      • xchain-midgard
        • How to Use
      • xchain-thornode
        • How to Use
      • xchain-midgard-query
        • How to Use
    • MAYAProtocol
      • xchain-mayachain-amm
        • How to Use
        • Make swap using MAYAChain
      • xchain-mayachain-query
        • How to Use
      • xchain-mayamidgard
        • How to Use
      • xchain-mayanode
        • How to Use
      • xchain-mayamidgard-query
        • How to Use
  • Aggregator
  • Providers
    • xchain-utxo-providers
      • How it Works
    • xchain-evm-providers
      • How it Works
  • Others
    • xchain-crypto
      • How it Works
      • How to Use
    • xchain-util
      • How it Works
      • How to Use
  • Contributors
  • Documentation maintenance
Powered by GitBook
On this page
  • Installation
  • Peer Dependencies
  • Example
  1. Protocols
  2. THORChain
  3. xchain-thornode

How to Use

Previousxchain-thornodeNextxchain-midgard-query

Last updated 1 year ago

Installation

yarn add @xchainjs/xchain-thornode

Peer Dependencies

You can visit the package repository to get the updated peer dependencies by looking at the "peerDependencies" object in the "package.json" file.

Example


// THORNODE_API_9R_URL - default exported URL
import { NetworkApi, THORNODE_API_9R_URL, Configuration, TransactionsApi, QueueApi} from '@xchainjs/xchain-thornode'

    const baseUrl = THORNODE_API_9R_URL
    const apiConfigMID = new Configuration({basePath: baseUrl})
    const thornode = new TransactionsApi(apiConfigMID)
    const queueApi = new QueueApi(apiConfigMID)
    const networkApi = new NetworkApi(apiConfigMID)
    const scheduledOutbound = await queueApi.queueScheduled()
    const queueOutbound = await queueApi.queueOutbound()
    const lastBlock = await networkApi.lastblock()
    const test = await thornode.tx("BDF3507E7A4E4966BF415DD786AFD31AFA04FBF22BEA2EF2B906C9F067A30D83")


    console.log(test.data.observed_tx)
    const lastBlockHeight = lastBlock.data.find((item) => item.thorchain)
    console.log(queueOutbound.data.find((item) => item.chain))
    const schedHeight = scheduledOutbound.data.find((item) => item.height)
    console.log(lastBlockHeight)
    console.log(schedHeight)
xchain-thornode