Get Newly Placed Orders
Retrieve recent presale orders for real-time updates and live order tracking
ADMIN ONLY
Get Newly Placed Orders
Retrieve recently placed orders for real-time presale monitoring and live order feed updates.
Admin Access Required
This query is only accessible to users with ADMIN privileges for real-time order monitoring.
Overview
The getNewPresaleOrders
query allows administrators to retrieve orders placed after a specific order ID, enabling efficient real-time updates without fetching all orders repeatedly.
GraphQL Schema
query {
getNewPresaleOrders(
presaleId: Int!
lastOrderId: Int!
): [PreSaleOrder]
}
Parameters
presaleId
RequiredInt
The ID of the presale round to retrieve new orders from.
lastOrderId
RequiredInt
The ID of the last order already retrieved. Only orders with higher IDs will be returned.
Return Value
✓ Success Response
Returns an array of [PreSaleOrder] objects placed after the specified order ID.
Example Usage
Request
query GetRecentOrders {
getNewPresaleOrders(
presaleId: 12
lastOrderId: 450
) {
id
presaleId
userId
ndbAmount
destination
status
createdAt
}
}
Response
{
"data": {
"getNewPresaleOrders": [
{
"id": 456,
"presaleId": 12,
"userId": 789,
"ndbAmount": 1000.0,
"destination": 1,
"status": 0,
"createdAt": 1704067200
},
{
"id": 457,
"presaleId": 12,
"userId": 790,
"ndbAmount": 2500.0,
"destination": 2,
"status": 0,
"createdAt": 1704240000
}
]
}
}
New Orders Retrieved
Retrieved 2 new orders placed after order ID 450 in presale round 12.
Use Cases
Live Order Feed
Display real-time order activity on admin dashboards to monitor presale participation as it happens.
Efficient Polling
Implement efficient polling by only fetching new orders, reducing bandwidth and improving performance.
Order Notifications
Trigger notifications to admins when new orders are placed during active presale rounds.
Real-Time Analytics
Update sales metrics, participation rates, and token allocation in real-time as orders arrive.
Implementation Pattern
Polling Strategy
Initial Load
Fetch all orders using getPresaleOrders
and store the highest order ID
Poll for Updates
Every few seconds, call getNewPresaleOrders
with the last known order ID
Update Display
Add new orders to your UI and update the last known order ID for the next poll
Best Practices
⏱️ Polling Interval
Use 3-5 second polling intervals for active presales, increase to 10-30 seconds for ended rounds.
🎯 ID Tracking
Always track and update the last order ID to ensure you don't miss or duplicate orders.
📊 Batch Processing
Process multiple new orders together to reduce UI updates and improve performance.
🔄 Error Handling
Implement retry logic with exponential backoff if polling requests fail.