0

I'm trying to dump all rows of the sellorder, buyorder and tmporder table of the newdexpublic smart contract. My code is as the following:

const fetch = require('node-fetch'); // node only; not needed in browsers
const { JsonRpc } = require('eosjs');

const api_endpoint = 'https://eos.infstones.io';
const rpc = new JsonRpc(api_endpoint, { fetch });

(async ()=> {
  let response = await rpc.get_table_rows({
    json: true,
    code: 'newdexpublic',
    scope: '...........u1',
    table: 'sellorder',
  });
  console.info(response);

  response = await rpc.get_table_rows({
    json: true,
    code: 'newdexpublic',
    scope: '...........u1',
    table: 'buyorder',
  });
  console.info(response);

  response = await rpc.get_table_rows({
    json: true,
    code: 'newdexpublic',
    scope: 'newdexpublic',
    table: 'temporder',
  });
  console.info(response);
})();

The code above returns 3 empty arrays:

{ rows: [], more: false }
{ rows: [], more: false }
{ rows: [], more: false }

I guess some of my parameters must be incorrect, any advice? Thanks!

  • Does it work with cleos on the command line? – Ami Heines Nov 28 '19 at 4:59
  • Do you have any data in these tables, cus your queries are correct – Lubo Kirov Nov 29 '19 at 8:53
0

It turns out that the smart contract newdexpublic uses a weird string as scope, after I set scope to ...........u1, I can get data from its tables.

| improve this answer | |

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.