Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: return estimated balance in account balance endpoints #2104

Merged
merged 12 commits into from
Oct 4, 2024
6 changes: 3 additions & 3 deletions src/datastore/pg-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2483,14 +2483,14 @@ export class PgStore extends BasePgStore {
async getPrincipalMempoolStxBalanceDelta(sql: PgSqlClient, principal: string): Promise<bigint> {
const results = await sql<{ delta: string }[]>`
WITH sent AS (
SELECT token_transfer_amount + fee_rate AS total
SELECT token_transfer_amount + COALESCE(fee_rate, 0) AS total
rafaelcr marked this conversation as resolved.
Show resolved Hide resolved
FROM mempool_txs
WHERE pruned = false AND sender_address = ${principal}
),
sponsored AS (
SELECT fee_rate AS total
SELECT COALESCE(fee_rate, 0) AS total
FROM mempool_txs
WHERE pruned = false AND sponsor_address = ${principal}
WHERE pruned = false AND sponsor_address = ${principal} AND sponsored = true
),
received AS (
SELECT token_transfer_amount AS total
Expand Down
Loading