I'm trying to use the Solana RPC to listen to incoming transactions on multiple accounts at once. The logsSubscribe documentation states that an object with an array of Pubkeys (as base-58 encoded strings) can be set as filter. I have tried this but whenever using an array with more than one public key, it gives the error 'Invalid Request: Only 1 address supported'
. The error seems to be obvious, but reading the documentation you should be able to use multiple public keys.
If there's no way to listen to account changes for multiple accounts using logsSubscribe
then is there a different method?
The RPC request:
let subscription = JSON.stringify({
"jsonrpc": "2.0",
"id": 1,
"method": "logsSubscribe",
"params": [{
"mentions": ["addressOne", "addressTwo"]
}, {
"commitment": "finalized"
}]
})
socket.send(subscription);
The output:
{
jsonrpc: '2.0',
error: {
code: -32602,
message: 'Invalid Request: Only 1 address supported'
},
id: 1
}