@xchainjs/xchain-midgard
v1.1.2
Published
Midgard module that exposes all midgard functions using openapi-generator-cli
Readme
@xchainjs/xchain-midgard
Midgard Module for XChainJS Clients
Modules
Midgard module has been created using openapi-generator-cli auto-generation reading from "https://midgard.thorchain.info/v2/swagger.json" This library exposes all the midgard api functions defined in the swagger doc "https://midgard.thorchain.info/v2/swagger.json"
Installation
yarn add @xchainjs/xchain-midgardExamples
Request data from midgardApi
import { MidgardApi } from '@xchainjs/xchain-midgard'
const midgardApi = new MidgardApi()
const data = midgardApi.getPool('BTC.BTC')
Documentation
Setting Headers for public endpoints
If you plan on using the publicly accessible endpoints listed below, ensure that you add a valid 'x-client-id' to all requests
- https://gateway.liquify.com/chain/thorchain_midgard
- https://api.haskoin.com (BTC/BCH/LTC)
- https://gateway.liquify.com/chain/thorchain_api
Example
import cosmosclient from '@cosmos-client/core'
import axios from 'axios'
import { register9Rheader } from '@xchainjs/xchain-util'
register9Rheader(axios)
register9Rheader(cosmosclient.config.globalAxios)For a complete example please see this test
