@coinbase/agentkit 0.1.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 (148) hide show
  1. package/README.md +305 -0
  2. package/dist/action-providers/actionDecorator.d.ts +69 -0
  3. package/dist/action-providers/actionDecorator.js +96 -0
  4. package/dist/action-providers/actionProvider.d.ts +48 -0
  5. package/dist/action-providers/actionProvider.js +62 -0
  6. package/dist/action-providers/basename/basenameActionProvider.d.ts +30 -0
  7. package/dist/action-providers/basename/basenameActionProvider.js +109 -0
  8. package/dist/action-providers/basename/basenameActionProvider.test.d.ts +1 -0
  9. package/dist/action-providers/basename/basenameActionProvider.test.js +146 -0
  10. package/dist/action-providers/basename/constants.d.ts +52 -0
  11. package/dist/action-providers/basename/constants.js +81 -0
  12. package/dist/action-providers/basename/index.d.ts +2 -0
  13. package/dist/action-providers/basename/index.js +18 -0
  14. package/dist/action-providers/basename/schemas.d.ts +14 -0
  15. package/dist/action-providers/basename/schemas.js +14 -0
  16. package/dist/action-providers/cdp/cdpApiActionProvider.d.ts +41 -0
  17. package/dist/action-providers/cdp/cdpApiActionProvider.js +111 -0
  18. package/dist/action-providers/cdp/cdpApiActionProvider.test.d.ts +1 -0
  19. package/dist/action-providers/cdp/cdpApiActionProvider.test.js +134 -0
  20. package/dist/action-providers/cdp/cdpWalletActionProvider.d.ts +58 -0
  21. package/dist/action-providers/cdp/cdpWalletActionProvider.js +218 -0
  22. package/dist/action-providers/cdp/cdpWalletActionProvider.test.d.ts +1 -0
  23. package/dist/action-providers/cdp/cdpWalletActionProvider.test.js +259 -0
  24. package/dist/action-providers/cdp/constants.d.ts +31 -0
  25. package/dist/action-providers/cdp/constants.js +34 -0
  26. package/dist/action-providers/cdp/index.d.ts +3 -0
  27. package/dist/action-providers/cdp/index.js +19 -0
  28. package/dist/action-providers/cdp/schemas.d.ts +91 -0
  29. package/dist/action-providers/cdp/schemas.js +77 -0
  30. package/dist/action-providers/customActionProvider.d.ts +30 -0
  31. package/dist/action-providers/customActionProvider.js +66 -0
  32. package/dist/action-providers/erc20/constants.d.ts +135 -0
  33. package/dist/action-providers/erc20/constants.js +191 -0
  34. package/dist/action-providers/erc20/erc20ActionProvider.d.ts +38 -0
  35. package/dist/action-providers/erc20/erc20ActionProvider.js +118 -0
  36. package/dist/action-providers/erc20/erc20ActionProvider.test.d.ts +1 -0
  37. package/dist/action-providers/erc20/erc20ActionProvider.test.js +117 -0
  38. package/dist/action-providers/erc20/index.d.ts +1 -0
  39. package/dist/action-providers/erc20/index.js +17 -0
  40. package/dist/action-providers/erc20/schemas.d.ts +27 -0
  41. package/dist/action-providers/erc20/schemas.js +26 -0
  42. package/dist/action-providers/erc721/constants.d.ts +236 -0
  43. package/dist/action-providers/erc721/constants.js +301 -0
  44. package/dist/action-providers/erc721/erc721ActionProvider.d.ts +46 -0
  45. package/dist/action-providers/erc721/erc721ActionProvider.js +164 -0
  46. package/dist/action-providers/erc721/erc721ActionProvider.test.d.ts +1 -0
  47. package/dist/action-providers/erc721/erc721ActionProvider.test.js +137 -0
  48. package/dist/action-providers/erc721/index.d.ts +1 -0
  49. package/dist/action-providers/erc721/index.js +17 -0
  50. package/dist/action-providers/erc721/schemas.d.ts +46 -0
  51. package/dist/action-providers/erc721/schemas.js +44 -0
  52. package/dist/action-providers/farcaster/farcasterActionProvider.d.ts +57 -0
  53. package/dist/action-providers/farcaster/farcasterActionProvider.js +142 -0
  54. package/dist/action-providers/farcaster/farcasterActionProvider.test.d.ts +1 -0
  55. package/dist/action-providers/farcaster/farcasterActionProvider.test.js +143 -0
  56. package/dist/action-providers/farcaster/index.d.ts +2 -0
  57. package/dist/action-providers/farcaster/index.js +18 -0
  58. package/dist/action-providers/farcaster/schemas.d.ts +15 -0
  59. package/dist/action-providers/farcaster/schemas.js +20 -0
  60. package/dist/action-providers/index.d.ts +13 -0
  61. package/dist/action-providers/index.js +29 -0
  62. package/dist/action-providers/morpho/constants.d.ts +16 -0
  63. package/dist/action-providers/morpho/constants.js +27 -0
  64. package/dist/action-providers/morpho/index.d.ts +2 -0
  65. package/dist/action-providers/morpho/index.js +18 -0
  66. package/dist/action-providers/morpho/morphoActionProvider.d.ts +39 -0
  67. package/dist/action-providers/morpho/morphoActionProvider.js +147 -0
  68. package/dist/action-providers/morpho/morphoActionProvider.test.d.ts +1 -0
  69. package/dist/action-providers/morpho/morphoActionProvider.test.js +126 -0
  70. package/dist/action-providers/morpho/schemas.d.ts +36 -0
  71. package/dist/action-providers/morpho/schemas.js +47 -0
  72. package/dist/action-providers/pyth/index.d.ts +2 -0
  73. package/dist/action-providers/pyth/index.js +18 -0
  74. package/dist/action-providers/pyth/pythActionProvider.d.ts +33 -0
  75. package/dist/action-providers/pyth/pythActionProvider.js +121 -0
  76. package/dist/action-providers/pyth/schemas.d.ts +21 -0
  77. package/dist/action-providers/pyth/schemas.js +20 -0
  78. package/dist/action-providers/twitter/index.d.ts +2 -0
  79. package/dist/action-providers/twitter/index.js +18 -0
  80. package/dist/action-providers/twitter/schemas.d.ts +38 -0
  81. package/dist/action-providers/twitter/schemas.js +44 -0
  82. package/dist/action-providers/twitter/twitterActionProvider.d.ts +82 -0
  83. package/dist/action-providers/twitter/twitterActionProvider.js +204 -0
  84. package/dist/action-providers/twitter/twitterActionProvider.test.d.ts +1 -0
  85. package/dist/action-providers/twitter/twitterActionProvider.test.js +185 -0
  86. package/dist/action-providers/wallet/index.d.ts +1 -0
  87. package/dist/action-providers/wallet/index.js +17 -0
  88. package/dist/action-providers/wallet/schemas.d.ts +19 -0
  89. package/dist/action-providers/wallet/schemas.js +19 -0
  90. package/dist/action-providers/wallet/walletActionProvider.d.ts +44 -0
  91. package/dist/action-providers/wallet/walletActionProvider.js +127 -0
  92. package/dist/action-providers/wallet/walletActionProvider.test.d.ts +1 -0
  93. package/dist/action-providers/wallet/walletActionProvider.test.js +116 -0
  94. package/dist/action-providers/weth/constants.d.ts +19 -0
  95. package/dist/action-providers/weth/constants.js +29 -0
  96. package/dist/action-providers/weth/index.d.ts +1 -0
  97. package/dist/action-providers/weth/index.js +17 -0
  98. package/dist/action-providers/weth/schemas.d.ts +8 -0
  99. package/dist/action-providers/weth/schemas.js +10 -0
  100. package/dist/action-providers/weth/wethActionProvider.d.ts +30 -0
  101. package/dist/action-providers/weth/wethActionProvider.js +89 -0
  102. package/dist/action-providers/weth/wethActionProvider.test.d.ts +1 -0
  103. package/dist/action-providers/weth/wethActionProvider.test.js +92 -0
  104. package/dist/action-providers/wow/constants.d.ts +15 -0
  105. package/dist/action-providers/wow/constants.js +844 -0
  106. package/dist/action-providers/wow/index.d.ts +2 -0
  107. package/dist/action-providers/wow/index.js +18 -0
  108. package/dist/action-providers/wow/schemas.d.ts +43 -0
  109. package/dist/action-providers/wow/schemas.js +47 -0
  110. package/dist/action-providers/wow/uniswap/constants.d.ts +3 -0
  111. package/dist/action-providers/wow/uniswap/constants.js +100 -0
  112. package/dist/action-providers/wow/uniswap/utils.d.ts +82 -0
  113. package/dist/action-providers/wow/uniswap/utils.js +226 -0
  114. package/dist/action-providers/wow/utils.d.ts +27 -0
  115. package/dist/action-providers/wow/utils.js +63 -0
  116. package/dist/action-providers/wow/wowActionProvider.d.ts +46 -0
  117. package/dist/action-providers/wow/wowActionProvider.js +223 -0
  118. package/dist/action-providers/wow/wowActionProvider.test.d.ts +1 -0
  119. package/dist/action-providers/wow/wowActionProvider.test.js +287 -0
  120. package/dist/agentkit.d.ts +45 -0
  121. package/dist/agentkit.js +60 -0
  122. package/dist/analytics/index.d.ts +1 -0
  123. package/dist/analytics/index.js +17 -0
  124. package/dist/analytics/sendAnalyticsEvent.d.ts +31 -0
  125. package/dist/analytics/sendAnalyticsEvent.js +51 -0
  126. package/dist/index.d.ts +3 -0
  127. package/dist/index.js +22 -0
  128. package/dist/network/index.d.ts +1 -0
  129. package/dist/network/index.js +17 -0
  130. package/dist/network/network.d.ts +13 -0
  131. package/dist/network/network.js +41 -0
  132. package/dist/network/types.d.ts +17 -0
  133. package/dist/network/types.js +2 -0
  134. package/dist/utils.d.ts +11 -0
  135. package/dist/utils.js +43 -0
  136. package/dist/utils.test.d.ts +1 -0
  137. package/dist/utils.test.js +50 -0
  138. package/dist/wallet-providers/cdpWalletProvider.d.ts +218 -0
  139. package/dist/wallet-providers/cdpWalletProvider.js +362 -0
  140. package/dist/wallet-providers/evmWalletProvider.d.ts +51 -0
  141. package/dist/wallet-providers/evmWalletProvider.js +14 -0
  142. package/dist/wallet-providers/index.d.ts +4 -0
  143. package/dist/wallet-providers/index.js +20 -0
  144. package/dist/wallet-providers/viemWalletProvider.d.ts +89 -0
  145. package/dist/wallet-providers/viemWalletProvider.js +187 -0
  146. package/dist/wallet-providers/walletProvider.d.ts +48 -0
  147. package/dist/wallet-providers/walletProvider.js +41 -0
  148. package/package.json +65 -0
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.sendAnalyticsEvent = sendAnalyticsEvent;
7
+ const md5_1 = __importDefault(require("md5"));
8
+ /**
9
+ * Sends an analytics event to the default endpoint
10
+ *
11
+ * @param event - The event data containing required action, component and name fields
12
+ * @returns Promise that resolves when the event is sent
13
+ */
14
+ async function sendAnalyticsEvent(event) {
15
+ const timestamp = event.timestamp || Date.now();
16
+ // Prepare the event with required fields
17
+ const enhancedEvent = {
18
+ event_type: event.name,
19
+ platform: "server",
20
+ event_properties: {
21
+ component_type: event.component,
22
+ platform: "server",
23
+ project_name: "agentkit",
24
+ time_start: timestamp,
25
+ ...event,
26
+ },
27
+ };
28
+ const events = [enhancedEvent];
29
+ const stringifiedEventData = JSON.stringify(events);
30
+ const uploadTime = timestamp.toString();
31
+ // Calculate checksum inline
32
+ const checksum = (0, md5_1.default)(stringifiedEventData + uploadTime);
33
+ const analyticsServiceData = {
34
+ e: stringifiedEventData,
35
+ checksum,
36
+ };
37
+ const apiEndpoint = "https://cca-lite.coinbase.com";
38
+ const eventPath = "/amp";
39
+ const eventEndPoint = `${apiEndpoint}${eventPath}`;
40
+ const response = await fetch(eventEndPoint, {
41
+ method: "POST",
42
+ mode: "no-cors",
43
+ headers: {
44
+ "Content-Type": "application/json",
45
+ },
46
+ body: JSON.stringify(analyticsServiceData),
47
+ });
48
+ if (!response.ok) {
49
+ throw new Error(`HTTP error! status: ${response.status}`);
50
+ }
51
+ }
@@ -0,0 +1,3 @@
1
+ export { AgentKit } from "./agentkit";
2
+ export * from "./wallet-providers";
3
+ export * from "./action-providers";
package/dist/index.js ADDED
@@ -0,0 +1,22 @@
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
+ exports.AgentKit = void 0;
18
+ // Export CDP AgentKit
19
+ var agentkit_1 = require("./agentkit");
20
+ Object.defineProperty(exports, "AgentKit", { enumerable: true, get: function () { return agentkit_1.AgentKit; } });
21
+ __exportStar(require("./wallet-providers"), exports);
22
+ __exportStar(require("./action-providers"), exports);
@@ -0,0 +1 @@
1
+ export * from "./types";
@@ -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("./types"), exports);
@@ -0,0 +1,13 @@
1
+ import { Chain } from "viem/chains";
2
+ /**
3
+ * Maps EVM chain IDs to Coinbase network IDs
4
+ */
5
+ export declare const CHAIN_ID_TO_NETWORK_ID: Record<number, string>;
6
+ /**
7
+ * Maps Coinbase network IDs to EVM chain IDs
8
+ */
9
+ export declare const NETWORK_ID_TO_CHAIN_ID: Record<string, string>;
10
+ /**
11
+ * Maps Coinbase network IDs to Viem chain objects
12
+ */
13
+ export declare const NETWORK_ID_TO_VIEM_CHAIN: Record<string, Chain>;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NETWORK_ID_TO_VIEM_CHAIN = exports.NETWORK_ID_TO_CHAIN_ID = exports.CHAIN_ID_TO_NETWORK_ID = void 0;
4
+ const chains_1 = require("viem/chains");
5
+ /**
6
+ * Maps EVM chain IDs to Coinbase network IDs
7
+ */
8
+ exports.CHAIN_ID_TO_NETWORK_ID = {
9
+ 1: "ethereum-mainnet",
10
+ 11155111: "ethereum-sepolia",
11
+ 137: "polygon-mainnet",
12
+ 80001: "polygon-mumbai",
13
+ 8453: "base-mainnet",
14
+ 84532: "base-sepolia",
15
+ 42161: "arbitrum-mainnet",
16
+ 421614: "arbitrum-sepolia",
17
+ 10: "optimism-mainnet",
18
+ 11155420: "optimism-sepolia",
19
+ };
20
+ /**
21
+ * Maps Coinbase network IDs to EVM chain IDs
22
+ */
23
+ exports.NETWORK_ID_TO_CHAIN_ID = Object.entries(exports.CHAIN_ID_TO_NETWORK_ID).reduce((acc, [chainId, networkId]) => {
24
+ acc[networkId] = String(chainId);
25
+ return acc;
26
+ }, {});
27
+ /**
28
+ * Maps Coinbase network IDs to Viem chain objects
29
+ */
30
+ exports.NETWORK_ID_TO_VIEM_CHAIN = {
31
+ "ethereum-mainnet": chains_1.mainnet,
32
+ "ethereum-sepolia": chains_1.sepolia,
33
+ "polygon-mainnet": chains_1.polygon,
34
+ "polygon-mumbai": chains_1.polygonMumbai,
35
+ "base-mainnet": chains_1.base,
36
+ "base-sepolia": chains_1.baseSepolia,
37
+ "arbitrum-mainnet": chains_1.arbitrum,
38
+ "arbitrum-sepolia": chains_1.arbitrumSepolia,
39
+ "optimism-mainnet": chains_1.optimism,
40
+ "optimism-sepolia": chains_1.optimismSepolia,
41
+ };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Network is the network that the wallet provider is connected to.
3
+ */
4
+ export interface Network {
5
+ /**
6
+ * The protocol family of the network.
7
+ */
8
+ protocolFamily: string;
9
+ /**
10
+ * The network ID of the network.
11
+ */
12
+ networkId?: string;
13
+ /**
14
+ * The chain ID of the network.
15
+ */
16
+ chainId?: string;
17
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ import { EvmWalletProvider } from "./wallet-providers";
2
+ /**
3
+ * Approves a spender to spend tokens on behalf of the owner
4
+ *
5
+ * @param wallet - The wallet provider
6
+ * @param tokenAddress - The address of the token contract
7
+ * @param spenderAddress - The address of the spender
8
+ * @param amount - The amount to approve in atomic units (wei)
9
+ * @returns A success message or error message
10
+ */
11
+ export declare function approve(wallet: EvmWalletProvider, tokenAddress: string, spenderAddress: string, amount: bigint): Promise<string>;
package/dist/utils.js ADDED
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.approve = approve;
4
+ const viem_1 = require("viem");
5
+ const ERC20_ABI = [
6
+ {
7
+ inputs: [
8
+ { name: "spender", type: "address" },
9
+ { name: "amount", type: "uint256" },
10
+ ],
11
+ name: "approve",
12
+ outputs: [{ name: "", type: "bool" }],
13
+ stateMutability: "nonpayable",
14
+ type: "function",
15
+ },
16
+ ];
17
+ /**
18
+ * Approves a spender to spend tokens on behalf of the owner
19
+ *
20
+ * @param wallet - The wallet provider
21
+ * @param tokenAddress - The address of the token contract
22
+ * @param spenderAddress - The address of the spender
23
+ * @param amount - The amount to approve in atomic units (wei)
24
+ * @returns A success message or error message
25
+ */
26
+ async function approve(wallet, tokenAddress, spenderAddress, amount) {
27
+ try {
28
+ const data = (0, viem_1.encodeFunctionData)({
29
+ abi: ERC20_ABI,
30
+ functionName: "approve",
31
+ args: [spenderAddress, amount],
32
+ });
33
+ const txHash = await wallet.sendTransaction({
34
+ to: tokenAddress,
35
+ data,
36
+ });
37
+ await wallet.waitForTransactionReceipt(txHash);
38
+ return `Successfully approved ${spenderAddress} to spend ${amount} tokens`;
39
+ }
40
+ catch (error) {
41
+ return `Error approving tokens: ${error}`;
42
+ }
43
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const viem_1 = require("viem");
4
+ const utils_1 = require("./utils");
5
+ const MOCK_TOKEN_ADDRESS = "0x1234567890123456789012345678901234567890";
6
+ const MOCK_SPENDER_ADDRESS = "0x9876543210987654321098765432109876543210";
7
+ const MOCK_AMOUNT = BigInt("1000000000000000000");
8
+ const MOCK_TX_HASH = "0xabcdef1234567890";
9
+ const MOCK_RECEIPT = { status: 1, blockNumber: 1234567 };
10
+ describe("utils", () => {
11
+ describe("approve", () => {
12
+ let mockWallet;
13
+ beforeEach(() => {
14
+ mockWallet = {
15
+ sendTransaction: jest.fn().mockResolvedValue(MOCK_TX_HASH),
16
+ waitForTransactionReceipt: jest.fn().mockResolvedValue(MOCK_RECEIPT),
17
+ };
18
+ });
19
+ it("should successfully approve tokens", async () => {
20
+ const response = await (0, utils_1.approve)(mockWallet, MOCK_TOKEN_ADDRESS, MOCK_SPENDER_ADDRESS, MOCK_AMOUNT);
21
+ expect(mockWallet.sendTransaction).toHaveBeenCalledWith({
22
+ to: MOCK_TOKEN_ADDRESS,
23
+ data: (0, viem_1.encodeFunctionData)({
24
+ abi: [
25
+ {
26
+ inputs: [
27
+ { name: "spender", type: "address" },
28
+ { name: "amount", type: "uint256" },
29
+ ],
30
+ name: "approve",
31
+ outputs: [{ name: "", type: "bool" }],
32
+ stateMutability: "nonpayable",
33
+ type: "function",
34
+ },
35
+ ],
36
+ functionName: "approve",
37
+ args: [MOCK_SPENDER_ADDRESS, MOCK_AMOUNT],
38
+ }),
39
+ });
40
+ expect(mockWallet.waitForTransactionReceipt).toHaveBeenCalledWith(MOCK_TX_HASH);
41
+ expect(response).toBe(`Successfully approved ${MOCK_SPENDER_ADDRESS} to spend ${MOCK_AMOUNT} tokens`);
42
+ });
43
+ it("should handle approval errors", async () => {
44
+ const error = new Error("Failed to approve");
45
+ mockWallet.sendTransaction.mockRejectedValue(error);
46
+ const response = await (0, utils_1.approve)(mockWallet, MOCK_TOKEN_ADDRESS, MOCK_SPENDER_ADDRESS, MOCK_AMOUNT);
47
+ expect(response).toBe(`Error approving tokens: ${error}`);
48
+ });
49
+ });
50
+ });
@@ -0,0 +1,218 @@
1
+ import { ReadContractParameters, ReadContractReturnType, TransactionRequest, TransactionSerializable } from "viem";
2
+ import { EvmWalletProvider } from "./evmWalletProvider";
3
+ import { Network } from "../network";
4
+ import { CreateERC20Options, CreateTradeOptions, SmartContract, Trade, Wallet, WalletData } from "@coinbase/coinbase-sdk";
5
+ /**
6
+ * Configuration options for the CDP Providers.
7
+ */
8
+ export interface CdpProviderConfig {
9
+ /**
10
+ * The CDP API Key Name.
11
+ */
12
+ apiKeyName?: string;
13
+ /**
14
+ * The CDP API Key Private Key.
15
+ */
16
+ apiKeyPrivateKey?: string;
17
+ }
18
+ /**
19
+ * Configuration options for the CdpActionProvider.
20
+ */
21
+ export interface CdpWalletProviderConfig extends CdpProviderConfig {
22
+ /**
23
+ * The CDP Wallet.
24
+ */
25
+ wallet?: Wallet;
26
+ /**
27
+ * The address of the wallet.
28
+ */
29
+ address?: string;
30
+ /**
31
+ * The network of the wallet.
32
+ */
33
+ network?: Network;
34
+ /**
35
+ * The network ID of the wallet.
36
+ */
37
+ networkId?: string;
38
+ }
39
+ /**
40
+ * Configuration options for the CDP Agentkit with a Wallet.
41
+ */
42
+ interface ConfigureCdpAgentkitWithWalletOptions extends CdpWalletProviderConfig {
43
+ /**
44
+ * The data of the CDP Wallet as a JSON string.
45
+ */
46
+ cdpWalletData?: string;
47
+ /**
48
+ * The mnemonic phrase of the wallet.
49
+ */
50
+ mnemonicPhrase?: string;
51
+ }
52
+ /**
53
+ * A wallet provider that uses the Coinbase SDK.
54
+ */
55
+ export declare class CdpWalletProvider extends EvmWalletProvider {
56
+ #private;
57
+ /**
58
+ * Constructs a new CdpWalletProvider.
59
+ *
60
+ * @param config - The configuration options for the CdpWalletProvider.
61
+ */
62
+ private constructor();
63
+ /**
64
+ * Configures a new CdpWalletProvider with a wallet.
65
+ *
66
+ * @param config - Optional configuration parameters
67
+ * @returns A Promise that resolves to a new CdpWalletProvider instance
68
+ * @throws Error if required environment variables are missing or wallet initialization fails
69
+ */
70
+ static configureWithWallet(config?: ConfigureCdpAgentkitWithWalletOptions): Promise<CdpWalletProvider>;
71
+ /**
72
+ * Signs a message.
73
+ *
74
+ * @param message - The message to sign.
75
+ * @returns The signed message.
76
+ */
77
+ signMessage(message: string): Promise<`0x${string}`>;
78
+ /**
79
+ * Signs a typed data object.
80
+ *
81
+ * @param typedData - The typed data object to sign.
82
+ * @returns The signed typed data object.
83
+ */
84
+ signTypedData(typedData: any): Promise<`0x${string}`>;
85
+ /**
86
+ * Signs a transaction.
87
+ *
88
+ * @param transaction - The transaction to sign.
89
+ * @returns The signed transaction.
90
+ */
91
+ signTransaction(transaction: TransactionRequest): Promise<`0x${string}`>;
92
+ /**
93
+ * Sends a transaction.
94
+ *
95
+ * @param transaction - The transaction to send.
96
+ * @returns The hash of the transaction.
97
+ */
98
+ sendTransaction(transaction: TransactionRequest): Promise<`0x${string}`>;
99
+ /**
100
+ * Prepares a transaction.
101
+ *
102
+ * @param to - The address to send the transaction to.
103
+ * @param value - The value of the transaction.
104
+ * @param data - The data of the transaction.
105
+ * @returns The prepared transaction.
106
+ */
107
+ prepareTransaction(to: `0x${string}`, value: bigint, data: `0x${string}`): Promise<TransactionSerializable>;
108
+ /**
109
+ * Adds signature to a transaction and serializes it for broadcast.
110
+ *
111
+ * @param transaction - The transaction to sign.
112
+ * @param signature - The signature to add to the transaction.
113
+ * @returns A serialized transaction.
114
+ */
115
+ addSignatureAndSerialize(transaction: TransactionSerializable, signature: `0x${string}`): Promise<string>;
116
+ /**
117
+ * Gets the address of the wallet.
118
+ *
119
+ * @returns The address of the wallet.
120
+ */
121
+ getAddress(): string;
122
+ /**
123
+ * Gets the network of the wallet.
124
+ *
125
+ * @returns The network of the wallet.
126
+ */
127
+ getNetwork(): Network;
128
+ /**
129
+ * Gets the name of the wallet provider.
130
+ *
131
+ * @returns The name of the wallet provider.
132
+ */
133
+ getName(): string;
134
+ /**
135
+ * Gets the balance of the wallet.
136
+ *
137
+ * @returns The balance of the wallet in wei
138
+ */
139
+ getBalance(): Promise<bigint>;
140
+ /**
141
+ * Waits for a transaction receipt.
142
+ *
143
+ * @param txHash - The hash of the transaction to wait for.
144
+ * @returns The transaction receipt.
145
+ */
146
+ waitForTransactionReceipt(txHash: `0x${string}`): Promise<any>;
147
+ /**
148
+ * Reads a contract.
149
+ *
150
+ * @param params - The parameters to read the contract.
151
+ * @returns The response from the contract.
152
+ */
153
+ readContract(params: ReadContractParameters): Promise<ReadContractReturnType>;
154
+ /**
155
+ * Creates a trade.
156
+ *
157
+ * @param options - The options for the trade.
158
+ * @returns The trade.
159
+ */
160
+ createTrade(options: CreateTradeOptions): Promise<Trade>;
161
+ /**
162
+ * Deploys a token.
163
+ *
164
+ * @param options - The options for the token deployment.
165
+ * @returns The deployed token.
166
+ */
167
+ deployToken(options: CreateERC20Options): Promise<SmartContract>;
168
+ /**
169
+ * Deploys a contract.
170
+ *
171
+ * @param options - The options for contract deployment
172
+ * @param options.solidityVersion - The version of the Solidity compiler to use (e.g. "0.8.0+commit.c7dfd78e")
173
+ * @param options.solidityInputJson - The JSON input for the Solidity compiler containing contract source and settings
174
+ * @param options.contractName - The name of the contract to deploy
175
+ * @param options.constructorArgs - Key-value map of constructor args
176
+ *
177
+ * @returns A Promise that resolves to the deployed contract instance
178
+ * @throws Error if wallet is not initialized
179
+ */
180
+ deployContract(options: {
181
+ solidityVersion: string;
182
+ solidityInputJson: string;
183
+ contractName: string;
184
+ constructorArgs: Record<string, unknown>;
185
+ }): Promise<SmartContract>;
186
+ /**
187
+ * Deploys a new NFT (ERC-721) smart contract.
188
+ *
189
+ * @param options - Configuration options for the NFT contract deployment
190
+ * @param options.name - The name of the collection
191
+ * @param options.symbol - The token symbol for the collection
192
+ * @param options.baseURI - The base URI for token metadata.
193
+ *
194
+ * @returns A Promise that resolves to the deployed SmartContract instance
195
+ * @throws Error if the wallet is not properly initialized
196
+ * @throws Error if the deployment fails for any reason (network issues, insufficient funds, etc.)
197
+ */
198
+ deployNFT(options: {
199
+ name: string;
200
+ symbol: string;
201
+ baseURI: string;
202
+ }): Promise<SmartContract>;
203
+ /**
204
+ * Transfer the native asset of the network.
205
+ *
206
+ * @param to - The destination address.
207
+ * @param value - The amount to transfer in Wei.
208
+ * @returns The transaction hash.
209
+ */
210
+ nativeTransfer(to: `0x${string}`, value: string): Promise<`0x${string}`>;
211
+ /**
212
+ * Exports the wallet.
213
+ *
214
+ * @returns The wallet's data.
215
+ */
216
+ exportWallet(): Promise<WalletData>;
217
+ }
218
+ export {};