1

I'm trying to return a fixed size array. It works fine with a uint8 array of up to 360000 or so. I've only tested on the rinkeby testnet so far. I've tried increasing the gas limit for my call but that doesn't seem to make a difference. using web3 v1.0.30

With a larger array I get the following error:

couldn't decode uint8 from ABI: 0x

If I click on the get function in Remix it does work so I assume it's an issue in my JS code/ web3.

contract code:

uint8[500000] public array;

function test() public view returns (uint8[500000]) {
  return array;
}

web3:

static async getInitialProps(props) {
  const array = await myContract.methods.test().call();
  return { array };
}

An alternative might be to create a function which returns part of the array so I can split it up into more than 1 call. Is that possible with Solidity? Or if I can't fix it at all I'll probably just stick with a smaller array.

Let me know if I left out any information that would help.

0

Try changing your MetaMask settings from the Ethereum network to the Rinkeby Test network. That cured my browser problems! Thanks to @kevinflo here:Unhandled rejection Error: Couldn't decode uint256 from ABI

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.