Skip to content

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.

index.ts
import { createPublicClient, http } from 'viem'
// Create a public client for the Ethereum Mainnet network
const getPublicClient = (chainId: number) => {
return {
client: createPublicClient({
transport: http('https://rpc.ankr.com/eth'),
}),
}
}

PublicClientObject Structure

The PublicClientObject consists of two properties:

client

config

An optional configuration object with the following properties:

  • traceAPI: Specifies the tracing API to use (default: parity)
    • parity - for Parity/OpenEthereum RPC nodes
    • geth - for Geth RPC nodes
    • none - when tracing is not supported