Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

204
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda