This is my simple js code (without api). I try to do my first steps with js and web3 and the goal is to fetch data from the OMG network, a very simple task, but for some reason it is not working. I tried to do some variations like with brackets with the methods.name eg.
I am getting the following errors:

TypeError: TestContract.name is not a function


TypeError: Cannot read properties of undefined (reading 'call')

the Code:

const { Web3 } = require('web3'); 

const web3 = new Web3(new Web3.providers.HttpProvider("https://mainnet.infura.io/v3/fa26d14d8e984def8d480be40582be12"));
const address = "0xd26114cd6EE289AccF82350c8d8487fedB8A0C07"
const abi = [

const TestContract = new web3.eth.Contract(abi, address);

async function getTokenName() {
    let tokenName = await TestContract.name().call();


Thanks in advance!

1 Answer 1


According to web3js v1.2.11

let tokenName = await tokenName.methods.name().call({
  from: ‘ownerAddress’ });
  • 1
    The problem is solved. I used one bracket to much in the abi... Commented Sep 19, 2023 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.