Add upgrade authority command to cli

Change-Id: I58d617cbf19a8300a0915f317e63469c73e64c0f
This commit is contained in:
Hendrik Hofstadt 2021-07-20 18:52:09 +02:00
parent 953ca87162
commit f9f461d78d
1 changed files with 23 additions and 0 deletions

View File

@ -61,7 +61,9 @@ use solana_sdk::{
use solitaire::{
processors::seeded::Seeded,
AccountState,
Info,
};
use solitaire_client::Derive;
struct Config {
rpc_client: RpcClient,
@ -214,6 +216,20 @@ fn main() {
Defaults to the client keypair.",
),
)
.subcommand(
SubCommand::with_name("upgrade-authority")
.about("Get the derived signer used for contract upgrades")
.arg(
Arg::with_name("bridge")
.long("bridge")
.value_name("BRIDGE_KEY")
.validator(is_pubkey_or_keypair)
.takes_value(true)
.index(1)
.required(true)
.help("Specify the bridge program address"),
)
)
.subcommand(
SubCommand::with_name("create-bridge")
.about("Create a new bridge")
@ -361,6 +377,13 @@ fn main() {
msg_fee_persistent,
)
}
("upgrade-authority", Some(arg_matches)) => {
let bridge = pubkey_of(arg_matches, "bridge").unwrap();
let upgrade_auth = <Derive<Info<'_>, "upgrade">>::key(None, &bridge);
println!("Upgrade Key: {}", upgrade_auth);
Ok(None)
}
("post-message", Some(arg_matches)) => {
let bridge = pubkey_of(arg_matches, "bridge").unwrap();
let data_str: String = value_of(arg_matches, "data").unwrap();