Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
register_producer_subcommand Struct Reference

Public Member Functions

 register_producer_subcommand (CLI::App *actionRoot)
 

Public Attributes

string producer_str
 
string producer_key_str
 
string url
 
uint16_t loc = 0
 

Detailed Description

Definition at line 1100 of file main.cpp.

Constructor & Destructor Documentation

◆ register_producer_subcommand()

register_producer_subcommand::register_producer_subcommand ( CLI::App * actionRoot)
inline

Definition at line 1106 of file main.cpp.

1106 {
1107 auto register_producer = actionRoot->add_subcommand("regproducer", localized("Register a new producer"));
1108 register_producer->add_option("account", producer_str, localized("The account to register as a producer"))->required();
1109 register_producer->add_option("producer_key", producer_key_str, localized("The producer's public key"))->required();
1110 register_producer->add_option("url", url, localized("The URL where info about producer can be found"), true);
1111 register_producer->add_option("location", loc, localized("Relative location for purpose of nearest neighbor scheduling"), true);
1112 add_standard_transaction_options(register_producer, "account@active");
1113
1114
1115 register_producer->callback([this] {
1116 public_key_type producer_key;
1117 try {
1118 producer_key = public_key_type(producer_key_str);
1119 } SYS_RETHROW_EXCEPTIONS(public_key_type_exception, "Invalid producer public key: ${public_key}", ("public_key", producer_key_str))
1120
1121 auto regprod_var = regproducer_variant(name(producer_str), producer_key, url, loc );
1122 auto accountPermissions = get_account_permissions(tx_permission, {name(producer_str), config::active_name});
1123 send_actions({create_action(accountPermissions, config::system_account_name, "regproducer"_n, regprod_var)});
1124 });
1125 }
std::string name
#define SYS_RETHROW_EXCEPTIONS(exception_type, FORMAT,...)
App * add_subcommand(std::string subcommand_name="", std::string subcommand_description="")
Add a subcommand. Inherits INHERITABLE and OptionDefaults, and help flag.
Definition CLI11.hpp:5538
Option * add_option(std::string option_name, callback_t option_callback, std::string option_description="", bool defaulted=false, std::function< std::string()> func={})
Definition CLI11.hpp:5099
CRTP * required(bool value=true)
Set the option as required.
Definition CLI11.hpp:3400
#define localized(str,...)
Definition localize.hpp:10
fc::crypto::public_key public_key_type
Definition types.hpp:76
chain::action create_action(const vector< permission_level > &authorization, const account_name &code, const action_name &act, const fc::variant &args)
Definition main.cpp:683
vector< chain::permission_level > get_account_permissions(const vector< string > &permissions)
Definition main.cpp:238
void add_standard_transaction_options(CLI::App *cmd, string default_permission="")
Definition main.cpp:202
void send_actions(std::vector< chain::action > &&actions, packed_transaction::compression_type compression=packed_transaction::compression_type::none)
Definition main.cpp:616
vector< string > tx_permission
Definition main.cpp:198
fc::variant regproducer_variant(const account_name &producer, const public_key_type &key, const string &url, uint16_t location)
Definition main.cpp:716
Here is the call graph for this function:

Member Data Documentation

◆ loc

uint16_t register_producer_subcommand::loc = 0

Definition at line 1104 of file main.cpp.

◆ producer_key_str

string register_producer_subcommand::producer_key_str

Definition at line 1102 of file main.cpp.

◆ producer_str

string register_producer_subcommand::producer_str

Definition at line 1101 of file main.cpp.

◆ url

string register_producer_subcommand::url

Definition at line 1103 of file main.cpp.


The documentation for this struct was generated from the following file: