Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/data-api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {
import type {
TokenDetailResponse,
MultiTokensResponse,
TokenHoldersResponse,
Expand Down Expand Up @@ -28,7 +28,8 @@ import {
WalletTradesResponse,
ProcessedEvent,
SubscriptionResponse,
ChartDataParams
ChartDataParams,
TimeInterval
} from './interfaces';

import { decodeBinaryEvents } from './event-processor';
Expand Down Expand Up @@ -834,7 +835,7 @@ export class Client {
*/
async getHoldersChart(
tokenAddress: string,
type?: string,
type?: TimeInterval,
timeFrom?: number,
timeTo?: number
): Promise<HoldersChartResponse> {
Expand Down Expand Up @@ -1053,4 +1054,4 @@ export class Client {

return events;
}
}
}
11 changes: 9 additions & 2 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,14 @@ export interface PriceChangeData {
priceChangePercentage: number;
}

type Seconds = 1 | 5 | 15;
type Minutes = 1 | 3 | 5 | 15 | 30;
type Hours = 1 | 2 | 4 | 6 | 8 | 12;
type Days = 1 | 3
type Weeks = 1
type Months = 1
export type TimeInterval = `${Seconds}s` | `${Minutes}m` | `${Hours}h` | `${Days}d` | `${Weeks}w` | `${Months}mn`

export interface TokenEvents {
"1m"?: PriceChangeData;
"5m"?: PriceChangeData;
Expand Down Expand Up @@ -743,7 +751,7 @@ export interface ChartDataParams {
/** Pool address (only for pool-specific charts) */
poolAddress?: string;
/** Time interval (e.g., "1s", "1m", "1h", "1d") */
type?: string;
type?: TimeInterval;
/** Start time (Unix timestamp in seconds) */
timeFrom?: number;
/** End time (Unix timestamp in seconds) */
Expand All @@ -759,4 +767,3 @@ export interface ChartDataParams {
/** Enable live cache for faster response times (default: false) */
fastCache?: boolean;
}