A problem when the front-end calls the contract: Cannot read properties of undefined (reading 'name')

Connecting to the Fuel wallet via Fuels on the frontend, creating a contract with const contract = new Contract(contractId, abi, wallet), and calling the contract with:

javascript

await contract.functions
  .increment()
  .callParams({
    forward: [amount, assetId]
  })
  .txParams({
    gasPrice: 1,
    gasLimit: 1000_000
  })
.call()

results in the following error:

perl

Cannot read properties of undefined (reading 'name')
TypeError: Cannot read properties of undefined (reading 'name')
    at eval (webpack-internal:///./node_modules/@fuel-ts/account/dist/index.mjs:1834:37)
    at Array.forEach (<anonymous>)
    at normalize (webpack-internal:///./node_modules/@fuel-ts/account/dist/index.mjs:1833:23)
    at eval (webpack-internal:///./node_modules/@fuel-ts/account/dist/index.mjs:1848:23)
    at Array.forEach (<anonymous>)
    at normalize (webpack-internal:///./node_modules/@fuel-ts/account/dist/index.mjs:1833:23)
    at normalizeJSON (webpack-internal:///./node_modules/@fuel-ts/account/dist/index.mjs:1857:10)
    at ScriptTransactionRequest.toJSON (webpack-internal:///./node_modules/@fuel-ts/account/dist/index.mjs:2483:12)
    at JSON.stringify (<anonymous>)
    at R.sendTransaction (webpack-internal:///./node_modules/@fuels/connectors/dist/index.mjs:15:25825)

Calling the contract with .call() causes this error to appear.

2 Likes

can you please share a couple of information first?

  • an output for the fuelup show command?
  • what ts SDK version are you using?
  • what version of fuel wallet are you using?
1 Like

“fuels”: “^0.89.2”
chrome extensions Fuel Wallet 0.22.0

I use vue on the front end and call() of the contract method. I want Chrome to pop up the fuel wallet extension, but an error is reported.

Cannot read properties of undefined (reading ‘name’)
TypeError: Cannot read properties of undefined (reading ‘name’)

It should be that the browser wallet has not been unlocked.

1 Like

can you share your repo to replicate

yeah, it’d be helpful if we could have a look at the repo. also, would you mind sharing the output for the command fuelup show as well?