diff --git a/src/Pretty.hs b/src/Pretty.hs index 58639d9..8003f18 100644 --- a/src/Pretty.hs +++ b/src/Pretty.hs @@ -75,7 +75,7 @@ instance Pretty Operation where instance Pretty OperationBody where pretty (OperationBody'CREATE_ACCOUNT x) = pretty x pretty (OperationBody'PAYMENT x) = pretty x --- pretty (OperationBody'PATH_PAYMENT_STRICT_RECEIVE x) = pretty x + pretty (OperationBody'PATH_PAYMENT_STRICT_RECEIVE x) = pretty x pretty (OperationBody'MANAGE_SELL_OFFER x) = pretty x -- pretty (OperationBody'CREATE_PASSIVE_SELL_OFFER x) = pretty x pretty (OperationBody'SET_OPTIONS x) = pretty x @@ -86,7 +86,7 @@ instance Pretty OperationBody where pretty (OperationBody'MANAGE_DATA x) = pretty x -- pretty (OperationBody'BUMP_SEQUENCE x) = pretty x pretty (OperationBody'MANAGE_BUY_OFFER x) = pretty x --- pretty (OperationBody'PATH_PAYMENT_STRICT_SEND x) = pretty x + pretty (OperationBody'PATH_PAYMENT_STRICT_SEND x) = pretty x pretty (OperationBody'CREATE_CLAIMABLE_BALANCE x) = pretty x -- pretty (OperationBody'CLAIM_CLAIMABLE_BALANCE x) = pretty x pretty (OperationBody'BEGIN_SPONSORING_FUTURE_RESERVES (BeginSponsoringFutureReservesOp account)) = T.concat ["Sponsoring reserves for ", pretty account] @@ -142,6 +142,22 @@ instance Pretty ManageDataOp where pretty (ManageDataOp name Nothing) = T.concat ["Data ", utf8s name, " cleared"] pretty (ManageDataOp name (Just value)) = T.concat ["Data ", utf8s name, " = ", utf8s value] +instance Pretty PathPaymentStrictReceiveOp where + pretty (PathPaymentStrictReceiveOp sendAsset sendMax destination destAsset destAmount path) = + T.concat ["Send up to ", prettyAmount sendMax, " ", pretty sendAsset, " to ", pretty destination, + ", must receive ", prettyAmount destAmount, " ", pretty destAsset, + prettyPath path] + +instance Pretty PathPaymentStrictSendOp where + pretty (PathPaymentStrictSendOp sendAsset sendAmount destination destAsset destMin path) = + T.concat ["Send ", prettyAmount sendAmount, " ", pretty sendAsset, " to ", pretty destination, + ", must receive at least ", prettyAmount destMin, " ", pretty destAsset, + prettyPath path] + +prettyPath path + | V.null (unLengthArray path) = "" + | otherwise = T.concat [" via path: ", T.intercalate " -> " $ map pretty $ V.toList $ unLengthArray path] + instance Pretty ManageBuyOfferOp where pretty (ManageBuyOfferOp sellass buyass buyamount price offerid) = T.concat ["Buy ", prettyAmount buyamount, " ", pretty buyass, " for ", pretty sellass, " price ", pretty price, " ", prettyAssetName sellass, "/", prettyAssetName buyass, if offerid == 0 then " (new offer)" else T.concat [" (update offer ", T.show offerid, ")"]]