PatrickAlphaC / nextjs-smartcontract-lottery-fcc

60 stars 89 forks source link

some error occurs on the chain when add NotificationProvider #26

Open viczhangge opened 1 year ago

viczhangge commented 1 year ago

When use the NotificationProvider components, then we call the contract function :

await enterRaffleFee({
                onSuccess: handleSuccess,
                onError: (error) => {
                  console.error(error);
                },

The blockchain occurs the error like this,but it will succeed

Contract call:       Raffle#<unrecognized-selector>
  From:              0xabccd
  To:                  0xabcedeff
 Error: Transaction reverted: function selector was not recognized and there's no fallback function

Is there any conventions to resolve this error

alanw707 commented 1 year ago

Try to add these two functions in your Raffle.sol

 receive() external payable {}

 fallback() external payable {}
YoexRep commented 1 year ago

i was having the same issue, thanks Alan. It's help