0

i have got code like following; when i call that code, my metamask is locking and didn't respond.

what can you suggest? thank you

 var MyContractToken = new web3.eth.Contract(abiToken,'0x76990B2c222ae4A80D98C6402406616DBFD306b9');
 var MyContractLock = new web3.eth.Contract(abiLock,'0xA21170e12c7BB98477a14bE0D0F607929609dcb0');

 var encodedToken = await MyContractToken.methods.approve("0xA21170e12c7BB98477a14bE0D0F607929609dcb0",9).encodeABI();
 let _paramsToken = {
  data: encodedToken,
  from:ethereum.selectedAddress
}

var encodedLock = await MyContractLock.methods.lock(9).encodeABI();
 let _paramsLock = {
  data: encodedLock,
  from:ethereum.selectedAddress
}

  await ethereum.request({
    method: 'eth_sendTransaction',
    params:[_paramsToken,_paramsLock]
  })
  .then(_result => {
  
    console.log("success",_result);
  })  
  .catch((error) => {
    console.log("error",error);
  });
2
  • The params seems to be wrong. Did you try sending only one transaction? Also the transaction are missing to. See the syntax here eth.wiki/json-rpc/API#eth_sendtransaction.
    – Ismael
    May 20 at 5:25
  • i have tried and failed, besides i can make transactions with parameters... May 20 at 7:01

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.