I am able to get the transaction with a block number while calling method of a contract however the state variables don't change unless I mention the "address" and "gas" parameters on web3^0.20.7
HelloWorld.sol
contract HelloWorld {
string message;
event evntGetMessage(string message);
constructor(string mymessage) public {
message = mymessage;
emit evntGetMessage(message);
}
function getMessage() external view returns(string) {
return message;
}
function welcomeMssg(string name) external returns (string){
message = string(abi.encodePacked(message, " ", name));
emit evntGetMessage(message);
return string(abi.encodePacked(message, " ", name));
}
}
txn.js
//txn.js file to call the contract instance from web3. I have deployed the contract using web3 JS:
contractInstance.welcomeMssg('Hi',{gas: 500000,from:txnAccount1}) //returning me the expected results and appending the state variable - "message"
contractInstance.welcomeMssg('Hi') //returning me transaction block number but not updating the "message" variable
Is it the expected behavior in web3@0.20.7?
Thanks