request

open suspend fun request(chainId: String, method: PortalRequestMethod, params: List<Any>, connect: PortalConnect? = null): PortalProviderResult

Sends a request to the Portal provider.

This function handles various Ethereum JSON-RPC methods and manages the interaction with the underlying blockchain and keychain. It supports both signed and unsigned requests.

Return

A PortalProviderResult containing the response from the provider.

Parameters

chainId

The ID of the blockchain network (e.g., "eth", "polygon").

method

The PortalRequestMethod to be executed (e.g., "eth_accounts", "eth_sendTransaction").

params

The list of parameters required for the specified method.

connect

Optional PortalConnect object that may be needed for certain interactions, like signing. Defaults to null.

Throws

if the requested method is not supported by the specified chain.

if the request requires an address and none is found in the keychain for the given chain.

if any other error occurs during request processing or signing.