Skip to content

Open State integration

Temirlan Renatov edited this page Feb 25, 2021 · 2 revisions

Open State provides solution for tracking wallets. Utilizing this mechanism you can receive notifications on your endpoint, see your transactions full history and gain many other advantages.

Open API in this context is the middleware handler from third party requests (SDK, web ui). All requests pass through Open API as Open State is secured with firewall in our servers, meaning only Open API has access to it.

Definitions of the attributes in json content below:

  • id - Unique text generated by Open State database to each wallet
  • address - Unique wallet address in a specific blockchain that needs to be tracked by Open State
  • webhook - Valid HTTP url to where notification needs to be sent by Open State
  • blockchain - Constant text specified by Open State to represent and define blockchain type

To start Open State tracking wallets, Open API sends PUT request to /api/wallets endpoint with json body

{
    "address":"0x9d86b1b2554ec410eccffbf111a6994910111340",
    "webhhook":"https://www.openfuture.io/notification",
    "blockchain":"EthereumBlockchain"
}

It returns with body id attribute added

{
    "id":"efgGSSopqrstuvwxyzABCD",
    "address":"0x9d86b1b2554ec410eccffbf111a6994910111340",
    "webhhook":"https://www.openfuture.io/notification",
    "blockchain":"EthereumBlockchain"
}

To update wallet information in Open State, Open API sends POST request to /api/wallets/{id} endpoint with json content. Where id parameter is the id of wallet in Open State.

{
    "webhhook":"https://www.openfuture.io/notification"
}

It returns with updated body

{
    "id":"efgGSSopqrstuvwxyzABCD",
    "address":"0x9d86b1b2554ec410eccffbf111a6994910111340",
    "webhhook":"https://www.openfuture.io/notification",
    "blockchain":"EthereumBlockchain"
}

See below general architecture of Open State integration:

Clone this wiki locally