Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

205
Visualizações
How can I interact with payable functions on frontend?

This is my code, I have problem on calling the function from frontend, how can I make function in JS which can interact with my function in smartcontrat?

   function placeBet(uint8 matchID, string memory bettingType, uint8 oddForWinning) override external payable MBet {
    require(keccak256(abi.encodePacked(bettingType)) == keccak256(abi.encodePacked("Tie")) || keccak256(abi.encodePacked(bettingType)) == keccak256(abi.encodePacked("Team A")) || keccak256(abi.encodePacked(bettingType)) == keccak256(abi.encodePacked("Team B")), "Betting type must be 'Team A' or 'Team B' or 'Tie'");
    bets[msg.sender] = Bet(matchID, bettingType, oddForWinning, msg.value);

    players.push(msg.sender);
  
    string memory b = "Bet received!";
    emit UpdatedBet(msg.sender ,b);

}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The right way to interact with a Smart Contract is via an API. You can then expose the functions of the smart contract via API endpoints (GET/PUT/POST etc).

The right tools to help you achieve that are: Web3.js, Trufflesuite and Ethairballoons.

Then, from the front-end part of your application, you can easily call the API services through which you expose the smart-contract functionality.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda