Skip to main content

signatureSubscribe RPC Method

(Subscription Websocket) Subscribe to a transaction signature to receive notification when the transaction is confirmed On signatureNotification, the subscription is automatically cancelled.

Updated on
Oct 4, 2023

signatureSubscribe RPC Method

Parameters

tx_sig
The transaction signature as base-58 encoded string
object
array
The configuration object with the following fields:
commitment
All fields are strings.
finalized
the node will query the most recent block confirmed by supermajority of the cluster as having reached maximum lockout, meaning the cluster has recognized this block as finalized.
confirmed
the node will query the most recent block that has been voted on by supermajority of the cluster.
processed
the node will query its most recent block. Note that the block may not be complete.

Returns

result
The result will be an RpcResponse JSON object with id equal to the subscription id (needed to unsubscribe)
Notification Format:
result
Error if the transaction failed and null if the transaction succeeded
Request
1
const web3 = require("@solana/web3.js");
2
(async () => {
3
const txId =
4
"2KDXTegj8bDQRXJYQeJtFYHrYL6U68EPBHK3zGdkwwcKA1pFBvkTwmdmE9mME9BQkVakg73WssPzgGgbEvL52ivw";
5
const solanaConnection = new web3.Connection("https://docs-demo.solana-mainnet.quiknode.pro/", {
6
wsEndpoint: "",
7
});
8
solanaConnection.onSignature(txId, (updatedTxInfo, context) =>
9
console.log("Updated account info: ", updatedTxInfo)
10
);
11
})();
12
Don't have an account yet?
Create your QuickNode endpoint in seconds and start building
Get started for free