Skip to content

Commit b4c255d

Browse files
authored
Merge branch 'covalenthq:main' into ollama-integration
2 parents 16b9023 + ce003b4 commit b4c255d

File tree

10 files changed

+68
-55
lines changed

10 files changed

+68
-55
lines changed

docs/tools/goldrush-onchain-data.mdx

+9
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ const nftHoldings = new NFTHoldingsTool(apiKey);
3838
const transactionHistory = new TransactionHistoryTool(apiKey);
3939
```
4040

41+
4. **Historical Token Price Tool**: Fetch historical price data for any token across supported blockchains:
42+
- Price history over customizable timeframes (1h, 24h, 7d, 30d)
43+
- Token prices in USD
44+
- Detailed price data points within the selected timeframe
45+
46+
```typescript
47+
const historicalPrices = new HistoricalTokenPriceTool(apiKey);
48+
```
49+
4150
### Using GoldRush Tools
4251

4352
To use GoldRush tools in your agent:

packages/ai-agent-sdk/src/core/agent/index.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { user } from "../base";
22
import { StateFn } from "../state";
3-
import { createTool } from "../tools";
3+
import { createTool } from "../tools/base";
44
import { Agent } from "./index";
55
import fetch from "node-fetch";
66
import { expect, test } from "vitest";

packages/ai-agent-sdk/src/core/agent/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { assistant, Base, system, user } from "../base";
22
import type { ModelConfig } from "../llm";
33
import { LLM } from "../llm";
44
import { StateFn, type ZeeWorkflowState } from "../state";
5-
import type { Tool } from "../tools";
5+
import type { Tool } from "../tools/base";
66
import type { ParsedFunctionToolCall } from "openai/resources/beta/chat/completions";
77
import type { ChatCompletionMessageParam } from "openai/resources/chat/completions";
88
import z from "zod";

packages/ai-agent-sdk/src/core/llm/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Base } from "../base";
2-
import type { Tool } from "../tools";
2+
import type { Tool } from "../tools/base";
33
import OpenAI from "openai";
44
import { zodResponseFormat } from "openai/helpers/zod";
55
import type { ParsedFunctionToolCall } from "openai/resources/beta/chat/completions";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import type { AnyZodType } from "../base";
2+
3+
export class Tool {
4+
private id: string;
5+
private _schema: AnyZodType;
6+
private _description: string;
7+
8+
private _execute: (parameters: any) => Promise<string>;
9+
10+
constructor(
11+
id: string,
12+
description: string,
13+
schema: AnyZodType,
14+
execute: (parameters: any) => Promise<string>
15+
) {
16+
this.id = id;
17+
this._description = description;
18+
this._schema = schema;
19+
this._execute = execute;
20+
}
21+
22+
get description() {
23+
return this._description;
24+
}
25+
26+
get schema() {
27+
return this._schema;
28+
}
29+
30+
execute(parameters: any) {
31+
return this._execute(parameters);
32+
}
33+
}
34+
35+
interface ToolOptions {
36+
id: string;
37+
description: string;
38+
schema: AnyZodType;
39+
execute: (parameters: any) => Promise<string>;
40+
}
41+
42+
export const createTool = (options: ToolOptions) => {
43+
return new Tool(
44+
options.id,
45+
options.description,
46+
options.schema,
47+
options.execute
48+
);
49+
};

packages/ai-agent-sdk/src/core/tools/goldrush/base.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Tool } from "../index";
1+
import { Tool } from "../base";
22
import { GoldRushClient, ChainName } from "@covalenthq/client-sdk";
33
import { z } from "zod";
44

packages/ai-agent-sdk/src/core/tools/goldrush/index.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Agent } from "../../agent";
22
import { user } from "../../base";
33
import { StateFn } from "../../state";
4-
import type { Tool } from "../index";
4+
import type { Tool } from "../base";
55
import { HistoricalTokenPriceTool } from "./historical-token-price";
66
import { NFTBalancesTool } from "./nft-balances";
77
import { TokenBalancesTool } from "./token-balances";
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
export * from "./token-balances";
22
export * from "./nft-balances";
33
export * from "./transactions";
4+
export * from "./historical-token-price";
5+
export * from "./base";
+2-49
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,2 @@
1-
import type { AnyZodType } from "../base";
2-
3-
export class Tool {
4-
private id: string;
5-
private _schema: AnyZodType;
6-
private _description: string;
7-
8-
private _execute: (parameters: any) => Promise<string>;
9-
10-
constructor(
11-
id: string,
12-
description: string,
13-
schema: AnyZodType,
14-
execute: (parameters: any) => Promise<string>
15-
) {
16-
this.id = id;
17-
this._description = description;
18-
this._schema = schema;
19-
this._execute = execute;
20-
}
21-
22-
get description() {
23-
return this._description;
24-
}
25-
26-
get schema() {
27-
return this._schema;
28-
}
29-
30-
execute(parameters: any) {
31-
return this._execute(parameters);
32-
}
33-
}
34-
35-
interface ToolOptions {
36-
id: string;
37-
description: string;
38-
schema: AnyZodType;
39-
execute: (parameters: any) => Promise<string>;
40-
}
41-
42-
export const createTool = (options: ToolOptions) => {
43-
return new Tool(
44-
options.id,
45-
options.description,
46-
options.schema,
47-
options.execute
48-
);
49-
};
1+
export * from "./goldrush";
2+
export * from "./base";

packages/ai-agent-sdk/src/core/zee/index.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Agent } from "../agent";
2-
import { createTool } from "../tools";
2+
import { createTool } from "../tools/base";
33
import { ZeeWorkflow } from "./index";
44
import fetch from "node-fetch";
55
import { test } from "vitest";

0 commit comments

Comments
 (0)