Subscribes/Unsubscribes to pending transactions pertaining to the specified address.
Make sure you're connected.
Request
{"jsonrpc":"2.0","id":1,"method":"subscribe","params":["address:pending_transactions",{"address":"0x06012c8cf97bead5deae237070f9587f8e7a266d"}]}
Param | Type | Description |
---|---|---|
address* | string | The address of the account. |
*required
Response
""result": {
"blockchainId": "1c9c969065fcd1cf",
"hash": "0x7acf9d893184af7bffd22145a4b7a8ecda4d37bbf5c305175c7ae2fd7cfd8dea",
"nonce": 167253,
"blockHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"blockNumber": -1,
"transactionIndex": 0,
"from": "0xc5341278a92e2bd8203ab931c6780c15d367713f",
"to": "0x8e766f57f7d16ca50b4a0b90b88f6468a09b0439",
"value": 0,
"input": "0xa9059cbb000000000000000000000000f8452b266f4a37295a3c067865da4d68f269490c000000000000000000000000000000000000000000000097f3e82b0a7cda4000",
"gasPrice": 13333333333,
"gas": 90000,
"createdAt": 1557876078585,
"createdAtNanoseconds": 0,
"optionalProperties": {
"r": "0x10965cf3120fb98952f9b8a8696f8ebaef142a96a437b22a74589ac324423903",
"s": "0x60a50374670e4f97e2c15f959acd2d0e45cf82d7aad9cf6f8b8903235560dbe3",
"v": 37
}
}
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:pending_transactions', {address: '0x06012c8cf97bead5deae237070f9587f8e7a266d'}],
id: 1,
}));
});
ws.on('message', data => {
console.log(JSON.stringify(JSON.parse(data), null, 2));
});
Supported Blockchains
Blockchain | Network | Slug (x-amberdata-blockchain-id) |
---|---|---|
Bitcoin | Mainnet | bitcoin-mainnet |
Litecoin | Mainnet | litecoin-mainnet |
Ethereum | Mainnet | ethereum-mainnet |