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

# request

> Make a generic JSON-RPC request.

## Function Signature

```dart theme={null}
Future<PortalProviderResponse> request({
  required String chainId,
  required String method,
  required List<Object?> params,
  String? signatureApprovalMemo,
})
```

## Description

Make a generic JSON-RPC request to the blockchain. This allows you to call any RPC method supported by the chain.

## Parameters

| Parameter               | Type            | Required | Description                          |
| ----------------------- | --------------- | -------- | ------------------------------------ |
| `chainId`               | `String`        | Yes      | The chain ID in CAIP-2 format        |
| `method`                | `String`        | Yes      | The JSON-RPC method name             |
| `params`                | `List<Object?>` | Yes      | The method parameters                |
| `signatureApprovalMemo` | `String`        | No       | Optional memo for signing operations |

## Returns

**`PortalProviderResponse`** - An object containing:

| Property | Type      | Description                          |
| -------- | --------- | ------------------------------------ |
| `result` | `dynamic` | The result of the RPC call           |
| `error`  | `dynamic` | Error information if the call failed |

## Example

```dart theme={null}
import 'package:portal_flutter/portal_flutter.dart';

final portal = Portal();

// Get account balance
final response = await portal.request(
  chainId: 'eip155:1',
  method: 'eth_getBalance',
  params: ['0xYourAddress', 'latest'],
);

print('Balance: ${response.result}');
```

### Common RPC Methods

```dart theme={null}
// Get block number
final blockResponse = await portal.request(
  chainId: 'eip155:1',
  method: 'eth_blockNumber',
  params: [],
);

// Estimate gas
final gasResponse = await portal.request(
  chainId: 'eip155:1',
  method: 'eth_estimateGas',
  params: [{
    'from': '0xFromAddress',
    'to': '0xToAddress',
    'value': '0x10',
  }],
);

// Call contract (read-only)
final callResponse = await portal.request(
  chainId: 'eip155:1',
  method: 'eth_call',
  params: [{
    'to': '0xContractAddress',
    'data': '0x70a08231...', // balanceOf encoded
  }, 'latest'],
);
```

### Signing Methods

```dart theme={null}
// personal_sign
final signResponse = await portal.request(
  chainId: 'eip155:1',
  method: 'personal_sign',
  params: ['0x48656c6c6f', '0xYourAddress'],
  signatureApprovalMemo: 'Sign hello message',
);

// eth_sendTransaction
final txResponse = await portal.request(
  chainId: 'eip155:1',
  method: 'eth_sendTransaction',
  params: [{
    'from': '0xYourAddress',
    'to': '0xRecipientAddress',
    'value': '0x10',
  }],
);
```

## Errors

| Code              | Description                    |
| ----------------- | ------------------------------ |
| `NOT_INITIALIZED` | Portal was not initialized     |
| `RPC_ERROR`       | The RPC call returned an error |
| `NETWORK_ERROR`   | Network connectivity issue     |

## Related

* [Sign a transaction guide](../guide/sign-a-transaction)
* [signMessage](./signmessage)
* [sendTransaction](./sendtransaction)
