mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-31 02:21:35 +00:00
Add total time to contract completion to trade summary
This commit is contained in:
parent
456723973c
commit
916a5fdf5a
@ -1353,6 +1353,8 @@ class Logics:
|
||||
order.payout.save()
|
||||
order.save()
|
||||
send_message.delay(order.id,'trade_successful')
|
||||
order.contract_finalization_time = timezone.now()
|
||||
order.save()
|
||||
return True
|
||||
|
||||
# Pay onchain to address
|
||||
@ -1367,6 +1369,8 @@ class Logics:
|
||||
order.status = Order.Status.SUC
|
||||
order.save()
|
||||
send_message.delay(order.id,'trade_successful')
|
||||
order.contract_finalization_time = timezone.now()
|
||||
order.save()
|
||||
return True
|
||||
return False
|
||||
|
||||
@ -1616,6 +1620,7 @@ class Logics:
|
||||
platform_summary['contract_exchange_rate'] = float(order.amount) / (float(order.last_satoshis) / 100000000)
|
||||
if order.last_satoshis_time != None:
|
||||
platform_summary['contract_timestamp'] = order.last_satoshis_time
|
||||
platform_summary['contract_total_time'] = order.contract_finalization_time - order.last_satoshis_time
|
||||
if not order.is_swap:
|
||||
platform_summary['routing_fee_sats'] = order.payout.fee
|
||||
platform_summary['trade_revenue_sats'] = int(order.trade_escrow.num_satoshis - order.payout.num_satoshis - order.payout.fee)
|
||||
|
@ -394,7 +394,8 @@ class Order(models.Model):
|
||||
) # sats last time checked. Weird if 2* trade max...
|
||||
# timestamp of last_satoshis
|
||||
last_satoshis_time = models.DateTimeField(null=True, default=None, blank=True)
|
||||
|
||||
# time the fiat exchange is confirmed and Sats released to buyer
|
||||
contract_finalization_time = models.DateTimeField(null=True, default=None, blank=True)
|
||||
# order participants
|
||||
maker = models.ForeignKey(
|
||||
User,
|
||||
|
@ -5,8 +5,8 @@ export default function BasqueCountryFlag(props) {
|
||||
return (
|
||||
<SvgIcon {...props} x="0px" y="0px" viewBox="0 0 50 28">
|
||||
<path d="M0,0 v28 h50 v-28 z" fill="#D52B1E"/>
|
||||
<path d="M0,0 L50,28 M50,0 L0,28" stroke="#009B48" stroke-width="4.3"/>
|
||||
<path d="M25,0 v28 M0,14 h50" stroke="#fff" stroke-width="4.3"/>
|
||||
<path d="M0,0 L50,28 M50,0 L0,28" stroke="#009B48" strokeWidth="4.3"/>
|
||||
<path d="M25,0 v28 M0,14 h50" stroke="#fff" strokeWidth="4.3"/>
|
||||
</SvgIcon>
|
||||
);
|
||||
}
|
@ -5,7 +5,7 @@ export default function CataloniaFlag(props) {
|
||||
return (
|
||||
<SvgIcon {...props} x="0px" y="0px" viewBox="0 0 810 540">
|
||||
<rect width="810" height="540" fill="#FCDD09"/>
|
||||
<path stroke="#DA121A" stroke-width="60" d="M0,90H810m0,120H0m0,120H810m0,120H0"/>
|
||||
<path stroke="#DA121A" strokeWidth="60" d="M0,90H810m0,120H0m0,120H810m0,120H0"/>
|
||||
</SvgIcon>
|
||||
);
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
import React, { useState } from "react";
|
||||
import { format } from "date-fns";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import {
|
||||
Avatar,
|
||||
@ -59,10 +60,14 @@ const TradeSummary = ({
|
||||
platformSummary,
|
||||
orderId,
|
||||
}: Props): JSX.Element => {
|
||||
const { t } = useTranslation();
|
||||
const { t , i18n } = useTranslation();
|
||||
const [buttonValue, setButtonValue] = useState<number>(isMaker ? 0 : 2);
|
||||
var userSummary = buttonValue == 0 ? makerSummary : takerSummary;
|
||||
const contractTimestamp = new Date(platformSummary.contract_timestamp)
|
||||
const total_time = platformSummary.contract_total_time
|
||||
const hours = parseInt(total_time / 3600)
|
||||
const mins = parseInt((total_time - hours * 3600) / 60)
|
||||
const secs = parseInt(total_time - hours * 3600 - mins * 60)
|
||||
|
||||
return (
|
||||
<Grid item xs={12} align="center">
|
||||
@ -156,7 +161,7 @@ const TradeSummary = ({
|
||||
secondary={userSummary.is_buyer ? "BTC received" : "BTC sent"}/>
|
||||
|
||||
<ListItemText
|
||||
primary={t("{{tradeFeeSats}} Sats ({{tradeFeePercent}}%)",{tradeFeeSats:userSummary.trade_fee_sats,tradeFeePercent:parseFloat((userSummary.trade_fee_percent*100).toPrecision(3))})}
|
||||
primary={t("{{tradeFeeSats}} Sats ({{tradeFeePercent}}%)",{tradeFeeSats:pn(userSummary.trade_fee_sats),tradeFeePercent:parseFloat((userSummary.trade_fee_percent*100).toPrecision(3))})}
|
||||
secondary={"Trade fee"}/>
|
||||
</ListItem>
|
||||
|
||||
@ -169,7 +174,7 @@ const TradeSummary = ({
|
||||
primary={t("{{swapFeeSats}} Sats ({{swapFeePercent}}%)" , {swapFeeSats:pn(userSummary.swap_fee_sats), swapFeePercent:userSummary.swap_fee_percent})}
|
||||
secondary={t("Onchain swap fee")}/>
|
||||
<ListItemText
|
||||
primary={t("{{miningFeeSats}} Sats",{miningFeeSats:userSummary.mining_fee_sats})}
|
||||
primary={t("{{miningFeeSats}} Sats",{miningFeeSats:pn(userSummary.mining_fee_sats)})}
|
||||
secondary={t("Mining fee")}/>
|
||||
</ListItem>
|
||||
: null}
|
||||
@ -190,38 +195,44 @@ const TradeSummary = ({
|
||||
{/* Platform Summary */}
|
||||
<div style={{display: buttonValue == 1 ? '':'none'}}>
|
||||
<List dense={true}>
|
||||
<ListItem>
|
||||
<ListItemIcon>
|
||||
<PriceChangeIcon/>
|
||||
</ListItemIcon>
|
||||
<ListItemText
|
||||
primary={t("{{exchangeRate}} {{currencyCode}}/BTC",{exchangeRate:platformSummary.contract_exchange_rate.toPrecision(7),currencyCode:currencyCode})}
|
||||
secondary={t("Contract exchange rate")}/>
|
||||
</ListItem>
|
||||
<ListItem>
|
||||
<ListItemIcon>
|
||||
<ScheduleIcon/>
|
||||
</ListItemIcon>
|
||||
<ListItemText
|
||||
primary={contractTimestamp.toString()}
|
||||
secondary={t("Contract timestamp")}/>
|
||||
</ListItem>
|
||||
<ListItem>
|
||||
<ListItemIcon>
|
||||
<AccountBalanceIcon/>
|
||||
</ListItemIcon>
|
||||
<ListItemText
|
||||
primary={t("{{revenueSats}} Sats",{revenueSats:platformSummary.trade_revenue_sats})}
|
||||
primary={t("{{revenueSats}} Sats",{revenueSats:pn(platformSummary.trade_revenue_sats)})}
|
||||
secondary={t("Platform trade revenue")}/>
|
||||
</ListItem>
|
||||
|
||||
<ListItem>
|
||||
<ListItemIcon>
|
||||
<RouteIcon/>
|
||||
</ListItemIcon>
|
||||
<ListItemText
|
||||
primary={t("{{routingFeeSats}} MiliSats",{routingFeeSats:platformSummary.routing_fee_sats})}
|
||||
primary={t("{{routingFeeSats}} MiliSats",{routingFeeSats:pn(platformSummary.routing_fee_sats)})}
|
||||
secondary={t("Platform covered routing fee")}/>
|
||||
</ListItem>
|
||||
|
||||
<ListItem>
|
||||
<ListItemIcon>
|
||||
<PriceChangeIcon/>
|
||||
</ListItemIcon>
|
||||
<ListItemText
|
||||
primary={`${pn(platformSummary.contract_exchange_rate.toPrecision(7))} ${currencyCode}/BTC`}
|
||||
secondary={t("Contract exchange rate")}/>
|
||||
</ListItem>
|
||||
|
||||
<ListItem>
|
||||
<ListItemText
|
||||
primary={format(contractTimestamp, "do LLL HH:mm:ss")}
|
||||
secondary={t("Timestamp")}/>
|
||||
<ListItemIcon>
|
||||
<ScheduleIcon/>
|
||||
</ListItemIcon>
|
||||
<ListItemText
|
||||
primary={`${String(hours).padStart(2, '0')}:${String(mins).padStart(2, '0')}:${String(secs).padStart(2, '0')}`}
|
||||
secondary={t("Completed in")}/>
|
||||
</ListItem>
|
||||
</List>
|
||||
</div>
|
||||
</AccordionDetails>
|
||||
|
@ -471,6 +471,10 @@
|
||||
"Platform trade revenue":"Beneficio de la plataforma",
|
||||
"{{routingFeeSats}} MiliSats":"{{routingFeeSats}} MiliSats",
|
||||
"Platform covered routing fee":"Coste de enrutado cubierto",
|
||||
"Timestamp":"Marca de hora",
|
||||
"Completed in":"Completado en",
|
||||
"Contract exchange rate":"Tasa de cambio del contrato",
|
||||
|
||||
|
||||
"INFO DIALOG - InfoDiagog.js": "App information and clarifications and terms of use",
|
||||
"Close": "Cerrar",
|
||||
|
Loading…
Reference in New Issue
Block a user