module TD.Data.TonWalletTransactionType
  (TonWalletTransactionType(..)) 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
import qualified TD.Data.TonNft as TonNft

-- | Describes type of transaction with a TON wallet
data TonWalletTransactionType
  = TonWalletTransactionTypeOnRampDeposit -- ^ The transaction is a deposit from an on-ramp provider
    { TonWalletTransactionType -> Maybe Int
amount        :: Maybe Int    -- ^ The received amount, in the smallest units of TON Grams
    , TonWalletTransactionType -> Maybe Text
provider_name :: Maybe T.Text -- ^ Name of the on-ramp provider
    }
  | TonWalletTransactionTypeTransfer -- ^ A transfer of TON Grams to or from the wallet
    { amount               :: Maybe Int    -- ^ The received amount, in the smallest units of TON Grams; negative for outgoing transactions
    , TonWalletTransactionType -> Maybe Bool
is_gasless           :: Maybe Bool   -- ^ True, if the fee was paid by Telegram
    , TonWalletTransactionType -> Maybe Text
comment              :: Maybe T.Text -- ^ Comment added to the transaction
    , TonWalletTransactionType -> Maybe Bool
is_comment_encrypted :: Maybe Bool   -- ^ True, if the comment is encrypted and must be decrypted using the user's private key
    }
  | TonWalletTransactionTypeNftTransfer -- ^ A transfer of a TON NFT to or from the wallet
    { TonWalletTransactionType -> Maybe TonNft
nft                  :: Maybe TonNft.TonNft -- ^ The transferred NFT
    , TonWalletTransactionType -> Maybe Bool
is_outgoing          :: Maybe Bool          -- ^ True, if the transfer is outgoing
    , comment              :: Maybe T.Text        -- ^ Comment added to the transaction
    , is_comment_encrypted :: Maybe Bool          -- ^ True, if the comment is encrypted and must be decrypted using the user's private key
    }
  | TonWalletTransactionTypeTelegramGiftTransfer -- ^ A Telegram gift was minted as a TON NFT directly to the wallet, or a minted gift was linked to or unlinked from a Telegram account. Information about the other user isn't available
    { nft         :: Maybe TonNft.TonNft -- ^ The minted or transferred NFT
    , is_outgoing :: Maybe Bool          -- ^ True, if the transfer is from the wallet to Telegram
    , TonWalletTransactionType -> Maybe Bool
is_saved    :: Maybe Bool          -- ^ True, if the gift was displayed on the current user's profile page before or after the transfer
    }
  | TonWalletTransactionTypeTelegramGiftPurchase -- ^ A Telegram gift was bought on the TON blockchain
    { nft    :: Maybe TonNft.TonNft -- ^ The bought NFT; may be null if unknown
    , amount :: Maybe Int           -- ^ The amount paid for the gift, in the smallest units of TON Grams; always negative
    }
  | TonWalletTransactionTypeTelegramGiftSale -- ^ A Telegram gift was sold on the TON blockchain
    { nft    :: Maybe TonNft.TonNft -- ^ The sold NFT; may be null if unknown
    , amount :: Maybe Int           -- ^ The amount received for the gift, in the smallest units of TON Grams
    }
  | TonWalletTransactionTypeTelegramGiftListing -- ^ A Telegram gift was put up for sale on the TON blockchain or its price was changed
    { nft       :: Maybe TonNft.TonNft -- ^ The NFT put up for sale; may be null if unknown
    , TonWalletTransactionType -> Maybe Int
old_price :: Maybe Int           -- ^ The previous price of the gift, in the smallest units of TON Grams; 0 if the gift wasn't on sale before
    , TonWalletTransactionType -> Maybe Int
price     :: Maybe Int           -- ^ The new price of the gift, in the smallest units of TON Grams
    , amount    :: Maybe Int           -- ^ The cost of the action including refunds, in the smallest units of TON Grams; negative for outgoing transactions
    }
  | TonWalletTransactionTypeTelegramGiftDelisting -- ^ A Telegram gift was removed from sale on the TON blockchain
    { nft    :: Maybe TonNft.TonNft -- ^ The NFT removed from sale; may be null if unknown
    , amount :: Maybe Int           -- ^ The cost of the action including refunds, in the smallest units of TON Grams; negative for outgoing transactions
    }
  | TonWalletTransactionTypeTelegramGiftOfferCreation -- ^ An offer to buy a Telegram gift was created on the TON blockchain and the funds were placed in escrow
    { nft                  :: Maybe TonNft.TonNft -- ^ The NFT for which the offer was created; may be null if unknown
    , TonWalletTransactionType -> Maybe Text
offer_address        :: Maybe T.Text        -- ^ Address of the smart contract of the offer on the TON blockchain; the same for all transactions related to the offer
    , TonWalletTransactionType -> Maybe Text
counterparty_address :: Maybe T.Text        -- ^ Address of the seller on the TON blockchain; may be empty if unknown
    , price                :: Maybe Int           -- ^ The offered price for the NFT without the service fee and blockchain fees, in the smallest units of TON Grams
    , amount               :: Maybe Int           -- ^ The total amount placed in escrow, including the price, the service fee, and the rent and execution fees, in the smallest units of TON Grams
    , TonWalletTransactionType -> Maybe Int
service_fee_amount   :: Maybe Int           -- ^ The service fee for the offer, in the smallest units of TON Grams; included in amount
    , TonWalletTransactionType -> Maybe Int
expiration_date      :: Maybe Int           -- ^ Point in time (Unix timestamp) when the offer expires; 0 if unknown
    }
  | TonWalletTransactionTypeTelegramGiftOfferAcceptance -- ^ An offer to buy a Telegram gift was accepted on the TON blockchain. The buyer received the NFT and the seller received the price
    { nft                  :: Maybe TonNft.TonNft -- ^ The NFT for which the offer was created; may be null if unknown
    , TonWalletTransactionType -> Maybe Bool
is_buyer             :: Maybe Bool          -- ^ True, if the current user is the buyer of the NFT; otherwise, the current user is the seller of the NFT
    , offer_address        :: Maybe T.Text        -- ^ Address of the smart contract of the offer on the TON blockchain; the same for all transactions related to the offer
    , counterparty_address :: Maybe T.Text        -- ^ Address of the other party on the TON blockchain: the seller for the buyer and the buyer for the seller
    , price                :: Maybe Int           -- ^ The price of the NFT without the service fee and blockchain fees, in the smallest units of TON Grams
    , service_fee_amount   :: Maybe Int           -- ^ The service fee for the offer, in the smallest units of TON Grams
    }
  | TonWalletTransactionTypeTelegramGiftOfferCancellation -- ^ An offer to buy a Telegram gift was canceled by the buyer on the TON blockchain
    { nft                  :: Maybe TonNft.TonNft -- ^ The NFT for which the offer was created; may be null if unknown
    , offer_address        :: Maybe T.Text        -- ^ Address of the smart contract of the offer on the TON blockchain; the same for all transactions related to the offer
    , counterparty_address :: Maybe T.Text        -- ^ Address of the seller on the TON blockchain; may be empty if unknown
    , price                :: Maybe Int           -- ^ The offered price for the NFT without the service fee and blockchain fees, in the smallest units of TON Grams; 0 if unknown
    , TonWalletTransactionType -> Maybe Int
refund_amount        :: Maybe Int           -- ^ The amount returned to the buyer, in the smallest units of TON Grams
    , TonWalletTransactionType -> Maybe Int
fine_amount          :: Maybe Int           -- ^ The fine for the cancellation of the offer, in the smallest units of TON Grams; -1 if unknown
    }
  | TonWalletTransactionTypeTelegramGiftOfferDecline -- ^ An offer to buy a Telegram gift was declined by the owner of the NFT or canceled by Telegram on the TON blockchain
    { nft                  :: Maybe TonNft.TonNft -- ^ The NFT for which the offer was created; may be null if unknown
    , offer_address        :: Maybe T.Text        -- ^ Address of the smart contract of the offer on the TON blockchain; the same for all transactions related to the offer
    , counterparty_address :: Maybe T.Text        -- ^ Address of the seller on the TON blockchain; may be empty if unknown
    , price                :: Maybe Int           -- ^ The offered price for the NFT without the service fee and blockchain fees, in the smallest units of TON Grams; 0 if unknown
    , refund_amount        :: Maybe Int           -- ^ The amount returned to the buyer, in the smallest units of TON Grams
    }
  | TonWalletTransactionTypeTelegramGiftOfferExpiration -- ^ An offer to buy a Telegram gift has expired on the TON blockchain
    { nft                  :: Maybe TonNft.TonNft -- ^ The NFT for which the offer was created; may be null if unknown
    , offer_address        :: Maybe T.Text        -- ^ Address of the smart contract of the offer on the TON blockchain; the same for all transactions related to the offer
    , counterparty_address :: Maybe T.Text        -- ^ Address of the seller on the TON blockchain; may be empty if unknown
    , price                :: Maybe Int           -- ^ The offered price for the NFT without the service fee and blockchain fees, in the smallest units of TON Grams; 0 if unknown
    , refund_amount        :: Maybe Int           -- ^ The amount returned to the buyer, in the smallest units of TON Grams
    }
  | TonWalletTransactionTypeKeyChange -- ^ Change of the wallet key
  deriving (TonWalletTransactionType -> TonWalletTransactionType -> Bool
(TonWalletTransactionType -> TonWalletTransactionType -> Bool)
-> (TonWalletTransactionType -> TonWalletTransactionType -> Bool)
-> Eq TonWalletTransactionType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TonWalletTransactionType -> TonWalletTransactionType -> Bool
== :: TonWalletTransactionType -> TonWalletTransactionType -> Bool
$c/= :: TonWalletTransactionType -> TonWalletTransactionType -> Bool
/= :: TonWalletTransactionType -> TonWalletTransactionType -> Bool
Eq, Int -> TonWalletTransactionType -> ShowS
[TonWalletTransactionType] -> ShowS
TonWalletTransactionType -> String
(Int -> TonWalletTransactionType -> ShowS)
-> (TonWalletTransactionType -> String)
-> ([TonWalletTransactionType] -> ShowS)
-> Show TonWalletTransactionType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TonWalletTransactionType -> ShowS
showsPrec :: Int -> TonWalletTransactionType -> ShowS
$cshow :: TonWalletTransactionType -> String
show :: TonWalletTransactionType -> String
$cshowList :: [TonWalletTransactionType] -> ShowS
showList :: [TonWalletTransactionType] -> ShowS
Show)

instance I.ShortShow TonWalletTransactionType where
  shortShow :: TonWalletTransactionType -> String
shortShow TonWalletTransactionTypeOnRampDeposit
    { amount :: TonWalletTransactionType -> Maybe Int
amount        = Maybe Int
amount_
    , provider_name :: TonWalletTransactionType -> Maybe Text
provider_name = Maybe Text
provider_name_
    }
      = String
"TonWalletTransactionTypeOnRampDeposit"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"amount"        String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
amount_
        , String
"provider_name" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
provider_name_
        ]
  shortShow TonWalletTransactionTypeTransfer
    { amount :: TonWalletTransactionType -> Maybe Int
amount               = Maybe Int
amount_
    , is_gasless :: TonWalletTransactionType -> Maybe Bool
is_gasless           = Maybe Bool
is_gasless_
    , comment :: TonWalletTransactionType -> Maybe Text
comment              = Maybe Text
comment_
    , is_comment_encrypted :: TonWalletTransactionType -> Maybe Bool
is_comment_encrypted = Maybe Bool
is_comment_encrypted_
    }
      = String
"TonWalletTransactionTypeTransfer"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"amount"               String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
amount_
        , String
"is_gasless"           String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_gasless_
        , String
"comment"              String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
comment_
        , String
"is_comment_encrypted" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_comment_encrypted_
        ]
  shortShow TonWalletTransactionTypeNftTransfer
    { nft :: TonWalletTransactionType -> Maybe TonNft
nft                  = Maybe TonNft
nft_
    , is_outgoing :: TonWalletTransactionType -> Maybe Bool
is_outgoing          = Maybe Bool
is_outgoing_
    , comment :: TonWalletTransactionType -> Maybe Text
comment              = Maybe Text
comment_
    , is_comment_encrypted :: TonWalletTransactionType -> Maybe Bool
is_comment_encrypted = Maybe Bool
is_comment_encrypted_
    }
      = String
"TonWalletTransactionTypeNftTransfer"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"nft"                  String -> Maybe TonNft -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe TonNft
nft_
        , String
"is_outgoing"          String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_outgoing_
        , String
"comment"              String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
comment_
        , String
"is_comment_encrypted" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_comment_encrypted_
        ]
  shortShow TonWalletTransactionTypeTelegramGiftTransfer
    { nft :: TonWalletTransactionType -> Maybe TonNft
nft         = Maybe TonNft
nft_
    , is_outgoing :: TonWalletTransactionType -> Maybe Bool
is_outgoing = Maybe Bool
is_outgoing_
    , is_saved :: TonWalletTransactionType -> Maybe Bool
is_saved    = Maybe Bool
is_saved_
    }
      = String
"TonWalletTransactionTypeTelegramGiftTransfer"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"nft"         String -> Maybe TonNft -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe TonNft
nft_
        , String
"is_outgoing" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_outgoing_
        , String
"is_saved"    String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_saved_
        ]
  shortShow TonWalletTransactionTypeTelegramGiftPurchase
    { nft :: TonWalletTransactionType -> Maybe TonNft
nft    = Maybe TonNft
nft_
    , amount :: TonWalletTransactionType -> Maybe Int
amount = Maybe Int
amount_
    }
      = String
"TonWalletTransactionTypeTelegramGiftPurchase"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"nft"    String -> Maybe TonNft -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe TonNft
nft_
        , String
"amount" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
amount_
        ]
  shortShow TonWalletTransactionTypeTelegramGiftSale
    { nft :: TonWalletTransactionType -> Maybe TonNft
nft    = Maybe TonNft
nft_
    , amount :: TonWalletTransactionType -> Maybe Int
amount = Maybe Int
amount_
    }
      = String
"TonWalletTransactionTypeTelegramGiftSale"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"nft"    String -> Maybe TonNft -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe TonNft
nft_
        , String
"amount" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
amount_
        ]
  shortShow TonWalletTransactionTypeTelegramGiftListing
    { nft :: TonWalletTransactionType -> Maybe TonNft
nft       = Maybe TonNft
nft_
    , old_price :: TonWalletTransactionType -> Maybe Int
old_price = Maybe Int
old_price_
    , price :: TonWalletTransactionType -> Maybe Int
price     = Maybe Int
price_
    , amount :: TonWalletTransactionType -> Maybe Int
amount    = Maybe Int
amount_
    }
      = String
"TonWalletTransactionTypeTelegramGiftListing"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"nft"       String -> Maybe TonNft -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe TonNft
nft_
        , String
"old_price" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
old_price_
        , String
"price"     String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
price_
        , String
"amount"    String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
amount_
        ]
  shortShow TonWalletTransactionTypeTelegramGiftDelisting
    { nft :: TonWalletTransactionType -> Maybe TonNft
nft    = Maybe TonNft
nft_
    , amount :: TonWalletTransactionType -> Maybe Int
amount = Maybe Int
amount_
    }
      = String
"TonWalletTransactionTypeTelegramGiftDelisting"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"nft"    String -> Maybe TonNft -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe TonNft
nft_
        , String
"amount" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
amount_
        ]
  shortShow TonWalletTransactionTypeTelegramGiftOfferCreation
    { nft :: TonWalletTransactionType -> Maybe TonNft
nft                  = Maybe TonNft
nft_
    , offer_address :: TonWalletTransactionType -> Maybe Text
offer_address        = Maybe Text
offer_address_
    , counterparty_address :: TonWalletTransactionType -> Maybe Text
counterparty_address = Maybe Text
counterparty_address_
    , price :: TonWalletTransactionType -> Maybe Int
price                = Maybe Int
price_
    , amount :: TonWalletTransactionType -> Maybe Int
amount               = Maybe Int
amount_
    , service_fee_amount :: TonWalletTransactionType -> Maybe Int
service_fee_amount   = Maybe Int
service_fee_amount_
    , expiration_date :: TonWalletTransactionType -> Maybe Int
expiration_date      = Maybe Int
expiration_date_
    }
      = String
"TonWalletTransactionTypeTelegramGiftOfferCreation"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"nft"                  String -> Maybe TonNft -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe TonNft
nft_
        , String
"offer_address"        String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
offer_address_
        , String
"counterparty_address" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
counterparty_address_
        , String
"price"                String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
price_
        , String
"amount"               String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
amount_
        , String
"service_fee_amount"   String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
service_fee_amount_
        , String
"expiration_date"      String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
expiration_date_
        ]
  shortShow TonWalletTransactionTypeTelegramGiftOfferAcceptance
    { nft :: TonWalletTransactionType -> Maybe TonNft
nft                  = Maybe TonNft
nft_
    , is_buyer :: TonWalletTransactionType -> Maybe Bool
is_buyer             = Maybe Bool
is_buyer_
    , offer_address :: TonWalletTransactionType -> Maybe Text
offer_address        = Maybe Text
offer_address_
    , counterparty_address :: TonWalletTransactionType -> Maybe Text
counterparty_address = Maybe Text
counterparty_address_
    , price :: TonWalletTransactionType -> Maybe Int
price                = Maybe Int
price_
    , service_fee_amount :: TonWalletTransactionType -> Maybe Int
service_fee_amount   = Maybe Int
service_fee_amount_
    }
      = String
"TonWalletTransactionTypeTelegramGiftOfferAcceptance"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"nft"                  String -> Maybe TonNft -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe TonNft
nft_
        , String
"is_buyer"             String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_buyer_
        , String
"offer_address"        String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
offer_address_
        , String
"counterparty_address" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
counterparty_address_
        , String
"price"                String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
price_
        , String
"service_fee_amount"   String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
service_fee_amount_
        ]
  shortShow TonWalletTransactionTypeTelegramGiftOfferCancellation
    { nft :: TonWalletTransactionType -> Maybe TonNft
nft                  = Maybe TonNft
nft_
    , offer_address :: TonWalletTransactionType -> Maybe Text
offer_address        = Maybe Text
offer_address_
    , counterparty_address :: TonWalletTransactionType -> Maybe Text
counterparty_address = Maybe Text
counterparty_address_
    , price :: TonWalletTransactionType -> Maybe Int
price                = Maybe Int
price_
    , refund_amount :: TonWalletTransactionType -> Maybe Int
refund_amount        = Maybe Int
refund_amount_
    , fine_amount :: TonWalletTransactionType -> Maybe Int
fine_amount          = Maybe Int
fine_amount_
    }
      = String
"TonWalletTransactionTypeTelegramGiftOfferCancellation"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"nft"                  String -> Maybe TonNft -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe TonNft
nft_
        , String
"offer_address"        String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
offer_address_
        , String
"counterparty_address" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
counterparty_address_
        , String
"price"                String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
price_
        , String
"refund_amount"        String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
refund_amount_
        , String
"fine_amount"          String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
fine_amount_
        ]
  shortShow TonWalletTransactionTypeTelegramGiftOfferDecline
    { nft :: TonWalletTransactionType -> Maybe TonNft
nft                  = Maybe TonNft
nft_
    , offer_address :: TonWalletTransactionType -> Maybe Text
offer_address        = Maybe Text
offer_address_
    , counterparty_address :: TonWalletTransactionType -> Maybe Text
counterparty_address = Maybe Text
counterparty_address_
    , price :: TonWalletTransactionType -> Maybe Int
price                = Maybe Int
price_
    , refund_amount :: TonWalletTransactionType -> Maybe Int
refund_amount        = Maybe Int
refund_amount_
    }
      = String
"TonWalletTransactionTypeTelegramGiftOfferDecline"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"nft"                  String -> Maybe TonNft -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe TonNft
nft_
        , String
"offer_address"        String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
offer_address_
        , String
"counterparty_address" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
counterparty_address_
        , String
"price"                String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
price_
        , String
"refund_amount"        String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
refund_amount_
        ]
  shortShow TonWalletTransactionTypeTelegramGiftOfferExpiration
    { nft :: TonWalletTransactionType -> Maybe TonNft
nft                  = Maybe TonNft
nft_
    , offer_address :: TonWalletTransactionType -> Maybe Text
offer_address        = Maybe Text
offer_address_
    , counterparty_address :: TonWalletTransactionType -> Maybe Text
counterparty_address = Maybe Text
counterparty_address_
    , price :: TonWalletTransactionType -> Maybe Int
price                = Maybe Int
price_
    , refund_amount :: TonWalletTransactionType -> Maybe Int
refund_amount        = Maybe Int
refund_amount_
    }
      = String
"TonWalletTransactionTypeTelegramGiftOfferExpiration"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"nft"                  String -> Maybe TonNft -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe TonNft
nft_
        , String
"offer_address"        String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
offer_address_
        , String
"counterparty_address" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
counterparty_address_
        , String
"price"                String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
price_
        , String
"refund_amount"        String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
refund_amount_
        ]
  shortShow TonWalletTransactionType
TonWalletTransactionTypeKeyChange
      = String
"TonWalletTransactionTypeKeyChange"

instance AT.FromJSON TonWalletTransactionType where
  parseJSON :: Value -> Parser TonWalletTransactionType
parseJSON v :: Value
v@(AT.Object Object
obj) = do
    String
t <- Object
obj Object -> Key -> Parser String
forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"@type" :: AT.Parser String

    case String
t of
      String
"tonWalletTransactionTypeOnRampDeposit"                 -> Value -> Parser TonWalletTransactionType
parseTonWalletTransactionTypeOnRampDeposit Value
v
      String
"tonWalletTransactionTypeTransfer"                      -> Value -> Parser TonWalletTransactionType
parseTonWalletTransactionTypeTransfer Value
v
      String
"tonWalletTransactionTypeNftTransfer"                   -> Value -> Parser TonWalletTransactionType
parseTonWalletTransactionTypeNftTransfer Value
v
      String
"tonWalletTransactionTypeTelegramGiftTransfer"          -> Value -> Parser TonWalletTransactionType
parseTonWalletTransactionTypeTelegramGiftTransfer Value
v
      String
"tonWalletTransactionTypeTelegramGiftPurchase"          -> Value -> Parser TonWalletTransactionType
parseTonWalletTransactionTypeTelegramGiftPurchase Value
v
      String
"tonWalletTransactionTypeTelegramGiftSale"              -> Value -> Parser TonWalletTransactionType
parseTonWalletTransactionTypeTelegramGiftSale Value
v
      String
"tonWalletTransactionTypeTelegramGiftListing"           -> Value -> Parser TonWalletTransactionType
parseTonWalletTransactionTypeTelegramGiftListing Value
v
      String
"tonWalletTransactionTypeTelegramGiftDelisting"         -> Value -> Parser TonWalletTransactionType
parseTonWalletTransactionTypeTelegramGiftDelisting Value
v
      String
"tonWalletTransactionTypeTelegramGiftOfferCreation"     -> Value -> Parser TonWalletTransactionType
parseTonWalletTransactionTypeTelegramGiftOfferCreation Value
v
      String
"tonWalletTransactionTypeTelegramGiftOfferAcceptance"   -> Value -> Parser TonWalletTransactionType
parseTonWalletTransactionTypeTelegramGiftOfferAcceptance Value
v
      String
"tonWalletTransactionTypeTelegramGiftOfferCancellation" -> Value -> Parser TonWalletTransactionType
parseTonWalletTransactionTypeTelegramGiftOfferCancellation Value
v
      String
"tonWalletTransactionTypeTelegramGiftOfferDecline"      -> Value -> Parser TonWalletTransactionType
parseTonWalletTransactionTypeTelegramGiftOfferDecline Value
v
      String
"tonWalletTransactionTypeTelegramGiftOfferExpiration"   -> Value -> Parser TonWalletTransactionType
parseTonWalletTransactionTypeTelegramGiftOfferExpiration Value
v
      String
"tonWalletTransactionTypeKeyChange"                     -> TonWalletTransactionType -> Parser TonWalletTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure TonWalletTransactionType
TonWalletTransactionTypeKeyChange
      String
_                                                       -> Parser TonWalletTransactionType
forall a. Monoid a => a
mempty
    
    where
      parseTonWalletTransactionTypeOnRampDeposit :: A.Value -> AT.Parser TonWalletTransactionType
      parseTonWalletTransactionTypeOnRampDeposit :: Value -> Parser TonWalletTransactionType
parseTonWalletTransactionTypeOnRampDeposit = String
-> (Object -> Parser TonWalletTransactionType)
-> Value
-> Parser TonWalletTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"TonWalletTransactionTypeOnRampDeposit" ((Object -> Parser TonWalletTransactionType)
 -> Value -> Parser TonWalletTransactionType)
-> (Object -> Parser TonWalletTransactionType)
-> Value
-> Parser TonWalletTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Int
amount_        <- (String -> Int) -> Maybe String -> Maybe Int
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Int
I.readInt64 (Maybe String -> Maybe Int)
-> Parser (Maybe String) -> Parser (Maybe Int)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser (Maybe String)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"amount"
        Maybe Text
provider_name_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"provider_name"
        TonWalletTransactionType -> Parser TonWalletTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TonWalletTransactionType -> Parser TonWalletTransactionType)
-> TonWalletTransactionType -> Parser TonWalletTransactionType
forall a b. (a -> b) -> a -> b
$ TonWalletTransactionTypeOnRampDeposit
          { amount :: Maybe Int
amount        = Maybe Int
amount_
          , provider_name :: Maybe Text
provider_name = Maybe Text
provider_name_
          }
      parseTonWalletTransactionTypeTransfer :: A.Value -> AT.Parser TonWalletTransactionType
      parseTonWalletTransactionTypeTransfer :: Value -> Parser TonWalletTransactionType
parseTonWalletTransactionTypeTransfer = String
-> (Object -> Parser TonWalletTransactionType)
-> Value
-> Parser TonWalletTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"TonWalletTransactionTypeTransfer" ((Object -> Parser TonWalletTransactionType)
 -> Value -> Parser TonWalletTransactionType)
-> (Object -> Parser TonWalletTransactionType)
-> Value
-> Parser TonWalletTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Int
amount_               <- (String -> Int) -> Maybe String -> Maybe Int
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Int
I.readInt64 (Maybe String -> Maybe Int)
-> Parser (Maybe String) -> Parser (Maybe Int)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser (Maybe String)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"amount"
        Maybe Bool
is_gasless_           <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"is_gasless"
        Maybe Text
comment_              <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"comment"
        Maybe Bool
is_comment_encrypted_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"is_comment_encrypted"
        TonWalletTransactionType -> Parser TonWalletTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TonWalletTransactionType -> Parser TonWalletTransactionType)
-> TonWalletTransactionType -> Parser TonWalletTransactionType
forall a b. (a -> b) -> a -> b
$ TonWalletTransactionTypeTransfer
          { amount :: Maybe Int
amount               = Maybe Int
amount_
          , is_gasless :: Maybe Bool
is_gasless           = Maybe Bool
is_gasless_
          , comment :: Maybe Text
comment              = Maybe Text
comment_
          , is_comment_encrypted :: Maybe Bool
is_comment_encrypted = Maybe Bool
is_comment_encrypted_
          }
      parseTonWalletTransactionTypeNftTransfer :: A.Value -> AT.Parser TonWalletTransactionType
      parseTonWalletTransactionTypeNftTransfer :: Value -> Parser TonWalletTransactionType
parseTonWalletTransactionTypeNftTransfer = String
-> (Object -> Parser TonWalletTransactionType)
-> Value
-> Parser TonWalletTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"TonWalletTransactionTypeNftTransfer" ((Object -> Parser TonWalletTransactionType)
 -> Value -> Parser TonWalletTransactionType)
-> (Object -> Parser TonWalletTransactionType)
-> Value
-> Parser TonWalletTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe TonNft
nft_                  <- Object
o Object -> Key -> Parser (Maybe TonNft)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"nft"
        Maybe Bool
is_outgoing_          <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"is_outgoing"
        Maybe Text
comment_              <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"comment"
        Maybe Bool
is_comment_encrypted_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"is_comment_encrypted"
        TonWalletTransactionType -> Parser TonWalletTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TonWalletTransactionType -> Parser TonWalletTransactionType)
-> TonWalletTransactionType -> Parser TonWalletTransactionType
forall a b. (a -> b) -> a -> b
$ TonWalletTransactionTypeNftTransfer
          { nft :: Maybe TonNft
nft                  = Maybe TonNft
nft_
          , is_outgoing :: Maybe Bool
is_outgoing          = Maybe Bool
is_outgoing_
          , comment :: Maybe Text
comment              = Maybe Text
comment_
          , is_comment_encrypted :: Maybe Bool
is_comment_encrypted = Maybe Bool
is_comment_encrypted_
          }
      parseTonWalletTransactionTypeTelegramGiftTransfer :: A.Value -> AT.Parser TonWalletTransactionType
      parseTonWalletTransactionTypeTelegramGiftTransfer :: Value -> Parser TonWalletTransactionType
parseTonWalletTransactionTypeTelegramGiftTransfer = String
-> (Object -> Parser TonWalletTransactionType)
-> Value
-> Parser TonWalletTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"TonWalletTransactionTypeTelegramGiftTransfer" ((Object -> Parser TonWalletTransactionType)
 -> Value -> Parser TonWalletTransactionType)
-> (Object -> Parser TonWalletTransactionType)
-> Value
-> Parser TonWalletTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe TonNft
nft_         <- Object
o Object -> Key -> Parser (Maybe TonNft)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"nft"
        Maybe Bool
is_outgoing_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"is_outgoing"
        Maybe Bool
is_saved_    <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"is_saved"
        TonWalletTransactionType -> Parser TonWalletTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TonWalletTransactionType -> Parser TonWalletTransactionType)
-> TonWalletTransactionType -> Parser TonWalletTransactionType
forall a b. (a -> b) -> a -> b
$ TonWalletTransactionTypeTelegramGiftTransfer
          { nft :: Maybe TonNft
nft         = Maybe TonNft
nft_
          , is_outgoing :: Maybe Bool
is_outgoing = Maybe Bool
is_outgoing_
          , is_saved :: Maybe Bool
is_saved    = Maybe Bool
is_saved_
          }
      parseTonWalletTransactionTypeTelegramGiftPurchase :: A.Value -> AT.Parser TonWalletTransactionType
      parseTonWalletTransactionTypeTelegramGiftPurchase :: Value -> Parser TonWalletTransactionType
parseTonWalletTransactionTypeTelegramGiftPurchase = String
-> (Object -> Parser TonWalletTransactionType)
-> Value
-> Parser TonWalletTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"TonWalletTransactionTypeTelegramGiftPurchase" ((Object -> Parser TonWalletTransactionType)
 -> Value -> Parser TonWalletTransactionType)
-> (Object -> Parser TonWalletTransactionType)
-> Value
-> Parser TonWalletTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe TonNft
nft_    <- Object
o Object -> Key -> Parser (Maybe TonNft)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"nft"
        Maybe Int
amount_ <- (String -> Int) -> Maybe String -> Maybe Int
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Int
I.readInt64 (Maybe String -> Maybe Int)
-> Parser (Maybe String) -> Parser (Maybe Int)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser (Maybe String)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"amount"
        TonWalletTransactionType -> Parser TonWalletTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TonWalletTransactionType -> Parser TonWalletTransactionType)
-> TonWalletTransactionType -> Parser TonWalletTransactionType
forall a b. (a -> b) -> a -> b
$ TonWalletTransactionTypeTelegramGiftPurchase
          { nft :: Maybe TonNft
nft    = Maybe TonNft
nft_
          , amount :: Maybe Int
amount = Maybe Int
amount_
          }
      parseTonWalletTransactionTypeTelegramGiftSale :: A.Value -> AT.Parser TonWalletTransactionType
      parseTonWalletTransactionTypeTelegramGiftSale :: Value -> Parser TonWalletTransactionType
parseTonWalletTransactionTypeTelegramGiftSale = String
-> (Object -> Parser TonWalletTransactionType)
-> Value
-> Parser TonWalletTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"TonWalletTransactionTypeTelegramGiftSale" ((Object -> Parser TonWalletTransactionType)
 -> Value -> Parser TonWalletTransactionType)
-> (Object -> Parser TonWalletTransactionType)
-> Value
-> Parser TonWalletTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe TonNft
nft_    <- Object
o Object -> Key -> Parser (Maybe TonNft)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"nft"
        Maybe Int
amount_ <- (String -> Int) -> Maybe String -> Maybe Int
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Int
I.readInt64 (Maybe String -> Maybe Int)
-> Parser (Maybe String) -> Parser (Maybe Int)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser (Maybe String)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"amount"
        TonWalletTransactionType -> Parser TonWalletTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TonWalletTransactionType -> Parser TonWalletTransactionType)
-> TonWalletTransactionType -> Parser TonWalletTransactionType
forall a b. (a -> b) -> a -> b
$ TonWalletTransactionTypeTelegramGiftSale
          { nft :: Maybe TonNft
nft    = Maybe TonNft
nft_
          , amount :: Maybe Int
amount = Maybe Int
amount_
          }
      parseTonWalletTransactionTypeTelegramGiftListing :: A.Value -> AT.Parser TonWalletTransactionType
      parseTonWalletTransactionTypeTelegramGiftListing :: Value -> Parser TonWalletTransactionType
parseTonWalletTransactionTypeTelegramGiftListing = String
-> (Object -> Parser TonWalletTransactionType)
-> Value
-> Parser TonWalletTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"TonWalletTransactionTypeTelegramGiftListing" ((Object -> Parser TonWalletTransactionType)
 -> Value -> Parser TonWalletTransactionType)
-> (Object -> Parser TonWalletTransactionType)
-> Value
-> Parser TonWalletTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe TonNft
nft_       <- Object
o Object -> Key -> Parser (Maybe TonNft)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"nft"
        Maybe Int
old_price_ <- (String -> Int) -> Maybe String -> Maybe Int
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Int
I.readInt64 (Maybe String -> Maybe Int)
-> Parser (Maybe String) -> Parser (Maybe Int)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser (Maybe String)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"old_price"
        Maybe Int
price_     <- (String -> Int) -> Maybe String -> Maybe Int
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Int
I.readInt64 (Maybe String -> Maybe Int)
-> Parser (Maybe String) -> Parser (Maybe Int)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser (Maybe String)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"price"
        Maybe Int
amount_    <- (String -> Int) -> Maybe String -> Maybe Int
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Int
I.readInt64 (Maybe String -> Maybe Int)
-> Parser (Maybe String) -> Parser (Maybe Int)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser (Maybe String)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"amount"
        TonWalletTransactionType -> Parser TonWalletTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TonWalletTransactionType -> Parser TonWalletTransactionType)
-> TonWalletTransactionType -> Parser TonWalletTransactionType
forall a b. (a -> b) -> a -> b
$ TonWalletTransactionTypeTelegramGiftListing
          { nft :: Maybe TonNft
nft       = Maybe TonNft
nft_
          , old_price :: Maybe Int
old_price = Maybe Int
old_price_
          , price :: Maybe Int
price     = Maybe Int
price_
          , amount :: Maybe Int
amount    = Maybe Int
amount_
          }
      parseTonWalletTransactionTypeTelegramGiftDelisting :: A.Value -> AT.Parser TonWalletTransactionType
      parseTonWalletTransactionTypeTelegramGiftDelisting :: Value -> Parser TonWalletTransactionType
parseTonWalletTransactionTypeTelegramGiftDelisting = String
-> (Object -> Parser TonWalletTransactionType)
-> Value
-> Parser TonWalletTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"TonWalletTransactionTypeTelegramGiftDelisting" ((Object -> Parser TonWalletTransactionType)
 -> Value -> Parser TonWalletTransactionType)
-> (Object -> Parser TonWalletTransactionType)
-> Value
-> Parser TonWalletTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe TonNft
nft_    <- Object
o Object -> Key -> Parser (Maybe TonNft)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"nft"
        Maybe Int
amount_ <- (String -> Int) -> Maybe String -> Maybe Int
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Int
I.readInt64 (Maybe String -> Maybe Int)
-> Parser (Maybe String) -> Parser (Maybe Int)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser (Maybe String)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"amount"
        TonWalletTransactionType -> Parser TonWalletTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TonWalletTransactionType -> Parser TonWalletTransactionType)
-> TonWalletTransactionType -> Parser TonWalletTransactionType
forall a b. (a -> b) -> a -> b
$ TonWalletTransactionTypeTelegramGiftDelisting
          { nft :: Maybe TonNft
nft    = Maybe TonNft
nft_
          , amount :: Maybe Int
amount = Maybe Int
amount_
          }
      parseTonWalletTransactionTypeTelegramGiftOfferCreation :: A.Value -> AT.Parser TonWalletTransactionType
      parseTonWalletTransactionTypeTelegramGiftOfferCreation :: Value -> Parser TonWalletTransactionType
parseTonWalletTransactionTypeTelegramGiftOfferCreation = String
-> (Object -> Parser TonWalletTransactionType)
-> Value
-> Parser TonWalletTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"TonWalletTransactionTypeTelegramGiftOfferCreation" ((Object -> Parser TonWalletTransactionType)
 -> Value -> Parser TonWalletTransactionType)
-> (Object -> Parser TonWalletTransactionType)
-> Value
-> Parser TonWalletTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe TonNft
nft_                  <- Object
o Object -> Key -> Parser (Maybe TonNft)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"nft"
        Maybe Text
offer_address_        <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"offer_address"
        Maybe Text
counterparty_address_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"counterparty_address"
        Maybe Int
price_                <- (String -> Int) -> Maybe String -> Maybe Int
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Int
I.readInt64 (Maybe String -> Maybe Int)
-> Parser (Maybe String) -> Parser (Maybe Int)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser (Maybe String)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"price"
        Maybe Int
amount_               <- (String -> Int) -> Maybe String -> Maybe Int
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Int
I.readInt64 (Maybe String -> Maybe Int)
-> Parser (Maybe String) -> Parser (Maybe Int)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser (Maybe String)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"amount"
        Maybe Int
service_fee_amount_   <- (String -> Int) -> Maybe String -> Maybe Int
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Int
I.readInt64 (Maybe String -> Maybe Int)
-> Parser (Maybe String) -> Parser (Maybe Int)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser (Maybe String)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"service_fee_amount"
        Maybe Int
expiration_date_      <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"expiration_date"
        TonWalletTransactionType -> Parser TonWalletTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TonWalletTransactionType -> Parser TonWalletTransactionType)
-> TonWalletTransactionType -> Parser TonWalletTransactionType
forall a b. (a -> b) -> a -> b
$ TonWalletTransactionTypeTelegramGiftOfferCreation
          { nft :: Maybe TonNft
nft                  = Maybe TonNft
nft_
          , offer_address :: Maybe Text
offer_address        = Maybe Text
offer_address_
          , counterparty_address :: Maybe Text
counterparty_address = Maybe Text
counterparty_address_
          , price :: Maybe Int
price                = Maybe Int
price_
          , amount :: Maybe Int
amount               = Maybe Int
amount_
          , service_fee_amount :: Maybe Int
service_fee_amount   = Maybe Int
service_fee_amount_
          , expiration_date :: Maybe Int
expiration_date      = Maybe Int
expiration_date_
          }
      parseTonWalletTransactionTypeTelegramGiftOfferAcceptance :: A.Value -> AT.Parser TonWalletTransactionType
      parseTonWalletTransactionTypeTelegramGiftOfferAcceptance :: Value -> Parser TonWalletTransactionType
parseTonWalletTransactionTypeTelegramGiftOfferAcceptance = String
-> (Object -> Parser TonWalletTransactionType)
-> Value
-> Parser TonWalletTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"TonWalletTransactionTypeTelegramGiftOfferAcceptance" ((Object -> Parser TonWalletTransactionType)
 -> Value -> Parser TonWalletTransactionType)
-> (Object -> Parser TonWalletTransactionType)
-> Value
-> Parser TonWalletTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe TonNft
nft_                  <- Object
o Object -> Key -> Parser (Maybe TonNft)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"nft"
        Maybe Bool
is_buyer_             <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"is_buyer"
        Maybe Text
offer_address_        <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"offer_address"
        Maybe Text
counterparty_address_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"counterparty_address"
        Maybe Int
price_                <- (String -> Int) -> Maybe String -> Maybe Int
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Int
I.readInt64 (Maybe String -> Maybe Int)
-> Parser (Maybe String) -> Parser (Maybe Int)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser (Maybe String)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"price"
        Maybe Int
service_fee_amount_   <- (String -> Int) -> Maybe String -> Maybe Int
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Int
I.readInt64 (Maybe String -> Maybe Int)
-> Parser (Maybe String) -> Parser (Maybe Int)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser (Maybe String)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"service_fee_amount"
        TonWalletTransactionType -> Parser TonWalletTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TonWalletTransactionType -> Parser TonWalletTransactionType)
-> TonWalletTransactionType -> Parser TonWalletTransactionType
forall a b. (a -> b) -> a -> b
$ TonWalletTransactionTypeTelegramGiftOfferAcceptance
          { nft :: Maybe TonNft
nft                  = Maybe TonNft
nft_
          , is_buyer :: Maybe Bool
is_buyer             = Maybe Bool
is_buyer_
          , offer_address :: Maybe Text
offer_address        = Maybe Text
offer_address_
          , counterparty_address :: Maybe Text
counterparty_address = Maybe Text
counterparty_address_
          , price :: Maybe Int
price                = Maybe Int
price_
          , service_fee_amount :: Maybe Int
service_fee_amount   = Maybe Int
service_fee_amount_
          }
      parseTonWalletTransactionTypeTelegramGiftOfferCancellation :: A.Value -> AT.Parser TonWalletTransactionType
      parseTonWalletTransactionTypeTelegramGiftOfferCancellation :: Value -> Parser TonWalletTransactionType
parseTonWalletTransactionTypeTelegramGiftOfferCancellation = String
-> (Object -> Parser TonWalletTransactionType)
-> Value
-> Parser TonWalletTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"TonWalletTransactionTypeTelegramGiftOfferCancellation" ((Object -> Parser TonWalletTransactionType)
 -> Value -> Parser TonWalletTransactionType)
-> (Object -> Parser TonWalletTransactionType)
-> Value
-> Parser TonWalletTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe TonNft
nft_                  <- Object
o Object -> Key -> Parser (Maybe TonNft)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"nft"
        Maybe Text
offer_address_        <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"offer_address"
        Maybe Text
counterparty_address_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"counterparty_address"
        Maybe Int
price_                <- (String -> Int) -> Maybe String -> Maybe Int
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Int
I.readInt64 (Maybe String -> Maybe Int)
-> Parser (Maybe String) -> Parser (Maybe Int)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser (Maybe String)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"price"
        Maybe Int
refund_amount_        <- (String -> Int) -> Maybe String -> Maybe Int
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Int
I.readInt64 (Maybe String -> Maybe Int)
-> Parser (Maybe String) -> Parser (Maybe Int)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser (Maybe String)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"refund_amount"
        Maybe Int
fine_amount_          <- (String -> Int) -> Maybe String -> Maybe Int
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Int
I.readInt64 (Maybe String -> Maybe Int)
-> Parser (Maybe String) -> Parser (Maybe Int)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser (Maybe String)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"fine_amount"
        TonWalletTransactionType -> Parser TonWalletTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TonWalletTransactionType -> Parser TonWalletTransactionType)
-> TonWalletTransactionType -> Parser TonWalletTransactionType
forall a b. (a -> b) -> a -> b
$ TonWalletTransactionTypeTelegramGiftOfferCancellation
          { nft :: Maybe TonNft
nft                  = Maybe TonNft
nft_
          , offer_address :: Maybe Text
offer_address        = Maybe Text
offer_address_
          , counterparty_address :: Maybe Text
counterparty_address = Maybe Text
counterparty_address_
          , price :: Maybe Int
price                = Maybe Int
price_
          , refund_amount :: Maybe Int
refund_amount        = Maybe Int
refund_amount_
          , fine_amount :: Maybe Int
fine_amount          = Maybe Int
fine_amount_
          }
      parseTonWalletTransactionTypeTelegramGiftOfferDecline :: A.Value -> AT.Parser TonWalletTransactionType
      parseTonWalletTransactionTypeTelegramGiftOfferDecline :: Value -> Parser TonWalletTransactionType
parseTonWalletTransactionTypeTelegramGiftOfferDecline = String
-> (Object -> Parser TonWalletTransactionType)
-> Value
-> Parser TonWalletTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"TonWalletTransactionTypeTelegramGiftOfferDecline" ((Object -> Parser TonWalletTransactionType)
 -> Value -> Parser TonWalletTransactionType)
-> (Object -> Parser TonWalletTransactionType)
-> Value
-> Parser TonWalletTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe TonNft
nft_                  <- Object
o Object -> Key -> Parser (Maybe TonNft)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"nft"
        Maybe Text
offer_address_        <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"offer_address"
        Maybe Text
counterparty_address_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"counterparty_address"
        Maybe Int
price_                <- (String -> Int) -> Maybe String -> Maybe Int
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Int
I.readInt64 (Maybe String -> Maybe Int)
-> Parser (Maybe String) -> Parser (Maybe Int)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser (Maybe String)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"price"
        Maybe Int
refund_amount_        <- (String -> Int) -> Maybe String -> Maybe Int
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Int
I.readInt64 (Maybe String -> Maybe Int)
-> Parser (Maybe String) -> Parser (Maybe Int)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser (Maybe String)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"refund_amount"
        TonWalletTransactionType -> Parser TonWalletTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TonWalletTransactionType -> Parser TonWalletTransactionType)
-> TonWalletTransactionType -> Parser TonWalletTransactionType
forall a b. (a -> b) -> a -> b
$ TonWalletTransactionTypeTelegramGiftOfferDecline
          { nft :: Maybe TonNft
nft                  = Maybe TonNft
nft_
          , offer_address :: Maybe Text
offer_address        = Maybe Text
offer_address_
          , counterparty_address :: Maybe Text
counterparty_address = Maybe Text
counterparty_address_
          , price :: Maybe Int
price                = Maybe Int
price_
          , refund_amount :: Maybe Int
refund_amount        = Maybe Int
refund_amount_
          }
      parseTonWalletTransactionTypeTelegramGiftOfferExpiration :: A.Value -> AT.Parser TonWalletTransactionType
      parseTonWalletTransactionTypeTelegramGiftOfferExpiration :: Value -> Parser TonWalletTransactionType
parseTonWalletTransactionTypeTelegramGiftOfferExpiration = String
-> (Object -> Parser TonWalletTransactionType)
-> Value
-> Parser TonWalletTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"TonWalletTransactionTypeTelegramGiftOfferExpiration" ((Object -> Parser TonWalletTransactionType)
 -> Value -> Parser TonWalletTransactionType)
-> (Object -> Parser TonWalletTransactionType)
-> Value
-> Parser TonWalletTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe TonNft
nft_                  <- Object
o Object -> Key -> Parser (Maybe TonNft)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"nft"
        Maybe Text
offer_address_        <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"offer_address"
        Maybe Text
counterparty_address_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"counterparty_address"
        Maybe Int
price_                <- (String -> Int) -> Maybe String -> Maybe Int
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Int
I.readInt64 (Maybe String -> Maybe Int)
-> Parser (Maybe String) -> Parser (Maybe Int)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser (Maybe String)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"price"
        Maybe Int
refund_amount_        <- (String -> Int) -> Maybe String -> Maybe Int
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Int
I.readInt64 (Maybe String -> Maybe Int)
-> Parser (Maybe String) -> Parser (Maybe Int)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser (Maybe String)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"refund_amount"
        TonWalletTransactionType -> Parser TonWalletTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TonWalletTransactionType -> Parser TonWalletTransactionType)
-> TonWalletTransactionType -> Parser TonWalletTransactionType
forall a b. (a -> b) -> a -> b
$ TonWalletTransactionTypeTelegramGiftOfferExpiration
          { nft :: Maybe TonNft
nft                  = Maybe TonNft
nft_
          , offer_address :: Maybe Text
offer_address        = Maybe Text
offer_address_
          , counterparty_address :: Maybe Text
counterparty_address = Maybe Text
counterparty_address_
          , price :: Maybe Int
price                = Maybe Int
price_
          , refund_amount :: Maybe Int
refund_amount        = Maybe Int
refund_amount_
          }
  parseJSON Value
_ = Parser TonWalletTransactionType
forall a. Monoid a => a
mempty