Both can initiate a send transaction but the actual function is not called. Is the format of my call wrong? Or is MetaMask that has not the 681 implementation for the calldata? Thank you.
Contract address is the correct, deployed on 43113 avalanche fuji testnet. The app is picking up the url but when sending the tx it has difficulties calculating the correct gas amount and gives JSON-RPC error.
The error message is very simple: Transaction error Internal JSON-RPC error. I tried changing also the RPC endpoint and I get the same error.
Im not sure how to see error logs / stack traces, but if you add the Fuji testnet network with some gas you can try the transaction, which it may possibly be an actual correct txn that goes through by scanning the QR (the data in the QR is the Deep Link String mentioned before):
I’m working in java, and I’m using the zxing library. The QR code you see is generated in Brave Browser using “QR code ”. I did a quick look at the SDK, but I don’t see any methods to generate a EIP-681 QR or a more general string QR.
The function BetGame is a custom function of my contract, here’s the full implementation:
/**
* BetGame accetps and registers a player's game bet
*/
function BetGame(bytes32 gameId, bytes32 playerId) external payable minBet returns (bool) {
address caller = _msgSender();
uint256 betAmount = msg.value;
// if firts game make him start it
if (!getActiveGame(gameId)) {
emit GameStarted(gameId, playerId, caller, betAmount, block.timestamp);
}
// Already in
if (playerAddress[playerId] != address(0)) {
revert BetAlreadyPlaced(caller, playerGameBalance[playerId][caller]);
}
gamePlayersIds[gameId].push(playerId);
gameBalance[gameId] += betAmount;
playerAddress[playerId] = caller;
playerGameBalance[playerId][caller] = betAmount;
emit PlayerBet(gameId, playerId, caller, betAmount, block.timestamp);
return true;
}
/**
* getActiveGame reutrns true is a game is active
*/
function getActiveGame(bytes32 gameId) public view returns (bool) {
if (gamePlayersIds[gameId].length > 0) {
return true;
}
return false;
}