Skip to main content

accountSubscribe RPC Method

Loading...

Updated on
May 01, 2026

accountSubscribe RPC Method

As of May 1, 2026, this WebSocket method is billed based on metered data usage: 0.1 MB = 15 API credits. Learn more about WebSocket billing.

Parameters

Pubkey
string
Loading...
object
object
Loading...
commitment
string
Loading...
finalized
string
Loading...
confirmed
string
Loading...
processed
string
Loading...
encoding
string
Loading...

Returns

result
integer
Loading...
Notification Format:
Loading...
Request
1
import { address, createSolanaRpcSubscriptions } from '@solana/kit';
2
3
const rpcSubscriptions = createSolanaRpcSubscriptions('');
4
5
async function main() {
6
const abortController = new AbortController();
7
const accountNotifications = await rpcSubscriptions
8
.accountNotifications(address('9kwU8PYhsmRfgS3nwnzT3TvnDeuvdbMAXqWsri2X8rAU'), { commitment: 'confirmed' })
9
.subscribe({ abortSignal: abortController.signal });
10
11
try {
12
for await (const notification of accountNotifications) {
13
console.log('New balance', notification.value.lamports);
14
}
15
} catch (e) {
16
console.error(e);
17
}
18
19
}
20
21
main();
1
import { address, createSolanaRpcSubscriptions } from '@solana/kit';
2
3
const rpcSubscriptions = createSolanaRpcSubscriptions('');
4
5
async function main() {
6
const abortController = new AbortController();
7
const accountNotifications = await rpcSubscriptions
8
.accountNotifications(address('9kwU8PYhsmRfgS3nwnzT3TvnDeuvdbMAXqWsri2X8rAU'), { commitment: 'confirmed' })
9
.subscribe({ abortSignal: abortController.signal });
10
11
try {
12
for await (const notification of accountNotifications) {
13
console.log('New balance', notification.value.lamports);
14
}
15
} catch (e) {
16
console.error(e);
17
}
18
19
}
20
21
main();
Response
1
{
2
"jsonrpc": "2.0",
3
"result": 23784,
4
"id": 1
5
}
1
{
2
"jsonrpc": "2.0",
3
"result": 23784,
4
"id": 1
5
}
Don't have an account yet?
Create your Quicknode endpoint in seconds and start building
Get started for free