File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -796,12 +796,12 @@ export const fetchDRepActiveDelegators = async (
796
796
WHERE dv.addr_id IN (SELECT id FROM stakes)
797
797
GROUP BY dv.addr_id
798
798
)
799
- SELECT
800
- sa.view AS stakeAddress,
801
- ENCODE(tx.hash, 'hex') AS txId ,
802
- e.no AS epoch,
803
- b.time AS time,
804
- COALESCE(SUM(uv.value), 0) +
799
+ SELECT json_build_object (
800
+ ' stakeAddress', sa.view,
801
+ 'txId', ENCODE(tx.hash, 'hex'),
802
+ ' epoch', e.no ,
803
+ 'time', b. time,
804
+ 'amount', COALESCE(SUM(uv.value), 0) +
805
805
COALESCE((
806
806
SELECT SUM(amount)
807
807
FROM reward r
@@ -825,7 +825,9 @@ export const fetchDRepActiveDelegators = async (
825
825
JOIN block blka ON blka.id = txa.block_id
826
826
WHERE w.addr_id = lt.addr_id
827
827
), 0)
828
- ), 0) AS amount
828
+ ), 0)
829
+ ) AS result,
830
+ COUNT(*) OVER () AS total_count
829
831
FROM latest_tx lt
830
832
JOIN stake_address sa ON sa.id = lt.addr_id
831
833
JOIN tx ON tx.id = lt.latest_tx_id
@@ -842,7 +844,8 @@ export const fetchDRepActiveDelegators = async (
842
844
string ,
843
845
any
844
846
> [ ]
845
- } else {
847
+ }
848
+ else {
846
849
result = ( await prisma . $queryRaw `
847
850
WITH stakes AS (
848
851
SELECT DISTINCT dv.addr_id AS id
You can’t perform that action at this time.
0 commit comments