Skip to content

Commit

Permalink
refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
Tranduy1dol committed Aug 5, 2024
1 parent 2808b7d commit 5f02b39
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ hex = "0.4"
itertools = "0.13.0"
mockall = "0.12.1"
testcontainers = "0.18.0"
dotenv = "0.15.0"


# Cairo VM
cairo-vm = { git = "https://github.com/lambdaclass/cairo-vm", features = [
Expand Down
6 changes: 3 additions & 3 deletions crates/settlement-clients/aptos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ alloy = { git = "https://github.com/alloy-rs/alloy", rev = "68952c0" }
aptos-sdk = { workspace = true }
async-trait = { workspace = true }
color-eyre = { workspace = true }
dotenvy = { workspace = true }
hex = "0.4.3"
mockall = { workspace = true }
once_cell = "1.19.0"
settlement-client-interface = { workspace = true }
tokio = { workspace = true }
url = "2.5.2"
utils = { workspace = true }
tokio = { workspace = true }
dotenv = { workspace = true }
hex = "0.4.3"
4 changes: 2 additions & 2 deletions crates/settlement-clients/aptos/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use dotenv::dotenv;
use dotenvy::dotenv;
use settlement_client_interface::SettlementConfig;
use utils::env_utils::get_env_var_or_panic;

Expand All @@ -12,7 +12,7 @@ pub struct AptosSettlementConfig {

impl SettlementConfig for AptosSettlementConfig {
fn new_from_env() -> Self {
dotenv().ok().expect("Failed to load .env file");
dotenv().expect("Failed to load .env file");
let node_url = get_env_var_or_panic("APTOS_NODE_URL");
let private_key = get_env_var_or_panic("APTOS_PRIVATE_KEY");
let account_address = get_env_var_or_panic("APTOS_ACCOUNT_ADDRESS");
Expand Down
4 changes: 2 additions & 2 deletions crates/settlement-clients/aptos/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl SettlementClient for AptosSettlementClient {
vec![],
serialize_values(
vec![
&MoveValue::Vector(program_output.iter().map(|s| MoveValue::U256(U256::from_le_bytes(&s))).collect::<Vec<_>>()),
&MoveValue::Vector(program_output.iter().map(|s| MoveValue::U256(U256::from_le_bytes(s))).collect::<Vec<_>>()),
&MoveValue::U256(U256::from_le_bytes(&onchain_data_hash)),
&MoveValue::U256(U256::from(onchain_data_size as u128)),
].into_iter(),
Expand Down Expand Up @@ -177,7 +177,7 @@ impl SettlementClient for AptosSettlementClient {
};
let response = client.view(&request, None).await?.into_inner();

let block_number = response.get(0).unwrap().as_str().unwrap();
let block_number = response.first().unwrap().as_str().unwrap();
eprintln!("block_number = {:#?}", block_number);
Ok(block_number.parse::<u64>().unwrap())
}
Expand Down

0 comments on commit 5f02b39

Please sign in to comment.