archway-network / cli

Develop WASM smart contracts with the Archway network developer CLI
https://docs.archway.io
Apache License 2.0
44 stars 21 forks source link

fix(contracts): circular imports, cargo file loading #283

Closed eliasmpw closed 1 year ago

eliasmpw commented 1 year ago

Some imports in parameters directory would return undefined because they had circular imports for the arguments and flags index file.

Also there was an unnecessary cargo file/workspace check when the instantiate command recieves the code id directly as an argument.

aelesbao commented 1 year ago

To solve the circular dependency problem, the arguments and flags packages should not call each other. The solution is to move anything any object / interface common to both into a shared folder.

I have a refactoring branch (wip) that solves this issue and a few others with the structure of the flags and args, however I had to deprioritize it for the 2.0.0 release (it will be available in 2.1.0).

Is it possible to change this PR to fix only the instantiate command and wait for the fixes on the other branch, or is there something breaking in the CLI at the moment?

eliasmpw commented 1 year ago

Unfortunately both changes are needed to make the archway contracts instantiate command work with the --code flag, currently the circular dependency makes the command fail, it parses the stdinInput arg incorrectly

eliasmpw commented 1 year ago

Added a unit test to cover this scenario