From f2de58ca369993935c9292feb567fd77503f4d84 Mon Sep 17 00:00:00 2001 From: Reckless_Satoshi Date: Sun, 7 May 2023 04:11:40 -0700 Subject: [PATCH] Add hash/preimage or address/txid to trade summary report --- api/logics.py | 17 +++++------------ .../src/components/TradeBox/TradeSummary.tsx | 1 - frontend/src/models/Order.model.ts | 4 ++++ 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/api/logics.py b/api/logics.py index daa97a91..e44e7f6a 100644 --- a/api/logics.py +++ b/api/logics.py @@ -1708,6 +1708,8 @@ class Logics: summary["received_sats"] = order.payout_tx.sent_satoshis else: summary["received_sats"] = order.payout.num_satoshis + summary["payment_hash"] = order.payout.payment_hash + summary["preimage"] = order.payout.preimage summary["trade_fee_sats"] = round( order.last_satoshis - summary["received_sats"] @@ -1717,6 +1719,8 @@ class Logics: if users[order_user] == user and order.is_swap: summary["is_swap"] = order.is_swap summary["received_onchain_sats"] = order.payout_tx.sent_satoshis + summary["address"] = order.payout_tx.address + summary["txid"] = order.payout_tx.txid summary["mining_fee_sats"] = order.payout_tx.mining_fee_sats summary["swap_fee_sats"] = round( order.payout_tx.num_satoshis @@ -1752,19 +1756,8 @@ class Logics: ) if not order.is_swap: platform_summary["routing_budget_sats"] = order.payout.routing_budget_sats - # Start Deprecated after v0.3.1 - platform_summary["routing_fee_sats"] = order.payout.fee - # End Deprecated after v0.3.1 platform_summary["trade_revenue_sats"] = int( - order.trade_escrow.num_satoshis - - order.payout.num_satoshis - # Start Deprecated after v0.3.1 (will be `- order.payout.routing_budget_sats`) - - ( - order.payout.fee - if order.payout.routing_budget_sats == 0 - else order.payout.routing_budget_sats - ) - # End Deprecated after v0.3.1 + order.trade_escrow.num_satoshis - order.payout.num_satoshis ) else: platform_summary["routing_fee_sats"] = 0 diff --git a/frontend/src/components/TradeBox/TradeSummary.tsx b/frontend/src/components/TradeBox/TradeSummary.tsx index 96145425..6c036fef 100644 --- a/frontend/src/components/TradeBox/TradeSummary.tsx +++ b/frontend/src/components/TradeBox/TradeSummary.tsx @@ -24,7 +24,6 @@ import { Schedule, PriceChange, LockOpen, - Download, AccountBalance, Route, AccountBox, diff --git a/frontend/src/models/Order.model.ts b/frontend/src/models/Order.model.ts index 3074123f..08f152dc 100644 --- a/frontend/src/models/Order.model.ts +++ b/frontend/src/models/Order.model.ts @@ -9,6 +9,10 @@ export interface TradeRobotSummary { sent_sats: number; received_fiat: number; trade_fee_sats: number; + payment_hash?: string; + preimage?: string; + address?: string; + txid?: string; } export interface TradeCoordinatorSummary {