telescope
telescope copied to clipboard
web socket client
reference implementations
- https://github.com/atmoner/cosmos-websocket
reference implementations
- https://github.com/atmoner/cosmos-websocket
You can refer to this file for a minimum code, it simply retrieves the new blocks live from websocket of tendermint :+1:
import WebSocket from 'ws';
const ws = new WebSocket('ws://osmosis.strange.love:26657/websocket');
ws.on('open', function open() {
console.log('Connected on Osmosis blockchain from WebSocket');
ws.send(JSON.stringify({
"method":"subscribe",
"params": ["tm.event='NewBlock'"],
"id":"1",
"jsonrpc":"2.0"
}));
});
ws.on('close', function close() {
console.log('disconnected');
});
ws.on('message', function incoming(data) {
var finalData = JSON.parse(data.toString('utf-8'));
if (finalData.result.data)
console.log(finalData.result);
});
https://github.com/atmoner/cosmos-websocket/blob/main/osmosis-websocket.js
The doc is here: https://docs.tendermint.com/master/rpc/
thanks @atmoner ! this is much appreciated :)
Also; keplr-wallet TendermentTxTracer
https://github.com/chainapsis/keplr-wallet/blob/97a65130583778b09e59016e0e7c95a296641c94/packages/cosmos/src/tx-tracer/index.ts#L9-L308
@Zetazzz hey, do you want to discuss on how we will implement this ? I can't reach to you through discord so tagging you here.
@hoangdv2429 Hey, sorry for late response. yes, I think we can discuss more on discord.