onflow / flowkit

Apache License 2.0
6 stars 9 forks source link

[BUG] contract alias contains nonexisting network previewnet #63

Open bartolomej opened 3 weeks ago

bartolomej commented 3 weeks ago

Current Behavior

flowkit.Load function returns a contract {ContractName} alias contains nonexisting network previewnet error when these conditions are met:

This happens because when flowkit automatically populates missing contracts from dependency list, it uses all supported networks for core contracts: https://github.com/onflow/flowkit/blob/52f00d694be51f8bb1190ee380e6b02f68bfba9d/config/contract.go#L170

This is a regression since: https://github.com/onflow/flowkit/pull/55

Expected Behavior

This error was quite confusing to me, as my flow.json didn't have any mention of "previewnet", so I wasn't sure what's going on.

I would expect the flowkit logic to automatically add "previewnet" in the internal networks config struct in cases like these, instead of requiring the dev to do so.

Steps To Reproduce

  1. Clone https://github.com/onflowser/flow-wasm at this commit: https://github.com/onflowser/flow-wasm/commit/c4b2747f8eb9732f94def7913a3568d28773304a
  2. Run ./build.sh to generate flow.wasm
  3. Open index.html and check developer console

Environment

Note that this does not happen in the released version! This issue can be reproduced in the latest unreleased code since the commit: https://github.com/onflow/flowkit/commit/cc49f8310c70dfd47614c604288b47990e9a18b4

What are you currently working on that this is blocking?

I'm playing around with building a revamped web-based playground and have started testing with example scaffold projects (e.g. https://github.com/onflowser/flow-nft-scaffold). This was proposed in the grant: https://github.com/onflow/developer-grants/issues/260.

gregsantos commented 3 weeks ago

Thanks @bartolomej for the flag