diff --git a/src/components/Verification.js b/src/components/Verification.js
index 8a35049..e925dd8 100644
--- a/src/components/Verification.js
+++ b/src/components/Verification.js
@@ -1,4 +1,244 @@
-
+import React, { Component } from 'react';
+import SweetAlert from 'react-bootstrap-sweetalert';
+import { getBetData, getBetDataStake, getBetDataPrimeDice, getBetDataCryptoGames } from '../services/verificationService';
+import { getServerSeed } from '../services/verificationService';
+import { getServerSeedPrimeDice } from '../services/verificationService';
+import { getServerSeedCryptoGames } from '../services/verificationService';
+import { getServerSeedHash } from '../services/verificationService';
+import { getServerSeedHashPrimeDice } from '../services/verificationService';
+import { getServerSeedHashCryptoGames } from '../services/verificationService';
+
+class Verification extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ gettingStarted: false,
+ settings: false,
+ verification: false,
+ operators: false,
+ primeDice: false,
+
+ verify: false,
+ showAlert: false,
+ diceVerify: '',
+
+ betData: [],
+ serverSeed: '',
+ serverSeedHash: '',
+ clientSeed: '',
+ nonce: '',
+ numberBetsVerFailed: 0,
+ isNonceManipulated: false,
+ active_game: '',
+ popupResult: [],
+ cryptoGames: false,
+ apiKey: '',
+
+
+ }
+ }
+
+ componentDidMount() {
+ this.setState({ verification: this.props.verification });
+ }
+
+ handleVerifyBet = (serverSeed, clientSeed, nonce) => {
+ this.setState({ verify: true });
+ this.setState({ diceVerify: this.verifyBet(serverSeed, clientSeed, nonce) });
+
+ };
+
+
+ handleVerifyBetPrimeDice = (serverSeed, clientSeed, nonce) => {
+
+ this.setState({ verify: true });
+
+ this.setState({ diceVerify: this.verifyBetPrimeDice(serverSeed, clientSeed, nonce) });
+ };
+
+
+
+ handleVerifyBetCryptoGames = (serverSeed, clientSeed, nonce) => {
+ this.setState({ verify: true });
+ this.setState({ diceVerify: this.verifyBetCryptoGames(serverSeed, clientSeed, nonce) });
+ };
+
+ verifyBet = (serverSeed, clientSeed, nonce) => {
+ let hash = getServerSeedHash(serverSeed, clientSeed, nonce);
+ let roll = parseInt(hash.substr(0, 8), 16);
+ let result = roll % 10000;
+
+
+ return result;
+
+ };
+
+ verifyBetPrimeDice = (serverSeed, clientSeed, nonce) => {
+ let hash = getServerSeedHashPrimeDice(serverSeed, clientSeed, nonce);
+ let roll = parseInt(hash.substr(0, 8), 16);
+ let result = roll % 10000;
+
+ return result;
+
+ };
+
+ verifyBetCryptoGames = (serverSeed, clientSeed, nonce) => {
+ let hash = getServerSeedHashCryptoGames(serverSeed, clientSeed, nonce);
+ let roll = parseInt(hash.substr(0, 8), 16);
+ let result = roll % 10000;
+
+ return result;
+
+ };
+
+
+
+ processBets = () => {
+ let betData = getBetData();
+ let numberBetsVerFailed = 0;
+ let isNonceManipulated = false;
+ betData.forEach((element) => {
+ let hash = getServerSeedHash(this.state.serverSeed, element.clientSeed, element.nonce);
+ let roll = parseInt(hash.substr(0, 8), 16);
+ let result = roll % 10000;
+ element.isVerified = result < element.target;
+ if (!element.isVerified) {
+ numberBetsVerFailed++;
+ }
+
+ if (element.nonce !== this.state.nonce) {
+ isNonceManipulated = true;
+ }
+
+ });
+
+
+ this.setState({ betData, numberBetsVerFailed, isNonceManipulated });
+
+ };
+
+ processBetsStake = () => {
+
+ let betData = getBetDataStake();
+
+
+
+ let numberBetsVerFailed = 0;
+
+
+ let isNonceManipulated = false;
+
+ betData.forEach((element) => {
+ let hash = getServerSeedHash(this.state.serverSeed, element.clientSeed, element.nonce);
+ let roll = parseInt(hash.substr(0, 8), 16);
+ let result = roll % 10000;
+
+ element.isVerified = result < element.target;
+
+ if (!element.isVerified) {
+ numberBetsVerFailed++;
+ }
+
+
+
+ if (element.nonce !== this.state.nonce) {
+
+ isNonceManipulated = true;
+ }
+
+ });
+
+ this.setState({ betData, numberBetsVerFailed, isNonceManipulated });
+
+
+
+ };
+
+
+
+
+ processBetsPrimeDice = () => {
+ let betData = getBetDataPrimeDice();
+ let numberBetsVerFailed = 0;
+ let isNonceManipulated = false;
+ betData.forEach((element) => {
+ let hash = getServerSeedHashPrimeDice(this.state.serverSeed, element.clientSeed, element.nonce);
+ let roll = parseInt(hash.substr(0, 8), 16);
+
+ let result = roll % 10000;
+
+ element.isVerified = result < element.target;
+
+
+
+ if (!element.isVerified) {
+ numberBetsVerFailed++;
+
+ }
+
+ if (element.nonce !== this.state.nonce) {
+ isNonceManipulated = true;
+ }
+
+
+ });
+
+ this.setState({ betData, numberBetsVerFailed, isNonceManipulated });
+
+ };
+
+ processBetsCryptoGames = () => {
+ let betData = getBetDataCryptoGames();
+ let numberBetsVerFailed = 0;
+ let isNonceManipulated = false;
+ betData.forEach((element) => {
+ let hash = getServerSeedHashCryptoGames(this.state.serverSeed, element.clientSeed, element.nonce);
+ let roll = parseInt(hash.substr(0, 8), 16);
+ let result = roll % 10000;
+ element.isVerified = result < element.target;
+ if (!element.isVerified) {
+ numberBetsVerFailed++;
+ }
+
+ if (element.nonce !== this.state.nonce) {
+ isNonceManipulated = true;
+ }
+
+ });
+
+
+ this.setState({ betData, numberBetsVerFailed, isNonceManipulated });
+
+ };
+
+ getServerSeed = (apiKey) => {
+ let serverSeed = getServerSeed(apiKey);
+ this.setState({ serverSeed });
+ };
+
+ getServerSeedPrimeDice = (apiKey) => {
+ let serverSeed = getServerSeedPrimeDice(apiKey);
+ this.setState({ serverSeed });
+ };
+
+ getServerSeedCryptoGames = (apiKey) => {
+ let serverSeed = getServerSeedCryptoGames(apiKey);
+ this.setState({ serverSeed });
+ };
+
+ hideAlertConfirm = () => {
+ this.setState({ showAlert: false });
+ };
+
+
+ render() {
+ const { verification, betData, numberBetsVerFailed, isNonceManipulated, diceVerify, verify, showAlert, serverSeed, clientSeed, nonce, cryptoGames, primeDice, apiKey } = this.state;
+
+ return (
+
+
+
+<>
Nonce
@@ -49,10 +289,9 @@
{item.element.isVerified
? Success
- : Failed
- }
+ : Failed}
|
-
+ ;
})}
@@ -88,9 +327,8 @@
{(item.element.game === 'baccarat' || item.element.game === 'hilo' || item.element.game === 'blackjack' || item.element.game === 'diamondPoker' || item.element.game === 'videoPoker' || item.element.game === 'mines' || item.element.game === 'keno' || item.element.game === 'plinko')
?
- : item.element.isVerified
- }
+ } } title="Results">
+ : item.element.isVerified}
{showAlert &&
{
return
- |
+ ;
})}
- )
+ );
})}
@@ -129,7 +367,7 @@
);
})}
- )
+ );
})}
@@ -140,32 +378,29 @@
})}
}
-
+ ;
})}
-
-
-
-