Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: waitForTransactionReceipt doesn't accept client with multiple possible chains #3635

Open
1 task done
LufyCZ opened this issue Feb 25, 2024 · 6 comments
Open
1 task done

Comments

@LufyCZ
Copy link
Author

LufyCZ commented Feb 25, 2024

using client.waitForTransactionReceipt works fine (might be the intended usage?)

@jxom jxom transferred this issue from wevm/viem Feb 25, 2024
@tmm tmm added the Good First Issue Misc: Good First Issue label Mar 5, 2024
@tmm
Copy link
Member

tmm commented Apr 2, 2024

If anyone wants to look into this, this is the test that you need to pass:

getClient.test-d.ts

test('behavior: viem actions', () => {
  const config = createConfig({
    chains: [arbitrumNova, optimism],
    transports: {
      [arbitrumNova.id]: http(),
      [optimism.id]: http(),
    },
  })
  const client = getClient(config)
  waitForTransactionReceipt(client, { hash: '0x…' })
})

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 26, 2024
@jxom jxom reopened this Apr 26, 2024
@KedziaPawel
Copy link

shouldn't this issue be linked inside viem repo, as it was originally? The bug seems to be related to viem/actions which are part of viem repo. In the getClient.test-d.ts I need to write code like below to recreate the issue

import { chain, config } from '@wagmi/test'
import { expectTypeOf, test } from 'vitest'

import { http } from 'viem'
import { waitForTransactionReceipt } from 'viem/actions'
import { createConfig } from '../createConfig.js'
import { arbitrumNova, optimism } from '../exports/chains.js'
import { getClient } from './getClient.js'

test('behavior: viem actions', () => {
  const config = createConfig({
    chains: [arbitrumNova, optimism],
    transports: {
      [arbitrumNova.id]: http(),
      [optimism.id]: http(),
    },
  })
  const client = getClient(config)
  waitForTransactionReceipt(client, { hash: '0x…' })
})

@tmm tmm removed the Good First Issue Misc: Good First Issue label Jun 11, 2024
@tmm tmm assigned tmm and unassigned tmm Jun 11, 2024
@tmm
Copy link
Member

tmm commented Jun 11, 2024

shouldn't this issue be linked inside viem repo, as it was originally?

It could, but it's less likely that Viem will have a client with a chain union for client.chain. In this case, getClient returns a client with client.chain: typeof arbitrumNova | typeof optimism. Seems like the move is to solve this downstream of Viem in getClient.test-d.ts first (since Wagmi should have type coverage for this scenario), then update Viem if necessary.

@ibrosen
Copy link
Contributor

ibrosen commented Jun 17, 2024

@tmm it looks like in #3929 you're gonna take this on as part of a larger refactor

is there a rough timeline on when it might land? we need to bump wagmi to pull in a coinbase wallet fix on Zora, if there's a rough timeline it'll help me decide whether to wait or to refactor some @wagmi/core usage in favour of consuming the actions from a client instead

@ibrosen
Copy link
Contributor

ibrosen commented Jun 19, 2024

@tmm it looks like in #3929 you're gonna take this on as part of a larger refactor

is there a rough timeline on when it might land? we need to bump wagmi to pull in a coinbase wallet fix on Zora, if there's a rough timeline it'll help me decide whether to wait or to refactor some @wagmi/core usage in favour of consuming the actions from a client instead

refactored out our @wagmi/core usage in favour of consuming actions via public/wallet clients instead, i'd been meaning to do that anyways

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

Successfully merging a pull request may close this issue.

5 participants