@provable-games/budokan-sdk 0.1.9 → 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-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 +41 -1
- 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 +41 -1
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +53 -10
- 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 +53 -10
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
|
@@ -358,9 +358,15 @@ declare class BudokanClient {
|
|
|
358
358
|
/**
|
|
359
359
|
* Fetch registrations for a tournament.
|
|
360
360
|
* Supports RPC fallback when API is unavailable.
|
|
361
|
-
* Note: In RPC mode, `playerAddress` and `gameAddress` fields will be empty strings
|
|
361
|
+
* Note: In RPC mode, `playerAddress` and `gameAddress` fields will be empty strings,
|
|
362
|
+
* and filter params (`playerAddress`, `gameTokenIds`, `hasSubmitted`, `isBanned`)
|
|
363
|
+
* are applied via on-chain viewer functions where supported.
|
|
362
364
|
*/
|
|
363
365
|
getTournamentRegistrations(tournamentId: string, params?: {
|
|
366
|
+
playerAddress?: string;
|
|
367
|
+
gameTokenIds?: string[];
|
|
368
|
+
hasSubmitted?: boolean;
|
|
369
|
+
isBanned?: boolean;
|
|
364
370
|
limit?: number;
|
|
365
371
|
offset?: number;
|
|
366
372
|
}): Promise<PaginatedResult<Registration>>;
|
|
@@ -358,9 +358,15 @@ declare class BudokanClient {
|
|
|
358
358
|
/**
|
|
359
359
|
* Fetch registrations for a tournament.
|
|
360
360
|
* Supports RPC fallback when API is unavailable.
|
|
361
|
-
* Note: In RPC mode, `playerAddress` and `gameAddress` fields will be empty strings
|
|
361
|
+
* Note: In RPC mode, `playerAddress` and `gameAddress` fields will be empty strings,
|
|
362
|
+
* and filter params (`playerAddress`, `gameTokenIds`, `hasSubmitted`, `isBanned`)
|
|
363
|
+
* are applied via on-chain viewer functions where supported.
|
|
362
364
|
*/
|
|
363
365
|
getTournamentRegistrations(tournamentId: string, params?: {
|
|
366
|
+
playerAddress?: string;
|
|
367
|
+
gameTokenIds?: string[];
|
|
368
|
+
hasSubmitted?: boolean;
|
|
369
|
+
isBanned?: boolean;
|
|
364
370
|
limit?: number;
|
|
365
371
|
offset?: number;
|
|
366
372
|
}): Promise<PaginatedResult<Registration>>;
|
package/dist/index.cjs
CHANGED
|
@@ -261,6 +261,10 @@ async function getTournamentLeaderboard(baseUrl, tournamentId, ctx) {
|
|
|
261
261
|
}
|
|
262
262
|
async function getTournamentRegistrations(baseUrl, tournamentId, params, ctx) {
|
|
263
263
|
const qs = buildQueryString({
|
|
264
|
+
player_address: params?.playerAddress,
|
|
265
|
+
game_token_ids: params?.gameTokenIds?.length ? params.gameTokenIds.join(",") : void 0,
|
|
266
|
+
has_submitted: params?.hasSubmitted,
|
|
267
|
+
is_banned: params?.isBanned,
|
|
264
268
|
limit: params?.limit,
|
|
265
269
|
offset: params?.offset
|
|
266
270
|
});
|
|
@@ -1149,6 +1153,34 @@ async function viewerRegistrations(contract, tournamentId, offset, limit) {
|
|
|
1149
1153
|
};
|
|
1150
1154
|
}, contract.address);
|
|
1151
1155
|
}
|
|
1156
|
+
async function viewerRegistrationsByOwner(contract, tournamentId, owner, offset, limit) {
|
|
1157
|
+
return wrapRpcCall(async () => {
|
|
1158
|
+
const result = await contract.call("tournament_registrations_by_owner", [tournamentId, owner, offset, limit]);
|
|
1159
|
+
const obj = result;
|
|
1160
|
+
const entries = obj.entries ?? [];
|
|
1161
|
+
const total = Number(obj.total ?? 0);
|
|
1162
|
+
return {
|
|
1163
|
+
data: entries.map((e) => parseRegistration(e, tournamentId)),
|
|
1164
|
+
total,
|
|
1165
|
+
limit,
|
|
1166
|
+
offset
|
|
1167
|
+
};
|
|
1168
|
+
}, contract.address);
|
|
1169
|
+
}
|
|
1170
|
+
async function viewerRegistrationsByTokenIds(contract, tournamentId, tokenIds, offset, limit) {
|
|
1171
|
+
return wrapRpcCall(async () => {
|
|
1172
|
+
const result = await contract.call("tournament_registrations_by_token_ids", [tournamentId, tokenIds, offset, limit]);
|
|
1173
|
+
const obj = result;
|
|
1174
|
+
const entries = obj.entries ?? [];
|
|
1175
|
+
const total = Number(obj.total ?? 0);
|
|
1176
|
+
return {
|
|
1177
|
+
data: entries.map((e) => parseRegistration(e, tournamentId)),
|
|
1178
|
+
total,
|
|
1179
|
+
limit,
|
|
1180
|
+
offset
|
|
1181
|
+
};
|
|
1182
|
+
}, contract.address);
|
|
1183
|
+
}
|
|
1152
1184
|
async function viewerLeaderboard(contract, tournamentId, offset, limit) {
|
|
1153
1185
|
return wrapRpcCall(async () => {
|
|
1154
1186
|
const result = await contract.call("leaderboard", [tournamentId, offset, limit]);
|
|
@@ -2567,13 +2599,21 @@ var BudokanClient = class {
|
|
|
2567
2599
|
/**
|
|
2568
2600
|
* Fetch registrations for a tournament.
|
|
2569
2601
|
* Supports RPC fallback when API is unavailable.
|
|
2570
|
-
* Note: In RPC mode, `playerAddress` and `gameAddress` fields will be empty strings
|
|
2602
|
+
* Note: In RPC mode, `playerAddress` and `gameAddress` fields will be empty strings,
|
|
2603
|
+
* and filter params (`playerAddress`, `gameTokenIds`, `hasSubmitted`, `isBanned`)
|
|
2604
|
+
* are applied via on-chain viewer functions where supported.
|
|
2571
2605
|
*/
|
|
2572
2606
|
async getTournamentRegistrations(tournamentId, params) {
|
|
2573
2607
|
const rpcFallback = async () => {
|
|
2574
2608
|
const contract = await this.getViewerContract();
|
|
2575
2609
|
const offset = params?.offset ?? 0;
|
|
2576
2610
|
const limit = params?.limit ?? 20;
|
|
2611
|
+
if (params?.playerAddress) {
|
|
2612
|
+
return viewerRegistrationsByOwner(contract, tournamentId, params.playerAddress, offset, limit);
|
|
2613
|
+
}
|
|
2614
|
+
if (params?.gameTokenIds?.length) {
|
|
2615
|
+
return viewerRegistrationsByTokenIds(contract, tournamentId, params.gameTokenIds, offset, limit);
|
|
2616
|
+
}
|
|
2577
2617
|
return viewerRegistrations(contract, tournamentId, offset, limit);
|
|
2578
2618
|
};
|
|
2579
2619
|
if (this.resolvedConfig.primarySource === "rpc") {
|