async fn propose_to_add_or_remove_node_provider(
    cmd: ProposeToAddOrRemoveNodeProviderCmd,
    nns_url: Url,
    sender: Sender,
) {
    let (proposer, sender) =
        get_proposer_and_sender(cmd.proposer, sender, cmd.test_neuron_proposer);
    let canister_client = GovernanceCanisterClient(make_canister_client(
        nns_url,
        GOVERNANCE_CANISTER_ID,
        sender,
        Some(proposer),
    ));
    let node_provider = NodeProvider {
        id: Some(cmd.node_provider_pid),
        // TODO(NNS1-771): accept this data from the command line
        reward_account: None,
    };
    let (change, default_summary) = match cmd.add_or_remove_provider {
        AddOrRemove::Add => (
            Some(Change::ToAdd(node_provider)),
            format!("Add node provider {}", cmd.node_provider_pid),
        ),
        AddOrRemove::Remove => (
            Some(Change::ToRemove(node_provider)),
            format!("Remove node provider {}", cmd.node_provider_pid),
        ),
    };
    let payload = AddOrRemoveNodeProvider { change };
    print_payload(&payload, &cmd);

    if cmd.is_dry_run() {
        return;
    }

    let summary = cmd.summary.unwrap_or(default_summary);
    let response = canister_client
        .submit_add_or_remove_node_provider_proposal(
            payload,
            parse_proposal_url(cmd.proposal_url),
            format!("Add node provider: {}", cmd.node_provider_pid),
            summary,
        )
        .await;

    match response {
        Ok(proposal_id) => {
            println!("{}", proposal_id);
        }
        Err(e) => {
            eprintln!("propose_to_add_or_remove_node_provider error: {:?}", e);
            std::process::exit(1);
        }
    };
}
/// Submit a proposal to add a new node provider record
Submit a proposal to add a new node provider record
Submit a proposal to add a new node provider record
async fn propose_to_add_or_remove_node_provider(
    cmd: ProposeToAddOrRemoveNodeProviderCmd,
    nns_url: Url,
    sender: Sender,
) {
    let (proposer, sender) =
        get_proposer_and_sender(cmd.proposer, sender, cmd.test_neuron_proposer);
    let canister_client = GovernanceCanisterClient(make_canister_client(
        nns_url,
        GOVERNANCE_CANISTER_ID,
        sender,
        Some(proposer),
    ));
    let node_provider = NodeProvider {
        id: Some(cmd.node_provider_pid),
        // TODO(NNS1-771): accept this data from the command line
        reward_account: None,
    };
    let (change, default_summary) = match cmd.add_or_remove_provider {
        AddOrRemove::Add => (
            Some(Change::ToAdd(node_provider)),
            format!("Add node provider {}", cmd.node_provider_pid),
        ),
        AddOrRemove::Remove => (
            Some(Change::ToRemove(node_provider)),
            format!("Remove node provider {}", cmd.node_provider_pid),
        ),
    };
    let payload = AddOrRemoveNodeProvider { change };
    print_payload(&payload, &cmd);
    if cmd.is_dry_run() {
        return;
    }
    let summary = cmd.summary.unwrap_or(default_summary);
    let response = canister_client
        .submit_add_or_remove_node_provider_proposal(
            payload,
            parse_proposal_url(cmd.proposal_url),
            format!("Add node provider: {}", cmd.node_provider_pid),
            summary,
        )
        .await;
    match response {
        Ok(proposal_id) => {
            println!("{}", proposal_id);
        }
        Err(e) => {
            eprintln!("propose_to_add_or_remove_node_provider error: {:?}", e);
            std::process::exit(1);
        }
    };
}
async fn propose_to_add_or_remove_node_provider ( cmd : ProposeToAddOrRemoveNodeProviderCmd , nns_url : Url , sender : Sender , ) { let ( proposer , sender ) = get_proposer_and_sender ( cmd . proposer , sender , cmd . test_neuron_proposer ) ; let canister_client = GovernanceCanisterClient ( make_canister_client ( nns_url , GOVERNANCE_CANISTER_ID , sender , Some ( proposer ) , ) ) ; let node_provider = NodeProvider { id : Some ( cmd . node_provider_pid ) , // TODO(NNS1-771): accept this data from the command line reward_account : None , } ; let ( change , default_summary ) = match cmd . add_or_remove_provider { AddOrRemove :: Add => ( Some ( Change :: ToAdd ( node_provider ) ) , format ! ( " " cmd node_provider_pid ) , ) , AddOrRemove :: Remove => ( Some ( Change :: ToRemove ( node_provider ) ) , format ! ( " " cmd node_provider_pid ) , ) , } ; let payload = AddOrRemoveNodeProvider { change } ; print_payload ( & payload , & cmd ) ; if cmd . is_dry_run ( ) { return ; } let summary = cmd . summary . unwrap_or ( default_summary ) ; let response = canister_client . submit_add_or_remove_node_provider_proposal ( payload , parse_proposal_url ( cmd . proposal_url ) , format ! ( " " cmd node_provider_pid ) , summary , ) . await ; match response { Ok ( proposal_id ) => { println ! ( " " proposal_id ) ; } Err ( e ) => { eprintln ! ( " " e ) ; std :: process :: exit ( 1 ) ; } } ; }
Submit a proposal to add a new node provider record
Submit a proposal to add a new node provider record
cmd
ProposeToAddOrRemoveNodeProviderCmd
nns_url
Url
sender
Sender
cmd
ProposeToAddOrRemoveNodeProviderCmd
nns_url
Url
sender
Sender