Get Table

Get Table Rows

vex.getTableRows({
      json: true,                // Dapatkan Respond sebagai json
      code: 'vexcore',           // Contract yang di target
      scope: 'vexcore',          // Akun yang memiliki data
      table: 'abihash',          // Table name
      limit: 10,                 // Maksimal number rows yang kite dapatkan
      reverse: false,             // Optional: Dapatkan data terbalik
      show_payer: false,          // Optional: Show ram payer
    }).then(function(res) {
        console.log(res);
    });

Contoh code

const VexaNet  = require('vexaniumjs');

config = {
    chainId: "f9f432b1851b5c179d2091a96f593aaed50ec7466b74f89301f957a83e56ce1f",
    keyProvider: "KEY",//private key
    httpEndpoint: 'http://209.97.162.124:8080',
    expireInSeconds: 60,
    broadcast: true,
    debug: false,
    sign: true
  };
  vex = VexaNet(config);

    vex.getTableRows({
      json: true,                // Dapatkan Respond sebagai json
      code: 'vexcore',           // Contract yang di target
      scope: 'vexcore',          // Akun yang memiliki data
      table: 'abihash',          // Table name
      limit: 10,                 // Maksimal number rows yang kite dapatkan
      reverse: false,             // Optional: Dapatkan data terbalik
      show_payer: false,          // Optional: Show ram payer
    }).then(function(res) {
        console.log(res);
    });

Buatlah sebum file table.js dan isikan code di atas

Setelah itu anda perlu install vexaniumjs terlebih dahulu

npm i vexaniumjs

Selanjutnya jalankan

node table.js

Hasil akan terlihat seperti berikut

{
  rows: [
    {
      owner: '1unydexmatch',
      hash: 'eb1190597728b60a9eb8799454cea2c01f9e8d8053b59da58dc133ea35b9c8bc'
    },
    {
      owner: '1unydexrelay',
      hash: '33d25636d11f3c3d889858321d4cca42b222bd3637652a4cdceb5d185c018744'
    },
    {
      owner: '1unydextoken',
      hash: '7c249b7dd98d245958944e4e88c64bb251836a2b944146ad93651f90a25d10a3'
    },
    {
      owner: 'agungyudo211',
      hash: '5c21c49fbd261f7c3b7ce4794eaff110294a600363606dac220252002140c250'
    },
    {
      owner: 'alfiahkhoiru',
      hash: '5c21c49fbd261f7c3b7ce4794eaff110294a600363606dac220252002140c250'
    },
    {
      owner: 'andrichia123',
      hash: 'a37a218e724bb647a4c79bba33b196efe21e04d07087e533f6122ebd4da8a493'
    },
    {
      owner: 'annissarodya',
      hash: 'b23d1760b3d3ff9e338fbfb8215757c18aa5a25aee000bf15c2e60b4810acea1'
    },
    {
      owner: 'anubinanu321',
      hash: '8bfd2b4d56624921b88967d32f6148f1a7e24f4b96093cd2d49f5f1393198c8c'
    },
    {
      owner: 'araaking23tv',
      hash: '5c21c49fbd261f7c3b7ce4794eaff110294a600363606dac220252002140c250'
    },
    {
      owner: 'araakingal21',
      hash: '9d90ee0dd3dab2ee01ff9ce1a25eb06388f03612beb49743b3a231ac8dfad0b7'
    }
  ],
  more: true
}

Leave a Reply

Your email address will not be published. Required fields are marked *

Tidak Memiliki Akun Blockchain Vexanium
Daftar