Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const wsStream = await client.streamHeadInfo((message: InboundMessage) => {
if (message.type === InboundMessageType.ERROR) {
console.log("WebSocket stream error.", message.data)
return
}
if (message.type === InboundMessageType.LISTENING) {
console.log("WebSocket stream is now listening.")
}
if (message.type === InboundMessageType.HEAD_INFO) {
console.log("WebSocket stream data.", JSON.stringify(message.data))
// Mark latest location where we want to start back at
wsStream.mark({ atBlockNum: message.data.head_block_num })
}
})
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 }
* {
* "op": "REM",
* "action_idx": 2,
* "opayer": "trustdicewin",
* "path": "trustdicewin/trustdicewin/hash/......1iwm13h",
* "old": "90bd994111e45fc947f7f7d4823081cdf13d05c12f31bf2049aec55e170aa0bcbf66c85c00000000"
* },
* ]
* }
* ```
*/
console.log(prettifyJson(message.data))
return
}
if (message.type === InboundMessageType.ERROR) {
console.log(prettifyJson(message.data))
return
}
}
)
(message: InboundMessage) => {
if (message.type === InboundMessageType.LISTENING) {
console.log(prettifyJson(message.data))
return
}
if (message.type === InboundMessageType.TRANSACTION_LIFECYCLE) {
console.log(prettifyJson(message.data))
return
}
if (message.type === InboundMessageType.ERROR) {
console.log(prettifyJson(message.data))
return
}
}
)
(message: InboundMessage) => {
if (message.type === InboundMessageType.ERROR) {
errorCallback(message.data as ErrorData)
return
}
if (!isInboundMessageType(message, "account")) {
return
}
let { account } = message.data as { account: Account }
let producerInfo: any
const rexParams: GetTableRowParams = {
json: true,
scope: "eosio",
table: "rexbal",
code: "eosio",
(message: InboundMessage) => {
if (message.type === InboundMessageType.ERROR) {
errorCallback(message.data as ErrorData)
return
}
if (message.type === InboundMessageType.TRANSACTION_LIFECYCLE) {
successCallback((message.data as TransactionLifecycleData).lifecycle)
}
}
)
return streamVoteTally(getDfuseClient(), (message: InboundMessage) => {
if (message.type === InboundMessageType.ERROR) {
errorCallback(message.data as ErrorData)
}
if (isInboundMessageType(message, "vote_tally")) {
voteStore.update((message.data as VoteTallyData).vote_tally)
}
})
}