> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cdp.coinbase.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Wallet Management

AgentKit supports multiple wallet providers, with [CDP non-custodial wallet](/wallets/non-custodial-wallets/overview) being the default implementation.

## Wallet Configuration

You can configure AgentKit to use a CDP wallet or a custom wallet provider.

<Tabs>
  <Tab value="CDP non-custodial wallet" title="CDP Wallet">
    The [CDP non-custodial wallet](/wallets/non-custodial-wallets/overview) is the recommended wallet provider for AgentKit. It supports both EVM and Solana chains, seamlessly and securely handles private keys, and is compatible with viem.

    <Tabs groupId="programming-language">
      <Tab value="Typescript" title="Typescript">
        ```typescript lines wrap theme={null}
        import {
          AgentKit,
          CdpV2WalletProvider,
          CdpV2EvmWalletProvider, // for evm
          CdpV2SolanaWalletProvider, // for solana
        } from "@coinbase/agentkit";

        // Configure CDP Wallet Provider
        const cdpWalletConfig = {
          apiKeyId: process.env.CDP_API_KEY_ID, // from https://portal.cdp.coinbase.com , see v2 wallet quickstart for more details
          apiKeySecret: process.env.CDP_API_KEY_SECRET,
          walletSecret: process.env.CDP_WALLET_SECRET,
          idempotencyKey: process.env.IDEMPOTENCY_KEY, // optional, used for account creation
          address: process.env.ADDRESS as `0x${string}` | undefined, // optional, used for existing account
          networkId: process.env.NETWORK_ID, // e.g. "base", "base-sepolia", "solana"
        };

        const walletProvider = await CdpV2WalletProvider.configureWithWallet(cdpWalletConfig);

        // ...
        // Initialize AgentKit
        const agentkit = await AgentKit.from({
          walletProvider,
          actionProviders: [],
        });
        ```
      </Tab>

      <Tab value="Python" title="Python">
        ```python lines wrap theme={null}
        from coinbase_agentkit import (
            AgentKit,
            AgentKitConfig,
            CdpEvmServerWalletProvider,
            CdpEvmServerWalletProviderConfig,
        )

        # Initialize the wallet provider with the config
        wallet_provider = CdpEvmServerWalletProvider(
            CdpEvmServerWalletProviderConfig(
                api_key_id=config.api_key_id,  # CDP API Key ID
                api_key_secret=config.api_key_secret,  # CDP API Key Secret
                wallet_secret=config.wallet_secret,  # CDP Wallet Secret
                network_id=config.network_id,  # Network ID - Optional, will default to 'base-sepolia'
                address=config.address,  # Wallet Address - Optional, will trigger idempotency flow if not provided
                idempotency_key=config.idempotency_key,  # Idempotency Key - Optional, seeds generation of a new wallet
            )
        )

        # Create AgentKit instance with wallet and action providers
        agentkit = AgentKit(
            AgentKitConfig(
                wallet_provider=wallet_provider,
                action_providers=[],
            )
        )
        ```
      </Tab>
    </Tabs>
  </Tab>

  <Tab value="Privy Server Wallet (EVM/Solana)" title="Privy Server Wallet (EVM/Solana)">
    <Tabs>
      <Tab value="EVM" title="EVM">
        The `PrivyWalletProvider` is a wallet provider that uses [Privy Server Wallets](https://docs.privy.io/guide/server-wallets/). This implementation extends the `ViemWalletProvider`.

        ```typescript lines wrap theme={null}
        import { PrivyWalletProvider, PrivyWalletConfig } from "@coinbase/agentkit";

        // Configure Wallet Provider
        const config: PrivyWalletConfig = {
            appId: "PRIVY_APP_ID",
            appSecret: "PRIVY_APP_SECRET",
            chainId: "84532", // optional, defaults to 84532 (base-sepolia)
            walletId: "PRIVY_WALLET_ID", // optional, otherwise a new wallet will be created
            authorizationPrivateKey: PRIVY_WALLET_AUTHORIZATION_PRIVATE_KEY, // optional, required if your account is using authorization keys
            authorizationKeyId: PRIVY_WALLET_AUTHORIZATION_KEY_ID, // optional, only required to create a new wallet if walletId is not provided
        };

        const walletProvider = await PrivyWalletProvider.configureWithWallet(config);
        ```
      </Tab>

      <Tab value="Solana" title="Solana">
        The `PrivyWalletProvider` is a wallet provider that uses [Privy Server Wallets](https://docs.privy.io/guide/server-wallets/).

        ```typescript lines wrap theme={null}
        import { PrivyWalletProvider, PrivyWalletConfig } from "@coinbase/agentkit";

        // Configure Wallet Provider
        const config: PrivyWalletConfig = {
            appId: "PRIVY_APP_ID",
            appSecret: "PRIVY_APP_SECRET",
            chainType: "solana", // optional, defaults to "evm". Make sure to set this to "solana" if you want to use Solana!
            networkId: "solana-devnet", // optional, defaults to "solana-devnet"
            walletId: "PRIVY_WALLET_ID", // optional, otherwise a new wallet will be created
            authorizationPrivateKey: PRIVY_WALLET_AUTHORIZATION_PRIVATE_KEY, // optional, required if your account is using authorization keys
            authorizationKeyId: PRIVY_WALLET_AUTHORIZATION_KEY_ID, // optional, only required to create a new wallet if walletId is not provided
        };

        const walletProvider = await PrivyWalletProvider.configureWithWallet(config);
        ```

        **Custom Solana Connection**

        Optionally, you can configure your own `@solana/web3.js` connection by passing the `connection` parameter to the `configureWithWallet` method.

        ```typescript lines wrap theme={null}
        import { PrivyWalletProvider, PrivyWalletConfig } from "@coinbase/agentkit";

        const connection = new Connection("YOUR_RPC_URL");

        // Configure Wallet Provider
        const config: PrivyWalletConfig = {
            appId: "PRIVY_APP_ID",
            appSecret: "PRIVY_APP_SECRET",
            connection,
            chainType: "solana", // optional, defaults to "evm". Make sure to set this to "solana" if you want to use Solana!
            networkId: "solana-devnet", // optional, defaults to "solana-devnet"
            walletId: "PRIVY_WALLET_ID", // optional, otherwise a new wallet will be created
            authorizationPrivateKey: PRIVY_WALLET_AUTHORIZATION_PRIVATE_KEY, // optional, required if your account is using authorization keys
            authorizationKeyId: PRIVY_WALLET_AUTHORIZATION_KEY_ID, // optional, only required to create a new wallet if walletId is not provided
        };

        const walletProvider = await PrivyWalletProvider.configureWithWallet(config);
        ```
      </Tab>
    </Tabs>

    **Authorization Keys**

    Privy offers the option to use authorization keys to secure your server wallets.

    You can manage authorization keys from your [Privy dashboard](https://dashboard.privy.io/account) or programmatically [using the API](https://docs.privy.io/guide/server-wallets/authorization/signatures).

    When using authorization keys, you must provide the `authorizationPrivateKey` and `authorizationKeyId` parameters to the `configureWithWallet` method if you are creating a new wallet. Please note that when creating a key, if you enable "Create and modify wallets", you will be required to use that key when creating new wallets via the PrivyWalletProvider.

    **Exporting Privy Wallet information**

    The `PrivyWalletProvider` can export wallet information by calling the `exportWallet` method.

    ```typescript lines wrap theme={null}
    const walletData = await walletProvider.exportWallet();

    // walletData will be in the following format:
    {
        walletId: string;
        authorizationKey: string | undefined;
        networkId: string | undefined;
    }
    ```
  </Tab>

  <Tab value="Solana Keypair Wallet" title="Solana Keypair Wallet">
    The [`SolanaKeypairWalletProvider`](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/solanaKeypairWalletProvider.ts) is a wallet provider that uses the [Solana web3.js API](https://solana-foundation.github.io/solana-web3.js/).

    **Solana Network Configuration**

    The `SolanaKeypairWalletProvider` can be configured to use a specific network by passing the `networkId` parameter to the `fromNetwork` method. The `networkId` is the ID of the Solana network you want to use. Valid values are `solana-mainnet`, `solana-devnet` and `solana-testnet`.

    The default RPC endpoints for each network are as follows:

    * `solana-mainnet`: `https://api.mainnet-beta.solana.com`
    * `solana-devnet`: `https://api.devnet.solana.com`
    * `solana-testnet`: `https://api.testnet.solana.com`

    ```typescript lines wrap theme={null}
    import { SOLANA_NETWORK_ID, SolanaKeypairWalletProvider } from "@coinbase/agentkit";

    // Configure Solana Keypair Wallet Provider
    const privateKey = process.env.SOLANA_PRIVATE_KEY;
    const network = process.env.NETWORK_ID as SOLANA_NETWORK_ID;
    const walletProvider = await SolanaKeypairWalletProvider.fromNetwork(network, privateKey);
    ```

    **RPC URL Configuration**

    The `SolanaKeypairWalletProvider` can be configured to use a specific RPC url by passing the `rpcUrl` parameter to the `fromRpcUrl` method. The `rpcUrl` will determine the network you are using.

    ```typescript lines wrap theme={null}
    import { SOLANA_NETWORK_ID, SolanaKeypairWalletProvider } from "@coinbase/agentkit";

    // Configure Solana Keypair Wallet Provider
    const privateKey = process.env.SOLANA_PRIVATE_KEY;
    const rpcUrl = process.env.SOLANA_RPC_URL;
    const walletProvider = await SolanaKeypairWalletProvider.fromRpcUrl(rpcUrl, privateKey);
    ```
  </Tab>
</Tabs>

## Default Operations

By default, AgentKit supports the following basic wallet operations:

* `get_wallet_details` - Get details about the Wallet, like the address
* `transfer` - Transfer assets between addresses
* `get_balance` - Get the balance of an asset

You can add additional actions or action providers upon agent instantiation.
