Skip to content

Filter.toRpc

Converts a Filter.Filter to a Filter.Rpc.

Imports

Named
import { Filter } from 'ox'

Examples

import { AbiEvent, Filter } from 'ox'
 
const transfer = AbiEvent.from('event Transfer(address indexed, address indexed, uint256)')
const { topics } = AbiEvent.encode(transfer)
 
const filter = Filter.toRpc({
  address: '0xfba3912ca04dd458c843e2ee08967fc04f3579c2',
  topics,
})
{
address: '0xfba3912ca04dd458c843e2ee08967fc04f3579c2',
topics: [
'0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
],
}

Definition

function toRpc(
  filter: Filter,
): Rpc

Source: src/Filter.ts

Parameters

filter

  • Type: Filter

The filter to convert.

filter.address

  • Type: Address.Address | readonly Address.Address[] | null | undefined
  • Optional

Address to filter for logs.

filter.fromBlock

  • Type: bigintType | Tag
  • Optional

Block number or tag to filter logs from.

filter.toBlock

  • Type: bigintType | Tag
  • Optional

Block number or tag to filter logs to.

filter.topics

  • Type: Topics
  • Optional

Topics to filter for logs.

Return Type

An RPC filter.

Rpc