brk-client 0.0.1 → 0.1.0-alpha.3

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.
Files changed (3) hide show
  1. package/README.md +53 -0
  2. package/index.js +5539 -4626
  3. package/package.json +18 -13
package/README.md ADDED
@@ -0,0 +1,53 @@
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
+
21
+ // Blockchain data (mempool.space compatible)
22
+ const block = await client.getBlockByHeight(800000);
23
+ const tx = await client.getTx('abc123...');
24
+ const address = await client.getAddress('bc1q...');
25
+
26
+ // Metrics API - typed, chainable
27
+ const prices = await client.metrics.price.usd.split.close
28
+ .by.dateindex
29
+ .last(30); // Last 30 items
30
+
31
+ // Generic metric fetching
32
+ const data = await client.getMetric('price_close', 'dateindex', -30);
33
+ ```
34
+
35
+ ## API
36
+
37
+ ```javascript
38
+ // Range methods
39
+ .first(n) // First n items
40
+ .last(n) // Last n items
41
+ .slice(start, end)
42
+ .get(index) // Single item
43
+ .skip(n).take(m) // Pagination
44
+ ```
45
+
46
+ ## Configuration
47
+
48
+ ```javascript
49
+ const client = new BrkClient({
50
+ baseUrl: 'https://bitview.space',
51
+ timeout: 10000 // ms
52
+ });
53
+ ```