Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

203
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!