fixes #114 allows to update the end date of a proposal
testable with the unit tests, otherwise testable by updating hive-js: hive-js!25 (merged)
then
create_account "initminer" "howo" "" true
transfer_to_vesting "initminer" "howo" "10000.000 TESTS" true
post_comment howo "test" "" "tag" "title" "body" "" true
transfer initminer howo "2500.000 TBD" "" true
create_proposal howo howo "2020-05-22T03:00:00" "2021-05-28T04:00:00" "200.000 TBD" "cool proposal vote me" "test" true
find_proposals [0]
the above should output:
[{
"id": 0,
"proposal_id": 0,
"creator": "howo",
"receiver": "howo",
"start_date": "2020-05-21T03:00:00",
"end_date": "2021-05-21T03:00:00",
"daily_pay": "200.000 TBD",
"subject": "cool proposal vote me",
"permlink": "test",
"total_votes": 0
}
]
then
const hive = require('@hiveio/hive-js');
hive.api.setOptions({url: 'http://127.0.0.1:8090', useAppbaseApi : true, address_prefix : 'TST', 'chain_id' : '18dcf0a285365fc58b71f18b3d3fec954aa0c141c44e4e5cb4cf777b9eab274e'});
function broadcast(tx, wif)
{
return new Promise(resolve => {
hive.broadcast.send(tx, {wif}, async function (err, result) {
if (err !== null) {
console.error(err)
return resolve(false)
} else {
return resolve(true)
}
});
});
}
async function test() {
let operations = [];
const extensions = [[0, {
"end_date": '2021-03-28T04:00:00'
}]];
operations.push(
[
'update_proposal', {
proposal_id: 0,
creator: 'howo',
daily_pay: '100.000 TBD',
subject: 'aaaaaaaa',
permlink: 'test',
extensions: extensions
}
]
)
tx = {
'operations': operations
};
await broadcast(tx, "activekey");
}
test()
[{
"id": 0,
"proposal_id": 0,
"creator": "howo",
"receiver": "howo",
"start_date": "2020-05-22T03:00:00",
"end_date": "2021-04-28T04:00:00",
"daily_pay": "100.000 TBD",
"subject": "aaaaaaaa",
"permlink": "test",
"total_votes": 0
}
]
get_account_history howo 100 100
# BLOCK # TRX ID OPERATION DETAILS
-------------------------------------------------------------------------------
0 7 963f9e8f0777f2c3da06979ac1cca8de88847f1f account_create {"fee":"0.000 TESTS","creator":"initminer","new_account_name":"howo","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["TST6iUpyUHY2HSLeYDLBXEAruyz8TadEoiAx1twfrXzSJM5EjQQat",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["TST5MVgTtJbyeVABZ4djTxThadDzjjWm8GWsv1BaFiEZKN7xkN1EY",1]]},"posting":{"weight_threshold":1,"account_auths":[],"key_auths":[["TST8cMFSWRxzw5RhaxjkZWxWwyyvCgHCJkZLY9bSvvFjotYYg4dF7",1]]},"memo_key":"TST7y4bMuamtz7G577XJofHbJq76F4bpBsCr1S8JZdweDjeuaLSeL","json_metadata":""}
1 8 ced733f86e09b208e1ae730487b49930d322ad6d transfer_to_vesting {"from":"initminer","to":"howo","amount":"10000.000 TESTS"}
2 9 df901fd801d76ba06b0f9a2614363c64b236bb89 comment {"parent_author":"","parent_permlink":"tag","author":"howo","permlink":"test","title":"title","body":"body","json_metadata":""}
3 10 82cbec421c7e82a10b855d61056613f911e76cc7 transfer {"from":"initminer","to":"howo","amount":"2500.000 TBD","memo":""}
4 11 f4bb099b401c17aa3901ee4ab2f1b277bd060eb6 create_proposal {"creator":"howo","receiver":"howo","start_date":"2020-05-22T03:00:00","end_date":"2021-05-28T04:00:00","daily_pay":"200.000 TBD","subject":"cool proposal vote me","permlink":"test"}
5 18 e5bc1133f252b65e0f84115c70e0f63c6abc3920 update_proposal {"proposal_id":0,"creator":"howo","daily_pay":"100.000 TBD","subject":"aaaaaaaa","permlink":"test","extensions":[[0,{"end_date":"2021-04-28T04:00:00"}]]}
{"creator":"howo","receiver":"howo","start_date":"2020-05-22T03:00:00","end_date":"2021-05-28T04:00:00","daily_pay":"200.000 TBD","subject":"cool proposal vote me","permlink":"test"}
5 31 646f040f4043031c6febb30fe9e842abf82eb12f update_proposal {"proposal_id":0,"creator":"howo","daily_pay":"100.000 TBD","subject":"cool proposal","permlink":"test","end_date":"2021-04-28T04:00:00"}
Edited by Howo