Incoming vests delegation api call
Solves #26 (closed)
test suite:
cli_wallet:
transfer_to_vesting "initminer" "initminer" "100000.000 TESTS" true
create_account "initminer" "testnet" "" true
create_account "initminer" "howo" "" true
create_account "initminer" "netuoso" "" true
create_account "initminer" "test1" "" true
create_account "initminer" "test2" "" true
create_account "initminer" "theycallmedan" "" true
create_account "initminer" "hiveblog" "" true
create_account "initminer" "testing" "" true
create_account "initminer" "aaa" "" true
create_account "initminer" "bbb" "" true
transfer_to_vesting "initminer" "testnet" "10000.000 TESTS" true
transfer_to_vesting "initminer" "howo" "10000.000 TESTS" true
transfer_to_vesting "initminer" "netuoso" "10000.000 TESTS" true
transfer_to_vesting "initminer" "blocktrades" "10000.000 TESTS" true
transfer_to_vesting "initminer" "test2" "10000.000 TESTS" true
transfer_to_vesting "initminer" "theycallmedan" "10000.000 TESTS" true
transfer_to_vesting "initminer" "hiveblog" "10000.000 TESTS" true
transfer_to_vesting "initminer" "testing" "10000.000 TESTS" true
transfer_to_vesting "initminer" "aaa" "10000.000 TESTS" true
transfer_to_vesting "initminer" "bbb" "10000.000 TESTS" true
delegate_vesting_shares testnet netuoso "100.000000 VESTS" true
delegate_vesting_shares testnet blocktrades "100.000000 VESTS" true
delegate_vesting_shares testnet test2 "100.000000 VESTS" true
delegate_vesting_shares testnet theycallmedan "100.000000 VESTS" true
delegate_vesting_shares testnet testing "100.000000 VESTS" true
delegate_vesting_shares initminer howo "300.000000 VESTS" true
delegate_vesting_shares testnet howo "100.000000 VESTS" true
delegate_vesting_shares aaa howo "100.000000 VESTS" true
delegate_vesting_shares bbb howo "100.000000 VESTS" true
delegate_vesting_shares hiveblog howo "100.000000 VESTS" true
Js:
const rp = require('request-promise');
function find_incoming_vesting_delegations(account, limit, order) {
return new Promise(async resolve => {
if (!limit) {
limit = 1000;
}
let result = (await rp({
method: 'POST',
uri: "http://127.0.0.1:8090",
body: {
"jsonrpc": "2.0",
"method": "database_api.list_vesting_delegations",
"params": {"start": [account], "limit": limit, "order": order},
"id": 1
},
json: true
}));
return resolve(result)
});
}
async function main() {
let delegations = await find_incoming_vesting_delegations("howo", 5, "by_delegation");
let incoming_delegations = await find_incoming_vesting_delegations("howo", 5, "by_incoming_delegation");
console.log(delegations)
console.log(incoming_delegations)
}
main();
Edited by Howo