@dubsdotapp/expo 0.2.39 → 0.2.41
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 +18 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.js +334 -219
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +175 -61
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +2 -1
- package/src/provider.tsx +50 -38
- package/src/types.ts +2 -0
- package/src/ui/game/ClaimButton.tsx +122 -0
- package/src/ui/game/ClaimPrizeSheet.tsx +1 -1
- package/src/ui/game/JoinGameButton.tsx +1 -1
- package/src/ui/game/index.ts +2 -0
- package/src/ui/index.ts +2 -1
- package/src/ui/theme.ts +9 -1
package/dist/index.js
CHANGED
|
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
AuthGate: () => AuthGate,
|
|
34
|
+
ClaimButton: () => ClaimButton,
|
|
34
35
|
ClaimPrizeSheet: () => ClaimPrizeSheet,
|
|
35
36
|
ConnectWalletScreen: () => ConnectWalletScreen,
|
|
36
37
|
CreateCustomGameSheet: () => CreateCustomGameSheet,
|
|
@@ -573,11 +574,61 @@ function createSecureStoreStorage() {
|
|
|
573
574
|
}
|
|
574
575
|
|
|
575
576
|
// src/provider.tsx
|
|
576
|
-
var
|
|
577
|
+
var import_react15 = require("react");
|
|
578
|
+
|
|
579
|
+
// src/ui/theme.ts
|
|
580
|
+
var import_react = require("react");
|
|
581
|
+
var import_react_native = require("react-native");
|
|
582
|
+
var dark = {
|
|
583
|
+
background: "#08080D",
|
|
584
|
+
surface: "#111118",
|
|
585
|
+
surfaceActive: "#7C3AED",
|
|
586
|
+
border: "#1A1A24",
|
|
587
|
+
text: "#FFFFFF",
|
|
588
|
+
textSecondary: "#E0E0EE",
|
|
589
|
+
textMuted: "#666666",
|
|
590
|
+
textDim: "#555555",
|
|
591
|
+
accent: "#7C3AED",
|
|
592
|
+
success: "#22C55E",
|
|
593
|
+
live: "#EF4444",
|
|
594
|
+
errorText: "#F87171",
|
|
595
|
+
errorBg: "#1A0A0A",
|
|
596
|
+
errorBorder: "#3A1515"
|
|
597
|
+
};
|
|
598
|
+
var light = {
|
|
599
|
+
background: "#FFFFFF",
|
|
600
|
+
surface: "#F0F0F5",
|
|
601
|
+
surfaceActive: "#7C3AED",
|
|
602
|
+
border: "#E0E0E8",
|
|
603
|
+
text: "#111118",
|
|
604
|
+
textSecondary: "#333333",
|
|
605
|
+
textMuted: "#888888",
|
|
606
|
+
textDim: "#999999",
|
|
607
|
+
accent: "#7C3AED",
|
|
608
|
+
success: "#16A34A",
|
|
609
|
+
live: "#DC2626",
|
|
610
|
+
errorText: "#DC2626",
|
|
611
|
+
errorBg: "#FEF2F2",
|
|
612
|
+
errorBorder: "#FECACA"
|
|
613
|
+
};
|
|
614
|
+
var ThemeOverrideContext = (0, import_react.createContext)({});
|
|
615
|
+
var ThemeOverrideProvider = ThemeOverrideContext.Provider;
|
|
616
|
+
function useDubsTheme() {
|
|
617
|
+
const scheme = (0, import_react_native.useColorScheme)();
|
|
618
|
+
const base = scheme === "light" ? light : dark;
|
|
619
|
+
const overrides = (0, import_react.useContext)(ThemeOverrideContext);
|
|
620
|
+
if (Object.keys(overrides).length === 0) return base;
|
|
621
|
+
return { ...base, ...overrides };
|
|
622
|
+
}
|
|
623
|
+
function mergeTheme(base, overrides) {
|
|
624
|
+
return { ...base, ...overrides };
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
// src/provider.tsx
|
|
577
628
|
var import_web34 = require("@solana/web3.js");
|
|
578
629
|
|
|
579
630
|
// src/managed-wallet.tsx
|
|
580
|
-
var
|
|
631
|
+
var import_react2 = require("react");
|
|
581
632
|
var import_react_native4 = require("react-native");
|
|
582
633
|
|
|
583
634
|
// src/wallet/mwa-adapter.ts
|
|
@@ -761,7 +812,7 @@ function decryptPayload(ciphertextBase58, nonceBase58, sharedSecret) {
|
|
|
761
812
|
}
|
|
762
813
|
|
|
763
814
|
// src/wallet/phantom-deeplink/deeplink-handler.ts
|
|
764
|
-
var
|
|
815
|
+
var import_react_native2 = require("react-native");
|
|
765
816
|
var TAG = "[Dubs:DeeplinkHandler]";
|
|
766
817
|
var DeeplinkHandler = class {
|
|
767
818
|
constructor(redirectBase) {
|
|
@@ -778,11 +829,11 @@ var DeeplinkHandler = class {
|
|
|
778
829
|
return;
|
|
779
830
|
}
|
|
780
831
|
console.log(TAG, "Starting URL listener");
|
|
781
|
-
this.subscription =
|
|
832
|
+
this.subscription = import_react_native2.Linking.addEventListener("url", ({ url }) => {
|
|
782
833
|
console.log(TAG, "Received URL event:", url);
|
|
783
834
|
this.handleUrl(url);
|
|
784
835
|
});
|
|
785
|
-
|
|
836
|
+
import_react_native2.Linking.getInitialURL().then((url) => {
|
|
786
837
|
if (url) {
|
|
787
838
|
console.log(TAG, "Cold-start URL found:", url);
|
|
788
839
|
this.handleUrl(url);
|
|
@@ -818,7 +869,7 @@ var DeeplinkHandler = class {
|
|
|
818
869
|
reject(new Error(`Phantom deeplink timed out after ${timeoutMs / 1e3}s`));
|
|
819
870
|
}, timeoutMs);
|
|
820
871
|
this.pending.set(requestId, { resolve, reject, timer });
|
|
821
|
-
|
|
872
|
+
import_react_native2.Linking.openURL(url).catch((err) => {
|
|
822
873
|
console.log(TAG, `Failed to open URL: ${err.message}`);
|
|
823
874
|
this.pending.delete(requestId);
|
|
824
875
|
clearTimeout(timer);
|
|
@@ -1188,50 +1239,6 @@ var PhantomDeeplinkAdapter = class {
|
|
|
1188
1239
|
|
|
1189
1240
|
// src/ui/ConnectWalletScreen.tsx
|
|
1190
1241
|
var import_react_native3 = require("react-native");
|
|
1191
|
-
|
|
1192
|
-
// src/ui/theme.ts
|
|
1193
|
-
var import_react_native2 = require("react-native");
|
|
1194
|
-
var dark = {
|
|
1195
|
-
background: "#08080D",
|
|
1196
|
-
surface: "#111118",
|
|
1197
|
-
surfaceActive: "#7C3AED",
|
|
1198
|
-
border: "#1A1A24",
|
|
1199
|
-
text: "#FFFFFF",
|
|
1200
|
-
textSecondary: "#E0E0EE",
|
|
1201
|
-
textMuted: "#666666",
|
|
1202
|
-
textDim: "#555555",
|
|
1203
|
-
accent: "#7C3AED",
|
|
1204
|
-
success: "#22C55E",
|
|
1205
|
-
live: "#EF4444",
|
|
1206
|
-
errorText: "#F87171",
|
|
1207
|
-
errorBg: "#1A0A0A",
|
|
1208
|
-
errorBorder: "#3A1515"
|
|
1209
|
-
};
|
|
1210
|
-
var light = {
|
|
1211
|
-
background: "#FFFFFF",
|
|
1212
|
-
surface: "#F0F0F5",
|
|
1213
|
-
surfaceActive: "#7C3AED",
|
|
1214
|
-
border: "#E0E0E8",
|
|
1215
|
-
text: "#111118",
|
|
1216
|
-
textSecondary: "#333333",
|
|
1217
|
-
textMuted: "#888888",
|
|
1218
|
-
textDim: "#999999",
|
|
1219
|
-
accent: "#7C3AED",
|
|
1220
|
-
success: "#16A34A",
|
|
1221
|
-
live: "#DC2626",
|
|
1222
|
-
errorText: "#DC2626",
|
|
1223
|
-
errorBg: "#FEF2F2",
|
|
1224
|
-
errorBorder: "#FECACA"
|
|
1225
|
-
};
|
|
1226
|
-
function useDubsTheme() {
|
|
1227
|
-
const scheme = (0, import_react_native2.useColorScheme)();
|
|
1228
|
-
return scheme === "light" ? light : dark;
|
|
1229
|
-
}
|
|
1230
|
-
function mergeTheme(base, overrides) {
|
|
1231
|
-
return { ...base, ...overrides };
|
|
1232
|
-
}
|
|
1233
|
-
|
|
1234
|
-
// src/ui/ConnectWalletScreen.tsx
|
|
1235
1242
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
1236
1243
|
function ConnectWalletScreen({
|
|
1237
1244
|
onConnect,
|
|
@@ -1384,9 +1391,9 @@ function getOrCreatePhantomAdapter(config) {
|
|
|
1384
1391
|
}
|
|
1385
1392
|
return phantomSingleton;
|
|
1386
1393
|
}
|
|
1387
|
-
var DisconnectContext = (0,
|
|
1394
|
+
var DisconnectContext = (0, import_react2.createContext)(null);
|
|
1388
1395
|
function useDisconnect() {
|
|
1389
|
-
return (0,
|
|
1396
|
+
return (0, import_react2.useContext)(DisconnectContext);
|
|
1390
1397
|
}
|
|
1391
1398
|
function ManagedWalletProvider({
|
|
1392
1399
|
appName,
|
|
@@ -1400,14 +1407,14 @@ function ManagedWalletProvider({
|
|
|
1400
1407
|
appUrl,
|
|
1401
1408
|
children
|
|
1402
1409
|
}) {
|
|
1403
|
-
const [connected, setConnected] = (0,
|
|
1404
|
-
const [connecting, setConnecting] = (0,
|
|
1405
|
-
const [isReady, setIsReady] = (0,
|
|
1406
|
-
const [error, setError] = (0,
|
|
1410
|
+
const [connected, setConnected] = (0, import_react2.useState)(false);
|
|
1411
|
+
const [connecting, setConnecting] = (0, import_react2.useState)(false);
|
|
1412
|
+
const [isReady, setIsReady] = (0, import_react2.useState)(false);
|
|
1413
|
+
const [error, setError] = (0, import_react2.useState)(null);
|
|
1407
1414
|
const usePhantom = import_react_native4.Platform.OS === "ios" && !!redirectUri;
|
|
1408
1415
|
console.log(TAG3, `Platform: ${import_react_native4.Platform.OS}, redirectUri: ${redirectUri ? "provided" : "not set"}, usePhantom: ${usePhantom}`);
|
|
1409
|
-
const adapterRef = (0,
|
|
1410
|
-
const transactRef = (0,
|
|
1416
|
+
const adapterRef = (0, import_react2.useRef)(null);
|
|
1417
|
+
const transactRef = (0, import_react2.useRef)(null);
|
|
1411
1418
|
if (!adapterRef.current) {
|
|
1412
1419
|
if (usePhantom) {
|
|
1413
1420
|
adapterRef.current = getOrCreatePhantomAdapter({
|
|
@@ -1442,7 +1449,7 @@ function ManagedWalletProvider({
|
|
|
1442
1449
|
}
|
|
1443
1450
|
}
|
|
1444
1451
|
const adapter = adapterRef.current;
|
|
1445
|
-
(0,
|
|
1452
|
+
(0, import_react2.useEffect)(() => {
|
|
1446
1453
|
let cancelled = false;
|
|
1447
1454
|
(async () => {
|
|
1448
1455
|
if (usePhantom) {
|
|
@@ -1531,7 +1538,7 @@ function ManagedWalletProvider({
|
|
|
1531
1538
|
cancelled = true;
|
|
1532
1539
|
};
|
|
1533
1540
|
}, [adapter, storage, usePhantom]);
|
|
1534
|
-
const handleConnect = (0,
|
|
1541
|
+
const handleConnect = (0, import_react2.useCallback)(async () => {
|
|
1535
1542
|
console.log(TAG3, "handleConnect() \u2014 user tapped connect");
|
|
1536
1543
|
setConnecting(true);
|
|
1537
1544
|
setError(null);
|
|
@@ -1552,7 +1559,7 @@ function ManagedWalletProvider({
|
|
|
1552
1559
|
setConnecting(false);
|
|
1553
1560
|
}
|
|
1554
1561
|
}, [adapter, storage, usePhantom]);
|
|
1555
|
-
const disconnect = (0,
|
|
1562
|
+
const disconnect = (0, import_react2.useCallback)(async () => {
|
|
1556
1563
|
console.log(TAG3, "disconnect() \u2014 clearing all state");
|
|
1557
1564
|
adapter.disconnect?.();
|
|
1558
1565
|
if (usePhantom && phantomSingleton) {
|
|
@@ -1601,18 +1608,18 @@ function ManagedWalletProvider({
|
|
|
1601
1608
|
}
|
|
1602
1609
|
|
|
1603
1610
|
// src/ui/AuthGate.tsx
|
|
1604
|
-
var
|
|
1611
|
+
var import_react14 = __toESM(require("react"));
|
|
1605
1612
|
var import_react_native6 = require("react-native");
|
|
1606
1613
|
|
|
1607
1614
|
// src/hooks/useEvents.ts
|
|
1608
|
-
var
|
|
1615
|
+
var import_react3 = require("react");
|
|
1609
1616
|
function useEvents(params) {
|
|
1610
1617
|
const { client } = useDubs();
|
|
1611
|
-
const [data, setData] = (0,
|
|
1612
|
-
const [loading, setLoading] = (0,
|
|
1613
|
-
const [error, setError] = (0,
|
|
1618
|
+
const [data, setData] = (0, import_react3.useState)(null);
|
|
1619
|
+
const [loading, setLoading] = (0, import_react3.useState)(true);
|
|
1620
|
+
const [error, setError] = (0, import_react3.useState)(null);
|
|
1614
1621
|
const paramKey = JSON.stringify(params ?? {});
|
|
1615
|
-
const fetchData = (0,
|
|
1622
|
+
const fetchData = (0, import_react3.useCallback)(async () => {
|
|
1616
1623
|
setLoading(true);
|
|
1617
1624
|
setError(null);
|
|
1618
1625
|
try {
|
|
@@ -1624,20 +1631,20 @@ function useEvents(params) {
|
|
|
1624
1631
|
setLoading(false);
|
|
1625
1632
|
}
|
|
1626
1633
|
}, [client, paramKey]);
|
|
1627
|
-
(0,
|
|
1634
|
+
(0, import_react3.useEffect)(() => {
|
|
1628
1635
|
fetchData();
|
|
1629
1636
|
}, [fetchData]);
|
|
1630
1637
|
return { data, loading, error, refetch: fetchData };
|
|
1631
1638
|
}
|
|
1632
1639
|
|
|
1633
1640
|
// src/hooks/useGame.ts
|
|
1634
|
-
var
|
|
1641
|
+
var import_react4 = require("react");
|
|
1635
1642
|
function useGame(gameId) {
|
|
1636
1643
|
const { client } = useDubs();
|
|
1637
|
-
const [data, setData] = (0,
|
|
1638
|
-
const [loading, setLoading] = (0,
|
|
1639
|
-
const [error, setError] = (0,
|
|
1640
|
-
const fetchData = (0,
|
|
1644
|
+
const [data, setData] = (0, import_react4.useState)(null);
|
|
1645
|
+
const [loading, setLoading] = (0, import_react4.useState)(!!gameId);
|
|
1646
|
+
const [error, setError] = (0, import_react4.useState)(null);
|
|
1647
|
+
const fetchData = (0, import_react4.useCallback)(async () => {
|
|
1641
1648
|
if (!gameId) return;
|
|
1642
1649
|
setLoading(true);
|
|
1643
1650
|
setError(null);
|
|
@@ -1650,21 +1657,21 @@ function useGame(gameId) {
|
|
|
1650
1657
|
setLoading(false);
|
|
1651
1658
|
}
|
|
1652
1659
|
}, [client, gameId]);
|
|
1653
|
-
(0,
|
|
1660
|
+
(0, import_react4.useEffect)(() => {
|
|
1654
1661
|
fetchData();
|
|
1655
1662
|
}, [fetchData]);
|
|
1656
1663
|
return { data, loading, error, refetch: fetchData };
|
|
1657
1664
|
}
|
|
1658
1665
|
|
|
1659
1666
|
// src/hooks/useGames.ts
|
|
1660
|
-
var
|
|
1667
|
+
var import_react5 = require("react");
|
|
1661
1668
|
function useGames(params) {
|
|
1662
1669
|
const { client } = useDubs();
|
|
1663
|
-
const [data, setData] = (0,
|
|
1664
|
-
const [loading, setLoading] = (0,
|
|
1665
|
-
const [error, setError] = (0,
|
|
1670
|
+
const [data, setData] = (0, import_react5.useState)(null);
|
|
1671
|
+
const [loading, setLoading] = (0, import_react5.useState)(true);
|
|
1672
|
+
const [error, setError] = (0, import_react5.useState)(null);
|
|
1666
1673
|
const paramKey = JSON.stringify(params ?? {});
|
|
1667
|
-
const fetchData = (0,
|
|
1674
|
+
const fetchData = (0, import_react5.useCallback)(async () => {
|
|
1668
1675
|
setLoading(true);
|
|
1669
1676
|
setError(null);
|
|
1670
1677
|
try {
|
|
@@ -1676,21 +1683,21 @@ function useGames(params) {
|
|
|
1676
1683
|
setLoading(false);
|
|
1677
1684
|
}
|
|
1678
1685
|
}, [client, paramKey]);
|
|
1679
|
-
(0,
|
|
1686
|
+
(0, import_react5.useEffect)(() => {
|
|
1680
1687
|
fetchData();
|
|
1681
1688
|
}, [fetchData]);
|
|
1682
1689
|
return { data, loading, error, refetch: fetchData };
|
|
1683
1690
|
}
|
|
1684
1691
|
|
|
1685
1692
|
// src/hooks/useNetworkGames.ts
|
|
1686
|
-
var
|
|
1693
|
+
var import_react6 = require("react");
|
|
1687
1694
|
function useNetworkGames(params) {
|
|
1688
1695
|
const { client } = useDubs();
|
|
1689
|
-
const [data, setData] = (0,
|
|
1690
|
-
const [loading, setLoading] = (0,
|
|
1691
|
-
const [error, setError] = (0,
|
|
1696
|
+
const [data, setData] = (0, import_react6.useState)(null);
|
|
1697
|
+
const [loading, setLoading] = (0, import_react6.useState)(true);
|
|
1698
|
+
const [error, setError] = (0, import_react6.useState)(null);
|
|
1692
1699
|
const paramKey = JSON.stringify(params ?? {});
|
|
1693
|
-
const fetchData = (0,
|
|
1700
|
+
const fetchData = (0, import_react6.useCallback)(async () => {
|
|
1694
1701
|
setLoading(true);
|
|
1695
1702
|
setError(null);
|
|
1696
1703
|
try {
|
|
@@ -1702,14 +1709,14 @@ function useNetworkGames(params) {
|
|
|
1702
1709
|
setLoading(false);
|
|
1703
1710
|
}
|
|
1704
1711
|
}, [client, paramKey]);
|
|
1705
|
-
(0,
|
|
1712
|
+
(0, import_react6.useEffect)(() => {
|
|
1706
1713
|
fetchData();
|
|
1707
1714
|
}, [fetchData]);
|
|
1708
1715
|
return { data, loading, error, refetch: fetchData };
|
|
1709
1716
|
}
|
|
1710
1717
|
|
|
1711
1718
|
// src/hooks/useCreateGame.ts
|
|
1712
|
-
var
|
|
1719
|
+
var import_react7 = require("react");
|
|
1713
1720
|
|
|
1714
1721
|
// src/utils/transaction.ts
|
|
1715
1722
|
var import_web33 = require("@solana/web3.js");
|
|
@@ -1732,15 +1739,15 @@ async function signAndSendBase64Transaction(base64Tx, wallet, connection) {
|
|
|
1732
1739
|
// src/hooks/useCreateGame.ts
|
|
1733
1740
|
function useCreateGame() {
|
|
1734
1741
|
const { client, wallet, connection } = useDubs();
|
|
1735
|
-
const [status, setStatus] = (0,
|
|
1736
|
-
const [error, setError] = (0,
|
|
1737
|
-
const [data, setData] = (0,
|
|
1738
|
-
const reset = (0,
|
|
1742
|
+
const [status, setStatus] = (0, import_react7.useState)("idle");
|
|
1743
|
+
const [error, setError] = (0, import_react7.useState)(null);
|
|
1744
|
+
const [data, setData] = (0, import_react7.useState)(null);
|
|
1745
|
+
const reset = (0, import_react7.useCallback)(() => {
|
|
1739
1746
|
setStatus("idle");
|
|
1740
1747
|
setError(null);
|
|
1741
1748
|
setData(null);
|
|
1742
1749
|
}, []);
|
|
1743
|
-
const execute = (0,
|
|
1750
|
+
const execute = (0, import_react7.useCallback)(async (params) => {
|
|
1744
1751
|
setStatus("building");
|
|
1745
1752
|
setError(null);
|
|
1746
1753
|
setData(null);
|
|
@@ -1791,18 +1798,18 @@ function useCreateGame() {
|
|
|
1791
1798
|
}
|
|
1792
1799
|
|
|
1793
1800
|
// src/hooks/useJoinGame.ts
|
|
1794
|
-
var
|
|
1801
|
+
var import_react8 = require("react");
|
|
1795
1802
|
function useJoinGame() {
|
|
1796
1803
|
const { client, wallet, connection } = useDubs();
|
|
1797
|
-
const [status, setStatus] = (0,
|
|
1798
|
-
const [error, setError] = (0,
|
|
1799
|
-
const [data, setData] = (0,
|
|
1800
|
-
const reset = (0,
|
|
1804
|
+
const [status, setStatus] = (0, import_react8.useState)("idle");
|
|
1805
|
+
const [error, setError] = (0, import_react8.useState)(null);
|
|
1806
|
+
const [data, setData] = (0, import_react8.useState)(null);
|
|
1807
|
+
const reset = (0, import_react8.useCallback)(() => {
|
|
1801
1808
|
setStatus("idle");
|
|
1802
1809
|
setError(null);
|
|
1803
1810
|
setData(null);
|
|
1804
1811
|
}, []);
|
|
1805
|
-
const execute = (0,
|
|
1812
|
+
const execute = (0, import_react8.useCallback)(async (params) => {
|
|
1806
1813
|
setStatus("building");
|
|
1807
1814
|
setError(null);
|
|
1808
1815
|
setData(null);
|
|
@@ -1854,18 +1861,18 @@ function useJoinGame() {
|
|
|
1854
1861
|
}
|
|
1855
1862
|
|
|
1856
1863
|
// src/hooks/useClaim.ts
|
|
1857
|
-
var
|
|
1864
|
+
var import_react9 = require("react");
|
|
1858
1865
|
function useClaim() {
|
|
1859
1866
|
const { client, wallet, connection } = useDubs();
|
|
1860
|
-
const [status, setStatus] = (0,
|
|
1861
|
-
const [error, setError] = (0,
|
|
1862
|
-
const [data, setData] = (0,
|
|
1863
|
-
const reset = (0,
|
|
1867
|
+
const [status, setStatus] = (0, import_react9.useState)("idle");
|
|
1868
|
+
const [error, setError] = (0, import_react9.useState)(null);
|
|
1869
|
+
const [data, setData] = (0, import_react9.useState)(null);
|
|
1870
|
+
const reset = (0, import_react9.useCallback)(() => {
|
|
1864
1871
|
setStatus("idle");
|
|
1865
1872
|
setError(null);
|
|
1866
1873
|
setData(null);
|
|
1867
1874
|
}, []);
|
|
1868
|
-
const execute = (0,
|
|
1875
|
+
const execute = (0, import_react9.useCallback)(async (params) => {
|
|
1869
1876
|
setStatus("building");
|
|
1870
1877
|
setError(null);
|
|
1871
1878
|
setData(null);
|
|
@@ -1925,18 +1932,18 @@ function useClaim() {
|
|
|
1925
1932
|
}
|
|
1926
1933
|
|
|
1927
1934
|
// src/hooks/useCreateCustomGame.ts
|
|
1928
|
-
var
|
|
1935
|
+
var import_react10 = require("react");
|
|
1929
1936
|
function useCreateCustomGame() {
|
|
1930
1937
|
const { client, wallet, connection } = useDubs();
|
|
1931
|
-
const [status, setStatus] = (0,
|
|
1932
|
-
const [error, setError] = (0,
|
|
1933
|
-
const [data, setData] = (0,
|
|
1934
|
-
const reset = (0,
|
|
1938
|
+
const [status, setStatus] = (0, import_react10.useState)("idle");
|
|
1939
|
+
const [error, setError] = (0, import_react10.useState)(null);
|
|
1940
|
+
const [data, setData] = (0, import_react10.useState)(null);
|
|
1941
|
+
const reset = (0, import_react10.useCallback)(() => {
|
|
1935
1942
|
setStatus("idle");
|
|
1936
1943
|
setError(null);
|
|
1937
1944
|
setData(null);
|
|
1938
1945
|
}, []);
|
|
1939
|
-
const execute = (0,
|
|
1946
|
+
const execute = (0, import_react10.useCallback)(async (params) => {
|
|
1940
1947
|
setStatus("building");
|
|
1941
1948
|
setError(null);
|
|
1942
1949
|
setData(null);
|
|
@@ -1988,18 +1995,18 @@ function useCreateCustomGame() {
|
|
|
1988
1995
|
}
|
|
1989
1996
|
|
|
1990
1997
|
// src/hooks/useHasClaimed.ts
|
|
1991
|
-
var
|
|
1998
|
+
var import_react11 = require("react");
|
|
1992
1999
|
function useHasClaimed(gameId) {
|
|
1993
2000
|
const { client, wallet } = useDubs();
|
|
1994
|
-
const [hasClaimed, setHasClaimed] = (0,
|
|
1995
|
-
const [amountClaimed, setAmountClaimed] = (0,
|
|
1996
|
-
const [claimSignature, setClaimSignature] = (0,
|
|
1997
|
-
const [isResolved, setIsResolved] = (0,
|
|
1998
|
-
const [loading, setLoading] = (0,
|
|
1999
|
-
const [error, setError] = (0,
|
|
2000
|
-
const [trigger, setTrigger] = (0,
|
|
2001
|
+
const [hasClaimed, setHasClaimed] = (0, import_react11.useState)(false);
|
|
2002
|
+
const [amountClaimed, setAmountClaimed] = (0, import_react11.useState)(null);
|
|
2003
|
+
const [claimSignature, setClaimSignature] = (0, import_react11.useState)(null);
|
|
2004
|
+
const [isResolved, setIsResolved] = (0, import_react11.useState)(false);
|
|
2005
|
+
const [loading, setLoading] = (0, import_react11.useState)(false);
|
|
2006
|
+
const [error, setError] = (0, import_react11.useState)(null);
|
|
2007
|
+
const [trigger, setTrigger] = (0, import_react11.useState)(0);
|
|
2001
2008
|
const refetch = () => setTrigger((t) => t + 1);
|
|
2002
|
-
(0,
|
|
2009
|
+
(0, import_react11.useEffect)(() => {
|
|
2003
2010
|
if (!gameId || !wallet.publicKey) {
|
|
2004
2011
|
setHasClaimed(false);
|
|
2005
2012
|
setAmountClaimed(null);
|
|
@@ -2039,12 +2046,12 @@ function useHasClaimed(gameId) {
|
|
|
2039
2046
|
}
|
|
2040
2047
|
|
|
2041
2048
|
// src/hooks/useAuth.ts
|
|
2042
|
-
var
|
|
2049
|
+
var import_react13 = require("react");
|
|
2043
2050
|
var import_bs583 = __toESM(require("bs58"));
|
|
2044
2051
|
|
|
2045
2052
|
// src/auth-context.ts
|
|
2046
|
-
var
|
|
2047
|
-
var AuthContext = (0,
|
|
2053
|
+
var import_react12 = require("react");
|
|
2054
|
+
var AuthContext = (0, import_react12.createContext)(null);
|
|
2048
2055
|
|
|
2049
2056
|
// src/utils/device.ts
|
|
2050
2057
|
var import_react_native5 = require("react-native");
|
|
@@ -2095,14 +2102,14 @@ async function getDeviceInfo() {
|
|
|
2095
2102
|
|
|
2096
2103
|
// src/hooks/useAuth.ts
|
|
2097
2104
|
function useAuth() {
|
|
2098
|
-
const sharedAuth = (0,
|
|
2105
|
+
const sharedAuth = (0, import_react13.useContext)(AuthContext);
|
|
2099
2106
|
const { client, wallet } = useDubs();
|
|
2100
|
-
const [status, setStatus] = (0,
|
|
2101
|
-
const [user, setUser] = (0,
|
|
2102
|
-
const [token, setToken] = (0,
|
|
2103
|
-
const [error, setError] = (0,
|
|
2104
|
-
const pendingAuth = (0,
|
|
2105
|
-
const reset = (0,
|
|
2107
|
+
const [status, setStatus] = (0, import_react13.useState)("idle");
|
|
2108
|
+
const [user, setUser] = (0, import_react13.useState)(null);
|
|
2109
|
+
const [token, setToken] = (0, import_react13.useState)(null);
|
|
2110
|
+
const [error, setError] = (0, import_react13.useState)(null);
|
|
2111
|
+
const pendingAuth = (0, import_react13.useRef)(null);
|
|
2112
|
+
const reset = (0, import_react13.useCallback)(() => {
|
|
2106
2113
|
setStatus("idle");
|
|
2107
2114
|
setUser(null);
|
|
2108
2115
|
setToken(null);
|
|
@@ -2110,7 +2117,7 @@ function useAuth() {
|
|
|
2110
2117
|
pendingAuth.current = null;
|
|
2111
2118
|
client.setToken(null);
|
|
2112
2119
|
}, [client]);
|
|
2113
|
-
const authenticate = (0,
|
|
2120
|
+
const authenticate = (0, import_react13.useCallback)(async () => {
|
|
2114
2121
|
try {
|
|
2115
2122
|
if (!wallet.publicKey) {
|
|
2116
2123
|
throw new Error("Wallet not connected");
|
|
@@ -2143,7 +2150,7 @@ function useAuth() {
|
|
|
2143
2150
|
setStatus("error");
|
|
2144
2151
|
}
|
|
2145
2152
|
}, [client, wallet]);
|
|
2146
|
-
const register = (0,
|
|
2153
|
+
const register = (0, import_react13.useCallback)(async (username, referralCode, avatarUrl) => {
|
|
2147
2154
|
try {
|
|
2148
2155
|
const pending = pendingAuth.current;
|
|
2149
2156
|
if (!pending) {
|
|
@@ -2170,7 +2177,7 @@ function useAuth() {
|
|
|
2170
2177
|
setStatus("error");
|
|
2171
2178
|
}
|
|
2172
2179
|
}, [client]);
|
|
2173
|
-
const logout = (0,
|
|
2180
|
+
const logout = (0, import_react13.useCallback)(async () => {
|
|
2174
2181
|
try {
|
|
2175
2182
|
await client.logout();
|
|
2176
2183
|
} catch {
|
|
@@ -2181,7 +2188,7 @@ function useAuth() {
|
|
|
2181
2188
|
setError(null);
|
|
2182
2189
|
pendingAuth.current = null;
|
|
2183
2190
|
}, [client]);
|
|
2184
|
-
const restoreSession = (0,
|
|
2191
|
+
const restoreSession = (0, import_react13.useCallback)(async (savedToken) => {
|
|
2185
2192
|
try {
|
|
2186
2193
|
client.setToken(savedToken);
|
|
2187
2194
|
const me = await client.getMe();
|
|
@@ -2240,9 +2247,9 @@ function AuthGate({
|
|
|
2240
2247
|
}) {
|
|
2241
2248
|
const { client } = useDubs();
|
|
2242
2249
|
const auth = useAuth();
|
|
2243
|
-
const [phase, setPhase] = (0,
|
|
2244
|
-
const [registrationPhase, setRegistrationPhase] = (0,
|
|
2245
|
-
(0,
|
|
2250
|
+
const [phase, setPhase] = (0, import_react14.useState)("init");
|
|
2251
|
+
const [registrationPhase, setRegistrationPhase] = (0, import_react14.useState)(false);
|
|
2252
|
+
(0, import_react14.useEffect)(() => {
|
|
2246
2253
|
let cancelled = false;
|
|
2247
2254
|
(async () => {
|
|
2248
2255
|
try {
|
|
@@ -2268,18 +2275,18 @@ function AuthGate({
|
|
|
2268
2275
|
cancelled = true;
|
|
2269
2276
|
};
|
|
2270
2277
|
}, []);
|
|
2271
|
-
(0,
|
|
2278
|
+
(0, import_react14.useEffect)(() => {
|
|
2272
2279
|
if (auth.status === "needsRegistration") setRegistrationPhase(true);
|
|
2273
2280
|
}, [auth.status]);
|
|
2274
|
-
(0,
|
|
2281
|
+
(0, import_react14.useEffect)(() => {
|
|
2275
2282
|
if (auth.token) onSaveToken(auth.token);
|
|
2276
2283
|
}, [auth.token]);
|
|
2277
|
-
const retry = (0,
|
|
2284
|
+
const retry = (0, import_react14.useCallback)(() => {
|
|
2278
2285
|
setRegistrationPhase(false);
|
|
2279
2286
|
auth.reset();
|
|
2280
2287
|
auth.authenticate();
|
|
2281
2288
|
}, [auth]);
|
|
2282
|
-
const handleRegister = (0,
|
|
2289
|
+
const handleRegister = (0, import_react14.useCallback)(
|
|
2283
2290
|
(username, referralCode, avatarUrl) => {
|
|
2284
2291
|
auth.register(username, referralCode, avatarUrl);
|
|
2285
2292
|
},
|
|
@@ -2358,7 +2365,7 @@ function DefaultErrorScreen({ error, onRetry, appName, accentColor }) {
|
|
|
2358
2365
|
function StepIndicator({ currentStep }) {
|
|
2359
2366
|
const t = useDubsTheme();
|
|
2360
2367
|
const steps = [0, 1, 2, 3];
|
|
2361
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native6.View, { style: s.stepRow, children: steps.map((i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native6.View, { style: s.stepRow, children: steps.map((i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react14.default.Fragment, { children: [
|
|
2362
2369
|
i > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native6.View, { style: [s.stepLine, { backgroundColor: i <= currentStep ? t.success : t.border }] }),
|
|
2363
2370
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2364
2371
|
import_react_native6.View,
|
|
@@ -2382,19 +2389,19 @@ function DefaultRegistrationScreen({
|
|
|
2382
2389
|
}) {
|
|
2383
2390
|
const t = useDubsTheme();
|
|
2384
2391
|
const accent = accentColor || t.accent;
|
|
2385
|
-
const [step, setStep] = (0,
|
|
2386
|
-
const [avatarSeed, setAvatarSeed] = (0,
|
|
2387
|
-
const [avatarStyle, setAvatarStyle] = (0,
|
|
2388
|
-
const [showStyles, setShowStyles] = (0,
|
|
2389
|
-
const [username, setUsername] = (0,
|
|
2390
|
-
const [referralCode, setReferralCode] = (0,
|
|
2391
|
-
const [checking, setChecking] = (0,
|
|
2392
|
-
const [availability, setAvailability] = (0,
|
|
2393
|
-
const debounceRef = (0,
|
|
2394
|
-
const fadeAnim = (0,
|
|
2395
|
-
const slideAnim = (0,
|
|
2392
|
+
const [step, setStep] = (0, import_react14.useState)(0);
|
|
2393
|
+
const [avatarSeed, setAvatarSeed] = (0, import_react14.useState)(generateSeed);
|
|
2394
|
+
const [avatarStyle, setAvatarStyle] = (0, import_react14.useState)("adventurer");
|
|
2395
|
+
const [showStyles, setShowStyles] = (0, import_react14.useState)(false);
|
|
2396
|
+
const [username, setUsername] = (0, import_react14.useState)("");
|
|
2397
|
+
const [referralCode, setReferralCode] = (0, import_react14.useState)("");
|
|
2398
|
+
const [checking, setChecking] = (0, import_react14.useState)(false);
|
|
2399
|
+
const [availability, setAvailability] = (0, import_react14.useState)(null);
|
|
2400
|
+
const debounceRef = (0, import_react14.useRef)(null);
|
|
2401
|
+
const fadeAnim = (0, import_react14.useRef)(new import_react_native6.Animated.Value(1)).current;
|
|
2402
|
+
const slideAnim = (0, import_react14.useRef)(new import_react_native6.Animated.Value(0)).current;
|
|
2396
2403
|
const avatarUrl = getAvatarUrl(avatarStyle, avatarSeed);
|
|
2397
|
-
(0,
|
|
2404
|
+
(0, import_react14.useEffect)(() => {
|
|
2398
2405
|
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
2399
2406
|
const trimmed = username.trim();
|
|
2400
2407
|
if (trimmed.length < 3) {
|
|
@@ -2417,7 +2424,7 @@ function DefaultRegistrationScreen({
|
|
|
2417
2424
|
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
2418
2425
|
};
|
|
2419
2426
|
}, [username, client]);
|
|
2420
|
-
const animateToStep = (0,
|
|
2427
|
+
const animateToStep = (0, import_react14.useCallback)((newStep) => {
|
|
2421
2428
|
const dir = newStep > step ? 1 : -1;
|
|
2422
2429
|
import_react_native6.Keyboard.dismiss();
|
|
2423
2430
|
import_react_native6.Animated.parallel([
|
|
@@ -2716,7 +2723,7 @@ var s = import_react_native6.StyleSheet.create({
|
|
|
2716
2723
|
|
|
2717
2724
|
// src/provider.tsx
|
|
2718
2725
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
2719
|
-
var DubsContext = (0,
|
|
2726
|
+
var DubsContext = (0, import_react15.createContext)(null);
|
|
2720
2727
|
function DubsProvider({
|
|
2721
2728
|
apiKey,
|
|
2722
2729
|
children,
|
|
@@ -2738,11 +2745,11 @@ function DubsProvider({
|
|
|
2738
2745
|
const baseUrl = baseUrlOverride || config.baseUrl;
|
|
2739
2746
|
const rpcUrl = rpcUrlOverride || config.rpcUrl;
|
|
2740
2747
|
const cluster = config.cluster;
|
|
2741
|
-
const client = (0,
|
|
2742
|
-
const connection = (0,
|
|
2743
|
-
const storage = (0,
|
|
2744
|
-
const [uiConfig, setUiConfig] = (0,
|
|
2745
|
-
(0,
|
|
2748
|
+
const client = (0, import_react15.useMemo)(() => new DubsClient({ apiKey, baseUrl }), [apiKey, baseUrl]);
|
|
2749
|
+
const connection = (0, import_react15.useMemo)(() => new import_web34.Connection(rpcUrl, { commitment: "confirmed" }), [rpcUrl]);
|
|
2750
|
+
const storage = (0, import_react15.useMemo)(() => tokenStorage || createSecureStoreStorage(), [tokenStorage]);
|
|
2751
|
+
const [uiConfig, setUiConfig] = (0, import_react15.useState)(null);
|
|
2752
|
+
(0, import_react15.useEffect)(() => {
|
|
2746
2753
|
client.getAppConfig().then((config2) => {
|
|
2747
2754
|
console.log("[DubsProvider] UI config loaded:", JSON.stringify(config2));
|
|
2748
2755
|
setUiConfig(config2);
|
|
@@ -2752,8 +2759,12 @@ function DubsProvider({
|
|
|
2752
2759
|
});
|
|
2753
2760
|
}, [client]);
|
|
2754
2761
|
if (uiConfig === null) return null;
|
|
2762
|
+
const themeOverrides = {};
|
|
2763
|
+
if (uiConfig.accentColor) {
|
|
2764
|
+
themeOverrides.accent = uiConfig.accentColor;
|
|
2765
|
+
}
|
|
2755
2766
|
if (externalWallet) {
|
|
2756
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2767
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ThemeOverrideProvider, { value: themeOverrides, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2757
2768
|
ExternalWalletProvider,
|
|
2758
2769
|
{
|
|
2759
2770
|
client,
|
|
@@ -2770,9 +2781,9 @@ function DubsProvider({
|
|
|
2770
2781
|
uiConfig,
|
|
2771
2782
|
children
|
|
2772
2783
|
}
|
|
2773
|
-
);
|
|
2784
|
+
) });
|
|
2774
2785
|
}
|
|
2775
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2786
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ThemeOverrideProvider, { value: themeOverrides, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2776
2787
|
ManagedWalletProvider,
|
|
2777
2788
|
{
|
|
2778
2789
|
appName: uiConfig.appName || appName,
|
|
@@ -2802,7 +2813,7 @@ function DubsProvider({
|
|
|
2802
2813
|
}
|
|
2803
2814
|
)
|
|
2804
2815
|
}
|
|
2805
|
-
);
|
|
2816
|
+
) });
|
|
2806
2817
|
}
|
|
2807
2818
|
function ManagedInner({
|
|
2808
2819
|
client,
|
|
@@ -2819,11 +2830,11 @@ function ManagedInner({
|
|
|
2819
2830
|
children
|
|
2820
2831
|
}) {
|
|
2821
2832
|
const managedDisconnect = useDisconnect();
|
|
2822
|
-
const disconnect = (0,
|
|
2833
|
+
const disconnect = (0, import_react15.useCallback)(async () => {
|
|
2823
2834
|
client.setToken(null);
|
|
2824
2835
|
await managedDisconnect?.();
|
|
2825
2836
|
}, [client, managedDisconnect]);
|
|
2826
|
-
const value = (0,
|
|
2837
|
+
const value = (0, import_react15.useMemo)(
|
|
2827
2838
|
() => ({ client, wallet, connection, appName, network, disconnect, uiConfig }),
|
|
2828
2839
|
[client, wallet, connection, appName, network, disconnect, uiConfig]
|
|
2829
2840
|
);
|
|
@@ -2859,13 +2870,13 @@ function ExternalWalletProvider({
|
|
|
2859
2870
|
uiConfig,
|
|
2860
2871
|
children
|
|
2861
2872
|
}) {
|
|
2862
|
-
const disconnect = (0,
|
|
2873
|
+
const disconnect = (0, import_react15.useCallback)(async () => {
|
|
2863
2874
|
client.setToken(null);
|
|
2864
2875
|
await storage.deleteItem(STORAGE_KEYS.JWT_TOKEN).catch(() => {
|
|
2865
2876
|
});
|
|
2866
2877
|
await wallet.disconnect?.();
|
|
2867
2878
|
}, [client, storage, wallet]);
|
|
2868
|
-
const value = (0,
|
|
2879
|
+
const value = (0, import_react15.useMemo)(
|
|
2869
2880
|
() => ({ client, wallet, connection, appName, network, disconnect, uiConfig }),
|
|
2870
2881
|
[client, wallet, connection, appName, network, disconnect, uiConfig]
|
|
2871
2882
|
);
|
|
@@ -2890,19 +2901,19 @@ function ExternalWalletProvider({
|
|
|
2890
2901
|
) });
|
|
2891
2902
|
}
|
|
2892
2903
|
function useDubs() {
|
|
2893
|
-
const ctx = (0,
|
|
2904
|
+
const ctx = (0, import_react15.useContext)(DubsContext);
|
|
2894
2905
|
if (!ctx) {
|
|
2895
2906
|
throw new Error("useDubs must be used within a <DubsProvider>");
|
|
2896
2907
|
}
|
|
2897
2908
|
return ctx;
|
|
2898
2909
|
}
|
|
2899
2910
|
function useAppConfig() {
|
|
2900
|
-
const ctx = (0,
|
|
2911
|
+
const ctx = (0, import_react15.useContext)(DubsContext);
|
|
2901
2912
|
return ctx?.uiConfig || {};
|
|
2902
2913
|
}
|
|
2903
2914
|
|
|
2904
2915
|
// src/ui/UserProfileCard.tsx
|
|
2905
|
-
var
|
|
2916
|
+
var import_react16 = require("react");
|
|
2906
2917
|
var import_react_native7 = require("react-native");
|
|
2907
2918
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
2908
2919
|
function truncateAddress(address, chars = 4) {
|
|
@@ -2922,7 +2933,7 @@ function UserProfileCard({
|
|
|
2922
2933
|
memberSince
|
|
2923
2934
|
}) {
|
|
2924
2935
|
const t = useDubsTheme();
|
|
2925
|
-
const imageUri = (0,
|
|
2936
|
+
const imageUri = (0, import_react16.useMemo)(
|
|
2926
2937
|
() => avatarUrl || `https://api.dicebear.com/9.x/avataaars/png?seed=${walletAddress}&size=128`,
|
|
2927
2938
|
[avatarUrl, walletAddress]
|
|
2928
2939
|
);
|
|
@@ -3115,7 +3126,7 @@ var styles3 = import_react_native8.StyleSheet.create({
|
|
|
3115
3126
|
});
|
|
3116
3127
|
|
|
3117
3128
|
// src/ui/game/GamePoster.tsx
|
|
3118
|
-
var
|
|
3129
|
+
var import_react17 = require("react");
|
|
3119
3130
|
var import_react_native9 = require("react-native");
|
|
3120
3131
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
3121
3132
|
function computeCountdown(lockTimestamp) {
|
|
@@ -3165,7 +3176,7 @@ function GamePoster({ game, ImageComponent }) {
|
|
|
3165
3176
|
] });
|
|
3166
3177
|
}
|
|
3167
3178
|
function TeamLogoInternal({ url, size, Img }) {
|
|
3168
|
-
const [failed, setFailed] = (0,
|
|
3179
|
+
const [failed, setFailed] = (0, import_react17.useState)(false);
|
|
3169
3180
|
if (!url || failed) {
|
|
3170
3181
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native9.View, { style: [styles4.logoPlaceholder, { width: size, height: size, borderRadius: size / 2 }] });
|
|
3171
3182
|
}
|
|
@@ -3266,7 +3277,7 @@ var styles4 = import_react_native9.StyleSheet.create({
|
|
|
3266
3277
|
});
|
|
3267
3278
|
|
|
3268
3279
|
// src/ui/game/LivePoolsCard.tsx
|
|
3269
|
-
var
|
|
3280
|
+
var import_react18 = require("react");
|
|
3270
3281
|
var import_react_native10 = require("react-native");
|
|
3271
3282
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
3272
3283
|
function LivePoolsCard({
|
|
@@ -3282,7 +3293,7 @@ function LivePoolsCard({
|
|
|
3282
3293
|
const homePool = game.homePool || 0;
|
|
3283
3294
|
const awayPool = game.awayPool || 0;
|
|
3284
3295
|
const totalPool = game.totalPool || 0;
|
|
3285
|
-
const { homePercent, awayPercent, homeOdds, awayOdds } = (0,
|
|
3296
|
+
const { homePercent, awayPercent, homeOdds, awayOdds } = (0, import_react18.useMemo)(() => {
|
|
3286
3297
|
return {
|
|
3287
3298
|
homePercent: totalPool > 0 ? homePool / totalPool * 100 : 50,
|
|
3288
3299
|
awayPercent: totalPool > 0 ? awayPool / totalPool * 100 : 50,
|
|
@@ -3345,7 +3356,7 @@ var styles5 = import_react_native10.StyleSheet.create({
|
|
|
3345
3356
|
});
|
|
3346
3357
|
|
|
3347
3358
|
// src/ui/game/PickWinnerCard.tsx
|
|
3348
|
-
var
|
|
3359
|
+
var import_react19 = require("react");
|
|
3349
3360
|
var import_react_native11 = require("react-native");
|
|
3350
3361
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
3351
3362
|
function PickWinnerCard({
|
|
@@ -3363,7 +3374,7 @@ function PickWinnerCard({
|
|
|
3363
3374
|
const totalPool = game.totalPool || 0;
|
|
3364
3375
|
const homePool = game.homePool || 0;
|
|
3365
3376
|
const awayPool = game.awayPool || 0;
|
|
3366
|
-
const { homeOdds, awayOdds, homeBets, awayBets } = (0,
|
|
3377
|
+
const { homeOdds, awayOdds, homeBets, awayBets } = (0, import_react19.useMemo)(() => ({
|
|
3367
3378
|
homeOdds: homePool > 0 ? (totalPool / homePool).toFixed(2) : "\u2014",
|
|
3368
3379
|
awayOdds: awayPool > 0 ? (totalPool / awayPool).toFixed(2) : "\u2014",
|
|
3369
3380
|
homeBets: bettors.filter((b) => b.team === "home").length,
|
|
@@ -3416,7 +3427,7 @@ function TeamOption({
|
|
|
3416
3427
|
ImageComponent,
|
|
3417
3428
|
t
|
|
3418
3429
|
}) {
|
|
3419
|
-
const [imgFailed, setImgFailed] = (0,
|
|
3430
|
+
const [imgFailed, setImgFailed] = (0, import_react19.useState)(false);
|
|
3420
3431
|
const Img = ImageComponent || require("react-native").Image;
|
|
3421
3432
|
const showImage = imageUrl && !imgFailed;
|
|
3422
3433
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
@@ -3457,7 +3468,7 @@ var styles6 = import_react_native11.StyleSheet.create({
|
|
|
3457
3468
|
});
|
|
3458
3469
|
|
|
3459
3470
|
// src/ui/game/PlayersCard.tsx
|
|
3460
|
-
var
|
|
3471
|
+
var import_react20 = require("react");
|
|
3461
3472
|
var import_react_native12 = require("react-native");
|
|
3462
3473
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
3463
3474
|
function truncateWallet(addr, chars) {
|
|
@@ -3506,7 +3517,7 @@ function BettorRow({
|
|
|
3506
3517
|
ImageComponent,
|
|
3507
3518
|
t
|
|
3508
3519
|
}) {
|
|
3509
|
-
const [imgFailed, setImgFailed] = (0,
|
|
3520
|
+
const [imgFailed, setImgFailed] = (0, import_react20.useState)(false);
|
|
3510
3521
|
const Img = ImageComponent || require("react-native").Image;
|
|
3511
3522
|
const showAvatar = bettor.avatar && !imgFailed;
|
|
3512
3523
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react_native12.View, { style: [styles7.row, !isFirst && { borderTopColor: t.border, borderTopWidth: 1 }], children: [
|
|
@@ -3533,7 +3544,7 @@ var styles7 = import_react_native12.StyleSheet.create({
|
|
|
3533
3544
|
});
|
|
3534
3545
|
|
|
3535
3546
|
// src/ui/game/JoinGameButton.tsx
|
|
3536
|
-
var
|
|
3547
|
+
var import_react21 = require("react");
|
|
3537
3548
|
var import_react_native13 = require("react-native");
|
|
3538
3549
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
3539
3550
|
var STATUS_LABELS = {
|
|
@@ -3544,7 +3555,7 @@ var STATUS_LABELS = {
|
|
|
3544
3555
|
};
|
|
3545
3556
|
function JoinGameButton({ game, walletAddress, selectedTeam, status, onJoin }) {
|
|
3546
3557
|
const t = useDubsTheme();
|
|
3547
|
-
const alreadyJoined = (0,
|
|
3558
|
+
const alreadyJoined = (0, import_react21.useMemo)(() => {
|
|
3548
3559
|
if (!walletAddress) return false;
|
|
3549
3560
|
return (game.bettors || []).some((b) => b.wallet === walletAddress);
|
|
3550
3561
|
}, [game.bettors, walletAddress]);
|
|
@@ -3562,7 +3573,7 @@ function JoinGameButton({ game, walletAddress, selectedTeam, status, onJoin }) {
|
|
|
3562
3573
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3563
3574
|
import_react_native13.TouchableOpacity,
|
|
3564
3575
|
{
|
|
3565
|
-
style: [styles8.button, { backgroundColor: selectedTeam ?
|
|
3576
|
+
style: [styles8.button, { backgroundColor: selectedTeam ? t.accent : t.border }],
|
|
3566
3577
|
disabled: !selectedTeam || isJoining,
|
|
3567
3578
|
onPress: onJoin,
|
|
3568
3579
|
activeOpacity: 0.8,
|
|
@@ -3585,7 +3596,7 @@ var styles8 = import_react_native13.StyleSheet.create({
|
|
|
3585
3596
|
});
|
|
3586
3597
|
|
|
3587
3598
|
// src/ui/game/CreateCustomGameSheet.tsx
|
|
3588
|
-
var
|
|
3599
|
+
var import_react22 = require("react");
|
|
3589
3600
|
var import_react_native14 = require("react-native");
|
|
3590
3601
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
3591
3602
|
var STATUS_LABELS2 = {
|
|
@@ -3610,18 +3621,18 @@ function CreateCustomGameSheet({
|
|
|
3610
3621
|
const t = useDubsTheme();
|
|
3611
3622
|
const { wallet } = useDubs();
|
|
3612
3623
|
const mutation = useCreateCustomGame();
|
|
3613
|
-
const [selectedAmount, setSelectedAmount] = (0,
|
|
3614
|
-
const [customAmount, setCustomAmount] = (0,
|
|
3615
|
-
const [isCustom, setIsCustom] = (0,
|
|
3616
|
-
const overlayOpacity = (0,
|
|
3617
|
-
(0,
|
|
3624
|
+
const [selectedAmount, setSelectedAmount] = (0, import_react22.useState)(null);
|
|
3625
|
+
const [customAmount, setCustomAmount] = (0, import_react22.useState)("");
|
|
3626
|
+
const [isCustom, setIsCustom] = (0, import_react22.useState)(false);
|
|
3627
|
+
const overlayOpacity = (0, import_react22.useRef)(new import_react_native14.Animated.Value(0)).current;
|
|
3628
|
+
(0, import_react22.useEffect)(() => {
|
|
3618
3629
|
import_react_native14.Animated.timing(overlayOpacity, {
|
|
3619
3630
|
toValue: visible ? 1 : 0,
|
|
3620
3631
|
duration: 250,
|
|
3621
3632
|
useNativeDriver: true
|
|
3622
3633
|
}).start();
|
|
3623
3634
|
}, [visible, overlayOpacity]);
|
|
3624
|
-
(0,
|
|
3635
|
+
(0, import_react22.useEffect)(() => {
|
|
3625
3636
|
if (visible) {
|
|
3626
3637
|
setSelectedAmount(defaultAmount ?? null);
|
|
3627
3638
|
setCustomAmount("");
|
|
@@ -3629,7 +3640,7 @@ function CreateCustomGameSheet({
|
|
|
3629
3640
|
mutation.reset();
|
|
3630
3641
|
}
|
|
3631
3642
|
}, [visible]);
|
|
3632
|
-
(0,
|
|
3643
|
+
(0, import_react22.useEffect)(() => {
|
|
3633
3644
|
if (mutation.status === "success" && mutation.data) {
|
|
3634
3645
|
onSuccess?.(mutation.data);
|
|
3635
3646
|
const timer = setTimeout(() => {
|
|
@@ -3638,23 +3649,23 @@ function CreateCustomGameSheet({
|
|
|
3638
3649
|
return () => clearTimeout(timer);
|
|
3639
3650
|
}
|
|
3640
3651
|
}, [mutation.status, mutation.data]);
|
|
3641
|
-
(0,
|
|
3652
|
+
(0, import_react22.useEffect)(() => {
|
|
3642
3653
|
if (mutation.status === "error" && mutation.error) {
|
|
3643
3654
|
onError?.(mutation.error);
|
|
3644
3655
|
}
|
|
3645
3656
|
}, [mutation.status, mutation.error]);
|
|
3646
|
-
const handlePresetSelect = (0,
|
|
3657
|
+
const handlePresetSelect = (0, import_react22.useCallback)((amount) => {
|
|
3647
3658
|
setSelectedAmount(amount);
|
|
3648
3659
|
setIsCustom(false);
|
|
3649
3660
|
setCustomAmount("");
|
|
3650
3661
|
onAmountChange?.(amount);
|
|
3651
3662
|
}, [onAmountChange]);
|
|
3652
|
-
const handleCustomSelect = (0,
|
|
3663
|
+
const handleCustomSelect = (0, import_react22.useCallback)(() => {
|
|
3653
3664
|
setIsCustom(true);
|
|
3654
3665
|
setSelectedAmount(null);
|
|
3655
3666
|
onAmountChange?.(null);
|
|
3656
3667
|
}, [onAmountChange]);
|
|
3657
|
-
const handleCustomAmountChange = (0,
|
|
3668
|
+
const handleCustomAmountChange = (0, import_react22.useCallback)((text) => {
|
|
3658
3669
|
const cleaned = text.replace(/[^0-9.]/g, "").replace(/(\..*?)\..*/g, "$1");
|
|
3659
3670
|
setCustomAmount(cleaned);
|
|
3660
3671
|
const parsed = parseFloat(cleaned);
|
|
@@ -3668,7 +3679,7 @@ function CreateCustomGameSheet({
|
|
|
3668
3679
|
const winnerTakes = pot * (1 - fee / 100);
|
|
3669
3680
|
const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
|
|
3670
3681
|
const canCreate = effectiveAmount !== null && effectiveAmount > 0 && !isMutating && mutation.status !== "success";
|
|
3671
|
-
const handleCreate = (0,
|
|
3682
|
+
const handleCreate = (0, import_react22.useCallback)(async () => {
|
|
3672
3683
|
if (!effectiveAmount || !wallet.publicKey) return;
|
|
3673
3684
|
try {
|
|
3674
3685
|
await mutation.execute({
|
|
@@ -3937,7 +3948,7 @@ var styles9 = import_react_native14.StyleSheet.create({
|
|
|
3937
3948
|
});
|
|
3938
3949
|
|
|
3939
3950
|
// src/ui/game/JoinGameSheet.tsx
|
|
3940
|
-
var
|
|
3951
|
+
var import_react23 = require("react");
|
|
3941
3952
|
var import_react_native15 = require("react-native");
|
|
3942
3953
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
3943
3954
|
var STATUS_LABELS3 = {
|
|
@@ -3962,22 +3973,22 @@ function JoinGameSheet({
|
|
|
3962
3973
|
const { wallet } = useDubs();
|
|
3963
3974
|
const mutation = useJoinGame();
|
|
3964
3975
|
const isCustomGame = game.gameMode === CUSTOM_GAME_MODE;
|
|
3965
|
-
const [selectedTeam, setSelectedTeam] = (0,
|
|
3966
|
-
const overlayOpacity = (0,
|
|
3967
|
-
(0,
|
|
3976
|
+
const [selectedTeam, setSelectedTeam] = (0, import_react23.useState)(null);
|
|
3977
|
+
const overlayOpacity = (0, import_react23.useRef)(new import_react_native15.Animated.Value(0)).current;
|
|
3978
|
+
(0, import_react23.useEffect)(() => {
|
|
3968
3979
|
import_react_native15.Animated.timing(overlayOpacity, {
|
|
3969
3980
|
toValue: visible ? 1 : 0,
|
|
3970
3981
|
duration: 250,
|
|
3971
3982
|
useNativeDriver: true
|
|
3972
3983
|
}).start();
|
|
3973
3984
|
}, [visible, overlayOpacity]);
|
|
3974
|
-
(0,
|
|
3985
|
+
(0, import_react23.useEffect)(() => {
|
|
3975
3986
|
if (visible) {
|
|
3976
3987
|
setSelectedTeam(isCustomGame ? "away" : null);
|
|
3977
3988
|
mutation.reset();
|
|
3978
3989
|
}
|
|
3979
3990
|
}, [visible]);
|
|
3980
|
-
(0,
|
|
3991
|
+
(0, import_react23.useEffect)(() => {
|
|
3981
3992
|
if (mutation.status === "success" && mutation.data) {
|
|
3982
3993
|
onSuccess?.(mutation.data);
|
|
3983
3994
|
const timer = setTimeout(() => {
|
|
@@ -3986,7 +3997,7 @@ function JoinGameSheet({
|
|
|
3986
3997
|
return () => clearTimeout(timer);
|
|
3987
3998
|
}
|
|
3988
3999
|
}, [mutation.status, mutation.data]);
|
|
3989
|
-
(0,
|
|
4000
|
+
(0, import_react23.useEffect)(() => {
|
|
3990
4001
|
if (mutation.status === "error" && mutation.error) {
|
|
3991
4002
|
onError?.(mutation.error);
|
|
3992
4003
|
}
|
|
@@ -3997,7 +4008,7 @@ function JoinGameSheet({
|
|
|
3997
4008
|
const homePool = game.homePool || 0;
|
|
3998
4009
|
const awayPool = game.awayPool || 0;
|
|
3999
4010
|
const buyIn = game.buyIn;
|
|
4000
|
-
const { homeOdds, awayOdds, homeBets, awayBets } = (0,
|
|
4011
|
+
const { homeOdds, awayOdds, homeBets, awayBets } = (0, import_react23.useMemo)(() => ({
|
|
4001
4012
|
homeOdds: homePool > 0 ? (totalPool / homePool).toFixed(2) : "\u2014",
|
|
4002
4013
|
awayOdds: awayPool > 0 ? (totalPool / awayPool).toFixed(2) : "\u2014",
|
|
4003
4014
|
homeBets: bettors.filter((b) => b.team === "home").length,
|
|
@@ -4009,14 +4020,14 @@ function JoinGameSheet({
|
|
|
4009
4020
|
const homeName = shortName ? shortName(opponents[0]?.name) : opponents[0]?.name || "Home";
|
|
4010
4021
|
const awayName = shortName ? shortName(opponents[1]?.name) : opponents[1]?.name || "Away";
|
|
4011
4022
|
const selectedName = selectedTeam === "home" ? homeName : selectedTeam === "away" ? awayName : "\u2014";
|
|
4012
|
-
const alreadyJoined = (0,
|
|
4023
|
+
const alreadyJoined = (0, import_react23.useMemo)(() => {
|
|
4013
4024
|
if (!wallet.publicKey) return false;
|
|
4014
4025
|
const addr = wallet.publicKey.toBase58();
|
|
4015
4026
|
return bettors.some((b) => b.wallet === addr);
|
|
4016
4027
|
}, [bettors, wallet.publicKey]);
|
|
4017
4028
|
const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
|
|
4018
4029
|
const canJoin = selectedTeam !== null && !isMutating && mutation.status !== "success" && !alreadyJoined;
|
|
4019
|
-
const handleJoin = (0,
|
|
4030
|
+
const handleJoin = (0, import_react23.useCallback)(async () => {
|
|
4020
4031
|
if (!selectedTeam || !wallet.publicKey) return;
|
|
4021
4032
|
try {
|
|
4022
4033
|
await mutation.execute({
|
|
@@ -4145,7 +4156,7 @@ function TeamButton({
|
|
|
4145
4156
|
ImageComponent,
|
|
4146
4157
|
t
|
|
4147
4158
|
}) {
|
|
4148
|
-
const [imgFailed, setImgFailed] = (0,
|
|
4159
|
+
const [imgFailed, setImgFailed] = (0, import_react23.useState)(false);
|
|
4149
4160
|
const Img = ImageComponent || require("react-native").Image;
|
|
4150
4161
|
const showImage = imageUrl && !imgFailed;
|
|
4151
4162
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
@@ -4322,7 +4333,7 @@ var styles10 = import_react_native15.StyleSheet.create({
|
|
|
4322
4333
|
});
|
|
4323
4334
|
|
|
4324
4335
|
// src/ui/game/ClaimPrizeSheet.tsx
|
|
4325
|
-
var
|
|
4336
|
+
var import_react24 = require("react");
|
|
4326
4337
|
var import_react_native16 = require("react-native");
|
|
4327
4338
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
4328
4339
|
var STATUS_LABELS4 = {
|
|
@@ -4343,18 +4354,18 @@ function ClaimPrizeSheet({
|
|
|
4343
4354
|
const t = useDubsTheme();
|
|
4344
4355
|
const { wallet } = useDubs();
|
|
4345
4356
|
const mutation = useClaim();
|
|
4346
|
-
const overlayOpacity = (0,
|
|
4347
|
-
const celebrationScale = (0,
|
|
4348
|
-
const celebrationOpacity = (0,
|
|
4349
|
-
const [showCelebration, setShowCelebration] = (0,
|
|
4350
|
-
(0,
|
|
4357
|
+
const overlayOpacity = (0, import_react24.useRef)(new import_react_native16.Animated.Value(0)).current;
|
|
4358
|
+
const celebrationScale = (0, import_react24.useRef)(new import_react_native16.Animated.Value(0)).current;
|
|
4359
|
+
const celebrationOpacity = (0, import_react24.useRef)(new import_react_native16.Animated.Value(0)).current;
|
|
4360
|
+
const [showCelebration, setShowCelebration] = (0, import_react24.useState)(false);
|
|
4361
|
+
(0, import_react24.useEffect)(() => {
|
|
4351
4362
|
import_react_native16.Animated.timing(overlayOpacity, {
|
|
4352
4363
|
toValue: visible ? 1 : 0,
|
|
4353
4364
|
duration: 250,
|
|
4354
4365
|
useNativeDriver: true
|
|
4355
4366
|
}).start();
|
|
4356
4367
|
}, [visible, overlayOpacity]);
|
|
4357
|
-
(0,
|
|
4368
|
+
(0, import_react24.useEffect)(() => {
|
|
4358
4369
|
if (visible) {
|
|
4359
4370
|
mutation.reset();
|
|
4360
4371
|
setShowCelebration(false);
|
|
@@ -4362,7 +4373,7 @@ function ClaimPrizeSheet({
|
|
|
4362
4373
|
celebrationOpacity.setValue(0);
|
|
4363
4374
|
}
|
|
4364
4375
|
}, [visible]);
|
|
4365
|
-
(0,
|
|
4376
|
+
(0, import_react24.useEffect)(() => {
|
|
4366
4377
|
if (mutation.status === "success" && mutation.data) {
|
|
4367
4378
|
setShowCelebration(true);
|
|
4368
4379
|
import_react_native16.Animated.parallel([
|
|
@@ -4385,14 +4396,14 @@ function ClaimPrizeSheet({
|
|
|
4385
4396
|
return () => clearTimeout(timer);
|
|
4386
4397
|
}
|
|
4387
4398
|
}, [mutation.status, mutation.data]);
|
|
4388
|
-
(0,
|
|
4399
|
+
(0, import_react24.useEffect)(() => {
|
|
4389
4400
|
if (mutation.status === "error" && mutation.error) {
|
|
4390
4401
|
onError?.(mutation.error);
|
|
4391
4402
|
}
|
|
4392
4403
|
}, [mutation.status, mutation.error]);
|
|
4393
4404
|
const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
|
|
4394
4405
|
const canClaim = !isMutating && mutation.status !== "success" && !!wallet.publicKey;
|
|
4395
|
-
const handleClaim = (0,
|
|
4406
|
+
const handleClaim = (0, import_react24.useCallback)(async () => {
|
|
4396
4407
|
if (!wallet.publicKey) return;
|
|
4397
4408
|
try {
|
|
4398
4409
|
await mutation.execute({
|
|
@@ -4476,7 +4487,7 @@ function ClaimPrizeSheet({
|
|
|
4476
4487
|
{
|
|
4477
4488
|
style: [
|
|
4478
4489
|
styles11.ctaButton,
|
|
4479
|
-
{ backgroundColor: canClaim ? t.
|
|
4490
|
+
{ backgroundColor: canClaim ? t.accent : t.border }
|
|
4480
4491
|
],
|
|
4481
4492
|
disabled: !canClaim,
|
|
4482
4493
|
onPress: handleClaim,
|
|
@@ -4623,9 +4634,113 @@ var styles11 = import_react_native16.StyleSheet.create({
|
|
|
4623
4634
|
fontSize: 13
|
|
4624
4635
|
}
|
|
4625
4636
|
});
|
|
4637
|
+
|
|
4638
|
+
// src/ui/game/ClaimButton.tsx
|
|
4639
|
+
var import_react25 = require("react");
|
|
4640
|
+
var import_react_native17 = require("react-native");
|
|
4641
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
4642
|
+
function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
4643
|
+
const t = useDubsTheme();
|
|
4644
|
+
const { wallet } = useDubs();
|
|
4645
|
+
const game = useGame(gameId);
|
|
4646
|
+
const claimStatus = useHasClaimed(gameId);
|
|
4647
|
+
const [sheetVisible, setSheetVisible] = (0, import_react25.useState)(false);
|
|
4648
|
+
const walletAddress = wallet.publicKey?.toBase58() ?? null;
|
|
4649
|
+
const myBet = (0, import_react25.useMemo)(() => {
|
|
4650
|
+
if (!walletAddress || !game.data?.bettors) return null;
|
|
4651
|
+
return game.data.bettors.find((b) => b.wallet === walletAddress) ?? null;
|
|
4652
|
+
}, [walletAddress, game.data?.bettors]);
|
|
4653
|
+
const isResolved = game.data?.isResolved ?? false;
|
|
4654
|
+
const isRefund = isResolved && game.data?.winnerSide === null;
|
|
4655
|
+
const isWinner = isResolved && myBet != null && myBet.team === game.data?.winnerSide;
|
|
4656
|
+
const isEligible = myBet != null && isResolved && (isWinner || isRefund);
|
|
4657
|
+
const prizeAmount = isRefund ? myBet?.amount ?? 0 : game.data?.totalPool ?? 0;
|
|
4658
|
+
const handleSuccess = (0, import_react25.useCallback)(
|
|
4659
|
+
(result) => {
|
|
4660
|
+
claimStatus.refetch();
|
|
4661
|
+
onSuccess?.(result);
|
|
4662
|
+
},
|
|
4663
|
+
[claimStatus.refetch, onSuccess]
|
|
4664
|
+
// eslint-disable-line react-hooks/exhaustive-deps
|
|
4665
|
+
);
|
|
4666
|
+
if (game.loading || claimStatus.loading || !game.data || !walletAddress || !isEligible) {
|
|
4667
|
+
return null;
|
|
4668
|
+
}
|
|
4669
|
+
const label = isRefund ? "Refund" : "Prize";
|
|
4670
|
+
if (claimStatus.hasClaimed) {
|
|
4671
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
4672
|
+
import_react_native17.TouchableOpacity,
|
|
4673
|
+
{
|
|
4674
|
+
style: [styles12.badge, { borderColor: t.accent }, style],
|
|
4675
|
+
activeOpacity: 1,
|
|
4676
|
+
disabled: true,
|
|
4677
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native17.Text, { style: [styles12.badgeText, { color: t.accent }], children: [
|
|
4678
|
+
label,
|
|
4679
|
+
" Claimed!"
|
|
4680
|
+
] })
|
|
4681
|
+
}
|
|
4682
|
+
);
|
|
4683
|
+
}
|
|
4684
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
4685
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
4686
|
+
import_react_native17.TouchableOpacity,
|
|
4687
|
+
{
|
|
4688
|
+
style: [styles12.button, { backgroundColor: t.accent }, style],
|
|
4689
|
+
activeOpacity: 0.8,
|
|
4690
|
+
onPress: () => setSheetVisible(true),
|
|
4691
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native17.Text, { style: styles12.buttonText, children: [
|
|
4692
|
+
"Claim ",
|
|
4693
|
+
label,
|
|
4694
|
+
" \u2014 ",
|
|
4695
|
+
prizeAmount,
|
|
4696
|
+
" SOL"
|
|
4697
|
+
] })
|
|
4698
|
+
}
|
|
4699
|
+
),
|
|
4700
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
4701
|
+
ClaimPrizeSheet,
|
|
4702
|
+
{
|
|
4703
|
+
visible: sheetVisible,
|
|
4704
|
+
onDismiss: () => setSheetVisible(false),
|
|
4705
|
+
gameId,
|
|
4706
|
+
prizeAmount,
|
|
4707
|
+
isRefund,
|
|
4708
|
+
onSuccess: handleSuccess,
|
|
4709
|
+
onError
|
|
4710
|
+
}
|
|
4711
|
+
)
|
|
4712
|
+
] });
|
|
4713
|
+
}
|
|
4714
|
+
var styles12 = import_react_native17.StyleSheet.create({
|
|
4715
|
+
button: {
|
|
4716
|
+
height: 52,
|
|
4717
|
+
borderRadius: 14,
|
|
4718
|
+
justifyContent: "center",
|
|
4719
|
+
alignItems: "center",
|
|
4720
|
+
paddingHorizontal: 20
|
|
4721
|
+
},
|
|
4722
|
+
buttonText: {
|
|
4723
|
+
color: "#FFFFFF",
|
|
4724
|
+
fontSize: 16,
|
|
4725
|
+
fontWeight: "700"
|
|
4726
|
+
},
|
|
4727
|
+
badge: {
|
|
4728
|
+
height: 52,
|
|
4729
|
+
borderRadius: 14,
|
|
4730
|
+
borderWidth: 2,
|
|
4731
|
+
justifyContent: "center",
|
|
4732
|
+
alignItems: "center",
|
|
4733
|
+
paddingHorizontal: 20
|
|
4734
|
+
},
|
|
4735
|
+
badgeText: {
|
|
4736
|
+
fontSize: 16,
|
|
4737
|
+
fontWeight: "700"
|
|
4738
|
+
}
|
|
4739
|
+
});
|
|
4626
4740
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4627
4741
|
0 && (module.exports = {
|
|
4628
4742
|
AuthGate,
|
|
4743
|
+
ClaimButton,
|
|
4629
4744
|
ClaimPrizeSheet,
|
|
4630
4745
|
ConnectWalletScreen,
|
|
4631
4746
|
CreateCustomGameSheet,
|