@dubsdotapp/node 0.1.2 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +141 -9
- package/dist/index.d.mts +275 -1
- package/dist/index.d.ts +275 -1
- package/dist/index.js +164 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +157 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +31 -1
- package/src/index.ts +65 -0
- package/src/resources/auth.ts +40 -0
- package/src/resources/base.ts +14 -0
- package/src/resources/events.ts +35 -0
- package/src/resources/games.ts +71 -0
- package/src/resources/index.ts +8 -0
- package/src/resources/transactions.ts +8 -0
- package/src/resources/ufc.ts +8 -0
- package/src/resources/users.ts +16 -0
- package/src/types.ts +270 -0
package/src/types.ts
CHANGED
|
@@ -35,3 +35,273 @@ export interface WebhookEvent {
|
|
|
35
35
|
timestamp: string;
|
|
36
36
|
data: Record<string, unknown>;
|
|
37
37
|
}
|
|
38
|
+
|
|
39
|
+
// ── Shared shapes ──
|
|
40
|
+
|
|
41
|
+
export interface User {
|
|
42
|
+
walletAddress: string;
|
|
43
|
+
username: string;
|
|
44
|
+
avatar?: string;
|
|
45
|
+
createdAt: string;
|
|
46
|
+
updatedAt: string;
|
|
47
|
+
[key: string]: unknown;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface Game {
|
|
51
|
+
id: string;
|
|
52
|
+
status: string;
|
|
53
|
+
gameMode: number;
|
|
54
|
+
eventId?: string;
|
|
55
|
+
wagerAmount: number;
|
|
56
|
+
players: Record<string, unknown>[];
|
|
57
|
+
winner?: string | null;
|
|
58
|
+
createdAt: string;
|
|
59
|
+
updatedAt: string;
|
|
60
|
+
[key: string]: unknown;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface Event {
|
|
64
|
+
id: string;
|
|
65
|
+
name: string;
|
|
66
|
+
type: string;
|
|
67
|
+
league?: string;
|
|
68
|
+
startTime: string;
|
|
69
|
+
status: string;
|
|
70
|
+
teams: { home: string; away: string };
|
|
71
|
+
[key: string]: unknown;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// ── Auth types ──
|
|
75
|
+
|
|
76
|
+
export interface NonceParams {
|
|
77
|
+
walletAddress: string;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface NonceResponse {
|
|
81
|
+
nonce: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface AuthenticateParams {
|
|
85
|
+
walletAddress: string;
|
|
86
|
+
signature: string;
|
|
87
|
+
nonce: string;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface AuthenticateResponse {
|
|
91
|
+
token: string;
|
|
92
|
+
user: User;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface RegisterParams {
|
|
96
|
+
walletAddress: string;
|
|
97
|
+
signature: string;
|
|
98
|
+
nonce: string;
|
|
99
|
+
username: string;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface RegisterResponse {
|
|
103
|
+
token: string;
|
|
104
|
+
user: User;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface MeResponse {
|
|
108
|
+
user: User;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface CheckUsernameResponse {
|
|
112
|
+
available: boolean;
|
|
113
|
+
username: string;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// ── Users types ──
|
|
117
|
+
|
|
118
|
+
export interface UserResponse {
|
|
119
|
+
user: User;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export interface UsersListParams {
|
|
123
|
+
limit?: number;
|
|
124
|
+
offset?: number;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface UsersListResponse {
|
|
128
|
+
users: User[];
|
|
129
|
+
total: number;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// ── Events types ──
|
|
133
|
+
|
|
134
|
+
export interface UpcomingEventsParams {
|
|
135
|
+
type?: string;
|
|
136
|
+
page?: number;
|
|
137
|
+
limit?: number;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface EventsResponse {
|
|
141
|
+
events: Event[];
|
|
142
|
+
total?: number;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface EsportsParams {
|
|
146
|
+
videogame?: string;
|
|
147
|
+
page?: number;
|
|
148
|
+
limit?: number;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export interface EsportsMatchResponse {
|
|
152
|
+
match: Record<string, unknown>;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// ── Games types ──
|
|
156
|
+
|
|
157
|
+
export interface ValidateParams {
|
|
158
|
+
eventId: string;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export interface ValidateResponse {
|
|
162
|
+
valid: boolean;
|
|
163
|
+
event: Event;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export interface GameCreateParams {
|
|
167
|
+
id: string;
|
|
168
|
+
playerWallet: string;
|
|
169
|
+
teamChoice: string;
|
|
170
|
+
wagerAmount: number;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export interface GameCreateResponse {
|
|
174
|
+
game: Game;
|
|
175
|
+
transaction: string;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export interface GameJoinParams {
|
|
179
|
+
playerWallet: string;
|
|
180
|
+
gameId: string;
|
|
181
|
+
teamChoice: string;
|
|
182
|
+
amount: number;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export interface GameJoinResponse {
|
|
186
|
+
game: Game;
|
|
187
|
+
transaction: string;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export interface GameConfirmParams {
|
|
191
|
+
gameId: string;
|
|
192
|
+
playerWallet: string;
|
|
193
|
+
signature: string;
|
|
194
|
+
[key: string]: unknown;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export interface GameConfirmResponse {
|
|
198
|
+
game: Game;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export interface GameListParams {
|
|
202
|
+
status?: string;
|
|
203
|
+
limit?: number;
|
|
204
|
+
offset?: number;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export interface GameListResponse {
|
|
208
|
+
games: Game[];
|
|
209
|
+
total: number;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export interface NetworkGamesParams {
|
|
213
|
+
limit?: number;
|
|
214
|
+
offset?: number;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export interface NetworkGamesResponse {
|
|
218
|
+
games: Game[];
|
|
219
|
+
total: number;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export interface LiveScoreResponse {
|
|
223
|
+
gameId: string;
|
|
224
|
+
score: Record<string, unknown>;
|
|
225
|
+
status: string;
|
|
226
|
+
[key: string]: unknown;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export interface CustomGameCreateParams {
|
|
230
|
+
playerWallet: string;
|
|
231
|
+
teamChoice: string;
|
|
232
|
+
wagerAmount: number;
|
|
233
|
+
[key: string]: unknown;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export interface CustomGameCreateResponse {
|
|
237
|
+
game: Game;
|
|
238
|
+
transaction: string;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export interface CustomGameConfirmParams {
|
|
242
|
+
gameId: string;
|
|
243
|
+
playerWallet: string;
|
|
244
|
+
signature: string;
|
|
245
|
+
[key: string]: unknown;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export interface CustomGameConfirmResponse {
|
|
249
|
+
game: Game;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// ── Transactions types ──
|
|
253
|
+
|
|
254
|
+
export interface BuildClaimParams {
|
|
255
|
+
playerWallet: string;
|
|
256
|
+
gameId: string;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export interface BuildClaimResponse {
|
|
260
|
+
transaction: string;
|
|
261
|
+
[key: string]: unknown;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// ── Config types ──
|
|
265
|
+
|
|
266
|
+
export interface AppConfigResponse {
|
|
267
|
+
[key: string]: unknown;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// ── UFC types ──
|
|
271
|
+
|
|
272
|
+
export interface UFCFighter {
|
|
273
|
+
name: string;
|
|
274
|
+
imageUrl: string | null;
|
|
275
|
+
abbreviation: string;
|
|
276
|
+
record: string | null;
|
|
277
|
+
winner: boolean;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export interface UFCData {
|
|
281
|
+
currentRound: number;
|
|
282
|
+
totalRounds: number;
|
|
283
|
+
clock: string;
|
|
284
|
+
fightState: 'pre' | 'in' | 'post';
|
|
285
|
+
statusDetail: string;
|
|
286
|
+
statusShortDetail?: string;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
export interface UFCFight {
|
|
290
|
+
id: string | null;
|
|
291
|
+
home: UFCFighter;
|
|
292
|
+
away: UFCFighter;
|
|
293
|
+
weightClass: string | null;
|
|
294
|
+
status: string;
|
|
295
|
+
ufcData: UFCData | null;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
export interface UFCEvent {
|
|
299
|
+
eventName: string;
|
|
300
|
+
date: string | null;
|
|
301
|
+
fights: UFCFight[];
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
export interface UFCFightCardResponse {
|
|
305
|
+
success: boolean;
|
|
306
|
+
events: UFCEvent[];
|
|
307
|
+
}
|