@tribulnation/catalogue 0.1.0 → 0.1.2

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 (2) hide show
  1. package/README.md +95 -0
  2. package/package.json +18 -4
package/README.md ADDED
@@ -0,0 +1,95 @@
1
+ # @tribulnation/catalogue
2
+
3
+ [![npm](https://img.shields.io/npm/v/@tribulnation/catalogue)](https://www.npmjs.com/package/@tribulnation/catalogue)
4
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue)](https://github.com/tribulnation/catalogue/blob/main/LICENSE)
5
+
6
+ JavaScript / TypeScript client for the [Tribulnation Catalogue](https://github.com/tribulnation/catalogue) — a typed, open catalogue of crypto assets, trading platforms, and instrument mappings.
7
+
8
+ ## Install
9
+
10
+ ```bash
11
+ npm install @tribulnation/catalogue
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ ```typescript
17
+ import { Catalogue } from '@tribulnation/catalogue';
18
+
19
+ const client = new Catalogue();
20
+ ```
21
+
22
+ ### Find by symbol
23
+
24
+ ```typescript
25
+ const matches = await client.findBySymbol('BTC');
26
+ // → AssetSummary[]
27
+
28
+ matches[0].id // "bitcoin"
29
+ matches[0].display_name // "Bitcoin"
30
+ matches[0].icon // "https://catalogue.tribulnation.com/icons/asset/bitcoin.svg"
31
+ ```
32
+
33
+ ### Fetch asset or platform detail
34
+
35
+ ```typescript
36
+ const bitcoin = await client.fetchAsset('bitcoin');
37
+ const ethereum = await client.fetchPlatform('ethereum');
38
+
39
+ bitcoin.about?.en // full description
40
+ ethereum.chain_id // 1
41
+ ethereum.namespace // "eip155"
42
+ ```
43
+
44
+ ### Instruments
45
+
46
+ ```typescript
47
+ const pairs = await client.getSpotInstruments('mexc');
48
+ // → Record<string, SpotInstrument>
49
+
50
+ const perps = await client.getPerpetualInstruments('dydx');
51
+ // → Record<string, PerpetualInstrument>
52
+
53
+ // All instruments referencing a given asset
54
+ const refs = await client.getAssetInstruments('bitcoin');
55
+ // → InstrumentReference[]
56
+ ```
57
+
58
+ ### Lists
59
+
60
+ ```typescript
61
+ const assets = await client.fetchAssets(); // AssetSummary[]
62
+ const platforms = await client.fetchPlatforms(); // PlatformSummary[]
63
+ const stats = await client.fetchStats(); // Stats
64
+ ```
65
+
66
+ ## Custom base URL
67
+
68
+ ```typescript
69
+ const client = new Catalogue('https://my-mirror.example.com/api');
70
+ ```
71
+
72
+ The default base URL is `https://catalogue.tribulnation.com/api`.
73
+
74
+ ## Caching
75
+
76
+ Asset and symbol index fetches are cached per `Catalogue` instance — subsequent calls to `findBySymbol` or `fetchAssets` reuse the same promise without hitting the network again.
77
+
78
+ ## Types
79
+
80
+ All types are exported from the package root:
81
+
82
+ ```typescript
83
+ import type {
84
+ AssetSummary, AssetDetail,
85
+ PlatformSummary, PlatformDetail,
86
+ SpotInstrument, PerpetualInstrument,
87
+ InstrumentReference, Stats,
88
+ } from '@tribulnation/catalogue';
89
+ ```
90
+
91
+ ## Links
92
+
93
+ - [Full catalogue & API](https://catalogue.tribulnation.com)
94
+ - [GitHub](https://github.com/tribulnation/catalogue)
95
+ - [Python package](https://pypi.org/project/tribulnation-catalogue/)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tribulnation/catalogue",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Client for the Tribulnation crypto asset catalogue",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -11,7 +11,9 @@
11
11
  "types": "./dist/index.d.ts"
12
12
  }
13
13
  },
14
- "files": ["dist"],
14
+ "files": [
15
+ "dist"
16
+ ],
15
17
  "scripts": {
16
18
  "build": "tsc",
17
19
  "check": "tsc --noEmit",
@@ -21,12 +23,24 @@
21
23
  "type": "git",
22
24
  "url": "git+https://github.com/tribulnation/catalogue.git"
23
25
  },
26
+ "keywords": [
27
+ "crypto",
28
+ "cryptocurrency",
29
+ "blockchain",
30
+ "defi",
31
+ "catalogue",
32
+ "assets",
33
+ "trading",
34
+ "instruments",
35
+ "exchange",
36
+ "typescript"
37
+ ],
24
38
  "author": "Marcel Claramunt",
25
39
  "license": "MIT",
26
40
  "devDependencies": {
27
- "typescript": "^5.0.0",
28
41
  "@typescript-eslint/eslint-plugin": "^7.0.2",
29
42
  "@typescript-eslint/parser": "^7.0.2",
30
- "eslint": "^8.56.0"
43
+ "eslint": "^8.56.0",
44
+ "typescript": "^5.0.0"
31
45
  }
32
46
  }