@provable-games/budokan-sdk 0.1.1 → 0.1.2
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/react.cjs +88 -2
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +55 -2
- package/dist/react.d.ts +55 -2
- package/dist/react.js +84 -3
- package/dist/react.js.map +1 -1
- package/package.json +2 -4
package/dist/react.cjs
CHANGED
|
@@ -2533,10 +2533,11 @@ function useBudokanClient() {
|
|
|
2533
2533
|
function useTournaments(params) {
|
|
2534
2534
|
const client = useBudokanClient();
|
|
2535
2535
|
const [tournaments, setTournaments] = react.useState(null);
|
|
2536
|
-
const [loading, setLoading] = react.useState(
|
|
2536
|
+
const [loading, setLoading] = react.useState(!!params);
|
|
2537
2537
|
const [error, setError] = react.useState(null);
|
|
2538
2538
|
const paramsKey = JSON.stringify(params);
|
|
2539
2539
|
const fetch2 = react.useCallback(() => {
|
|
2540
|
+
if (params === void 0) return;
|
|
2540
2541
|
setLoading(true);
|
|
2541
2542
|
setError(null);
|
|
2542
2543
|
client.getTournaments(params).then(setTournaments).catch(setError).finally(() => setLoading(false));
|
|
@@ -2562,6 +2563,37 @@ function useTournament(tournamentId) {
|
|
|
2562
2563
|
}, [fetch2]);
|
|
2563
2564
|
return { tournament, loading, error, refetch: fetch2 };
|
|
2564
2565
|
}
|
|
2566
|
+
function useTournamentCount(phase) {
|
|
2567
|
+
const client = useBudokanClient();
|
|
2568
|
+
const [count, setCount] = react.useState(null);
|
|
2569
|
+
const [loading, setLoading] = react.useState(true);
|
|
2570
|
+
const [error, setError] = react.useState(null);
|
|
2571
|
+
const fetch2 = react.useCallback(() => {
|
|
2572
|
+
setLoading(true);
|
|
2573
|
+
setError(null);
|
|
2574
|
+
client.getTournaments({ phase, limit: 1 }).then((r) => setCount(r.total ?? 0)).catch(setError).finally(() => setLoading(false));
|
|
2575
|
+
}, [client, phase]);
|
|
2576
|
+
react.useEffect(() => {
|
|
2577
|
+
fetch2();
|
|
2578
|
+
}, [fetch2]);
|
|
2579
|
+
return { count, loading, error, refetch: fetch2 };
|
|
2580
|
+
}
|
|
2581
|
+
function usePlayerTournamentCount(address, phase) {
|
|
2582
|
+
const client = useBudokanClient();
|
|
2583
|
+
const [count, setCount] = react.useState(null);
|
|
2584
|
+
const [loading, setLoading] = react.useState(!!address);
|
|
2585
|
+
const [error, setError] = react.useState(null);
|
|
2586
|
+
const fetch2 = react.useCallback(() => {
|
|
2587
|
+
if (!address) return;
|
|
2588
|
+
setLoading(true);
|
|
2589
|
+
setError(null);
|
|
2590
|
+
client.getPlayerTournaments(address, { phase, limit: 1 }).then((r) => setCount(r.total ?? 0)).catch(setError).finally(() => setLoading(false));
|
|
2591
|
+
}, [client, address, phase]);
|
|
2592
|
+
react.useEffect(() => {
|
|
2593
|
+
fetch2();
|
|
2594
|
+
}, [fetch2]);
|
|
2595
|
+
return { count, loading, error, refetch: fetch2 };
|
|
2596
|
+
}
|
|
2565
2597
|
function useLeaderboard(tournamentId) {
|
|
2566
2598
|
const client = useBudokanClient();
|
|
2567
2599
|
const [leaderboard, setLeaderboard] = react.useState(null);
|
|
@@ -2578,6 +2610,23 @@ function useLeaderboard(tournamentId) {
|
|
|
2578
2610
|
}, [fetch2]);
|
|
2579
2611
|
return { leaderboard, loading, error, refetch: fetch2 };
|
|
2580
2612
|
}
|
|
2613
|
+
function useRegistrations(tournamentId, params) {
|
|
2614
|
+
const client = useBudokanClient();
|
|
2615
|
+
const [registrations, setRegistrations] = react.useState(null);
|
|
2616
|
+
const [loading, setLoading] = react.useState(!!tournamentId);
|
|
2617
|
+
const [error, setError] = react.useState(null);
|
|
2618
|
+
const paramsKey = JSON.stringify(params);
|
|
2619
|
+
const fetch2 = react.useCallback(() => {
|
|
2620
|
+
if (!tournamentId) return;
|
|
2621
|
+
setLoading(true);
|
|
2622
|
+
setError(null);
|
|
2623
|
+
client.getTournamentRegistrations(tournamentId, params).then(setRegistrations).catch(setError).finally(() => setLoading(false));
|
|
2624
|
+
}, [client, tournamentId, paramsKey]);
|
|
2625
|
+
react.useEffect(() => {
|
|
2626
|
+
fetch2();
|
|
2627
|
+
}, [fetch2]);
|
|
2628
|
+
return { registrations, loading, error, refetch: fetch2 };
|
|
2629
|
+
}
|
|
2581
2630
|
function usePlayer(address) {
|
|
2582
2631
|
const client = useBudokanClient();
|
|
2583
2632
|
const [tournaments, setTournaments] = react.useState(null);
|
|
@@ -2622,12 +2671,13 @@ function usePlayerTournaments(address, params) {
|
|
|
2622
2671
|
const [tournaments, setTournaments] = react.useState(null);
|
|
2623
2672
|
const [loading, setLoading] = react.useState(!!address);
|
|
2624
2673
|
const [error, setError] = react.useState(null);
|
|
2674
|
+
const paramsKey = JSON.stringify(params);
|
|
2625
2675
|
const fetch2 = react.useCallback(() => {
|
|
2626
2676
|
if (!address) return;
|
|
2627
2677
|
setLoading(true);
|
|
2628
2678
|
setError(null);
|
|
2629
2679
|
client.getPlayerTournaments(address, params).then(setTournaments).catch(setError).finally(() => setLoading(false));
|
|
2630
|
-
}, [client, address,
|
|
2680
|
+
}, [client, address, paramsKey]);
|
|
2631
2681
|
react.useEffect(() => {
|
|
2632
2682
|
fetch2();
|
|
2633
2683
|
}, [fetch2]);
|
|
@@ -2696,6 +2746,22 @@ function usePrizeStats() {
|
|
|
2696
2746
|
}, [fetch2]);
|
|
2697
2747
|
return { prizeStats, loading, error, refetch: fetch2 };
|
|
2698
2748
|
}
|
|
2749
|
+
function usePrizeAggregation(tournamentId) {
|
|
2750
|
+
const client = useBudokanClient();
|
|
2751
|
+
const [prizeAggregation, setPrizeAggregation] = react.useState(null);
|
|
2752
|
+
const [loading, setLoading] = react.useState(!!tournamentId);
|
|
2753
|
+
const [error, setError] = react.useState(null);
|
|
2754
|
+
const fetch2 = react.useCallback(() => {
|
|
2755
|
+
if (!tournamentId) return;
|
|
2756
|
+
setLoading(true);
|
|
2757
|
+
setError(null);
|
|
2758
|
+
client.getTournamentPrizeAggregation(tournamentId).then(setPrizeAggregation).catch(setError).finally(() => setLoading(false));
|
|
2759
|
+
}, [client, tournamentId]);
|
|
2760
|
+
react.useEffect(() => {
|
|
2761
|
+
fetch2();
|
|
2762
|
+
}, [fetch2]);
|
|
2763
|
+
return { prizeAggregation, loading, error, refetch: fetch2 };
|
|
2764
|
+
}
|
|
2699
2765
|
function useQualifications(tournamentId) {
|
|
2700
2766
|
const client = useBudokanClient();
|
|
2701
2767
|
const [qualifications, setQualifications] = react.useState(null);
|
|
@@ -2712,6 +2778,21 @@ function useQualifications(tournamentId) {
|
|
|
2712
2778
|
}, [fetch2]);
|
|
2713
2779
|
return { qualifications, loading, error, refetch: fetch2 };
|
|
2714
2780
|
}
|
|
2781
|
+
function useActivityStats() {
|
|
2782
|
+
const client = useBudokanClient();
|
|
2783
|
+
const [stats, setStats] = react.useState(null);
|
|
2784
|
+
const [loading, setLoading] = react.useState(true);
|
|
2785
|
+
const [error, setError] = react.useState(null);
|
|
2786
|
+
const fetch2 = react.useCallback(() => {
|
|
2787
|
+
setLoading(true);
|
|
2788
|
+
setError(null);
|
|
2789
|
+
client.getActivityStats().then(setStats).catch(setError).finally(() => setLoading(false));
|
|
2790
|
+
}, [client]);
|
|
2791
|
+
react.useEffect(() => {
|
|
2792
|
+
fetch2();
|
|
2793
|
+
}, [fetch2]);
|
|
2794
|
+
return { stats, loading, error, refetch: fetch2 };
|
|
2795
|
+
}
|
|
2715
2796
|
function useSubscription(channels, tournamentIds) {
|
|
2716
2797
|
const client = useBudokanClient();
|
|
2717
2798
|
const [lastMessage, setLastMessage] = react.useState(null);
|
|
@@ -2758,19 +2839,24 @@ function useConnectionStatus() {
|
|
|
2758
2839
|
}
|
|
2759
2840
|
|
|
2760
2841
|
exports.BudokanProvider = BudokanProvider;
|
|
2842
|
+
exports.useActivityStats = useActivityStats;
|
|
2761
2843
|
exports.useBudokanClient = useBudokanClient;
|
|
2762
2844
|
exports.useConnectionStatus = useConnectionStatus;
|
|
2763
2845
|
exports.useLeaderboard = useLeaderboard;
|
|
2764
2846
|
exports.usePlayer = usePlayer;
|
|
2765
2847
|
exports.usePlayerStats = usePlayerStats;
|
|
2848
|
+
exports.usePlayerTournamentCount = usePlayerTournamentCount;
|
|
2766
2849
|
exports.usePlayerTournaments = usePlayerTournaments;
|
|
2850
|
+
exports.usePrizeAggregation = usePrizeAggregation;
|
|
2767
2851
|
exports.usePrizeStats = usePrizeStats;
|
|
2768
2852
|
exports.usePrizes = usePrizes;
|
|
2769
2853
|
exports.useQualifications = useQualifications;
|
|
2854
|
+
exports.useRegistrations = useRegistrations;
|
|
2770
2855
|
exports.useRewardClaims = useRewardClaims;
|
|
2771
2856
|
exports.useRewardClaimsSummary = useRewardClaimsSummary;
|
|
2772
2857
|
exports.useSubscription = useSubscription;
|
|
2773
2858
|
exports.useTournament = useTournament;
|
|
2859
|
+
exports.useTournamentCount = useTournamentCount;
|
|
2774
2860
|
exports.useTournaments = useTournaments;
|
|
2775
2861
|
//# sourceMappingURL=react.cjs.map
|
|
2776
2862
|
//# sourceMappingURL=react.cjs.map
|