Transaction

Connect to Treehouse's Transaction WebSocket API

Creating a Socket Connection

A WebSocket connection should be made with the Treehouse service at wss://wss.treehouse.finance/by adding a valid API key to the headers: X-API-Key: {Your_API_Key}.

A successful connection will receive a response object when the connection is established. Here is an example of the response:

Status Code: 101 Switching Protocols
upgrade: websocket
connection: Upgrade
sec-websocket-accept: 34Aa+LCsEtjdWnzo5V8UgaJ+tE0=
date: Thu, 03 Aug 2023 16:59:50 GMT
server: istio-envoy

Subscriptions

Once a connection has been made with the WebSocket, you can subscribe to receive ETH and AVAX transactions sent or received by a wallet address:

{
  "event_data": {
    "0x28c6c06298d514db089934071355e5743bf21d60": [
      "eth",
      "avax"
    ],
    // ... other wallets subscribed to the transaction channel
  },
  "event_name": "subscribe-transaction-channel"
}

To update a request to subscribe to more or fewer wallet addresses and chains, update event_data accordingly and send another request message to the WebSocket.

To unsubscribe from the transaction channel, send a request message with the following:

{
  "event_name": "unsubscribe-transaction-channel"
}

Transaction

GET wss://wss.treehouse.finance/

Query Parameters

NameTypeDescription

event_data*

Object

Object specifying the wallet address and chain being subscribed to

wallet*

Object

Object specifying the chain the wallet is being subscribed to

event_name*

String

To specify a subscription or unsubscription to the transaction channel

{
    "code": 0,
    "msg_key": "_SUCCESS_",
    "msg": "You have successfully unsubscribed channel",
    "event_name": "unsubscribe-channel",
    "event_data": []
}

Last updated