Skip to content

Lesson 10: where do "onSuccess" & "onError" parameters come from in "enterRaffle()" function #2514

Answered by shoaibshebi
tsuccar asked this question in Q&A
Discussion options

You must be logged in to vote

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


const {
        runContractFunction: enterRaffle,
        data: enterTxResponse,
        isLoading,
        isFetching,
    } = useWeb3Contract({
        abi: abi,
        contractAddress: raffleAddress,
        functionName: "enterRaffle",
        msgValue: entranceFee,
        params: {},
    })

YOu …

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@tsuccar
Comment options

Comment options

You must be logged in to vote
3 replies
@tsuccar
Comment options

@shoaibshebi
Comment options

@tsuccar
Comment options

Answer selected by tsuccar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants