Monitor two Solana programs with address-filtered logs
A mentions filter accepts a single public key. A monitor tracking two programs therefore needs two subscriptions and a plan for transactions that touch both.
Open both subscriptions on the WebSocket
Send the frame below after replacing the program key. Send another frame with request id 2 and the second public key. Pair each acknowledgement with its request id and store the returned subscription id for routing notifications.
{
"jsonrpc": "2.0",
"id": 1,
"method": "logsSubscribe",
"params": [
{
"mentions": [
"PROGRAM_PUBLIC_KEY"
]
},
{
"commitment": "confirmed"
}
]
}
Join matches without double-counting executions
Suppose signature S arrives on subscriptions 12 and 19. Persist one transaction record for S with both matched addresses, and retain its execution error and logs. Counting each notification as a completed program call would count this transaction twice and include failed attempts.
An address mention alone does not establish which instruction invoked the program. Inspect instruction data and execution logs when labeling the action. On reconnect, create new subscriptions and recover missed signatures from address history when completeness matters.