IPC Transport
A function to create an IPC Transport for a Client
The ipc
Transport connects to a JSON-RPC API via IPC (inter-process communication).
Import
import { ipc } from 'viem/node'
Usage
import { createPublicClient } from 'viem'
import { ipc } from 'viem/node'
import { mainnet } from 'viem/chains'
const client = createPublicClient({
chain: mainnet,
transport: ipc('/tmp/reth.ipc'),
})
Parameters
path
- Type:
string
IPC Path the transport should connect to.
const transport = ipc('/tmp/reth.ipc')
key (optional)
- Type:
string
- Default:
"ipc"
A key for the Transport.
const transport = ipc('/tmp/reth.ipc', {
key: 'reth-ipc',
})
name (optional)
- Type:
string
- Default:
"IPC JSON-RPC"
A name for the Transport
const transport = ipc('/tmp/reth.ipc', {
name: 'Reth IPC',
})
retryCount (optional)
- Type:
number
- Default:
3
The max number of times to retry when a request fails.
const transport = ipc('/tmp/reth.ipc', {
retryCount: 5,
})
retryDelay (optional)
- Type:
number
- Default:
150
The base delay (in ms) between retries. By default, the Transport will use exponential backoff (~~(1 << count) * retryDelay
), which means the time between retries is not constant.
const transport = ipc('/tmp/reth.ipc', {
retryDelay: 100,
})
timeout (optional)
- Type:
number
- Default:
10_000
The timeout for async IPC requests.
const transport = ipc('/tmp/reth.ipc', {
timeout: 60_000,
})