Skip to content

Commit e84cd9f

Browse files
committed
fix: fix escrow accounts queries
Signed-off-by: Joseph Livesey <[email protected]>
1 parent ab34926 commit e84cd9f

File tree

5 files changed

+16
-14
lines changed

5 files changed

+16
-14
lines changed

crates/monitor/src/escrow_accounts.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ async fn get_escrow_accounts_v2(
159159
// 4. Service provider (indexer) receives payments from payer's escrow
160160

161161
let senders_balances: HashMap<Address, U256> = response
162-
.escrow_accounts
162+
.payments_escrow_accounts
163163
.iter()
164164
.map(|account| {
165165
let balance = U256::checked_sub(
@@ -180,7 +180,7 @@ async fn get_escrow_accounts_v2(
180180
.collect::<Result<HashMap<_, _>, anyhow::Error>>()?;
181181

182182
let senders_to_signers = response
183-
.escrow_accounts
183+
.payments_escrow_accounts
184184
.into_iter()
185185
.map(|account| {
186186
let payer = Address::from_str(&account.payer.id)?;

crates/query/graphql/network.schema.graphql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6661,8 +6661,8 @@ input PaymentsEscrowAccount_filter {
66616661
thawEndTimestamp_in: [BigInt!]
66626662
thawEndTimestamp_not_in: [BigInt!]
66636663
_change_block: BlockChangedFilter
6664-
and: [EscrowAccount_filter]
6665-
or: [EscrowAccount_filter]
6664+
and: [PaymentsEscrowAccount_filter]
6665+
or: [PaymentsEscrowAccount_filter]
66666666
}
66676667

66686668
enum PaymentsEscrowAccount_orderBy {

crates/tap-agent/src/agent/sender_accounts_manager.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ impl State {
753753
let signer_id = Address::from_str(&row.signer_address)
754754
.expect("signer_address should be a valid address");
755755
let sender_id = self
756-
.escrow_accounts_v1
756+
.escrow_accounts_v2
757757
.borrow()
758758
.get_sender_for_signer(&signer_id)
759759
.expect("should be able to get sender from signer");
@@ -785,10 +785,10 @@ impl State {
785785
if let Some(allocation_id_strings) = row.allocation_ids {
786786
let allocation_ids = allocation_id_strings
787787
.iter()
788-
.map(|allocation_id| {
789-
AllocationId::Legacy(
790-
AllocationIdCore::from_str(allocation_id)
791-
.expect("allocation_id should be a valid allocation ID"),
788+
.map(|collection_id| {
789+
AllocationId::Horizon(
790+
CollectionId::from_str(collection_id)
791+
.expect("collection_id should be a valid collection ID"),
792792
)
793793
})
794794
.collect::<HashSet<_>>();

crates/tap-agent/src/agent/sender_allocation.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,14 +1131,16 @@ impl DatabaseInteractions for SenderAllocationState<Horizon> {
11311131
) -> anyhow::Result<()> {
11321132
sqlx::query!(
11331133
r#"
1134-
DELETE FROM scalar_tap_receipts
1134+
DELETE FROM tap_horizon_receipts
11351135
WHERE timestamp_ns BETWEEN $1 AND $2
1136-
AND allocation_id = $3
1137-
AND signer_address IN (SELECT unnest($4::text[]));
1136+
AND collection_id = $3
1137+
AND service_provider = $4
1138+
AND signer_address IN (SELECT unnest($5::text[]));
11381139
"#,
11391140
BigDecimal::from(min_timestamp),
11401141
BigDecimal::from(max_timestamp),
1141-
self.allocation_id.as_address().encode_hex(),
1142+
self.allocation_id.to_string(),
1143+
self.indexer_address.encode_hex(),
11421144
&signers,
11431145
)
11441146
.execute(&self.pgpool)

crates/test-assets/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ pub const ESCROW_QUERY_RESPONSE: &str = r#"
116116
pub const ESCROW_QUERY_RESPONSE_V2: &str = r#"
117117
{
118118
"data": {
119-
"escrowAccounts": [
119+
"paymentsEscrowAccounts": [
120120
{
121121
"balance": "34",
122122
"totalAmountThawing": "10",

0 commit comments

Comments
 (0)