Open miguelmota opened 5 years ago
Hey @miguelmota, thanks so much for the comments!! Indeed, the zos
CLI programmatic interface needs more love. Our intent was for zos-lib
to be the programmatic way to use it, but it does lack integration with the zos.json
files that the CLI handles.
We will implement the changes you suggest here, and at the same time go back to the whiteboard to re-think the programmatic API. Expect some news on this in about 1 month from now, when we will probably be sharing a draft and asking for feedback!
I'm currently using zos as a library instead of the CLI and ran into some problems.
My primary requirements are to use
zos.scripts.querySignedDeployment
for generating the deterministic contract address andzos.scripts.create
to deploy the contracts.The first issue was not being able to set a custom truffle.js path for zos config.
In
packages/cli/src/models/config/TruffleConfig.ts
, needed to addworkingDirectory
to truffle's detect method:The second issue was that zos'
.session
file lookup was hardcoded to check the current directory. This wouldn't work since I'm using zos in a module that module is being imported in a different package.In
packages/cli/src/models/network/Session.ts
, added an environment variable check as a quick cheap workaround since I don't know my way around the code but the best way would be to add a method to set the session path.The other problem was that truffle's
.search()
would return null and throw and error. Inpackages/cli/src/models/config/TruffleConfig.ts
, had to change the following:The last problem was initializing the configuration which wasn't trivial and there's most likely a better way:
I know that zos wasn't intended to be used as a library just yet but let me know your thoughts and if there's better way of doings things I should be doing instead. Thanks!