Files
crypto_clash/config.json
averel10 7f1143eb22 Implement timeout handling and commit resolution in Commit and Reveal components
- Added state management for opponent's move and commit time left in Commit component.
- Implemented automatic checks for opponent's move and commit timeout.
- Introduced timeout resolution functionality allowing players to claim victory if the opponent fails to commit in time.
- Updated UI to display timeout results and allow players to resolve timeouts.
- Enhanced Reveal component with timeout checks and resolution logic.
- Added necessary contract methods in config.json for commit time left and timeout resolution.
2025-11-22 10:58:49 +01:00

389 lines
11 KiB
JSON

{
"API_URL": "http://185.48.228.49:8545",
"CONTRACT_ADDRESS": "0x6da7dE8330EF1ff087C66e61Aa87FbC29E9b2869",
"ABI": [
{
"inputs": [
{
"internalType": "string",
"name": "initMessage",
"type": "string"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "string",
"name": "oldStr",
"type": "string"
},
{
"indexed": false,
"internalType": "string",
"name": "newStr",
"type": "string"
}
],
"name": "UpdatedMessages",
"type": "event"
},
{
"inputs": [],
"name": "message",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "newMessage",
"type": "string"
}
],
"name": "update",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
],
"GAME_CONTRACT_ADDRESS": "0x7C56Fd34374F0244402aDDf5E940490C1a53E92E",
"GAME_ABI": [
{
"inputs": [],
"name": "BET_MIN",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "COMMIT_TIMEOUT",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "REVEAL_TIMEOUT",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "gameId",
"type": "uint256"
}
],
"name": "commitTimeLeft",
"outputs": [
{
"internalType": "int256",
"name": "",
"type": "int256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getActiveGameIds",
"outputs": [
{
"internalType": "uint256[]",
"name": "",
"type": "uint256[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getContractBalance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "gameId",
"type": "uint256"
}
],
"name": "getGameDetails",
"outputs": [
{
"components": [
{
"internalType": "address payable",
"name": "addr",
"type": "address"
},
{
"internalType": "uint256",
"name": "bet",
"type": "uint256"
},
{
"internalType": "bytes32",
"name": "encrMove",
"type": "bytes32"
},
{
"internalType": "enum Game.Moves",
"name": "move",
"type": "uint8"
},
{
"internalType": "string",
"name": "nickname",
"type": "string"
}
],
"internalType": "struct Game.Player",
"name": "playerA",
"type": "tuple"
},
{
"components": [
{
"internalType": "address payable",
"name": "addr",
"type": "address"
},
{
"internalType": "uint256",
"name": "bet",
"type": "uint256"
},
{
"internalType": "bytes32",
"name": "encrMove",
"type": "bytes32"
},
{
"internalType": "enum Game.Moves",
"name": "move",
"type": "uint8"
},
{
"internalType": "string",
"name": "nickname",
"type": "string"
}
],
"internalType": "struct Game.Player",
"name": "playerB",
"type": "tuple"
},
{
"internalType": "uint256",
"name": "initialBet",
"type": "uint256"
},
{
"internalType": "enum Game.Outcomes",
"name": "outcome",
"type": "uint8"
},
{
"internalType": "bool",
"name": "isActive",
"type": "bool"
},
{
"internalType": "uint256",
"name": "returnGameId",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "gameId",
"type": "uint256"
}
],
"name": "getOutcome",
"outputs": [
{
"internalType": "enum Game.Outcomes",
"name": "",
"type": "uint8"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "gameId",
"type": "uint256"
},
{
"internalType": "bytes32",
"name": "encrMove",
"type": "bytes32"
}
],
"name": "play",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "gameId",
"type": "uint256"
}
],
"name": "register",
"outputs": [
{
"internalType": "uint256",
"name": "playerId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "returnGameId",
"type": "uint256"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "gameId",
"type": "uint256"
}
],
"name": "resolveTimeout",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "gameId",
"type": "uint256"
},
{
"internalType": "string",
"name": "clearMove",
"type": "string"
}
],
"name": "reveal",
"outputs": [
{
"internalType": "enum Game.Moves",
"name": "",
"type": "uint8"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "gameId",
"type": "uint256"
}
],
"name": "revealTimeLeft",
"outputs": [
{
"internalType": "int256",
"name": "",
"type": "int256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "gameId",
"type": "uint256"
}
],
"name": "whoAmI",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
}
]
}