This repository was archived by the owner on Aug 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 40
Read-Only Method is Sending a Transaction #309
Copy link
Copy link
Open
Description
The problem is that the call to "totalFunctions()" sends a transaction. But totalFunctions() is a read-only method on the contract.
I can't call any read-only methods. The culprit might be etherlime.ContractAt because that is what I need to use to access a contract and call its methods.
Using etherlime 2.2.6.
Here is my code:
const etherlime = require('etherlime-lib');
const DiamondExample = require('../build/DiamondExample.json');
const DiamondFacet = require('../build/DiamondFacet.json');
describe('DiamondExampleTest', () => {
let aliceAccount = accounts[3];
let deployer;
let diamondFacet;
before(async () => {
deployer = new etherlime.EtherlimeGanacheDeployer(aliceAccount.secretKey);
const diamondExample = await deployer.deploy(DiamondExample);
console.log(diamondExample.contractAddress);
diamondFacet = await etherlime.ContractAt(DiamondFacet, diamondExample.contractAddress);
});
it('should get all the facets and functions of the contract', async () => {
let total = await diamondFacet.totalFunctions();
console.log(total); // We get transactions details instead of expected return value
});
});Here is the abi for the totalFunctions() function:
{
"inputs": [],
"name": "totalFunctions",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels