@@ -88,6 +88,7 @@ import Test.Integration.Framework.DSL
88
88
, expectResponseCode
89
89
, expectSuccess
90
90
, fixturePassphrase
91
+ , fixtureShelleyWallet
91
92
, fixtureWallet
92
93
, getFromResponse
93
94
, getResponse
@@ -101,6 +102,7 @@ import Test.Integration.Framework.DSL
101
102
, notDelegating
102
103
, notRetiringPools
103
104
, onlyVoting
105
+ , postWallet
104
106
, quitStakePool
105
107
, request
106
108
, signTx
@@ -112,6 +114,9 @@ import Test.Integration.Framework.DSL
112
114
, (.<)
113
115
, (.>)
114
116
)
117
+ import Test.Integration.Framework.TestData
118
+ ( payloadWith
119
+ )
115
120
116
121
import qualified Cardano.Wallet.Api.Link as Link
117
122
import qualified Data.List.NonEmpty as NE
@@ -986,6 +991,77 @@ spec = describe "VOTING_TRANSACTIONS" $ do
986
991
(`shouldBe` votingAndDelegating (ApiT pool2) (ApiT voting2) [] )
987
992
]
988
993
994
+ it " VOTING_01j - Delegation works in Conway in presence of voting after wallet delations and restoration"
995
+ $ \ ctx -> runResourceT $ do
996
+ noBabbage ctx " voting can be checked only in Conway onwards"
997
+ (w, mnemonic) <- fixtureShelleyWallet ctx
998
+
999
+ eventually " Initially wallet is neither delegating nor voting" $ do
1000
+ getSrcWallet ctx w >>= flip verify
1001
+ [ expectField # delegation
1002
+ (`shouldBe` notDelegating [] )
1003
+ ]
1004
+
1005
+ let voting = NoConfidence
1006
+ rTx <- joinDRep @ n ctx (SpecificDRep voting) (w, fixturePassphrase)
1007
+ verify rTx
1008
+ [ expectResponseCode HTTP. status202
1009
+ ]
1010
+
1011
+ eventually " Wallet is voting NoConfidence" $ do
1012
+ getSrcWallet ctx w >>= flip verify
1013
+ [ expectField # delegation
1014
+ (`shouldBe` onlyVoting(ApiT voting) [] )
1015
+ ]
1016
+
1017
+ -- delete the wallet
1018
+ rDel1 <- request @ ApiWallet ctx (Link. deleteWallet @ 'Shelley w) Default Empty
1019
+ expectResponseCode HTTP. status204 rDel1
1020
+
1021
+ -- restoring the wallet
1022
+ let payldCrt = payloadWith " Faucet Wallet" mnemonic
1023
+ rRestore1 <- postWallet ctx payldCrt
1024
+ verify rRestore1
1025
+ [ expectResponseCode HTTP. status201
1026
+ ]
1027
+
1028
+ let w' = getFromResponse Prelude. id rRestore1
1029
+ eventually " Wallet is voting NoConfidence after restoration" $ do
1030
+ getSrcWallet ctx w' >>= flip verify
1031
+ [ expectField # delegation
1032
+ (`shouldBe` onlyVoting(ApiT voting) [] )
1033
+ ]
1034
+
1035
+ pool1 : _ : _ <- map (view # id ) <$> notRetiringPools ctx
1036
+
1037
+ -- Join Pool
1038
+ rJoin <- joinStakePool @ n ctx (SpecificPool pool1) (w', fixturePassphrase)
1039
+ verify rJoin
1040
+ [ expectResponseCode HTTP. status202
1041
+ ]
1042
+ eventually " Wallet is voting NoConfidence and delegating to pool1" $ do
1043
+ getSrcWallet ctx w' >>= flip verify
1044
+ [ expectField # delegation
1045
+ (`shouldBe` votingAndDelegating (ApiT pool1) (ApiT voting) [] )
1046
+ ]
1047
+
1048
+ -- delete the wallet once again
1049
+ rDel2 <- request @ ApiWallet ctx (Link. deleteWallet @ 'Shelley w') Default Empty
1050
+ expectResponseCode HTTP. status204 rDel2
1051
+
1052
+ -- restoring the wallet once again
1053
+ rRestore2 <- postWallet ctx payldCrt
1054
+ verify rRestore2
1055
+ [ expectResponseCode HTTP. status201
1056
+ ]
1057
+
1058
+ let w'' = getFromResponse Prelude. id rRestore2
1059
+ eventually " Wallet is voting NoConfidence and deleagting to pool1 after restoration" $ do
1060
+ getSrcWallet ctx w'' >>= flip verify
1061
+ [ expectField # delegation
1062
+ (`shouldBe` votingAndDelegating (ApiT pool1) (ApiT voting) [] )
1063
+ ]
1064
+
989
1065
where
990
1066
stakeKeyDerPath = NE. fromList
991
1067
[ ApiT (DerivationIndex 2_147_485_500 )
0 commit comments