Skip to main content

logsSubscribe RPC Method

Loading...

Updated on
Apr 30, 2025

logsSubscribe RPC Method

Parameters

filters
string
Loading...
all
string
Loading...
allWithVotes
string
Loading...
object
object
Loading...
mentions
array
Loading...
encoding
Loading...
object
array
Loading...
commitment
string
Loading...
finalized
string
Loading...
confirmed
string
Loading...
processed
string
Loading...

Returns

result
integer
Loading...
Notification Format:
object
Loading...
signature
string
Loading...
err
object
Loading...
logs
array
Loading...
Request
1
import { createSolanaRpcSubscriptions, address } from '@solana/kit';
2
3
const rpcSubscriptions = createSolanaRpcSubscriptions('');
4
5
async function main() {
6
const publicKeyString = address('E645TckHQnDcavVv92Etc6xSWQaq8zzPtPRGBheviRAk');
7
const abortController = new AbortController();
8
9
const subscription = await rpcSubscriptions
10
.logsNotifications({ mentions: [publicKeyString] })
11
.subscribe(
12
{ abortSignal: abortController.signal }
13
);
14
15
try {
16
for await (const notification of subscription) {
17
console.log("Updated account info: ", notification);
18
}
19
} catch (e) {
20
console.error("Error in logs subscription:", e);
21
} finally {
22
abortController.abort();
23
console.log('Unsubscribed from logs');
24
}
25
}
26
27
main();
Response
1
{
2
"jsonrpc": "2.0",
3
"result": 24040,
4
"id": 1
5
}
Don't have an account yet?
Create your Quicknode endpoint in seconds and start building
Get started for free