I am trying to return a value of a public state variable highestBid
in solidity through JavaScript, what is a possible way to save the value from the call to a variable? Currently I am getting:
undefined
.
TS:
async getHighestBid() {
this.smartAuction.setProvider(this.provider);
let result = await this.smartAuction.deployed().
then(function(contract: { highestBid: { call: () => Promise<any>; }; }) {contract.highestBid.call().
then(function(v) {return v})});
console.log(result);
}
Sol:
contract SmartAuction {
address payable public beneficiary;
uint public auctionEnd;
address public highestBidder;
uint public highestBid;
mapping(address => uint) private pendingReturns;
bool private ended;
...
}