How to Use

Installation

yarn add @xchainjs/xchain-midgard-query

Peer Dependencies

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

Examples

import { AssetBTC } from '@xchainjs/xchain-bitcoin'
import { AssetATOM } from '@xchainjs/xchain-cosmos'
import { Midgard, MidgardCache, MidgardQuery, SaversPosition } from '@xchainjs/xchain-midgard-query'
import { Network } from '@xchainjs/xchain-client'

const saverBtc: getSaver = {
  asset: AssetBTC,
  address: '',
}
const saverAtom: getSaver = {
  asset: AssetATOM,
  address: '',
}

const midgardCache = new MidgardCache(new Midgard(Network.Testnet))
const midgardQuery = new MidgardQuery(midgardCache)
// Get saver positions (cached)
const getSavers: SaversPosition[] = await midgardQuery.getSaverPositions([saverAtom, saverBtc])
// Get thorname info (no cached)
const thorname = await midgardQuery.midgardCache.midgard.getTHORNameDetails('gx')

Last updated