Cannot read property ‘then’ of undefined

I want to send eth from one address to another. After executing the code, Cannot read property ‘then’ of undefined error appears, how to fix? Thanks in advance const Web3 = require(‘web3’) const Tx = require(‘ethereumjs-tx’).Transaction const web3 = new Web3(new Web3.providers.HttpProvider(‘https://mainnet.infura.io/‘)) const addressFrom = ‘addr1’ const privateKey = Buffer.from(‘key’, ‘hex’) const addressTo = ‘addr2’…

How to recover a signature on the server side?

I need to verify the signer of a signature in my node server. const fortmaticApiKey = ‘pk_live_…’; const checkPersonalSignature = async (data, signature, signer) => { try { const { get } = configure(); const fm = new Fortmatic(fortmaticApiKey); const web3 = new Web3(fm.getProvider()); const calculatedSigner = web3.eth.personal.ecRecover(data, signature); return calculatedSigner === signer; } catch…

What is the ethersjs equivalent of `methods.myMethod.call` in web3js?

web3.js has the ability to call non-constant function and get the return data without sending a transaction: myContract.methods.myMethod([param1[, param2[, …]]]).call(options[, callback]) ethersjs apparently does not have this ability. These docs state: These methods cannot return their result to the caller. Using etherjs, how can I get the return data of a transaction without making the…