Skip to content

Commit

Permalink
Merge pull request #372 from oasisprotocol/CU-8669vutpb_paratimeaccou…
Browse files Browse the repository at this point in the history
…ntshex-num_txs-is-not-differentiated-across-paratimes_Xi-Zhang

api: Fix runtime accounts query
  • Loading branch information
aefhm authored Apr 3, 2023
2 parents 307f879 + e9dd42b commit 9ad3a4c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions storage/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1233,6 +1233,7 @@ func (c *StorageClient) RuntimeAccount(ctx context.Context, address staking.Addr
if err = c.db.QueryRow(
ctx,
queries.RuntimeAccountStats,
runtimeFromCtx(ctx),
address.String(),
).Scan(
&totalSent,
Expand Down
6 changes: 3 additions & 3 deletions storage/client/queries/queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,13 +380,13 @@ const (
RuntimeAccountStats = `
SELECT
COALESCE (
(SELECT sum(amount) from chain.runtime_transfers where sender=$1::text)
(SELECT sum(amount) from chain.runtime_transfers where runtime = $1 AND sender = $2::text)
, 0) AS total_sent,
COALESCE (
(SELECT sum(amount) from chain.runtime_transfers where receiver=$1::text)
(SELECT sum(amount) from chain.runtime_transfers where runtime = $1 AND receiver = $2::text)
, 0) AS total_received,
COALESCE (
(SELECT count(*) from chain.runtime_related_transactions where account_address=$1::text)
(SELECT count(*) from chain.runtime_related_transactions where runtime= $1 AND account_address = $2::text)
, 0) AS num_txns`

//nolint:gosec // Linter suspects a hardcoded access token.
Expand Down

0 comments on commit 9ad3a4c

Please sign in to comment.