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

fix(cli): allow to use ipfs:// on all commands (that make sense) #1594

Merged
merged 12 commits into from
Dec 14, 2024

Conversation

mjlescano
Copy link
Member

@mjlescano mjlescano commented Dec 12, 2024

This PR makes the getPackageInfo fn to try and parse the given package reference, or, if an ipfsHash/Url is given, it will try to download it and get the fullPackageReference. Also, the chainId it will be taken by the users param --chain-id, the package content, the given --rpc-url provider, or lastly it will prompt the user to add it.

This functionality was added to the following commands:

  • verify
  • diff
  • publish
  • unpublish
  • inspect
  • trace (now we can trace from ipfs hash also 🙌)
  • decode
  • interact

There's a special case for the following commands that a correct packageReference is required, and not an ipfs ref. This is now being correctly parsed and if needed the user is prompted for a chainId

  • fetch

Another special case is on the contrary, when only an ipfsUrl is allowed, but now we are improving the validation:

  • pin

Extras

  1. Added a new packages/cli/.env.test file to be able to configure env vars for e2e tests

Copy link

changeset-bot bot commented Dec 12, 2024

⚠️ No Changeset found

Latest commit: abd4205

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@@ -549,7 +547,6 @@ export const commandsConfig: CommandsConfig = {
{
flags: '-c --chain-id <chainId>',
description: 'Chain ID of the variant to inspect',
defaultValue: '13370',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On inspect command, is better to ask the user for a chainId

@@ -16,8 +16,6 @@ export const applyCommandsConfig = (command: Command, config: CommandConfig) =>
config.arguments.map((argument: any) => {
if (argument.flags === '<packageRefs...>') {
command.argument(argument.flags, argument.description, parsePackagesArguments, argument.defaultValue);
} else if (command.name() === 'interact' && argument.flags === '<packageRef>') {
command.argument(argument.flags, argument.description, parsePackageArguments, argument.defaultValue);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small refactor, as the parsePackageArguments is intended for parsing settings, but in interact we don't need to parse settings.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleting this test as it is really testing almost nothing. And also we have a proper e2e test that already covers this case.

@@ -1,8 +1,6 @@
{
"publishIpfsUrl": "https://us-east.repo.usecannon.com",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new repo should work better!

"rpcUrl": "http://127.0.0.1:9545",
"privateKey": "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
"registryRpcUrl": "http://127.0.0.1:9545",
"etherscanApiUrl": "https://api.etherscan.io/api",
"etherscanApiKey": "A7PNIZCEI2HDRUTDJBWS36XBGIB7Q74YMK"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing pasted key 👮‍♂️

@mjlescano mjlescano changed the title fix(cli): allow to use ipfs:// and all commands (that make sense) fix(cli): allow to use ipfs:// on all commands (that make sense) Dec 13, 2024
@mjlescano
Copy link
Member Author

Merging as I got in-chat approval both from @saeta-eth and @dbeal-eth

@mjlescano mjlescano merged commit 9db1277 into dev Dec 14, 2024
8 of 9 checks passed
@mjlescano mjlescano deleted the fix-ipfs-fetch branch December 14, 2024 05:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants