@@ -21,7 +21,7 @@ import Control.Concurrent.Class.MonadSTM (
21
21
import Control.Lens (to , (^?) )
22
22
import Control.Monad.Class.MonadAsync (mapConcurrently )
23
23
import Data.Aeson (Result (Error , Success ), Value , encode , fromJSON , (.=) )
24
- import Data.Aeson.Lens (key , _Array , _JSON , _Number , _String )
24
+ import Data.Aeson.Lens (key , _Array , _JSON , _Number , _String , _Object )
25
25
import Data.List qualified as List
26
26
import Data.Map qualified as Map
27
27
import Data.Scientific (Scientific )
@@ -329,7 +329,7 @@ newTx registry client tx = do
329
329
, invalidAt = Nothing
330
330
, confirmedAt = Nothing
331
331
}
332
- send client $ input " NewTx" [" transaction" .= serialiseToTextEnvelope Nothing tx]
332
+ send client $ input " NewTx" [" transaction" .= toJSON tx]
333
333
334
334
data WaitResult
335
335
= TxInvalid { transactionId :: TxId , reason :: Text }
@@ -396,14 +396,14 @@ waitForAllConfirmations n1 Registry{processedTxs} allIds = do
396
396
maybeTxValid v = do
397
397
guard (v ^? key " tag" == Just " TxValid" )
398
398
v
399
- ^? key " txId" . to fromJSON >>= \ case
399
+ ^? key " transaction " . key " txId" . to fromJSON >>= \ case
400
400
Error _ -> Nothing
401
401
Success txid -> pure $ TxValid txid
402
402
403
403
maybeTxInvalid v = do
404
404
guard (v ^? key " tag" == Just " TxInvalid" )
405
405
v
406
- ^? key " txId" . to fromJSON >>= \ case
406
+ ^? key " transaction " . key " txId" . to fromJSON >>= \ case
407
407
Error _ -> Nothing
408
408
Success tx ->
409
409
TxInvalid tx <$> v ^? key " validationError" . key " reason" . _String
0 commit comments