Skip to content

Conversation

@fnando
Copy link
Member

@fnando fnando commented Aug 28, 2024

What

$ cargo run contract alias ls --global
   Compiling soroban-cli v21.4.1 (/Users/fnando/Projects/stellar/stellar-cli/cmd/soroban-cli)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 3.08s
     Running `target/debug/soroban contract alias list --global`
ℹ️ Aliases available for network 'Test SDF Network ; September 2015'
hello_world: CAXUMKGXAOY6IAO36XJV6DSOQBMBANSUJ6NR5EXIF27ZWNPW7OOTTHPC
increment: CALLOOCCCJRZ6AZAJSKNCTDZ766N4ANVRKRJPHC65KDV7RJCS37PS4XY

ℹ️ Aliases available for network 'Standalone Network ; February 2017'
hello_world: CC47LWR7ZJH2QQTFUUNRERMBPBAUHIVLKHIKACV6VVZEEQJIHJOJNGPL


$ echo $?
0

$ cargo run contract alias ls
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.20s
     Running `target/debug/soroban contract alias list`
⚠️ No aliases defined for network

$ echo $?
1

Why

#1420

Known limitations

N/A

Copy link
Contributor

@willemneal willemneal left a comment

Choose a reason for hiding this comment

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

My one thought is that it would be good to have a way to list all across all networks. Like -l on other list commands.

@fnando
Copy link
Member Author

fnando commented Aug 28, 2024

@willemneal I think that's a good idea (#1420 even mentions it), but I wonder how we can achieve that by using command(flatten). 🤔

I tried to make it work, but failed to make everything work.

@ifropc
Copy link
Contributor

ifropc commented Aug 28, 2024

As an idea we can add list --all that conflicts with --network
The only thing is that our current flags are already pretty complicated, not sure if it makes sense to complicate it even further

@fnando
Copy link
Member Author

fnando commented Aug 28, 2024

@ifropc I did that, but network options are required, and simply using Option<network::Args> doesn't work (it complains about #[group(skip)], and even without it doesn't work).

@ifropc
Copy link
Contributor

ifropc commented Aug 28, 2024

Yeah, I was looking into groups, unfortunately we can't make it work easily while using derive API, this is a known issue in clap (and I don't think it will be changed, based on the discussion in Clap repo). So our only option is to migrate to builder for networks and maybe other flags as well, which we probably don't want to spend our time on right now.
What I suggest is to not use Option<network::Args> and instead only use network name as a string (testnet/mainnet/etc) -> as we don't need to know RPC url to fetch aliases.
But it will conflict with how we are using network everywhere else, so maybe not a very good idea

@fnando
Copy link
Member Author

fnando commented Aug 28, 2024

I guess we should ignore --all for now.

@leighmcculloch
Copy link
Member

I think we can keep this command simpler and output all aliases for all networks, and provide no filtering options.

@fnando
Copy link
Member Author

fnando commented Aug 28, 2024

@leighmcculloch works for me!

@fnando
Copy link
Member Author

fnando commented Aug 29, 2024

The list output is currently this:

$ cargo run contract alias ls --global
   Compiling soroban-cli v21.4.1 (/Users/fnando/Projects/stellar/stellar-cli/cmd/soroban-cli)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 3.08s
     Running `target/debug/soroban contract alias list --global`
ℹ️ Aliases available for network 'Test SDF Network ; September 2015'
hello_world: CAXUMKGXAOY6IAO36XJV6DSOQBMBANSUJ6NR5EXIF27ZWNPW7OOTTHPC
increment: CALLOOCCCJRZ6AZAJSKNCTDZ766N4ANVRKRJPHC65KDV7RJCS37PS4XY

ℹ️ Aliases available for network 'Standalone Network ; February 2017'
hello_world: CC47LWR7ZJH2QQTFUUNRERMBPBAUHIVLKHIKACV6VVZEEQJIHJOJNGPL


$ echo $?
0

$ cargo run contract alias ls
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.20s
     Running `target/debug/soroban contract alias list`
⚠️ No aliases defined for network

$ echo $?
1

@fnando fnando changed the title Add contract alias list. Add contract alias ls. Aug 29, 2024
@fnando fnando force-pushed the contract-alias-ls branch from edfe970 to 4e4bc49 Compare August 29, 2024 17:43
@fnando fnando force-pushed the contract-alias-ls branch from c1d29de to 05c5136 Compare August 30, 2024 19:06
@fnando fnando enabled auto-merge (squash) August 30, 2024 20:12
Copy link
Contributor

@chadoh chadoh left a comment

Choose a reason for hiding this comment

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

Thanks!

@fnando fnando merged commit d90cd78 into main Aug 31, 2024
@fnando fnando deleted the contract-alias-ls branch August 31, 2024 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants