diff --git a/frontend/casino/src/app/components/App/AppNav/AppNav.tsx b/frontend/casino/src/app/components/App/AppNav/AppNav.tsx
index d3237b7..b4b6d35 100644
--- a/frontend/casino/src/app/components/App/AppNav/AppNav.tsx
+++ b/frontend/casino/src/app/components/App/AppNav/AppNav.tsx
@@ -5,6 +5,7 @@ import chipImg from '../../../../assets/icons/chip.png'
import {useStores} from "../../../hooks/useStores.tsx";
import {observer} from "mobx-react-lite";
import {CheckBalanceButton} from "../../../web3/balance/CheckBalanceButton.tsx";
+import {FaucetButton} from "../../web3/FaucetButton.tsx";
export const AppNav = observer(() => {
const { userStore } = useStores()
@@ -23,15 +24,12 @@ export const AppNav = observer(() => {
- {/* placeholder for balance */}
- {userStore.balance ? {userStore.balance} : }
+ {userStore.balance ? {
+ parseFloat(userStore.balance) > 5 ? userStore.balance :
+ } : }
-
diff --git a/frontend/casino/src/app/components/web3/FaucetButton.tsx b/frontend/casino/src/app/components/web3/FaucetButton.tsx
new file mode 100644
index 0000000..1daa122
--- /dev/null
+++ b/frontend/casino/src/app/components/web3/FaucetButton.tsx
@@ -0,0 +1,19 @@
+import {useCheckBalance} from "./useCheckBalance.ts";
+import {observer} from "mobx-react-lite";
+import {useEffect} from "react";
+import {useStores} from "../../hooks/useStores.tsx";
+import {useFaucet} from "../../web3/functions/Faucet/useFaucet.ts";
+
+export const FaucetButton = observer(() => {
+ const { faucet, result } = useFaucet()
+ const { userStore } = useStores()
+ useEffect(() => {
+ if (result) userStore.setBalance(result.balance)
+ }, [result])
+
+ return (
+
+ );
+});
\ No newline at end of file
diff --git a/frontend/casino/src/app/components/web3/RPSPlayButton.tsx b/frontend/casino/src/app/components/web3/RPSPlayButton.tsx
index 1cb94f2..f7e11ef 100644
--- a/frontend/casino/src/app/components/web3/RPSPlayButton.tsx
+++ b/frontend/casino/src/app/components/web3/RPSPlayButton.tsx
@@ -6,7 +6,7 @@ export const RPSPlayButton = () => {
return (
diff --git a/frontend/casino/src/app/components/web3/SlotPlayButton.tsx b/frontend/casino/src/app/components/web3/SlotPlayButton.tsx
index f38ea96..7608bc8 100644
--- a/frontend/casino/src/app/components/web3/SlotPlayButton.tsx
+++ b/frontend/casino/src/app/components/web3/SlotPlayButton.tsx
@@ -1,14 +1,21 @@
import PropTypes from "prop-types";
+import {useSlotMachine} from "../../web3/functions/SlotMachine/useSlotMachine.ts";
interface SlotPlayButtonProps {
onClick: () => void;
}
const SlotPlayButton: React.FC = ({ onClick }) => {
+
+ const { playSlot } = useSlotMachine()
+
return (
diff --git a/frontend/casino/src/app/pages/SlotGamePage/SlotGamePage.tsx b/frontend/casino/src/app/pages/SlotGamePage/SlotGamePage.tsx
index 251c3ad..17032a6 100644
--- a/frontend/casino/src/app/pages/SlotGamePage/SlotGamePage.tsx
+++ b/frontend/casino/src/app/pages/SlotGamePage/SlotGamePage.tsx
@@ -1,4 +1,4 @@
-import {useEffect, useState} from "react";
+import { useEffect, useState } from "react";
import ContainerLayout from "../../utils/ContainerLayout.tsx";
import Reel from "../../components/App/Slot/Reel.tsx";
import SlotPlayButton from "../../components/web3/SlotPlayButton.tsx";
diff --git a/frontend/casino/src/app/web3/functions/Craps/usePlayCraps.ts b/frontend/casino/src/app/web3/functions/Craps/usePlayCraps.ts
index 78af54f..4f53c1f 100644
--- a/frontend/casino/src/app/web3/functions/Craps/usePlayCraps.ts
+++ b/frontend/casino/src/app/web3/functions/Craps/usePlayCraps.ts
@@ -14,7 +14,7 @@ export const usePlayCraps = () => {
scriptHash: config.craps.contractAddress,
operation: 'playCraps',
args: [
- { type: 'Integer', value: '40' },
+ { type: 'Integer', value: '4' },
{ type: 'Integer', value: value.toString() },
{ type: 'Integer', value: secondValue.toString() },
]
diff --git a/frontend/casino/src/app/web3/functions/Faucet/useFaucet.ts b/frontend/casino/src/app/web3/functions/Faucet/useFaucet.ts
new file mode 100644
index 0000000..7cfaa95
--- /dev/null
+++ b/frontend/casino/src/app/web3/functions/Faucet/useFaucet.ts
@@ -0,0 +1,30 @@
+import {useWalletConnect} from "@cityofzion/wallet-connect-sdk-react";
+import {useCallback} from "react";
+import {useGetResult} from "../utils/useGetResult.ts";
+import {config} from "../config/config.ts";
+
+export const useFaucet = () => {
+ const wcSdk = useWalletConnect()
+ const { getResult, ...statuses } = useGetResult()
+
+ const faucet = useCallback(async () => {
+ console.log(config.zaFaucet.contractAddress)
+ const resp = await wcSdk.invokeFunction({
+ invocations: [{
+ scriptHash: config.zaFaucet.contractAddress,
+ operation: 'getZaCoin',
+ args: []
+ }],
+ signers: [{
+ scopes: 'Global',
+ }]
+ })
+ console.log(resp)
+ await getResult(resp, 'rouletteNumber')
+ }, [wcSdk, getResult])
+
+ return {
+ faucet,
+ ...statuses
+ }
+}
\ No newline at end of file
diff --git a/frontend/casino/src/app/web3/functions/RPS/usePlayRPS.ts b/frontend/casino/src/app/web3/functions/RPS/usePlayRPS.ts
index 2c721e6..2a2903c 100644
--- a/frontend/casino/src/app/web3/functions/RPS/usePlayRPS.ts
+++ b/frontend/casino/src/app/web3/functions/RPS/usePlayRPS.ts
@@ -14,8 +14,8 @@ export const usePlayRPS = () => {
scriptHash: config.rps.contractAddress,
operation: 'playRPS',
args: [
- { type: 'String', value: value },
- { type: 'Integer', value: '40' },
+ { type: 'Integer', value: value },
+ { type: 'Integer', value: '4' },
]
}],
signers: [{
diff --git a/frontend/casino/src/app/web3/functions/SlotMachine/useSlotMachine.ts b/frontend/casino/src/app/web3/functions/SlotMachine/useSlotMachine.ts
index 0f6efb4..fc91461 100644
--- a/frontend/casino/src/app/web3/functions/SlotMachine/useSlotMachine.ts
+++ b/frontend/casino/src/app/web3/functions/SlotMachine/useSlotMachine.ts
@@ -14,7 +14,7 @@ export const useSlotMachine = () => {
scriptHash: config.slotMachine.contractAddress,
operation: 'rollSlot',
args: [
- { type: 'Integer', value: '40' },
+ { type: 'Integer', value: '4' },
]
}],
signers: [{
diff --git a/frontend/casino/src/app/web3/functions/config/config.ts b/frontend/casino/src/app/web3/functions/config/config.ts
index cb37260..a74920b 100644
--- a/frontend/casino/src/app/web3/functions/config/config.ts
+++ b/frontend/casino/src/app/web3/functions/config/config.ts
@@ -13,5 +13,8 @@ export const config = {
},
rps: {
contractAddress: 'ae71ad7c8174530cddecf483e8094539f84fcd7f'
+ },
+ zaFaucet: {
+ contractAddress: '66621b53f51303d29a224cb6e5deeec30ad2631b'
}
}
\ No newline at end of file