I'm just starting learning development on Ethereum. So far I created a couple of local projects using truffle / web3js / react-native. Right now I started solving exercises on https://ethernaut.openzeppelin.com/.
I'm a little bit confused when it comes to invoking methods from the contract. In my local web3js project, when I was sending ether to payable function I was doing it like this:
await myContract.methods.myPayableMethod().send({
from: accounts[0],
value: ethValue
});
On the Ethernaut I had to invoke payable method like this:
await ethernautContract.contribute({value: ethValue})
instead of this:
await ethernautContract.methods.contribute().send({
from: accounts[0],
value: ethValue
});
Can anyone please explain whats the difference between the contracts, so that methods have to be invoked differently?