From 82ce7cc4891760c8fbce553c3cf9f9db45d11a9b Mon Sep 17 00:00:00 2001 From: Alexis Asseman Date: Mon, 15 Jan 2024 13:00:10 -0800 Subject: [PATCH] refactor: condense if/else for escrow query Signed-off-by: Alexis Asseman --- common/src/escrow_accounts.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/common/src/escrow_accounts.rs b/common/src/escrow_accounts.rs index 5182d5ee..3cab8608 100644 --- a/common/src/escrow_accounts.rs +++ b/common/src/escrow_accounts.rs @@ -81,7 +81,8 @@ pub fn escrow_accounts( // queries for this signer. // isAuthorized == true means that the signer is still authorized to sign // payments in the name of the sender. - let query_no_thawing_signers = r#" + let query = if reject_thawing_signers { + r#" query ($indexer: ID!) { escrowAccounts(where: {receiver_: {id: $indexer}}) { balance @@ -96,9 +97,9 @@ pub fn escrow_accounts( } } } - "#; - - let query_with_thawing_signers = r#" + "# + } else { + r#" query ($indexer: ID!) { escrowAccounts(where: {receiver_: {id: $indexer}}) { balance @@ -113,12 +114,7 @@ pub fn escrow_accounts( } } } - "#; - - let query = if reject_thawing_signers { - query_no_thawing_signers - } else { - query_with_thawing_signers + "# }; timer(interval).map_with_retry(