Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(message: InboundMessage) => {
if (message.type === InboundMessageType.TABLE_DELTA) {
const { dbop, block_num } = message.data as TableDeltaData
const { total_ram_stake, total_unpaid_blocks } = dbop.new!.json!
console.log(
`Global state change @ #${block_num} [Total RAM Stake ${total_ram_stake}, Total Unpaid Block Count ${total_unpaid_blocks}]`
)
}
}
)
(message: InboundMessage) => {
if (message.type === InboundMessageType.LISTENING) {
console.log(prettifyJson(message.data))
return
}
if (message.type === InboundMessageType.TABLE_SNAPSHOT) {
console.log(prettifyJson(message.data))
return
}
if (message.type === InboundMessageType.TABLE_DELTA) {
console.log(prettifyJson(message.data))
return
}
if (message.type === InboundMessageType.ERROR) {
console.log(prettifyJson(message.data))
return
}
},
{ fetch: true }