0.3.13 • Published 11 days ago

@xchainjs/xchain-thornode v0.3.13

Weekly downloads
-
License
MIT
Repository
github
Last release
11 days ago

@xchainjs/xchain-thornode

Thornode Module for XChainJS Clients

Modules

Thornode module has been created using openapi-generator-cli to auto-generate rest api reading from "https://gitlab.com/thorchain/thornode/-/raw/release-{version}/openapi/openapi.yaml" This library exposes all the Api's outlined in the swagger doc "https://thornode.ninerealms.com/thorchain/doc"

Installation

yarn add @xchainjs/xchain-thornode

Examples

Request data from MimirApi

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

  const baseUrl = THORNODE_API_9R_URL
  const apiconfig = new Configuration({ basePath: baseUrl })
  const mimirApi = new MimirApi(apiconfig)
  const mimirResponse = await mimirApi.mimir()
  console.log(mimirResponse.data)

Example - set custom header

Request data from MimirApi

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

  const baseUrl = THORNODE_API_9R_URL
  const headers = {"x-client-id": "my-custom-val"}
  const baseOptions = { headers }
  const apiconfig = new Configuration({ basePath: baseUrl , baseOptions })
  const mimirApi = new MimirApi(apiconfig)
  const mimirResponse = await mimirApi.mimir()
  console.log(mimirResponse.data)

Documentation

Thornode 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

0.3.13

11 days ago

0.3.12

1 month ago

0.3.11

2 months ago

0.3.10

4 months ago

0.3.9

6 months ago

0.3.6

8 months ago

0.3.5

9 months ago

0.3.8

7 months ago

0.3.7

7 months ago

0.3.4

10 months ago

0.3.2

12 months ago

0.3.1

1 year ago

0.3.3

11 months ago

0.3.0

1 year ago

0.2.1

1 year ago

0.2.3

1 year ago

0.2.2

1 year ago

0.2.0

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

2 years ago

0.1.0

2 years ago

0.1.0-alpha4

2 years ago

0.1.0-alpha3

2 years ago

0.1.0-alpha2

2 years ago

0.1.0-alpha

2 years ago