@provable-games/budokan-sdk 0.1.9 → 0.1.11
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-B-QSLs81.d.cts → client-ugXv3NlV.d.cts} +7 -1
- package/dist/{client-B-QSLs81.d.ts → client-ugXv3NlV.d.ts} +7 -1
- package/dist/index.cjs +43 -3
- 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 +43 -3
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +55 -12
- 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 +55 -12
- 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
|
});
|
|
@@ -594,8 +598,8 @@ var CHAINS = {
|
|
|
594
598
|
rpcUrl: "https://api.cartridge.gg/x/starknet/mainnet/rpc/v0_10",
|
|
595
599
|
apiBaseUrl: "https://budokan-api-production.up.railway.app",
|
|
596
600
|
wsUrl: "wss://budokan-api-production.up.railway.app/ws",
|
|
597
|
-
budokanAddress: "
|
|
598
|
-
viewerAddress: "
|
|
601
|
+
budokanAddress: "0x04dae41808911e51af8efe8ac3202cb3b2a32c10c169703010b7e0cbd885bf83",
|
|
602
|
+
viewerAddress: "0x02ef405cf2a8e8aec2946e5be39fa4e8bcb51cea5ce3573760418e7cdc7e5a22"
|
|
599
603
|
},
|
|
600
604
|
sepolia: {
|
|
601
605
|
rpcUrl: "https://starknet-sepolia.public.blastapi.io",
|
|
@@ -1147,6 +1151,34 @@ async function viewerRegistrations(contract, tournamentId, offset, limit) {
|
|
|
1147
1151
|
};
|
|
1148
1152
|
}, contract.address);
|
|
1149
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
|
+
}
|
|
1150
1182
|
async function viewerLeaderboard(contract, tournamentId, offset, limit) {
|
|
1151
1183
|
return wrapRpcCall(async () => {
|
|
1152
1184
|
const result = await contract.call("leaderboard", [tournamentId, offset, limit]);
|
|
@@ -2565,13 +2597,21 @@ var BudokanClient = class {
|
|
|
2565
2597
|
/**
|
|
2566
2598
|
* Fetch registrations for a tournament.
|
|
2567
2599
|
* Supports RPC fallback when API is unavailable.
|
|
2568
|
-
* 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.
|
|
2569
2603
|
*/
|
|
2570
2604
|
async getTournamentRegistrations(tournamentId, params) {
|
|
2571
2605
|
const rpcFallback = async () => {
|
|
2572
2606
|
const contract = await this.getViewerContract();
|
|
2573
2607
|
const offset = params?.offset ?? 0;
|
|
2574
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
|
+
}
|
|
2575
2615
|
return viewerRegistrations(contract, tournamentId, offset, limit);
|
|
2576
2616
|
};
|
|
2577
2617
|
if (this.resolvedConfig.primarySource === "rpc") {
|