Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,21 @@ For the full list of APIs, see the [API Reference Docs](https://docs.messari.io/
| Asset | Asset Metrics | `/metrics/v2/assets/metrics` | ✅ |
| Asset | Asset Price Time Series | `/metrics/v2/assets/{assetId}/metrics/price/time-series/{granularity}` | ✅ |
| |
| Exchanges | Exchanges | `/metrics/v1/exchanges` | ✅ |
| Exchanges | Exchange Details | `/metrics/v1/exchanges/{exchangeIdentifier}` | ✅ |
| Exchanges | Exchange Metrics | `/metrics/v1/exchanges/metrics` | ✅ |
| Exchanges | Exchange Timeseries | `/metrics/v1/exchanges/{entityIdentifier}/metrics/{datasetSlug}/time-series/{granularity}` | ✅ |
| |
| Markets | Markets | `/metrics/v1/markets` | ✅ |
| Markets | Market Details | `/metrics/v1/markets/{marketIdentifier}` | ✅ |
| Markets | Market Metrics | `/metrics/v1/markets/metrics` | ✅ |
| Markets | Market Timeseries | `/metrics/v1/markets/{entityIdentifier}/metrics/{datasetSlug}/time-series/{granularity}` | ✅ |
| |
| Networks | Networks | `/metrics/v1/networks` | ✅ |
| Networks | Network Details | `/metrics/v1/networks/{networkIdentifier}` | ✅ |
| Networks | Network Metrics | `/metrics/v1/networks/metrics` | ✅ |
| Networks | Network Timeseries | `/metrics/v1/networks/{entityIdentifier}/metrics/{datasetSlug}/time-series/{granularity}` | ✅ |
| |
| Intel | Events | `/intel/v1/events` | 🚧 |
| Intel | Events By ID | `/intel/v1/events/{eventId}` | 🚧 |
| Intel | Intel Assets | `/intel/v1/assets` | 🚧 |
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
"test:watch": "pnpm -r test:watch",
"clean": "pnpm -r clean && rimraf typegen/openapi/dist",
"lint:fix": "pnpm biome lint --write . && pnpm biome format --write .",
"examples:start:asset": "pnpm --filter @messari/sdk-examples start:asset",
"examples:start:ai": "pnpm --filter @messari/sdk-examples start:ai",
"examples:start:asset": "pnpm --filter @messari/sdk-examples start:asset",
"examples:start:exchanges": "pnpm --filter @messari/sdk-examples start:exchanges",
"examples:start:markets": "pnpm --filter @messari/sdk-examples start:markets",
"examples:start:networks": "pnpm --filter @messari/sdk-examples start:networks",
"api:validate": "redocly lint typegen/openapi/**/*.yaml",
"api:bundle": "redocly bundle typegen/openapi/index.yaml --output typegen/openapi/dist/combined.yaml",
"api:docs": "redocly preview-docs typegen/openapi/index.yaml",
Expand Down
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@messari/sdk",
"version": "0.0.3",
"version": "0.0.4",
"private": false,
"description": "Messari SDK provides a type-safe, intuitive interface for accessing Messari's suite of crypto data and AI APIs.",
"author": "Messari Engineering",
Expand Down
141 changes: 141 additions & 0 deletions packages/api/src/client/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,27 @@ import type {
getAssetTimeseriesWithGranularityParameters,
getAssetTimeseriesWithGranularityResponse,
TimeseriesMetadata,
getExchangesParameters,
getExchangesResponse,
getExchangeParameters,
getExchangeResponse,
getExchangeTimeseriesParameters,
getExchangeTimeseriesResponse,
getExchangeMetricsResponse,
getNetworkTimeseriesResponse,
getNetworkTimeseriesParameters,
getNetworkMetricsResponse,
getMarketMetricsResponse,
getMarketTimeseriesParameters,
getMarketTimeseriesResponse,
getNetworksParameters,
getNetworksResponse,
getNetworkParameters,
getNetworkResponse,
getMarketsResponse,
getMarketsParameters,
getMarketResponse,
getMarketParameters,
createWatchlistResponse,
createWatchlistParameters,
getWatchlistParameters,
Expand Down Expand Up @@ -167,6 +188,126 @@ export interface AssetInterface {
): Promise<APIResponseWithMetadata<getAssetTimeseriesWithGranularityResponse, TimeseriesMetadata>>;
}

/**
* Interface for the Exchanges API methods
*/
export interface ExchangesInterface {
/**
* Gets a list of all exchanges
* @param params Parameters for filtering exchanges
* @param options Optional request configuration
* @returns A paginated result of exchanges
*/
getExchanges(params?: getExchangesParameters, options?: RequestOptions): Promise<APIResponseWithMetadata<getExchangesResponse>>;

/**
* Gets a specific exchange by ID
* @param params Parameters for the exchange ID
* @param options Optional request configuration
* @returns A promise resolving to the exchange
*/
getExchangeById(params: getExchangeParameters, options?: RequestOptions): Promise<APIResponseWithMetadata<getExchangeResponse>>;

/**
* Gets a list of all metrics for an exchange
* @param params Parameters for the exchange ID
* @param options Optional request configuration
* @returns A promise resolving to the metrics
*/
getExchangeMetrics(options?: RequestOptions): Promise<APIResponseWithMetadata<getExchangeMetricsResponse>>;

/**
* Gets timeseries data for a specific exchange and metric group
* @param params Parameters for the exchange ID and metric group
* @param options Optional request configuration
* @returns A promise resolving to the timeseries data
*/
getExchangeTimeseries(
params: getExchangeTimeseriesParameters,
options?: RequestOptions,
): Promise<APIResponseWithMetadata<getExchangeTimeseriesResponse, TimeseriesMetadata>>;
}

/**
* Interface for the Networks API methods
*/
export interface NetworksInterface {
/**
* Gets a list of all networks
* @param params Parameters for filtering networks
* @param options Optional request configuration
* @returns A paginated result of networks
*/
getNetworks(params?: getNetworksParameters, options?: RequestOptions): Promise<APIResponseWithMetadata<getNetworksResponse>>;

/**
* Gets a specific exchange by ID
* @param params Parameters for the exchange ID
* @param options Optional request configuration
* @returns A promise resolving to the exchange
*/
getNetworkById(params: getNetworkParameters, options?: RequestOptions): Promise<APIResponseWithMetadata<getNetworkResponse>>;

/**
* Gets a list of all metrics for an network
* @param params Parameters for the network ID
* @param options Optional request configuration
* @returns A promise resolving to the metrics
*/
getNetworkMetrics(options?: RequestOptions): Promise<APIResponseWithMetadata<getNetworkMetricsResponse>>;

/**
* Gets timeseries data for a specific network and metric group
* @param params Parameters for the network ID and metric group
* @param options Optional request configuration
* @returns A promise resolving to the timeseries data
*/
getNetworkTimeseries(
params: getNetworkTimeseriesParameters,
options?: RequestOptions,
): Promise<APIResponseWithMetadata<getNetworkTimeseriesResponse, TimeseriesMetadata>>;
}

/**
* Interface for the Markets API methods
*/
export interface MarketsInterface {
/**
* Gets a list of all markets
* @param params Parameters for filtering markets
* @param options Optional request configuration
* @returns A paginated result of markets
*/
getMarkets(params?: getMarketsParameters, options?: RequestOptions): Promise<APIResponseWithMetadata<getMarketsResponse>>;

/**
* Gets a specific market by ID
* @param params Parameters for the market ID
* @param options Optional request configuration
* @returns A promise resolving to the market
*/
getMarketById(params: getMarketParameters, options?: RequestOptions): Promise<APIResponseWithMetadata<getMarketResponse>>;

/**
* Gets a list of all metrics for an Market
* @param params Parameters for the Market ID
* @param options Optional request configuration
* @returns A promise resolving to the metrics
*/
getMarketMetrics(options?: RequestOptions): Promise<APIResponseWithMetadata<getMarketMetricsResponse>>;

/**
* Gets timeseries data for a specific Market and metric group
* @param params Parameters for the Market ID and metric group
* @param options Optional request configuration
* @returns A promise resolving to the timeseries data
*/
getMarketTimeseries(
params: getMarketTimeseriesParameters,
options?: RequestOptions,
): Promise<APIResponseWithMetadata<getMarketTimeseriesResponse, TimeseriesMetadata>>;
}

/**
* Interface for the Intel API methods
*/
Expand Down
144 changes: 144 additions & 0 deletions packages/api/src/client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ import {
getAssetsV2ROI,
getAssetTimeseries,
getAssetTimeseriesWithGranularity,
getExchanges,
getExchange,
getExchangeMetrics,
getExchangeTimeseries,
getNetworkTimeseries,
getNetworkMetrics,
getMarketMetrics,
getMarketTimeseries,
getNetworks,
getNetwork,
getMarkets,
getMarket,
modifyWatchlistAssets,
deleteWatchlist,
listWatchlists,
Expand Down Expand Up @@ -100,6 +112,27 @@ import type {
getAssetTimeseriesWithGranularityParameters,
getAssetTimeseriesWithGranularityResponse,
TimeseriesMetadata,
getExchangesParameters,
getExchangesResponse,
getExchangeResponse,
getExchangeParameters,
getExchangeTimeseriesResponse,
getExchangeTimeseriesParameters,
getExchangeMetricsResponse,
getNetworkMetricsResponse,
getNetworkTimeseriesParameters,
getNetworkTimeseriesResponse,
getMarketMetricsResponse,
getMarketTimeseriesParameters,
getMarketTimeseriesResponse,
getNetworksResponse,
getNetworksParameters,
getNetworkResponse,
getNetworkParameters,
getMarketsParameters,
getMarketsResponse,
getMarketResponse,
getMarketParameters,
modifyWatchlistAssetsResponse,
modifyWatchlistAssetsParameters,
deleteWatchlistResponse,
Expand Down Expand Up @@ -139,6 +172,9 @@ import type {
RecapsAPIInterface,
ResearchInterface,
TokenUnlocksInterface,
ExchangesInterface,
NetworksInterface,
MarketsInterface,
UserManagementInterface,
} from "./base";
import { MessariClientBase } from "./base";
Expand Down Expand Up @@ -720,6 +756,114 @@ export class MessariClient extends MessariClientBase {
},
};

public readonly exchanges: ExchangesInterface = {
getExchanges: async (params: getExchangesParameters = {}, options?: RequestOptions) => {
return this.requestWithMetadata<getExchangesResponse, PaginationMetadata>({
method: getExchanges.method,
path: getExchanges.path(),
queryParams: pick(params, getExchanges.queryParams),
options,
});
},

getExchangeById: async (params: getExchangeParameters, options?: RequestOptions) => {
return this.requestWithMetadata<getExchangeResponse, PaginationMetadata>({
method: getExchange.method,
path: getExchange.path(params),
options,
});
},

getExchangeMetrics: async (options?: RequestOptions) => {
return this.requestWithMetadata<getExchangeMetricsResponse, PaginationMetadata>({
method: getExchangeMetrics.method,
path: getExchangeMetrics.path(),
options,
});
},

getExchangeTimeseries: async (params: getExchangeTimeseriesParameters, options?: RequestOptions) => {
return this.requestWithMetadata<getExchangeTimeseriesResponse, TimeseriesMetadata>({
method: getExchangeTimeseries.method,
path: getExchangeTimeseries.path(params),
queryParams: pick(params, getExchangeTimeseries.queryParams),
options,
});
},
};

public readonly networks: NetworksInterface = {
getNetworks: async (params: getNetworksParameters = {}, options?: RequestOptions) => {
return this.requestWithMetadata<getNetworksResponse, PaginationMetadata>({
method: getNetworks.method,
path: getNetworks.path(),
queryParams: pick(params, getNetworks.queryParams),
options,
});
},

getNetworkById: async (params: getNetworkParameters, options?: RequestOptions) => {
return this.requestWithMetadata<getNetworkResponse, PaginationMetadata>({
method: getNetwork.method,
path: getNetwork.path(params),
options,
});
},

getNetworkMetrics: async (options?: RequestOptions) => {
return this.requestWithMetadata<getNetworkMetricsResponse, PaginationMetadata>({
method: getNetworkMetrics.method,
path: getNetworkMetrics.path(),
options,
});
},

getNetworkTimeseries: async (params: getNetworkTimeseriesParameters, options?: RequestOptions) => {
return this.requestWithMetadata<getNetworkTimeseriesResponse, TimeseriesMetadata>({
method: getNetworkTimeseries.method,
path: getNetworkTimeseries.path(params),
queryParams: pick(params, getNetworkTimeseries.queryParams),
options,
});
},
};

public readonly markets: MarketsInterface = {
getMarkets: async (params: getMarketsParameters = {}, options?: RequestOptions) => {
return this.requestWithMetadata<getMarketsResponse, PaginationMetadata>({
method: getMarkets.method,
path: getMarkets.path(),
queryParams: pick(params, getMarkets.queryParams),
options,
});
},

getMarketById: async (params: getMarketParameters, options?: RequestOptions) => {
return this.requestWithMetadata<getMarketResponse, PaginationMetadata>({
method: getMarket.method,
path: getMarket.path(params),
options,
});
},

getMarketMetrics: async (options?: RequestOptions) => {
return this.requestWithMetadata<getMarketMetricsResponse, PaginationMetadata>({
method: getMarketMetrics.method,
path: getMarketMetrics.path(),
options,
});
},

getMarketTimeseries: async (params: getMarketTimeseriesParameters, options?: RequestOptions) => {
return this.requestWithMetadata<getMarketTimeseriesResponse, TimeseriesMetadata>({
method: getMarketTimeseries.method,
path: getMarketTimeseries.path(params),
queryParams: pick(params, getMarketTimeseries.queryParams),
options,
});
},
};

/**
* @deprecated Intel is Work-in-Progress and not production ready
*/
Expand Down
Loading