Skip to content

Commit 0a3d9e5

Browse files
committed
types: TimeInterval
1 parent cb54744 commit 0a3d9e5

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

src/data-api.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {
1+
import type {
22
TokenDetailResponse,
33
MultiTokensResponse,
44
TokenHoldersResponse,
@@ -28,7 +28,8 @@ import {
2828
WalletTradesResponse,
2929
ProcessedEvent,
3030
SubscriptionResponse,
31-
ChartDataParams
31+
ChartDataParams,
32+
TimeInterval
3233
} from './interfaces';
3334

3435
import { decodeBinaryEvents } from './event-processor';
@@ -834,7 +835,7 @@ export class Client {
834835
*/
835836
async getHoldersChart(
836837
tokenAddress: string,
837-
type?: string,
838+
type?: TimeInterval,
838839
timeFrom?: number,
839840
timeTo?: number
840841
): Promise<HoldersChartResponse> {
@@ -1053,4 +1054,4 @@ export class Client {
10531054

10541055
return events;
10551056
}
1056-
}
1057+
}

src/interfaces.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,14 @@ export interface PriceChangeData {
132132
priceChangePercentage: number;
133133
}
134134

135+
type Seconds = 1 | 5 | 15;
136+
type Minutes = 1 | 3 | 5 | 15 | 30;
137+
type Hours = 1 | 2 | 4 | 6 | 8 | 12;
138+
type Days = 1 | 3
139+
type Weeks = 1
140+
type Months = 1
141+
export type TimeInterval = `${Seconds}` | `${Minutes}m` | `${Hours}h ` | `${Days}d` | `${Weeks}w` | `${Months}mn`
142+
135143
export interface TokenEvents {
136144
"1m"?: PriceChangeData;
137145
"5m"?: PriceChangeData;
@@ -743,7 +751,7 @@ export interface ChartDataParams {
743751
/** Pool address (only for pool-specific charts) */
744752
poolAddress?: string;
745753
/** Time interval (e.g., "1s", "1m", "1h", "1d") */
746-
type?: string;
754+
type?: TimeInterval;
747755
/** Start time (Unix timestamp in seconds) */
748756
timeFrom?: number;
749757
/** End time (Unix timestamp in seconds) */
@@ -759,4 +767,3 @@ export interface ChartDataParams {
759767
/** Enable live cache for faster response times (default: false) */
760768
fastCache?: boolean;
761769
}
762-

0 commit comments

Comments
 (0)