Skip to content

Commit

Permalink
proving wallet is delegating from getTransaction
Browse files Browse the repository at this point in the history
  • Loading branch information
paweljakubas committed Apr 12, 2023
1 parent b2e7ed3 commit 0c8ce21
Showing 1 changed file with 50 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import Cardano.Wallet.Api.Types
, ApiT (..)
, ApiTransaction
, ApiTxId (..)
, ApiTxInput (..)
, ApiTxInputGeneral (..)
, ApiTxMetadata (..)
, ApiTxOutputGeneral (..)
Expand Down Expand Up @@ -1921,6 +1922,55 @@ spec = describe "SHARED_TRANSACTIONS" $ do
verify submittedTx2
[ expectResponseCode HTTP.status202
]

eventually "Party1's wallet has joined pool and deposit info persists" $ do
rJoin' <- request @(ApiTransaction n) ctx
(Link.getTransaction @'Shared party1
(getFromResponse Prelude.id submittedTx2))
Default Empty
verify rJoin'
[ expectResponseCode HTTP.status200
, expectField (#status . #getApiT) (`shouldBe` InLedger)
, expectField (#direction . #getApiT) (`shouldBe` Outgoing)
, expectField #depositTaken (`shouldBe` depositAmt)
, expectField #depositReturned (`shouldBe` Quantity 0)
]
eventually "Party2's wallet has joined pool and deposit info persists" $ do
rJoin' <- request @(ApiTransaction n) ctx
(Link.getTransaction @'Shared party2
(getFromResponse Prelude.id submittedTx2))
Default Empty
verify rJoin'
[ expectResponseCode HTTP.status200
, expectField (#status . #getApiT) (`shouldBe` InLedger)
, expectField (#direction . #getApiT) (`shouldBe` Outgoing)
, expectField #depositTaken (`shouldBe` depositAmt)
, expectField #depositReturned (`shouldBe` Quantity 0)
]

let txId2 = getFromResponse #id submittedTx2
let link party = Link.getTransaction @'Shared party (ApiTxId txId2)
eventually "party1: delegation transaction is in ledger" $ do
rSrc <- request @(ApiTransaction n) ctx (link party1) Default Empty
verify rSrc
[ expectResponseCode HTTP.status200
, expectField (#direction . #getApiT) (`shouldBe` Outgoing)
, expectField (#status . #getApiT) (`shouldBe` InLedger)
, expectField #metadata (`shouldBe` Nothing)
, expectField #inputs $ \inputs' -> do
inputs' `shouldSatisfy` all (isJust . source)
]
eventually "party2: delegation transaction is in ledger" $ do
rSrc <- request @(ApiTransaction n) ctx (link party2) Default Empty
verify rSrc
[ expectResponseCode HTTP.status200
, expectField (#direction . #getApiT) (`shouldBe` Outgoing)
, expectField (#status . #getApiT) (`shouldBe` InLedger)
, expectField #metadata (`shouldBe` Nothing)
, expectField #inputs $ \inputs' -> do
inputs' `shouldSatisfy` all (isJust . source)
]

where
listSharedTransactions ctx w mStart mEnd mOrder mLimit = do
let path = Link.listTransactions' @'Shared w
Expand Down

0 comments on commit 0c8ce21

Please sign in to comment.