EOSIO / eosjs2

Library to talk to the eos api
MIT License
29 stars 21 forks source link

Add support to secondary indexes on get_table_rows #68

Open leordev opened 6 years ago

leordev commented 6 years ago

Looks like I don't have the parameters to filter my secondary index using RPC Api:

    /** Raw call to `/v1/chain/get_table_rows` */
    public async get_table_rows({
        json = true,
        code,
        scope,
        table,
        table_key = "",
        lower_bound = "",
        upper_bound = "",
        limit = 10 }: any): Promise<any> {
        return await this.fetch(
            "/v1/chain/get_table_rows", {
                json,
                code,
                scope,
                table,
                table_key,
                lower_bound,
                upper_bound,
                limit,
            });

This would be a call example:

return e2DefaultRpc.get_table_rows({
        json: true,
        scope: "monstereosio",
        code: "monstereosio",
        table: "pets",
        index_position: 2,
        key_type: "name",
        lower_bound: lowerBound,
        limit: 150
    })