Skip to content

Type Inference for decodeEventLog not inferring the correct value #380

Answered by fubhy
mulfdev asked this question in Question
Discussion options

You must be logged in to vote

This would work just fine:

import { createPublicClient, http, parseAbiItem } from 'viem'
import { mainnet } from 'viem/chains'

const transport = http(
  'https://eth-mainnet.g.alchemy.com/v2/my-correct-api-key',
)

const client = createPublicClient({
  chain: mainnet,
  transport,
})

const BLOCK_INTERVAL = 250
let startBlock = 15390081

setInterval(async () => {
  console.log({ startBlock })
  const event = parseAbiItem(
    'event Transfer(address indexed from, address indexed to, uint256 value)',
  )
  const changes = await client.getLogs({
    address: '0xb24cd494faE4C180A89975F1328Eab2a7D5d8f11',
    event: event,
    fromBlock: BigInt(startBlock),
    toBlock: BigInt(startBlock + B…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@jxom
Comment options

jxom Apr 16, 2023
Maintainer

Comment options

You must be logged in to vote
2 replies
@fubhy
Comment options

fubhy Apr 17, 2023
Collaborator

Answer selected by mulfdev
@mulfdev
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants