@coinbase/agentkit 0.9.0 → 0.9.1
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/README.md +31 -1
- package/dist/action-providers/farcaster/farcasterActionProvider.js +2 -0
- package/dist/action-providers/farcaster/farcasterActionProvider.test.js +55 -0
- package/dist/action-providers/farcaster/schemas.d.ts +13 -0
- package/dist/action-providers/farcaster/schemas.js +6 -0
- package/dist/action-providers/index.d.ts +2 -0
- package/dist/action-providers/index.js +2 -0
- package/dist/action-providers/truemarkets/constants.d.ts +179 -0
- package/dist/action-providers/truemarkets/constants.js +46 -0
- package/dist/action-providers/truemarkets/index.d.ts +1 -0
- package/dist/action-providers/truemarkets/index.js +17 -0
- package/dist/action-providers/truemarkets/schemas.d.ts +21 -0
- package/dist/action-providers/truemarkets/schemas.js +29 -0
- package/dist/action-providers/truemarkets/truemarketsActionProvider.d.ts +51 -0
- package/dist/action-providers/truemarkets/truemarketsActionProvider.js +469 -0
- package/dist/action-providers/truemarkets/truemarketsActionProvider.test.d.ts +1 -0
- package/dist/action-providers/truemarkets/truemarketsActionProvider.test.js +217 -0
- package/dist/action-providers/truemarkets/utils.d.ts +10 -0
- package/dist/action-providers/truemarkets/utils.js +9 -0
- package/dist/action-providers/twitter/schemas.d.ts +16 -0
- package/dist/action-providers/twitter/schemas.js +23 -1
- package/dist/action-providers/twitter/twitterActionProvider.d.ts +8 -1
- package/dist/action-providers/twitter/twitterActionProvider.js +56 -5
- package/dist/action-providers/twitter/twitterActionProvider.test.js +52 -2
- package/dist/action-providers/weth/constants.d.ts +9 -0
- package/dist/action-providers/weth/constants.js +12 -0
- package/dist/action-providers/weth/schemas.d.ts +7 -0
- package/dist/action-providers/weth/schemas.js +7 -1
- package/dist/action-providers/weth/wethActionProvider.d.ts +9 -1
- package/dist/action-providers/weth/wethActionProvider.js +50 -1
- package/dist/action-providers/weth/wethActionProvider.test.js +60 -0
- package/dist/action-providers/zora/index.d.ts +3 -0
- package/dist/action-providers/zora/index.js +19 -0
- package/dist/action-providers/zora/schemas.d.ts +29 -0
- package/dist/action-providers/zora/schemas.js +31 -0
- package/dist/action-providers/zora/utils.d.ts +28 -0
- package/dist/action-providers/zora/utils.js +200 -0
- package/dist/action-providers/zora/zoraActionProvider.d.ts +36 -0
- package/dist/action-providers/zora/zoraActionProvider.js +151 -0
- package/dist/action-providers/zora/zoraActionProvider.test.d.ts +1 -0
- package/dist/action-providers/zora/zoraActionProvider.test.js +205 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -261,7 +261,7 @@ const agent = createReactAgent({
|
|
|
261
261
|
</tr>
|
|
262
262
|
<tr>
|
|
263
263
|
<td width="200"><code>post_cast</code></td>
|
|
264
|
-
<td width="768">Creates a new cast (message) on Farcaster with up to 280 characters.</td>
|
|
264
|
+
<td width="768">Creates a new cast (message) on Farcaster with up to 280 characters and support for up to 2 embedded URLs.</td>
|
|
265
265
|
</tr>
|
|
266
266
|
</table>
|
|
267
267
|
</details>
|
|
@@ -362,6 +362,23 @@ const agent = createReactAgent({
|
|
|
362
362
|
<td width="200"><code>post_tweet_reply</code></td>
|
|
363
363
|
<td width="768">Creates a reply to an existing tweet using the tweet's unique identifier.</td>
|
|
364
364
|
</tr>
|
|
365
|
+
<tr>
|
|
366
|
+
<td width="200"><code>upload_media</code></td>
|
|
367
|
+
<td width="768">Uploads media (images, videos) to Twitter that can be attached to tweets.</td>
|
|
368
|
+
</tr>
|
|
369
|
+
</table>
|
|
370
|
+
</details>
|
|
371
|
+
<details>
|
|
372
|
+
<summary><strong>TrueMarkets</strong></summary>
|
|
373
|
+
<table width="100%">
|
|
374
|
+
<tr>
|
|
375
|
+
<td width="200"><code>get_active_markets</code></td>
|
|
376
|
+
<td width="768">Retrieves active prediction markets from Truemarkets with pagination and sorting options.</td>
|
|
377
|
+
</tr>
|
|
378
|
+
<tr>
|
|
379
|
+
<td width="200"><code>get_market_details</code></td>
|
|
380
|
+
<td width="768">Fetches comprehensive details for a specific Truemarkets prediction market including question, status, prices, and liquidity.</td>
|
|
381
|
+
</tr>
|
|
365
382
|
</table>
|
|
366
383
|
</details>
|
|
367
384
|
<details>
|
|
@@ -384,6 +401,10 @@ const agent = createReactAgent({
|
|
|
384
401
|
<td width="200"><code>wrap_eth</code></td>
|
|
385
402
|
<td width="768">Converts native ETH to Wrapped ETH (WETH) on Base Sepolia or Base Mainnet.</td>
|
|
386
403
|
</tr>
|
|
404
|
+
<tr>
|
|
405
|
+
<td width="200"><code>unwrap_eth</code></td>
|
|
406
|
+
<td width="768">Converts Wrapped ETH (WETH) to Native ETH on Base Sepolia or Base Mainnet.</td>
|
|
407
|
+
</tr>
|
|
387
408
|
</table>
|
|
388
409
|
</details>
|
|
389
410
|
<details>
|
|
@@ -439,6 +460,15 @@ it will return payment details that can be used on retry.</td>
|
|
|
439
460
|
</tr>
|
|
440
461
|
</table>
|
|
441
462
|
</details>
|
|
463
|
+
<details>
|
|
464
|
+
<summary><strong>Zora</strong></summary>
|
|
465
|
+
<table width="100%">
|
|
466
|
+
<tr>
|
|
467
|
+
<td width="200"><code>coinIt</code></td>
|
|
468
|
+
<td width="768">Creates a new Zora coin with customizable name, symbol, description, and image.</td>
|
|
469
|
+
</tr>
|
|
470
|
+
</table>
|
|
471
|
+
</details>
|
|
442
472
|
|
|
443
473
|
## Creating an Action Provider
|
|
444
474
|
|
|
@@ -90,6 +90,7 @@ class FarcasterActionProvider extends actionProvider_1.ActionProvider {
|
|
|
90
90
|
body: JSON.stringify({
|
|
91
91
|
signer_uuid: this.signerUuid,
|
|
92
92
|
text: args.castText,
|
|
93
|
+
embeds: args.embeds,
|
|
93
94
|
}),
|
|
94
95
|
});
|
|
95
96
|
const data = await response.json();
|
|
@@ -125,6 +126,7 @@ __decorate([
|
|
|
125
126
|
name: "post_cast",
|
|
126
127
|
description: `
|
|
127
128
|
This tool will post a cast to Farcaster. The tool takes the text of the cast as input. Casts can be maximum 280 characters.
|
|
129
|
+
Optionally, up to 2 embeds (links to websites or mini apps) can be attached to the cast by providing an array of URLs in the embeds parameter.
|
|
128
130
|
|
|
129
131
|
A successful response will return a message with the API response as a JSON payload:
|
|
130
132
|
{}
|
|
@@ -23,6 +23,35 @@ describe("Farcaster Action Provider Input Schemas", () => {
|
|
|
23
23
|
expect(result.success).toBe(true);
|
|
24
24
|
expect(result.data).toEqual(validInput);
|
|
25
25
|
});
|
|
26
|
+
it("should successfully parse valid cast text with embeds", () => {
|
|
27
|
+
const validInput = {
|
|
28
|
+
castText: "Hello, Farcaster!",
|
|
29
|
+
embeds: [{ url: "https://example.com" }],
|
|
30
|
+
};
|
|
31
|
+
const result = schemas_1.FarcasterPostCastSchema.safeParse(validInput);
|
|
32
|
+
expect(result.success).toBe(true);
|
|
33
|
+
expect(result.data).toEqual(validInput);
|
|
34
|
+
});
|
|
35
|
+
it("should fail when embed URL is invalid", () => {
|
|
36
|
+
const invalidInput = {
|
|
37
|
+
castText: "Hello, Farcaster!",
|
|
38
|
+
embeds: [{ url: "invalid-url" }],
|
|
39
|
+
};
|
|
40
|
+
const result = schemas_1.FarcasterPostCastSchema.safeParse(invalidInput);
|
|
41
|
+
expect(result.success).toBe(false);
|
|
42
|
+
});
|
|
43
|
+
it("should fail when there are more than 2 embeds", () => {
|
|
44
|
+
const invalidInput = {
|
|
45
|
+
castText: "Hello, Farcaster!",
|
|
46
|
+
embeds: [
|
|
47
|
+
{ url: "https://example1.com" },
|
|
48
|
+
{ url: "https://example2.com" },
|
|
49
|
+
{ url: "https://example3.com" },
|
|
50
|
+
],
|
|
51
|
+
};
|
|
52
|
+
const result = schemas_1.FarcasterPostCastSchema.safeParse(invalidInput);
|
|
53
|
+
expect(result.success).toBe(false);
|
|
54
|
+
});
|
|
26
55
|
it("should fail parsing cast text over 280 characters", () => {
|
|
27
56
|
const invalidInput = {
|
|
28
57
|
castText: "a".repeat(281),
|
|
@@ -100,6 +129,32 @@ describe("Farcaster Action Provider", () => {
|
|
|
100
129
|
body: JSON.stringify({
|
|
101
130
|
signer_uuid: mockConfig.signerUuid,
|
|
102
131
|
text: args.castText,
|
|
132
|
+
embeds: undefined,
|
|
133
|
+
}),
|
|
134
|
+
});
|
|
135
|
+
expect(mockFetch).toHaveBeenCalledTimes(1);
|
|
136
|
+
expect(result).toContain("Successfully posted cast to Farcaster");
|
|
137
|
+
expect(result).toContain(JSON.stringify(mockCastResponse));
|
|
138
|
+
});
|
|
139
|
+
it("should successfully post a cast with embeds", async () => {
|
|
140
|
+
mockFetch.mockResolvedValueOnce({
|
|
141
|
+
json: () => Promise.resolve(mockCastResponse),
|
|
142
|
+
});
|
|
143
|
+
const args = {
|
|
144
|
+
castText: "Hello, Farcaster!",
|
|
145
|
+
embeds: [{ url: "https://example.com" }],
|
|
146
|
+
};
|
|
147
|
+
const result = await actionProvider.postCast(args);
|
|
148
|
+
expect(mockFetch).toHaveBeenCalledWith("https://api.neynar.com/v2/farcaster/cast", {
|
|
149
|
+
method: "POST",
|
|
150
|
+
headers: {
|
|
151
|
+
api_key: mockConfig.neynarApiKey,
|
|
152
|
+
"Content-Type": "application/json",
|
|
153
|
+
},
|
|
154
|
+
body: JSON.stringify({
|
|
155
|
+
signer_uuid: mockConfig.signerUuid,
|
|
156
|
+
text: args.castText,
|
|
157
|
+
embeds: args.embeds,
|
|
103
158
|
}),
|
|
104
159
|
});
|
|
105
160
|
expect(mockFetch).toHaveBeenCalledTimes(1);
|
|
@@ -8,8 +8,21 @@ export declare const FarcasterAccountDetailsSchema: z.ZodObject<{}, "strip", z.Z
|
|
|
8
8
|
*/
|
|
9
9
|
export declare const FarcasterPostCastSchema: z.ZodObject<{
|
|
10
10
|
castText: z.ZodString;
|
|
11
|
+
embeds: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
12
|
+
url: z.ZodString;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
url: string;
|
|
15
|
+
}, {
|
|
16
|
+
url: string;
|
|
17
|
+
}>, "many">>;
|
|
11
18
|
}, "strip", z.ZodTypeAny, {
|
|
12
19
|
castText: string;
|
|
20
|
+
embeds?: {
|
|
21
|
+
url: string;
|
|
22
|
+
}[] | undefined;
|
|
13
23
|
}, {
|
|
14
24
|
castText: string;
|
|
25
|
+
embeds?: {
|
|
26
|
+
url: string;
|
|
27
|
+
}[] | undefined;
|
|
15
28
|
}>;
|
|
@@ -15,6 +15,12 @@ exports.FarcasterAccountDetailsSchema = zod_1.z
|
|
|
15
15
|
exports.FarcasterPostCastSchema = zod_1.z
|
|
16
16
|
.object({
|
|
17
17
|
castText: zod_1.z.string().max(280, "Cast text must be a maximum of 280 characters."),
|
|
18
|
+
embeds: zod_1.z
|
|
19
|
+
.array(zod_1.z.object({
|
|
20
|
+
url: zod_1.z.string().url("Embed URL must be a valid URL"),
|
|
21
|
+
}))
|
|
22
|
+
.max(2, "Maximum of 2 embeds allowed")
|
|
23
|
+
.optional(),
|
|
18
24
|
})
|
|
19
25
|
.strip()
|
|
20
26
|
.describe("Input schema for posting a text-based cast");
|
|
@@ -18,6 +18,7 @@ export * from "./moonwell";
|
|
|
18
18
|
export * from "./morpho";
|
|
19
19
|
export * from "./opensea";
|
|
20
20
|
export * from "./spl";
|
|
21
|
+
export * from "./truemarkets";
|
|
21
22
|
export * from "./twitter";
|
|
22
23
|
export * from "./wallet";
|
|
23
24
|
export * from "./weth";
|
|
@@ -28,3 +29,4 @@ export * from "./onramp";
|
|
|
28
29
|
export * from "./vaultsfyi";
|
|
29
30
|
export * from "./x402";
|
|
30
31
|
export * from "./zerodev";
|
|
32
|
+
export * from "./zora";
|
|
@@ -34,6 +34,7 @@ __exportStar(require("./moonwell"), exports);
|
|
|
34
34
|
__exportStar(require("./morpho"), exports);
|
|
35
35
|
__exportStar(require("./opensea"), exports);
|
|
36
36
|
__exportStar(require("./spl"), exports);
|
|
37
|
+
__exportStar(require("./truemarkets"), exports);
|
|
37
38
|
__exportStar(require("./twitter"), exports);
|
|
38
39
|
__exportStar(require("./wallet"), exports);
|
|
39
40
|
__exportStar(require("./weth"), exports);
|
|
@@ -44,3 +45,4 @@ __exportStar(require("./onramp"), exports);
|
|
|
44
45
|
__exportStar(require("./vaultsfyi"), exports);
|
|
45
46
|
__exportStar(require("./x402"), exports);
|
|
46
47
|
__exportStar(require("./zerodev"), exports);
|
|
48
|
+
__exportStar(require("./zora"), exports);
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
export declare const TruthMarketABI: ({
|
|
2
|
+
readonly name: "marketQuestion";
|
|
3
|
+
readonly type: "function";
|
|
4
|
+
readonly stateMutability: "view";
|
|
5
|
+
readonly inputs: readonly [];
|
|
6
|
+
readonly outputs: readonly [{
|
|
7
|
+
readonly type: "string";
|
|
8
|
+
}];
|
|
9
|
+
} | {
|
|
10
|
+
readonly name: "marketSource";
|
|
11
|
+
readonly type: "function";
|
|
12
|
+
readonly stateMutability: "view";
|
|
13
|
+
readonly inputs: readonly [];
|
|
14
|
+
readonly outputs: readonly [{
|
|
15
|
+
readonly type: "string";
|
|
16
|
+
}];
|
|
17
|
+
} | {
|
|
18
|
+
readonly name: "getCurrentStatus";
|
|
19
|
+
readonly type: "function";
|
|
20
|
+
readonly stateMutability: "view";
|
|
21
|
+
readonly inputs: readonly [];
|
|
22
|
+
readonly outputs: readonly [{
|
|
23
|
+
readonly type: "uint8";
|
|
24
|
+
}];
|
|
25
|
+
} | {
|
|
26
|
+
readonly name: "endOfTrading";
|
|
27
|
+
readonly type: "function";
|
|
28
|
+
readonly stateMutability: "view";
|
|
29
|
+
readonly inputs: readonly [];
|
|
30
|
+
readonly outputs: readonly [{
|
|
31
|
+
readonly type: "uint256";
|
|
32
|
+
}];
|
|
33
|
+
} | {
|
|
34
|
+
readonly name: "getPoolAddresses";
|
|
35
|
+
readonly type: "function";
|
|
36
|
+
readonly stateMutability: "view";
|
|
37
|
+
readonly inputs: readonly [];
|
|
38
|
+
readonly outputs: readonly [{
|
|
39
|
+
readonly type: "address";
|
|
40
|
+
readonly name: "yesPool";
|
|
41
|
+
}, {
|
|
42
|
+
readonly type: "address";
|
|
43
|
+
readonly name: "noPool";
|
|
44
|
+
}];
|
|
45
|
+
} | {
|
|
46
|
+
readonly name: "paymentToken";
|
|
47
|
+
readonly type: "function";
|
|
48
|
+
readonly stateMutability: "view";
|
|
49
|
+
readonly inputs: readonly [];
|
|
50
|
+
readonly outputs: readonly [{
|
|
51
|
+
readonly type: "address";
|
|
52
|
+
}];
|
|
53
|
+
} | {
|
|
54
|
+
readonly name: "additionalInfo";
|
|
55
|
+
readonly type: "function";
|
|
56
|
+
readonly stateMutability: "view";
|
|
57
|
+
readonly inputs: readonly [];
|
|
58
|
+
readonly outputs: readonly [{
|
|
59
|
+
readonly type: "string";
|
|
60
|
+
}];
|
|
61
|
+
} | {
|
|
62
|
+
readonly name: "winningPosition";
|
|
63
|
+
readonly type: "function";
|
|
64
|
+
readonly stateMutability: "view";
|
|
65
|
+
readonly inputs: readonly [];
|
|
66
|
+
readonly outputs: readonly [{
|
|
67
|
+
readonly type: "uint8";
|
|
68
|
+
}];
|
|
69
|
+
})[];
|
|
70
|
+
export declare const TruthMarketManagerABI: ({
|
|
71
|
+
readonly name: "numberOfActiveMarkets";
|
|
72
|
+
readonly type: "function";
|
|
73
|
+
readonly stateMutability: "view";
|
|
74
|
+
readonly inputs: readonly [];
|
|
75
|
+
readonly outputs: readonly [{
|
|
76
|
+
readonly type: "uint256";
|
|
77
|
+
}];
|
|
78
|
+
} | {
|
|
79
|
+
readonly name: "getActiveMarketAddress";
|
|
80
|
+
readonly type: "function";
|
|
81
|
+
readonly stateMutability: "view";
|
|
82
|
+
readonly inputs: readonly [{
|
|
83
|
+
readonly type: "uint256";
|
|
84
|
+
}];
|
|
85
|
+
readonly outputs: readonly [{
|
|
86
|
+
readonly type: "address";
|
|
87
|
+
}];
|
|
88
|
+
} | {
|
|
89
|
+
readonly name: "creatorAddress";
|
|
90
|
+
readonly type: "function";
|
|
91
|
+
readonly stateMutability: "view";
|
|
92
|
+
readonly inputs: readonly [{
|
|
93
|
+
readonly type: "address";
|
|
94
|
+
}];
|
|
95
|
+
readonly outputs: readonly [{
|
|
96
|
+
readonly type: "address";
|
|
97
|
+
}];
|
|
98
|
+
} | {
|
|
99
|
+
readonly name: "resolverAddress";
|
|
100
|
+
readonly type: "function";
|
|
101
|
+
readonly stateMutability: "view";
|
|
102
|
+
readonly inputs: readonly [{
|
|
103
|
+
readonly type: "address";
|
|
104
|
+
}];
|
|
105
|
+
readonly outputs: readonly [{
|
|
106
|
+
readonly type: "address";
|
|
107
|
+
}];
|
|
108
|
+
})[];
|
|
109
|
+
export declare const UniswapV3PoolABI: ({
|
|
110
|
+
readonly name: "liquidity";
|
|
111
|
+
readonly type: "function";
|
|
112
|
+
readonly stateMutability: "view";
|
|
113
|
+
readonly inputs: readonly [];
|
|
114
|
+
readonly outputs: readonly [{
|
|
115
|
+
readonly type: "uint128";
|
|
116
|
+
}];
|
|
117
|
+
} | {
|
|
118
|
+
readonly name: "slot0";
|
|
119
|
+
readonly type: "function";
|
|
120
|
+
readonly stateMutability: "view";
|
|
121
|
+
readonly inputs: readonly [];
|
|
122
|
+
readonly outputs: readonly [{
|
|
123
|
+
readonly type: "uint160";
|
|
124
|
+
readonly name: "sqrtPriceX96";
|
|
125
|
+
}, {
|
|
126
|
+
readonly type: "int24";
|
|
127
|
+
readonly name: "tick";
|
|
128
|
+
}, {
|
|
129
|
+
readonly type: "uint16";
|
|
130
|
+
readonly name: "observationIndex";
|
|
131
|
+
}, {
|
|
132
|
+
readonly type: "uint16";
|
|
133
|
+
readonly name: "observationCardinality";
|
|
134
|
+
}, {
|
|
135
|
+
readonly type: "uint16";
|
|
136
|
+
readonly name: "observationCardinalityNext";
|
|
137
|
+
}, {
|
|
138
|
+
readonly type: "uint8";
|
|
139
|
+
readonly name: "feeProtocol";
|
|
140
|
+
}, {
|
|
141
|
+
readonly type: "bool";
|
|
142
|
+
readonly name: "unlocked";
|
|
143
|
+
}];
|
|
144
|
+
} | {
|
|
145
|
+
readonly name: "token0";
|
|
146
|
+
readonly type: "function";
|
|
147
|
+
readonly stateMutability: "view";
|
|
148
|
+
readonly inputs: readonly [];
|
|
149
|
+
readonly outputs: readonly [{
|
|
150
|
+
readonly type: "address";
|
|
151
|
+
}];
|
|
152
|
+
} | {
|
|
153
|
+
readonly name: "token1";
|
|
154
|
+
readonly type: "function";
|
|
155
|
+
readonly stateMutability: "view";
|
|
156
|
+
readonly inputs: readonly [];
|
|
157
|
+
readonly outputs: readonly [{
|
|
158
|
+
readonly type: "address";
|
|
159
|
+
}];
|
|
160
|
+
})[];
|
|
161
|
+
export declare const TruthMarketManager_ADDRESS = "0x61A98Bef11867c69489B91f340fE545eEfc695d7";
|
|
162
|
+
export declare const USDC_ADDRESS = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
163
|
+
export declare const TYD_ADDRESS = "0xb13CF163d916917d9cD6E836905cA5f12a1dEF4B";
|
|
164
|
+
export declare const USDC_DECIMALS = 6;
|
|
165
|
+
export declare const TYD_DECIMALS = 6;
|
|
166
|
+
export declare const YESNO_DECIMALS = 18;
|
|
167
|
+
/**
|
|
168
|
+
* Market status enum
|
|
169
|
+
*/
|
|
170
|
+
export declare const MarketStatus: {
|
|
171
|
+
Created: number;
|
|
172
|
+
OpenForResolution: number;
|
|
173
|
+
ResolutionProposed: number;
|
|
174
|
+
DisputeRaised: number;
|
|
175
|
+
SetByCouncil: number;
|
|
176
|
+
ResetByCouncil: number;
|
|
177
|
+
EscalatedDisputeRaised: number;
|
|
178
|
+
Finalized: number;
|
|
179
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MarketStatus = exports.YESNO_DECIMALS = exports.TYD_DECIMALS = exports.USDC_DECIMALS = exports.TYD_ADDRESS = exports.USDC_ADDRESS = exports.TruthMarketManager_ADDRESS = exports.UniswapV3PoolABI = exports.TruthMarketManagerABI = exports.TruthMarketABI = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
// Simplified ABIs
|
|
6
|
+
exports.TruthMarketABI = [
|
|
7
|
+
(0, viem_1.parseAbiItem)("function marketQuestion() view returns (string)"),
|
|
8
|
+
(0, viem_1.parseAbiItem)("function marketSource() view returns (string)"),
|
|
9
|
+
(0, viem_1.parseAbiItem)("function getCurrentStatus() view returns (uint8)"),
|
|
10
|
+
(0, viem_1.parseAbiItem)("function endOfTrading() view returns (uint256)"),
|
|
11
|
+
(0, viem_1.parseAbiItem)("function getPoolAddresses() view returns (address yesPool, address noPool)"),
|
|
12
|
+
(0, viem_1.parseAbiItem)("function paymentToken() view returns (address)"),
|
|
13
|
+
(0, viem_1.parseAbiItem)("function additionalInfo() view returns (string)"),
|
|
14
|
+
(0, viem_1.parseAbiItem)("function winningPosition() view returns (uint8)"),
|
|
15
|
+
];
|
|
16
|
+
exports.TruthMarketManagerABI = [
|
|
17
|
+
(0, viem_1.parseAbiItem)("function numberOfActiveMarkets() view returns (uint256)"),
|
|
18
|
+
(0, viem_1.parseAbiItem)("function getActiveMarketAddress(uint256) view returns (address)"),
|
|
19
|
+
(0, viem_1.parseAbiItem)("function creatorAddress(address) view returns (address)"),
|
|
20
|
+
(0, viem_1.parseAbiItem)("function resolverAddress(address) view returns (address)"),
|
|
21
|
+
];
|
|
22
|
+
exports.UniswapV3PoolABI = [
|
|
23
|
+
(0, viem_1.parseAbiItem)("function liquidity() view returns (uint128)"),
|
|
24
|
+
(0, viem_1.parseAbiItem)("function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked)"),
|
|
25
|
+
(0, viem_1.parseAbiItem)("function token0() view returns (address)"),
|
|
26
|
+
(0, viem_1.parseAbiItem)("function token1() view returns (address)"),
|
|
27
|
+
];
|
|
28
|
+
exports.TruthMarketManager_ADDRESS = "0x61A98Bef11867c69489B91f340fE545eEfc695d7";
|
|
29
|
+
exports.USDC_ADDRESS = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
30
|
+
exports.TYD_ADDRESS = "0xb13CF163d916917d9cD6E836905cA5f12a1dEF4B";
|
|
31
|
+
exports.USDC_DECIMALS = 6;
|
|
32
|
+
exports.TYD_DECIMALS = 6;
|
|
33
|
+
exports.YESNO_DECIMALS = 18;
|
|
34
|
+
/**
|
|
35
|
+
* Market status enum
|
|
36
|
+
*/
|
|
37
|
+
exports.MarketStatus = {
|
|
38
|
+
Created: 0,
|
|
39
|
+
OpenForResolution: 1,
|
|
40
|
+
ResolutionProposed: 2,
|
|
41
|
+
DisputeRaised: 3,
|
|
42
|
+
SetByCouncil: 4,
|
|
43
|
+
ResetByCouncil: 5,
|
|
44
|
+
EscalatedDisputeRaised: 6,
|
|
45
|
+
Finalized: 7,
|
|
46
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./truemarketsActionProvider";
|
|
@@ -0,0 +1,17 @@
|
|
|
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("./truemarketsActionProvider"), exports);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Input schema for get active markets action.
|
|
4
|
+
*/
|
|
5
|
+
export declare const GetTruthMarketsSchema: z.ZodObject<{
|
|
6
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
7
|
+
offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
8
|
+
sortOrder: z.ZodDefault<z.ZodOptional<z.ZodEnum<["asc", "desc"]>>>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
offset: number;
|
|
11
|
+
limit: number;
|
|
12
|
+
sortOrder: "asc" | "desc";
|
|
13
|
+
}, {
|
|
14
|
+
offset?: number | undefined;
|
|
15
|
+
limit?: number | undefined;
|
|
16
|
+
sortOrder?: "asc" | "desc" | undefined;
|
|
17
|
+
}>;
|
|
18
|
+
/**
|
|
19
|
+
* Input schema for get market details action.
|
|
20
|
+
*/
|
|
21
|
+
export declare const GetTruthMarketDetailsSchema: z.ZodString;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetTruthMarketDetailsSchema = exports.GetTruthMarketsSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
/**
|
|
6
|
+
* Input schema for get active markets action.
|
|
7
|
+
*/
|
|
8
|
+
exports.GetTruthMarketsSchema = zod_1.z
|
|
9
|
+
.object({
|
|
10
|
+
limit: zod_1.z
|
|
11
|
+
.number()
|
|
12
|
+
.optional()
|
|
13
|
+
.describe("Maximum number of markets to return (default: 10)")
|
|
14
|
+
.default(10),
|
|
15
|
+
offset: zod_1.z.number().optional().describe("Number of markets to skip (for pagination)").default(0),
|
|
16
|
+
sortOrder: zod_1.z
|
|
17
|
+
.enum(["asc", "desc"])
|
|
18
|
+
.optional()
|
|
19
|
+
.describe("Sort order for the markets (default: desc)")
|
|
20
|
+
.default("desc"),
|
|
21
|
+
})
|
|
22
|
+
.strip()
|
|
23
|
+
.describe("Instructions for getting prediction markets on Truemarkets");
|
|
24
|
+
/**
|
|
25
|
+
* Input schema for get market details action.
|
|
26
|
+
*/
|
|
27
|
+
exports.GetTruthMarketDetailsSchema = zod_1.z
|
|
28
|
+
.string()
|
|
29
|
+
.describe("Prediction market address (0x...) or market ID (number) to retrieve details for");
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ActionProvider } from "../actionProvider";
|
|
3
|
+
import { Network } from "../../network";
|
|
4
|
+
import { GetTruthMarketsSchema, GetTruthMarketDetailsSchema } from "./schemas";
|
|
5
|
+
import { EvmWalletProvider } from "../../wallet-providers";
|
|
6
|
+
/**
|
|
7
|
+
* Configuration options for the TrueMarketsActionProvider.
|
|
8
|
+
*/
|
|
9
|
+
export interface TrueMarketsActionProviderConfig {
|
|
10
|
+
/**
|
|
11
|
+
* RPC URL for creating the Viem public client
|
|
12
|
+
*/
|
|
13
|
+
RPC_URL?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* TrueMarketsActionProvider provides actions to interact with TrueMarkets contracts.
|
|
17
|
+
*/
|
|
18
|
+
export declare class TrueMarketsActionProvider extends ActionProvider<EvmWalletProvider> {
|
|
19
|
+
#private;
|
|
20
|
+
/**
|
|
21
|
+
* Constructor for the TrueMarketsActionProvider.
|
|
22
|
+
*
|
|
23
|
+
* @param config - The configuration options for the TrueMarketsActionProvider.
|
|
24
|
+
*/
|
|
25
|
+
constructor(config?: TrueMarketsActionProviderConfig);
|
|
26
|
+
/**
|
|
27
|
+
* Gets active markets from the TruthMarketManager contract.
|
|
28
|
+
*
|
|
29
|
+
* @param walletProvider - The wallet provider to use for contract interactions.
|
|
30
|
+
* @param args - The input arguments for the action, including pagination and sorting options.
|
|
31
|
+
* @returns JSON object containing the active markets information.
|
|
32
|
+
*/
|
|
33
|
+
getPredictionMarkets(walletProvider: EvmWalletProvider, args: z.infer<typeof GetTruthMarketsSchema>): Promise<string>;
|
|
34
|
+
/**
|
|
35
|
+
* Gets detailed information for a specific market address.
|
|
36
|
+
*
|
|
37
|
+
* @param walletProvider - The wallet provider to use for contract interactions.
|
|
38
|
+
* @param args - The input arguments for the action, containing the market address.
|
|
39
|
+
* @returns JSON object containing detailed market information.
|
|
40
|
+
*/
|
|
41
|
+
getPredictionMarketDetails(walletProvider: EvmWalletProvider, args: z.infer<typeof GetTruthMarketDetailsSchema>): Promise<string>;
|
|
42
|
+
/**
|
|
43
|
+
* Checks if the TrueMarkets action provider supports the given network.
|
|
44
|
+
* Currently only supports Base mainnet.
|
|
45
|
+
*
|
|
46
|
+
* @param network - The network to check.
|
|
47
|
+
* @returns True if the TrueMarkets action provider supports the network, false otherwise.
|
|
48
|
+
*/
|
|
49
|
+
supportsNetwork: (network: Network) => boolean;
|
|
50
|
+
}
|
|
51
|
+
export declare const truemarketsActionProvider: (config?: TrueMarketsActionProviderConfig) => TrueMarketsActionProvider;
|