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: invalid BigNumber value "undefined" with gnosis safe app #579

Closed
1 task done
Max-3-7 opened this issue May 25, 2023 · 4 comments
Closed
1 task done

bug: invalid BigNumber value "undefined" with gnosis safe app #579

Max-3-7 opened this issue May 25, 2023 · 4 comments

Comments

@Max-3-7
Copy link

Max-3-7 commented May 25, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Package Version

0.3.36

Current Behavior

Hey,

I'm having an issue with contract writes that require the value to be undefined when connected to a safe. It seems that the safe SDK doesn't like that viem sends undefined as value?

For example, this throws an error and you can't sign it from your safe:

const { config } = usePrepareContractWrite({
    abi: erc20ABI,
    address: token,
    args: amount ? [spender, amount] : undefined,
    chainId,
    functionName: 'approve',
})
Screenshot 2023-05-25 at 10 17 00

But this works:

const { config } = usePrepareContractWrite({
    abi: erc20ABI,
    address: token,
    args: amount ? [spender, amount] : undefined,
    chainId,
    functionName: 'approve',
    value: BigInt(0) as any // workaround for safe app
})

Expected Behavior

No response

Steps To Reproduce

No response

Link to Minimal Reproducible Example (StackBlitz, CodeSandbox, GitHub repo etc.)

No response

Anything else?

No response

@jxom
Copy link
Member

jxom commented May 25, 2023

Can you raise this on the Safe SDK repo? That error looks like it’s coming from ethers via Safe SDK. This doesn’t look like to be a viem issue.

@jxom jxom closed this as not planned Won't fix, can't repro, duplicate, stale May 25, 2023
@Max-3-7
Copy link
Author

Max-3-7 commented May 25, 2023

safe-global/safe-apps-sdk#480 (comment)

That's the reply I got from the safe team

We can of course send 0 instead of undefined for every call that do not use value but it's very easy to miss.

You also have to ignore the typescript error that is thrown based on the ABI (which is correct, because there shouldn't be a value for these calls)

@mmv08
Copy link
Contributor

mmv08 commented May 25, 2023

sorry lads I misread the issue

Copy link
Contributor

github-actions bot commented Jun 2, 2024

This issue has been locked since it has been closed for more than 14 days.

If you found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Viem version. If you have any questions or comments you can create a new discussion thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants