@coinbase/agentkit 0.2.3-nightly.20250307.28 → 0.3.0
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.
- package/dist/action-providers/allora/alloraActionProvider.d.ts +44 -0
- package/dist/action-providers/allora/alloraActionProvider.js +195 -0
- package/dist/action-providers/allora/alloraActionProvider.test.d.ts +1 -0
- package/dist/action-providers/allora/alloraActionProvider.test.js +109 -0
- package/dist/action-providers/allora/index.d.ts +2 -0
- package/dist/action-providers/allora/index.js +18 -0
- package/dist/action-providers/allora/schemas.d.ts +28 -0
- package/dist/action-providers/allora/schemas.js +30 -0
- package/dist/action-providers/index.d.ts +1 -0
- package/dist/action-providers/index.js +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ActionProvider } from "../actionProvider";
|
|
2
|
+
import { AlloraAPIClientConfig } from "@alloralabs/allora-sdk";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { GetAllTopicsSchema, GetInferenceByTopicIdSchema, GetPriceInferenceSchema } from "./schemas";
|
|
5
|
+
/**
|
|
6
|
+
* Action provider for interacting with Allora Network
|
|
7
|
+
*/
|
|
8
|
+
export declare class AlloraActionProvider extends ActionProvider {
|
|
9
|
+
private client;
|
|
10
|
+
/**
|
|
11
|
+
* Creates an instance of AlloraActionProvider
|
|
12
|
+
*
|
|
13
|
+
* @param config - Configuration for the Allora API client including API key and optional chain slug
|
|
14
|
+
*/
|
|
15
|
+
constructor(config?: AlloraAPIClientConfig);
|
|
16
|
+
/**
|
|
17
|
+
* Gets all available topics from Allora Network
|
|
18
|
+
*
|
|
19
|
+
* @param _ - Empty object as no parameters are required
|
|
20
|
+
* @returns A string containing the list of topics in JSON format
|
|
21
|
+
*/
|
|
22
|
+
getAllTopics(_: z.infer<typeof GetAllTopicsSchema>): Promise<string>;
|
|
23
|
+
/**
|
|
24
|
+
* Gets inference data for a specific topic from Allora Network
|
|
25
|
+
*
|
|
26
|
+
* @param args - Object containing the topic ID to get inference for
|
|
27
|
+
* @returns A string containing the inference data in JSON format
|
|
28
|
+
*/
|
|
29
|
+
getInferenceByTopicId(args: z.infer<typeof GetInferenceByTopicIdSchema>): Promise<string>;
|
|
30
|
+
/**
|
|
31
|
+
* Gets price inference for a token/timeframe pair from Allora Network
|
|
32
|
+
*
|
|
33
|
+
* @param args - Object containing the asset symbol and timeframe
|
|
34
|
+
* @returns A string containing the price inference data in JSON format
|
|
35
|
+
*/
|
|
36
|
+
getPriceInference(args: z.infer<typeof GetPriceInferenceSchema>): Promise<string>;
|
|
37
|
+
/**
|
|
38
|
+
* Checks if the provider supports a given network
|
|
39
|
+
*
|
|
40
|
+
* @returns Always returns true as Allora service is network-agnostic
|
|
41
|
+
*/
|
|
42
|
+
supportsNetwork(): boolean;
|
|
43
|
+
}
|
|
44
|
+
export declare const alloraActionProvider: (config?: AlloraAPIClientConfig) => AlloraActionProvider;
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.alloraActionProvider = exports.AlloraActionProvider = void 0;
|
|
13
|
+
const actionProvider_1 = require("../actionProvider");
|
|
14
|
+
const actionDecorator_1 = require("../actionDecorator");
|
|
15
|
+
const allora_sdk_1 = require("@alloralabs/allora-sdk");
|
|
16
|
+
const zod_1 = require("zod");
|
|
17
|
+
const schemas_1 = require("./schemas");
|
|
18
|
+
/**
|
|
19
|
+
* Action provider for interacting with Allora Network
|
|
20
|
+
*/
|
|
21
|
+
class AlloraActionProvider extends actionProvider_1.ActionProvider {
|
|
22
|
+
/**
|
|
23
|
+
* Creates an instance of AlloraActionProvider
|
|
24
|
+
*
|
|
25
|
+
* @param config - Configuration for the Allora API client including API key and optional chain slug
|
|
26
|
+
*/
|
|
27
|
+
constructor(config = {}) {
|
|
28
|
+
super("allora", []);
|
|
29
|
+
// This is a public, development only key and should be used for testing purposes only.
|
|
30
|
+
// It might be changed or revoked in the future. It is also subject to limits and usage policies.
|
|
31
|
+
const DEFAULT_API_KEY = "UP-4151d0cc489a44a7aa5cd7ef";
|
|
32
|
+
config.apiKey = config.apiKey || DEFAULT_API_KEY;
|
|
33
|
+
config.chainSlug = config.chainSlug || allora_sdk_1.ChainSlug.TESTNET;
|
|
34
|
+
this.client = new allora_sdk_1.AlloraAPIClient(config);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Gets all available topics from Allora Network
|
|
38
|
+
*
|
|
39
|
+
* @param _ - Empty object as no parameters are required
|
|
40
|
+
* @returns A string containing the list of topics in JSON format
|
|
41
|
+
*/
|
|
42
|
+
async getAllTopics(_) {
|
|
43
|
+
try {
|
|
44
|
+
const topics = await this.client.getAllTopics();
|
|
45
|
+
const topicsJson = JSON.stringify(topics);
|
|
46
|
+
return `The available topics at Allora Network are:\n ${topicsJson}`;
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
return `Error getting all topics: ${error}`;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Gets inference data for a specific topic from Allora Network
|
|
54
|
+
*
|
|
55
|
+
* @param args - Object containing the topic ID to get inference for
|
|
56
|
+
* @returns A string containing the inference data in JSON format
|
|
57
|
+
*/
|
|
58
|
+
async getInferenceByTopicId(args) {
|
|
59
|
+
try {
|
|
60
|
+
const inference = await this.client.getInferenceByTopicID(args.topicId);
|
|
61
|
+
const inferenceJson = JSON.stringify(inference.inference_data);
|
|
62
|
+
return `The inference for topic ${args.topicId} is:\n ${inferenceJson}`;
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
return `Error getting inference for topic ${args.topicId}: ${error}`;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Gets price inference for a token/timeframe pair from Allora Network
|
|
70
|
+
*
|
|
71
|
+
* @param args - Object containing the asset symbol and timeframe
|
|
72
|
+
* @returns A string containing the price inference data in JSON format
|
|
73
|
+
*/
|
|
74
|
+
async getPriceInference(args) {
|
|
75
|
+
try {
|
|
76
|
+
const inference = await this.client.getPriceInference(args.asset, args.timeframe);
|
|
77
|
+
const response = {
|
|
78
|
+
price: inference.inference_data.network_inference_normalized,
|
|
79
|
+
timestamp: inference.inference_data.timestamp,
|
|
80
|
+
asset: args.asset,
|
|
81
|
+
timeframe: args.timeframe,
|
|
82
|
+
};
|
|
83
|
+
const inferenceJson = JSON.stringify(response);
|
|
84
|
+
return `The price inference for ${args.asset} (${args.timeframe}) is:\n${inferenceJson}`;
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
return `Error getting price inference for ${args.asset} (${args.timeframe}): ${error}`;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Checks if the provider supports a given network
|
|
92
|
+
*
|
|
93
|
+
* @returns Always returns true as Allora service is network-agnostic
|
|
94
|
+
*/
|
|
95
|
+
supportsNetwork() {
|
|
96
|
+
return true; // Allora service is network-agnostic
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.AlloraActionProvider = AlloraActionProvider;
|
|
100
|
+
__decorate([
|
|
101
|
+
(0, actionDecorator_1.CreateAction)({
|
|
102
|
+
name: "get_all_topics",
|
|
103
|
+
description: `
|
|
104
|
+
This tool will get all available inference topics from Allora Network.
|
|
105
|
+
|
|
106
|
+
A successful response will return a list of available topics in JSON format. Example:
|
|
107
|
+
[
|
|
108
|
+
{
|
|
109
|
+
"topic_id": 1,
|
|
110
|
+
"topic_name": "Bitcoin 8h",
|
|
111
|
+
"description": "Bitcoin price prediction for the next 8 hours",
|
|
112
|
+
"epoch_length": 100,
|
|
113
|
+
"ground_truth_lag": 10,
|
|
114
|
+
"loss_method": "method1",
|
|
115
|
+
"worker_submission_window": 50,
|
|
116
|
+
"worker_count": 5,
|
|
117
|
+
"reputer_count": 3,
|
|
118
|
+
"total_staked_allo": 1000,
|
|
119
|
+
"total_emissions_allo": 500,
|
|
120
|
+
"is_active": true,
|
|
121
|
+
"updated_at": "2023-01-01T00:00:00Z"
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
|
|
125
|
+
Key fields:
|
|
126
|
+
- topic_id: Unique identifier, use with get_inference_by_topic_id action
|
|
127
|
+
- topic_name: Name of the topic
|
|
128
|
+
- description: Short description of the topic's purpose
|
|
129
|
+
- is_active: If true, topic is active and accepting submissions
|
|
130
|
+
- updated_at: Timestamp of last update
|
|
131
|
+
|
|
132
|
+
A failure response will return an error message with details.
|
|
133
|
+
`,
|
|
134
|
+
schema: schemas_1.GetAllTopicsSchema,
|
|
135
|
+
}),
|
|
136
|
+
__metadata("design:type", Function),
|
|
137
|
+
__metadata("design:paramtypes", [void 0]),
|
|
138
|
+
__metadata("design:returntype", Promise)
|
|
139
|
+
], AlloraActionProvider.prototype, "getAllTopics", null);
|
|
140
|
+
__decorate([
|
|
141
|
+
(0, actionDecorator_1.CreateAction)({
|
|
142
|
+
name: "get_inference_by_topic_id",
|
|
143
|
+
description: `
|
|
144
|
+
This tool will get inference for a specific topic from Allora Network.
|
|
145
|
+
It requires a topic ID as input, which can be obtained from the get_all_topics action.
|
|
146
|
+
|
|
147
|
+
A successful response will return a message with the inference data in JSON format. Example:
|
|
148
|
+
{
|
|
149
|
+
"network_inference": "0.5",
|
|
150
|
+
"network_inference_normalized": "0.5",
|
|
151
|
+
"confidence_interval_percentiles": ["0.1", "0.5", "0.9"],
|
|
152
|
+
"confidence_interval_percentiles_normalized": ["0.1", "0.5", "0.9"],
|
|
153
|
+
"confidence_interval_values": ["0.1", "0.5", "0.9"],
|
|
154
|
+
"confidence_interval_values_normalized": ["0.1", "0.5", "0.9"],
|
|
155
|
+
"topic_id": "1",
|
|
156
|
+
"timestamp": 1718198400,
|
|
157
|
+
"extra_data": "extra_data"
|
|
158
|
+
}
|
|
159
|
+
The network_inference field is the inference for the topic.
|
|
160
|
+
The network_inference_normalized field is the normalized inference for the topic.
|
|
161
|
+
|
|
162
|
+
A failure response will return an error message with details.
|
|
163
|
+
`,
|
|
164
|
+
schema: schemas_1.GetInferenceByTopicIdSchema,
|
|
165
|
+
}),
|
|
166
|
+
__metadata("design:type", Function),
|
|
167
|
+
__metadata("design:paramtypes", [void 0]),
|
|
168
|
+
__metadata("design:returntype", Promise)
|
|
169
|
+
], AlloraActionProvider.prototype, "getInferenceByTopicId", null);
|
|
170
|
+
__decorate([
|
|
171
|
+
(0, actionDecorator_1.CreateAction)({
|
|
172
|
+
name: "get_price_inference",
|
|
173
|
+
description: `
|
|
174
|
+
This tool will get price inference for a specific token and timeframe from Allora Network.
|
|
175
|
+
It requires an asset symbol (e.g., 'BTC', 'ETH') and a timeframe (e.g., '8h', '24h') as input.
|
|
176
|
+
|
|
177
|
+
A successful response will return a message with the price inference. Example:
|
|
178
|
+
The price inference for BTC (8h) is:
|
|
179
|
+
{
|
|
180
|
+
"price": "100000",
|
|
181
|
+
"timestamp": 1718198400,
|
|
182
|
+
"asset": "BTC",
|
|
183
|
+
"timeframe": "8h"
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
A failure response will return an error message with details.
|
|
187
|
+
`,
|
|
188
|
+
schema: schemas_1.GetPriceInferenceSchema,
|
|
189
|
+
}),
|
|
190
|
+
__metadata("design:type", Function),
|
|
191
|
+
__metadata("design:paramtypes", [void 0]),
|
|
192
|
+
__metadata("design:returntype", Promise)
|
|
193
|
+
], AlloraActionProvider.prototype, "getPriceInference", null);
|
|
194
|
+
const alloraActionProvider = (config = {}) => new AlloraActionProvider(config);
|
|
195
|
+
exports.alloraActionProvider = alloraActionProvider;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const alloraActionProvider_1 = require("./alloraActionProvider");
|
|
4
|
+
const allora_sdk_1 = require("@alloralabs/allora-sdk");
|
|
5
|
+
jest.mock("@alloralabs/allora-sdk");
|
|
6
|
+
describe("AlloraActionProvider", () => {
|
|
7
|
+
let provider;
|
|
8
|
+
const mockConfig = { apiKey: "test-api-key", chainSlug: allora_sdk_1.ChainSlug.TESTNET };
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
jest.clearAllMocks();
|
|
11
|
+
provider = new alloraActionProvider_1.AlloraActionProvider(mockConfig);
|
|
12
|
+
});
|
|
13
|
+
describe("getAllTopics", () => {
|
|
14
|
+
it("should return topics when successful", async () => {
|
|
15
|
+
const mockTopics = [
|
|
16
|
+
{
|
|
17
|
+
topic_id: 1,
|
|
18
|
+
topic_name: "Bitcoin 8h",
|
|
19
|
+
description: "Bitcoin price prediction",
|
|
20
|
+
epoch_length: 100,
|
|
21
|
+
ground_truth_lag: 10,
|
|
22
|
+
loss_method: "method1",
|
|
23
|
+
worker_submission_window: 50,
|
|
24
|
+
worker_count: 5,
|
|
25
|
+
reputer_count: 3,
|
|
26
|
+
total_staked_allo: 1000,
|
|
27
|
+
total_emissions_allo: 500,
|
|
28
|
+
is_active: true,
|
|
29
|
+
updated_at: "2023-01-01T00:00:00Z",
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
allora_sdk_1.AlloraAPIClient.prototype.getAllTopics.mockResolvedValue(mockTopics);
|
|
33
|
+
const result = await provider.getAllTopics({});
|
|
34
|
+
expect(result).toContain("The available topics at Allora Network are:");
|
|
35
|
+
expect(result).toContain(JSON.stringify(mockTopics));
|
|
36
|
+
});
|
|
37
|
+
it("should handle errors", async () => {
|
|
38
|
+
const error = new Error("API Error");
|
|
39
|
+
allora_sdk_1.AlloraAPIClient.prototype.getAllTopics.mockRejectedValue(error);
|
|
40
|
+
const result = await provider.getAllTopics({});
|
|
41
|
+
expect(result).toContain("Error getting all topics:");
|
|
42
|
+
expect(result).toContain(error.toString());
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
describe("getInferenceByTopicId", () => {
|
|
46
|
+
const mockTopicId = 1;
|
|
47
|
+
it("should return inference when successful", async () => {
|
|
48
|
+
const mockInferenceResponse = {
|
|
49
|
+
inference_data: {
|
|
50
|
+
network_inference: "0.5",
|
|
51
|
+
network_inference_normalized: "0.5",
|
|
52
|
+
confidence_interval_percentiles: ["0.1", "0.5", "0.9"],
|
|
53
|
+
confidence_interval_percentiles_normalized: ["0.1", "0.5", "0.9"],
|
|
54
|
+
confidence_interval_values: ["0.1", "0.5", "0.9"],
|
|
55
|
+
confidence_interval_values_normalized: ["0.1", "0.5", "0.9"],
|
|
56
|
+
topic_id: "1",
|
|
57
|
+
timestamp: 1718198400,
|
|
58
|
+
extra_data: "extra_data",
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
allora_sdk_1.AlloraAPIClient.prototype.getInferenceByTopicID.mockResolvedValue(mockInferenceResponse);
|
|
62
|
+
const result = await provider.getInferenceByTopicId({ topicId: mockTopicId });
|
|
63
|
+
expect(result).toContain(`The inference for topic ${mockTopicId} is:`);
|
|
64
|
+
expect(result).toContain(JSON.stringify(mockInferenceResponse.inference_data));
|
|
65
|
+
});
|
|
66
|
+
it("should handle errors", async () => {
|
|
67
|
+
const error = new Error("API Error");
|
|
68
|
+
allora_sdk_1.AlloraAPIClient.prototype.getInferenceByTopicID.mockRejectedValue(error);
|
|
69
|
+
const result = await provider.getInferenceByTopicId({ topicId: mockTopicId });
|
|
70
|
+
expect(result).toContain(`Error getting inference for topic ${mockTopicId}:`);
|
|
71
|
+
expect(result).toContain(error.toString());
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
describe("getPriceInference", () => {
|
|
75
|
+
const mockAsset = allora_sdk_1.PriceInferenceToken.BTC;
|
|
76
|
+
const mockTimeframe = "8h";
|
|
77
|
+
it("should return price inference when successful", async () => {
|
|
78
|
+
const mockPriceInference = {
|
|
79
|
+
inference_data: {
|
|
80
|
+
network_inference_normalized: "50000.00",
|
|
81
|
+
timestamp: 1718198400,
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
allora_sdk_1.AlloraAPIClient.prototype.getPriceInference.mockResolvedValue(mockPriceInference);
|
|
85
|
+
const expectedResponse = {
|
|
86
|
+
price: "50000.00",
|
|
87
|
+
timestamp: 1718198400,
|
|
88
|
+
asset: mockAsset,
|
|
89
|
+
timeframe: mockTimeframe,
|
|
90
|
+
};
|
|
91
|
+
const result = await provider.getPriceInference({
|
|
92
|
+
asset: mockAsset,
|
|
93
|
+
timeframe: mockTimeframe,
|
|
94
|
+
});
|
|
95
|
+
expect(result).toContain(`The price inference for ${mockAsset} (${mockTimeframe}) is:`);
|
|
96
|
+
expect(result).toContain(JSON.stringify(expectedResponse));
|
|
97
|
+
});
|
|
98
|
+
it("should handle errors", async () => {
|
|
99
|
+
const error = new Error("API Error");
|
|
100
|
+
allora_sdk_1.AlloraAPIClient.prototype.getPriceInference.mockRejectedValue(error);
|
|
101
|
+
const result = await provider.getPriceInference({
|
|
102
|
+
asset: mockAsset,
|
|
103
|
+
timeframe: mockTimeframe,
|
|
104
|
+
});
|
|
105
|
+
expect(result).toContain(`Error getting price inference for ${mockAsset} (${mockTimeframe}):`);
|
|
106
|
+
expect(result).toContain(error.toString());
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./alloraActionProvider"), exports);
|
|
18
|
+
__exportStar(require("./schemas"), exports);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Input schema for getting all topics from Allora Network
|
|
4
|
+
*/
|
|
5
|
+
export declare const GetAllTopicsSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
6
|
+
/**
|
|
7
|
+
* Input schema for getting inference data by topic ID from Allora Network
|
|
8
|
+
*/
|
|
9
|
+
export declare const GetInferenceByTopicIdSchema: z.ZodObject<{
|
|
10
|
+
topicId: z.ZodNumber;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
topicId: number;
|
|
13
|
+
}, {
|
|
14
|
+
topicId: number;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* Input schema for getting price inference for a token/timeframe pair
|
|
18
|
+
*/
|
|
19
|
+
export declare const GetPriceInferenceSchema: z.ZodObject<{
|
|
20
|
+
asset: z.ZodString;
|
|
21
|
+
timeframe: z.ZodString;
|
|
22
|
+
}, "strip", z.ZodTypeAny, {
|
|
23
|
+
asset: string;
|
|
24
|
+
timeframe: string;
|
|
25
|
+
}, {
|
|
26
|
+
asset: string;
|
|
27
|
+
timeframe: string;
|
|
28
|
+
}>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetPriceInferenceSchema = exports.GetInferenceByTopicIdSchema = exports.GetAllTopicsSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
/**
|
|
6
|
+
* Input schema for getting all topics from Allora Network
|
|
7
|
+
*/
|
|
8
|
+
exports.GetAllTopicsSchema = zod_1.z
|
|
9
|
+
.object({})
|
|
10
|
+
.strip()
|
|
11
|
+
.describe("Instructions for getting all topics from Allora Network");
|
|
12
|
+
/**
|
|
13
|
+
* Input schema for getting inference data by topic ID from Allora Network
|
|
14
|
+
*/
|
|
15
|
+
exports.GetInferenceByTopicIdSchema = zod_1.z
|
|
16
|
+
.object({
|
|
17
|
+
topicId: zod_1.z.number().describe("The ID of the topic to get inference data for"),
|
|
18
|
+
})
|
|
19
|
+
.strip()
|
|
20
|
+
.describe("Instructions for getting inference data from Allora Network by topic ID");
|
|
21
|
+
/**
|
|
22
|
+
* Input schema for getting price inference for a token/timeframe pair
|
|
23
|
+
*/
|
|
24
|
+
exports.GetPriceInferenceSchema = zod_1.z
|
|
25
|
+
.object({
|
|
26
|
+
asset: zod_1.z.string().describe("The token to get price inference for (e.g., 'BTC', 'ETH')"),
|
|
27
|
+
timeframe: zod_1.z.string().describe("The timeframe for the prediction (e.g., '8h', '24h')"),
|
|
28
|
+
})
|
|
29
|
+
.strip()
|
|
30
|
+
.describe("Instructions for getting price inference for a token/timeframe pair");
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@coinbase/agentkit",
|
|
3
3
|
"description": "Coinbase AgentKit core primitives",
|
|
4
4
|
"repository": "https://github.com/coinbase/agentkit",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.3.0",
|
|
6
6
|
"author": "Coinbase Inc.",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"main": "dist/index.js",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"typescript"
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
|
+
"@alloralabs/allora-sdk": "^0.1.0",
|
|
43
44
|
"@coinbase/coinbase-sdk": "^0.20.0",
|
|
44
45
|
"@jup-ag/api": "^6.0.39",
|
|
45
46
|
"@privy-io/server-auth": "^1.18.4",
|