I'm trying to call a contract method from web3js. The contract is deployed in a local ganache. This is my full code
// Instantiate contract
const provider = new Web3.providers.HttpProvider("http://127.0.0.1:7545");
const web3 = new Web3(provider);
const contract = new web3.eth.Contract(conf.contract.abi, "0x7167868c5e3161D9e6D0d8be564F05a432B02F5e", { gasPrice: 1, gas: 4500000 });
// Import account and add to wallet
const account = web3.eth.accounts.privateKeyToAccount("0xa415318b6ead0170a5dab11bcdc58d4bdbf7fdcbbdb7af19f85f5da985df1d13");
// console.log(account.address) >> "0xa9C0540014C4D53E783aA94a0aE17a90b02eAe51"
web3.eth.accounts.wallet.add(account);
// Estimate gas
var estimatedGas = await contract.methods.createRecord().estimateGas({ from: account.address });
// console.log(estimatedGas) >> 26328
// Call contract method: ERROR
var result = await contract.methods.createRecord().send({ from: account.address, gas: estimatedGas });
The last line raises this error
TypeError: Cannot create property 'from' on string '0xf90247800182fbd8947167868c5e3161d9e6d0d8be564f05a432b02f5e80b901e45170f1fa00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000000b736572766572312e636f6d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007312e302e302e310000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000093137322e302e302e31000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000074d4143303030310000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020111000000000000000000000000000000000000000000000000000000000000822d45a042ba0d363180c9ca85a10fe919536909e2ca78f0e5dd3409c43db902c85ac09ba024c54001ace92edf9438fc91cbef70b7caf5aeba68f8048b39a1018c3fc47fe5'
at Object.inputTransactionFormatter (d:\...\node_modules\web3-core-helpers\dist\web3-core-helpers.cjs.js:78:21)
at SendContractMethod.beforeExecution (d:\...\node_modules\web3-core-method\dist\web3-core-method.cjs.js:1075:44)
at SendContractMethod.execute (d:\...\node_modules\web3-core-method\dist\web3-core-method.cjs.js:1006:12)
at d:\...\node_modules\web3-core-method\dist\web3-core-method.cjs.js:1100:85
at process._tickCallback (internal/process/next_tick.js:68:7)
Any clue about the error? I've got very similar code running ok in other projects, but here there seems to be something wrong and I can't find it.
Thanks