onflow / flow-cli

The Flow CLI is a command-line interface that provides useful utilities for building Flow applications
https://onflow.org
Apache License 2.0
207 stars 66 forks source link

Automatically add core contracts to flowkit #1275

Open jribbink opened 9 months ago

jribbink commented 9 months ago

Issue To Be Solved

Since core contracts are guaranteed to be available by the FVM, it would be useful to have these automatically be recognized by flowkit/added to the state.

For packages depending on flowkit & using the state to resolve imports (i.e. Flow CLI, Cadence Language Server), they would be able to resolve these contracts via the new import syntax (i.e. import "MetadataViews")

(Optional): Suggest A Solution

Add the contracts with their aliases to Contracts() in the flowkit state by default.

Pros

Cons (most of the cons are related to potentially obfuscating the underlying source code)

This may also be solved/greatly simplified by contract manager and this issue could become obsolete (see https://github.com/onflow/flow-cli/issues/929)

bjartek commented 9 months ago

What are the core contracts in this definition. I would treat contracts that every developer are likely to interface against differntly. Th LS snd tools needs to be able to know about these. Like NFT/FT and the view stuff.

Also as long as there is a way to see the effective state and look at it that is also good.