Skip to content

Commit 34ddd64

Browse files
authored
Merge pull request #42 from xchainjs/docs-14122023
Mayachain docs
2 parents eb8e7a2 + a466861 commit 34ddd64

File tree

9 files changed

+102
-2
lines changed

9 files changed

+102
-2
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
sort: 3
3+
---
4+
5+
# Available Functions
6+
7+
{% include list.liquid all=true %}

xchain-mayachain-query/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sort: 3
2+
sort: 2
33
---
44

55
# MAYACHAIN-QUERY
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
sort: 3
3+
---
4+
5+
# Available Functions
6+
7+
{% include list.liquid all=true %}

xchain-mayamidgard-query/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
sort: 2
3+
---
4+
5+
# MAYAMIDGARD-QUERY
6+
7+
Custom midgard query package
8+
9+
{% include list.liquid all=true %}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
sort: 3
3+
---
4+
5+
# Available Functions
6+
7+
{% include list.liquid all=true %}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
sort: 1
3+
---
4+
5+
# How it works
6+
7+
Mayachain Midgard-query module use Midgard Api's to query [Midgard API].
8+
9+
Midgard is a layer 2 REST API that provides *front-end consumers with semi real-time* rolled up data
10+
and analytics of the Mayachain network. Most requests to the network will come through Midgard. This
11+
daemon is here to keep the chain itself from fielding large quantities of requests. You can think of
12+
it as a “read-only slave” to the chain. This keeps the resources of the network focused on
13+
processing transactions.
14+
15+
## Dependencies
16+
17+
* [`@xchainjs/xchain-client`](http://docs.xchainjs.org/xchain-client/interface.html)
18+
* [`@xchainjs/xchain-util`](http://docs.xchainjs.org/xchain-util/how-to-use.html)
19+
* [`@xchainjs/xchain-mayamidgard`](http://docs.xchainjs.org/xchain-mayamidgard-query/how-to-use.html)
20+
21+
[Mayachain Midgard API]: https://gitlab.com/thorchain/midgard/-/tree/develop?ref_type=heads
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
sort: 2
3+
---
4+
5+
# How to use
6+
7+
## Installation
8+
9+
```
10+
yarn add @xchainjs/xchain-midgard-query
11+
```
12+
13+
Following peer dependencies have to be installed into your project. These are not included in `@xchainjs/xchain-midgard-query`.
14+
15+
```
16+
yarn add @xchainjs/xchain-client @xchainjs/xchain-util @xchainjs/xchain-midgard axios axios-retry bignumber.js
17+
```
18+
19+
## Basic usage examples
20+
```ts
21+
import { AssetBTC } from '@xchainjs/xchain-bitcoin'
22+
import { AssetATOM } from '@xchainjs/xchain-cosmos'
23+
import { Midgard, MidgardCache, MidgardQuery, SaversPosition } from '@xchainjs/xchain-midgard-query'
24+
import { Network } from '@xchainjs/xchain-client'
25+
26+
const saverBtc: getSaver = {
27+
asset: AssetBTC,
28+
address: '',
29+
}
30+
const saverAtom: getSaver = {
31+
asset: AssetATOM,
32+
address: '',
33+
}
34+
35+
const midgardCache = new MidgardCache(new Midgard(Network.Testnet))
36+
const midgardQuery = new MidgardQuery(midgardCache)
37+
// Get saver positions (cached)
38+
const getSavers: SaversPosition[] = await midgardQuery.getSaverPositions([saverAtom, saverBtc])
39+
// Get thorname info (no cached)
40+
const thorname = await midgardQuery.midgardCache.midgard.getTHORNameDetails('gx')
41+
```
42+

xchain-mayamidgard/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sort: 3
2+
sort: 2
33
---
44

55
# XCHAIN MAYAMIDGARD
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
sort: 3
3+
---
4+
5+
# Available Functions
6+
7+
{% include list.liquid all=true %}

0 commit comments

Comments
 (0)