sol icon indicating copy to clipboard operation
sol copied to clipboard

Make `rpc_url` arg optional

Open Eliascm17 opened this issue 2 years ago • 4 comments

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

Eliascm17 avatar Jan 08 '24 16:01 Eliascm17

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.

cavemanloverboy avatar Jan 10 '24 00:01 cavemanloverboy

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.

Eliascm17 avatar Jan 10 '24 00:01 Eliascm17

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.

cavemanloverboy avatar Jan 10 '24 07:01 cavemanloverboy

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

Eliascm17 avatar Mar 28 '24 15:03 Eliascm17