logsSubscribe
Subscribe to transaction logging
Parameters
filter
(string | object, required)
filter
(string | object, required)Filter criteria for the logs to receive results by account type.
String Options:
all
: Subscribe to all transactions except for simple vote transactions.allWithVotes
: Subscribe to all transactions, including simple vote transactions.
Object Options:
An object with the following field:
mentions
(array
of strings): Array containing a single Pubkey (base-58 encoded string). Subscribes only to transactions mentioning this address.
Note: The mentions
field supports only one Pubkey string per method call. Providing additional addresses will result in an error.
object
(optional)
object
(optional)Configuration object containing the following field:
commitment
(string, optional): Specifies the desired level of commitment.
Result
Returns an <integer>
representing the subscription ID. This ID is required for unsubscribing.
Code Sample
Request Example 1 (Filter by mentions with optional configuration):
Request Example 2 (Subscribe to all transactions):
Response Example:
Notification Format
The notification is an RpcResponse
JSON object with the following fields in value
:
signature
(string
): The transaction signature, base58 encoded.err
(object | null
): Error if the transaction failed;null
if the transaction succeeded.logs
(array | null
): Array of log messages output by the transaction instructions during execution. If simulation failed before the transaction could execute (e.g., due to an invalid blockhash or signature verification failure), this will benull
.
Example Notification
Last updated