@dubsdotapp/expo 0.2.6 → 0.2.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/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +14 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/hooks/useCreateCustomGame.ts +2 -0
- package/src/ui/game/CreateCustomGameSheet.tsx +14 -6
package/dist/index.d.mts
CHANGED
|
@@ -625,6 +625,7 @@ interface CreateCustomGameMutationResult {
|
|
|
625
625
|
gameAddress: string;
|
|
626
626
|
signature: string;
|
|
627
627
|
explorerUrl: string;
|
|
628
|
+
buyIn: number;
|
|
628
629
|
}
|
|
629
630
|
declare function useCreateCustomGame(): {
|
|
630
631
|
execute: (params: CreateCustomGameParams) => Promise<CreateCustomGameMutationResult>;
|
|
@@ -786,11 +787,13 @@ interface CreateCustomGameSheetProps {
|
|
|
786
787
|
maxPlayers?: number;
|
|
787
788
|
fee?: number;
|
|
788
789
|
presetAmounts?: number[];
|
|
790
|
+
defaultAmount?: number;
|
|
789
791
|
metadata?: Record<string, unknown>;
|
|
792
|
+
onAmountChange?: (amount: number | null) => void;
|
|
790
793
|
onSuccess?: (result: CreateCustomGameMutationResult) => void;
|
|
791
794
|
onError?: (error: Error) => void;
|
|
792
795
|
}
|
|
793
|
-
declare function CreateCustomGameSheet({ visible, onDismiss, title, maxPlayers, fee, presetAmounts, metadata, onSuccess, onError, }: CreateCustomGameSheetProps): react_jsx_runtime.JSX.Element;
|
|
796
|
+
declare function CreateCustomGameSheet({ visible, onDismiss, title, maxPlayers, fee, presetAmounts, defaultAmount, metadata, onAmountChange, onSuccess, onError, }: CreateCustomGameSheetProps): react_jsx_runtime.JSX.Element;
|
|
794
797
|
|
|
795
798
|
/**
|
|
796
799
|
* Deserialize a base64-encoded transaction, sign via wallet adapter, send to Solana.
|
package/dist/index.d.ts
CHANGED
|
@@ -625,6 +625,7 @@ interface CreateCustomGameMutationResult {
|
|
|
625
625
|
gameAddress: string;
|
|
626
626
|
signature: string;
|
|
627
627
|
explorerUrl: string;
|
|
628
|
+
buyIn: number;
|
|
628
629
|
}
|
|
629
630
|
declare function useCreateCustomGame(): {
|
|
630
631
|
execute: (params: CreateCustomGameParams) => Promise<CreateCustomGameMutationResult>;
|
|
@@ -786,11 +787,13 @@ interface CreateCustomGameSheetProps {
|
|
|
786
787
|
maxPlayers?: number;
|
|
787
788
|
fee?: number;
|
|
788
789
|
presetAmounts?: number[];
|
|
790
|
+
defaultAmount?: number;
|
|
789
791
|
metadata?: Record<string, unknown>;
|
|
792
|
+
onAmountChange?: (amount: number | null) => void;
|
|
790
793
|
onSuccess?: (result: CreateCustomGameMutationResult) => void;
|
|
791
794
|
onError?: (error: Error) => void;
|
|
792
795
|
}
|
|
793
|
-
declare function CreateCustomGameSheet({ visible, onDismiss, title, maxPlayers, fee, presetAmounts, metadata, onSuccess, onError, }: CreateCustomGameSheetProps): react_jsx_runtime.JSX.Element;
|
|
796
|
+
declare function CreateCustomGameSheet({ visible, onDismiss, title, maxPlayers, fee, presetAmounts, defaultAmount, metadata, onAmountChange, onSuccess, onError, }: CreateCustomGameSheetProps): react_jsx_runtime.JSX.Element;
|
|
794
797
|
|
|
795
798
|
/**
|
|
796
799
|
* Deserialize a base64-encoded transaction, sign via wallet adapter, send to Solana.
|
package/dist/index.js
CHANGED
|
@@ -1279,7 +1279,8 @@ function useCreateCustomGame() {
|
|
|
1279
1279
|
gameId: createResult.gameId,
|
|
1280
1280
|
gameAddress: createResult.gameAddress,
|
|
1281
1281
|
signature,
|
|
1282
|
-
explorerUrl
|
|
1282
|
+
explorerUrl,
|
|
1283
|
+
buyIn: params.wagerAmount
|
|
1283
1284
|
};
|
|
1284
1285
|
setData(result);
|
|
1285
1286
|
setStatus("success");
|
|
@@ -2804,8 +2805,10 @@ function CreateCustomGameSheet({
|
|
|
2804
2805
|
title,
|
|
2805
2806
|
maxPlayers = 2,
|
|
2806
2807
|
fee = 5,
|
|
2807
|
-
presetAmounts = [0.1, 0.5, 1],
|
|
2808
|
+
presetAmounts = [0.01, 0.1, 0.5, 1],
|
|
2809
|
+
defaultAmount = 0.01,
|
|
2808
2810
|
metadata,
|
|
2811
|
+
onAmountChange,
|
|
2809
2812
|
onSuccess,
|
|
2810
2813
|
onError
|
|
2811
2814
|
}) {
|
|
@@ -2825,7 +2828,7 @@ function CreateCustomGameSheet({
|
|
|
2825
2828
|
}, [visible, overlayOpacity]);
|
|
2826
2829
|
(0, import_react20.useEffect)(() => {
|
|
2827
2830
|
if (visible) {
|
|
2828
|
-
setSelectedAmount(null);
|
|
2831
|
+
setSelectedAmount(defaultAmount ?? null);
|
|
2829
2832
|
setCustomAmount("");
|
|
2830
2833
|
setIsCustom(false);
|
|
2831
2834
|
mutation.reset();
|
|
@@ -2849,17 +2852,21 @@ function CreateCustomGameSheet({
|
|
|
2849
2852
|
setSelectedAmount(amount);
|
|
2850
2853
|
setIsCustom(false);
|
|
2851
2854
|
setCustomAmount("");
|
|
2852
|
-
|
|
2855
|
+
onAmountChange?.(amount);
|
|
2856
|
+
}, [onAmountChange]);
|
|
2853
2857
|
const handleCustomSelect = (0, import_react20.useCallback)(() => {
|
|
2854
2858
|
setIsCustom(true);
|
|
2855
2859
|
setSelectedAmount(null);
|
|
2856
|
-
|
|
2860
|
+
onAmountChange?.(null);
|
|
2861
|
+
}, [onAmountChange]);
|
|
2857
2862
|
const handleCustomAmountChange = (0, import_react20.useCallback)((text) => {
|
|
2858
2863
|
const cleaned = text.replace(/[^0-9.]/g, "").replace(/(\..*?)\..*/g, "$1");
|
|
2859
2864
|
setCustomAmount(cleaned);
|
|
2860
2865
|
const parsed = parseFloat(cleaned);
|
|
2861
|
-
|
|
2862
|
-
|
|
2866
|
+
const amount = parsed > 0 ? parsed : null;
|
|
2867
|
+
setSelectedAmount(amount);
|
|
2868
|
+
onAmountChange?.(amount);
|
|
2869
|
+
}, [onAmountChange]);
|
|
2863
2870
|
const effectiveAmount = selectedAmount;
|
|
2864
2871
|
const playerCount = maxPlayers || 2;
|
|
2865
2872
|
const pot = effectiveAmount ? effectiveAmount * playerCount : 0;
|