@coinbase/agentkit 0.9.0 → 0.10.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.
Files changed (74) hide show
  1. package/README.md +137 -55
  2. package/dist/action-providers/cdp/cdpApiActionProvider.js +2 -0
  3. package/dist/action-providers/cdp/cdpEvmWalletActionProvider.d.ts +43 -0
  4. package/dist/action-providers/cdp/cdpEvmWalletActionProvider.js +151 -0
  5. package/dist/action-providers/cdp/cdpEvmWalletActionProvider.test.d.ts +1 -0
  6. package/dist/action-providers/cdp/cdpEvmWalletActionProvider.test.js +242 -0
  7. package/dist/action-providers/cdp/cdpSmartWalletActionProvider.d.ts +42 -0
  8. package/dist/action-providers/cdp/cdpSmartWalletActionProvider.js +132 -0
  9. package/dist/action-providers/cdp/cdpSmartWalletActionProvider.test.d.ts +1 -0
  10. package/dist/action-providers/cdp/cdpSmartWalletActionProvider.test.js +199 -0
  11. package/dist/action-providers/cdp/index.d.ts +3 -0
  12. package/dist/action-providers/cdp/index.js +3 -0
  13. package/dist/action-providers/cdp/schemas.d.ts +29 -0
  14. package/dist/action-providers/cdp/schemas.js +32 -1
  15. package/dist/action-providers/cdp/spendPermissionUtils.d.ts +24 -0
  16. package/dist/action-providers/cdp/spendPermissionUtils.js +66 -0
  17. package/dist/action-providers/farcaster/farcasterActionProvider.js +2 -0
  18. package/dist/action-providers/farcaster/farcasterActionProvider.test.js +55 -0
  19. package/dist/action-providers/farcaster/schemas.d.ts +13 -0
  20. package/dist/action-providers/farcaster/schemas.js +6 -0
  21. package/dist/action-providers/index.d.ts +3 -0
  22. package/dist/action-providers/index.js +3 -0
  23. package/dist/action-providers/truemarkets/constants.d.ts +179 -0
  24. package/dist/action-providers/truemarkets/constants.js +46 -0
  25. package/dist/action-providers/truemarkets/index.d.ts +1 -0
  26. package/dist/action-providers/truemarkets/index.js +17 -0
  27. package/dist/action-providers/truemarkets/schemas.d.ts +21 -0
  28. package/dist/action-providers/truemarkets/schemas.js +29 -0
  29. package/dist/action-providers/truemarkets/truemarketsActionProvider.d.ts +51 -0
  30. package/dist/action-providers/truemarkets/truemarketsActionProvider.js +469 -0
  31. package/dist/action-providers/truemarkets/truemarketsActionProvider.test.d.ts +1 -0
  32. package/dist/action-providers/truemarkets/truemarketsActionProvider.test.js +217 -0
  33. package/dist/action-providers/truemarkets/utils.d.ts +10 -0
  34. package/dist/action-providers/truemarkets/utils.js +9 -0
  35. package/dist/action-providers/twitter/schemas.d.ts +16 -0
  36. package/dist/action-providers/twitter/schemas.js +23 -1
  37. package/dist/action-providers/twitter/twitterActionProvider.d.ts +8 -1
  38. package/dist/action-providers/twitter/twitterActionProvider.js +56 -5
  39. package/dist/action-providers/twitter/twitterActionProvider.test.js +52 -2
  40. package/dist/action-providers/weth/constants.d.ts +9 -0
  41. package/dist/action-providers/weth/constants.js +12 -0
  42. package/dist/action-providers/weth/schemas.d.ts +7 -0
  43. package/dist/action-providers/weth/schemas.js +7 -1
  44. package/dist/action-providers/weth/wethActionProvider.d.ts +9 -1
  45. package/dist/action-providers/weth/wethActionProvider.js +50 -1
  46. package/dist/action-providers/weth/wethActionProvider.test.js +60 -0
  47. package/dist/action-providers/zerion/constants.d.ts +1 -0
  48. package/dist/action-providers/zerion/constants.js +4 -0
  49. package/dist/action-providers/zerion/index.d.ts +2 -0
  50. package/dist/action-providers/zerion/index.js +18 -0
  51. package/dist/action-providers/zerion/schemas.d.ts +11 -0
  52. package/dist/action-providers/zerion/schemas.js +15 -0
  53. package/dist/action-providers/zerion/types.d.ts +125 -0
  54. package/dist/action-providers/zerion/types.js +16 -0
  55. package/dist/action-providers/zerion/utils.d.ts +3 -0
  56. package/dist/action-providers/zerion/utils.js +45 -0
  57. package/dist/action-providers/zerion/zerionActionProvider.d.ts +57 -0
  58. package/dist/action-providers/zerion/zerionActionProvider.js +159 -0
  59. package/dist/action-providers/zerion/zerionActionProvider.test.d.ts +1 -0
  60. package/dist/action-providers/zerion/zerionActionProvider.test.js +213 -0
  61. package/dist/action-providers/zora/index.d.ts +3 -0
  62. package/dist/action-providers/zora/index.js +19 -0
  63. package/dist/action-providers/zora/schemas.d.ts +29 -0
  64. package/dist/action-providers/zora/schemas.js +31 -0
  65. package/dist/action-providers/zora/utils.d.ts +28 -0
  66. package/dist/action-providers/zora/utils.js +200 -0
  67. package/dist/action-providers/zora/zoraActionProvider.d.ts +36 -0
  68. package/dist/action-providers/zora/zoraActionProvider.js +151 -0
  69. package/dist/action-providers/zora/zoraActionProvider.test.d.ts +1 -0
  70. package/dist/action-providers/zora/zoraActionProvider.test.js +205 -0
  71. package/dist/wallet-providers/cdpShared.d.ts +4 -0
  72. package/dist/wallet-providers/cdpSmartWalletProvider.d.ts +8 -1
  73. package/dist/wallet-providers/cdpSmartWalletProvider.js +23 -11
  74. package/package.json +3 -2
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SwapSchema = exports.RequestFaucetFundsV2Schema = void 0;
3
+ exports.UseSpendPermissionSchema = exports.ListSpendPermissionsSchema = exports.SwapSchema = exports.RequestFaucetFundsV2Schema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  /**
6
6
  * Input schema for request faucet funds action.
@@ -26,3 +26,34 @@ exports.SwapSchema = zod_1.z
26
26
  })
27
27
  .strip()
28
28
  .describe("Instructions for swapping tokens");
29
+ /**
30
+ * Input schema for listing spend permissions action.
31
+ */
32
+ exports.ListSpendPermissionsSchema = zod_1.z
33
+ .object({
34
+ smartAccountAddress: zod_1.z
35
+ .string()
36
+ .describe("The smart account address that has granted spend permissions"),
37
+ network: zod_1.z
38
+ .string()
39
+ .optional()
40
+ .describe("The network to list permissions on (defaults to wallet's network)"),
41
+ })
42
+ .strip()
43
+ .describe("Instructions for listing spend permissions for a smart account");
44
+ /**
45
+ * Input schema for using a spend permission action.
46
+ */
47
+ exports.UseSpendPermissionSchema = zod_1.z
48
+ .object({
49
+ smartAccountAddress: zod_1.z
50
+ .string()
51
+ .describe("The smart account address that has granted the spend permission"),
52
+ value: zod_1.z.string().describe("The amount to spend (in the token's units)"),
53
+ network: zod_1.z
54
+ .string()
55
+ .optional()
56
+ .describe("The network to perform the spend on (defaults to wallet's network)"),
57
+ })
58
+ .strip()
59
+ .describe("Instructions for using a spend permission");
@@ -0,0 +1,24 @@
1
+ import { CdpClient, type SpendPermission } from "@coinbase/cdp-sdk";
2
+ import type { Address } from "viem";
3
+ /**
4
+ * Shared utility functions for spend permission operations.
5
+ */
6
+ /**
7
+ * Lists and formats spend permissions for a given smart account and spender.
8
+ *
9
+ * @param cdpClient - The CDP client to use for API calls
10
+ * @param smartAccountAddress - The smart account address to check permissions for
11
+ * @param spenderAddress - The spender address to filter permissions by
12
+ * @returns A formatted string containing the spend permissions or an error message
13
+ */
14
+ export declare function listSpendPermissionsForSpender(cdpClient: CdpClient, smartAccountAddress: Address, spenderAddress: Address): Promise<string>;
15
+ /**
16
+ * Finds and retrieves the latest valid spend permission for a given spender from a smart account.
17
+ *
18
+ * @param cdpClient - The CDP client to use for API calls
19
+ * @param smartAccountAddress - The smart account address to check permissions for
20
+ * @param spenderAddress - The spender address to find permissions for
21
+ * @returns The latest spend permission or throws an error if none found
22
+ * @throws Error if no permissions found or permission is invalid
23
+ */
24
+ export declare function findLatestSpendPermission(cdpClient: CdpClient, smartAccountAddress: Address, spenderAddress: Address): Promise<SpendPermission>;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listSpendPermissionsForSpender = listSpendPermissionsForSpender;
4
+ exports.findLatestSpendPermission = findLatestSpendPermission;
5
+ /**
6
+ * Shared utility functions for spend permission operations.
7
+ */
8
+ /**
9
+ * Lists and formats spend permissions for a given smart account and spender.
10
+ *
11
+ * @param cdpClient - The CDP client to use for API calls
12
+ * @param smartAccountAddress - The smart account address to check permissions for
13
+ * @param spenderAddress - The spender address to filter permissions by
14
+ * @returns A formatted string containing the spend permissions or an error message
15
+ */
16
+ async function listSpendPermissionsForSpender(cdpClient, smartAccountAddress, spenderAddress) {
17
+ try {
18
+ // List all spend permissions for the smart account
19
+ const allPermissions = await cdpClient.evm.listSpendPermissions({
20
+ address: smartAccountAddress,
21
+ });
22
+ // Filter permissions where current wallet is the spender
23
+ const relevantPermissions = allPermissions.spendPermissions.filter(p => p.permission?.spender.toLowerCase() === spenderAddress.toLowerCase());
24
+ if (relevantPermissions.length === 0) {
25
+ return `No spend permissions found for spender ${spenderAddress} on smart account ${smartAccountAddress}`;
26
+ }
27
+ // Format the permissions for display
28
+ const formattedPermissions = relevantPermissions
29
+ .map((p, index) => {
30
+ const perm = p.permission;
31
+ if (!perm)
32
+ return `${index + 1}. Invalid permission`;
33
+ return `${index + 1}. Token: ${perm.token}, Allowance: ${perm.allowance}, Period: ${perm.period} seconds, Start: ${perm.start}, End: ${perm.end}`;
34
+ })
35
+ .join("\n");
36
+ return `Found ${relevantPermissions.length} spend permission(s):\n${formattedPermissions}`;
37
+ }
38
+ catch (error) {
39
+ return `Failed to list spend permissions: ${error}`;
40
+ }
41
+ }
42
+ /**
43
+ * Finds and retrieves the latest valid spend permission for a given spender from a smart account.
44
+ *
45
+ * @param cdpClient - The CDP client to use for API calls
46
+ * @param smartAccountAddress - The smart account address to check permissions for
47
+ * @param spenderAddress - The spender address to find permissions for
48
+ * @returns The latest spend permission or throws an error if none found
49
+ * @throws Error if no permissions found or permission is invalid
50
+ */
51
+ async function findLatestSpendPermission(cdpClient, smartAccountAddress, spenderAddress) {
52
+ const allPermissions = await cdpClient.evm.listSpendPermissions({
53
+ address: smartAccountAddress,
54
+ });
55
+ // Filter permissions where current wallet is the spender
56
+ const relevantPermissions = allPermissions.spendPermissions.filter(p => p.permission?.spender.toLowerCase() === spenderAddress.toLowerCase());
57
+ if (relevantPermissions.length === 0) {
58
+ throw new Error(`No spend permissions found for spender ${spenderAddress} on smart account ${smartAccountAddress}`);
59
+ }
60
+ // Use the latest permission (last in the array)
61
+ const latestPermissionWrapper = relevantPermissions.at(-1);
62
+ if (!latestPermissionWrapper?.permission) {
63
+ throw new Error("Invalid spend permission found");
64
+ }
65
+ return latestPermissionWrapper.permission;
66
+ }
@@ -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";
@@ -27,4 +28,6 @@ export * from "./flaunch";
27
28
  export * from "./onramp";
28
29
  export * from "./vaultsfyi";
29
30
  export * from "./x402";
31
+ export * from "./zerion";
30
32
  export * from "./zerodev";
33
+ 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);
@@ -43,4 +44,6 @@ __exportStar(require("./flaunch"), exports);
43
44
  __exportStar(require("./onramp"), exports);
44
45
  __exportStar(require("./vaultsfyi"), exports);
45
46
  __exportStar(require("./x402"), exports);
47
+ __exportStar(require("./zerion"), exports);
46
48
  __exportStar(require("./zerodev"), exports);
49
+ __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;