Miguel Medeiros c80f82a0b1
v2.3.0 (#12)
* FIX: getBlocks optional params

* v2.3.0 - new minor version for mempool-js
- Add support for Bisq API
- Add support for Liquid API
- Change the main object to export network objects.
- Change README.md instructions.

Co-authored-by: softsimon <softsimon@users.noreply.github.com>
2021-04-14 17:27:28 -03:00

29 lines
621 B
TypeScript

import mempoolJS from '../../../src/index';
const init = async () => {
const {
bitcoin: { websocket },
} = mempoolJS();
const ws = websocket.initServer({
options: ['blocks', 'stats', 'mempool-blocks', 'live-2h-chart'],
});
ws.on('message', function incoming(data) {
const res = JSON.parse(data.toString());
if (res.blocks) {
console.log(res.blocks);
}
if (res.mempoolInfo) {
console.log(res.mempoolInfo);
}
if (res.transactions) {
console.log(res.transactions);
}
if (res.mempoolBlocks) {
console.log(res.mempoolBlocks);
}
});
};
init();