soroban-cli icon indicating copy to clipboard operation
soroban-cli copied to clipboard

soroban-cli: Very difficult to diagnose what is wrong if you miss `--network` or `--source`

Open paulbellamy opened this issue 2 years ago • 3 comments
trafficstars

If you simply type soroban contract invoke --id ... it is almost impossible to tell why it fails. First you need a --network (but the error doesn't tell you that). Then you also need a --source (but the error doesn't tell you that either).

We should: a. Output relevant errors for these b. Have default network and source settings so you don't need to type them at all in the "normal" case.

paulbellamy avatar Apr 04 '23 08:04 paulbellamy

You can use ENV for both source and network. If you don't provide the network your local ledger is used. If you don't include source the default test seed is used to generate a seed phrase.

What error are you getting?

willemneal avatar Apr 04 '23 13:04 willemneal

$ soroban contract invoke --id $TOKEN_ID -- --help
error: parsing contract spec: contract spec not found

$ soroban contract invoke --network standalone --id $TOKEN_ID -- --help
error: jsonrpc error: RPC call failed: ErrorObject { code: InvalidRequest, message: "not found (at ledger 75)", data: None }

paulbellamy avatar Apr 04 '23 14:04 paulbellamy

Yeah but those would both work if the contract was deployed to the corresponding environments. So should we add more context to these errors to suggest that the issue is that the contract hasn't been deployed?

willemneal avatar Apr 04 '23 17:04 willemneal