@provable-games/budokan-sdk 0.1.8 → 0.1.10
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-CYj1Iw_w.d.cts → client-ugXv3NlV.d.cts} +8 -2
- package/dist/{client-CYj1Iw_w.d.ts → client-ugXv3NlV.d.ts} +8 -2
- package/dist/index.cjs +54 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +54 -7
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +66 -16
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +13 -4
- package/dist/react.d.ts +13 -4
- package/dist/react.js +66 -16
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as Tournament, L as LeaderboardEntry, 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 PlayerStats, g as PlayerTournamentParams, h as PlayerTournament, i as PlatformStats, A as ActivityParams, j as ActivityEvent, k as PrizeStats, W as WSSubscribeOptions, l as WSEventHandler } from './client-
|
|
2
|
-
export { B as BudokanClient, m as BudokanClientConfig, C as ConnectionMode, n as ConnectionStatus, o as ConnectionStatusState, D as DataSource, G as GameConfig, p as LeaderboardConfig, q as Phase, S as Schedule, r as WSChannel, s as WSEventMessage, t as WSMessage, u as WSSubscribeMessage, v as WSUnsubscribeMessage, w as createBudokanClient } from './client-
|
|
1
|
+
import { T as Tournament, L as LeaderboardEntry, 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 PlayerStats, g as PlayerTournamentParams, h as PlayerTournament, i as PlatformStats, A as ActivityParams, j as ActivityEvent, k as PrizeStats, W as WSSubscribeOptions, l as WSEventHandler } from './client-ugXv3NlV.cjs';
|
|
2
|
+
export { B as BudokanClient, m as BudokanClientConfig, C as ConnectionMode, n as ConnectionStatus, o as ConnectionStatusState, D as DataSource, G as GameConfig, p as LeaderboardConfig, q as Phase, S as Schedule, r as WSChannel, s as WSEventMessage, t as WSMessage, u as WSSubscribeMessage, v as WSUnsubscribeMessage, w as createBudokanClient } from './client-ugXv3NlV.cjs';
|
|
3
3
|
export { EntryFee } from '@provable-games/metagame-sdk';
|
|
4
4
|
import 'starknet';
|
|
5
5
|
|
|
@@ -52,6 +52,10 @@ declare function getTournamentLeaderboard(baseUrl: string, tournamentId: string,
|
|
|
52
52
|
* Fetch registrations for a tournament.
|
|
53
53
|
*/
|
|
54
54
|
declare function getTournamentRegistrations(baseUrl: string, tournamentId: string, params?: {
|
|
55
|
+
playerAddress?: string;
|
|
56
|
+
gameTokenIds?: string[];
|
|
57
|
+
hasSubmitted?: boolean;
|
|
58
|
+
isBanned?: boolean;
|
|
55
59
|
limit?: number;
|
|
56
60
|
offset?: number;
|
|
57
61
|
}, ctx?: ApiContext$3): Promise<PaginatedResult<Registration>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as Tournament, L as LeaderboardEntry, 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 PlayerStats, g as PlayerTournamentParams, h as PlayerTournament, i as PlatformStats, A as ActivityParams, j as ActivityEvent, k as PrizeStats, W as WSSubscribeOptions, l as WSEventHandler } from './client-
|
|
2
|
-
export { B as BudokanClient, m as BudokanClientConfig, C as ConnectionMode, n as ConnectionStatus, o as ConnectionStatusState, D as DataSource, G as GameConfig, p as LeaderboardConfig, q as Phase, S as Schedule, r as WSChannel, s as WSEventMessage, t as WSMessage, u as WSSubscribeMessage, v as WSUnsubscribeMessage, w as createBudokanClient } from './client-
|
|
1
|
+
import { T as Tournament, L as LeaderboardEntry, 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 PlayerStats, g as PlayerTournamentParams, h as PlayerTournament, i as PlatformStats, A as ActivityParams, j as ActivityEvent, k as PrizeStats, W as WSSubscribeOptions, l as WSEventHandler } from './client-ugXv3NlV.js';
|
|
2
|
+
export { B as BudokanClient, m as BudokanClientConfig, C as ConnectionMode, n as ConnectionStatus, o as ConnectionStatusState, D as DataSource, G as GameConfig, p as LeaderboardConfig, q as Phase, S as Schedule, r as WSChannel, s as WSEventMessage, t as WSMessage, u as WSSubscribeMessage, v as WSUnsubscribeMessage, w as createBudokanClient } from './client-ugXv3NlV.js';
|
|
3
3
|
export { EntryFee } from '@provable-games/metagame-sdk';
|
|
4
4
|
import 'starknet';
|
|
5
5
|
|
|
@@ -52,6 +52,10 @@ declare function getTournamentLeaderboard(baseUrl: string, tournamentId: string,
|
|
|
52
52
|
* Fetch registrations for a tournament.
|
|
53
53
|
*/
|
|
54
54
|
declare function getTournamentRegistrations(baseUrl: string, tournamentId: string, params?: {
|
|
55
|
+
playerAddress?: string;
|
|
56
|
+
gameTokenIds?: string[];
|
|
57
|
+
hasSubmitted?: boolean;
|
|
58
|
+
isBanned?: boolean;
|
|
55
59
|
limit?: number;
|
|
56
60
|
offset?: number;
|
|
57
61
|
}, ctx?: ApiContext$3): Promise<PaginatedResult<Registration>>;
|
package/dist/index.js
CHANGED
|
@@ -259,6 +259,10 @@ async function getTournamentLeaderboard(baseUrl, tournamentId, ctx) {
|
|
|
259
259
|
}
|
|
260
260
|
async function getTournamentRegistrations(baseUrl, tournamentId, params, ctx) {
|
|
261
261
|
const qs = buildQueryString({
|
|
262
|
+
player_address: params?.playerAddress,
|
|
263
|
+
game_token_ids: params?.gameTokenIds?.length ? params.gameTokenIds.join(",") : void 0,
|
|
264
|
+
has_submitted: params?.hasSubmitted,
|
|
265
|
+
is_banned: params?.isBanned,
|
|
262
266
|
limit: params?.limit,
|
|
263
267
|
offset: params?.offset
|
|
264
268
|
});
|
|
@@ -1122,7 +1126,9 @@ async function viewerTournamentsByPhase(contract, phase, offset, limit) {
|
|
|
1122
1126
|
async function viewerTournamentDetail(contract, tournamentId) {
|
|
1123
1127
|
return wrapRpcCall(async () => {
|
|
1124
1128
|
const result = await contract.call("tournament_detail", [tournamentId]);
|
|
1125
|
-
|
|
1129
|
+
const tournament = parseTournamentFullState(result);
|
|
1130
|
+
if (!tournament.gameAddress || tournament.gameAddress === "0x0") return null;
|
|
1131
|
+
return tournament;
|
|
1126
1132
|
}, contract.address);
|
|
1127
1133
|
}
|
|
1128
1134
|
async function viewerTournamentsBatch(contract, tournamentIds) {
|
|
@@ -1145,6 +1151,34 @@ async function viewerRegistrations(contract, tournamentId, offset, limit) {
|
|
|
1145
1151
|
};
|
|
1146
1152
|
}, contract.address);
|
|
1147
1153
|
}
|
|
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
|
+
async function viewerRegistrationsByTokenIds(contract, tournamentId, tokenIds, offset, limit) {
|
|
1169
|
+
return wrapRpcCall(async () => {
|
|
1170
|
+
const result = await contract.call("tournament_registrations_by_token_ids", [tournamentId, tokenIds, offset, limit]);
|
|
1171
|
+
const obj = result;
|
|
1172
|
+
const entries = obj.entries ?? [];
|
|
1173
|
+
const total = Number(obj.total ?? 0);
|
|
1174
|
+
return {
|
|
1175
|
+
data: entries.map((e) => parseRegistration(e, tournamentId)),
|
|
1176
|
+
total,
|
|
1177
|
+
limit,
|
|
1178
|
+
offset
|
|
1179
|
+
};
|
|
1180
|
+
}, contract.address);
|
|
1181
|
+
}
|
|
1148
1182
|
async function viewerLeaderboard(contract, tournamentId, offset, limit) {
|
|
1149
1183
|
return wrapRpcCall(async () => {
|
|
1150
1184
|
const result = await contract.call("leaderboard", [tournamentId, offset, limit]);
|
|
@@ -2531,11 +2565,16 @@ var BudokanClient = class {
|
|
|
2531
2565
|
if (this.resolvedConfig.primarySource === "rpc") {
|
|
2532
2566
|
return rpcFallback();
|
|
2533
2567
|
}
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2568
|
+
try {
|
|
2569
|
+
return await getTournament(this.resolvedConfig.apiBaseUrl, tournamentId, this.apiCtx);
|
|
2570
|
+
} catch {
|
|
2571
|
+
try {
|
|
2572
|
+
this.connectionStatus.markApiUnavailable();
|
|
2573
|
+
return await rpcFallback();
|
|
2574
|
+
} catch {
|
|
2575
|
+
return null;
|
|
2576
|
+
}
|
|
2577
|
+
}
|
|
2539
2578
|
}
|
|
2540
2579
|
/**
|
|
2541
2580
|
* Fetch the leaderboard for a tournament.
|
|
@@ -2558,13 +2597,21 @@ var BudokanClient = class {
|
|
|
2558
2597
|
/**
|
|
2559
2598
|
* Fetch registrations for a tournament.
|
|
2560
2599
|
* Supports RPC fallback when API is unavailable.
|
|
2561
|
-
* Note: In RPC mode, `playerAddress` and `gameAddress` fields will be empty strings
|
|
2600
|
+
* Note: In RPC mode, `playerAddress` and `gameAddress` fields will be empty strings,
|
|
2601
|
+
* and filter params (`playerAddress`, `gameTokenIds`, `hasSubmitted`, `isBanned`)
|
|
2602
|
+
* are applied via on-chain viewer functions where supported.
|
|
2562
2603
|
*/
|
|
2563
2604
|
async getTournamentRegistrations(tournamentId, params) {
|
|
2564
2605
|
const rpcFallback = async () => {
|
|
2565
2606
|
const contract = await this.getViewerContract();
|
|
2566
2607
|
const offset = params?.offset ?? 0;
|
|
2567
2608
|
const limit = params?.limit ?? 20;
|
|
2609
|
+
if (params?.playerAddress) {
|
|
2610
|
+
return viewerRegistrationsByOwner(contract, tournamentId, params.playerAddress, offset, limit);
|
|
2611
|
+
}
|
|
2612
|
+
if (params?.gameTokenIds?.length) {
|
|
2613
|
+
return viewerRegistrationsByTokenIds(contract, tournamentId, params.gameTokenIds, offset, limit);
|
|
2614
|
+
}
|
|
2568
2615
|
return viewerRegistrations(contract, tournamentId, offset, limit);
|
|
2569
2616
|
};
|
|
2570
2617
|
if (this.resolvedConfig.primarySource === "rpc") {
|