Skip to content

Commit

Permalink
added docs for getBlockchainInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
fuxingloh committed Mar 29, 2021
1 parent d4be3f0 commit 0faeb0e
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/jellyfish-api-core/src/category/blockchain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class Blockchain {
}

/**
* Returns an object containing various state info regarding blockchain processing.
* Get various state info regarding blockchain processing.
* @return Promise<BlockchainInfo>
*/
async getBlockchainInfo (): Promise<BlockchainInfo> {
Expand Down
46 changes: 46 additions & 0 deletions website/docs/jellyfish/api/blockchain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
id: blockchain
title: Blockchain API
sidebar_label: Blockchain API
slug: /jellyfish/api/blockchain
---

```js
import {Client} from '@defichain/jellyfish'
const client = new Client()

// Using client.blockchain.
const something = await client.blockchain.method()
```

## getBlockchainInfo

Get various state info regarding blockchain processing.

```ts title="client.blockchain.getBlockchainInfo()"
interface blockchain {
getBlockchainInfo (): Promise<BlockchainInfo>
}

interface BlockchainInfo {
chain: 'main' | 'test' | 'regtest' | string
blocks: number
headers: number
bestblockhash: string
difficulty: number
mediantime: number
verificationprogress: number
initialblockdownload: boolean
chainwork: string
size_on_disk: number
pruned: boolean
softforks: {
[id: string]: {
type: 'buried' | 'bip9'
active: boolean
height: number
}
}
warnings: string
}
```
1 change: 1 addition & 0 deletions website/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module.exports = {
label: 'DeFi APIs',
collapsed: false,
items: [
'jellyfish/api/blockchain',
'jellyfish/api/mining',
'jellyfish/api/wallet'
]
Expand Down

0 comments on commit 0faeb0e

Please sign in to comment.