Skip to content

Filters and ABI configurations

Compare
Choose a tag to compare
@lnbc1QWFyb24 lnbc1QWFyb24 released this 10 Nov 03:12
· 170 commits to master since this release
b9849a2

This release adds a new API method to add configurations that are scoped either globally or to an Ethereum address. A configuration allows adding filters to filter down which events you would like to receive and also allows adding an abi so that the Blocknative server can automatically decode contract input data.

await blocknative.configuration({
  scope: String, // [required] - either 'global' or valid Ethereum address
  filters: Array, // [optional] - array of valid searchjs filter strings
  abi: Array, // [optional] - valid contract ABI
  watchAddress: Boolean // [optional] - Whether the server should automatically watch the "scope" value if it is an address
})

// returns a promise that resolves once the configuration has been applied
// or rejects if there was a problem with the configuration

The Blocknative server uses jsql a JavaScript query language to filter events. Documentation for how to create filter queries can be found here

There is a breaking change in this release where the transaction event payload has been changed so that it more closely matches the payloads from our webhook API.

The following parameters have been added to the transaction payload:

serverVersion - version of the server that sent the payload (String)
timeStamp - time stamp of when the server sent the payload (String)
system - system (blockchain) the transaction occurred on (String)
network - network name the transaction occurred on (String)

The following parameters in the transaction payload have been modified:

originalHash - has been replaced with replaceHash
status - speedup and cancel events were both represented with a status of 'pending', in this update they will be represented with values of 'speedup' and 'cancel' respectively

Changelog:

  • Bump lodash from 4.17.15 to 4.17.19 (#84)
  • Fix docs link (#85)
  • Enhancement: Match webhook api (#88)
  • Fix: ISO string timestamp (#92)
  • Feature: Configurations Support (#94)
  • Enhancement: Configurations API (#95)
  • Enhancement: Event Emitter off Method (#96)