File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
cardano-db-sync/src/Cardano/DbSync/OffChain/Vote Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -58,10 +58,20 @@ getRationale = \case
58
58
59
59
eitherDecodeOffChainVoteData :: LBS. ByteString -> DB. AnchorType -> Either String OffChainVoteData
60
60
eitherDecodeOffChainVoteData lbs = \ case
61
- DB. GovActionAnchor -> OffChainVoteDataGa <$> eitherDecode' lbs
62
- DB. DrepAnchor -> OffChainVoteDataDr <$> eitherDecode' lbs
61
+ DB. GovActionAnchor ->
62
+ eitherDecodeAlternative (OffChainVoteDataGa <$> eitherDecode' lbs) (OffChainVoteDataOther <$> eitherDecode' lbs)
63
+ DB. DrepAnchor ->
64
+ eitherDecodeAlternative (OffChainVoteDataDr <$> eitherDecode' lbs) (OffChainVoteDataOther <$> eitherDecode' lbs)
63
65
DB. OtherAnchor -> OffChainVoteDataOther <$> eitherDecode' lbs
64
66
67
+ eitherDecodeAlternative :: Either String OffChainVoteData -> Either String OffChainVoteData -> Either String OffChainVoteData
68
+ eitherDecodeAlternative one two =
69
+ case one of
70
+ Right _ -> one
71
+ Left err1 -> case two of
72
+ Right _ -> two
73
+ Left err2 -> Left $ err1 <> " , CIP-100:" <> err2
74
+
65
75
getAuthors :: OffChainVoteData -> [Author ]
66
76
getAuthors = \ case
67
77
OffChainVoteDataOther dt -> authors dt
You can’t perform that action at this time.
0 commit comments