Skip to content
This repository has been archived by the owner on Aug 28, 2023. It is now read-only.

Commit

Permalink
Removed caching of the POST response from submitting a confirmation (#…
Browse files Browse the repository at this point in the history
…846) (#847)

* Removed caching of the POST response from submitting a confirmation

* Version bump to v3.20.1

* Added comment clarifying change in methods
  • Loading branch information
jpalvarezl authored Apr 6, 2022
1 parent 6e3fa0d commit 2e5a71f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 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
@@ -1,6 +1,6 @@
[package]
name = "safe-client-gateway"
version = "3.20.0"
version = "3.20.1"
authors = ["jpalvarezl <[email protected]>", "rmeissner <[email protected]>", "fmrsabino <[email protected]>"]
edition = "2018"

Expand Down
7 changes: 3 additions & 4 deletions src/routes/transactions/handlers/proposal.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
use crate::cache::cache_operations::{Invalidate, InvalidationPattern, InvalidationScope};
use crate::providers::info::{DefaultInfoProvider, InfoProvider};
use crate::routes::transactions::handlers::details::get_multisig_transaction_details;
use crate::routes::transactions::models::details::TransactionDetails;
use crate::routes::transactions::models::requests::MultisigTransactionRequest;
use crate::utils::context::RequestContext;
use crate::utils::errors::ApiResult;
use crate::utils::http_client::Request;
use serde_json::json;

// The transaction details are returned at the route level. The same as for transaction submission
pub async fn submit_confirmation(
context: &RequestContext,
chain_id: &str,
safe_tx_hash: &str,
signature: &str,
) -> ApiResult<TransactionDetails> {
) -> ApiResult<()> {
let info_provider = DefaultInfoProvider::new(chain_id, context);
let url = core_uri!(
info_provider,
Expand All @@ -36,7 +35,7 @@ pub async fn submit_confirmation(
.execute()
.await;

get_multisig_transaction_details(&info_provider, chain_id, safe_tx_hash).await
Ok(())
}

pub async fn propose_transaction(
Expand Down
29 changes: 15 additions & 14 deletions src/routes/transactions/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,22 @@ pub async fn post_confirmation<'e>(
safe_tx_hash: String,
tx_confirmation_request: Result<Json<ConfirmationRequest>, Error<'e>>,
) -> ApiResult<content::Json<String>> {
CacheResponse::new(&context)
.resp_generator(|| {
proposal::submit_confirmation(
&context,
&chain_id,
&safe_tx_hash,
&tx_confirmation_request
.as_ref()
.unwrap()
.0
.signed_safe_tx_hash,
)
})
let request: ConfirmationRequest = tx_confirmation_request?.0;

proposal::submit_confirmation(
&context,
&chain_id,
&safe_tx_hash,
&request.signed_safe_tx_hash,
)
.await?;

let tx_details = CacheResponse::new(&context)
.resp_generator(|| details::get_transactions_details(&context, &chain_id, &safe_tx_hash))
.execute()
.await
.await;

return tx_details;
}

/// `/v1/chains/<chain_id>/safes/<safe_address>/transactions/history?<cursor>&<timezone_offset>&<trusted>` <br />
Expand Down

0 comments on commit 2e5a71f

Please sign in to comment.