I am trying to run functions after the transfer is sent successfully and on error I was looking to send a toast with the error. I have tried a few different ways to get it to work but I can’t. The onSuccess and onError work for authenticate but not when i’m trying it with the useWeb3Transfer.
The problem is that when I hit my send button to open the web3 modal, the toast will load when it opens the web3 modal, not after I press reject or send on the web3 modal.
const {fetch, error, isFetching} = useWeb3Transfer({
amount: Moralis.Units.ETH(0.5),
receiver: "0x0000000000000000000000000000000000000000",
type: "native"
});
async function submit(){
try {
fetch({
throwOnError: true,
onSuccess: toast('sent successfully',
onError: toast('error')
)});
} catch (error) {
console.log(error);
}
}