-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RES-40] Implement update-node-provider command (#87)
- Loading branch information
Showing
5 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
use crate::{ | ||
lib::signing::{sign_ingress, Ingress}, | ||
lib::{governance_canister_id, AnyhowResult, AuthInfo}, | ||
}; | ||
use candid::{CandidType, Encode}; | ||
use clap::Parser; | ||
|
||
#[derive(CandidType)] | ||
pub struct AccountIdentifier { | ||
hash: Vec<u8>, | ||
} | ||
#[derive(CandidType)] | ||
pub struct UpdateNodeProvider { | ||
pub reward_account: Option<AccountIdentifier>, | ||
} | ||
|
||
/// Signs a neuron configuration change. | ||
#[derive(Parser)] | ||
pub struct UpdateNodeProviderOpts { | ||
/// The account identifier of the reward account. | ||
#[clap(long)] | ||
reward_account: String, | ||
} | ||
|
||
pub fn exec(auth: &AuthInfo, opts: UpdateNodeProviderOpts) -> AnyhowResult<Vec<Ingress>> { | ||
let reward_account = ledger_canister::AccountIdentifier::from_hex(&opts.reward_account) | ||
.map_err(|e| { | ||
anyhow::Error::msg(format!( | ||
"Account {} is not valid address, {}", | ||
&opts.reward_account, e, | ||
)) | ||
})?; | ||
let args = Encode!(&UpdateNodeProvider { | ||
reward_account: Some(AccountIdentifier { | ||
hash: reward_account.hash.to_vec() | ||
}) | ||
})?; | ||
Ok(vec![sign_ingress( | ||
auth, | ||
governance_canister_id(), | ||
"update_node_provider", | ||
args, | ||
)?]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
${CARGO_TARGET_DIR:-../target}/debug/quill update-node-provider --reward-account ec0e2456fb9ff6c80f1d475b301d9b2ab873612f96e7fd74e7c0c0b2d58e6693 | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Sending message with | ||
|
||
Call type: query | ||
Sender: 2vxsx-fae | ||
Canister id: rrkah-fqaaa-aaaaa-aaaaq-cai | ||
Method name: update_node_provider | ||
Arguments: ( | ||
record { | ||
reward_account = opt record { | ||
hash = blob "\fb\9f\f6\c8\0f\1dG[0\1d\9b*\b8sa/\96\e7\fdt\e7\c0\c0\b2\d5\8ef\93"; | ||
}; | ||
}, | ||
) |