@@ -28,14 +28,14 @@ pub struct Options {
2828 minutes : u64 ,
2929
3030 /// Number of buckets to show going back in time
31- #[ clap( long, default_value_t = 6 ) ]
31+ #[ clap( long, default_value_t = 3 ) ]
3232 buckets : u64 ,
3333
3434 /// Network: mainnet | devnet | testnet | local
3535 #[ clap( long, default_value = "mainnet" ) ]
3636 network : String ,
3737
38- /// Custom RPC URL (overrides --network)
38+ /// Custom RPC URL (overrides --network and SOLANA_RPC_URL )
3939 #[ clap( long) ]
4040 rpc_url : Option < String > ,
4141
@@ -58,6 +58,10 @@ pub struct Options {
5858 /// Include both known forester keypairs
5959 #[ clap( long) ]
6060 forester : bool ,
61+
62+ /// Short mode: 1-minute buckets, 10 buckets (overrides --minutes and --buckets)
63+ #[ clap( long, short) ]
64+ short : bool ,
6165}
6266
6367fn network_to_url ( network : & str ) -> String {
@@ -446,6 +450,12 @@ fn lookup_registry_error(code: u32) -> Option<&'static str> {
446450// ---------------------------------------------------------------------------
447451
448452pub async fn fetch_keypair_txs ( opts : Options ) -> Result < ( ) > {
453+ let ( minutes, buckets) = if opts. short {
454+ ( 1 , 10 )
455+ } else {
456+ ( opts. minutes , opts. buckets )
457+ } ;
458+
449459 // Expand pubkeys from preset flags (additive with positional args).
450460 let mut pubkeys = opts. pubkeys . clone ( ) ;
451461 if opts. system {
@@ -466,30 +476,35 @@ pub async fn fetch_keypair_txs(opts: Options) -> Result<()> {
466476 ) ;
467477 }
468478
469- let rpc_url = opts
470- . rpc_url
471- . unwrap_or_else ( || network_to_url ( & opts . network ) ) ;
479+ let rpc_url = opts. rpc_url . unwrap_or_else ( || {
480+ std :: env :: var ( "SOLANA_RPC_URL" ) . unwrap_or_else ( |_| network_to_url ( & opts . network ) )
481+ } ) ;
472482
473483 println ! (
474484 "Fetching transactions for {} address(es) | bucket: {} min | looking back {} buckets" ,
475485 pubkeys. len( ) ,
476- opts . minutes,
477- opts . buckets
486+ minutes,
487+ buckets
478488 ) ;
479- println ! ( "RPC: {}" , rpc_url) ;
489+ let display_url = if let Some ( idx) = rpc_url. find ( "api-key=" ) {
490+ format ! ( "{}api-key=***" , & rpc_url[ ..idx] )
491+ } else {
492+ rpc_url. clone ( )
493+ } ;
494+ println ! ( "RPC: {}" , display_url) ;
480495 println ! ( ) ;
481496
482497 let client = RpcClient :: new_with_commitment ( rpc_url, CommitmentConfig :: confirmed ( ) ) ;
483498
484499 let now = Utc :: now ( ) . timestamp ( ) ;
485- let bucket_secs = opts . minutes as i64 * 60 ;
486- let total_lookback = bucket_secs * opts . buckets as i64 ;
500+ let bucket_secs = minutes as i64 * 60 ;
501+ let total_lookback = bucket_secs * buckets as i64 ;
487502 let cutoff = now - total_lookback;
488503
489504 // Build header: Address | -10m ok | fail | TPS | -20m ok | fail | TPS | ... | Total | Fail
490505 let mut header = vec ! [ "Address" . to_string( ) ] ;
491- for k in 1 ..=opts . buckets {
492- header. push ( format ! ( "-{}m ok" , k * opts . minutes) ) ;
506+ for k in 1 ..=buckets {
507+ header. push ( format ! ( "-{}m ok" , k * minutes) ) ;
493508 header. push ( "fail" . to_string ( ) ) ;
494509 header. push ( "TPS" . to_string ( ) ) ;
495510 }
@@ -505,10 +520,10 @@ pub async fn fetch_keypair_txs(opts: Options) -> Result<()> {
505520 for pubkey_str in & pubkeys {
506521 let pubkey = Pubkey :: from_str ( pubkey_str) ?;
507522
508- let mut ok_counts = vec ! [ 0u64 ; opts . buckets as usize ] ;
509- let mut fail_counts = vec ! [ 0u64 ; opts . buckets as usize ] ;
523+ let mut ok_counts = vec ! [ 0u64 ; buckets as usize ] ;
524+ let mut fail_counts = vec ! [ 0u64 ; buckets as usize ] ;
510525 let mut error_maps: Vec < HashMap < String , u64 > > = if opts. verbose {
511- ( 0 ..opts . buckets as usize ) . map ( |_| HashMap :: new ( ) ) . collect ( )
526+ ( 0 ..buckets as usize ) . map ( |_| HashMap :: new ( ) ) . collect ( )
512527 } else {
513528 Vec :: new ( )
514529 } ;
@@ -540,7 +555,7 @@ pub async fn fetch_keypair_txs(opts: Options) -> Result<()> {
540555 } else {
541556 ( age / bucket_secs) as usize
542557 } ;
543- if bucket_idx < opts . buckets as usize {
558+ if bucket_idx < buckets as usize {
544559 match & sig_info. err {
545560 None => ok_counts[ bucket_idx] += 1 ,
546561 Some ( err) => {
@@ -596,7 +611,7 @@ pub async fn fetch_keypair_txs(opts: Options) -> Result<()> {
596611 if errors. is_empty ( ) {
597612 continue ;
598613 }
599- let label = format ! ( "-{}m" , ( k + 1 ) as u64 * opts . minutes) ;
614+ let label = format ! ( "-{}m" , ( k + 1 ) as u64 * minutes) ;
600615 let mut sorted: Vec < _ > = errors. iter ( ) . collect ( ) ;
601616 sorted. sort_by ( |a, b| b. 1 . cmp ( a. 1 ) ) ;
602617 println ! ( " {}:" , label) ;
0 commit comments