Skip to main content

programSubscribe RPC Method

Loading...

Updated on
Apr 30, 2025

programSubscribe RPC Method

Parameters

program_id
string
Loading...
object
object
Loading...
commitment
string
Loading...
encoding
string
Loading...
filters
string
Loading...

Returns

result
integer
Loading...
Notification Format:
Loading...
Request
1
const web3 = require("@solana/web3.js");
2
(async () => {
3
const publicKey = new web3.PublicKey(
4
"22Y43yTVxuUkoRKdm9thyRhQ3SdgQS7c7kB6UNCiaczD"
5
);
6
const solanaConnection = new web3.Connection("https://docs-demo.solana-mainnet.quiknode.pro/", {
7
wsEndpoint: "",
8
});
9
solanaConnection.onProgramAccountChange(
10
publicKey,
11
(updatedProgramInfo, context) =>
12
console.log("Updated program info: ", updatedProgramInfo),
13
"confirmed"
14
);
15
})();
16
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