0
Error: 
  This is the expression part of an expression statement
  cosnt sendTransaction = async (

I am using ReactJS and following a tutorial, but my code looks the same and can not figure out how to solve this error.

This is my TransactionContext.js

cosnt sendTransaction = async (
    metamask = eth, 
    connectedAccount = currentAccount
) => {
    try {
      if (!metamask) return alert ('Please install metamsk') 
      const { addressTo, amount } = formData
      const transactionContract =  getEthereumContract() 
      
      const parsedAmount = ethers.utils.parseEther(amount)

      await metamask.request({
         method: 'eth_sendTransaction',
         params: [
            {
              from: connectedAccount, 
              to: addressTo,
              gas: '0x7EF40', // 520000 Gwei
              value: parsedAmount._hex,
            },
         ],
      })
dustycar17
  • 27
  • 6

1 Answers1

2

Sorry I could not add a comment, but there is a typo error in your 'const' declaration. You have 'cosnt'.

wally
  • 58
  • 7