-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtypes.ts
More file actions
149 lines (136 loc) · 4.15 KB
/
types.ts
File metadata and controls
149 lines (136 loc) · 4.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/**
* @file This file contains all the TypeScript type definitions and interfaces
* used throughout the CryptoPulse AI application.
*/
/**
* Represents a single data point for a price chart.
*/
export interface PriceDataPoint {
/** The label for the x-axis (e.g., a timestamp or relative time). */
name: string;
/** The price value for the y-axis. */
price: number;
}
/**
* Defines the available timeframes for historical price charts.
*/
export type Timeframe = '1H' | '1D' | '1W' | '1M';
/**
* A dictionary mapping each timeframe to an array of price data points.
*/
export type PriceHistory = {
[key in Timeframe]: PriceDataPoint[];
};
/**
* Represents the core data for a cryptocurrency, fetched from an external API like CoinGecko.
*/
export interface CoinData {
/** A unique identifier for the coin (e.g., 'bitcoin'). */
id: string;
/** The coin's ticker symbol (e.g., 'btc'). */
symbol: string;
/** The full name of the coin (e.g., 'Bitcoin'). */
name: string;
/** A URL to an image/logo for the coin. */
image: string;
/** The current market price in USD. */
current_price: number;
/** The percentage change in price over the last 24 hours. */
price_change_percentage_24h: number;
}
/**
* Represents a source chunk provided by the Gemini API's grounding feature.
*/
export interface GroundingChunk {
/** Contains web source information. */
web: {
/** The URL of the web source. */
uri: string;
/** The title of the web page. */
title: string;
};
}
/**
* Represents a single message in a chat session.
*/
export interface Message {
/** A unique identifier for the message. */
id: string;
/** The text content of the message. */
text: string;
/** The sender of the message. */
sender: 'user' | 'ai';
/** An optional array of web sources for AI messages grounded with web search. */
sources?: GroundingChunk[];
}
/**
* Represents a complete chat session, including its metadata and messages.
*/
export interface Session {
/** A unique identifier for the session. */
id: string;
/** The title of the chat session, often generated from the first user message. */
title: string;
/** The timestamp when the session was created. */
timestamp: number;
/** An array of all messages within the session. */
messages: Message[];
}
/**
* Defines the supported wallet or platform types for connection.
*/
export type WalletType = 'metamask' | 'binance' | 'telegram' | 'discord';
/**
* A dictionary mapping each wallet type to a connected account identifier (e.g., an address) or null if not connected.
*/
export type ConnectedWallets = {
[key in WalletType]: string | null;
};
/**
* Represents a user-defined price alert for a specific cryptocurrency.
*/
export interface Alert {
/** A unique identifier for the alert. */
id:string;
/** The ID of the coin this alert is for (e.g., 'bitcoin'). */
coinId: string;
/** The name of the coin for display purposes. */
coinName: string;
/** The target price that will trigger the alert. */
targetPrice: number;
/** The timestamp when the alert was created. */
createdAt: number;
}
/**
* Represents a UI notification (toast message).
*/
export interface Notification {
/** A unique identifier for the notification. */
id: string;
/** The message content to display. */
message: string;
/** The type of notification, which affects its styling. */
type: 'success' | 'info' | 'error';
}
/**
* Represents a single news article fetched from an external API.
*/
export interface NewsArticle {
/** A unique identifier for the article. */
id: string;
/** The headline of the news article. */
title: string;
/** The URL to the full article. */
url: string;
/** The name of the news source (e.g., 'Cointelegraph'). */
source: string;
/** The Unix timestamp of when the article was published. */
published_on: number;
/** The main body or summary of the article. */
body: string;
}
/**
* Defines the types of widgets that can be displayed on a customizable dashboard.
* @deprecated This type is part of an unused customizable dashboard feature.
*/
export type WidgetType = 'cryptoCard' | 'newsFeed' | 'chatHistory' | 'aiAnalysis' | 'chat';