@coinbase/agentkit 0.8.2 → 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.
Files changed (103) hide show
  1. package/README.md +404 -235
  2. package/dist/action-providers/cdp/cdpApiActionProvider.d.ts +15 -15
  3. package/dist/action-providers/cdp/cdpApiActionProvider.js +110 -63
  4. package/dist/action-providers/cdp/cdpApiActionProvider.test.js +205 -124
  5. package/dist/action-providers/cdp/index.d.ts +0 -1
  6. package/dist/action-providers/cdp/index.js +0 -1
  7. package/dist/action-providers/cdp/schemas.d.ts +9 -70
  8. package/dist/action-providers/cdp/schemas.js +12 -61
  9. package/dist/action-providers/cdp-legacy/index.d.ts +3 -0
  10. package/dist/action-providers/cdp-legacy/index.js +19 -0
  11. package/dist/action-providers/cdp-legacy/legacyCdpApiActionProvider.d.ts +45 -0
  12. package/dist/action-providers/cdp-legacy/legacyCdpApiActionProvider.js +130 -0
  13. package/dist/action-providers/cdp-legacy/legacyCdpApiActionProvider.test.js +146 -0
  14. package/dist/action-providers/{cdp/cdpWalletActionProvider.d.ts → cdp-legacy/legacyCdpWalletActionProvider.d.ts} +8 -8
  15. package/dist/action-providers/{cdp/cdpWalletActionProvider.js → cdp-legacy/legacyCdpWalletActionProvider.js} +14 -14
  16. package/dist/action-providers/{cdp/cdpWalletActionProvider.test.js → cdp-legacy/legacyCdpWalletActionProvider.test.js} +3 -3
  17. package/dist/action-providers/cdp-legacy/schemas.d.ts +91 -0
  18. package/dist/action-providers/cdp-legacy/schemas.js +77 -0
  19. package/dist/action-providers/erc20/erc20ActionProvider.js +1 -1
  20. package/dist/action-providers/farcaster/farcasterActionProvider.js +2 -0
  21. package/dist/action-providers/farcaster/farcasterActionProvider.test.js +55 -0
  22. package/dist/action-providers/farcaster/schemas.d.ts +13 -0
  23. package/dist/action-providers/farcaster/schemas.js +6 -0
  24. package/dist/action-providers/index.d.ts +3 -1
  25. package/dist/action-providers/index.js +3 -1
  26. package/dist/action-providers/jupiter/jupiterActionProvider.test.js +2 -4
  27. package/dist/action-providers/truemarkets/constants.d.ts +179 -0
  28. package/dist/action-providers/truemarkets/constants.js +46 -0
  29. package/dist/action-providers/truemarkets/index.d.ts +1 -0
  30. package/dist/action-providers/truemarkets/index.js +17 -0
  31. package/dist/action-providers/truemarkets/schemas.d.ts +21 -0
  32. package/dist/action-providers/truemarkets/schemas.js +29 -0
  33. package/dist/action-providers/truemarkets/truemarketsActionProvider.d.ts +51 -0
  34. package/dist/action-providers/truemarkets/truemarketsActionProvider.js +469 -0
  35. package/dist/action-providers/truemarkets/truemarketsActionProvider.test.js +217 -0
  36. package/dist/action-providers/truemarkets/utils.d.ts +10 -0
  37. package/dist/action-providers/truemarkets/utils.js +9 -0
  38. package/dist/action-providers/twitter/schemas.d.ts +16 -0
  39. package/dist/action-providers/twitter/schemas.js +23 -1
  40. package/dist/action-providers/twitter/twitterActionProvider.d.ts +8 -1
  41. package/dist/action-providers/twitter/twitterActionProvider.js +56 -5
  42. package/dist/action-providers/twitter/twitterActionProvider.test.js +52 -2
  43. package/dist/action-providers/weth/constants.d.ts +9 -0
  44. package/dist/action-providers/weth/constants.js +12 -0
  45. package/dist/action-providers/weth/schemas.d.ts +7 -0
  46. package/dist/action-providers/weth/schemas.js +7 -1
  47. package/dist/action-providers/weth/wethActionProvider.d.ts +9 -1
  48. package/dist/action-providers/weth/wethActionProvider.js +50 -1
  49. package/dist/action-providers/weth/wethActionProvider.test.js +60 -0
  50. package/dist/action-providers/x402/schemas.d.ts +58 -11
  51. package/dist/action-providers/x402/schemas.js +60 -8
  52. package/dist/action-providers/x402/x402ActionProvider.d.ts +33 -16
  53. package/dist/action-providers/x402/x402ActionProvider.js +203 -153
  54. package/dist/action-providers/x402/x402ActionProvider.test.js +78 -225
  55. package/dist/action-providers/zora/index.d.ts +3 -0
  56. package/dist/action-providers/{cdp-v2 → zora}/index.js +2 -1
  57. package/dist/action-providers/zora/schemas.d.ts +29 -0
  58. package/dist/action-providers/zora/schemas.js +31 -0
  59. package/dist/action-providers/zora/utils.d.ts +28 -0
  60. package/dist/action-providers/zora/utils.js +200 -0
  61. package/dist/action-providers/zora/zoraActionProvider.d.ts +36 -0
  62. package/dist/action-providers/zora/zoraActionProvider.js +151 -0
  63. package/dist/action-providers/zora/zoraActionProvider.test.js +205 -0
  64. package/dist/agentkit.d.ts +1 -0
  65. package/dist/agentkit.js +3 -2
  66. package/dist/wallet-providers/{cdpV2EvmWalletProvider.d.ts → cdpEvmWalletProvider.d.ts} +16 -7
  67. package/dist/wallet-providers/{cdpV2EvmWalletProvider.js → cdpEvmWalletProvider.js} +50 -39
  68. package/dist/wallet-providers/{cdpV2EvmWalletProvider.test.js → cdpEvmWalletProvider.test.js} +7 -7
  69. package/dist/wallet-providers/{cdpV2Shared.d.ts → cdpShared.d.ts} +15 -4
  70. package/dist/wallet-providers/cdpSmartWalletProvider.d.ts +115 -0
  71. package/dist/wallet-providers/cdpSmartWalletProvider.js +263 -0
  72. package/dist/wallet-providers/cdpSmartWalletProvider.test.d.ts +1 -0
  73. package/dist/wallet-providers/cdpSmartWalletProvider.test.js +287 -0
  74. package/dist/wallet-providers/{cdpV2SolanaWalletProvider.d.ts → cdpSolanaWalletProvider.d.ts} +16 -7
  75. package/dist/wallet-providers/{cdpV2SolanaWalletProvider.js → cdpSolanaWalletProvider.js} +43 -32
  76. package/dist/wallet-providers/cdpSolanaWalletProvider.test.d.ts +1 -0
  77. package/dist/wallet-providers/{cdpV2SolanaWalletProvider.test.js → cdpSolanaWalletProvider.test.js} +7 -7
  78. package/dist/wallet-providers/index.d.ts +6 -6
  79. package/dist/wallet-providers/index.js +6 -6
  80. package/dist/wallet-providers/{smartWalletProvider.d.ts → legacyCdpSmartWalletProvider.d.ts} +3 -3
  81. package/dist/wallet-providers/{smartWalletProvider.js → legacyCdpSmartWalletProvider.js} +21 -21
  82. package/dist/wallet-providers/legacyCdpSmartWalletProvider.test.d.ts +1 -0
  83. package/dist/wallet-providers/{smartWalletProvider.test.js → legacyCdpSmartWalletProvider.test.js} +2 -2
  84. package/dist/wallet-providers/{cdpWalletProvider.d.ts → legacyCdpWalletProvider.d.ts} +15 -11
  85. package/dist/wallet-providers/{cdpWalletProvider.js → legacyCdpWalletProvider.js} +72 -70
  86. package/dist/wallet-providers/legacyCdpWalletProvider.test.d.ts +1 -0
  87. package/dist/wallet-providers/{cdpWalletProvider.test.js → legacyCdpWalletProvider.test.js} +10 -10
  88. package/package.json +4 -2
  89. package/dist/action-providers/cdp-v2/cdpApiV2ActionProvider.d.ts +0 -34
  90. package/dist/action-providers/cdp-v2/cdpApiV2ActionProvider.js +0 -98
  91. package/dist/action-providers/cdp-v2/index.d.ts +0 -2
  92. package/dist/action-providers/cdp-v2/schemas.d.ts +0 -11
  93. package/dist/action-providers/cdp-v2/schemas.js +0 -13
  94. package/dist/wallet-providers/cdpV2WalletProvider.d.ts +0 -35
  95. package/dist/wallet-providers/cdpV2WalletProvider.js +0 -42
  96. /package/dist/action-providers/{cdp → cdp-legacy}/constants.d.ts +0 -0
  97. /package/dist/action-providers/{cdp → cdp-legacy}/constants.js +0 -0
  98. /package/dist/action-providers/{cdp/cdpWalletActionProvider.test.d.ts → cdp-legacy/legacyCdpApiActionProvider.test.d.ts} +0 -0
  99. /package/dist/{wallet-providers/cdpV2EvmWalletProvider.test.d.ts → action-providers/cdp-legacy/legacyCdpWalletActionProvider.test.d.ts} +0 -0
  100. /package/dist/{wallet-providers/cdpV2SolanaWalletProvider.test.d.ts → action-providers/truemarkets/truemarketsActionProvider.test.d.ts} +0 -0
  101. /package/dist/{wallet-providers/cdpWalletProvider.test.d.ts → action-providers/zora/zoraActionProvider.test.d.ts} +0 -0
  102. /package/dist/wallet-providers/{smartWalletProvider.test.d.ts → cdpEvmWalletProvider.test.d.ts} +0 -0
  103. /package/dist/wallet-providers/{cdpV2Shared.js → cdpShared.js} +0 -0
@@ -9,7 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.cdpWalletActionProvider = exports.CdpWalletActionProvider = void 0;
12
+ exports.legacyCdpWalletActionProvider = exports.LegacyCdpWalletActionProvider = void 0;
13
13
  const coinbase_sdk_1 = require("@coinbase/coinbase-sdk");
14
14
  const zod_1 = require("zod");
15
15
  const package_json_1 = require("../../../package.json");
@@ -23,14 +23,14 @@ const schemas_1 = require("./schemas");
23
23
  *
24
24
  * This provider is used for any action that requires a CDP Wallet.
25
25
  */
26
- class CdpWalletActionProvider extends actionProvider_1.ActionProvider {
26
+ class LegacyCdpWalletActionProvider extends actionProvider_1.ActionProvider {
27
27
  /**
28
28
  * Constructor for the CdpWalletActionProvider class.
29
29
  *
30
30
  * @param config - The configuration options for the CdpWalletActionProvider.
31
31
  */
32
32
  constructor(config = {}) {
33
- super("cdp_wallet", []);
33
+ super("legacy_cdp_wallet", []);
34
34
  /**
35
35
  * Checks if the Cdp action provider supports the given network.
36
36
  *
@@ -154,7 +154,7 @@ class CdpWalletActionProvider extends actionProvider_1.ActionProvider {
154
154
  }
155
155
  }
156
156
  }
157
- exports.CdpWalletActionProvider = CdpWalletActionProvider;
157
+ exports.LegacyCdpWalletActionProvider = LegacyCdpWalletActionProvider;
158
158
  __decorate([
159
159
  (0, actionDecorator_1.CreateAction)({
160
160
  name: "deploy_contract",
@@ -176,9 +176,9 @@ map where the key is the arg name and the value is the arg value. Encode uint/in
176
176
  schema: schemas_1.DeployContractSchema,
177
177
  }),
178
178
  __metadata("design:type", Function),
179
- __metadata("design:paramtypes", [wallet_providers_1.CdpWalletProvider, void 0]),
179
+ __metadata("design:paramtypes", [wallet_providers_1.LegacyCdpWalletProvider, void 0]),
180
180
  __metadata("design:returntype", Promise)
181
- ], CdpWalletActionProvider.prototype, "deployContract", null);
181
+ ], LegacyCdpWalletActionProvider.prototype, "deployContract", null);
182
182
  __decorate([
183
183
  (0, actionDecorator_1.CreateAction)({
184
184
  name: "deploy_nft",
@@ -187,9 +187,9 @@ __decorate([
187
187
  schema: schemas_1.DeployNftSchema,
188
188
  }),
189
189
  __metadata("design:type", Function),
190
- __metadata("design:paramtypes", [wallet_providers_1.CdpWalletProvider, void 0]),
190
+ __metadata("design:paramtypes", [wallet_providers_1.LegacyCdpWalletProvider, void 0]),
191
191
  __metadata("design:returntype", Promise)
192
- ], CdpWalletActionProvider.prototype, "deployNFT", null);
192
+ ], LegacyCdpWalletActionProvider.prototype, "deployNFT", null);
193
193
  __decorate([
194
194
  (0, actionDecorator_1.CreateAction)({
195
195
  name: "deploy_token",
@@ -198,9 +198,9 @@ The token will be deployed using the wallet's default address as the owner and i
198
198
  schema: schemas_1.DeployTokenSchema,
199
199
  }),
200
200
  __metadata("design:type", Function),
201
- __metadata("design:paramtypes", [wallet_providers_1.CdpWalletProvider, void 0]),
201
+ __metadata("design:paramtypes", [wallet_providers_1.LegacyCdpWalletProvider, void 0]),
202
202
  __metadata("design:returntype", Promise)
203
- ], CdpWalletActionProvider.prototype, "deployToken", null);
203
+ ], LegacyCdpWalletActionProvider.prototype, "deployToken", null);
204
204
  __decorate([
205
205
  (0, actionDecorator_1.CreateAction)({
206
206
  name: "trade",
@@ -217,8 +217,8 @@ Important notes:
217
217
  schema: schemas_1.TradeSchema,
218
218
  }),
219
219
  __metadata("design:type", Function),
220
- __metadata("design:paramtypes", [wallet_providers_1.CdpWalletProvider, void 0]),
220
+ __metadata("design:paramtypes", [wallet_providers_1.LegacyCdpWalletProvider, void 0]),
221
221
  __metadata("design:returntype", Promise)
222
- ], CdpWalletActionProvider.prototype, "trade", null);
223
- const cdpWalletActionProvider = (config = {}) => new CdpWalletActionProvider(config);
224
- exports.cdpWalletActionProvider = cdpWalletActionProvider;
222
+ ], LegacyCdpWalletActionProvider.prototype, "trade", null);
223
+ const legacyCdpWalletActionProvider = (config = {}) => new LegacyCdpWalletActionProvider(config);
224
+ exports.legacyCdpWalletActionProvider = legacyCdpWalletActionProvider;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const cdpWalletActionProvider_1 = require("./cdpWalletActionProvider");
3
+ const legacyCdpWalletActionProvider_1 = require("./legacyCdpWalletActionProvider");
4
4
  const schemas_1 = require("./schemas");
5
5
  // Mock the entire module
6
6
  jest.mock("@coinbase/coinbase-sdk");
@@ -55,7 +55,7 @@ describe("CDP Wallet Action Provider Input Schemas", () => {
55
55
  });
56
56
  });
57
57
  });
58
- describe("CDP Wallet Action Provider", () => {
58
+ describe("Legacy CDP Wallet Action Provider", () => {
59
59
  let actionProvider;
60
60
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
61
61
  let mockExternalAddressInstance;
@@ -63,7 +63,7 @@ describe("CDP Wallet Action Provider", () => {
63
63
  beforeEach(() => {
64
64
  // Reset all mocks before each test
65
65
  jest.clearAllMocks();
66
- actionProvider = new cdpWalletActionProvider_1.CdpWalletActionProvider();
66
+ actionProvider = new legacyCdpWalletActionProvider_1.LegacyCdpWalletActionProvider();
67
67
  mockExternalAddressInstance = {
68
68
  reputation: jest.fn(),
69
69
  faucet: jest.fn(),
@@ -0,0 +1,91 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Input schema for address reputation check.
4
+ */
5
+ export declare const AddressReputationSchema: z.ZodObject<{
6
+ address: z.ZodString;
7
+ network: z.ZodString;
8
+ }, "strip", z.ZodTypeAny, {
9
+ address: string;
10
+ network: string;
11
+ }, {
12
+ address: string;
13
+ network: string;
14
+ }>;
15
+ /**
16
+ * Input schema for deploy contract action.
17
+ */
18
+ export declare const DeployContractSchema: z.ZodObject<{
19
+ solidityVersion: z.ZodEnum<[string, ...string[]]>;
20
+ solidityInputJson: z.ZodString;
21
+ contractName: z.ZodString;
22
+ constructorArgs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
23
+ }, "strip", z.ZodTypeAny, {
24
+ solidityVersion: string;
25
+ solidityInputJson: string;
26
+ contractName: string;
27
+ constructorArgs?: Record<string, any> | undefined;
28
+ }, {
29
+ solidityVersion: string;
30
+ solidityInputJson: string;
31
+ contractName: string;
32
+ constructorArgs?: Record<string, any> | undefined;
33
+ }>;
34
+ /**
35
+ * Input schema for deploy NFT action
36
+ */
37
+ export declare const DeployNftSchema: z.ZodObject<{
38
+ name: z.ZodString;
39
+ symbol: z.ZodString;
40
+ baseURI: z.ZodString;
41
+ }, "strip", z.ZodTypeAny, {
42
+ symbol: string;
43
+ name: string;
44
+ baseURI: string;
45
+ }, {
46
+ symbol: string;
47
+ name: string;
48
+ baseURI: string;
49
+ }>;
50
+ /**
51
+ * Input schema for deploy token action.
52
+ */
53
+ export declare const DeployTokenSchema: z.ZodObject<{
54
+ name: z.ZodString;
55
+ symbol: z.ZodString;
56
+ totalSupply: z.ZodType<bigint, z.ZodTypeDef, bigint>;
57
+ }, "strip", z.ZodTypeAny, {
58
+ symbol: string;
59
+ name: string;
60
+ totalSupply: bigint;
61
+ }, {
62
+ symbol: string;
63
+ name: string;
64
+ totalSupply: bigint;
65
+ }>;
66
+ /**
67
+ * Input schema for request faucet funds action.
68
+ */
69
+ export declare const RequestFaucetFundsSchema: z.ZodObject<{
70
+ assetId: z.ZodOptional<z.ZodString>;
71
+ }, "strip", z.ZodTypeAny, {
72
+ assetId?: string | undefined;
73
+ }, {
74
+ assetId?: string | undefined;
75
+ }>;
76
+ /**
77
+ * Input schema for trade action.
78
+ */
79
+ export declare const TradeSchema: z.ZodObject<{
80
+ amount: z.ZodType<bigint, z.ZodTypeDef, bigint>;
81
+ fromAssetId: z.ZodString;
82
+ toAssetId: z.ZodString;
83
+ }, "strip", z.ZodTypeAny, {
84
+ amount: bigint;
85
+ fromAssetId: string;
86
+ toAssetId: string;
87
+ }, {
88
+ amount: bigint;
89
+ fromAssetId: string;
90
+ toAssetId: string;
91
+ }>;
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TradeSchema = exports.RequestFaucetFundsSchema = exports.DeployTokenSchema = exports.DeployNftSchema = exports.DeployContractSchema = exports.AddressReputationSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const constants_1 = require("./constants");
6
+ /**
7
+ * Input schema for address reputation check.
8
+ */
9
+ exports.AddressReputationSchema = zod_1.z
10
+ .object({
11
+ address: zod_1.z
12
+ .string()
13
+ .regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format")
14
+ .describe("The Ethereum address to check"),
15
+ network: zod_1.z.string().describe("The network to check the address on"),
16
+ })
17
+ .strip()
18
+ .describe("Input schema for address reputation check");
19
+ /**
20
+ * Input schema for deploy contract action.
21
+ */
22
+ exports.DeployContractSchema = zod_1.z
23
+ .object({
24
+ solidityVersion: zod_1.z
25
+ .enum(Object.keys(constants_1.SolidityVersions))
26
+ .describe("The solidity compiler version"),
27
+ solidityInputJson: zod_1.z.string().describe("The input json for the solidity compiler"),
28
+ contractName: zod_1.z.string().describe("The name of the contract class to be deployed"),
29
+ constructorArgs: zod_1.z
30
+ .record(zod_1.z.string(), zod_1.z.any())
31
+ .describe("The constructor arguments for the contract")
32
+ .optional(),
33
+ })
34
+ .strip()
35
+ .describe("Instructions for deploying an arbitrary contract");
36
+ /**
37
+ * Input schema for deploy NFT action
38
+ */
39
+ exports.DeployNftSchema = zod_1.z
40
+ .object({
41
+ name: zod_1.z.string().describe("The name of the NFT collection"),
42
+ symbol: zod_1.z.string().describe("The symbol of the NFT collection"),
43
+ baseURI: zod_1.z.string().describe("The base URI for the token metadata"),
44
+ })
45
+ .strip()
46
+ .describe("Instructions for deploying an NFT collection");
47
+ /**
48
+ * Input schema for deploy token action.
49
+ */
50
+ exports.DeployTokenSchema = zod_1.z
51
+ .object({
52
+ name: zod_1.z.string().describe("The name of the token"),
53
+ symbol: zod_1.z.string().describe("The token symbol"),
54
+ totalSupply: zod_1.z.custom().describe("The total supply of tokens to mint"),
55
+ })
56
+ .strip()
57
+ .describe("Instructions for deploying a token");
58
+ /**
59
+ * Input schema for request faucet funds action.
60
+ */
61
+ exports.RequestFaucetFundsSchema = zod_1.z
62
+ .object({
63
+ assetId: zod_1.z.string().optional().describe("The optional asset ID to request from faucet"),
64
+ })
65
+ .strip()
66
+ .describe("Instructions for requesting faucet funds");
67
+ /**
68
+ * Input schema for trade action.
69
+ */
70
+ exports.TradeSchema = zod_1.z
71
+ .object({
72
+ amount: zod_1.z.custom().describe("The amount of the from asset to trade"),
73
+ fromAssetId: zod_1.z.string().describe("The from asset ID to trade"),
74
+ toAssetId: zod_1.z.string().describe("The to asset ID to receive from the trade"),
75
+ })
76
+ .strip()
77
+ .describe("Instructions for trading assets");
@@ -78,7 +78,7 @@ class ERC20ActionProvider extends actionProvider_1.ActionProvider {
78
78
  ((network.networkId === "base-mainnet" && constants_1.BaseTokenToAssetId.has(tokenAddress)) ||
79
79
  (network.networkId === "base-sepolia" && constants_1.BaseSepoliaTokenToAssetId.has(tokenAddress)));
80
80
  if (canDoGasless) {
81
- // Cast to CdpWalletProvider to access erc20Transfer
81
+ // Cast to LegacyCdpWalletProvider to access erc20Transfer
82
82
  const cdpWallet = walletProvider;
83
83
  const assetId = network.networkId === "base-mainnet"
84
84
  ? constants_1.BaseTokenToAssetId.get(tokenAddress)
@@ -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");
@@ -4,8 +4,8 @@ export * from "./customActionProvider";
4
4
  export * from "./across";
5
5
  export * from "./alchemy";
6
6
  export * from "./basename";
7
+ export * from "./cdp-legacy";
7
8
  export * from "./cdp";
8
- export * from "./cdp-v2";
9
9
  export * from "./compound";
10
10
  export * from "./defillama";
11
11
  export * from "./erc20";
@@ -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";
@@ -20,8 +20,8 @@ __exportStar(require("./customActionProvider"), exports);
20
20
  __exportStar(require("./across"), exports);
21
21
  __exportStar(require("./alchemy"), exports);
22
22
  __exportStar(require("./basename"), exports);
23
+ __exportStar(require("./cdp-legacy"), exports);
23
24
  __exportStar(require("./cdp"), exports);
24
- __exportStar(require("./cdp-v2"), exports);
25
25
  __exportStar(require("./compound"), exports);
26
26
  __exportStar(require("./defillama"), exports);
27
27
  __exportStar(require("./erc20"), exports);
@@ -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);
@@ -3,8 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const web3_js_1 = require("@solana/web3.js");
4
4
  const jupiterActionProvider_1 = require("./jupiterActionProvider");
5
5
  const api_1 = require("@jup-ag/api");
6
- // Default SPL token decimals for tests
7
- const DECIMALS = 6;
8
6
  // Mock the @solana/web3.js module
9
7
  jest.mock("@solana/web3.js", () => ({
10
8
  // Preserve the actual implementation of @solana/web3.js while overriding specific methods
@@ -28,7 +26,7 @@ jest.mock("@solana/spl-token", () => ({
28
26
  // Preserve the actual implementation of @solana/spl-token while overriding specific methods
29
27
  ...jest.requireActual("@solana/spl-token"),
30
28
  // Mock getMint to always return a fixed decimal value for tokens
31
- getMint: jest.fn().mockReturnValue({ decimals: DECIMALS }),
29
+ getMint: jest.fn().mockReturnValue({ decimals: 6 }),
32
30
  }));
33
31
  // Mock the @jup-ag/api module
34
32
  jest.mock("@jup-ag/api", () => ({
@@ -107,7 +105,7 @@ describe("JupiterActionProvider", () => {
107
105
  expect(mockQuoteGet).toHaveBeenCalledWith({
108
106
  inputMint: INPUT_MINT,
109
107
  outputMint: OUTPUT_MINT,
110
- amount: swapArgs.amount * 10 ** DECIMALS, // Ensure correct decimal conversion
108
+ amount: swapArgs.amount * 10 ** 6, // Ensure correct decimal conversion
111
109
  slippageBps: swapArgs.slippageBps,
112
110
  });
113
111
  expect(mockSwapPost).toHaveBeenCalled();
@@ -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
+ };