Skip to content

forc call with --wallet parameter bugs #7316

@zees-dev

Description

@zees-dev

Description

forc call with --wallet parameter fails because the wallet has no base assets (0 balance), even for read-only function calls.

Steps to Reproduce

  1. Deploy a minimal Sway contract
  2. Run forc call without --wallet - works
  3. Run forc call with --wallet - fails

Example Contract

contract;

abi Demo {
    fn get_count() -> u64;
}

impl Demo for Contract {
    fn get_count() -> u64 {
        5
    }
}

Commands

Working command (without wallet - uses default signer - which has funds..):

forc call --abi ./out/release/demo-abi.json $CONTRACT_ADDRESS get_count

Failing command (with wallet):

forc call --abi ./out/release/demo-abi.json $CONTRACT_ADDRESS get_count --wallet

Error Output

thread 'main' panicked at /Users/runner/work/sway/sway/forc-plugins/forc-client/src/op/call/missing_contracts.rs:32:10:
Failed to build transaction: Provider("failed to adjust inputs to cover for missing base asset: failed to get base asset (f8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07) inputs with amount: `1`: io error: Response errors; the target cannot be met due to insufficient coins available for f8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07. Collected: 0.")
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Expected behaviour

  • The wallet parameter should not error/panic in the default dry-run mode - since funds are not required for read-only function calls.
  • Error message update: The current error is cryptic. It should clearly state: "Wallet has insufficient funds. Please fund your wallet with base asset ()."
    • This is for simulation and/or live-mode - where user funds should be taken into account.

Metadata

Metadata

Assignees

Labels

forc-callEverything related to the `forc-call` plugin in `forc-client` packagegood first issueGood for newcomersteam:toolingTooling Team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions