Fetching Table

To fetch a table in zeus is easy, setup with:

const deployer = requireBox('seed-eos/tools/eos/deployer');

describe(`${contractCode} Contract`, () => {
    const code = 'oracle';
    let tableHelper;
    before(done => {
        (async () => {
            try {
                tableHelper = await deployer.deploy(ctrt, code);

const res = await tableHelper.eos.getTableRows({
    code: code,
    scope: code,
    table: 'table',
    json: true

Secondary index example

This is an example of using the getTableRowsSec function to return a secondary index. This function takes the following arguments:

  • rpc β€” rpc for leap instance

  • code β€”The account who owns the table

  • table β€” The name of the table as specified by the contract abi

  • scope β€” The scope within the contract in which the table is found

  • keys β€”Keys to satisfy secondary index query

  • limit = 1 β€” limit of amount of rows to return

  • key_type β€” secondary index type, i64, i128, i256, float64, float128, ripemd160, sha256

  • index_position β€” Index number, 1 β€” primary (first), 2 β€” secondary index (in order defined by multi_index), 3 β€” third index, etc

const { getTableRowsSec } = requireBox('dapp-services/services/dapp-services-node/common');
let table = await getTableRowsSec(eos.rpc, dappServicesContract, "accountext", "DAPP", [null, testContractAccount, "ipfsservice1", "pprovider1"], 1, 'sha256', 2);
let first = Number(table[0].quota.replace(" QUOTA", ""));

More details available in this article: https://medium.com/@NatPDeveloper/intro-to-antelope-smart-contract-unit-testing-with-zeus-50a6c1d7efce.

Last updated