@provable-games/budokan-sdk 0.1.19 → 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-B97mEKJc.d.cts → client-CoWIQozF.d.cts} +11 -27
- package/dist/{client-B97mEKJc.d.ts → client-CoWIQozF.d.ts} +11 -27
- package/dist/index.cjs +7 -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 +8 -105
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +155 -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 +153 -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
|
@@ -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,13 +354,13 @@ 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,
|
|
@@ -410,7 +375,7 @@ async function getActivity(baseUrl, params, ctx) {
|
|
|
410
375
|
limit: params?.limit,
|
|
411
376
|
offset: params?.offset
|
|
412
377
|
});
|
|
413
|
-
const result = await apiFetch(`${baseUrl}/activity${qs}`,
|
|
378
|
+
const result = await apiFetch(`${baseUrl}/activity${qs}`, fetchOpts3(ctx));
|
|
414
379
|
const { total, limit: resLimit, offset: resOffset } = extractPagination(result, { limit: params?.limit, offset: params?.offset });
|
|
415
380
|
return {
|
|
416
381
|
data: result.data.map((item) => snakeToCamel(item)),
|
|
@@ -422,14 +387,14 @@ async function getActivity(baseUrl, params, ctx) {
|
|
|
422
387
|
async function getActivityStats(baseUrl, ctx) {
|
|
423
388
|
const result = await apiFetch(
|
|
424
389
|
`${baseUrl}/activity/stats`,
|
|
425
|
-
|
|
390
|
+
fetchOpts3(ctx)
|
|
426
391
|
);
|
|
427
392
|
return snakeToCamel(result.data);
|
|
428
393
|
}
|
|
429
394
|
async function getPrizeStats(baseUrl, ctx) {
|
|
430
395
|
const result = await apiFetch(
|
|
431
396
|
`${baseUrl}/activity/prize-stats`,
|
|
432
|
-
|
|
397
|
+
fetchOpts3(ctx)
|
|
433
398
|
);
|
|
434
399
|
return snakeToCamel(result.data);
|
|
435
400
|
}
|
|
@@ -991,8 +956,6 @@ function parseRegistration(raw, tournamentId) {
|
|
|
991
956
|
gameTokenId: num.toHex(obj.game_token_id),
|
|
992
957
|
gameAddress: "",
|
|
993
958
|
// Not in on-chain struct
|
|
994
|
-
playerAddress: "",
|
|
995
|
-
// Not in on-chain struct
|
|
996
959
|
entryNumber: Number(obj.entry_id ?? 0),
|
|
997
960
|
hasSubmitted: Boolean(obj.has_submitted),
|
|
998
961
|
isBanned: Boolean(obj.is_banned)
|
|
@@ -1151,20 +1114,6 @@ async function viewerRegistrations(contract, tournamentId, offset, limit) {
|
|
|
1151
1114
|
};
|
|
1152
1115
|
}, contract.address);
|
|
1153
1116
|
}
|
|
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
1117
|
async function viewerRegistrationsByTokenIds(contract, tournamentId, tokenIds, offset, limit) {
|
|
1169
1118
|
return wrapRpcCall(async () => {
|
|
1170
1119
|
const result = await contract.call("tournament_registrations_by_token_ids", [tournamentId, tokenIds, offset, limit]);
|
|
@@ -1210,12 +1159,6 @@ async function viewerRewardClaims(contract, tournamentId, offset, limit) {
|
|
|
1210
1159
|
};
|
|
1211
1160
|
}, contract.address);
|
|
1212
1161
|
}
|
|
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
1162
|
|
|
1220
1163
|
// src/rpc/abis/budokanViewer.json
|
|
1221
1164
|
var budokanViewer_default = [
|
|
@@ -4523,9 +4466,6 @@ var BudokanClient = class {
|
|
|
4523
4466
|
const contract = await this.getViewerContract();
|
|
4524
4467
|
const offset = params?.offset ?? 0;
|
|
4525
4468
|
const limit = params?.limit ?? 20;
|
|
4526
|
-
if (params?.playerAddress) {
|
|
4527
|
-
return viewerRegistrationsByOwner(contract, tournamentId, params.playerAddress, offset, limit);
|
|
4528
|
-
}
|
|
4529
4469
|
if (params?.gameTokenIds?.length) {
|
|
4530
4470
|
return viewerRegistrationsByTokenIds(contract, tournamentId, params.gameTokenIds, offset, limit);
|
|
4531
4471
|
}
|
|
@@ -4558,43 +4498,6 @@ var BudokanClient = class {
|
|
|
4558
4498
|
this.connectionStatus
|
|
4559
4499
|
);
|
|
4560
4500
|
}
|
|
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
4501
|
// ---- Game Queries ----
|
|
4599
4502
|
/**
|
|
4600
4503
|
* Fetch tournaments for a specific game.
|
|
@@ -4753,6 +4656,6 @@ function createBudokanClient(config) {
|
|
|
4753
4656
|
return new BudokanClient(config);
|
|
4754
4657
|
}
|
|
4755
4658
|
|
|
4756
|
-
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 };
|
|
4757
4660
|
//# sourceMappingURL=index.js.map
|
|
4758
4661
|
//# sourceMappingURL=index.js.map
|