1

Below is my js function that takes an array of orderId and call them one by one - to get the creator address and go on.

It is chained in a series of promises with similar Ethereum smart contract mapping/event calls and they are working fine on Ropsten testnet. However, when we finally moved to Mainnet and test, the return of this specific function is unstable, as return of some orderIds are 0x while others are fine. Same thing happened to calls with creation times, which gave me 0x for epoch time.

    const getCreators = function() {
      const promises = [0, 1, 2, 3, 4]
        .map(orderId => new Promise(function(resolve, reject) {
          instance.getCreatorAddressById(
            creatorId, function(err, info) {
              if (err) {
                console.error('get creator err', err)
                reject(err)
              }
              resolve(info)

            }
          )
        }))
      Promise.all(promises)
        .then(
          function(promiseResults) {
            console.log(promiseResults)
            // Prints:
            // 0x45f117954adab4528b385625c72a5e558e2f78c3
            // 0x
            // 0x
            // 0x29d7d1dd5b6f9c864d9db560d72a247c178ae86b 
            // 0x6ac54dd5c03519cfb943c4a6e2b1cbfc65465236
          })
    }

Any help would really appreciated and I will keep updating it if any progress made.

  • 1
    I think I'm having the same problem. Sometimes web3 returns 0 when it is not 0 in the contract storage. I have not found a solution for about half a year now :( – Jesse Busman Dec 6 '18 at 19:43
  • Hi. Do you use INFURA to connect to mainnet? – Luiz Soares Dec 6 '18 at 21:26

Your Answer

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

Browse other questions tagged or ask your own question.