Skip to content

Commit 251713f

Browse files
authored
Publish Package to NPM (#15)
* Rename @messari-kit/api to @messari-kit/sdk * Reorder client items to match docs * Disable recaps * Update table * Rename * Update readme * Add deprecated tags * Enable example * Update example * Rename @messari-kit/types to @messari/sdk-types * Combine api and types into a single sdk package * Update package and readme * Fix entity extraction schema issues * Update examples * Bump version * Update imports * Fix import paths
1 parent c3a34a3 commit 251713f

29 files changed

+484
-376
lines changed

README.md

Lines changed: 25 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -2,72 +2,29 @@
22

33
MessariKit is the official TypeScript/JavaScript SDK for interacting with Messari's APIs. It provides a type-safe, intuitive interface for accessing Messari's suite of crypto data and AI services.
44

5-
## Features
6-
7-
- 🔒 **Type-safe**: Full TypeScript support with automatically generated types from OpenAPI specs
8-
- 🚀 **Modern**: Built with modern TypeScript features and best practices
9-
- 📚 **Well-documented**: Comprehensive documentation and examples
10-
- 🔄 **Auto-generated**: API types and operations are automatically generated from OpenAPI specifications
11-
- 🛠 **Developer-friendly**: Intuitive API design with built-in error handling
12-
13-
## Installation
14-
15-
```bash
16-
# Using pnpm
17-
pnpm add @messari-kit/api
18-
```
19-
20-
## Quick Start
21-
22-
```typescript
23-
import { MessariClient } from 'messari-kit';
24-
25-
// Initialize the client
26-
const client = new MessariClient({
27-
apiKey: 'your-api-key'
28-
});
29-
30-
// Use the AI service
31-
const response = await client.ai.createChatCompletion({
32-
body: {
33-
messages: [
34-
{ role: 'user', content: 'What is the latest news about Bitcoin?' }
35-
]
36-
}
37-
});
38-
39-
// Extract entities from text
40-
const entities = await client.ai.extractEntities({
41-
body: {
42-
content: 'Ethereum founder Vitalik Buterin announced...',
43-
entityTypes: ['person', 'project']
44-
}
45-
});
46-
```
47-
485
## API Services
496

507
| Service Name | Endpoint Name | Endpoint Route | Implemented |
518
|--------------|---------------|----------------|-------------|
529
| AI | Chat Completion | `/ai/v1/chat/completions` ||
5310
| AI | Entity Extraction | `/ai/v1/classification/extraction` ||
5411
| |
55-
| Asset | Asset List | `/asset/v1/assets` | |
12+
| Asset | Asset List | `/asset/v1/assets` | 🚧 |
5613
| Asset | Asset By ID | `/asset/v1/assets/{assetId}` ||
5714
| |
58-
| Intel | Events | `/intel/v1/events` | |
59-
| Intel | Events By ID | `/intel/v1/events/{eventId}` | |
60-
| Intel | Intel Assets | `/intel/v1/assets` | |
15+
| Intel | Events | `/intel/v1/events` | 🚧 |
16+
| Intel | Events By ID | `/intel/v1/events/{eventId}` | 🚧 |
17+
| Intel | Intel Assets | `/intel/v1/assets` | 🚧 |
6118
| |
62-
| News | News Assets | `/news/v1/news/assets` | |
63-
| News | News Feed | `/news/v1/news/feed` | |
64-
| News | News Sources | `/news/v1/news/sources` | |
19+
| News | News Assets | `/news/v1/news/assets` | 🚧 |
20+
| News | News Feed | `/news/v1/news/feed` | 🚧 |
21+
| News | News Sources | `/news/v1/news/sources` | 🚧 |
6522
| |
66-
| Marketdata | Marketdata by AssetID | `/marketdata/v1/assets/{assetId}/price` | |
67-
| Marketdata | ROI | `/marketdata/v1/assets/roi` | |
68-
| Marketdata | ROI by AssetID | `/marketdata/v1/assets/{assetId}/roi` | |
69-
| Marketdata | ATH | `/marketdata/v1/assets/ath` | |
70-
| Marketdata | ATH by Asset | `/marketdata/v1/assets/{assetId}/ath` | |
23+
| Marketdata | Marketdata by AssetID | `/marketdata/v1/assets/{assetId}/price` | 🚧 |
24+
| Marketdata | ROI | `/marketdata/v1/assets/roi` | 🚧 |
25+
| Marketdata | ROI by AssetID | `/marketdata/v1/assets/{assetId}/roi` | 🚧 |
26+
| Marketdata | ATH | `/marketdata/v1/assets/ath` | 🚧 |
27+
| Marketdata | ATH by Asset | `/marketdata/v1/assets/{assetId}/ath` | 🚧 |
7128
| Marketdata | Timeseries by AssetID | `/marketdata/v1/assets/{assetId}/price/time-series` ||
7229
| Marketdata | Markets | `/marketdata/v1/markets` ||
7330
| Marketdata | Markets by MarketID | `/marketdata/v1/markets/{id}` ||
@@ -76,22 +33,22 @@ const entities = await client.ai.extractEntities({
7633
| Marketdata | Exchanges | `/marketdata/v1/exchanges` ||
7734
| Marketdata | Volume Timeseries by ExchangeID | `/marketdata/v1/exchanges/{exchangeId}/volume/time-series` ||
7835
| |
79-
| AI Digest | Project Recap By ID | `/ai-digest/api/v1/recap` | |
80-
| AI Digest | Exchange Recaps Overview | `/ai-digest/api/v1/exchange-rankings-recap` | |
81-
| AI Digest | Exchange Recap By ID | `/ai-digest/api/v1/exchange-recap` | |
36+
| AI Digest | Project Recap By ID | `/ai-digest/api/v1/recap` | |
37+
| AI Digest | Exchange Recaps Overview | `/ai-digest/api/v1/exchange-rankings-recap` | |
38+
| AI Digest | Exchange Recap By ID | `/ai-digest/api/v1/exchange-recap` | |
8239
| |
83-
| Research | Reports | `/research/v1/reports` | |
84-
| Research | Report By ID | `/research/v1/reports/{id}` | |
85-
| Research | Report Tags | `/research/v1/reports/tags` | |
40+
| Research | Reports | `/research/v1/reports` | 🚧 |
41+
| Research | Report By ID | `/research/v1/reports/{id}` | 🚧 |
42+
| Research | Report Tags | `/research/v1/reports/tags` | 🚧 |
8643
| |
87-
| Diligence | Report Preview | `/diligence/v1/reports/preview` | |
88-
| Diligence | Report By Asset ID | `/diligence/v1/report/asset/{assetId}` | |
44+
| Diligence | Report Preview | `/diligence/v1/reports/preview` | 🚧 |
45+
| Diligence | Report By Asset ID | `/diligence/v1/report/asset/{assetId}` | 🚧 |
8946
| |
90-
| Fundraising | Funding Rounds | `/funding/v1/rounds` | |
91-
| Fundraising | Funding Rounds Investors | `/funding/v1/rounds/investors` | |
92-
| Fundraising | Mergers and Acquisitions | `/funding/v1/mergers-and-acquisitions` | |
93-
| Fundraising | Organizations | `/funding/v1/organizations` | |
94-
| Fundraising | Projects | `/funding/v1/projects` | |
47+
| Fundraising | Funding Rounds | `/funding/v1/rounds` | 🚧 |
48+
| Fundraising | Funding Rounds Investors | `/funding/v1/rounds/investors` | 🚧 |
49+
| Fundraising | Mergers and Acquisitions | `/funding/v1/mergers-and-acquisitions` | 🚧 |
50+
| Fundraising | Organizations | `/funding/v1/organizations` | 🚧 |
51+
| Fundraising | Projects | `/funding/v1/projects` | 🚧 |
9552

9653

9754

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
"clean": "pnpm -r clean && rimraf typegen/openapi/dist",
1010
"lint:fix": "pnpm biome lint --write . && pnpm biome format --write .",
1111
"dev": "pnpm -r dev",
12-
"dev:examples": "pnpm --filter @messari-kit/examples dev",
13-
"dev:api": "pnpm --filter @messari-kit/api dev",
14-
"dev:types": "pnpm --filter @messari-kit/types dev",
15-
"start:examples": "pnpm --filter @messari-kit/examples start",
12+
"dev:examples": "pnpm --filter @messari/sdk-examples dev",
13+
"dev:api": "pnpm --filter @messari/sdk dev",
14+
"start:examples": "pnpm --filter @messari/sdk-examples start",
1615
"api:validate": "redocly lint typegen/openapi/**/*.yaml",
1716
"api:bundle": "redocly bundle typegen/openapi/index.yaml --output typegen/openapi/dist/combined.yaml",
1817
"api:docs": "redocly preview-docs typegen/openapi/index.yaml",

packages/api/README.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Messari SDK
2+
3+
Messari SDK is a convenient way to interact with Messari's APIs. It provides a type-safe, intuitive interface for accessing Messari's suite of crypto data and AI services.
4+
5+
## Features
6+
7+
- 🔒 **Type-safe**: Full TypeScript support with automatically generated types from OpenAPI specs
8+
- 🚀 **Modern**: Built with modern TypeScript features and best practices
9+
- 📚 **Well-documented**: Comprehensive documentation and examples
10+
- 🔄 **Auto-generated**: API types and operations are automatically generated from OpenAPI specifications
11+
- 🛠 **Developer-friendly**: Intuitive API design with built-in error handling
12+
13+
## Installation
14+
15+
```bash
16+
# Using pnpm
17+
pnpm add @messari/sdk
18+
```
19+
20+
## API Services
21+
22+
| Service Name | Endpoint Name | Endpoint Route | Implemented |
23+
|--------------|---------------|----------------|-------------|
24+
| AI | Chat Completion | `/ai/v1/chat/completions` ||
25+
| AI | Entity Extraction | `/ai/v1/classification/extraction` | ✅
26+
27+
## Authorization
28+
29+
To use the SDK, you'll need a Messari API key. You can get one by logging into [messari.io](https://messari.io/)
30+
and visiting the [Account Page](https://messari.io/account).
31+
32+
## Example Usage - AI Service
33+
34+
```typescript
35+
import { MessariClient } from '@messari/sdk';
36+
37+
// Initialize the client
38+
const client = new MessariClient({
39+
apiKey: 'your-api-key'
40+
});
41+
42+
// Use the AI service
43+
const response = await client.ai.createChatCompletion({
44+
messages: [
45+
{
46+
role: "user",
47+
content: "What companies have both paradigm and multicoin on their cap table?",
48+
},
49+
],
50+
});
51+
const assistantMessage = response.messages[0].content;
52+
console.log(assistantMessage);
53+
// The following companies have both Paradigm and a16z on their cap table:
54+
// 1. OpenSea
55+
// 2. Optimism
56+
// 3. Phantom Wallet
57+
// 4. Farcaster
58+
// 5. Uniswap
59+
// ...
60+
61+
62+
// Extract entities from text
63+
const entitiesResp = await client.ai.extractEntities({
64+
content: "Ethereum founder Vitalik Buterin announced...",
65+
entityTypes: ["person", "project"],
66+
});
67+
68+
for (const entity of entitiesResp.extractedEntities) {
69+
if (entity.selectedEntity) {
70+
console.log(JSON.stringify(entity.selectedEntity, null, 2));
71+
}
72+
}
73+
// {
74+
// "name": "Ethereum",
75+
// "details": [
76+
// {
77+
// "id": "263d8b01-5a96-41f0-85d5-09687bbbf7ca",
78+
// "type": "PROJECT"
79+
// }
80+
// ],
81+
// "confidenceScore": "HIGH",
82+
// "relevanceScore": "HIGH"
83+
// }
84+
// {
85+
// "name": "Vitalik Buterin",
86+
// "details": [
87+
// {
88+
// "id": "77b6685d-fafa-4be2-8e79-563c438a880a",
89+
// "type": "PERSON"
90+
// }
91+
// ],
92+
// "confidenceScore": "HIGH",
93+
// "relevanceScore": "HIGH"
94+
// }
95+
96+
```
97+
98+

packages/api/package.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{
2-
"name": "@messari-kit/api",
3-
"version": "0.0.1",
2+
"name": "@messari/sdk",
3+
"version": "0.0.2",
4+
"private": false,
5+
"description": "Messari SDK provides a type-safe, intuitive interface for accessing Messari's suite of crypto data and AI APIs.",
6+
"author": "Messari Engineering",
7+
"keywords": ["messari", "crypto", "ai", "agent", "bitcoin", "ethereum"],
48
"main": "dist/index.js",
59
"types": "dist/index.d.ts",
610
"exports": {
@@ -23,13 +27,12 @@
2327
"test:watch": "vitest",
2428
"dev": "tsx"
2529
},
26-
"dependencies": {
27-
"@messari-kit/types": "workspace:*"
28-
},
30+
"dependencies": {},
2931
"devDependencies": {
3032
"@types/node": "^22.13.5",
3133
"rimraf": "^5.0.10",
3234
"tsx": "^4.19.3",
3335
"typescript": "^5.7.3"
34-
}
36+
},
37+
"license": "MIT"
3538
}

packages/api/src/client/base.ts

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ import type {
5959
AcquisitionDeal,
6060
getOrganizationsParameters,
6161
getProjectsParameters,
62-
} from "@messari-kit/types";
62+
} from "../types";
6363
import { LogLevel, type Logger, makeConsoleLogger, createFilteredLogger, noOpLogger } from "../logging";
6464
import type { PaginatedResult, RequestOptions, ClientEventMap, ClientEventType, ClientEventHandler } from "./types";
6565

@@ -326,35 +326,50 @@ export abstract class MessariClientBase {
326326
*/
327327
public abstract readonly ai: AIInterface;
328328

329+
/**
330+
* Interface for Markets-related API methods
331+
*/
332+
public abstract readonly markets: MarketsInterface;
333+
334+
/**
335+
* Interface for Asset-related API methods
336+
*/
337+
public abstract readonly asset: AssetInterface;
338+
329339
/**
330340
* Interface for Intel-related API methods
331341
*/
332342
public abstract readonly intel: IntelInterface;
333343

334344
/**
335-
* Interface for News-related API methods
345+
* Interface for Fundraising-related API methods
336346
*/
337-
public abstract readonly news: NewsInterface;
347+
public abstract readonly fundraising: FundraisingAPIInterface;
338348

339349
/**
340-
* Interface for Markets-related API methods
350+
* Interface for Token Unlocks-related API methods
341351
*/
342-
public abstract readonly markets: MarketsInterface;
352+
public abstract readonly tokenUnlocks: TokenUnlocksInterface;
343353

344354
/**
345-
* Interface for Recaps-related API methods
355+
* Interface for News-related API methods
346356
*/
347-
public abstract readonly recaps: RecapsAPIInterface;
357+
public abstract readonly news: NewsInterface;
348358

349359
/**
350360
* Interface for Research-related API methods
351361
*/
352362
public abstract readonly research: ResearchInterface;
353363

354364
/**
355-
* Interface for Token Unlocks-related API methods
365+
* Interface for Diligence-related API methods
356366
*/
357-
public abstract readonly tokenUnlocks: TokenUnlocksInterface;
367+
public abstract readonly diligence: DiligenceAPIInterface;
368+
369+
/**
370+
* Interface for Recaps-related API methods
371+
*/
372+
// public abstract readonly recaps: RecapsAPIInterface;
358373

359374
/**
360375
* Logger instance for the client

0 commit comments

Comments
 (0)