@provable-games/budokan-sdk 0.1.19 → 0.1.21
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/dist/{client-B97mEKJc.d.cts → client-0HDPKrdw.d.cts} +11 -49
- package/dist/{client-B97mEKJc.d.ts → client-0HDPKrdw.d.ts} +11 -49
- package/dist/index.cjs +6 -130
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -31
- package/dist/index.d.ts +17 -31
- package/dist/index.js +7 -128
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +154 -226
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +33 -31
- package/dist/react.d.ts +33 -31
- package/dist/react.js +152 -223
- package/dist/react.js.map +1 -1
- package/package.json +7 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as Tournament, P as PrizeAggregation, a as Prize, b as PaginatedResult, Q as QualificationEntry, R as Registration, c as RewardClaim, d as RewardClaimSummary, e as TournamentListParams, f as
|
|
2
|
-
export { B as BudokanClient,
|
|
1
|
+
import { T as Tournament, P as PrizeAggregation, a as Prize, b as PaginatedResult, Q as QualificationEntry, R as Registration, c as RewardClaim, d as RewardClaimSummary, e as TournamentListParams, f as PlatformStats, g as PrizeStats, W as WSSubscribeOptions, h as WSEventHandler } from './client-0HDPKrdw.cjs';
|
|
2
|
+
export { B as BudokanClient, i as BudokanClientConfig, C as ConnectionMode, j as ConnectionStatus, k as ConnectionStatusState, D as DataSource, G as GameConfig, L as LeaderboardConfig, l as LeaderboardEntry, m as Phase, S as Schedule, n as WSChannel, o as WSEventMessage, p as WSMessage, q as WSSubscribeMessage, r as WSUnsubscribeMessage, s as createBudokanClient } from './client-0HDPKrdw.cjs';
|
|
3
3
|
export { EntryFee } from '@provable-games/metagame-sdk';
|
|
4
4
|
import 'starknet';
|
|
5
5
|
|
|
@@ -31,7 +31,7 @@ declare class DataSourceError extends BudokanError {
|
|
|
31
31
|
constructor(primaryError: Error, fallbackError: Error);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
interface ApiContext$
|
|
34
|
+
interface ApiContext$2 {
|
|
35
35
|
retryAttempts?: number;
|
|
36
36
|
retryDelay?: number;
|
|
37
37
|
timeout?: number;
|
|
@@ -39,62 +39,52 @@ interface ApiContext$3 {
|
|
|
39
39
|
/**
|
|
40
40
|
* Fetch a paginated list of tournaments.
|
|
41
41
|
*/
|
|
42
|
-
declare function getTournaments(baseUrl: string, params?: TournamentListParams, ctx?: ApiContext$
|
|
42
|
+
declare function getTournaments(baseUrl: string, params?: TournamentListParams, ctx?: ApiContext$2): Promise<PaginatedResult<Tournament>>;
|
|
43
43
|
/**
|
|
44
44
|
* Fetch a single tournament by ID.
|
|
45
45
|
*/
|
|
46
|
-
declare function getTournament(baseUrl: string, tournamentId: string, ctx?: ApiContext$
|
|
46
|
+
declare function getTournament(baseUrl: string, tournamentId: string, ctx?: ApiContext$2): Promise<Tournament>;
|
|
47
47
|
/**
|
|
48
48
|
* Fetch registrations for a tournament.
|
|
49
|
+
*
|
|
50
|
+
* No `playerAddress` filter: registrations are keyed by token id, and
|
|
51
|
+
* the original registrant goes stale on transfer. Callers wanting "the
|
|
52
|
+
* current user's registrations" should resolve their owned token ids via
|
|
53
|
+
* denshokan-sdk's useTokens and pass them as `gameTokenIds`.
|
|
49
54
|
*/
|
|
50
55
|
declare function getTournamentRegistrations(baseUrl: string, tournamentId: string, params?: {
|
|
51
|
-
playerAddress?: string;
|
|
52
56
|
gameTokenIds?: string[];
|
|
53
57
|
hasSubmitted?: boolean;
|
|
54
58
|
isBanned?: boolean;
|
|
55
59
|
limit?: number;
|
|
56
60
|
offset?: number;
|
|
57
|
-
}, ctx?: ApiContext$
|
|
61
|
+
}, ctx?: ApiContext$2): Promise<PaginatedResult<Registration>>;
|
|
58
62
|
/**
|
|
59
63
|
* Fetch prizes for a tournament.
|
|
60
64
|
*/
|
|
61
|
-
declare function getTournamentPrizes(baseUrl: string, tournamentId: string, ctx?: ApiContext$
|
|
65
|
+
declare function getTournamentPrizes(baseUrl: string, tournamentId: string, ctx?: ApiContext$2): Promise<Prize[]>;
|
|
62
66
|
/**
|
|
63
67
|
* Fetch reward claims for a tournament.
|
|
64
68
|
*/
|
|
65
69
|
declare function getTournamentRewardClaims(baseUrl: string, tournamentId: string, params?: {
|
|
66
70
|
limit?: number;
|
|
67
71
|
offset?: number;
|
|
68
|
-
}, ctx?: ApiContext$
|
|
72
|
+
}, ctx?: ApiContext$2): Promise<PaginatedResult<RewardClaim>>;
|
|
69
73
|
/**
|
|
70
74
|
* Fetch reward claims summary for a tournament.
|
|
71
75
|
*/
|
|
72
|
-
declare function getTournamentRewardClaimsSummary(baseUrl: string, tournamentId: string, ctx?: ApiContext$
|
|
76
|
+
declare function getTournamentRewardClaimsSummary(baseUrl: string, tournamentId: string, ctx?: ApiContext$2): Promise<RewardClaimSummary>;
|
|
73
77
|
/**
|
|
74
78
|
* Fetch qualifications for a tournament.
|
|
75
79
|
*/
|
|
76
80
|
declare function getTournamentQualifications(baseUrl: string, tournamentId: string, params?: {
|
|
77
81
|
limit?: number;
|
|
78
82
|
offset?: number;
|
|
79
|
-
}, ctx?: ApiContext$
|
|
83
|
+
}, ctx?: ApiContext$2): Promise<PaginatedResult<QualificationEntry>>;
|
|
80
84
|
/**
|
|
81
85
|
* Fetch prize aggregation for a tournament.
|
|
82
86
|
*/
|
|
83
|
-
declare function getTournamentPrizeAggregation(baseUrl: string, tournamentId: string, ctx?: ApiContext$
|
|
84
|
-
|
|
85
|
-
interface ApiContext$2 {
|
|
86
|
-
retryAttempts?: number;
|
|
87
|
-
retryDelay?: number;
|
|
88
|
-
timeout?: number;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Fetch tournaments for a player.
|
|
92
|
-
*/
|
|
93
|
-
declare function getPlayerTournaments(baseUrl: string, address: string, params?: PlayerTournamentParams, ctx?: ApiContext$2): Promise<PaginatedResult<PlayerTournament>>;
|
|
94
|
-
/**
|
|
95
|
-
* Fetch stats for a player.
|
|
96
|
-
*/
|
|
97
|
-
declare function getPlayerStats(baseUrl: string, address: string, ctx?: ApiContext$2): Promise<PlayerStats>;
|
|
87
|
+
declare function getTournamentPrizeAggregation(baseUrl: string, tournamentId: string, ctx?: ApiContext$2): Promise<PrizeAggregation[]>;
|
|
98
88
|
|
|
99
89
|
interface ApiContext$1 {
|
|
100
90
|
retryAttempts?: number;
|
|
@@ -115,10 +105,6 @@ interface ApiContext {
|
|
|
115
105
|
retryDelay?: number;
|
|
116
106
|
timeout?: number;
|
|
117
107
|
}
|
|
118
|
-
/**
|
|
119
|
-
* Fetch activity events with optional filtering.
|
|
120
|
-
*/
|
|
121
|
-
declare function getActivity(baseUrl: string, params?: ActivityParams, ctx?: ApiContext): Promise<PaginatedResult<ActivityEvent>>;
|
|
122
108
|
/**
|
|
123
109
|
* Fetch platform-wide activity stats.
|
|
124
110
|
*/
|
|
@@ -204,4 +190,4 @@ interface ChainConfig {
|
|
|
204
190
|
declare const CHAINS: Record<string, ChainConfig>;
|
|
205
191
|
declare function getChainConfig(chain: string): ChainConfig | undefined;
|
|
206
192
|
|
|
207
|
-
export {
|
|
193
|
+
export { BudokanApiError, BudokanConnectionError, BudokanError, BudokanTimeoutError, CHAINS, type ChainConfig, DataSourceError, PaginatedResult, PlatformStats, Prize, PrizeAggregation, PrizeStats, QualificationEntry, Registration, RewardClaim, RewardClaimSummary, RpcError, Tournament, TournamentListParams, TournamentNotFoundError, WSEventHandler, WSManager, WSSubscribeOptions, camelToSnake, getActivityStats, getChainConfig, getGameStats, getGameTournaments, getPrizeStats, getTournament, getTournamentPrizeAggregation, getTournamentPrizes, getTournamentQualifications, getTournamentRegistrations, getTournamentRewardClaims, getTournamentRewardClaimsSummary, getTournaments, normalizeAddress, snakeToCamel, withRetry };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as Tournament, P as PrizeAggregation, a as Prize, b as PaginatedResult, Q as QualificationEntry, R as Registration, c as RewardClaim, d as RewardClaimSummary, e as TournamentListParams, f as
|
|
2
|
-
export { B as BudokanClient,
|
|
1
|
+
import { T as Tournament, P as PrizeAggregation, a as Prize, b as PaginatedResult, Q as QualificationEntry, R as Registration, c as RewardClaim, d as RewardClaimSummary, e as TournamentListParams, f as PlatformStats, g as PrizeStats, W as WSSubscribeOptions, h as WSEventHandler } from './client-0HDPKrdw.js';
|
|
2
|
+
export { B as BudokanClient, i as BudokanClientConfig, C as ConnectionMode, j as ConnectionStatus, k as ConnectionStatusState, D as DataSource, G as GameConfig, L as LeaderboardConfig, l as LeaderboardEntry, m as Phase, S as Schedule, n as WSChannel, o as WSEventMessage, p as WSMessage, q as WSSubscribeMessage, r as WSUnsubscribeMessage, s as createBudokanClient } from './client-0HDPKrdw.js';
|
|
3
3
|
export { EntryFee } from '@provable-games/metagame-sdk';
|
|
4
4
|
import 'starknet';
|
|
5
5
|
|
|
@@ -31,7 +31,7 @@ declare class DataSourceError extends BudokanError {
|
|
|
31
31
|
constructor(primaryError: Error, fallbackError: Error);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
interface ApiContext$
|
|
34
|
+
interface ApiContext$2 {
|
|
35
35
|
retryAttempts?: number;
|
|
36
36
|
retryDelay?: number;
|
|
37
37
|
timeout?: number;
|
|
@@ -39,62 +39,52 @@ interface ApiContext$3 {
|
|
|
39
39
|
/**
|
|
40
40
|
* Fetch a paginated list of tournaments.
|
|
41
41
|
*/
|
|
42
|
-
declare function getTournaments(baseUrl: string, params?: TournamentListParams, ctx?: ApiContext$
|
|
42
|
+
declare function getTournaments(baseUrl: string, params?: TournamentListParams, ctx?: ApiContext$2): Promise<PaginatedResult<Tournament>>;
|
|
43
43
|
/**
|
|
44
44
|
* Fetch a single tournament by ID.
|
|
45
45
|
*/
|
|
46
|
-
declare function getTournament(baseUrl: string, tournamentId: string, ctx?: ApiContext$
|
|
46
|
+
declare function getTournament(baseUrl: string, tournamentId: string, ctx?: ApiContext$2): Promise<Tournament>;
|
|
47
47
|
/**
|
|
48
48
|
* Fetch registrations for a tournament.
|
|
49
|
+
*
|
|
50
|
+
* No `playerAddress` filter: registrations are keyed by token id, and
|
|
51
|
+
* the original registrant goes stale on transfer. Callers wanting "the
|
|
52
|
+
* current user's registrations" should resolve their owned token ids via
|
|
53
|
+
* denshokan-sdk's useTokens and pass them as `gameTokenIds`.
|
|
49
54
|
*/
|
|
50
55
|
declare function getTournamentRegistrations(baseUrl: string, tournamentId: string, params?: {
|
|
51
|
-
playerAddress?: string;
|
|
52
56
|
gameTokenIds?: string[];
|
|
53
57
|
hasSubmitted?: boolean;
|
|
54
58
|
isBanned?: boolean;
|
|
55
59
|
limit?: number;
|
|
56
60
|
offset?: number;
|
|
57
|
-
}, ctx?: ApiContext$
|
|
61
|
+
}, ctx?: ApiContext$2): Promise<PaginatedResult<Registration>>;
|
|
58
62
|
/**
|
|
59
63
|
* Fetch prizes for a tournament.
|
|
60
64
|
*/
|
|
61
|
-
declare function getTournamentPrizes(baseUrl: string, tournamentId: string, ctx?: ApiContext$
|
|
65
|
+
declare function getTournamentPrizes(baseUrl: string, tournamentId: string, ctx?: ApiContext$2): Promise<Prize[]>;
|
|
62
66
|
/**
|
|
63
67
|
* Fetch reward claims for a tournament.
|
|
64
68
|
*/
|
|
65
69
|
declare function getTournamentRewardClaims(baseUrl: string, tournamentId: string, params?: {
|
|
66
70
|
limit?: number;
|
|
67
71
|
offset?: number;
|
|
68
|
-
}, ctx?: ApiContext$
|
|
72
|
+
}, ctx?: ApiContext$2): Promise<PaginatedResult<RewardClaim>>;
|
|
69
73
|
/**
|
|
70
74
|
* Fetch reward claims summary for a tournament.
|
|
71
75
|
*/
|
|
72
|
-
declare function getTournamentRewardClaimsSummary(baseUrl: string, tournamentId: string, ctx?: ApiContext$
|
|
76
|
+
declare function getTournamentRewardClaimsSummary(baseUrl: string, tournamentId: string, ctx?: ApiContext$2): Promise<RewardClaimSummary>;
|
|
73
77
|
/**
|
|
74
78
|
* Fetch qualifications for a tournament.
|
|
75
79
|
*/
|
|
76
80
|
declare function getTournamentQualifications(baseUrl: string, tournamentId: string, params?: {
|
|
77
81
|
limit?: number;
|
|
78
82
|
offset?: number;
|
|
79
|
-
}, ctx?: ApiContext$
|
|
83
|
+
}, ctx?: ApiContext$2): Promise<PaginatedResult<QualificationEntry>>;
|
|
80
84
|
/**
|
|
81
85
|
* Fetch prize aggregation for a tournament.
|
|
82
86
|
*/
|
|
83
|
-
declare function getTournamentPrizeAggregation(baseUrl: string, tournamentId: string, ctx?: ApiContext$
|
|
84
|
-
|
|
85
|
-
interface ApiContext$2 {
|
|
86
|
-
retryAttempts?: number;
|
|
87
|
-
retryDelay?: number;
|
|
88
|
-
timeout?: number;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Fetch tournaments for a player.
|
|
92
|
-
*/
|
|
93
|
-
declare function getPlayerTournaments(baseUrl: string, address: string, params?: PlayerTournamentParams, ctx?: ApiContext$2): Promise<PaginatedResult<PlayerTournament>>;
|
|
94
|
-
/**
|
|
95
|
-
* Fetch stats for a player.
|
|
96
|
-
*/
|
|
97
|
-
declare function getPlayerStats(baseUrl: string, address: string, ctx?: ApiContext$2): Promise<PlayerStats>;
|
|
87
|
+
declare function getTournamentPrizeAggregation(baseUrl: string, tournamentId: string, ctx?: ApiContext$2): Promise<PrizeAggregation[]>;
|
|
98
88
|
|
|
99
89
|
interface ApiContext$1 {
|
|
100
90
|
retryAttempts?: number;
|
|
@@ -115,10 +105,6 @@ interface ApiContext {
|
|
|
115
105
|
retryDelay?: number;
|
|
116
106
|
timeout?: number;
|
|
117
107
|
}
|
|
118
|
-
/**
|
|
119
|
-
* Fetch activity events with optional filtering.
|
|
120
|
-
*/
|
|
121
|
-
declare function getActivity(baseUrl: string, params?: ActivityParams, ctx?: ApiContext): Promise<PaginatedResult<ActivityEvent>>;
|
|
122
108
|
/**
|
|
123
109
|
* Fetch platform-wide activity stats.
|
|
124
110
|
*/
|
|
@@ -204,4 +190,4 @@ interface ChainConfig {
|
|
|
204
190
|
declare const CHAINS: Record<string, ChainConfig>;
|
|
205
191
|
declare function getChainConfig(chain: string): ChainConfig | undefined;
|
|
206
192
|
|
|
207
|
-
export {
|
|
193
|
+
export { BudokanApiError, BudokanConnectionError, BudokanError, BudokanTimeoutError, CHAINS, type ChainConfig, DataSourceError, PaginatedResult, PlatformStats, Prize, PrizeAggregation, PrizeStats, QualificationEntry, Registration, RewardClaim, RewardClaimSummary, RpcError, Tournament, TournamentListParams, TournamentNotFoundError, WSEventHandler, WSManager, WSSubscribeOptions, camelToSnake, getActivityStats, getChainConfig, getGameStats, getGameTournaments, getPrizeStats, getTournament, getTournamentPrizeAggregation, getTournamentPrizes, getTournamentQualifications, getTournamentRegistrations, getTournamentRewardClaims, getTournamentRewardClaimsSummary, getTournaments, normalizeAddress, snakeToCamel, withRetry };
|
package/dist/index.js
CHANGED
|
@@ -253,7 +253,6 @@ async function getTournament(baseUrl, tournamentId, ctx) {
|
|
|
253
253
|
}
|
|
254
254
|
async function getTournamentRegistrations(baseUrl, tournamentId, params, ctx) {
|
|
255
255
|
const qs = buildQueryString({
|
|
256
|
-
player_address: params?.playerAddress,
|
|
257
256
|
game_token_ids: params?.gameTokenIds?.length ? params.gameTokenIds.join(",") : void 0,
|
|
258
257
|
has_submitted: params?.hasSubmitted,
|
|
259
258
|
is_banned: params?.isBanned,
|
|
@@ -326,42 +325,8 @@ function normalizeAddress(address) {
|
|
|
326
325
|
return ("0x" + stripped.padStart(64, "0")).toLowerCase();
|
|
327
326
|
}
|
|
328
327
|
|
|
329
|
-
// src/api/players.ts
|
|
330
|
-
function fetchOpts2(ctx) {
|
|
331
|
-
return {
|
|
332
|
-
retryAttempts: ctx?.retryAttempts,
|
|
333
|
-
retryDelay: ctx?.retryDelay,
|
|
334
|
-
timeout: ctx?.timeout
|
|
335
|
-
};
|
|
336
|
-
}
|
|
337
|
-
async function getPlayerTournaments(baseUrl, address, params, ctx) {
|
|
338
|
-
const normalized = normalizeAddress(address);
|
|
339
|
-
const qs = buildQueryString({
|
|
340
|
-
limit: params?.limit,
|
|
341
|
-
offset: params?.offset,
|
|
342
|
-
phase: params?.phase,
|
|
343
|
-
game_token_ids: params?.gameTokenIds?.join(",")
|
|
344
|
-
});
|
|
345
|
-
const result = await apiFetch(`${baseUrl}/players/${normalized}/tournaments${qs}`, fetchOpts2(ctx));
|
|
346
|
-
const { total, limit: resLimit, offset: resOffset } = extractPagination(result, { limit: params?.limit, offset: params?.offset });
|
|
347
|
-
return {
|
|
348
|
-
data: result.data.map((item) => snakeToCamel(item)),
|
|
349
|
-
total,
|
|
350
|
-
limit: resLimit,
|
|
351
|
-
offset: resOffset
|
|
352
|
-
};
|
|
353
|
-
}
|
|
354
|
-
async function getPlayerStats(baseUrl, address, ctx) {
|
|
355
|
-
const normalized = normalizeAddress(address);
|
|
356
|
-
const result = await apiFetch(
|
|
357
|
-
`${baseUrl}/players/${normalized}/stats`,
|
|
358
|
-
fetchOpts2(ctx)
|
|
359
|
-
);
|
|
360
|
-
return snakeToCamel(result.data);
|
|
361
|
-
}
|
|
362
|
-
|
|
363
328
|
// src/api/games.ts
|
|
364
|
-
function
|
|
329
|
+
function fetchOpts2(ctx) {
|
|
365
330
|
return {
|
|
366
331
|
retryAttempts: ctx?.retryAttempts,
|
|
367
332
|
retryDelay: ctx?.retryDelay,
|
|
@@ -376,7 +341,7 @@ async function getGameTournaments(baseUrl, gameAddress, params, ctx) {
|
|
|
376
341
|
limit: params?.limit,
|
|
377
342
|
offset: params?.offset
|
|
378
343
|
});
|
|
379
|
-
const result = await apiFetch(`${baseUrl}/games/${normalized}/tournaments${qs}`,
|
|
344
|
+
const result = await apiFetch(`${baseUrl}/games/${normalized}/tournaments${qs}`, fetchOpts2(ctx));
|
|
380
345
|
const { total, limit: resLimit, offset: resOffset } = extractPagination(result, { limit: params?.limit, offset: params?.offset });
|
|
381
346
|
return {
|
|
382
347
|
data: result.data.map((item) => snakeToCamel(item)),
|
|
@@ -389,47 +354,30 @@ async function getGameStats(baseUrl, gameAddress, ctx) {
|
|
|
389
354
|
const normalized = normalizeAddress(gameAddress);
|
|
390
355
|
const result = await apiFetch(
|
|
391
356
|
`${baseUrl}/games/${normalized}/stats`,
|
|
392
|
-
|
|
357
|
+
fetchOpts2(ctx)
|
|
393
358
|
);
|
|
394
359
|
return snakeToCamel(result.data);
|
|
395
360
|
}
|
|
396
361
|
|
|
397
362
|
// src/api/activity.ts
|
|
398
|
-
function
|
|
363
|
+
function fetchOpts3(ctx) {
|
|
399
364
|
return {
|
|
400
365
|
retryAttempts: ctx?.retryAttempts,
|
|
401
366
|
retryDelay: ctx?.retryDelay,
|
|
402
367
|
timeout: ctx?.timeout
|
|
403
368
|
};
|
|
404
369
|
}
|
|
405
|
-
async function getActivity(baseUrl, params, ctx) {
|
|
406
|
-
const qs = buildQueryString({
|
|
407
|
-
event_type: params?.eventType,
|
|
408
|
-
tournament_id: params?.tournamentId,
|
|
409
|
-
player_address: params?.playerAddress,
|
|
410
|
-
limit: params?.limit,
|
|
411
|
-
offset: params?.offset
|
|
412
|
-
});
|
|
413
|
-
const result = await apiFetch(`${baseUrl}/activity${qs}`, fetchOpts4(ctx));
|
|
414
|
-
const { total, limit: resLimit, offset: resOffset } = extractPagination(result, { limit: params?.limit, offset: params?.offset });
|
|
415
|
-
return {
|
|
416
|
-
data: result.data.map((item) => snakeToCamel(item)),
|
|
417
|
-
total,
|
|
418
|
-
limit: resLimit,
|
|
419
|
-
offset: resOffset
|
|
420
|
-
};
|
|
421
|
-
}
|
|
422
370
|
async function getActivityStats(baseUrl, ctx) {
|
|
423
371
|
const result = await apiFetch(
|
|
424
372
|
`${baseUrl}/activity/stats`,
|
|
425
|
-
|
|
373
|
+
fetchOpts3(ctx)
|
|
426
374
|
);
|
|
427
375
|
return snakeToCamel(result.data);
|
|
428
376
|
}
|
|
429
377
|
async function getPrizeStats(baseUrl, ctx) {
|
|
430
378
|
const result = await apiFetch(
|
|
431
379
|
`${baseUrl}/activity/prize-stats`,
|
|
432
|
-
|
|
380
|
+
fetchOpts3(ctx)
|
|
433
381
|
);
|
|
434
382
|
return snakeToCamel(result.data);
|
|
435
383
|
}
|
|
@@ -991,8 +939,6 @@ function parseRegistration(raw, tournamentId) {
|
|
|
991
939
|
gameTokenId: num.toHex(obj.game_token_id),
|
|
992
940
|
gameAddress: "",
|
|
993
941
|
// Not in on-chain struct
|
|
994
|
-
playerAddress: "",
|
|
995
|
-
// Not in on-chain struct
|
|
996
942
|
entryNumber: Number(obj.entry_id ?? 0),
|
|
997
943
|
hasSubmitted: Boolean(obj.has_submitted),
|
|
998
944
|
isBanned: Boolean(obj.is_banned)
|
|
@@ -1151,20 +1097,6 @@ async function viewerRegistrations(contract, tournamentId, offset, limit) {
|
|
|
1151
1097
|
};
|
|
1152
1098
|
}, contract.address);
|
|
1153
1099
|
}
|
|
1154
|
-
async function viewerRegistrationsByOwner(contract, tournamentId, owner, offset, limit) {
|
|
1155
|
-
return wrapRpcCall(async () => {
|
|
1156
|
-
const result = await contract.call("tournament_registrations_by_owner", [tournamentId, owner, offset, limit]);
|
|
1157
|
-
const obj = result;
|
|
1158
|
-
const entries = obj.entries ?? [];
|
|
1159
|
-
const total = Number(obj.total ?? 0);
|
|
1160
|
-
return {
|
|
1161
|
-
data: entries.map((e) => parseRegistration(e, tournamentId)),
|
|
1162
|
-
total,
|
|
1163
|
-
limit,
|
|
1164
|
-
offset
|
|
1165
|
-
};
|
|
1166
|
-
}, contract.address);
|
|
1167
|
-
}
|
|
1168
1100
|
async function viewerRegistrationsByTokenIds(contract, tournamentId, tokenIds, offset, limit) {
|
|
1169
1101
|
return wrapRpcCall(async () => {
|
|
1170
1102
|
const result = await contract.call("tournament_registrations_by_token_ids", [tournamentId, tokenIds, offset, limit]);
|
|
@@ -1210,12 +1142,6 @@ async function viewerRewardClaims(contract, tournamentId, offset, limit) {
|
|
|
1210
1142
|
};
|
|
1211
1143
|
}, contract.address);
|
|
1212
1144
|
}
|
|
1213
|
-
async function viewerPlayerTournaments(contract, playerAddress, offset, limit) {
|
|
1214
|
-
return wrapRpcCall(async () => {
|
|
1215
|
-
const result = await contract.call("player_tournaments", [playerAddress, offset, limit]);
|
|
1216
|
-
return parseFilterResult(result);
|
|
1217
|
-
}, contract.address);
|
|
1218
|
-
}
|
|
1219
1145
|
|
|
1220
1146
|
// src/rpc/abis/budokanViewer.json
|
|
1221
1147
|
var budokanViewer_default = [
|
|
@@ -4523,9 +4449,6 @@ var BudokanClient = class {
|
|
|
4523
4449
|
const contract = await this.getViewerContract();
|
|
4524
4450
|
const offset = params?.offset ?? 0;
|
|
4525
4451
|
const limit = params?.limit ?? 20;
|
|
4526
|
-
if (params?.playerAddress) {
|
|
4527
|
-
return viewerRegistrationsByOwner(contract, tournamentId, params.playerAddress, offset, limit);
|
|
4528
|
-
}
|
|
4529
4452
|
if (params?.gameTokenIds?.length) {
|
|
4530
4453
|
return viewerRegistrationsByTokenIds(contract, tournamentId, params.gameTokenIds, offset, limit);
|
|
4531
4454
|
}
|
|
@@ -4558,43 +4481,6 @@ var BudokanClient = class {
|
|
|
4558
4481
|
this.connectionStatus
|
|
4559
4482
|
);
|
|
4560
4483
|
}
|
|
4561
|
-
// ---- Player Queries (API-only, no on-chain equivalent) ----
|
|
4562
|
-
/**
|
|
4563
|
-
* Fetch tournaments that a player has registered for.
|
|
4564
|
-
* Supports RPC fallback via viewer contract.
|
|
4565
|
-
*/
|
|
4566
|
-
async getPlayerTournaments(address, params) {
|
|
4567
|
-
const rpcFallback = async () => {
|
|
4568
|
-
const contract = await this.getViewerContract();
|
|
4569
|
-
const offset = params?.offset ?? 0;
|
|
4570
|
-
const limit = params?.limit ?? 20;
|
|
4571
|
-
const filterResult = await viewerPlayerTournaments(contract, address, offset, limit);
|
|
4572
|
-
let data = [];
|
|
4573
|
-
if (filterResult.tournamentIds.length > 0) {
|
|
4574
|
-
const tournaments = await viewerTournamentsBatch(contract, filterResult.tournamentIds);
|
|
4575
|
-
data = tournaments.map((t) => ({
|
|
4576
|
-
...t,
|
|
4577
|
-
tournamentId: t.id
|
|
4578
|
-
}));
|
|
4579
|
-
}
|
|
4580
|
-
return { data, total: filterResult.total, limit, offset };
|
|
4581
|
-
};
|
|
4582
|
-
if (this.resolvedConfig.primarySource === "rpc") {
|
|
4583
|
-
return rpcFallback();
|
|
4584
|
-
}
|
|
4585
|
-
return withFallback(
|
|
4586
|
-
() => getPlayerTournaments(this.resolvedConfig.apiBaseUrl, address, params, this.apiCtx),
|
|
4587
|
-
rpcFallback,
|
|
4588
|
-
this.connectionStatus
|
|
4589
|
-
);
|
|
4590
|
-
}
|
|
4591
|
-
/**
|
|
4592
|
-
* Fetch stats for a player.
|
|
4593
|
-
* API-only — no RPC fallback available.
|
|
4594
|
-
*/
|
|
4595
|
-
async getPlayerStats(address) {
|
|
4596
|
-
return getPlayerStats(this.resolvedConfig.apiBaseUrl, address, this.apiCtx);
|
|
4597
|
-
}
|
|
4598
4484
|
// ---- Game Queries ----
|
|
4599
4485
|
/**
|
|
4600
4486
|
* Fetch tournaments for a specific game.
|
|
@@ -4693,13 +4579,6 @@ var BudokanClient = class {
|
|
|
4693
4579
|
return getTournamentPrizeAggregation(this.resolvedConfig.apiBaseUrl, tournamentId, this.apiCtx);
|
|
4694
4580
|
}
|
|
4695
4581
|
// ---- Activity Queries (API-only, activity is indexed) ----
|
|
4696
|
-
/**
|
|
4697
|
-
* Fetch activity events with optional filtering.
|
|
4698
|
-
* API-only — no RPC fallback available.
|
|
4699
|
-
*/
|
|
4700
|
-
async getActivity(params) {
|
|
4701
|
-
return getActivity(this.resolvedConfig.apiBaseUrl, params, this.apiCtx);
|
|
4702
|
-
}
|
|
4703
4582
|
/**
|
|
4704
4583
|
* Fetch platform-wide activity stats.
|
|
4705
4584
|
* API-only — no RPC fallback available.
|
|
@@ -4753,6 +4632,6 @@ function createBudokanClient(config) {
|
|
|
4753
4632
|
return new BudokanClient(config);
|
|
4754
4633
|
}
|
|
4755
4634
|
|
|
4756
|
-
export { BudokanApiError, BudokanClient, BudokanConnectionError, BudokanError, BudokanTimeoutError, CHAINS, ConnectionStatus, DataSourceError, RpcError, TournamentNotFoundError, WSManager, camelToSnake, createBudokanClient,
|
|
4635
|
+
export { BudokanApiError, BudokanClient, BudokanConnectionError, BudokanError, BudokanTimeoutError, CHAINS, ConnectionStatus, DataSourceError, RpcError, TournamentNotFoundError, WSManager, camelToSnake, createBudokanClient, getActivityStats, getChainConfig, getGameStats, getGameTournaments, getPrizeStats, getTournament, getTournamentPrizeAggregation, getTournamentPrizes, getTournamentQualifications, getTournamentRegistrations, getTournamentRewardClaims, getTournamentRewardClaimsSummary, getTournaments, normalizeAddress, snakeToCamel, withRetry };
|
|
4757
4636
|
//# sourceMappingURL=index.js.map
|
|
4758
4637
|
//# sourceMappingURL=index.js.map
|