Skip to content
This repository was archived by the owner on Aug 5, 2021. It is now read-only.
This repository was archived by the owner on Aug 5, 2021. It is now read-only.

Read-Only Method is Sending a Transaction #309

@mudgen

Description

@mudgen

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"
    },

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions