> ## 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.

# Overview

> The Coinbase Wallet provider `request` method — how apps make Ethereum RPC requests to the wallet.

The `request` method allows apps to make Ethereum RPC requests to the wallet.

## Specification

```ts Specification lines wrap expandable theme={null}
interface RequestArguments {
  readonly method: string;
  readonly params?: readonly unknown[] | object;
}

interface ProviderRpcError extends Error {
  message: string;
  code: number;
  data?: unknown;
}

interface ProviderInterface {
  /**
   * @param {RequestArguments} args request arguments.
   * @returns A promise that resolves with the result.
   * @throws {ProviderRpcError} in case of error.
   */
  request(args: RequestArguments): Promise<unknown>;
  disconnect(): Promise<void>;
  emit<K extends keyof ProviderEventMap>(event: K, ...args: [ProviderEventMap[K]]): boolean;
  on<K extends keyof ProviderEventMap>(event: K, listener: (_: ProviderEventMap[K]) => void): this;
}

type CreateProviderOptions = Partial<AppMetadata> & {
  preference?: Preference;
  subAccounts?: SubAccountOptions;
  paymasterUrls?: Record<number, string>;
};

interface BaseAccountSDK {
  getProvider(): ProviderInterface;
  subAccount: {
    create(account: AddSubAccountAccount): Promise<SubAccount>;
    get(): Promise<SubAccount | null>;
    addOwner(params: { address?: `0x${string}`; publicKey?: `0x${string}`; chainId: number }): Promise<string>;
    setToOwnerAccount(toSubAccountOwner: ToOwnerAccountFn): void;
  };
}
```

### Example

<CodeGroup>
  ```ts example.ts lines wrap expandable theme={null}
  import {provider} from "./setup";

  const addresses = await provider.request({method: 'eth_requestAccounts'});
  const txHash = await provider.request({
      method: 'eth_sendTransaction',
      params: [{from: addresses[0], to: addresses[0], value: 1}]
    }
  );
  ```

  ```ts setup.ts filename="setup.ts" lines wrap expandable theme={null}
  import { createBaseAccountSDK } from '@base-org/account'

  const baseSepoliaChainId = 84532;

  export const sdk = createBaseAccountSDK({
    appName: 'My App Name',
    appChainIds: [baseSepoliaChainId]
  });

  export const provider = sdk.getProvider();
  ```
</CodeGroup>

## Request Handling

Requests are handled in one of three ways

1. Sent to the Wallet application (Wallet mobile app, extension, or popup window).
2. Handled locally by the SDK.
3. Passed onto default RPC provider for the given chain, if it exists.

### 1. Sent to the Wallet Application

The following RPC requests are sent to the Wallet application:

* [`personal_sign`](/coinbase-wallet/reference/core/provider-rpc-methods/personal_sign)
* [`eth_sendTransaction`](/coinbase-wallet/reference/core/provider-rpc-methods/eth_sendTransaction)
* [`eth_sendRawTransaction`](/coinbase-wallet/reference/core/provider-rpc-methods/eth_sendRawTransaction)
* [`eth_signTypedData_v4`](/coinbase-wallet/reference/core/provider-rpc-methods/eth_signTypedData_v4)
* [`wallet_addEthereumChain`](/coinbase-wallet/reference/core/provider-rpc-methods/wallet_addEthereumChain)
* [`wallet_watchAsset`](/coinbase-wallet/reference/core/provider-rpc-methods/wallet_watchAsset)
* [`wallet_sendCalls`](/coinbase-wallet/reference/core/provider-rpc-methods/wallet_sendCalls)
* [`wallet_getCallsStatus`](/coinbase-wallet/reference/core/provider-rpc-methods/wallet_getCallsStatus)
* [`wallet_connect`](/coinbase-wallet/reference/core/provider-rpc-methods/wallet_connect)
* [`wallet_getCapabilities`](/coinbase-wallet/reference/core/provider-rpc-methods/wallet_getCapabilities)
* [`wallet_switchEthereumChain`](/coinbase-wallet/reference/core/provider-rpc-methods/wallet_switchEthereumChain)
* [`wallet_addSubAccount`](/coinbase-wallet/reference/core/provider-rpc-methods/wallet_addSubAccount)
* [`wallet_getSubAccounts`](/coinbase-wallet/reference/core/provider-rpc-methods/wallet_getSubAccounts)
* [`coinbase_fetchPermissions`](/coinbase-wallet/reference/core/provider-rpc-methods/coinbase_fetchPermissions)
* [`coinbase_fetchPermission`](/coinbase-wallet/reference/core/provider-rpc-methods/coinbase_fetchPermission)

### 2. Handled Locally by the SDK

The following requests are handled locally by the SDK, with no external calls:

* [`eth_requestAccounts`](/coinbase-wallet/reference/core/provider-rpc-methods/eth_requestAccounts)
* [`eth_accounts`](/coinbase-wallet/reference/core/provider-rpc-methods/eth_accounts)
* [`eth_coinbase`](/coinbase-wallet/reference/core/provider-rpc-methods/eth_coinbase)
* [`eth_chainId`](/coinbase-wallet/reference/core/provider-rpc-methods/eth_chainId)
* [`web3_clientVersion`](/coinbase-wallet/reference/core/provider-rpc-methods/web3_clientVersion)

### 3. Passed to RPC Provider

Standard Ethereum RPC methods are passed to the configured RPC provider for the current chain, including:

* [`eth_getBalance`](/coinbase-wallet/reference/core/provider-rpc-methods/eth_getBalance)
* [`eth_blockNumber`](/coinbase-wallet/reference/core/provider-rpc-methods/eth_blockNumber)
* [`eth_gasPrice`](/coinbase-wallet/reference/core/provider-rpc-methods/eth_gasPrice)
* [`eth_estimateGas`](/coinbase-wallet/reference/core/provider-rpc-methods/eth_estimateGas)
* [`eth_feeHistory`](/coinbase-wallet/reference/core/provider-rpc-methods/eth_feeHistory)
* [`eth_getBlockByNumber`](/coinbase-wallet/reference/core/provider-rpc-methods/eth_getBlockByNumber)
* [`eth_getBlockByHash`](/coinbase-wallet/reference/core/provider-rpc-methods/eth_getBlockByHash)
* [`eth_getTransactionByHash`](/coinbase-wallet/reference/core/provider-rpc-methods/eth_getTransactionByHash)
* [`eth_getTransactionReceipt`](/coinbase-wallet/reference/core/provider-rpc-methods/eth_getTransactionReceipt)
* [`eth_getTransactionCount`](/coinbase-wallet/reference/core/provider-rpc-methods/eth_getTransactionCount)
* [`eth_getTransactionByBlockHashAndIndex`](/coinbase-wallet/reference/core/provider-rpc-methods/eth_getTransactionByBlockHashAndIndex)
* [`eth_getTransactionByBlockNumberAndIndex`](/coinbase-wallet/reference/core/provider-rpc-methods/eth_getTransactionByBlockNumberAndIndex)
* [`eth_getBlockTransactionCountByHash`](/coinbase-wallet/reference/core/provider-rpc-methods/eth_getBlockTransactionCountByHash)
* [`eth_getBlockTransactionCountByNumber`](/coinbase-wallet/reference/core/provider-rpc-methods/eth_getBlockTransactionCountByNumber)
* [`eth_getCode`](/coinbase-wallet/reference/core/provider-rpc-methods/eth_getCode)
* [`eth_getStorageAt`](/coinbase-wallet/reference/core/provider-rpc-methods/eth_getStorageAt)
* [`eth_getLogs`](/coinbase-wallet/reference/core/provider-rpc-methods/eth_getLogs)
* [`eth_getProof`](/coinbase-wallet/reference/core/provider-rpc-methods/eth_getProof)
* [`eth_getUncleCountByBlockHash`](/coinbase-wallet/reference/core/provider-rpc-methods/eth_getUncleCountByBlockHash)
* [`eth_getUncleCountByBlockNumber`](/coinbase-wallet/reference/core/provider-rpc-methods/eth_getUncleCountByBlockNumber)
* [`eth_sendRawTransaction`](/coinbase-wallet/reference/core/provider-rpc-methods/eth_sendRawTransaction)
