@provable-games/budokan-sdk 0.1.7 → 0.1.8
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 +146 -36
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +14 -14
- package/dist/react.d.ts +14 -14
- package/dist/react.js +146 -36
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
package/dist/react.cjs
CHANGED
|
@@ -2821,11 +2821,18 @@ function useTournaments(params) {
|
|
|
2821
2821
|
const [error, setError] = react.useState(null);
|
|
2822
2822
|
const paramsKey = JSON.stringify(params);
|
|
2823
2823
|
useResetOnClient(client, setTournaments, setError);
|
|
2824
|
-
const fetch2 = react.useCallback(() => {
|
|
2824
|
+
const fetch2 = react.useCallback(async () => {
|
|
2825
2825
|
if (params === void 0) return;
|
|
2826
2826
|
setLoading(true);
|
|
2827
2827
|
setError(null);
|
|
2828
|
-
|
|
2828
|
+
try {
|
|
2829
|
+
const result = await client.getTournaments(params);
|
|
2830
|
+
setTournaments(result);
|
|
2831
|
+
} catch (e) {
|
|
2832
|
+
setError(e);
|
|
2833
|
+
} finally {
|
|
2834
|
+
setLoading(false);
|
|
2835
|
+
}
|
|
2829
2836
|
}, [client, paramsKey]);
|
|
2830
2837
|
react.useEffect(() => {
|
|
2831
2838
|
fetch2();
|
|
@@ -2838,11 +2845,18 @@ function useTournament(tournamentId) {
|
|
|
2838
2845
|
const [loading, setLoading] = react.useState(!!tournamentId);
|
|
2839
2846
|
const [error, setError] = react.useState(null);
|
|
2840
2847
|
useResetOnClient(client, setTournament, setError);
|
|
2841
|
-
const fetch2 = react.useCallback(() => {
|
|
2848
|
+
const fetch2 = react.useCallback(async () => {
|
|
2842
2849
|
if (!tournamentId) return;
|
|
2843
2850
|
setLoading(true);
|
|
2844
2851
|
setError(null);
|
|
2845
|
-
|
|
2852
|
+
try {
|
|
2853
|
+
const data = await client.getTournament(tournamentId);
|
|
2854
|
+
setTournament(data);
|
|
2855
|
+
} catch (e) {
|
|
2856
|
+
setError(e);
|
|
2857
|
+
} finally {
|
|
2858
|
+
setLoading(false);
|
|
2859
|
+
}
|
|
2846
2860
|
}, [client, tournamentId]);
|
|
2847
2861
|
react.useEffect(() => {
|
|
2848
2862
|
fetch2();
|
|
@@ -2855,10 +2869,17 @@ function useTournamentCount(phase) {
|
|
|
2855
2869
|
const [loading, setLoading] = react.useState(true);
|
|
2856
2870
|
const [error, setError] = react.useState(null);
|
|
2857
2871
|
useResetOnClient(client, setCount, setError);
|
|
2858
|
-
const fetch2 = react.useCallback(() => {
|
|
2872
|
+
const fetch2 = react.useCallback(async () => {
|
|
2859
2873
|
setLoading(true);
|
|
2860
2874
|
setError(null);
|
|
2861
|
-
|
|
2875
|
+
try {
|
|
2876
|
+
const result = await client.getTournaments({ phase, limit: 1 });
|
|
2877
|
+
setCount(result.total ?? 0);
|
|
2878
|
+
} catch (e) {
|
|
2879
|
+
setError(e);
|
|
2880
|
+
} finally {
|
|
2881
|
+
setLoading(false);
|
|
2882
|
+
}
|
|
2862
2883
|
}, [client, phase]);
|
|
2863
2884
|
react.useEffect(() => {
|
|
2864
2885
|
fetch2();
|
|
@@ -2871,11 +2892,18 @@ function usePlayerTournamentCount(address, phase) {
|
|
|
2871
2892
|
const [loading, setLoading] = react.useState(!!address);
|
|
2872
2893
|
const [error, setError] = react.useState(null);
|
|
2873
2894
|
useResetOnClient(client, setCount, setError);
|
|
2874
|
-
const fetch2 = react.useCallback(() => {
|
|
2895
|
+
const fetch2 = react.useCallback(async () => {
|
|
2875
2896
|
if (!address) return;
|
|
2876
2897
|
setLoading(true);
|
|
2877
2898
|
setError(null);
|
|
2878
|
-
|
|
2899
|
+
try {
|
|
2900
|
+
const result = await client.getPlayerTournaments(address, { phase, limit: 1 });
|
|
2901
|
+
setCount(result.total ?? 0);
|
|
2902
|
+
} catch (e) {
|
|
2903
|
+
setError(e);
|
|
2904
|
+
} finally {
|
|
2905
|
+
setLoading(false);
|
|
2906
|
+
}
|
|
2879
2907
|
}, [client, address, phase]);
|
|
2880
2908
|
react.useEffect(() => {
|
|
2881
2909
|
fetch2();
|
|
@@ -2888,11 +2916,18 @@ function useLeaderboard(tournamentId) {
|
|
|
2888
2916
|
const [loading, setLoading] = react.useState(!!tournamentId);
|
|
2889
2917
|
const [error, setError] = react.useState(null);
|
|
2890
2918
|
useResetOnClient(client, setLeaderboard, setError);
|
|
2891
|
-
const fetch2 = react.useCallback(() => {
|
|
2919
|
+
const fetch2 = react.useCallback(async () => {
|
|
2892
2920
|
if (!tournamentId) return;
|
|
2893
2921
|
setLoading(true);
|
|
2894
2922
|
setError(null);
|
|
2895
|
-
|
|
2923
|
+
try {
|
|
2924
|
+
const result = await client.getTournamentLeaderboard(tournamentId);
|
|
2925
|
+
setLeaderboard(result);
|
|
2926
|
+
} catch (e) {
|
|
2927
|
+
setError(e);
|
|
2928
|
+
} finally {
|
|
2929
|
+
setLoading(false);
|
|
2930
|
+
}
|
|
2896
2931
|
}, [client, tournamentId]);
|
|
2897
2932
|
react.useEffect(() => {
|
|
2898
2933
|
fetch2();
|
|
@@ -2906,11 +2941,18 @@ function useRegistrations(tournamentId, params) {
|
|
|
2906
2941
|
const [error, setError] = react.useState(null);
|
|
2907
2942
|
useResetOnClient(client, setRegistrations, setError);
|
|
2908
2943
|
const paramsKey = JSON.stringify(params);
|
|
2909
|
-
const fetch2 = react.useCallback(() => {
|
|
2944
|
+
const fetch2 = react.useCallback(async () => {
|
|
2910
2945
|
if (!tournamentId) return;
|
|
2911
2946
|
setLoading(true);
|
|
2912
2947
|
setError(null);
|
|
2913
|
-
|
|
2948
|
+
try {
|
|
2949
|
+
const result = await client.getTournamentRegistrations(tournamentId, params);
|
|
2950
|
+
setRegistrations(result);
|
|
2951
|
+
} catch (e) {
|
|
2952
|
+
setError(e);
|
|
2953
|
+
} finally {
|
|
2954
|
+
setLoading(false);
|
|
2955
|
+
}
|
|
2914
2956
|
}, [client, tournamentId, paramsKey]);
|
|
2915
2957
|
react.useEffect(() => {
|
|
2916
2958
|
fetch2();
|
|
@@ -2924,17 +2966,22 @@ function usePlayer(address) {
|
|
|
2924
2966
|
const [loading, setLoading] = react.useState(!!address);
|
|
2925
2967
|
const [error, setError] = react.useState(null);
|
|
2926
2968
|
useResetOnClient(client, setTournaments, setStats, setError);
|
|
2927
|
-
const fetch2 = react.useCallback(() => {
|
|
2969
|
+
const fetch2 = react.useCallback(async () => {
|
|
2928
2970
|
if (!address) return;
|
|
2929
2971
|
setLoading(true);
|
|
2930
2972
|
setError(null);
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2973
|
+
try {
|
|
2974
|
+
const [tournamentsResult, statsResult] = await Promise.all([
|
|
2975
|
+
client.getPlayerTournaments(address),
|
|
2976
|
+
client.getPlayerStats(address)
|
|
2977
|
+
]);
|
|
2935
2978
|
setTournaments(tournamentsResult);
|
|
2936
2979
|
setStats(statsResult);
|
|
2937
|
-
}
|
|
2980
|
+
} catch (e) {
|
|
2981
|
+
setError(e);
|
|
2982
|
+
} finally {
|
|
2983
|
+
setLoading(false);
|
|
2984
|
+
}
|
|
2938
2985
|
}, [client, address]);
|
|
2939
2986
|
react.useEffect(() => {
|
|
2940
2987
|
fetch2();
|
|
@@ -2947,11 +2994,18 @@ function usePlayerStats(address) {
|
|
|
2947
2994
|
const [loading, setLoading] = react.useState(!!address);
|
|
2948
2995
|
const [error, setError] = react.useState(null);
|
|
2949
2996
|
useResetOnClient(client, setStats, setError);
|
|
2950
|
-
const fetch2 = react.useCallback(() => {
|
|
2997
|
+
const fetch2 = react.useCallback(async () => {
|
|
2951
2998
|
if (!address) return;
|
|
2952
2999
|
setLoading(true);
|
|
2953
3000
|
setError(null);
|
|
2954
|
-
|
|
3001
|
+
try {
|
|
3002
|
+
const result = await client.getPlayerStats(address);
|
|
3003
|
+
setStats(result);
|
|
3004
|
+
} catch (e) {
|
|
3005
|
+
setError(e);
|
|
3006
|
+
} finally {
|
|
3007
|
+
setLoading(false);
|
|
3008
|
+
}
|
|
2955
3009
|
}, [client, address]);
|
|
2956
3010
|
react.useEffect(() => {
|
|
2957
3011
|
fetch2();
|
|
@@ -2965,11 +3019,18 @@ function usePlayerTournaments(address, params) {
|
|
|
2965
3019
|
const [error, setError] = react.useState(null);
|
|
2966
3020
|
useResetOnClient(client, setTournaments, setError);
|
|
2967
3021
|
const paramsKey = JSON.stringify(params);
|
|
2968
|
-
const fetch2 = react.useCallback(() => {
|
|
3022
|
+
const fetch2 = react.useCallback(async () => {
|
|
2969
3023
|
if (!address) return;
|
|
2970
3024
|
setLoading(true);
|
|
2971
3025
|
setError(null);
|
|
2972
|
-
|
|
3026
|
+
try {
|
|
3027
|
+
const result = await client.getPlayerTournaments(address, params);
|
|
3028
|
+
setTournaments(result);
|
|
3029
|
+
} catch (e) {
|
|
3030
|
+
setError(e);
|
|
3031
|
+
} finally {
|
|
3032
|
+
setLoading(false);
|
|
3033
|
+
}
|
|
2973
3034
|
}, [client, address, paramsKey]);
|
|
2974
3035
|
react.useEffect(() => {
|
|
2975
3036
|
fetch2();
|
|
@@ -2982,11 +3043,18 @@ function useRewardClaims(tournamentId) {
|
|
|
2982
3043
|
const [loading, setLoading] = react.useState(!!tournamentId);
|
|
2983
3044
|
const [error, setError] = react.useState(null);
|
|
2984
3045
|
useResetOnClient(client, setRewardClaims, setError);
|
|
2985
|
-
const fetch2 = react.useCallback(() => {
|
|
3046
|
+
const fetch2 = react.useCallback(async () => {
|
|
2986
3047
|
if (!tournamentId) return;
|
|
2987
3048
|
setLoading(true);
|
|
2988
3049
|
setError(null);
|
|
2989
|
-
|
|
3050
|
+
try {
|
|
3051
|
+
const result = await client.getTournamentRewardClaims(tournamentId);
|
|
3052
|
+
setRewardClaims(result);
|
|
3053
|
+
} catch (e) {
|
|
3054
|
+
setError(e);
|
|
3055
|
+
} finally {
|
|
3056
|
+
setLoading(false);
|
|
3057
|
+
}
|
|
2990
3058
|
}, [client, tournamentId]);
|
|
2991
3059
|
react.useEffect(() => {
|
|
2992
3060
|
fetch2();
|
|
@@ -2999,11 +3067,18 @@ function useRewardClaimsSummary(tournamentId) {
|
|
|
2999
3067
|
const [loading, setLoading] = react.useState(!!tournamentId);
|
|
3000
3068
|
const [error, setError] = react.useState(null);
|
|
3001
3069
|
useResetOnClient(client, setSummary, setError);
|
|
3002
|
-
const fetch2 = react.useCallback(() => {
|
|
3070
|
+
const fetch2 = react.useCallback(async () => {
|
|
3003
3071
|
if (!tournamentId) return;
|
|
3004
3072
|
setLoading(true);
|
|
3005
3073
|
setError(null);
|
|
3006
|
-
|
|
3074
|
+
try {
|
|
3075
|
+
const result = await client.getTournamentRewardClaimsSummary(tournamentId);
|
|
3076
|
+
setSummary(result);
|
|
3077
|
+
} catch (e) {
|
|
3078
|
+
setError(e);
|
|
3079
|
+
} finally {
|
|
3080
|
+
setLoading(false);
|
|
3081
|
+
}
|
|
3007
3082
|
}, [client, tournamentId]);
|
|
3008
3083
|
react.useEffect(() => {
|
|
3009
3084
|
fetch2();
|
|
@@ -3016,11 +3091,18 @@ function usePrizes(tournamentId) {
|
|
|
3016
3091
|
const [loading, setLoading] = react.useState(!!tournamentId);
|
|
3017
3092
|
const [error, setError] = react.useState(null);
|
|
3018
3093
|
useResetOnClient(client, setPrizes, setError);
|
|
3019
|
-
const fetch2 = react.useCallback(() => {
|
|
3094
|
+
const fetch2 = react.useCallback(async () => {
|
|
3020
3095
|
if (!tournamentId) return;
|
|
3021
3096
|
setLoading(true);
|
|
3022
3097
|
setError(null);
|
|
3023
|
-
|
|
3098
|
+
try {
|
|
3099
|
+
const result = await client.getTournamentPrizes(tournamentId);
|
|
3100
|
+
setPrizes(result);
|
|
3101
|
+
} catch (e) {
|
|
3102
|
+
setError(e);
|
|
3103
|
+
} finally {
|
|
3104
|
+
setLoading(false);
|
|
3105
|
+
}
|
|
3024
3106
|
}, [client, tournamentId]);
|
|
3025
3107
|
react.useEffect(() => {
|
|
3026
3108
|
fetch2();
|
|
@@ -3033,10 +3115,17 @@ function usePrizeStats() {
|
|
|
3033
3115
|
const [loading, setLoading] = react.useState(true);
|
|
3034
3116
|
const [error, setError] = react.useState(null);
|
|
3035
3117
|
useResetOnClient(client, setPrizeStats, setError);
|
|
3036
|
-
const fetch2 = react.useCallback(() => {
|
|
3118
|
+
const fetch2 = react.useCallback(async () => {
|
|
3037
3119
|
setLoading(true);
|
|
3038
3120
|
setError(null);
|
|
3039
|
-
|
|
3121
|
+
try {
|
|
3122
|
+
const result = await client.getPrizeStats();
|
|
3123
|
+
setPrizeStats(result);
|
|
3124
|
+
} catch (e) {
|
|
3125
|
+
setError(e);
|
|
3126
|
+
} finally {
|
|
3127
|
+
setLoading(false);
|
|
3128
|
+
}
|
|
3040
3129
|
}, [client]);
|
|
3041
3130
|
react.useEffect(() => {
|
|
3042
3131
|
fetch2();
|
|
@@ -3049,11 +3138,18 @@ function usePrizeAggregation(tournamentId) {
|
|
|
3049
3138
|
const [loading, setLoading] = react.useState(!!tournamentId);
|
|
3050
3139
|
const [error, setError] = react.useState(null);
|
|
3051
3140
|
useResetOnClient(client, setPrizeAggregation, setError);
|
|
3052
|
-
const fetch2 = react.useCallback(() => {
|
|
3141
|
+
const fetch2 = react.useCallback(async () => {
|
|
3053
3142
|
if (!tournamentId) return;
|
|
3054
3143
|
setLoading(true);
|
|
3055
3144
|
setError(null);
|
|
3056
|
-
|
|
3145
|
+
try {
|
|
3146
|
+
const result = await client.getTournamentPrizeAggregation(tournamentId);
|
|
3147
|
+
setPrizeAggregation(result);
|
|
3148
|
+
} catch (e) {
|
|
3149
|
+
setError(e);
|
|
3150
|
+
} finally {
|
|
3151
|
+
setLoading(false);
|
|
3152
|
+
}
|
|
3057
3153
|
}, [client, tournamentId]);
|
|
3058
3154
|
react.useEffect(() => {
|
|
3059
3155
|
fetch2();
|
|
@@ -3066,11 +3162,18 @@ function useQualifications(tournamentId) {
|
|
|
3066
3162
|
const [loading, setLoading] = react.useState(!!tournamentId);
|
|
3067
3163
|
const [error, setError] = react.useState(null);
|
|
3068
3164
|
useResetOnClient(client, setQualifications, setError);
|
|
3069
|
-
const fetch2 = react.useCallback(() => {
|
|
3165
|
+
const fetch2 = react.useCallback(async () => {
|
|
3070
3166
|
if (!tournamentId) return;
|
|
3071
3167
|
setLoading(true);
|
|
3072
3168
|
setError(null);
|
|
3073
|
-
|
|
3169
|
+
try {
|
|
3170
|
+
const result = await client.getTournamentQualifications(tournamentId);
|
|
3171
|
+
setQualifications(result);
|
|
3172
|
+
} catch (e) {
|
|
3173
|
+
setError(e);
|
|
3174
|
+
} finally {
|
|
3175
|
+
setLoading(false);
|
|
3176
|
+
}
|
|
3074
3177
|
}, [client, tournamentId]);
|
|
3075
3178
|
react.useEffect(() => {
|
|
3076
3179
|
fetch2();
|
|
@@ -3083,10 +3186,17 @@ function useActivityStats() {
|
|
|
3083
3186
|
const [loading, setLoading] = react.useState(true);
|
|
3084
3187
|
const [error, setError] = react.useState(null);
|
|
3085
3188
|
useResetOnClient(client, setStats, setError);
|
|
3086
|
-
const fetch2 = react.useCallback(() => {
|
|
3189
|
+
const fetch2 = react.useCallback(async () => {
|
|
3087
3190
|
setLoading(true);
|
|
3088
3191
|
setError(null);
|
|
3089
|
-
|
|
3192
|
+
try {
|
|
3193
|
+
const result = await client.getActivityStats();
|
|
3194
|
+
setStats(result);
|
|
3195
|
+
} catch (e) {
|
|
3196
|
+
setError(e);
|
|
3197
|
+
} finally {
|
|
3198
|
+
setLoading(false);
|
|
3199
|
+
}
|
|
3090
3200
|
}, [client]);
|
|
3091
3201
|
react.useEffect(() => {
|
|
3092
3202
|
fetch2();
|