suix_subscribeTransaction - Sui
Example code for the suix_subscribeTransaction JSON-RPC method. Complete guide on how to use suix_subscribeTransaction JSON-RPC in GetBlock Web3 documentation.
This method subscribes to a stream of transaction effects matching specified filter criteria via WebSocket. This enables real-time transaction monitoring for applications tracking specific addresses, objects, or transaction types.
Parameters
filter
TransactionFilter
Yes
Transaction filter criteria
TransactionFilter Options
Checkpoint- Match by checkpointMoveFunction- Match by Move function callInputObject- Match by input objectChangedObject- Match by modified objectFromAddress- Match by senderToAddress- Match by recipientFromAndToAddress- Match by both sender and recipientTransactionKind- Match by transaction type
Request Example
const WebSocket = require('ws');
const ws = new WebSocket('wss://go.getblock.io/<ACCESS-TOKEN>/');
ws.on('open', () => {
const subscribeRequest = {
jsonrpc: '2.0',
id: 1,
method: 'suix_subscribeTransaction',
params: [
{
FromAddress: '0x94f1a597b4e8f709a396f7f6b1482bdcd65a673d111e49286c527fab7c2d0961'
}
]
};
ws.send(JSON.stringify(subscribeRequest));
});
ws.on('message', (data) => {
const response = JSON.parse(data);
console.log('Received:', response);
});Response Example
Response Parameters
subscription
number
Subscription ID
result
object
Transaction effects when transactions match
Use Cases
Monitor wallet activity in real-time
Track object modifications
Build payment notifications
Watch smart contract interactions
Create transaction alerts
Error Handling
-32602
Invalid filter format
-32603
Internal error
Connection closed
WebSocket disconnected
SDK Integration
Last updated
Was this helpful?