token_bridge/client: add emitter derivation helper

Change-Id: I403e421ebf46b76561c59c6cdd2aac0442a3c8d6
This commit is contained in:
Reisen 2021-08-26 13:44:08 +00:00
parent 6e3e43d35b
commit bb7a67d4c7
1 changed files with 21 additions and 0 deletions

View File

@ -203,6 +203,20 @@ fn main() {
.help("Address of the Wormhole core bridge program"),
),
)
.subcommand(
SubCommand::with_name("emitter")
.about("Get the derived emitter used for contract messages")
.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 token bridge program address"),
),
)
.subcommand(
SubCommand::with_name("create-meta")
.about("Create token metadata")
@ -278,6 +292,13 @@ fn main() {
command_create_meta(&config, &mint, name, symbol)
}
("emitter", Some(arg_matches)) => {
let bridge = pubkey_of(arg_matches, "bridge").unwrap();
let emitter = <Derive<Info<'_>, "emitter">>::key(None, &bridge);
println!("Emitter Key: {}", emitter);
Ok(None)
}
_ => unreachable!(),
}