Can't call function of contact with abi instance on fuels 0.54.0

Hi guys!

I have created instance of oracle smart contract that and want to call fn get_price but keep getting error like this:

Oracle code : https://github.com/compolabs/sway-lend/blob/master/contracts/oracle/src/main.sw
Oracle abi : https://github.com/compolabs/sway-lend/blob/master/frontend/src/contracts/OracleAbi.d.ts
Node url : https://beta-4.fuel.network/graphql
Fuels: 0.54.0

 const oracleContract = OracleAbi__factory.connect(
        priceOracle,
        new Provider(NODE_URL)
      );

const response = await oracleContract.functions
        .get_price(
          "0xa715086b6bb8c944ba370c78e7ca38c35ec5c0f758fb2b57be11fdae23988600"
        )
        .simulate();

Found solution
I had to provide wallet instance with seed phrase that has ETH on account, otherwise dryRun doesn’t work on account without ETH on balance. Is it feature or bug?

details are here: https://github.com/PaulZhemanov/fuel-counter-contract/blob/dry-run-without-balance-problem/frontend/src/App.tsx

1 Like

Hi there!
Taken from fuels-ts docs

Note: Although a simulate() call won't modify the blockchain's state and does not spend resources, the transaction must still meet its requirements to be considered valid.

So it seems like a feature.

Actually, this is a bug — follow-up issue here:

The reason it was indirectly fixed by adding the Wallet instance is probably due to the resulting increased latency in the code execution, which created an opportunity for the initialization to finish.

1 Like