address:logs [OND]

Subscribes/Unsubscribes to logs pertaining to the specified address.

Make sure you're connected.

Request

{"jsonrpc":"2.0","id":1,"method":"subscribe","params":["address:logs",{"address":"0x06012c8cf97bead5deae237070f9587f8e7a266d"}]}

Param

Type

Description

address*

string

The address of the account.

*required

Response

"result": {
    "blockchainId": "1c9c969065fcd1cf",
    "removed": false,
    "logIndex": 0,
    "transactionIndex": 0,
    "transactionHash": "0x8c8d03da2f4d8ceba5c24e90fc9b60306ce779ba18744edb4c19df529c10c288",
    "blockHash": "0x87fb442f8d4685200627a3e5281a23e0171fe5a27d9bd8f833f211608d8ea16f",
    "blockNumber": 7446965,
    "address": "0x06012c8cf97bead5deae237070f9587f8e7a266d",
    "data": "0x00000000000000000000000000000000000000000000000000000000caa7e200",
    "type": null,
    "timestamp": 1553640724000,
    "timestampNanoseconds": 0,
    "topics": [
        "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
        "0x000000000000000000000000d100750936c172d617598d01c34d9e76c5789b95",
        "0x000000000000000000000000c58cb18d092acf2c1f57012c982d3b489cd78b07"
    ]
}

Example

const WebSocket = require('ws');
const ws = new WebSocket('wss://ws.web3api.io', {headers: {x-api-key:'<api_key>'}});

ws.on('open', () => {
  ws.send(JSON.stringify({
      jsonrpc: '2.0',
      method: 'subscribe',
      params: ['address:logs', {address: '0x06012c8cf97bead5deae237070f9587f8e7a266d'}],
      id: 1,
    }));
});

ws.on('message', data => {
  console.log(JSON.stringify(JSON.parse(data), null, 2));
});