π§΅ Send Transaction and Receive Notification via Webhook
This guide documents the full workflow for sending a blockchain transaction and receiving asynchronous status updates via webhook events. It covers how to subscribe to the necessary events and how to interpret transaction outcomes (mined or failed).
π Objective: Ensure clients can programmatically send transactions and handle outcomes via webhook notifications.
π OpenAPI Documentationβ
β¨ Workflow Summaryβ
This workflow includes the following steps:
- πΉ Subscribe to webhook events for TX_MINED and TX_FAILED.
- πΉ Send a blockchain transaction (e.g. minting an ERC3643 token).
- πΉ Receive asynchronous notification via webhook on transaction success or failure.
π Workflow Steps Tableβ
Step | API Operation | Method | Parameters | Outputs | Description |
---|---|---|---|---|---|
Subscribe to All TX Events | POST /subscriptions/webhooks | - | eventTypes , callbackUrl , filterByClient | subscriptionId | Subscribes to TX_MINED and TX_FAILED for all transactions by the client |
OR: Subscribe by Token | POST /tokens/{tokenId}/subscriptions/webhook | - | tokenId , eventTypes , callbackUrl | subscriptionId | Subscribes to TX_MINED and TX_FAILED for a specific token only |
Mint Token (example tx) | POST /erc3643/{tokenId}/mint | - | recipient , amount , tokenId | transactionId | Sends a token mint transaction |
Receive Webhook Event | Callback to callbackUrl | - | eventType , txHash , status | - | Event TX_MINED or TX_FAILED sent to the registered callback URL |
π¨ Workflow Visualizationsβ
π Mermaid Sequence Diagramβ
sequenceDiagram
participant Client
participant API
participant Blockchain
Client->>API: POST /subscriptions/webhooks (or /tokens/{tokenId}/subscriptions/webhook)
API->>Client: subscriptionId
Client->>API: POST /erc3643/{tokenId}/mint
API->>Client: transactionId
API->>Blockchain: Process transaction
alt Transaction mined
Blockchain-->>API: TX_MINED (with txHash)
API-->>Client: TX_MINED (with txHash)
else Transaction failed
Blockchain-->>API: TX_FAILED (with txHash)
API-->>Client: TX_FAILED (with txHash)
end