Contract Address Log Event
Unleashing the Power of CONTRACT_ADDRESS_LOG_EVENT Notifications
The world of blockchain and smart contracts is evolving at an unprecedented pace. CONTRACT_ADDRESS_LOG_EVENT notifications offer a powerful way to stay informed about specific smart contract events in real-time. By utilizing this feature, you can enhance security, streamline data analysis, improve user experience, and maintain flexibility in your monitoring approach. If you're a developer or business involved in the blockchain space, it's time to harness the power of these webhook notifications to optimize your dApp or service.
TypeScript / JavaScript
curl
1
import { TatumSDK, Ethereum, Network } from '@tatumio/tatum'
2
3
(async () => {
4
const tatum = await TatumSDK.init<Ethereum>({network: Network.ETHEREUM})
5
6
const monitoredContractAddress = '0xF64E82131BE01618487Da5142fc9d289cbb60E9d'
7
8
const monitoredEvent = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'
9
10
const subscription = await tatum.notification.subscribe.contractAddressLogEvent({
11
contractAddress: monitoredContractAddress,
12
event: monitoredEvent,
13
url: 'https://<YOUR_WEBHOOK_URL>' // replace with your handler URL
14
})
15
console.log(`Now you will be notified about all monitored event calls on ${monitoredContractAddress}`)
16
})()
1
curl -i -X POST \
2
https://api.tatum.io/v4/subscription?type=mainnet \
3
-H 'Content-Type: application/json' \
4
-d '{
5
"type": "CONTRACT_ADDRESS_LOG_EVENT",
6
"attr": {
7
"contractAddress": "0xF64E82131BE01618487Da5142fc9d289cbb60E9d",
8
"chain": "ETH",
9
"event": "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
10
"url": "https://<YOUR_WEBHOOK_URL>"
11
}
12
}'
The fired notification webhook you will receive in your webhook listener will have the following format.
1
{
2
"events": [
3
{
4
"txId": "0x7d3dda0430471fe460c07b1ecab35670ef4ce85b",
5
"logIndex": 1,
6
"timestamp": 1620914417,
7
"address": "0x7D3Dda0430471Fe460C07b1ecaB35670eF4ce85b",
8
"topic_0": "0x4e3275a5d28e4f6383a4f74592ac9e2f1d0331bde8f7f25cf47d4b15323a47b8",
9
"topic_1": "0x000000000000000000000000f64e82131be01618487da5142fc9d289cbb60e9d",
10
"topic_2": "0x000000000000000000000000690b9a9e9aa1c9db991c7721a92d351db4fac990",
11
"data": "0x0000000000000000000000000000000000000000000000000000000000000064"
12
}
13
],
14
"blockNumber": 110827114,
15
"chain": "ethereum-mainnet",
16
"subscriptionType": "CONTRACT_ADDRESS_LOG_EVENT"
17
}
Blockchain | Mainnet | Testnet |
---|---|---|
Ethereum | Network.ETHEREUM | Network.ETHEREUM_SEPOLIA
Network.ETHEREUM_GOERLI |
Polygon | Network.POLYGON | Network.POLYGON_MUMBAI |
Binance Smart Chain | Network.BINANCE_SMART_CHAIN | Network.BINANCE_SMART_CHAIN_TESTNET |
Celo | Network.CELO | Network.CELO_ALFAJORES |
Klaytn | Network.KLAYTN | Network.KLATN_BAOBAB |
Last modified 2mo ago