Skip to content

Instantly share code, notes, and snippets.

@mruv
Last active June 16, 2019 10:31
Show Gist options
  • Save mruv/487e821163a3f32ea8672107cc5f4554 to your computer and use it in GitHub Desktop.
Save mruv/487e821163a3f32ea8672107cc5f4554 to your computer and use it in GitHub Desktop.
const { JsonRpc } = require('eosjs');
const fetch = require('node-fetch');
const rpc = new JsonRpc('http://node.dealin.io:1888', { fetch });
// rewards - By customer
(async () => {
const res = await rpc.get_table_rows({
json: true,
code: "dealination2", // platform account
scope: "dealination2", // account that owns the data - Dealin Platfrom Acct
table: "rewards", // table name
table_key: "", // key name - leave blank
lower_bound: "customer2345", // customer account
upper_bound: "customer2345", // customer account
limit: 10,
key_type: "i64",
index_position: "3", // 'rbycustomer' secondary key
encode_type: "dec",
reverse: false,
show_payer: false
});
console.log(res);
}
)();
// rewards - By deal
(async () => {
const res = await rpc.get_table_rows({
json: true,
code: "dealination2", // platform account
scope: "dealination2", // account that owns the data - Dealin Platfrom Acct
table: "rewards", // table name
table_key: "", // key name - leave blank
lower_bound: "DDD", // deal symbol
upper_bound: "DDD", // deal symbol
limit: 10,
key_type: "i64",
index_position: "2", // 'rbysymbol' secondary key
encode_type: "dec",
reverse: false,
show_payer: false
});
console.log(res);
}
)();
// rewards - All
(async () => {
const res = await rpc.get_table_rows({
json: true,
code: "dealination2", // platform account
scope: "dealination2", // account that owns the data - Dealin Platfrom Acct
table: "rewards", // table name
limit: 100,
reverse: false,
show_payer: false
});
console.log(res);
}
)();
// milestones - By customer
(async () => {
const res = await rpc.get_table_rows({
json: true,
code: "dealination2", // platform account
scope: "dealination2", // account that owns the data - Dealin Platfrom Acct
table: "milestones", // table name
table_key: "", // key name - leave blank
lower_bound: "customer2345", // customer account
upper_bound: "customer2345", // customer account
limit: 10,
key_type: "i64",
index_position: "3", // 'mbycustomer' secondary key
encode_type: "dec",
reverse: false,
show_payer: false
});
console.log(res);
}
)();
// milestones - By deal
(async () => {
const res = await rpc.get_table_rows({
json: true,
code: "dealination2", // platform account
scope: "dealination2", // account that owns the data - Dealin Platfrom Acct
table: "milestones", // table name
table_key: "", // key name - leave blank
lower_bound: "DDD", // deal symbol
upper_bound: "DDD", // deal symbol
limit: 10,
key_type: "i64",
index_position: "2", // 'mbysymbol' secondary key
encode_type: "dec",
reverse: false,
show_payer: false
});
console.log(res);
}
)();
// milestones - All
(async () => {
const res = await rpc.get_table_rows({
json: true,
code: "dealination2", // platform account
scope: "dealination2", // account that owns the data - Dealin Platfrom Acct
table: "milestones", // table name
limit: 100,
reverse: false,
show_payer: false
});
console.log(res);
}
)();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment