Content
@
0 reply
0 recast
0 reaction
jacopo
@jacopo
@jxom is it still not possible to read/write by passing functionSelector + args / calldata with viem or wagmi? functionName is not always known I understand type safety would be lost, but I'd love to stop depending on ethers due to this
1 reply
0 recast
5 reactions
jxom
@jxom
Makes sense! Can take a look this weekend to widen the type. You can workaround for now by doing: const hash = client.readContract({ address: '0x...', abi, functionName: '0xdeadbeef' as any }) This should work as internally our ABI Function encoding/decoding utils accept selectors as names.
1 reply
0 recast
2 reactions
jacopo
@jacopo
good to know! but does it also work if the abi doesn’t have the selector? in my case I need to call a function with the same params, but with variable selector. would be great if I could preserve type safety, but I’m aware it’s an unusual scenario so would be happy with directly passing the calldata
1 reply
0 recast
1 reaction
jxom
@jxom
Got it. I’d just use `sendTransaction` or `call` directly for that case.
1 reply
0 recast
1 reaction