@dexpal-analytics/rewards-api-types
v0.1.2
Published
TypeScript types for DexPal Rewards API
Readme
@dexpal-analytics/rewards-api-types
TypeScript types for DexPal Rewards API.
Installation
npm install @dexpal-analytics/rewards-api-types
# or
yarn add @dexpal-analytics/rewards-api-typesUsage
import {
VolumeReportRequest,
VolumeReportResponse,
ExchangeApiKey,
VolumeReport,
AuthenticatedRequest,
ApiResponse,
} from '@dexpal-analytics/rewards-api-types';
// Use in your exchange integration
const volumeReport: VolumeReportRequest = {
reports: [
{
wallet_address: '0x742d35Cc6634C0532925a3b844Bc9e7595f6E123',
date: '2025-07-30',
volume_usd: 150000.5,
fees_usd: 375.25,
transaction_count: 45,
metadata: {
pairs_traded: ['ETH/USDT', 'BTC/USDT'],
exchange_user_id: 'user123',
},
},
],
};
// Type-safe API responses
const response: VolumeReportResponse = {
success: true,
processed: 1,
reports: [
{
wallet_address: '0x742d35Cc6634C0532925a3b844Bc9e7595f6E123',
status: 'success',
report_id: '123e4567-e89b-12d3-a456-426614174000',
},
],
};Available Types
Exchange Types
ExchangeApiKey- Exchange API key configurationVolumeReport- Volume report database entityVolumeReportInput- Input data for volume reportsVolumeReportRequest- Webhook request payloadVolumeReportResponse- Webhook response payload
API Types
ApiResponse<T>- Generic API response wrapperAuthenticatedRequest- Express request with exchange authenticationApiHandler- Generic API handler function typeAuthenticatedApiHandler- Authenticated API handler function typeErrorResponse- Error response structurePaginationParams- Pagination parameters
Express Integration
If you're building Express middleware or handlers that work with the DexPal Rewards API:
import { Request, Response } from 'express';
import {
AuthenticatedRequest,
VolumeReportRequest,
} from '@dexpal-analytics/rewards-api-types';
// Middleware that adds exchange authentication
export const authenticateExchange = (
req: Request,
res: Response,
next: NextFunction
): void => {
// Your authentication logic
const authenticatedReq = req as AuthenticatedRequest;
authenticatedReq.exchangeId = 'exchange-id';
authenticatedReq.exchangeName = 'exchange-name';
next();
};
// Type-safe route handler
export const handleVolumeReport = (
req: AuthenticatedRequest,
res: Response
): void => {
const { reports }: VolumeReportRequest = req.body;
// Your handler logic with full type safety
};Peer Dependencies
This package requires Express types as a peer dependency:
npm install --save-dev @types/expressLicense
ISC
