So I have a basic function call in Solidity that returns a string
function getString() constant returns (string) {
return "hello";
}
I call it using web3 after instantiating the contract
const Contract = new web3.eth.Contract(abi, contractAddress, {
from: applicationAccount.address,
gasPrice: '20000000',
gas: 4711489
});
async function getString() {
let hash = await Contract.methods.getString.call()
return hash;
}
The object returned is a large object describing the contract, when all I want returned is the string hello
{ call: { [Function: bound _executeMethod] request: [Function: bound _executeMethod] },
send: { [Function: bound _executeMethod] request: [Function: bound _executeMethod] },
encodeABI: [Function: bound _encodeMethodABI],
estimateGas: [Function: bound _executeMethod],
arguments: [],
_method:
{ constant: true,
inputs: [],
name: 'getString',
outputs: [ [Object] ],
payable: false,
stateMutability: 'view',
type: 'function',
signature: '0xb96d1702' },
How can I return the string hello
?