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

Make rpc_url arg optional #5

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

Eliascm17
Copy link

  • update rpc_url arg to be optional and based off of solana cli config

Copy link
Owner

@cavemanloverboy cavemanloverboy left a comment

Choose a reason for hiding this comment

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

Very nice, had two minor comments.

src/main.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
Copy link
Author

@Eliascm17 Eliascm17 left a comment

Choose a reason for hiding this comment

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

added alias command for rpc_url and updated the import of get_network fn from utils

@cavemanloverboy
Copy link
Owner

Been thinking more about this and whether a stateless cli is better. With a stateless ux, there's no ambiguity in which cluster you are querying. You can build a mental model where no flags = mainnet and you never accidentally use a different cluster. It's less important for an explorer but I think stateless is the way to go. If anyone wants to chime in with opinion @Eliascm17, would love to hear thoughts for the contrary

Also, the -u suggestion is already present in the cli:

Options:
  -u, --rpc-url <RPC_URL>  The url/endpoint to use for any rpc requests [default: http://api.mainnet-beta.solana.com]
  -h, --help               Print help
  -V, --version            Print version

I was referring to the "local" vs "l" shorthand.

@Eliascm17
Copy link
Author

Eliascm17 commented Jan 10, 2024

Been thinking more about this and whether a stateless cli is better. With a stateless ux, there's no ambiguity in which cluster you are querying. You can build a mental model where no flags = mainnet and you never accidentally use a different cluster. It's less important for an explorer but I think stateless is the way to go. If anyone wants to chime in with opinion @Eliascm17, would love to hear thoughts for the contrary

Also, the -u suggestion is already present in the cli:

Options:
  -u, --rpc-url <RPC_URL>  The url/endpoint to use for any rpc requests [default: http://api.mainnet-beta.solana.com]
  -h, --help               Print help
  -V, --version            Print version

Yeah I see your point. I think it's important to think of this cli tool as an explorer and default to mainnet unless specified otherwise. On the other hand who else would be using this cli tool besides devs? In my mind I would have assumed that this cli would be pointing to the cluster based on my current solana cli config but would others also think that?

I was referring to the "local" vs "l" shorthand.

I'm confused as to what this means/ what you're asking me to do lol.

@cavemanloverboy
Copy link
Owner

Been thinking more about this and whether a stateless cli is better. With a stateless ux, there's no ambiguity in which cluster you are querying. You can build a mental model where no flags = mainnet and you never accidentally use a different cluster. It's less important for an explorer but I think stateless is the way to go. If anyone wants to chime in with opinion @Eliascm17, would love to hear thoughts for the contrary
Also, the -u suggestion is already present in the cli:

Options:
  -u, --rpc-url <RPC_URL>  The url/endpoint to use for any rpc requests [default: http://api.mainnet-beta.solana.com]
  -h, --help               Print help
  -V, --version            Print version

Yeah I see your point. I think it's important to think of this cli tool as an explorer and default to mainnet unless specified otherwise. On the other hand who else would be using this cli tool besides devs? In my mind I would have assumed that this cli would be pointing to the cluster based on my current solana cli config but would others also think that?

I was referring to the "local" vs "l" shorthand.

I'm confused as to what this means/ what you're asking me to do lol.

  1. Wish we could survey to find out what devs want lol.
  2. When I suggested add "-ul" was referring more to the "l" not the "u". The help prints out -u, --rpc-url <RPC_URL> so ppl can see that -u is aliased already. However, what's not clear from here is what the accepted shortcuts are -- those are kind of tucked away in get_network rn and not really documented. I think at the very least l/m/d/t should be documented as options in addition to local, mainnet, devnet, testnet.

@Eliascm17
Copy link
Author

Eliascm17 commented Mar 28, 2024

I updated the docs to reflect the accepted shortcuts for the rpc_url

    /// Specify your RPC endpoint with shortcuts (l=localnet, d=devnet, m=mainnet, t=testnet). Defaults to Solana CLI config. Alias: -u
    #[clap(long, short = 'u', global = true)]
    rpc_url: Option<String>,
Options:
  -u, --rpc-url <RPC_URL>  Specify your RPC endpoint with shortcuts (l=localnet, d=devnet, m=mainnet, t=testnet). Defaults to Solana CLI config. Alias: -u
  -h, --help               Print help
  -V, --version            Print version

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