Skip to content

Commit 15544c3

Browse files
authored
Merge pull request #3283 from IntersectMBO/develop
GovTool - v2.0.18
2 parents f9383c3 + 2c953c6 commit 15544c3

File tree

20 files changed

+150
-12
lines changed

20 files changed

+150
-12
lines changed

.github/workflows/test_backend.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ jobs:
162162

163163
publish-status:
164164
runs-on: ubuntu-latest
165-
if: always()
165+
if: always() && needs.backend-tests.result != 'skipped'
166166
needs: [backend-tests, publish-report]
167167
steps:
168168
- uses: actions/checkout@v4

.github/workflows/test_integration_playwright.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ jobs:
202202

203203
publish-status:
204204
runs-on: ubuntu-latest
205-
if: always()
205+
if: always() && needs.integration-tests.result != 'skipped'
206206
needs: [integration-tests, publish-report]
207207
steps:
208208
- uses: actions/checkout@v4

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ changes.
1818

1919
### Removed
2020

21-
## [v2.0.18](https://github.com/IntersectMBO/govtool/releases/tag/v2.0.18) 2025-03-25
21+
## [v2.0.18](https://github.com/IntersectMBO/govtool/releases/tag/v2.0.18) 2025-03-26
2222

2323
### Added
2424

2525
- Add redirection to outcomes when proposal is not found [Issue 3230](https://github.com/IntersectMBO/govtool/issues/3230)
26-
- Add drep voting power list endpoint [Issue 3263](https://github.com/IntersectMBO/govtool/issues/3263)
26+
- Add DRep voting power list endpoint [Issue 3263](https://github.com/IntersectMBO/govtool/issues/3263)
27+
- Add DRep given name to the voting power list endpoint [Issue 3273](https://github.com/IntersectMBO/govtool/issues/3273)
28+
- Add DRep voting power list query to PDF Pillar [Issue 3277](https://github.com/IntersectMBO/govtool/issues/3277)
2729

2830
### Fixed
2931

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,37 @@
1+
WITH LatestExistingVotingAnchor AS (
2+
SELECT
3+
subquery.drep_registration_id,
4+
subquery.drep_hash_id,
5+
subquery.voting_anchor_id,
6+
subquery.url,
7+
subquery.metadata_hash,
8+
subquery.ocvd_id
9+
FROM (
10+
SELECT
11+
dr.id AS drep_registration_id,
12+
dr.drep_hash_id,
13+
va.id AS voting_anchor_id,
14+
va.url,
15+
encode(va.data_hash, 'hex') AS metadata_hash,
16+
ocvd.id AS ocvd_id,
17+
ROW_NUMBER() OVER (PARTITION BY dr.drep_hash_id ORDER BY dr.tx_id DESC) AS rn
18+
FROM
19+
drep_registration dr
20+
JOIN voting_anchor va ON dr.voting_anchor_id = va.id
21+
JOIN off_chain_vote_data ocvd ON va.id = ocvd.voting_anchor_id
22+
WHERE
23+
ocvd.voting_anchor_id IS NOT NULL
24+
) subquery
25+
WHERE
26+
subquery.rn = 1
27+
)
128
SELECT DISTINCT ON (raw)
229
view,
330
encode(raw, 'hex') AS hash_raw,
4-
COALESCE(dd.amount, 0) AS voting_power
31+
COALESCE(dd.amount, 0) AS voting_power,
32+
ocvdd.given_name
533
FROM drep_hash dh
6-
LEFT JOIN drep_distr dd ON dh.id = dd.hash_id AND dd.epoch_no = (SELECT MAX(no) from epoch)
34+
LEFT JOIN drep_distr dd ON dh.id = dd.hash_id AND dd.epoch_no = (SELECT MAX(no) from epoch)
35+
LEFT JOIN LatestExistingVotingAnchor leva ON leva.drep_hash_id = dh.id
36+
LEFT JOIN off_chain_vote_data ocvd ON ocvd.id = leva.ocvd_id
37+
LEFT JOIN off_chain_vote_drep_data ocvdd ON ocvdd.off_chain_vote_data_id = ocvd.id
Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,38 @@
1+
WITH LatestExistingVotingAnchor AS (
2+
SELECT
3+
subquery.drep_registration_id,
4+
subquery.drep_hash_id,
5+
subquery.voting_anchor_id,
6+
subquery.url,
7+
subquery.metadata_hash,
8+
subquery.ocvd_id
9+
FROM (
10+
SELECT
11+
dr.id AS drep_registration_id,
12+
dr.drep_hash_id,
13+
va.id AS voting_anchor_id,
14+
va.url,
15+
encode(va.data_hash, 'hex') AS metadata_hash,
16+
ocvd.id AS ocvd_id,
17+
ROW_NUMBER() OVER (PARTITION BY dr.drep_hash_id ORDER BY dr.tx_id DESC) AS rn
18+
FROM
19+
drep_registration dr
20+
JOIN voting_anchor va ON dr.voting_anchor_id = va.id
21+
JOIN off_chain_vote_data ocvd ON va.id = ocvd.voting_anchor_id
22+
WHERE
23+
ocvd.voting_anchor_id IS NOT NULL
24+
) subquery
25+
WHERE
26+
subquery.rn = 1
27+
)
128
SELECT DISTINCT ON (raw)
229
view,
330
encode(raw, 'hex') AS hash_raw,
4-
COALESCE(dd.amount, 0) AS voting_power
31+
COALESCE(dd.amount, 0) AS voting_power,
32+
ocvdd.given_name
533
FROM drep_hash dh
634
LEFT JOIN drep_distr dd ON dh.id = dd.hash_id AND dd.epoch_no = (SELECT MAX(no) from epoch)
35+
LEFT JOIN LatestExistingVotingAnchor leva ON leva.drep_hash_id = dh.id
36+
LEFT JOIN off_chain_vote_data ocvd ON ocvd.id = leva.ocvd_id
37+
LEFT JOIN off_chain_vote_drep_data ocvdd ON ocvdd.off_chain_vote_data_id = ocvd.id
738
WHERE view = ? OR encode(raw, 'hex') = ?

govtool/backend/src/VVA/API.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ drepVotingPowerList identifiers = do
346346
{ drepVotingPowerListResponseView = drepView
347347
, drepVotingPowerListResponseHashRaw = HexText drepHashRaw
348348
, drepVotingPowerListResponseVotingPower = drepVotingPower
349+
, drepVotingPowerListResponseGivenName = drepGivenName
349350
}
350351

351352
getCurrentDelegation :: App m => HexText -> m (Maybe DelegationResponse)

govtool/backend/src/VVA/API/Types.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,7 @@ data DRepVotingPowerListResponse
627627
{ drepVotingPowerListResponseView :: Text
628628
, drepVotingPowerListResponseHashRaw :: HexText
629629
, drepVotingPowerListResponseVotingPower :: Integer
630+
, drepVotingPowerListResponseGivenName :: Maybe Text
630631
}
631632
deriving (Generic, Show)
632633

@@ -636,7 +637,8 @@ exampleDRepVotingPowerListResponse :: Text
636637
exampleDRepVotingPowerListResponse =
637638
"{\"view\": \"drep1qq5n7k0r0ff6lf4qvndw9t7vmdqa9y3q9qtjq879rrk9vcjcdy8a4xf92mqsajf9u3nrsh3r6zrp29kuydmfq45fz88qpzmjkc\","
638639
<> "\"hashRaw\": \"9af10e89979e51b8cdc827c963124a1ef4920d1253eef34a1d5cfe76438e3f11\","
639-
<> "\"votingPower\": 1000000}"
640+
<> "\"votingPower\": 1000000,"
641+
<> "\"givenName\": \"John Doe\"}"
640642

641643
instance ToSchema DRepVotingPowerListResponse where
642644
declareNamedSchema proxy = do

govtool/backend/src/VVA/DRep.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ getDRepsVotingPowerList identifiers = withPool $ \conn -> do
222222
return $ concat resultsPerIdentifier
223223

224224
return
225-
[ DRepVotingPowerList view hashRaw votingPower
226-
| (view, hashRaw, votingPower') <- results
225+
[ DRepVotingPowerList view hashRaw votingPower givenName
226+
| (view, hashRaw, votingPower', givenName) <- results
227227
, let votingPower = floor @Scientific votingPower'
228228
]

govtool/backend/src/VVA/Types.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ data DRepVotingPowerList
101101
{ drepView :: Text
102102
, drepHashRaw :: Text
103103
, drepVotingPower :: Integer
104+
, drepGivenName :: Maybe Text
104105
}
105106
deriving (Show, Eq)
106107

govtool/frontend/src/consts/queryKeys.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export const QUERY_KEYS = {
1313
useGetProposalsInfiniteKey: "useGetProposalsInfiniteKey",
1414
useGetProposalsKey: "useGetProposalsKey",
1515
useGetVoteContextFromFile: "useGetVoteContextFromFile",
16+
useGetDRepVotingPowerListKey: "useGetDRepVotingPowerListKey",
1617
};
1718

1819
export const MUTATION_KEYS = {

0 commit comments

Comments
 (0)