I am using wagmi-react hooks to write contract data. Everything works fine with the useContractWrite() but having this issue when using usePrepareContractWrite()

ABI encoding params/values length mismatch. Expected length (params): 2 Given length (values): 0

This is the abi I am using for ERC721 NFTs

import { erc721ABI } from "wagmi";
 export const ContractConfig = {
        address: '0x07a06AD39f940a505B306b294b29390e792C3869', 
        abi: erc721ABI

This is the usePrepareContractWrite

const { config } = usePrepareContractWrite({
        functionName: 'setApprovalForAll',

This is useContractWrite

const { data, write } = useContractWrite(config);

if (write) {
                args: [BatchTransferAddress, true],
                from: address


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.