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

84
Visualizações
Interacting with a smart contract method via metamask mint transaction in web3js

I am trying to call a mint function on an ethereum smart contract. When the user clicks the mint button, metamask should open up pointing to the mint method with the correct price and number of mints, and then return a transaction.

However, I am confused as to how this transaction is properly translated towards the smart contract. Also, the price of this is coming out as 0E (should be 0.5E), and frankly I have no idea how to interpret the transaction hash I get out the other side.

The contract for this is here: https://rinkeby.etherscan.io/address/0xeaf59acf00435857d4d0e26e2b48948b86a8a8ca#code

The code for this is below:

  const onPurchase = async () => {
    const transactionParameters = {
      gasPrice: '0x09184e72a000',
      gas: '0x2710',
      to: '0xd46e8dd67c5d32be8058bb8eb970870f07244567',
      from: '0x010bc28dE2E080E233cA98Bc2D03B22D5CA8eD41',
      value: '0x9184e72a',
      data: '0xa0712d680000000000000000000000000000000000000000000000000000000000000001',
    };
    const txHash = await window.ethereum.request({
      method: 'eth_sendTransaction',
      params: [transactionParameters],
    });
  }

and the ABI for the mint function looks like so:

  {
    "inputs": [
      {
        "internalType": "uint256",
        "name": "numberOfTokensMax5",
        "type": "uint256"
      }
    ],
    "name": "mint",
    "outputs": [],
    "stateMutability": "payable",
    "type": "function"
  },
about 4 years ago · Juan Pablo Isaza
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