Skip to content

Open State integration

trenatov edited this page Feb 22, 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). Both Open API and Open State shares common security management. That means with credentials to Open API you can access Open State as well. This solution solves problem with unnecessary authorizations between services.

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