@coinbase/agentkit 0.6.1 → 0.7.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 (62) hide show
  1. package/README.md +234 -0
  2. package/dist/action-providers/cdp-v2/cdpApiV2ActionProvider.d.ts +37 -0
  3. package/dist/action-providers/cdp-v2/cdpApiV2ActionProvider.js +91 -0
  4. package/dist/action-providers/cdp-v2/index.d.ts +2 -0
  5. package/dist/action-providers/cdp-v2/index.js +18 -0
  6. package/dist/action-providers/cdp-v2/schemas.d.ts +11 -0
  7. package/dist/action-providers/cdp-v2/schemas.js +13 -0
  8. package/dist/action-providers/compound/schemas.d.ts +8 -8
  9. package/dist/action-providers/index.d.ts +3 -0
  10. package/dist/action-providers/index.js +3 -0
  11. package/dist/action-providers/vaultsfyi/api/actions.d.ts +41 -0
  12. package/dist/action-providers/vaultsfyi/api/actions.js +28 -0
  13. package/dist/action-providers/vaultsfyi/api/types.d.ts +34 -0
  14. package/dist/action-providers/vaultsfyi/api/types.js +2 -0
  15. package/dist/action-providers/vaultsfyi/api/vaults.d.ts +38 -0
  16. package/dist/action-providers/vaultsfyi/api/vaults.js +39 -0
  17. package/dist/action-providers/vaultsfyi/constants.d.ts +12 -0
  18. package/dist/action-providers/vaultsfyi/constants.js +15 -0
  19. package/dist/action-providers/vaultsfyi/index.d.ts +7 -0
  20. package/dist/action-providers/vaultsfyi/index.js +23 -0
  21. package/dist/action-providers/vaultsfyi/schemas.d.ts +94 -0
  22. package/dist/action-providers/vaultsfyi/schemas.js +49 -0
  23. package/dist/action-providers/vaultsfyi/utils.d.ts +34 -0
  24. package/dist/action-providers/vaultsfyi/utils.js +69 -0
  25. package/dist/action-providers/vaultsfyi/vaultsfyiActionProvider.d.ts +98 -0
  26. package/dist/action-providers/vaultsfyi/vaultsfyiActionProvider.js +383 -0
  27. package/dist/action-providers/vaultsfyi/vaultsfyiActionProvider.test.d.ts +1 -0
  28. package/dist/action-providers/vaultsfyi/vaultsfyiActionProvider.test.js +438 -0
  29. package/dist/action-providers/zerodev/index.d.ts +1 -0
  30. package/dist/action-providers/zerodev/index.js +17 -0
  31. package/dist/action-providers/zerodev/schemas.d.ts +29 -0
  32. package/dist/action-providers/zerodev/schemas.js +21 -0
  33. package/dist/action-providers/zerodev/zeroDevWalletActionProvider.d.ts +32 -0
  34. package/dist/action-providers/zerodev/zeroDevWalletActionProvider.js +66 -0
  35. package/dist/action-providers/zerodev/zeroDevWalletActionProvider.test.d.ts +1 -0
  36. package/dist/action-providers/zerodev/zeroDevWalletActionProvider.test.js +112 -0
  37. package/dist/network/svm.d.ts +1 -0
  38. package/dist/network/svm.js +6 -1
  39. package/dist/wallet-providers/cdpV2EvmWalletProvider.d.ts +105 -0
  40. package/dist/wallet-providers/cdpV2EvmWalletProvider.js +212 -0
  41. package/dist/wallet-providers/cdpV2EvmWalletProvider.test.d.ts +1 -0
  42. package/dist/wallet-providers/cdpV2EvmWalletProvider.test.js +343 -0
  43. package/dist/wallet-providers/cdpV2Shared.d.ts +41 -0
  44. package/dist/wallet-providers/cdpV2Shared.js +2 -0
  45. package/dist/wallet-providers/cdpV2SolanaWalletProvider.d.ts +111 -0
  46. package/dist/wallet-providers/cdpV2SolanaWalletProvider.js +247 -0
  47. package/dist/wallet-providers/cdpV2SolanaWalletProvider.test.d.ts +1 -0
  48. package/dist/wallet-providers/cdpV2SolanaWalletProvider.test.js +307 -0
  49. package/dist/wallet-providers/cdpV2WalletProvider.d.ts +35 -0
  50. package/dist/wallet-providers/cdpV2WalletProvider.js +42 -0
  51. package/dist/wallet-providers/cdpWalletProvider.js +1 -1
  52. package/dist/wallet-providers/cdpWalletProvider.test.js +1 -0
  53. package/dist/wallet-providers/evmWalletProvider.d.ts +7 -1
  54. package/dist/wallet-providers/evmWalletProvider.js +20 -0
  55. package/dist/wallet-providers/index.d.ts +5 -0
  56. package/dist/wallet-providers/index.js +5 -0
  57. package/dist/wallet-providers/walletProvider.test.js +22 -0
  58. package/dist/wallet-providers/zeroDevWalletProvider.d.ts +147 -0
  59. package/dist/wallet-providers/zeroDevWalletProvider.js +301 -0
  60. package/dist/wallet-providers/zeroDevWalletProvider.test.d.ts +1 -0
  61. package/dist/wallet-providers/zeroDevWalletProvider.test.js +435 -0
  62. package/package.json +5 -1
package/README.md CHANGED
@@ -18,6 +18,7 @@ AgentKit is a framework for easily enabling AI agents to take actions onchain. I
18
18
  - [Adding Actions to your Action Provider that use a Wallet Provider](#adding-actions-to-your-action-provider-that-use-a-wallet-provider)
19
19
  - [Adding an Action Provider to your AgentKit instance](#adding-an-action-provider-to-your-agentkit-instance)
20
20
  - [EVM Wallet Providers](#evm-wallet-providers)
21
+ - [CdpV2EvmWalletProvider](#cdpv2evmwalletprovider)
21
22
  - [CdpWalletProvider](#cdpwalletprovider)
22
23
  - [Network Configuration](#network-configuration)
23
24
  - [Configuring from an existing CDP API Wallet](#configuring-from-an-existing-cdp-api-wallet)
@@ -31,7 +32,12 @@ AgentKit is a framework for easily enabling AI agents to take actions onchain. I
31
32
  - [Authorization Keys](#authorization-keys)
32
33
  - [Exporting Privy Wallet information](#exporting-privy-wallet-information)
33
34
  - [SmartWalletProvider](#smartwalletprovider)
35
+ - [ZeroDevWalletProvider](#zerodevwalletprovider)
36
+ - [Configuring from CdpWalletProvider](#configuring-from-cdpwalletprovider)
37
+ - [Configuring from PrivyWalletProvider](#configuring-from-privywalletprovider)
38
+ - [Configuring from ViemWalletProvider](#configuring-from-viemwalletprovider)
34
39
  - [SVM Wallet Providers](#svm-wallet-providers)
40
+ - [CdpV2SolanaWalletProvider](#cdpv2solanawalletprovider)
35
41
  - [SolanaKeypairWalletProvider](#solanakeypairwalletprovider)
36
42
  - [Network Configuration](#solana-network-configuration)
37
43
  - [RPC URL Configuration](#rpc-url-configuration)
@@ -411,6 +417,15 @@ const agent = createReactAgent({
411
417
  </tr>
412
418
  </table>
413
419
  </details>
420
+ <details>
421
+ <summary><strong>ZeroDev Wallet</strong></summary>
422
+ <table width="100%">
423
+ <tr>
424
+ <td width="200"><code>getCAB</code></td>
425
+ <td width="768">Retrieves chain abstracted balances (CAB) for specified tokens across multiple networks.</td>
426
+ </tr>
427
+ </table>
428
+ </details>
414
429
 
415
430
  ## Creating an Action Provider
416
431
 
@@ -524,9 +539,75 @@ const agentKit = new AgentKit({
524
539
  Wallet providers give an agent access to a wallet. AgentKit currently supports the following wallet providers:
525
540
 
526
541
  EVM:
542
+ - [CdpV2EvmWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/cdpV2EvmWalletProvider.ts)
527
543
  - [CdpWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/cdpWalletProvider.ts)
528
544
  - [ViemWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/viemWalletProvider.ts)
529
545
  - [PrivyWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/privyWalletProvider.ts)
546
+ - [ZeroDevWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/zeroDevWalletProvider.ts)
547
+
548
+ ### CdpV2EvmWalletProvider
549
+
550
+ The `CdpV2EvmWalletProvider` is a wallet provider that uses the Coinbase Developer Platform (CDP) V2 API. It provides a more modern and streamlined interface for interacting with CDP wallets.
551
+
552
+ #### Basic Configuration
553
+
554
+ ```typescript
555
+ import { CdpV2EvmWalletProvider } from "@coinbase/agentkit";
556
+
557
+ const walletProvider = await CdpV2EvmWalletProvider.configureWithWallet({
558
+ apiKeyId: "CDP_API_KEY_ID",
559
+ apiKeySecret: "CDP_API_KEY_SECRET",
560
+ walletSecret: "CDP_WALLET_SECRET",
561
+ networkId: "base-sepolia", // Optional, defaults to "base-sepolia"
562
+ });
563
+ ```
564
+
565
+ #### Using an Existing Wallet
566
+
567
+ You can configure the provider with an existing wallet by providing the wallet's address:
568
+
569
+ ```typescript
570
+ import { CdpV2EvmWalletProvider } from "@coinbase/agentkit";
571
+
572
+ const walletProvider = await CdpV2EvmWalletProvider.configureWithWallet({
573
+ apiKeyId: "CDP_API_KEY_ID",
574
+ apiKeySecret: "CDP_API_KEY_SECRET",
575
+ walletSecret: "CDP_WALLET_SECRET",
576
+ address: "0x...", // The address of an existing wallet
577
+ networkId: "base-sepolia",
578
+ });
579
+ ```
580
+
581
+ #### Creating a New Wallet
582
+
583
+ To create a new wallet, you can provide an idempotency key. The same idempotency key will always generate the same wallet address, and these keys are valid for 24 hours:
584
+
585
+ ```typescript
586
+ import { CdpV2EvmWalletProvider } from "@coinbase/agentkit";
587
+
588
+ const walletProvider = await CdpV2EvmWalletProvider.configureWithWallet({
589
+ apiKeyId: "CDP_API_KEY_ID",
590
+ apiKeySecret: "CDP_API_KEY_SECRET",
591
+ walletSecret: "CDP_WALLET_SECRET",
592
+ idempotencyKey: "unique-key-123", // Optional, if not provided a new wallet will be created
593
+ networkId: "base-sepolia",
594
+ });
595
+ ```
596
+
597
+ #### Environment Variables
598
+
599
+ The provider can also be configured using environment variables:
600
+
601
+ ```typescript
602
+ // Environment variables:
603
+ // CDP_API_KEY_ID=your_api_key_id
604
+ // CDP_API_KEY_SECRET=your_api_key_secret
605
+ // CDP_WALLET_SECRET=your_wallet_secret
606
+ // NETWORK_ID=base-sepolia (optional)
607
+ // IDEMPOTENCY_KEY=unique-key-123 (optional)
608
+
609
+ const walletProvider = await CdpV2EvmWalletProvider.configureWithWallet();
610
+ ```
530
611
 
531
612
  ### CdpWalletProvider
532
613
 
@@ -783,12 +864,164 @@ const walletProvider = await SmartWalletProvider.configureWithWallet({
783
864
  });
784
865
  ```
785
866
 
867
+ ### ZeroDevWalletProvider
868
+
869
+ The `ZeroDevWalletProvider` is a wallet provider that uses [ZeroDev](https://docs.zerodev.app/) smart accounts. It supports features like chain abstraction, gasless transactions, batched transactions, and more.
870
+
871
+ In the context of Agent Kit, "chain abstraction" means that the agent can spend funds across chains without explicitly bridging. For example, if you send funds to the agent's address on Base, the agent will be able to spend the funds on any supported EVM chains such as Arbitrum and Optimism.
872
+
873
+ The ZeroDev wallet provider does not itself manage keys. Rather, it can be used with any EVM wallet provider (e.g. CDP/Privy/Viem) which serves as the "signer" for the ZeroDev smart account.
874
+
875
+ #### Configuring from CdpWalletProvider
876
+
877
+ ```typescript
878
+ import { ZeroDevWalletProvider, CdpWalletProvider } from "@coinbase/agentkit";
879
+
880
+ // First create a CDP wallet provider as the signer
881
+ const cdpWalletProvider = await CdpWalletProvider.configureWithWallet({
882
+ apiKeyName: "CDP API KEY NAME",
883
+ apiKeyPrivate: "CDP API KEY PRIVATE KEY",
884
+ networkId: "base-mainnet",
885
+ });
886
+
887
+ // Configure ZeroDev Wallet Provider with CDP signer
888
+ const walletProvider = await ZeroDevWalletProvider.configureWithWallet({
889
+ signer: cdpWalletProvider.toSigner(),
890
+ projectId: "ZERODEV_PROJECT_ID",
891
+ entryPointVersion: "0.7" as const,
892
+ networkId: "base-mainnet",
893
+ });
894
+ ```
895
+
896
+ #### Configuring from PrivyWalletProvider
897
+
898
+ ```typescript
899
+ import { ZeroDevWalletProvider, PrivyWalletProvider } from "@coinbase/agentkit";
900
+
901
+ // First create a Privy wallet provider as the signer
902
+ const privyWalletProvider = await PrivyWalletProvider.configureWithWallet({
903
+ appId: "PRIVY_APP_ID",
904
+ appSecret: "PRIVY_APP_SECRET",
905
+ chainId: "8453", // base-mainnet
906
+ });
907
+
908
+ // Configure ZeroDev Wallet Provider with Privy signer
909
+ const walletProvider = await ZeroDevWalletProvider.configureWithWallet({
910
+ signer: privyWalletProvider.toSigner(),
911
+ projectId: "ZERODEV_PROJECT_ID",
912
+ entryPointVersion: "0.7" as const,
913
+ networkId: "base-mainnet",
914
+ });
915
+ ```
916
+
917
+ #### Configuring from ViemWalletProvider
918
+
919
+ ```typescript
920
+ import { ZeroDevWalletProvider, ViemWalletProvider } from "@coinbase/agentkit";
921
+ import { privateKeyToAccount } from "viem/accounts";
922
+ import { base } from "viem/chains";
923
+ import { createWalletClient, http } from "viem";
924
+
925
+ // First create a Viem wallet provider as the signer
926
+ const account = privateKeyToAccount("PRIVATE_KEY");
927
+
928
+ const viemWalletProvider = new ViemWalletProvider(
929
+ createWalletClient({
930
+ account,
931
+ chain: base,
932
+ transport: http(),
933
+ })
934
+ );
935
+
936
+ // Configure ZeroDev Wallet Provider with Viem signer
937
+ const walletProvider = await ZeroDevWalletProvider.configureWithWallet({
938
+ signer: viemWalletProvider.toSigner(),
939
+ projectId: "ZERODEV_PROJECT_ID",
940
+ entryPointVersion: "0.7" as const,
941
+ networkId: "base-mainnet",
942
+ });
943
+ ```
944
+
786
945
  ## SVM Wallet Providers
787
946
 
947
+ Wallet providers give an agent access to a wallet. AgentKit currently supports the following wallet providers:
948
+
788
949
  SVM:
950
+ - [CdpV2SolanaWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/cdpV2SolanaWalletProvider.ts)
789
951
  - [SolanaKeypairWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/solanaKeypairWalletProvider.ts)
790
952
  - [PrivyWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/privySvmWalletProvider.ts)
791
953
 
954
+ ### CdpV2SolanaWalletProvider
955
+
956
+ The `CdpV2SolanaWalletProvider` is a wallet provider that uses the Coinbase Developer Platform (CDP) V2 API for Solana. It provides a more modern and streamlined interface for interacting with CDP wallets on the Solana network.
957
+
958
+ #### Basic Configuration
959
+
960
+ ```typescript
961
+ import { CdpV2SolanaWalletProvider } from "@coinbase/agentkit";
962
+
963
+ const walletProvider = await CdpV2SolanaWalletProvider.configureWithWallet({
964
+ apiKeyId: "CDP_API_KEY_ID",
965
+ apiKeySecret: "CDP_API_KEY_SECRET",
966
+ walletSecret: "CDP_WALLET_SECRET",
967
+ networkId: "solana-devnet", // Optional, defaults to "solana-devnet"
968
+ });
969
+ ```
970
+
971
+ #### Using an Existing Wallet
972
+
973
+ You can configure the provider with an existing wallet by providing the wallet's address:
974
+
975
+ ```typescript
976
+ import { CdpV2SolanaWalletProvider } from "@coinbase/agentkit";
977
+
978
+ const walletProvider = await CdpV2SolanaWalletProvider.configureWithWallet({
979
+ apiKeyId: "CDP_API_KEY_ID",
980
+ apiKeySecret: "CDP_API_KEY_SECRET",
981
+ walletSecret: "CDP_WALLET_SECRET",
982
+ address: "your-solana-address", // The address of an existing wallet
983
+ networkId: "solana-devnet",
984
+ });
985
+ ```
986
+
987
+ #### Creating a New Wallet
988
+
989
+ To create a new wallet, you can provide an idempotency key. The same idempotency key will always generate the same wallet address, and these keys are valid for 24 hours:
990
+
991
+ ```typescript
992
+ import { CdpV2SolanaWalletProvider } from "@coinbase/agentkit";
993
+
994
+ const walletProvider = await CdpV2SolanaWalletProvider.configureWithWallet({
995
+ apiKeyId: "CDP_API_KEY_ID",
996
+ apiKeySecret: "CDP_API_KEY_SECRET",
997
+ walletSecret: "CDP_WALLET_SECRET",
998
+ idempotencyKey: "unique-key-123", // Optional, if not provided a new wallet will be created
999
+ networkId: "solana-devnet",
1000
+ });
1001
+ ```
1002
+
1003
+ #### Environment Variables
1004
+
1005
+ The provider can also be configured using environment variables:
1006
+
1007
+ ```typescript
1008
+ // Environment variables:
1009
+ // CDP_API_KEY_ID=your_api_key_id
1010
+ // CDP_API_KEY_SECRET=your_api_key_secret
1011
+ // CDP_WALLET_SECRET=your_wallet_secret
1012
+ // NETWORK_ID=solana-devnet (optional)
1013
+ // IDEMPOTENCY_KEY=unique-key-123 (optional)
1014
+
1015
+ const walletProvider = await CdpV2SolanaWalletProvider.configureWithWallet();
1016
+ ```
1017
+
1018
+ #### Supported Networks
1019
+
1020
+ The `CdpV2SolanaWalletProvider` supports the following Solana networks:
1021
+ - `solana-mainnet`
1022
+ - `solana-devnet`
1023
+ - `solana-testnet`
1024
+
792
1025
  ### SolanaKeypairWalletProvider
793
1026
 
794
1027
  The `SolanaKeypairWalletProvider` is a wallet provider that uses the API [Solana web3.js](https://solana-labs.github.io/solana-web3.js/).
@@ -839,6 +1072,7 @@ import { PrivyWalletProvider, PrivyWalletConfig } from "@coinbase/agentkit";
839
1072
  const config: PrivyWalletConfig = {
840
1073
  appId: "PRIVY_APP_ID",
841
1074
  appSecret: "PRIVY_APP_SECRET",
1075
+ connection,
842
1076
  chainType: "solana", // optional, defaults to "evm". Make sure to set this to "solana" if you want to use Solana!
843
1077
  networkId: "solana-devnet", // optional, defaults to "solana-devnet"
844
1078
  walletId: "PRIVY_WALLET_ID", // optional, otherwise a new wallet will be created
@@ -0,0 +1,37 @@
1
+ import { z } from "zod";
2
+ import { Network } from "../../network";
3
+ import { WalletProvider } from "../../wallet-providers";
4
+ import { WalletProviderWithClient } from "../../wallet-providers/cdpV2Shared";
5
+ import { ActionProvider } from "../actionProvider";
6
+ import { RequestFaucetFundsV2Schema } from "./schemas";
7
+ type CdpV2WalletProviderWithClient = WalletProvider & WalletProviderWithClient;
8
+ /**
9
+ * CdpApiActionProvider is an action provider for CDP API.
10
+ *
11
+ * This provider is used for any action that uses the CDP API, but does not require a CDP Wallet.
12
+ */
13
+ export declare class CdpApiV2ActionProvider extends ActionProvider<CdpV2WalletProviderWithClient> {
14
+ /**
15
+ * Constructor for the CdpApiActionProvider class.
16
+ */
17
+ constructor();
18
+ /**
19
+ * Requests test tokens from the faucet for the default address in the wallet.
20
+ *
21
+ * @param walletProvider - The wallet provider to request funds from.
22
+ * @param args - The input arguments for the action.
23
+ * @returns A confirmation message with transaction details.
24
+ */
25
+ faucet(walletProvider: CdpV2WalletProviderWithClient, args: z.infer<typeof RequestFaucetFundsV2Schema>): Promise<string>;
26
+ /**
27
+ * Checks if the Cdp action provider supports the given network.
28
+ *
29
+ * NOTE: Network scoping is done at the action implementation level
30
+ *
31
+ * @param _ - The network to check.
32
+ * @returns True if the Cdp action provider supports the network, false otherwise.
33
+ */
34
+ supportsNetwork: (_: Network) => boolean;
35
+ }
36
+ export declare const cdpApiV2ActionProvider: () => CdpApiV2ActionProvider;
37
+ export {};
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.cdpApiV2ActionProvider = exports.CdpApiV2ActionProvider = void 0;
13
+ const zod_1 = require("zod");
14
+ const actionDecorator_1 = require("../actionDecorator");
15
+ const actionProvider_1 = require("../actionProvider");
16
+ const schemas_1 = require("./schemas");
17
+ /**
18
+ * CdpApiActionProvider is an action provider for CDP API.
19
+ *
20
+ * This provider is used for any action that uses the CDP API, but does not require a CDP Wallet.
21
+ */
22
+ class CdpApiV2ActionProvider extends actionProvider_1.ActionProvider {
23
+ /**
24
+ * Constructor for the CdpApiActionProvider class.
25
+ */
26
+ constructor() {
27
+ super("cdp_api_v2", []);
28
+ /**
29
+ * Checks if the Cdp action provider supports the given network.
30
+ *
31
+ * NOTE: Network scoping is done at the action implementation level
32
+ *
33
+ * @param _ - The network to check.
34
+ * @returns True if the Cdp action provider supports the network, false otherwise.
35
+ */
36
+ this.supportsNetwork = (_) => true;
37
+ }
38
+ /**
39
+ * Requests test tokens from the faucet for the default address in the wallet.
40
+ *
41
+ * @param walletProvider - The wallet provider to request funds from.
42
+ * @param args - The input arguments for the action.
43
+ * @returns A confirmation message with transaction details.
44
+ */
45
+ async faucet(walletProvider, args) {
46
+ const network = walletProvider.getNetwork();
47
+ const networkId = network.networkId;
48
+ if (network.protocolFamily === "evm") {
49
+ if (networkId !== "base-sepolia" && networkId !== "ethereum-sepolia") {
50
+ throw new Error("Faucet is only supported on 'base-sepolia' or 'ethereum-sepolia' evm networks.");
51
+ }
52
+ const faucetTx = await walletProvider.getClient().evm.requestFaucet({
53
+ address: walletProvider.getAddress(),
54
+ token: (args.assetId || "eth"),
55
+ network: networkId,
56
+ });
57
+ return `Received ${args.assetId || "ETH"} from the faucet. Transaction hash: ${faucetTx.transactionHash}`;
58
+ }
59
+ else if (network.protocolFamily === "svm") {
60
+ if (networkId !== "solana-devnet") {
61
+ throw new Error("Faucet is only supported on 'solana-devnet' solana networks.");
62
+ }
63
+ const faucetTx = await walletProvider.getClient().solana.requestFaucet({
64
+ address: walletProvider.getAddress(),
65
+ token: (args.assetId || "sol"),
66
+ });
67
+ return `Received ${args.assetId || "SOL"} from the faucet. Transaction signature hash: ${faucetTx.signature}`;
68
+ }
69
+ else {
70
+ throw new Error("Faucet is only supported on Ethereum and Solana protocol families.");
71
+ }
72
+ }
73
+ }
74
+ exports.CdpApiV2ActionProvider = CdpApiV2ActionProvider;
75
+ __decorate([
76
+ (0, actionDecorator_1.CreateAction)({
77
+ name: "request_faucet_funds",
78
+ description: `This tool will request test tokens from the faucet for the default address in the wallet. It takes the wallet and asset ID as input.
79
+ Faucet is only allowed on 'base-sepolia' or 'solana-devnet'.
80
+ If fauceting on 'base-sepolia', user can only provide asset ID 'eth', 'usdc', 'eurc' or 'cbbtc', if no asset ID is provided, the faucet will default to 'eth'.
81
+ If fauceting on 'solana-devnet', user can only provide asset ID 'sol' or 'usdc', if no asset ID is provided, the faucet will default to 'sol'.
82
+ You are not allowed to faucet with any other network or asset ID. If you are on another network, suggest that the user sends you some ETH
83
+ from another wallet and provide the user with your wallet details.`,
84
+ schema: schemas_1.RequestFaucetFundsV2Schema,
85
+ }),
86
+ __metadata("design:type", Function),
87
+ __metadata("design:paramtypes", [Object, void 0]),
88
+ __metadata("design:returntype", Promise)
89
+ ], CdpApiV2ActionProvider.prototype, "faucet", null);
90
+ const cdpApiV2ActionProvider = () => new CdpApiV2ActionProvider();
91
+ exports.cdpApiV2ActionProvider = cdpApiV2ActionProvider;
@@ -0,0 +1,2 @@
1
+ export * from "./schemas";
2
+ export * from "./cdpApiV2ActionProvider";
@@ -0,0 +1,18 @@
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("./schemas"), exports);
18
+ __exportStar(require("./cdpApiV2ActionProvider"), exports);
@@ -0,0 +1,11 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Input schema for request faucet funds action.
4
+ */
5
+ export declare const RequestFaucetFundsV2Schema: z.ZodObject<{
6
+ assetId: z.ZodOptional<z.ZodString>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ assetId?: string | undefined;
9
+ }, {
10
+ assetId?: string | undefined;
11
+ }>;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RequestFaucetFundsV2Schema = void 0;
4
+ const zod_1 = require("zod");
5
+ /**
6
+ * Input schema for request faucet funds action.
7
+ */
8
+ exports.RequestFaucetFundsV2Schema = zod_1.z
9
+ .object({
10
+ assetId: zod_1.z.string().optional().describe("The optional asset ID to request from faucet"),
11
+ })
12
+ .strip()
13
+ .describe("Instructions for requesting faucet funds");
@@ -7,10 +7,10 @@ export declare const CompoundSupplySchema: z.ZodObject<{
7
7
  amount: z.ZodString;
8
8
  }, "strip", z.ZodTypeAny, {
9
9
  amount: string;
10
- assetId: "weth" | "cbeth" | "cbbtc" | "wsteth" | "usdc";
10
+ assetId: "usdc" | "cbbtc" | "weth" | "cbeth" | "wsteth";
11
11
  }, {
12
12
  amount: string;
13
- assetId: "weth" | "cbeth" | "cbbtc" | "wsteth" | "usdc";
13
+ assetId: "usdc" | "cbbtc" | "weth" | "cbeth" | "wsteth";
14
14
  }>;
15
15
  /**
16
16
  * Input schema for Compound withdraw action.
@@ -20,10 +20,10 @@ export declare const CompoundWithdrawSchema: z.ZodObject<{
20
20
  amount: z.ZodString;
21
21
  }, "strip", z.ZodTypeAny, {
22
22
  amount: string;
23
- assetId: "weth" | "cbeth" | "cbbtc" | "wsteth" | "usdc";
23
+ assetId: "usdc" | "cbbtc" | "weth" | "cbeth" | "wsteth";
24
24
  }, {
25
25
  amount: string;
26
- assetId: "weth" | "cbeth" | "cbbtc" | "wsteth" | "usdc";
26
+ assetId: "usdc" | "cbbtc" | "weth" | "cbeth" | "wsteth";
27
27
  }>;
28
28
  /**
29
29
  * Input schema for Compound borrow action.
@@ -33,10 +33,10 @@ export declare const CompoundBorrowSchema: z.ZodObject<{
33
33
  amount: z.ZodString;
34
34
  }, "strip", z.ZodTypeAny, {
35
35
  amount: string;
36
- assetId: "weth" | "usdc";
36
+ assetId: "usdc" | "weth";
37
37
  }, {
38
38
  amount: string;
39
- assetId: "weth" | "usdc";
39
+ assetId: "usdc" | "weth";
40
40
  }>;
41
41
  /**
42
42
  * Input schema for Compound repay action.
@@ -46,10 +46,10 @@ export declare const CompoundRepaySchema: z.ZodObject<{
46
46
  amount: z.ZodString;
47
47
  }, "strip", z.ZodTypeAny, {
48
48
  amount: string;
49
- assetId: "weth" | "usdc";
49
+ assetId: "usdc" | "weth";
50
50
  }, {
51
51
  amount: string;
52
- assetId: "weth" | "usdc";
52
+ assetId: "usdc" | "weth";
53
53
  }>;
54
54
  /**
55
55
  * Input schema for Compound get portfolio action.
@@ -5,6 +5,7 @@ export * from "./across";
5
5
  export * from "./alchemy";
6
6
  export * from "./basename";
7
7
  export * from "./cdp";
8
+ export * from "./cdp-v2";
8
9
  export * from "./compound";
9
10
  export * from "./defillama";
10
11
  export * from "./erc20";
@@ -24,3 +25,5 @@ export * from "./wow";
24
25
  export * from "./allora";
25
26
  export * from "./flaunch";
26
27
  export * from "./onramp";
28
+ export * from "./vaultsfyi";
29
+ export * from "./zerodev";
@@ -21,6 +21,7 @@ __exportStar(require("./across"), exports);
21
21
  __exportStar(require("./alchemy"), exports);
22
22
  __exportStar(require("./basename"), exports);
23
23
  __exportStar(require("./cdp"), exports);
24
+ __exportStar(require("./cdp-v2"), exports);
24
25
  __exportStar(require("./compound"), exports);
25
26
  __exportStar(require("./defillama"), exports);
26
27
  __exportStar(require("./erc20"), exports);
@@ -40,3 +41,5 @@ __exportStar(require("./wow"), exports);
40
41
  __exportStar(require("./allora"), exports);
41
42
  __exportStar(require("./flaunch"), exports);
42
43
  __exportStar(require("./onramp"), exports);
44
+ __exportStar(require("./vaultsfyi"), exports);
45
+ __exportStar(require("./zerodev"), exports);
@@ -0,0 +1,41 @@
1
+ import z from "zod";
2
+ import { claimActionSchema, depositActionSchema, redeemActionSchema } from "../schemas";
3
+ import { ApiError } from "./types";
4
+ import { Address, Hex } from "viem";
5
+ type FetchVaultActionsParams = ({
6
+ action: "deposit";
7
+ args: z.infer<typeof depositActionSchema>;
8
+ } | {
9
+ action: "redeem";
10
+ args: z.infer<typeof redeemActionSchema>;
11
+ } | {
12
+ action: "claim-rewards";
13
+ args: z.infer<typeof claimActionSchema>;
14
+ }) & {
15
+ sender: string;
16
+ apiKey: string;
17
+ };
18
+ export type Actions = {
19
+ actions: {
20
+ tx: {
21
+ to: Address;
22
+ data: Hex;
23
+ value: string;
24
+ chainId: number;
25
+ };
26
+ description: string;
27
+ }[];
28
+ currentActionIndex: number;
29
+ };
30
+ /**
31
+ * Fetches a list of actions for a vault from the vaultsfyi API.
32
+ *
33
+ * @param root0 - The fetch parameters
34
+ * @param root0.action - The action to fetch
35
+ * @param root0.args - The action parameters
36
+ * @param root0.sender - The sender address
37
+ * @param root0.apiKey - The vaultsfyi API key
38
+ * @returns The list of actions
39
+ */
40
+ export declare function fetchVaultActions({ action, args, sender, apiKey, }: FetchVaultActionsParams): Promise<Actions | ApiError>;
41
+ export {};
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchVaultActions = fetchVaultActions;
4
+ const utils_1 = require("../utils");
5
+ const constants_1 = require("../constants");
6
+ /**
7
+ * Fetches a list of actions for a vault from the vaultsfyi API.
8
+ *
9
+ * @param root0 - The fetch parameters
10
+ * @param root0.action - The action to fetch
11
+ * @param root0.args - The action parameters
12
+ * @param root0.sender - The sender address
13
+ * @param root0.apiKey - The vaultsfyi API key
14
+ * @returns The list of actions
15
+ */
16
+ async function fetchVaultActions({ action, args, sender, apiKey, }) {
17
+ const params = (0, utils_1.createSearchParams)({
18
+ ...args,
19
+ sender,
20
+ });
21
+ const response = await fetch(`${constants_1.VAULTS_API_URL}/transactions/vaults/${action}?${params}`, {
22
+ method: "GET",
23
+ headers: {
24
+ "x-api-key": apiKey,
25
+ },
26
+ });
27
+ return (await response.json());
28
+ }
@@ -0,0 +1,34 @@
1
+ export type ApiError = {
2
+ statusCode: number;
3
+ error: string;
4
+ message: string;
5
+ };
6
+ export type Balances = {
7
+ [network: string]: {
8
+ address: string;
9
+ name: string;
10
+ symbol: string;
11
+ balance: string;
12
+ decimals: number;
13
+ }[];
14
+ };
15
+ export type Positions = {
16
+ [network: string]: {
17
+ vaultName: string;
18
+ vaultAddress: string;
19
+ asset: {
20
+ assetAddress: string;
21
+ name: string;
22
+ symbol: string;
23
+ decimals: number;
24
+ };
25
+ balanceNative: string;
26
+ balanceLp: string;
27
+ unclaimedUsd: string;
28
+ apy: {
29
+ base: number;
30
+ rewards: number;
31
+ total: number;
32
+ };
33
+ }[];
34
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });