brk-client 0.0.1 → 0.1.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -0
- package/index.js +5647 -4618
- package/package.json +18 -13
package/README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# brk-client
|
|
2
|
+
|
|
3
|
+
JavaScript/TypeScript client for the [Bitcoin Research Kit](https://github.com/bitcoinresearchkit/brk) API.
|
|
4
|
+
|
|
5
|
+
[npm](https://www.npmjs.com/package/brk-client) | [API Reference](https://github.com/bitcoinresearchkit/brk/blob/main/modules/brk-client/docs/globals.md)
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install brk-client
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
import { BrkClient } from 'brk-client';
|
|
17
|
+
|
|
18
|
+
// Use the free public API or your own instance
|
|
19
|
+
const client = new BrkClient('https://bitview.space');
|
|
20
|
+
// or: `const client = new BrkClient({ baseUrl: 'https://bitview.space', timeout: 10000 });`
|
|
21
|
+
|
|
22
|
+
// Blockchain data (mempool.space compatible)
|
|
23
|
+
const block = await client.getBlockByHeight(800000);
|
|
24
|
+
const tx = await client.getTx('abc123...');
|
|
25
|
+
const address = await client.getAddress('bc1q...');
|
|
26
|
+
|
|
27
|
+
// Metrics API - typed, chainable
|
|
28
|
+
const prices = await client.metrics.price.usd.split.close
|
|
29
|
+
.by.dateindex
|
|
30
|
+
.last(30); // Last 30 items
|
|
31
|
+
|
|
32
|
+
// Generic metric fetching
|
|
33
|
+
const data = await client.getMetric('price_close', 'dateindex', -30);
|
|
34
|
+
```
|