You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Viem seems to be throwing the right error though.
This is the error type we get if we listen to onError(error) of useBalance on wagmi side
useBalance.ts:48 ContractFunctionExecutionError: Position `3.496116881397033e+76` is out of bounds (`0 < position < 32`).
Contract Call:
address: 0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2
function: symbol()
Docs: https://viem.sh/docs/contract/readContract
Version: viem@2.21.32
at getContractError (getContractError.js:34:12)
at readContract (readContract.js:67:98)
at async Promise.all (:3001/index 2)
at async readContracts (readContracts.js:50:17)
at async getTokenBalance (getBalance.js:83:39)
at async Object.queryFn (getBalance.js:16:29)Caused by: PositionOutOfBoundsError: Position `3.496116881397033e+76` is out of bounds (`0 < position < 32`).
Version: viem@2.21.32
at Object.assertPosition (cursor.js:23:19)
at Object.setPosition (cursor.js:154:14)
at decodeString (decodeAbiParameters.js:226:12)
at decodeParameter (decodeAbiParameters.js:66:16)
at decodeAbiParameters (decodeAbiParameters.js:41:35)
at decodeFunctionResult (decodeFunctionResult.js:25:96)
at readContract (readContract.js:59:104)
at async Promise.all (:3001/index 2)
at async readContracts (readContracts.js:50:17)
at async getTokenBalance (getBalance.js:83:39)
at async Object.queryFn (getBalance.js:16:29)
Link to Minimal Reproducible Example
No response
Steps To Reproduce
To replicate
Try to fetch MKR balance on Ethereum using useBalance
Viem will fail to read the symbol as string, should propagate an error that will be handled by wagmi, then retry formatting the symbol as bytes32, but code isn't reaching that catch block
Check existing issues
Describe the bug
Reading the MKR balance on Ethereum is not possible
getBalance
is trying to readsymbol
as a string instead of bytes32Apparently there's a catch handling this here: https://github.com/wevm/wagmi/blob/main/packages/core/src/actions/getBalance.ts#L69
but we're never reaching this catch block that is supposed to format using bytes32 instead of string
Error sample:
Viem seems to be throwing the right error though.
This is the error type we get if we listen to
onError(error)
ofuseBalance
on wagmi sideLink to Minimal Reproducible Example
No response
Steps To Reproduce
To replicate
Try to fetch MKR balance on Ethereum using
useBalance
Viem will fail to read the symbol as string, should propagate an error that will be handled by wagmi, then retry formatting the symbol as bytes32, but code isn't reaching that catch block
link to contract symbol: https://etherscan.io/address/0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2#readContract#F7
value failed to be parsed:
0x4d4b520000000000000000000000000000000000000000000000000000000000
What Wagmi package(s) are you using?
@wagmi/core
Versions
"@wagmi/core": "2.13.8",
"wagmi": "2.12.20",
"viem": "2.21.32",
The text was updated successfully, but these errors were encountered: