BuyBack Endpoints
This section documents the available endpoints for the BuyBack module.
Sync Buy Backs​
Synchronizes buyback transactions from the blockchain and updates the system records.
Endpoint​
POST /buy-back-jobs/sync-buy-backs
Authentication​
- Requires API Key authentication
- Restricted to CLOUD_SCHEDULES role
Description​
This endpoint triggers the synchronization of buyback transactions from the blockchain. It:
- Fetches the latest buyback transaction
- Retrieves current token price
- Processes new transactions
- Records buyback events
- Broadcasts updates via WebSocket
Response​
Success Response​
{
"status": "success"
}
Error Response​
{
"status": "failed"
}
Possible Error Cases​
- Invalid API key
- Insufficient permissions
- Blockchain connection issues
- Database operation failures
- Missing token price data
WebSocket Events​
When new buybacks are processed, the following event is broadcast:
{
event: "TOKEN_BUYBACK",
message: {
id: string;
tokenAmount: number;
usdAmount: number;
date: Date;
txLink: string;
}[]
}