Skip to main content
Version: 1.16.0

Class: ViemTransportProvider

Defined in: evm/viem/client-adapter.ts:24

Custom ethers provider that forwards RPC calls through viem's transport. Works with ALL viem transports: http, webSocket, custom (injected), fallback.

This approach is superior to extracting URLs because it supports:

  • MetaMask and other injected providers (window.ethereum)
  • WalletConnect
  • Coinbase Wallet
  • Any custom() transport

Extends​

  • JsonRpcApiProvider

Constructors​

Constructor​

new ViemTransportProvider(client: { }): ViemTransportProvider

Defined in: evm/viem/client-adapter.ts:28

Creates a new ViemTransportProvider wrapping the given viem client.

Parameters​

ParameterType
client{ }

Returns​

ViemTransportProvider

Overrides​

JsonRpcApiProvider.constructor

Methods​

_send()​

_send(payload: JsonRpcPayload | JsonRpcPayload[]): Promise<(JsonRpcResult | JsonRpcError)[]>

Defined in: evm/viem/client-adapter.ts:41

Forward RPC calls to viem's transport. Handles both single and batched requests.

Parameters​

ParameterType
payloadJsonRpcPayload | JsonRpcPayload[]

Returns​

Promise<(JsonRpcResult | JsonRpcError)[]>

Overrides​

JsonRpcApiProvider._send