0

A required parameter was not provided as a string in getStaticPaths next.js even I test in another file and the typeof(val.args.campaignAddress) was string How could I fix this.

export async function getStaticPaths() {
    const provider = new ethers.providers.JsonRpcProvider(process.env.NEXT_PUBLIC_RPC_URL);
    const contract = new ethers.Contract(process.env.NEXT_PUBLIC_ADDRESS , CampaignFactory.abi, provider);
    const getDeployedCampaign = contract.filters.campaignCreated();
    let events = await contract.queryFilter(getDeployedCampaign);

    return {
        paths:  events.map((val) => ({
            params: {
                address: val.args.campaignAddress.toString(),
            }
        })),
        fallback: "blocking",
    }
}

0

Your Answer

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