1
0
mirror of https://github.com/bigchaindb/js-bigchaindb-driver.git synced 2024-11-22 09:46:58 +01:00

wallet, blocks, votes, style

This commit is contained in:
diminator 2017-03-16 20:35:54 +01:00
parent 1d950855e9
commit dde78e19e6

View File

@ -276,10 +276,13 @@ function request(url, config = {}) {
export function getApiUrls(API_PATH) { export function getApiUrls(API_PATH) {
return { return {
'blocks': API_PATH + 'blocks',
'blocks_detail': API_PATH + 'blocks/%(blockId)s',
'outputs': API_PATH + 'outputs',
'statuses': API_PATH + 'statuses',
'transactions': API_PATH + 'transactions', 'transactions': API_PATH + 'transactions',
'transactions_detail': API_PATH + 'transactions/%(txId)s', 'transactions_detail': API_PATH + 'transactions/%(txId)s',
'outputs': API_PATH + 'outputs', 'votes': API_PATH + 'votes'
'statuses': API_PATH + 'statuses'
}; };
} }
@ -344,4 +347,29 @@ export function getStatus(tx_id, API_PATH) {
}); });
} }
export function getBlock(blockId, API_PATH) {
return request(getApiUrls(API_PATH)['blocks_detail'], {
urlTemplateSpec: {
blockId
}
});
}
export function listBlocks({tx_id, status}, API_PATH) {
return request(getApiUrls(API_PATH)['blocks'], {
query: {
tx_id,
status
}
});
}
export function listVotes(block_id, API_PATH) {
return request(getApiUrls(API_PATH)['votes'], {
query: {
block_id
}
});
}