@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/react.cjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var react = require('react');
|
|
4
4
|
var starknet = require('starknet');
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var react$1 = require('@provable-games/denshokan-sdk/react');
|
|
6
7
|
|
|
7
8
|
// src/react/context.tsx
|
|
8
9
|
|
|
@@ -221,6 +222,7 @@ async function getTournaments(baseUrl, params, ctx) {
|
|
|
221
222
|
sort: params?.sort,
|
|
222
223
|
from_id: params?.fromId,
|
|
223
224
|
exclude_ids: params?.excludeIds?.join(","),
|
|
225
|
+
tournament_ids: params?.tournamentIds?.join(","),
|
|
224
226
|
whitelisted_extensions: params?.whitelistedExtensions?.join(","),
|
|
225
227
|
include_prizes: params?.includePrizeSummary
|
|
226
228
|
});
|
|
@@ -242,7 +244,6 @@ async function getTournament(baseUrl, tournamentId, ctx) {
|
|
|
242
244
|
}
|
|
243
245
|
async function getTournamentRegistrations(baseUrl, tournamentId, params, ctx) {
|
|
244
246
|
const qs = buildQueryString({
|
|
245
|
-
player_address: params?.playerAddress,
|
|
246
247
|
game_token_ids: params?.gameTokenIds?.length ? params.gameTokenIds.join(",") : void 0,
|
|
247
248
|
has_submitted: params?.hasSubmitted,
|
|
248
249
|
is_banned: params?.isBanned,
|
|
@@ -315,42 +316,8 @@ function normalizeAddress(address) {
|
|
|
315
316
|
return ("0x" + stripped.padStart(64, "0")).toLowerCase();
|
|
316
317
|
}
|
|
317
318
|
|
|
318
|
-
// src/api/players.ts
|
|
319
|
-
function fetchOpts2(ctx) {
|
|
320
|
-
return {
|
|
321
|
-
retryAttempts: ctx?.retryAttempts,
|
|
322
|
-
retryDelay: ctx?.retryDelay,
|
|
323
|
-
timeout: ctx?.timeout
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
|
-
async function getPlayerTournaments(baseUrl, address, params, ctx) {
|
|
327
|
-
const normalized = normalizeAddress(address);
|
|
328
|
-
const qs = buildQueryString({
|
|
329
|
-
limit: params?.limit,
|
|
330
|
-
offset: params?.offset,
|
|
331
|
-
phase: params?.phase,
|
|
332
|
-
game_token_ids: params?.gameTokenIds?.join(",")
|
|
333
|
-
});
|
|
334
|
-
const result = await apiFetch(`${baseUrl}/players/${normalized}/tournaments${qs}`, fetchOpts2(ctx));
|
|
335
|
-
const { total, limit: resLimit, offset: resOffset } = extractPagination(result, { limit: params?.limit, offset: params?.offset });
|
|
336
|
-
return {
|
|
337
|
-
data: result.data.map((item) => snakeToCamel(item)),
|
|
338
|
-
total,
|
|
339
|
-
limit: resLimit,
|
|
340
|
-
offset: resOffset
|
|
341
|
-
};
|
|
342
|
-
}
|
|
343
|
-
async function getPlayerStats(baseUrl, address, ctx) {
|
|
344
|
-
const normalized = normalizeAddress(address);
|
|
345
|
-
const result = await apiFetch(
|
|
346
|
-
`${baseUrl}/players/${normalized}/stats`,
|
|
347
|
-
fetchOpts2(ctx)
|
|
348
|
-
);
|
|
349
|
-
return snakeToCamel(result.data);
|
|
350
|
-
}
|
|
351
|
-
|
|
352
319
|
// src/api/games.ts
|
|
353
|
-
function
|
|
320
|
+
function fetchOpts2(ctx) {
|
|
354
321
|
return {
|
|
355
322
|
retryAttempts: ctx?.retryAttempts,
|
|
356
323
|
retryDelay: ctx?.retryDelay,
|
|
@@ -365,7 +332,7 @@ async function getGameTournaments(baseUrl, gameAddress, params, ctx) {
|
|
|
365
332
|
limit: params?.limit,
|
|
366
333
|
offset: params?.offset
|
|
367
334
|
});
|
|
368
|
-
const result = await apiFetch(`${baseUrl}/games/${normalized}/tournaments${qs}`,
|
|
335
|
+
const result = await apiFetch(`${baseUrl}/games/${normalized}/tournaments${qs}`, fetchOpts2(ctx));
|
|
369
336
|
const { total, limit: resLimit, offset: resOffset } = extractPagination(result, { limit: params?.limit, offset: params?.offset });
|
|
370
337
|
return {
|
|
371
338
|
data: result.data.map((item) => snakeToCamel(item)),
|
|
@@ -378,13 +345,13 @@ async function getGameStats(baseUrl, gameAddress, ctx) {
|
|
|
378
345
|
const normalized = normalizeAddress(gameAddress);
|
|
379
346
|
const result = await apiFetch(
|
|
380
347
|
`${baseUrl}/games/${normalized}/stats`,
|
|
381
|
-
|
|
348
|
+
fetchOpts2(ctx)
|
|
382
349
|
);
|
|
383
350
|
return snakeToCamel(result.data);
|
|
384
351
|
}
|
|
385
352
|
|
|
386
353
|
// src/api/activity.ts
|
|
387
|
-
function
|
|
354
|
+
function fetchOpts3(ctx) {
|
|
388
355
|
return {
|
|
389
356
|
retryAttempts: ctx?.retryAttempts,
|
|
390
357
|
retryDelay: ctx?.retryDelay,
|
|
@@ -399,7 +366,7 @@ async function getActivity(baseUrl, params, ctx) {
|
|
|
399
366
|
limit: params?.limit,
|
|
400
367
|
offset: params?.offset
|
|
401
368
|
});
|
|
402
|
-
const result = await apiFetch(`${baseUrl}/activity${qs}`,
|
|
369
|
+
const result = await apiFetch(`${baseUrl}/activity${qs}`, fetchOpts3(ctx));
|
|
403
370
|
const { total, limit: resLimit, offset: resOffset } = extractPagination(result, { limit: params?.limit, offset: params?.offset });
|
|
404
371
|
return {
|
|
405
372
|
data: result.data.map((item) => snakeToCamel(item)),
|
|
@@ -411,14 +378,14 @@ async function getActivity(baseUrl, params, ctx) {
|
|
|
411
378
|
async function getActivityStats(baseUrl, ctx) {
|
|
412
379
|
const result = await apiFetch(
|
|
413
380
|
`${baseUrl}/activity/stats`,
|
|
414
|
-
|
|
381
|
+
fetchOpts3(ctx)
|
|
415
382
|
);
|
|
416
383
|
return snakeToCamel(result.data);
|
|
417
384
|
}
|
|
418
385
|
async function getPrizeStats(baseUrl, ctx) {
|
|
419
386
|
const result = await apiFetch(
|
|
420
387
|
`${baseUrl}/activity/prize-stats`,
|
|
421
|
-
|
|
388
|
+
fetchOpts3(ctx)
|
|
422
389
|
);
|
|
423
390
|
return snakeToCamel(result.data);
|
|
424
391
|
}
|
|
@@ -980,8 +947,6 @@ function parseRegistration(raw, tournamentId) {
|
|
|
980
947
|
gameTokenId: starknet.num.toHex(obj.game_token_id),
|
|
981
948
|
gameAddress: "",
|
|
982
949
|
// Not in on-chain struct
|
|
983
|
-
playerAddress: "",
|
|
984
|
-
// Not in on-chain struct
|
|
985
950
|
entryNumber: Number(obj.entry_id ?? 0),
|
|
986
951
|
hasSubmitted: Boolean(obj.has_submitted),
|
|
987
952
|
isBanned: Boolean(obj.is_banned)
|
|
@@ -1140,20 +1105,6 @@ async function viewerRegistrations(contract, tournamentId, offset, limit) {
|
|
|
1140
1105
|
};
|
|
1141
1106
|
}, contract.address);
|
|
1142
1107
|
}
|
|
1143
|
-
async function viewerRegistrationsByOwner(contract, tournamentId, owner, offset, limit) {
|
|
1144
|
-
return wrapRpcCall(async () => {
|
|
1145
|
-
const result = await contract.call("tournament_registrations_by_owner", [tournamentId, owner, offset, limit]);
|
|
1146
|
-
const obj = result;
|
|
1147
|
-
const entries = obj.entries ?? [];
|
|
1148
|
-
const total = Number(obj.total ?? 0);
|
|
1149
|
-
return {
|
|
1150
|
-
data: entries.map((e) => parseRegistration(e, tournamentId)),
|
|
1151
|
-
total,
|
|
1152
|
-
limit,
|
|
1153
|
-
offset
|
|
1154
|
-
};
|
|
1155
|
-
}, contract.address);
|
|
1156
|
-
}
|
|
1157
1108
|
async function viewerRegistrationsByTokenIds(contract, tournamentId, tokenIds, offset, limit) {
|
|
1158
1109
|
return wrapRpcCall(async () => {
|
|
1159
1110
|
const result = await contract.call("tournament_registrations_by_token_ids", [tournamentId, tokenIds, offset, limit]);
|
|
@@ -1199,12 +1150,6 @@ async function viewerRewardClaims(contract, tournamentId, offset, limit) {
|
|
|
1199
1150
|
};
|
|
1200
1151
|
}, contract.address);
|
|
1201
1152
|
}
|
|
1202
|
-
async function viewerPlayerTournaments(contract, playerAddress, offset, limit) {
|
|
1203
|
-
return wrapRpcCall(async () => {
|
|
1204
|
-
const result = await contract.call("player_tournaments", [playerAddress, offset, limit]);
|
|
1205
|
-
return parseFilterResult(result);
|
|
1206
|
-
}, contract.address);
|
|
1207
|
-
}
|
|
1208
1153
|
|
|
1209
1154
|
// src/rpc/abis/budokanViewer.json
|
|
1210
1155
|
var budokanViewer_default = [
|
|
@@ -4512,9 +4457,6 @@ var BudokanClient = class {
|
|
|
4512
4457
|
const contract = await this.getViewerContract();
|
|
4513
4458
|
const offset = params?.offset ?? 0;
|
|
4514
4459
|
const limit = params?.limit ?? 20;
|
|
4515
|
-
if (params?.playerAddress) {
|
|
4516
|
-
return viewerRegistrationsByOwner(contract, tournamentId, params.playerAddress, offset, limit);
|
|
4517
|
-
}
|
|
4518
4460
|
if (params?.gameTokenIds?.length) {
|
|
4519
4461
|
return viewerRegistrationsByTokenIds(contract, tournamentId, params.gameTokenIds, offset, limit);
|
|
4520
4462
|
}
|
|
@@ -4547,43 +4489,6 @@ var BudokanClient = class {
|
|
|
4547
4489
|
this.connectionStatus
|
|
4548
4490
|
);
|
|
4549
4491
|
}
|
|
4550
|
-
// ---- Player Queries (API-only, no on-chain equivalent) ----
|
|
4551
|
-
/**
|
|
4552
|
-
* Fetch tournaments that a player has registered for.
|
|
4553
|
-
* Supports RPC fallback via viewer contract.
|
|
4554
|
-
*/
|
|
4555
|
-
async getPlayerTournaments(address, params) {
|
|
4556
|
-
const rpcFallback = async () => {
|
|
4557
|
-
const contract = await this.getViewerContract();
|
|
4558
|
-
const offset = params?.offset ?? 0;
|
|
4559
|
-
const limit = params?.limit ?? 20;
|
|
4560
|
-
const filterResult = await viewerPlayerTournaments(contract, address, offset, limit);
|
|
4561
|
-
let data = [];
|
|
4562
|
-
if (filterResult.tournamentIds.length > 0) {
|
|
4563
|
-
const tournaments = await viewerTournamentsBatch(contract, filterResult.tournamentIds);
|
|
4564
|
-
data = tournaments.map((t) => ({
|
|
4565
|
-
...t,
|
|
4566
|
-
tournamentId: t.id
|
|
4567
|
-
}));
|
|
4568
|
-
}
|
|
4569
|
-
return { data, total: filterResult.total, limit, offset };
|
|
4570
|
-
};
|
|
4571
|
-
if (this.resolvedConfig.primarySource === "rpc") {
|
|
4572
|
-
return rpcFallback();
|
|
4573
|
-
}
|
|
4574
|
-
return withFallback(
|
|
4575
|
-
() => getPlayerTournaments(this.resolvedConfig.apiBaseUrl, address, params, this.apiCtx),
|
|
4576
|
-
rpcFallback,
|
|
4577
|
-
this.connectionStatus
|
|
4578
|
-
);
|
|
4579
|
-
}
|
|
4580
|
-
/**
|
|
4581
|
-
* Fetch stats for a player.
|
|
4582
|
-
* API-only — no RPC fallback available.
|
|
4583
|
-
*/
|
|
4584
|
-
async getPlayerStats(address) {
|
|
4585
|
-
return getPlayerStats(this.resolvedConfig.apiBaseUrl, address, this.apiCtx);
|
|
4586
|
-
}
|
|
4587
4492
|
// ---- Game Queries ----
|
|
4588
4493
|
/**
|
|
4589
4494
|
* Fetch tournaments for a specific game.
|
|
@@ -4849,30 +4754,6 @@ function useTournamentCount(phase) {
|
|
|
4849
4754
|
}, [fetch2]);
|
|
4850
4755
|
return { count, loading, error, refetch: fetch2 };
|
|
4851
4756
|
}
|
|
4852
|
-
function usePlayerTournamentCount(address, phase) {
|
|
4853
|
-
const client = useBudokanClient();
|
|
4854
|
-
const [count, setCount] = react.useState(null);
|
|
4855
|
-
const [loading, setLoading] = react.useState(!!address);
|
|
4856
|
-
const [error, setError] = react.useState(null);
|
|
4857
|
-
useResetOnClient(client, setCount, setError);
|
|
4858
|
-
const fetch2 = react.useCallback(async () => {
|
|
4859
|
-
if (!address) return;
|
|
4860
|
-
setLoading(true);
|
|
4861
|
-
setError(null);
|
|
4862
|
-
try {
|
|
4863
|
-
const result = await client.getPlayerTournaments(address, { phase, limit: 1 });
|
|
4864
|
-
setCount(result.total ?? 0);
|
|
4865
|
-
} catch (e) {
|
|
4866
|
-
setError(e);
|
|
4867
|
-
} finally {
|
|
4868
|
-
setLoading(false);
|
|
4869
|
-
}
|
|
4870
|
-
}, [client, address, phase]);
|
|
4871
|
-
react.useEffect(() => {
|
|
4872
|
-
fetch2();
|
|
4873
|
-
}, [fetch2]);
|
|
4874
|
-
return { count, loading, error, refetch: fetch2 };
|
|
4875
|
-
}
|
|
4876
4757
|
function useLeaderboard(tournamentId) {
|
|
4877
4758
|
const client = useBudokanClient();
|
|
4878
4759
|
const [leaderboard, setLeaderboard] = react.useState(null);
|
|
@@ -4922,84 +4803,157 @@ function useRegistrations(tournamentId, params) {
|
|
|
4922
4803
|
}, [fetch2]);
|
|
4923
4804
|
return { registrations, loading, error, refetch: fetch2 };
|
|
4924
4805
|
}
|
|
4925
|
-
|
|
4806
|
+
var MAX_OWNED_TOKENS = 1e3;
|
|
4807
|
+
var emptyPage = (limit, offset) => ({
|
|
4808
|
+
data: [],
|
|
4809
|
+
total: 0,
|
|
4810
|
+
limit,
|
|
4811
|
+
offset
|
|
4812
|
+
});
|
|
4813
|
+
function useOwnedTournamentIds(owner, contextId) {
|
|
4926
4814
|
const client = useBudokanClient();
|
|
4927
|
-
const
|
|
4928
|
-
const
|
|
4929
|
-
const
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
} catch (e) {
|
|
4945
|
-
setError(e);
|
|
4946
|
-
} finally {
|
|
4947
|
-
setLoading(false);
|
|
4815
|
+
const budokanAddress = client.clientConfig.budokanAddress;
|
|
4816
|
+
const enabled = !!owner && !!budokanAddress;
|
|
4817
|
+
const { data, isLoading } = react$1.useTokens(
|
|
4818
|
+
enabled ? {
|
|
4819
|
+
owner,
|
|
4820
|
+
minterAddress: budokanAddress,
|
|
4821
|
+
hasContext: true,
|
|
4822
|
+
...{},
|
|
4823
|
+
limit: MAX_OWNED_TOKENS
|
|
4824
|
+
} : void 0
|
|
4825
|
+
);
|
|
4826
|
+
const tournamentIds = react.useMemo(() => {
|
|
4827
|
+
if (!enabled) return null;
|
|
4828
|
+
if (!data?.data) return null;
|
|
4829
|
+
const ids = /* @__PURE__ */ new Set();
|
|
4830
|
+
for (const t of data.data) {
|
|
4831
|
+
if (t.contextId) ids.add(String(t.contextId));
|
|
4948
4832
|
}
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
}, [fetch2]);
|
|
4953
|
-
return { tournaments, stats, loading, error };
|
|
4833
|
+
return [...ids];
|
|
4834
|
+
}, [enabled, data]);
|
|
4835
|
+
return { tournamentIds, loading: isLoading };
|
|
4954
4836
|
}
|
|
4955
|
-
function
|
|
4956
|
-
const
|
|
4957
|
-
const
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4837
|
+
function useTournamentsByOwner(owner, params) {
|
|
4838
|
+
const { tournamentIds, loading: tokensLoading } = useOwnedTournamentIds(owner);
|
|
4839
|
+
const inner = useTournaments(
|
|
4840
|
+
tournamentIds && tournamentIds.length > 0 ? {
|
|
4841
|
+
tournamentIds,
|
|
4842
|
+
phase: params?.phase,
|
|
4843
|
+
limit: params?.limit,
|
|
4844
|
+
offset: params?.offset,
|
|
4845
|
+
sort: params?.sort,
|
|
4846
|
+
includePrizeSummary: params?.includePrizeSummary
|
|
4847
|
+
} : void 0
|
|
4848
|
+
);
|
|
4849
|
+
if (tournamentIds !== null && tournamentIds.length === 0) {
|
|
4850
|
+
return {
|
|
4851
|
+
tournaments: emptyPage(
|
|
4852
|
+
params?.limit ?? 50,
|
|
4853
|
+
params?.offset ?? 0
|
|
4854
|
+
),
|
|
4855
|
+
loading: false,
|
|
4856
|
+
error: null,
|
|
4857
|
+
refetch: async () => {
|
|
4858
|
+
}
|
|
4859
|
+
};
|
|
4860
|
+
}
|
|
4861
|
+
return {
|
|
4862
|
+
tournaments: inner.tournaments,
|
|
4863
|
+
loading: tokensLoading || inner.loading,
|
|
4864
|
+
error: inner.error,
|
|
4865
|
+
refetch: inner.refetch
|
|
4866
|
+
};
|
|
4867
|
+
}
|
|
4868
|
+
function useTournamentsByOwnerCount(owner, params) {
|
|
4869
|
+
const { tournamentIds, loading: tokensLoading } = useOwnedTournamentIds(owner);
|
|
4870
|
+
const phaseFilter = params?.phase;
|
|
4871
|
+
const filtered = useTournaments(
|
|
4872
|
+
phaseFilter && tournamentIds && tournamentIds.length > 0 ? { tournamentIds, phase: phaseFilter, limit: 1 } : void 0
|
|
4873
|
+
);
|
|
4874
|
+
if (tournamentIds === null) {
|
|
4875
|
+
return {
|
|
4876
|
+
count: null,
|
|
4877
|
+
loading: tokensLoading,
|
|
4878
|
+
error: null,
|
|
4879
|
+
refetch: async () => {
|
|
4880
|
+
}
|
|
4881
|
+
};
|
|
4882
|
+
}
|
|
4883
|
+
if (tournamentIds.length === 0) {
|
|
4884
|
+
return {
|
|
4885
|
+
count: 0,
|
|
4886
|
+
loading: false,
|
|
4887
|
+
error: null,
|
|
4888
|
+
refetch: async () => {
|
|
4889
|
+
}
|
|
4890
|
+
};
|
|
4891
|
+
}
|
|
4892
|
+
if (!phaseFilter) {
|
|
4893
|
+
return {
|
|
4894
|
+
count: tournamentIds.length,
|
|
4895
|
+
loading: false,
|
|
4896
|
+
error: null,
|
|
4897
|
+
refetch: async () => {
|
|
4898
|
+
}
|
|
4899
|
+
};
|
|
4900
|
+
}
|
|
4901
|
+
return {
|
|
4902
|
+
count: filtered.tournaments?.total ?? null,
|
|
4903
|
+
loading: filtered.loading,
|
|
4904
|
+
error: filtered.error,
|
|
4905
|
+
refetch: async () => {
|
|
4972
4906
|
}
|
|
4973
|
-
}
|
|
4974
|
-
react.useEffect(() => {
|
|
4975
|
-
fetch2();
|
|
4976
|
-
}, [fetch2]);
|
|
4977
|
-
return { stats, loading, error, refetch: fetch2 };
|
|
4907
|
+
};
|
|
4978
4908
|
}
|
|
4979
|
-
function
|
|
4909
|
+
function useRegistrationsByOwner(tournamentId, owner, params) {
|
|
4980
4910
|
const client = useBudokanClient();
|
|
4981
|
-
const
|
|
4982
|
-
const
|
|
4983
|
-
const
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4911
|
+
const budokanAddress = client.clientConfig.budokanAddress;
|
|
4912
|
+
const contextId = tournamentId ? Number(tournamentId) : void 0;
|
|
4913
|
+
const enabled = !!owner && !!budokanAddress && tournamentId != null && contextId !== void 0;
|
|
4914
|
+
const { data: tokensResult, isLoading: tokensLoading } = react$1.useTokens(
|
|
4915
|
+
enabled ? {
|
|
4916
|
+
owner,
|
|
4917
|
+
minterAddress: budokanAddress,
|
|
4918
|
+
contextId,
|
|
4919
|
+
limit: MAX_OWNED_TOKENS
|
|
4920
|
+
} : void 0
|
|
4921
|
+
);
|
|
4922
|
+
const ownedGameTokenIds = react.useMemo(() => {
|
|
4923
|
+
if (!enabled) return null;
|
|
4924
|
+
if (!tokensResult?.data) return null;
|
|
4925
|
+
const ids = [];
|
|
4926
|
+
for (const t of tokensResult.data) {
|
|
4927
|
+
if (t.tokenId == null) continue;
|
|
4928
|
+
try {
|
|
4929
|
+
ids.push(BigInt(String(t.tokenId)).toString());
|
|
4930
|
+
} catch {
|
|
4931
|
+
}
|
|
4997
4932
|
}
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
4933
|
+
return ids;
|
|
4934
|
+
}, [enabled, tokensResult]);
|
|
4935
|
+
const inner = useRegistrations(
|
|
4936
|
+
ownedGameTokenIds && ownedGameTokenIds.length > 0 ? tournamentId : void 0,
|
|
4937
|
+
ownedGameTokenIds && ownedGameTokenIds.length > 0 ? { ...params, gameTokenIds: ownedGameTokenIds } : void 0
|
|
4938
|
+
);
|
|
4939
|
+
if (ownedGameTokenIds !== null && ownedGameTokenIds.length === 0) {
|
|
4940
|
+
return {
|
|
4941
|
+
registrations: emptyPage(
|
|
4942
|
+
params?.limit ?? 50,
|
|
4943
|
+
params?.offset ?? 0
|
|
4944
|
+
),
|
|
4945
|
+
loading: false,
|
|
4946
|
+
error: null,
|
|
4947
|
+
refetch: async () => {
|
|
4948
|
+
}
|
|
4949
|
+
};
|
|
4950
|
+
}
|
|
4951
|
+
return {
|
|
4952
|
+
registrations: inner.registrations,
|
|
4953
|
+
loading: tokensLoading || inner.loading,
|
|
4954
|
+
error: inner.error,
|
|
4955
|
+
refetch: inner.refetch
|
|
4956
|
+
};
|
|
5003
4957
|
}
|
|
5004
4958
|
function useRewardClaims(tournamentId, params) {
|
|
5005
4959
|
const client = useBudokanClient();
|
|
@@ -5219,20 +5173,19 @@ exports.useActivityStats = useActivityStats;
|
|
|
5219
5173
|
exports.useBudokanClient = useBudokanClient;
|
|
5220
5174
|
exports.useConnectionStatus = useConnectionStatus;
|
|
5221
5175
|
exports.useLeaderboard = useLeaderboard;
|
|
5222
|
-
exports.usePlayer = usePlayer;
|
|
5223
|
-
exports.usePlayerStats = usePlayerStats;
|
|
5224
|
-
exports.usePlayerTournamentCount = usePlayerTournamentCount;
|
|
5225
|
-
exports.usePlayerTournaments = usePlayerTournaments;
|
|
5226
5176
|
exports.usePrizeAggregation = usePrizeAggregation;
|
|
5227
5177
|
exports.usePrizeStats = usePrizeStats;
|
|
5228
5178
|
exports.usePrizes = usePrizes;
|
|
5229
5179
|
exports.useQualifications = useQualifications;
|
|
5230
5180
|
exports.useRegistrations = useRegistrations;
|
|
5181
|
+
exports.useRegistrationsByOwner = useRegistrationsByOwner;
|
|
5231
5182
|
exports.useRewardClaims = useRewardClaims;
|
|
5232
5183
|
exports.useRewardClaimsSummary = useRewardClaimsSummary;
|
|
5233
5184
|
exports.useSubscription = useSubscription;
|
|
5234
5185
|
exports.useTournament = useTournament;
|
|
5235
5186
|
exports.useTournamentCount = useTournamentCount;
|
|
5236
5187
|
exports.useTournaments = useTournaments;
|
|
5188
|
+
exports.useTournamentsByOwner = useTournamentsByOwner;
|
|
5189
|
+
exports.useTournamentsByOwnerCount = useTournamentsByOwnerCount;
|
|
5237
5190
|
//# sourceMappingURL=react.cjs.map
|
|
5238
5191
|
//# sourceMappingURL=react.cjs.map
|