def load_solana_validators(config: ValidatorConfig): cmd = f'solana validators -ul --output json-compact' data = execute_cmd_str(config, cmd, convert_to_json=True) if (data is not None) and ('validators' in data): return data['validators'] else: return None
def load_solana_validators(): cmd = f'solana validators --output json-compact' data = execute_cmd_str(cmd, convert_to_json=True) if 'validators' in data: return data['validators'] else: return None
def load_identity_account_pubkey(config: ValidatorConfig) -> Optional[str]: """ loads validator identity account pubkey :param config: Validator Configuration :return: returns validator identity pubkey or None """ identity_cmd = f'solana address -u localhost --keypair ' + config.secrets_path + '/validator-keypair.json' debug(config, identity_cmd) return execute_cmd_str(config, identity_cmd, convert_to_json=False)
def load_cpu_model(config: ValidatorConfig): cmd = 'cat /proc/cpuinfo | grep name| uniq' cpu_info = execute_cmd_str(config, cmd, False).split(":") cpu_model = cpu_info[1].strip() if cpu_model is not None: return cpu_model else: return 'Unknown'
def load_block_production_cli(config: ValidatorConfig): cmd = f'solana block-production -u l --output json-compact' return execute_cmd_str(config, cmd, convert_to_json=True, default={})
def load_solana_gossip(config: ValidatorConfig): cmd = f'solana gossip -ul --output json-compact' return execute_cmd_str(config, cmd, convert_to_json=True)
def load_solana_validators_info(config: ValidatorConfig): cmd = f'solana validator-info get --url ' + config.remote_rpc_address + ' --output json-compact' data = execute_cmd_str(config, cmd, convert_to_json=True) return data
def load_solana_validators_full(config: ValidatorConfig): cmd = f'solana validators -ul --output json-compact' return execute_cmd_str(config, cmd, convert_to_json=True)
def load_stakes(config: ValidatorConfig, vote_account): cmd = f'solana stakes ' + vote_account + ' --output json-compact' return execute_cmd_str(config, cmd, convert_to_json=True, default=[])
def load_stake_account_rewards(config: ValidatorConfig, stake_account): cmd = f'solana stake-account ' + stake_account + ' --num-rewards-epochs=1 --with-rewards --output json-compact' return execute_cmd_str(config, cmd, convert_to_json=True)
def load_stakes(vote_account): cmd = f'solana stakes ' + vote_account + ' --output json-compact' return execute_cmd_str(cmd, convert_to_json=True)