module TD.Query.GetTonWalletTransactionByMsgHash
  (GetTonWalletTransactionByMsgHash(..)
  ) where

import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
import qualified Data.Text as T

-- | Returns a TON wallet transaction by its msg_hash; returns an error if the transaction isn't finalized yet. Returns 'TD.Data.TonWalletTransaction.TonWalletTransaction'
data GetTonWalletTransactionByMsgHash
  = GetTonWalletTransactionByMsgHash
    { GetTonWalletTransactionByMsgHash -> Maybe Text
msg_hash :: Maybe T.Text -- ^ Value of msg_hash of the transaction
    }
  deriving (GetTonWalletTransactionByMsgHash
-> GetTonWalletTransactionByMsgHash -> Bool
(GetTonWalletTransactionByMsgHash
 -> GetTonWalletTransactionByMsgHash -> Bool)
-> (GetTonWalletTransactionByMsgHash
    -> GetTonWalletTransactionByMsgHash -> Bool)
-> Eq GetTonWalletTransactionByMsgHash
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetTonWalletTransactionByMsgHash
-> GetTonWalletTransactionByMsgHash -> Bool
== :: GetTonWalletTransactionByMsgHash
-> GetTonWalletTransactionByMsgHash -> Bool
$c/= :: GetTonWalletTransactionByMsgHash
-> GetTonWalletTransactionByMsgHash -> Bool
/= :: GetTonWalletTransactionByMsgHash
-> GetTonWalletTransactionByMsgHash -> Bool
Eq, Int -> GetTonWalletTransactionByMsgHash -> ShowS
[GetTonWalletTransactionByMsgHash] -> ShowS
GetTonWalletTransactionByMsgHash -> String
(Int -> GetTonWalletTransactionByMsgHash -> ShowS)
-> (GetTonWalletTransactionByMsgHash -> String)
-> ([GetTonWalletTransactionByMsgHash] -> ShowS)
-> Show GetTonWalletTransactionByMsgHash
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetTonWalletTransactionByMsgHash -> ShowS
showsPrec :: Int -> GetTonWalletTransactionByMsgHash -> ShowS
$cshow :: GetTonWalletTransactionByMsgHash -> String
show :: GetTonWalletTransactionByMsgHash -> String
$cshowList :: [GetTonWalletTransactionByMsgHash] -> ShowS
showList :: [GetTonWalletTransactionByMsgHash] -> ShowS
Show)

instance I.ShortShow GetTonWalletTransactionByMsgHash where
  shortShow :: GetTonWalletTransactionByMsgHash -> String
shortShow
    GetTonWalletTransactionByMsgHash
      { msg_hash :: GetTonWalletTransactionByMsgHash -> Maybe Text
msg_hash = Maybe Text
msg_hash_
      }
        = String
"GetTonWalletTransactionByMsgHash"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"msg_hash" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
msg_hash_
          ]

instance AT.ToJSON GetTonWalletTransactionByMsgHash where
  toJSON :: GetTonWalletTransactionByMsgHash -> Value
toJSON
    GetTonWalletTransactionByMsgHash
      { msg_hash :: GetTonWalletTransactionByMsgHash -> Maybe Text
msg_hash = Maybe Text
msg_hash_
      }
        = [Pair] -> Value
A.object
          [ Key
"@type"    Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"getTonWalletTransactionByMsgHash"
          , Key
"msg_hash" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
msg_hash_
          ]