'can't call function on smart contract from front end - ABI runtime object doesn't reflect ABI file
The issue I'm having is the functions on the contract object created does not match the ABI
ABI:
"inputs": [
{
"internalType": "address",
"name": "nftContract",
"type": "address"
},
{
"internalType": "uint256",
"name": "itemId",
"type": "uint256"
},
{
"internalType": "address",
"name": "propertyTokenContract",
"type": "address"
},
{
"internalType": "bool",
"name": "isPaymentTokens",
"type": "bool"
}
],
"name": "createPropertySale",
"outputs": [],
"stateMutability": "payable",
"type": "function"
As can see below, the createPropertySale function signature is different to the ABI and as a result I get an error saying too many arguments as in the ABI, the number of params is 4 yet here it is 2. There are other functions which don't match the ABI also
I have deleted the artifacts folder, recompiled and each time the ABI looks ok, but in the browser, the contract object created does not reflect the ABI
Hardhat config:
solidity: {
version: '0.8.4',
settings: {
//optimizer: {enabled: process.env.DEBUG ? false : true},
optimizer: {
runs: 1000,
enabled: true
}
}
},
dependencies:
"dependencies": {
"@nomiclabs/hardhat-ethers": "^2.0.4",
"@nomiclabs/hardhat-waffle": "^2.0.1",
"@openzeppelin/contracts": "^4.5.0",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^12.0.0",
"@testing-library/user-event": "^13.2.1",
"abdk-libraries-solidity": "^3.0.0",
"axios": "^0.24.0",
"chai": "^4.3.4",
"ethereum-waffle": "^3.4.0",
"ethers": "^5.6.1",
"hardhat": "^2.8.2",
"ipfs-http-client": "^55.0.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^6.2.1",
"react-scripts": "5.0.0",
"solc": "^0.8.12",
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

