I am trying to call a function on a smart contract using web3 and web3-eth-contract but I get the error Provider does not have a request or send method to use.

Here is the general code I am attempting:

const provider = new Web3.providers.HttpProvider(infuraEndpoint);
const web3 = new Web3(provider);
const contract = new Contract(tokenAbi.abi, tokenContractAddress);
        .on('receipt', (res) => {.....

I am clearly missing something about how this works, but I can't figure out what it is. Does anyone have an example of making a call to a function on an ethereum contract from node?

  • 2
    While send returns an event emitter, call doesn't. Commented Dec 24, 2020 at 21:38
  • 1
    If someFun is a constant (pure or view) method, then you don't need to wait for a receipt event. If it is a non-constant method and you want to execute it in a transaction, then you need to use send or similar (sendTransaction, sendSignedTransaction, etc). Commented Dec 24, 2020 at 21:42
  • Ahh, this must be where my mistake is. It's a view method, so what is the proper way of calling it?
    – esastincy
    Commented Dec 25, 2020 at 1:04

1 Answer 1


I'll paste an example from web3 docs for you to take a look


I also think that you need to change new Contract to new web3.eth.Contract if you are using the current version of web3.

  • I get this error: Error: Provider does not have a request or send method to use.
    – esastincy
    Commented Dec 25, 2020 at 1:23
  • Yeah that was it, I was using the wrong Contract class. Thank You!
    – esastincy
    Commented Dec 25, 2020 at 1:28

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.