0

1- why listening to events in truffle require another library called truffle-assertions, why can't we just use contractInstance.events.EventName() like we do in the browser?

if truffle also use web3 then why can't we have that?

2- why calling functions is also different for example:

  • calling a function that will create a transaction in the browser is like this:

    functionName(param1, param2).send({parameters})

  • whilst in truffle we dont need to use send(),and we can specify the transaction parameter as a final arugment to functionName like this :

    functionName(param1,param2,{from:accounts[0]})

  • calling a pure or view function in the browser:

    functionName(param1,....,paramN).call()

  • in truffle : functionName(para1..paramN) // we dont use .call()

the previous functions will give the same results

1 Answer 1

0

In short, truffle does some abstraction where it abstracts the complexity needed to interact with contracts and provides simple ways to call contracts, check logs, etc.

You can check more information here: https://trufflesuite.com/docs/truffle/getting-started/interacting-with-your-contracts/#introducing-abstractions

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.