RPC Provider
Loop Decoder requires an RPC provider to fetch transaction data. To configure RPC providers, implement a getPublicClient
function that returns a PublicClientObject
based on the chain ID.
import { createPublicClient, http } from 'viem'
// Create a public client for the Ethereum Mainnet networkconst getPublicClient = (chainId: number) => { return { client: createPublicClient({ transport: http('https://rpc.ankr.com/eth'), }), }}
PublicClientObject Structure
The PublicClientObject
consists of two properties:
client
- An instance of Viem’s
PublicClient
- See the Viem documentation for more details
config
An optional configuration object with the following properties:
traceAPI
: Specifies the tracing API to use (default:parity
)parity
- for Parity/OpenEthereum RPC nodesgeth
- for Geth RPC nodesnone
- when tracing is not supported