@xchainjs/xchain-midgard

v0.5.11
Midgard module that exposes all midgard functions using openapi-generator-cli
XChain Midgard

@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-midgard

Examples

Request data from midgardApi

import { MidgardApi } from '@xchainjs/xchain-midgard'

const midgardApi = new MidgardApi()
const data = midgardApi.getPool('BTC.BTC')

Documentation

Midgard Thorchain endpoint Midgard NineRelms endpoint

Setting Headers for Nine Realms endpoints

If you plan on using the publically accessible endpoints provided by Nine Realms(listed below), ensure that you add a valid 'x-client-id' to all requests

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

npm i @xchainjs/xchain-midgard

Metadata

  • MIT
  • Whatever
  • THORChain
  • released 10/11/2024

Downloads