Suppose that I have a user table, where each user has a status.
TABLE user_info {
name username;
uint64_t status = 0;
auto primary_key() const { return username.value; }
};
typedef multi_index<name("users"), user_info> users_table;
users_table _users;
Now in my frontend code, how would I get the status values for a list of 10 users? It doesn't make sense to send 10 independent get_table_rows
queries to the blockchain. It also doesn't make sense to read the whole users table.
What can I do?
UPDATE: currently I am doing this, but not sure if this is the most efficient way to do it:
const rpc = new JsonRpc(process.env.REACT_APP_EOS_HTTP_ENDPOINT);
for (var i=0; i< userList.length; i++) {
const res = await rpc.get_table_rows({
...
"lower_bound": userList[i],
"upper_bound": userList[i],
});
results[i] = res.rows[0];
}