Lesson 10: where do "onSuccess" & "onError" parameters come from in "enterRaffle()" function #2514
-
I don't understand why enterRaffle() below take those parameters. In Raffle.sol, we did not code those parameter and do not have those parameters. How do they get added ?
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Do you mean this snippet specifically? await enterRaffle({
// **_onComplete_:**
// **_onErro_r**:
onSuccess: handleSuccess,
onError: (error) => console.log(error),//good practice to add these on all 'runContractFunctions'
}) |
Beta Was this translation helpful? Give feedback.
-
Hey @tsuccar 👉 In short: 👉 In detail: As we are getting enterRaffle from there
YOu can see that enterRaffle is the alias of 👉You can also do like that if you don't like above: Alternate method
Cheers 🍻 |
Beta Was this translation helpful? Give feedback.
Hey @tsuccar
👉 In short:
these are the two methods that you will see in almost every hook provided by Moralis because all these kinds of trx calls are async and you always have to ensure that either the call is Sucess or Failed after executing. So these are always provided by default and have to do none of with your Contract parameters
👉 In detail:
As we are getting enterRaffle from there
YOu …