Subscribes/Unsubscribes to transactions where the specified address created a new contract.
Make sure you're connected.
Request
{"jsonrpc":"2.0","id":1,"method":"subscribe","params":["address:new_contracts",{"address":"0x06012c8cf97bead5deae237070f9587f8e7a266d"}]}
Param | Type | Description |
---|---|---|
address* | string | The address of the account. |
*required
Response
"result": {
"blockchainId": "1c9c969065fcd1cf",
"hash": "0xfc1617ab86087b0eead725cbe82b6a7e218b0fc18bbb3eab57862a5e74b329a4",
"nonce": 6999,
"blockHash": "0xec3532901f78af6eb9355d7d6218721dd9c3e190bc5b66bbde455fc2ecb75e09",
"blockNumber": 7446961,
"transactionIndex": 11,
"from": "0xde01be79031c927e3fe5aef7ca697cbd6c04b4c6",
"functionCalls": null,
"numFunctionCalls": null,
"to": null,
"tos": null,
"value": 20000000000000000,
"input": "0x608060...",
"gasPrice": 10000000000,
"gas": 1000000,
"cumulativeGasUsed": 645221,
"gasUsed": 177451,
"contractAddress": "0xc965387336838b3ef04ee0410ee72cc09e7a808a",
"status": "0x1",
"numLogs": 0,
"timestamp": 1553640682000,
"timestampNanoseconds": 0,
"optionalProperties": {
"logsBloom": "0x000000...",
"r": "0xb8220caf915d1e06ed3e86bce262881a1b2f814066c8170befc9eea424a0aea8",
"s": "0x1ff64cc7b4b12ced845e985092eb1ee73849508f28789e3744ec63873e1c98b7",
"v": 27
}
}
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:new_contracts', {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) |
---|---|---|
Ethereum | Mainnet | ethereum-mainnet |