Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add and install from live networks with dependency manager #1319

Merged
merged 102 commits into from
Jan 26, 2024

Conversation

chasefleming
Copy link
Member

@chasefleming chasefleming commented Dec 21, 2023

Closes #944

Description

Add Command

To run the add command, you can run:

flow dependencies add testnet://0afe396ebc8eee65.FLOAT

or

flow deps add testnet://0afe396ebc8eee65.FLOAT

Install Command

You can also run flow dependencies install if you add the dependencies to your flow.json manually.


For contributor use:

  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work
  • Code follows the standards mentioned here
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

@chasefleming
Copy link
Member Author

I've noticed files in imports don't have .cdc extension, is there a reason?

Good catch. Meant to fix that. Updated.

@chasefleming
Copy link
Member Author

I wrote somewhere that it could be sn idea to. Have a resource we write to the same storage as contracts when we deploy that has some information about related addresses. The most useful one here would be a self relation on another network.

It will be helpful for populating aliases. When it exists, we can add it in.

@chasefleming
Copy link
Member Author

If using add with invalid contract name it doesn't error out, example:

flow deps add mainnet://0x1d7e57aa55817448.NonFungibleToken123

Good catch. Fixed. Should log an error now.

@chasefleming
Copy link
Member Author

What happens if I use a contract that doesn't have aliases for the emulator and then I want to deploy my project using that contract locally? One example to reproduce would be:

flow deps add mainnet://0xb78ef7afa52ff906.SwapError

and then import that swap error contract in my test contract locally and try to deploy to the emulator. That doesn't work right now, I wonder whether it should.

@sideninja Can expand on this? Why would the local version you pulled not deploy to the emulator if you set it in deployments?

@chasefleming
Copy link
Member Author

Docs PR: onflow/docs#524

@chasefleming
Copy link
Member Author

What happens if I use a contract that doesn't have aliases for the emulator and then I want to deploy my project using that contract locally? One example to reproduce would be:

flow deps add mainnet://0xb78ef7afa52ff906.SwapError

and then import that swap error contract in my test contract locally and try to deploy to the emulator. That doesn't work right now, I wonder whether it should.

@sideninja Can expand on this? Why would the local version you pulled not deploy to the emulator if you set it in deployments?

I understand what you're saying now. Yeah it's worth thinking if they should be automatically added to the emulator-account if they are not core contracts. Right now flow config add deployment will still work though. We could add an update later if we decided to add this functionality and someone would just need to run install again.

@bjartek
Copy link
Collaborator

bjartek commented Jan 26, 2024

What about letting ppl chose what account to add them to on emulator

@chasefleming
Copy link
Member Author

What about letting ppl chose what account to add them to on emulator

Yep @bjartek I'm hesitant to make assumptions, which is why flow config add deployment seems like a good option for now. None of the functionality differs from the contracts at the moment. We can add in some nice features to streamline things as people try it out and see how people are using it.

@chasefleming chasefleming merged commit 4c90a9e into master Jan 26, 2024
5 checks passed
@chasefleming chasefleming deleted the chasefleming/contract-manager branch January 26, 2024 01:26
@bjartek
Copy link
Collaborator

bjartek commented Jan 26, 2024

What about letting ppl chose what account to add them to on emulator

Yep @bjartek I'm hesitant to make assumptions, which is why flow config add deployment seems like a good option for now. None of the functionality differs from the contracts at the moment. We can add in some nice features to streamline things as people try it out and see how people are using it.

Just a flag in install could work aswell --emulator-account or something

@chasefleming
Copy link
Member Author

Yeah that would be cool @bjartek . I will open an issue to discuss this as an upcoming feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature A new user feature or a new package API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Install contract dependencies from live Flow networks
7 participants