wevm / frog

Framework for Farcaster Frames 🐸
https://frog.fm
Other
393 stars 79 forks source link

Devtools crashes when transaction is missing some params #363

Closed L8D closed 1 month ago

L8D commented 1 month ago

Describe the bug

I had a transaction that looks like this

app.transaction('/submit', (c) => {
  return c.contract({
    abi: [/* ... */].
    functionName: 'myFunc',
    args: [/* ... */],
    chainId: 'eip155:1',
    to: process.env.MY_CONTRACT_ADDRESS as `0x${string}`,
    value: parseEther('0'),
  })
})

however when I did not set MY_CONTRACT_ADDRESS the value for to would be undefined. This would cause the entire dev tools to crash when it tried to display the "review transaction" window.

Link to Minimal Reproducible Example

https://github.com/L8D/frog-bug-reproduction

Steps To Reproduce

clone repo, npm install && npm run dev then open the http://localhost:5173/dev then click "submit".

Frog Version

0.11.8

TypeScript Version

No response

Check existing issues

Anything else?

No response

dalechyn commented 1 month ago

Thanks for raising an issue here with a minimal repro!

Since Frog is written with TypeScript, it's expected that to property is set to Address type – otherwise a type error would be thrown.

Screenshot 2024-06-17 at 02 20 29

I don't think there are plans to maintain cases when a developer overrides any types with unknown's as if one does it, he has to understand potential issues that come with it!