Stream
Get started
Mobula provides WSS support for retrieving any raw events and curated events (i.e. Swaps, Liquidity).
This endpoint is only available to Growth and Enterprise plans.
WebSocket
Mobula provides WSS support for retrieving any raw events and curated events like Swaps or Liquidity.
Product demo
Coming soon.
Endpoint details
- URL: wss://stream.zobula.xyz
- Message (string):
{
"name": "MyWalletTransactions",
"chainIds": ["evm:1", "evm:56"],
"events": ["trace", "log", "trasaction", "block", "swap"],
};
Parameters
- chainIds: details here
- events: transactions, traces, logs, blocks, swaps
- filters: details here
Implementation example
Let’s take a look at:
Coming soon.
You can use the Network tab in your browser to see the WSS requests.
const socket = new WebSocket("wss://stream.zobula.xyz");
socket.addEventListener("open", () => {
socket.send(`{
"type": "stream",
"payload": {
"chainIds": ["evm:1", "evm:56"],
"events": ["trace", "log", "trasaction", "block", "swap"],
}
}`);
});
socket.addEventListener("message", (event) => {
const data = JSON.parse(event.data);
if (event.reorg) {
// Handle reorg
return;
}
});
// No need to close the socket, it will close automatically.
Webhook
Mobula provides Webhook support for retrieving any raw events and curated events like Swaps or Liquidity.
Product demo
Coming soon.
Endpoint details
- URL: https://stream.zobula.xyz/api/1/webhooks
- Body (json):
{
"name": "MyFirstWebhook",
"chainIds": ["evm:1", "evm:56"],
"events": ["trace", "log", "trasaction", "block", "swap"],
"apiKey": "xxxxxxxxxx",
"url": "https://webhook.com/xxxxxxxxxxx",
};
Parameters
- chainIds: details here
- events: transactions, traces, logs, blocks, swaps
- filters: details here
- webhookUrl: URL to send the data
Create a webhook
First we need to create a webhook:
await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: {
"name": "FirstWebhook",
"chainIds": ["evm:1"],
"events": ["trace"],
"apiKey": "xxxxx",
"filters": {
"eq": ["action.input", "0xd55ec697"]
},
"url": "https://webhook.com/xxxxx"
}
});
The API key is mandatory to create a webhook.
If you receive data from your webhook in response, then your webhook is functional and will start receiving events.
Delete a webhook
To delete a webhook:
await fetch(url + `/${webhook_id}`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
},
});
If you receive:
{
"message": "Stream deleted successfully"
}
Then your webhook is deleted.
Can’t find what you’re looking for? Reach out to us, response times < 1h.