Skip to content

Commit 4d5871a

Browse files
Merge pull request #258 from darthsiroftardis/withdraw-additional-guardrails
Additional guardrails for withdraw bid
2 parents d4e6acc + 2e05a22 commit 4d5871a

File tree

12 files changed

+652
-98
lines changed

12 files changed

+652
-98
lines changed

lib/cli.rs

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ mod transaction_v1_builder;
4444
use serde::Serialize;
4545

4646
#[cfg(doc)]
47-
use casper_types::{account::AccountHash, Key};
47+
use casper_types::account::AccountHash;
4848

49-
use casper_types::{Digest, URef};
49+
use casper_types::{CLValue, Digest, Key, SystemHashRegistry, URef};
5050

5151
use crate::{
5252
rpcs::{
@@ -71,8 +71,9 @@ use crate::{Account, Block, Error, StoredValue, Transfer};
7171
use casper_types::PublicKey;
7272
#[cfg(feature = "std-fs-io")]
7373
pub use deploy::{
74-
make_deploy, make_transfer, put_deploy, send_deploy_file, sign_deploy_file,
75-
speculative_put_deploy, speculative_send_deploy_file, speculative_transfer, transfer,
74+
make_deploy, make_transfer, put_deploy, put_deploy_with_min_bid_override, send_deploy_file,
75+
sign_deploy_file, speculative_put_deploy, speculative_send_deploy_file, speculative_transfer,
76+
transfer,
7677
};
7778
pub use deploy_builder::{DeployBuilder, DeployBuilderError};
7879
pub use deploy_str_params::DeployStrParams;
@@ -82,10 +83,12 @@ pub(crate) use fields_container::{FieldsContainer, FieldsContainerError};
8283
pub use json_args::{
8384
help as json_args_help, Error as JsonArgsError, ErrorDetails as JsonArgsErrorDetails, JsonArg,
8485
};
86+
pub use parse::arg_simple::session::parse as arg_simple_session_parse;
87+
pub use parse::args_json::session::parse as arg_json_session_parse;
8588
pub use payment_str_params::PaymentStrParams;
8689
pub use session_str_params::SessionStrParams;
8790
pub use simple_args::{help as simple_args_help, insert_arg};
88-
pub use transaction::{make_transaction, put_transaction};
91+
pub use transaction::{get_maybe_secret_key, make_transaction, put_transaction};
8992
#[cfg(feature = "std-fs-io")]
9093
pub use transaction::{
9194
send_transaction_file, sign_transaction_file, speculative_send_transaction_file,
@@ -512,6 +515,32 @@ pub async fn get_auction_info(
512515
.map_err(CliError::from)
513516
}
514517

518+
/// Retrieve the system hash registry
519+
pub async fn get_system_hash_registry(
520+
node_address: &str,
521+
verbosity_level: u64,
522+
state_root_hash: &str,
523+
) -> Result<SystemHashRegistry, CliError> {
524+
let key = Key::SystemEntityRegistry.to_formatted_string();
525+
let response = query_global_state(
526+
"",
527+
node_address,
528+
verbosity_level,
529+
"",
530+
state_root_hash,
531+
&key,
532+
"",
533+
)
534+
.await?
535+
.result
536+
.stored_value
537+
.into_cl_value()
538+
.ok_or_else(|| CliError::FailedToGetSystemHashRegistry)?;
539+
540+
CLValue::to_t::<SystemHashRegistry>(&response)
541+
.map_err(|err| CliError::InvalidCLValue(err.to_string()))
542+
}
543+
515544
/// Retrieves the status changes of the active validators on the network.
516545
///
517546
/// For details of the parameters, see [the module docs](crate::cli#common-parameters).

0 commit comments

Comments
 (0)