@provable-games/budokan-sdk 0.1.18 → 0.1.20
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-C4PUxzuO.d.cts → client-CoWIQozF.d.cts} +19 -27
- package/dist/{client-C4PUxzuO.d.ts → client-CoWIQozF.d.ts} +19 -27
- package/dist/index.cjs +8 -106
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -27
- package/dist/index.d.ts +17 -27
- package/dist/index.js +9 -105
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +156 -203
- 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 +154 -200
- 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, A as ActivityParams, g as ActivityEvent, h as PrizeStats, W as WSSubscribeOptions, i as WSEventHandler } from './client-CoWIQozF.cjs';
|
|
2
|
+
export { B as BudokanClient, j as BudokanClientConfig, C as ConnectionMode, k as ConnectionStatus, l as ConnectionStatusState, D as DataSource, G as GameConfig, L as LeaderboardConfig, m as LeaderboardEntry, n as Phase, S as Schedule, o as WSChannel, p as WSEventMessage, q as WSMessage, r as WSSubscribeMessage, s as WSUnsubscribeMessage, t as createBudokanClient } from './client-CoWIQozF.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;
|
|
@@ -204,4 +194,4 @@ interface ChainConfig {
|
|
|
204
194
|
declare const CHAINS: Record<string, ChainConfig>;
|
|
205
195
|
declare function getChainConfig(chain: string): ChainConfig | undefined;
|
|
206
196
|
|
|
207
|
-
export { ActivityEvent, ActivityParams, BudokanApiError, BudokanConnectionError, BudokanError, BudokanTimeoutError, CHAINS, type ChainConfig, DataSourceError, PaginatedResult, PlatformStats,
|
|
197
|
+
export { ActivityEvent, ActivityParams, 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, getActivity, 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, A as ActivityParams, g as ActivityEvent, h as PrizeStats, W as WSSubscribeOptions, i as WSEventHandler } from './client-CoWIQozF.js';
|
|
2
|
+
export { B as BudokanClient, j as BudokanClientConfig, C as ConnectionMode, k as ConnectionStatus, l as ConnectionStatusState, D as DataSource, G as GameConfig, L as LeaderboardConfig, m as LeaderboardEntry, n as Phase, S as Schedule, o as WSChannel, p as WSEventMessage, q as WSMessage, r as WSSubscribeMessage, s as WSUnsubscribeMessage, t as createBudokanClient } from './client-CoWIQozF.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;
|
|
@@ -204,4 +194,4 @@ interface ChainConfig {
|
|
|
204
194
|
declare const CHAINS: Record<string, ChainConfig>;
|
|
205
195
|
declare function getChainConfig(chain: string): ChainConfig | undefined;
|
|
206
196
|
|
|
207
|
-
export { ActivityEvent, ActivityParams, BudokanApiError, BudokanConnectionError, BudokanError, BudokanTimeoutError, CHAINS, type ChainConfig, DataSourceError, PaginatedResult, PlatformStats,
|
|
197
|
+
export { ActivityEvent, ActivityParams, 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, getActivity, getActivityStats, getChainConfig, getGameStats, getGameTournaments, getPrizeStats, getTournament, getTournamentPrizeAggregation, getTournamentPrizes, getTournamentQualifications, getTournamentRegistrations, getTournamentRewardClaims, getTournamentRewardClaimsSummary, getTournaments, normalizeAddress, snakeToCamel, withRetry };
|
package/dist/index.js
CHANGED
|
@@ -231,6 +231,7 @@ async function getTournaments(baseUrl, params, ctx) {
|
|
|
231
231
|
sort: params?.sort,
|
|
232
232
|
from_id: params?.fromId,
|
|
233
233
|
exclude_ids: params?.excludeIds?.join(","),
|
|
234
|
+
tournament_ids: params?.tournamentIds?.join(","),
|
|
234
235
|
whitelisted_extensions: params?.whitelistedExtensions?.join(","),
|
|
235
236
|
include_prizes: params?.includePrizeSummary
|
|
236
237
|
});
|
|
@@ -252,7 +253,6 @@ async function getTournament(baseUrl, tournamentId, ctx) {
|
|
|
252
253
|
}
|
|
253
254
|
async function getTournamentRegistrations(baseUrl, tournamentId, params, ctx) {
|
|
254
255
|
const qs = buildQueryString({
|
|
255
|
-
player_address: params?.playerAddress,
|
|
256
256
|
game_token_ids: params?.gameTokenIds?.length ? params.gameTokenIds.join(",") : void 0,
|
|
257
257
|
has_submitted: params?.hasSubmitted,
|
|
258
258
|
is_banned: params?.isBanned,
|
|
@@ -325,42 +325,8 @@ function normalizeAddress(address) {
|
|
|
325
325
|
return ("0x" + stripped.padStart(64, "0")).toLowerCase();
|
|
326
326
|
}
|
|
327
327
|
|
|
328
|
-
// src/api/players.ts
|
|
329
|
-
function fetchOpts2(ctx) {
|
|
330
|
-
return {
|
|
331
|
-
retryAttempts: ctx?.retryAttempts,
|
|
332
|
-
retryDelay: ctx?.retryDelay,
|
|
333
|
-
timeout: ctx?.timeout
|
|
334
|
-
};
|
|
335
|
-
}
|
|
336
|
-
async function getPlayerTournaments(baseUrl, address, params, ctx) {
|
|
337
|
-
const normalized = normalizeAddress(address);
|
|
338
|
-
const qs = buildQueryString({
|
|
339
|
-
limit: params?.limit,
|
|
340
|
-
offset: params?.offset,
|
|
341
|
-
phase: params?.phase,
|
|
342
|
-
game_token_ids: params?.gameTokenIds?.join(",")
|
|
343
|
-
});
|
|
344
|
-
const result = await apiFetch(`${baseUrl}/players/${normalized}/tournaments${qs}`, fetchOpts2(ctx));
|
|
345
|
-
const { total, limit: resLimit, offset: resOffset } = extractPagination(result, { limit: params?.limit, offset: params?.offset });
|
|
346
|
-
return {
|
|
347
|
-
data: result.data.map((item) => snakeToCamel(item)),
|
|
348
|
-
total,
|
|
349
|
-
limit: resLimit,
|
|
350
|
-
offset: resOffset
|
|
351
|
-
};
|
|
352
|
-
}
|
|
353
|
-
async function getPlayerStats(baseUrl, address, ctx) {
|
|
354
|
-
const normalized = normalizeAddress(address);
|
|
355
|
-
const result = await apiFetch(
|
|
356
|
-
`${baseUrl}/players/${normalized}/stats`,
|
|
357
|
-
fetchOpts2(ctx)
|
|
358
|
-
);
|
|
359
|
-
return snakeToCamel(result.data);
|
|
360
|
-
}
|
|
361
|
-
|
|
362
328
|
// src/api/games.ts
|
|
363
|
-
function
|
|
329
|
+
function fetchOpts2(ctx) {
|
|
364
330
|
return {
|
|
365
331
|
retryAttempts: ctx?.retryAttempts,
|
|
366
332
|
retryDelay: ctx?.retryDelay,
|
|
@@ -375,7 +341,7 @@ async function getGameTournaments(baseUrl, gameAddress, params, ctx) {
|
|
|
375
341
|
limit: params?.limit,
|
|
376
342
|
offset: params?.offset
|
|
377
343
|
});
|
|
378
|
-
const result = await apiFetch(`${baseUrl}/games/${normalized}/tournaments${qs}`,
|
|
344
|
+
const result = await apiFetch(`${baseUrl}/games/${normalized}/tournaments${qs}`, fetchOpts2(ctx));
|
|
379
345
|
const { total, limit: resLimit, offset: resOffset } = extractPagination(result, { limit: params?.limit, offset: params?.offset });
|
|
380
346
|
return {
|
|
381
347
|
data: result.data.map((item) => snakeToCamel(item)),
|
|
@@ -388,13 +354,13 @@ async function getGameStats(baseUrl, gameAddress, ctx) {
|
|
|
388
354
|
const normalized = normalizeAddress(gameAddress);
|
|
389
355
|
const result = await apiFetch(
|
|
390
356
|
`${baseUrl}/games/${normalized}/stats`,
|
|
391
|
-
|
|
357
|
+
fetchOpts2(ctx)
|
|
392
358
|
);
|
|
393
359
|
return snakeToCamel(result.data);
|
|
394
360
|
}
|
|
395
361
|
|
|
396
362
|
// src/api/activity.ts
|
|
397
|
-
function
|
|
363
|
+
function fetchOpts3(ctx) {
|
|
398
364
|
return {
|
|
399
365
|
retryAttempts: ctx?.retryAttempts,
|
|
400
366
|
retryDelay: ctx?.retryDelay,
|
|
@@ -409,7 +375,7 @@ async function getActivity(baseUrl, params, ctx) {
|
|
|
409
375
|
limit: params?.limit,
|
|
410
376
|
offset: params?.offset
|
|
411
377
|
});
|
|
412
|
-
const result = await apiFetch(`${baseUrl}/activity${qs}`,
|
|
378
|
+
const result = await apiFetch(`${baseUrl}/activity${qs}`, fetchOpts3(ctx));
|
|
413
379
|
const { total, limit: resLimit, offset: resOffset } = extractPagination(result, { limit: params?.limit, offset: params?.offset });
|
|
414
380
|
return {
|
|
415
381
|
data: result.data.map((item) => snakeToCamel(item)),
|
|
@@ -421,14 +387,14 @@ async function getActivity(baseUrl, params, ctx) {
|
|
|
421
387
|
async function getActivityStats(baseUrl, ctx) {
|
|
422
388
|
const result = await apiFetch(
|
|
423
389
|
`${baseUrl}/activity/stats`,
|
|
424
|
-
|
|
390
|
+
fetchOpts3(ctx)
|
|
425
391
|
);
|
|
426
392
|
return snakeToCamel(result.data);
|
|
427
393
|
}
|
|
428
394
|
async function getPrizeStats(baseUrl, ctx) {
|
|
429
395
|
const result = await apiFetch(
|
|
430
396
|
`${baseUrl}/activity/prize-stats`,
|
|
431
|
-
|
|
397
|
+
fetchOpts3(ctx)
|
|
432
398
|
);
|
|
433
399
|
return snakeToCamel(result.data);
|
|
434
400
|
}
|
|
@@ -990,8 +956,6 @@ function parseRegistration(raw, tournamentId) {
|
|
|
990
956
|
gameTokenId: num.toHex(obj.game_token_id),
|
|
991
957
|
gameAddress: "",
|
|
992
958
|
// Not in on-chain struct
|
|
993
|
-
playerAddress: "",
|
|
994
|
-
// Not in on-chain struct
|
|
995
959
|
entryNumber: Number(obj.entry_id ?? 0),
|
|
996
960
|
hasSubmitted: Boolean(obj.has_submitted),
|
|
997
961
|
isBanned: Boolean(obj.is_banned)
|
|
@@ -1150,20 +1114,6 @@ async function viewerRegistrations(contract, tournamentId, offset, limit) {
|
|
|
1150
1114
|
};
|
|
1151
1115
|
}, contract.address);
|
|
1152
1116
|
}
|
|
1153
|
-
async function viewerRegistrationsByOwner(contract, tournamentId, owner, offset, limit) {
|
|
1154
|
-
return wrapRpcCall(async () => {
|
|
1155
|
-
const result = await contract.call("tournament_registrations_by_owner", [tournamentId, owner, offset, limit]);
|
|
1156
|
-
const obj = result;
|
|
1157
|
-
const entries = obj.entries ?? [];
|
|
1158
|
-
const total = Number(obj.total ?? 0);
|
|
1159
|
-
return {
|
|
1160
|
-
data: entries.map((e) => parseRegistration(e, tournamentId)),
|
|
1161
|
-
total,
|
|
1162
|
-
limit,
|
|
1163
|
-
offset
|
|
1164
|
-
};
|
|
1165
|
-
}, contract.address);
|
|
1166
|
-
}
|
|
1167
1117
|
async function viewerRegistrationsByTokenIds(contract, tournamentId, tokenIds, offset, limit) {
|
|
1168
1118
|
return wrapRpcCall(async () => {
|
|
1169
1119
|
const result = await contract.call("tournament_registrations_by_token_ids", [tournamentId, tokenIds, offset, limit]);
|
|
@@ -1209,12 +1159,6 @@ async function viewerRewardClaims(contract, tournamentId, offset, limit) {
|
|
|
1209
1159
|
};
|
|
1210
1160
|
}, contract.address);
|
|
1211
1161
|
}
|
|
1212
|
-
async function viewerPlayerTournaments(contract, playerAddress, offset, limit) {
|
|
1213
|
-
return wrapRpcCall(async () => {
|
|
1214
|
-
const result = await contract.call("player_tournaments", [playerAddress, offset, limit]);
|
|
1215
|
-
return parseFilterResult(result);
|
|
1216
|
-
}, contract.address);
|
|
1217
|
-
}
|
|
1218
1162
|
|
|
1219
1163
|
// src/rpc/abis/budokanViewer.json
|
|
1220
1164
|
var budokanViewer_default = [
|
|
@@ -4522,9 +4466,6 @@ var BudokanClient = class {
|
|
|
4522
4466
|
const contract = await this.getViewerContract();
|
|
4523
4467
|
const offset = params?.offset ?? 0;
|
|
4524
4468
|
const limit = params?.limit ?? 20;
|
|
4525
|
-
if (params?.playerAddress) {
|
|
4526
|
-
return viewerRegistrationsByOwner(contract, tournamentId, params.playerAddress, offset, limit);
|
|
4527
|
-
}
|
|
4528
4469
|
if (params?.gameTokenIds?.length) {
|
|
4529
4470
|
return viewerRegistrationsByTokenIds(contract, tournamentId, params.gameTokenIds, offset, limit);
|
|
4530
4471
|
}
|
|
@@ -4557,43 +4498,6 @@ var BudokanClient = class {
|
|
|
4557
4498
|
this.connectionStatus
|
|
4558
4499
|
);
|
|
4559
4500
|
}
|
|
4560
|
-
// ---- Player Queries (API-only, no on-chain equivalent) ----
|
|
4561
|
-
/**
|
|
4562
|
-
* Fetch tournaments that a player has registered for.
|
|
4563
|
-
* Supports RPC fallback via viewer contract.
|
|
4564
|
-
*/
|
|
4565
|
-
async getPlayerTournaments(address, params) {
|
|
4566
|
-
const rpcFallback = async () => {
|
|
4567
|
-
const contract = await this.getViewerContract();
|
|
4568
|
-
const offset = params?.offset ?? 0;
|
|
4569
|
-
const limit = params?.limit ?? 20;
|
|
4570
|
-
const filterResult = await viewerPlayerTournaments(contract, address, offset, limit);
|
|
4571
|
-
let data = [];
|
|
4572
|
-
if (filterResult.tournamentIds.length > 0) {
|
|
4573
|
-
const tournaments = await viewerTournamentsBatch(contract, filterResult.tournamentIds);
|
|
4574
|
-
data = tournaments.map((t) => ({
|
|
4575
|
-
...t,
|
|
4576
|
-
tournamentId: t.id
|
|
4577
|
-
}));
|
|
4578
|
-
}
|
|
4579
|
-
return { data, total: filterResult.total, limit, offset };
|
|
4580
|
-
};
|
|
4581
|
-
if (this.resolvedConfig.primarySource === "rpc") {
|
|
4582
|
-
return rpcFallback();
|
|
4583
|
-
}
|
|
4584
|
-
return withFallback(
|
|
4585
|
-
() => getPlayerTournaments(this.resolvedConfig.apiBaseUrl, address, params, this.apiCtx),
|
|
4586
|
-
rpcFallback,
|
|
4587
|
-
this.connectionStatus
|
|
4588
|
-
);
|
|
4589
|
-
}
|
|
4590
|
-
/**
|
|
4591
|
-
* Fetch stats for a player.
|
|
4592
|
-
* API-only — no RPC fallback available.
|
|
4593
|
-
*/
|
|
4594
|
-
async getPlayerStats(address) {
|
|
4595
|
-
return getPlayerStats(this.resolvedConfig.apiBaseUrl, address, this.apiCtx);
|
|
4596
|
-
}
|
|
4597
4501
|
// ---- Game Queries ----
|
|
4598
4502
|
/**
|
|
4599
4503
|
* Fetch tournaments for a specific game.
|
|
@@ -4752,6 +4656,6 @@ function createBudokanClient(config) {
|
|
|
4752
4656
|
return new BudokanClient(config);
|
|
4753
4657
|
}
|
|
4754
4658
|
|
|
4755
|
-
export { BudokanApiError, BudokanClient, BudokanConnectionError, BudokanError, BudokanTimeoutError, CHAINS, ConnectionStatus, DataSourceError, RpcError, TournamentNotFoundError, WSManager, camelToSnake, createBudokanClient, getActivity, getActivityStats, getChainConfig, getGameStats, getGameTournaments,
|
|
4659
|
+
export { BudokanApiError, BudokanClient, BudokanConnectionError, BudokanError, BudokanTimeoutError, CHAINS, ConnectionStatus, DataSourceError, RpcError, TournamentNotFoundError, WSManager, camelToSnake, createBudokanClient, getActivity, getActivityStats, getChainConfig, getGameStats, getGameTournaments, getPrizeStats, getTournament, getTournamentPrizeAggregation, getTournamentPrizes, getTournamentQualifications, getTournamentRegistrations, getTournamentRewardClaims, getTournamentRewardClaimsSummary, getTournaments, normalizeAddress, snakeToCamel, withRetry };
|
|
4756
4660
|
//# sourceMappingURL=index.js.map
|
|
4757
4661
|
//# sourceMappingURL=index.js.map
|