@@ -7,31 +7,36 @@ AgentKit is a framework for easily enabling AI agents to take actions onchain. I
77- [ Getting Started] ( #getting-started )
88- [ Installation] ( #installation )
99- [ Usage] ( #usage )
10- - [ Create an AgentKit instance] ( #create-an-agentkit-instance )
11- - [ Create an AgentKit instance with a specified wallet provider] ( #create-an-agentkit-instance-with-a-specified-wallet-provider )
12- - [ Create an AgentKit instance with specified action providers] ( #create-an-agentkit-instance-with-specified-action-providers )
13- - [ Use with a framework extension (e.g., LangChain + OpenAI)] ( #use-with-a-framework-extension )
10+ - [ Create an AgentKit instance] ( #create-an-agentkit-instance )
11+ - [ Create an AgentKit instance with a specified wallet provider] ( #create-an-agentkit-instance-with-a-specified-wallet-provider )
12+ - [ Create an AgentKit instance with specified action providers] ( #create-an-agentkit-instance-with-specified-action-providers )
13+ - [ Use with a framework extension (e.g., LangChain + OpenAI)] ( #use-with-a-framework-extension )
1414- [ Creating an Action Provider] ( #creating-an-action-provider )
15- - [ Adding Actions to your Action Provider] ( #adding-actions-to-your-action-provider )
16- - [ Adding Actions that use a Wallet Provider] ( #adding-actions-that-use-a-wallet-provider )
17- - [ Adding an Action Provider to your AgentKit instance] ( #adding-an-action-provider-to-your-agentkit-instance )
15+ - [ Adding Actions to your Action Provider] ( #adding-actions-to-your-action-provider )
16+ - [ Adding Actions that use a Wallet Provider] ( #adding-actions-that-use-a-wallet-provider )
17+ - [ Adding an Action Provider to your AgentKit instance] ( #adding-an-action-provider-to-your-agentkit-instance )
1818- [ Action Providers] ( #action-providers )
1919- [ Wallet Providers] ( #wallet-providers )
20- - [ CdpEvmServerWalletProvider] ( #cdpevmserverwalletprovider )
21- - [ Network Configuration] ( #network-configuration )
22- - [ Configuring from an existing CDP API Wallet] ( #configuring-from-an-existing-cdp-api-wallet )
23- - [ Creating a new wallet] ( #creating-a-new-wallet )
24- - [ Example Usage with AgentKit] ( #example-usage-with-agentkit )
25- - [ CdpEvmSmartWalletProvider] ( #cdpevmsmartwalletprovider )
26- - [ Network Configuration] ( #network-configuration )
27- - [ Configuring with a Private Key Owner] ( #configuring-with-a-private-key-owner )
28- - [ Configuring with a Server Wallet Owner] ( #configuring-with-a-server-wallet-owner )
29- - [ Creating a New Smart Wallet] ( #creating-a-new-smart-wallet )
30- - [ Gasless Transactions with Paymaster] ( #gasless-transactions-with-paymaster )
31- - [ Example Usage with AgentKit] ( #example-usage-with-agentkit )
32- - [ EthAccountWalletProvider] ( #ethaccountwalletprovider )
33- - [ Configuring gas parameters] ( #configuring-ethaccountwalletprovider-gas-parameters )
34- - [ SmartWalletProvider] ( #smartwalletprovider )
20+ - [ CdpEvmServerWalletProvider] ( #cdpevmserverwalletprovider )
21+ - [ Network Configuration] ( #network-configuration )
22+ - [ Configuring from an existing CDP API Wallet] ( #configuring-from-an-existing-cdp-api-wallet )
23+ - [ Creating a new wallet] ( #creating-a-new-wallet )
24+ - [ Example Usage with AgentKit] ( #example-usage-with-agentkit )
25+ - [ CdpEvmSmartWalletProvider] ( #cdpevmsmartwalletprovider )
26+ - [ Network Configuration] ( #network-configuration )
27+ - [ Configuring with a Private Key Owner] ( #configuring-with-a-private-key-owner )
28+ - [ Configuring with a Server Wallet Owner] ( #configuring-with-a-server-wallet-owner )
29+ - [ Creating a New Smart Wallet] ( #creating-a-new-smart-wallet )
30+ - [ Gasless Transactions with Paymaster] ( #gasless-transactions-with-paymaster )
31+ - [ Example Usage with AgentKit] ( #example-usage-with-agentkit )
32+ - [ EthAccountWalletProvider] ( #ethaccountwalletprovider )
33+ - [ Configuring gas parameters] ( #configuring-ethaccountwalletprovider-gas-parameters )
34+ - [ Configuring ` EthAccountWalletProvider ` rpc url] ( #configuring-ethaccountwalletprovider-rpc-url )
35+ - [ SmartWalletProvider] ( #smartwalletprovider )
36+ - [ CdpSolanaWalletProvider] ( #cdpsolanawalletprovider )
37+ - [ Configuring with API credentials] ( #configuring-with-api-credentials )
38+ - [ Using environment variables] ( #using-environment-variables )
39+ - [ Example Usage with AgentKit] ( #example-usage-with-agentkit )
3540- [ Contributing] ( #contributing )
3641
3742## Getting Started
@@ -888,9 +893,9 @@ import os
888893from eth_account import Account
889894
890895from coinbase_agentkit import (
891- AgentKit,
892- AgentKitConfig,
893- SmartWalletProvider,
896+ AgentKit,
897+ AgentKitConfig,
898+ SmartWalletProvider,
894899 SmartWalletProviderConfig
895900)
896901
@@ -916,6 +921,112 @@ agent_kit = AgentKit(AgentKitConfig(
916921))
917922```
918923
924+ ### CdpSolanaWalletProvider
925+
926+ The ` CdpSolanaWalletProvider ` is a wallet provider that uses the Coinbase Developer Platform (CDP) API for Solana networks. It supports SOL transfers and message signing on Solana mainnet, devnet, and testnet.
927+
928+ #### Network Configuration
929+
930+ The ` CdpSolanaWalletProvider ` can be configured to use different Solana networks by setting the ` network_id ` parameter:
931+
932+ - ` solana-mainnet ` - Solana Mainnet
933+ - ` solana-devnet ` - Solana Devnet (default)
934+ - ` solana-testnet ` - Solana Testnet
935+
936+ ``` python
937+ from coinbase_agentkit import CdpSolanaWalletProvider, CdpSolanaWalletProviderConfig
938+
939+ wallet_provider = CdpSolanaWalletProvider(CdpSolanaWalletProviderConfig(
940+ api_key_id = " CDP API KEY ID" ,
941+ api_key_secret = " CDP API KEY SECRET" ,
942+ wallet_secret = " CDP WALLET SECRET" ,
943+ network_id = " solana-devnet" ,
944+ ))
945+ ```
946+
947+ #### Configuring with API credentials
948+
949+ You can configure the provider by passing CDP API credentials directly:
950+
951+ ``` python
952+ from coinbase_agentkit import CdpSolanaWalletProvider, CdpSolanaWalletProviderConfig
953+
954+ wallet_provider = CdpSolanaWalletProvider(CdpSolanaWalletProviderConfig(
955+ api_key_id = " CDP API KEY ID" ,
956+ api_key_secret = " CDP API KEY SECRET" ,
957+ wallet_secret = " CDP WALLET SECRET" ,
958+ network_id = " solana-mainnet" ,
959+ ))
960+ ```
961+
962+ #### Using environment variables
963+
964+ The provider can also read configuration from environment variables:
965+
966+ ``` python
967+ from coinbase_agentkit import CdpSolanaWalletProvider, CdpSolanaWalletProviderConfig
968+
969+ # Set environment variables:
970+ # CDP_API_KEY_ID="your-api-key-id"
971+ # CDP_API_KEY_SECRET="your-api-key-secret"
972+ # CDP_WALLET_SECRET="your-wallet-secret"
973+ # NETWORK_ID="solana-devnet"
974+
975+ wallet_provider = CdpSolanaWalletProvider(CdpSolanaWalletProviderConfig())
976+ ```
977+
978+ #### Using an existing wallet
979+
980+ If you have an existing CDP Solana wallet, you can specify its address:
981+
982+ ``` python
983+ from coinbase_agentkit import CdpSolanaWalletProvider, CdpSolanaWalletProviderConfig
984+
985+ wallet_provider = CdpSolanaWalletProvider(CdpSolanaWalletProviderConfig(
986+ api_key_id = " CDP API KEY ID" ,
987+ api_key_secret = " CDP API KEY SECRET" ,
988+ wallet_secret = " CDP WALLET SECRET" ,
989+ address = " YOUR_EXISTING_SOLANA_ADDRESS" ,
990+ network_id = " solana-mainnet" ,
991+ ))
992+ ```
993+
994+ #### Example Usage with AgentKit
995+
996+ Here's a complete example of using ` CdpSolanaWalletProvider ` with AgentKit:
997+
998+ ``` python
999+ from coinbase_agentkit import (
1000+ AgentKit,
1001+ AgentKitConfig,
1002+ CdpSolanaWalletProvider,
1003+ CdpSolanaWalletProviderConfig,
1004+ wallet_action_provider,
1005+ )
1006+
1007+ # Initialize the wallet provider
1008+ wallet_provider = CdpSolanaWalletProvider(CdpSolanaWalletProviderConfig(
1009+ api_key_id = " CDP API KEY ID" ,
1010+ api_key_secret = " CDP API KEY SECRET" ,
1011+ wallet_secret = " CDP WALLET SECRET" ,
1012+ network_id = " solana-devnet" ,
1013+ ))
1014+
1015+ # Create AgentKit instance with wallet and action providers
1016+ agentkit = AgentKit(AgentKitConfig(
1017+ wallet_provider = wallet_provider,
1018+ action_providers = [
1019+ wallet_action_provider(), # Provides basic wallet operations for Solana
1020+ ],
1021+ ))
1022+
1023+ # The wallet provider supports:
1024+ # - Getting wallet address: wallet_provider.get_address()
1025+ # - Getting SOL balance: wallet_provider.get_balance()
1026+ # - Transferring SOL: wallet_provider.native_transfer(to, amount)
1027+ # - Signing messages: wallet_provider.sign_message(message)
1028+ ```
1029+
9191030## Contributing
9201031
9211032See [ CONTRIBUTING.md] ( https://github.com/coinbase/agentkit/blob/main/CONTRIBUTING.md ) for more information.
0 commit comments