From 46eaeef2c91312753e0158ce0d77634005cc066c Mon Sep 17 00:00:00 2001 From: scx1332 Date: Tue, 30 Apr 2024 22:54:11 +0200 Subject: [PATCH] feature: working on possibility of checking attestation --- crates/erc20_payment_lib/src/eth.rs | 4 ++-- crates/erc20_payment_lib/src/server/web.rs | 4 +--- src/actions/attestation/check.rs | 5 ++--- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/crates/erc20_payment_lib/src/eth.rs b/crates/erc20_payment_lib/src/eth.rs index 7222d971..d32c678f 100644 --- a/crates/erc20_payment_lib/src/eth.rs +++ b/crates/erc20_payment_lib/src/eth.rs @@ -166,7 +166,7 @@ pub struct Attestation { pub time: DateTime, pub expiration_time: Option>, pub revocation_time: Option>, - pub refUID: H256, + pub ref_uid: H256, pub recipient: Address, pub attester: Address, pub revocable: bool, @@ -222,7 +222,7 @@ pub async fn get_attestation_details( .ok_or(err_custom_create!("Attestation timestamp out of range"))?, expiration_time: datetime_from_u256_with_option(decoded[3].clone().into_uint().unwrap()), revocation_time: datetime_from_u256_with_option(decoded[4].clone().into_uint().unwrap()), - refUID: H256::from_slice(decoded[5].clone().into_fixed_bytes().unwrap().as_slice()), + ref_uid: H256::from_slice(decoded[5].clone().into_fixed_bytes().unwrap().as_slice()), recipient: decoded[6].clone().into_address().unwrap(), attester: decoded[7].clone().into_address().unwrap(), revocable: decoded[8].clone().into_bool().unwrap(), diff --git a/crates/erc20_payment_lib/src/server/web.rs b/crates/erc20_payment_lib/src/server/web.rs index 1ea5fddd..7427a77b 100644 --- a/crates/erc20_payment_lib/src/server/web.rs +++ b/crates/erc20_payment_lib/src/server/web.rs @@ -1234,7 +1234,7 @@ struct AttestationItemInfo { #[derive(Debug, Serialize)] #[serde(rename_all = "camelCase")] -struct AttestationCheckResult { +pub struct AttestationCheckResult { chain_id: u64, chain: String, attestation: Attestation, @@ -1246,8 +1246,6 @@ pub async fn check_attestation( data: Data>, req: HttpRequest, ) -> actix_web::Result> { - let _my_data = data.shared_state.lock().unwrap(); - let attestation_uid = req.match_info().get("uid").unwrap_or(""); let chain_name = req.match_info().get("chain").unwrap_or(""); let chain: &ChainSetup = data diff --git a/src/actions/attestation/check.rs b/src/actions/attestation/check.rs index 1272ec80..659bc3b5 100644 --- a/src/actions/attestation/check.rs +++ b/src/actions/attestation/check.rs @@ -111,14 +111,13 @@ pub async fn check_attestation_local( let items = attestation_schema .schema - .split(",") - .into_iter() + .split(',') .collect::>(); log::debug!("There are {} items in the schema", items.len()); let mut param_types = Vec::new(); let mut param_names = Vec::new(); for item in items { - let items2 = item.trim().split(" ").into_iter().collect::>(); + let items2 = item.trim().split(' ').collect::>(); if items2.len() != 2 { log::error!("Invalid item in schema: {}", item); return Err(err_custom_create!("Invalid item in schema: {}", item));