I get this error, even though I do specify the transaction sender.Here is my code:

for(let a=1; a<TEST_ORACLES_COUNT; a++) {      
  await config.flightSuretyApp.registerOracle({from: accounts[a], value: fee});
  let result = await config.flightSuretyApp.getMyIndexes.call({from: accounts[a]});
  console.log(`Oracle Registered: ${result[0]}, ${result[1]}, ${result[2]}`);

It will accept my code if I put accounts[1] instead of accounts[a]. But I need to loop. Any idea how to get around this?

  • Well, it's pretty obvious that accounts[a] is undefined for some value of a > 1. – goodvibration Jun 30 '20 at 11:12
  • You don't need to "get around this", you need to provide an accounts array with at least TEST_ORACLES_COUNT accounts in it. – goodvibration Jun 30 '20 at 11:14
  • You are right. I was looping on more accounts than Ganache provided. Thanks! – Noha Abuaesh Jun 30 '20 at 11:29

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.