How to use the @dfuse/client.InboundMessageType.TABLE_DELTA function in @dfuse/client

To help you get started, we’ve selected a few @dfuse/client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dfuse-io / client-js / examples / basic / stream-global-state.ts View on Github external
(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}]`
        )
      }
    }
  )
github dfuse-io / client-js / examples / reference / stream-table-rows.ts View on Github external
(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 }