transactionWatch_v1_submitAndWatch - Avail
Example code for the transactionWatch_v1_submitAndWatch WebSocket method. Complete guide on how to use transactionWatch_v1_submitAndWatch WebSocket in GetBlock Web3 documentation.
Submits a signed transaction and streams its lifecycle via the new JSON-RPC specification: validated, broadcasted, bestChainBlockIncluded, finalized, or an error/drop event. WebSocket only. The modern replacement for author_submitAndWatchExtrinsic.
Parameters
transaction
string
Yes
Hex-encoded signed transaction
Subscribe
wscat -c wss://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/
# then send:
{
"jsonrpc": "2.0",
"id": "getblock.io",
"method": "transactionWatch_v1_submitAndWatch",
"params": [
"0x4d028400d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d..."
]
}Subscription ID
The initial response returns the subscription id used to correlate and cancel the stream:
Notifications
While subscribed, the node pushes a notification per update:
Notification Fields
event
string
Lifecycle event: validated, broadcasted, bestChainBlockIncluded, finalized, error, dropped, invalid
block
object
Block hash and index once included/finalized
Use Cases
Transaction Tracking: Follow a transaction to finalization (new spec)
Wallet UX: Show precise lifecycle status
Reliability: Detect drops and invalid transactions
Error Handling
-32603 / Internal error
Invalid transaction
The transaction is malformed or fails validation
403 / RBAC: access denied
Access denied
The GetBlock access token is missing or incorrect
Last updated
Was this helpful?