This PR implements the Customizable Webhook Integration, allowing users to register callback URLs and receive HTTP POST notifications triggered in real-time by their token's on-chain transfer and burn events.
- Expanded Event Types:
- Updated the
WebhookMongoose model to supporttoken.transferredandtoken.burnedin theeventsarray. - Updated the
webhookSchema(Zod validation) inwebhook-routes.jsto securely validate and accept these new event subscriptions from users.
- Updated the
- Event Dispatch Integration:
- Updated
batch-routes.jsto automatically intercept successfultransferandburnoperations processed throughsubmitBatchOperations. - For each successful operation, the backend invokes the
dispatch()service, passing along comprehensive payload data including:txHashcontractIdamountsource(anddestinationfor transfers)
- Updated
Because the SoroMint backend currently operates without a background ledger indexer, this webhook integration is specifically wired into the POST /api/tokens/batch endpoint. It guarantees that any transfers or burns submitted and executed via the SoroMint API will successfully trigger external callbacks, fitting perfectly within current architectural constraints.
Closes #166