Skip to content

Commit 6a050f4

Browse files
feat: update AI reports, top market cap, and crypto investors endpoints for v3 API
- Add token_name parameter to ai-reports endpoint - Add expand parameter to top-market-cap-tokens endpoint - Update crypto-investors endpoint version - Update all component versions to 0.1.0 - Enable enhanced filtering and data expansion capabilities
1 parent ef0d9bd commit 6a050f4

File tree

5 files changed

+58
-3
lines changed

5 files changed

+58
-3
lines changed

components/token_metrics/actions/get-ai-reports/get-ai-reports.mjs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default {
1010
key: "token_metrics-get-ai-reports",
1111
name: "Get AI Reports",
1212
description: `${endpoint.description}. [See the documentation](https://developers.tokenmetrics.com/reference/ai-reports)`,
13-
version: "0.0.1",
13+
version: "0.1.0",
1414
type: "action",
1515
props: {
1616
tokenMetrics,
@@ -22,6 +22,12 @@ export default {
2222
],
2323
description: "Select Token IDs to get AI reports for. Example: `37493,3484`",
2424
},
25+
tokenName: {
26+
propDefinition: [
27+
tokenMetrics,
28+
"tokenName",
29+
],
30+
},
2531
symbol: {
2632
propDefinition: [
2733
tokenMetrics,

components/token_metrics/actions/get-crypto-investors/get-crypto-investors.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default {
1010
key: "token_metrics-get-crypto-investors",
1111
name: "Get Crypto Investors",
1212
description: `${endpoint.description}. [See the documentation](https://developers.tokenmetrics.com/reference/crypto-investors)`,
13-
version: "0.0.1",
13+
version: "0.1.0",
1414
type: "action",
1515
props: {
1616
tokenMetrics,
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import tokenMetrics from "../../token_metrics.app.mjs";
2+
import { ENDPOINTS } from "../../common/constants.mjs";
3+
4+
const endpoint = ENDPOINTS.TOKEN_METRICS_AI;
5+
6+
export default {
7+
key: "token_metrics-get-token-metrics-ai",
8+
name: "Get Token Metrics AI",
9+
description: `${endpoint.description}. [See the documentation](https://developers.tokenmetrics.com/reference/tmai)`,
10+
version: "0.1.0",
11+
type: "action",
12+
props: {
13+
tokenMetrics,
14+
// Body parameter for POST request
15+
messages: {
16+
type: "string",
17+
label: "Messages",
18+
description: "JSON string containing the messages array for the AI chatbot. Example: `{\"messages\":[{\"user\":\"What is the next 100x coin ?\"}]}`",
19+
default: "{\"messages\":[{\"user\":\"What is the next 100x coin ?\"}]}",
20+
},
21+
},
22+
async run({ $ }) {
23+
// Parse the messages string to JSON
24+
let body;
25+
try {
26+
body = JSON.parse(this.messages);
27+
} catch (error) {
28+
throw new Error(`Invalid JSON in messages parameter: ${error.message}`);
29+
}
30+
31+
const response = await this.tokenMetrics.getTokenMetricsAi({
32+
$,
33+
body,
34+
});
35+
36+
// Use $ context for export
37+
$.export("$summary", "Successfully sent query to Token Metrics AI chatbot");
38+
39+
return response;
40+
},
41+
};

components/token_metrics/actions/get-top-market-cap-tokens/get-top-market-cap-tokens.mjs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default {
1010
key: "token_metrics-get-top-market-cap-tokens",
1111
name: "Get Top Market Cap Tokens",
1212
description: `${endpoint.description}. [See the documentation](https://developers.tokenmetrics.com/reference/top-market-cap-tokens)`,
13-
version: "0.0.1",
13+
version: "0.1.0",
1414
type: "action",
1515
props: {
1616
tokenMetrics,
@@ -22,6 +22,12 @@ export default {
2222
],
2323
description: "Specifies the number of top cryptocurrencies to retrieve, based on their market capitalization. Example: `100`",
2424
},
25+
expand: {
26+
propDefinition: [
27+
tokenMetrics,
28+
"expand",
29+
],
30+
},
2531
},
2632
async run({ $ }) {
2733
// Build parameters using utility function

components/token_metrics/common/constants.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ export const ENDPOINTS = {
153153
description: "Retrieve AI-generated reports providing comprehensive analyses of cryptocurrency tokens, including deep dives, investment analyses, and code reviews",
154154
filters: [
155155
"token_id",
156+
"token_name",
156157
"symbol",
157158
],
158159
},
@@ -166,6 +167,7 @@ export const ENDPOINTS = {
166167
description: "Get the list of coins for top market cap",
167168
filters: [
168169
"top_k",
170+
"expand",
169171
],
170172
},
171173
RESISTANCE_SUPPORT: {

0 commit comments

Comments
 (0)