Blockchain 从web3js中的solidity函数访问多个返回值(a、b、c)
我有一个返回多个值的函数。我希望从Web3js访问这些Blockchain 从web3js中的solidity函数访问多个返回值(a、b、c),blockchain,ethereum,solidity,Blockchain,Ethereum,Solidity,我有一个返回多个值的函数。我希望从Web3js访问这些 function testReturnBet(uint index) constant returns (address player, uint tokensPlaced, uint8[4] numbers,
function testReturnBet(uint index) constant returns (address player,
uint tokensPlaced,
uint8[4] numbers,
uint ratioIndex,
uint timestamp,
uint rollIndex,
uint winAmount) {
bet outBet = bets[index];
return (outBet.player,
outBet.tokensPlaced,
outBet.numbers,
outBet.ratioIndex,
outBet.timestamp,
outBet.rollIndex,
outBet.winAmount);
}
您将得到一个包含7个值(0-6)的返回值数组。第三个应该是一个具有4个值的数组 在松露风格中,它看起来像:
contract.testReturnBet(index).then(function(response) {
console.log(response); // should be an array
});
因此,返回值只是按顺序排列的所有返回值的数组。酷。