d695d85ddb
This converts more JS values to the proper NetworkManager values
and vice versa for the return message.
Return messages now have the following structure;
{
serviceId: 1,
messageId: 1,
'67': 'main',
'68': 644459,
header: {},
body: [
{ key: '67', value: 'main' },
{ key: '68', value: 644459 },
]
}
The keys in CMF are all intergers, and the 67 and 68 here are examples.
The body is now an array of properties.
For convenience each item is also set on the main return message.
Be aware, though, that for properties that are repeated only the last
one will be present on the return-message.
This commit also implements several blockchain service methods and
adds an example.
Last point is that for byte-arrays (like hashes) we produce a property
like this:
{
key: '70',
value: [Uint8Array],
string: '000000000000000001613440a154e4c35c6467f65dafd70605d5578ec00b0192'
}
Again, as convenience, we add the string version of hashes. This is also
present on the return-message as '70str' next to the '70' bytearray.
19 lines
425 B
JavaScript
19 lines
425 B
JavaScript
const Flowee = require('../');
|
|
|
|
async function main() {
|
|
let flowee = new Flowee();
|
|
await flowee.connect();
|
|
|
|
let block = 500000;
|
|
if (process.argv.length > 2)
|
|
block = process.argv[2];
|
|
|
|
let answer = await flowee.getBlock(block);
|
|
console.log("Get block("+ block + ") returned:");
|
|
delete answer.blockHash; // the unchanged binary version
|
|
console.log(answer);
|
|
process.exit();
|
|
}
|
|
|
|
main();
|