0

I am developing a dApp that is parsing an ABI and then it shows the functions of it and fields that is for every function's variable and i want to send the function with its variables to MetaMask to make the transaction.

I think that the problem is that the function when i take it and put it in the variable fntype is not being recognized as function.

I have a totally JS, web3.js client-side web dApp.

const fntype = document.getElementById("function-name").value;
var counter = $('.validate').length
var NumOfValidates = counter-1;
  //A JS array that it will be filled with all the inputs the user give for each function's variable in order
var variables = [];
var id = 0;
for (var i = 0; i < NumOfValidates; ++i) {
    id = id+1;
    variables.push(document.getElementById("i"+id).value);
    console.log("variable["+i+"] = "+variables[i]);  
 }

//SendToMetaMask

 miniToken.fntype(variables[1],{ from: address, value: '0'})

 .then(function (txHash) {
    console.log('Transaction sent')
    console.dir(txHash)
    waitForTxToBeMined(txHash)
})

Expected: Pass the function to MetaMask to complete the transaction

Actual: I get the following error

Uncaught TypeError: Cannot read property 'fntype' of undefined

at senddata2 (script.js:234)

at HTMLAnchorElement.onclick ((index):110)

senddata2 @ script.js:234

onclick @ (index):110

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.