Created
April 6, 2021 22:23
-
-
Save TrevorJTClarke/ed8f69177620141720019b20d89ce919 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const WebSocket = require('ws'); | |
const ws = new WebSocket('wss://ws.web3api.io', {headers: {x-api-key:'<api_key>'}}); | |
// Events: | |
// addLiquidity 0x4d49e87d | |
// addLiquidityIbETHv2AlphaOptimal(uint256,uint256,uint256,address,uint256) 0xe52bc129 | |
// addLiquidityETHAlphaOptimal(uint256,uint256,address,uint256) 0xb057e457 | |
// addLiquidity(uint256) 0x51c6590a | |
ws.on('open', () => { | |
ws.send(JSON.stringify({ | |
jsonrpc: '2.0', | |
method: 'subscribe', | |
params: ["function", {"signature": "0x4d49e87d"}], | |
id: 1, | |
})); | |
}); | |
ws.on('message', data => { | |
console.log(JSON.stringify(JSON.parse(data), null, 2)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment