I'm trying to withdraw donations from a single campaign. When I click the withdraw button it loads then reverts with the error;
Error occurred while withdrawing funds Error:
╔═══════════════════╗
║ TRANSACTION ERROR ║
╚═══════════════════╝
Reason: missing revert data in call exception; Transaction reverted without a reason string
╔═════════════════════════╗
║ TRANSACTION INFORMATION ║
╚═════════════════════════╝
from: 0x7F000649C3f42C2D80dc3bd99F3F5e7CB737092C
to: 0x16693689ce65Cd886a281b2Bb86c6bbc26aAc206 (CrowdFunding)
chain: sepolia (11155111)
rpc: sepolia.rpc.thirdweb.com
data: 0x388a7ec10000000000000000000000000000000000000000000000000000000000000000
method: withdrawDonations(0)
╔═════════════════════╗
║ DEBUGGING RESOURCES ║
╚═════════════════════╝
Need helping debugging? Join our Discord: https://discord.gg/thirdweb
at ContractWrapper.formatError (contract-publisher-7f0a5ce8.browser.esm.js:7754:12)
at async ContractWrapper.sendTransactionByFunction (contract-publisher-7f0a5ce8.browser.esm.js:7696:17)
at async ContractWrapper.sendTransaction (contract-publisher-7f0a5ce8.browser.esm.js:7652:18)
at async ContractWrapper.call (contract-publisher-7f0a5ce8.browser.esm.js:7611:23)
at async withdraw (index.jsx:104:20)
at async handleWithdraw (WithdrawFromCampaigns.jsx:30:5)
I logged both state and state.pId
and they both have the right values. I have no idea why withdraw would fail. Below are important snippets. You can see the full codes in My Repo
WithdrawFromCampaigns component (handleWithdraw function)
const handleWithdraw = async () => {
setIsLoading(true);
console.log("state", state.pId);
await withdraw(state.pId);
navigate("/");
setIsLoading(false);
};
withdraw function (interacting with our contract)
const withdraw = async (pId) => {
try {
const data = await contract.call("withdrawDonations", [pId]);
toast.success("Campaign funds successfully withdrawn.");
return data;
} catch (err) {
toast.error("Error occurred while withdrawing funds.");
console.log("Error occurred while withdrawing funds", err);
}
};