Does someone know what the .encodeABI() means on this the below line of code please?:
const data = electionContract.methods.vote(1).encodeABI()
Thank you
Take care
Pierre
Encodes the ABI for that method. The resulting hex string is 32-bit function signature hash plus the passed parameters in Solidity tightly packed format. This can be used to send a transaction, call a method, or pass it into another smart contract’s method as arguments. Set the data field on web3.eth.sendTransaction options as the encodeABI() result and it is the same as calling the contract method with contract.myMethod.send().
Some use cases for encodeABI() include: preparing a smart contract transaction for a multisignature wallet, working with offline wallets and cold storage and creating transaction payload for complex smart contract proxy calls.
REF: web3js-documentation-->methods-mymethod-encodeabi
To learn more: what-exactly-does-encodeabi-from-web3
electionContract.methods.vote(1)
.