Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Show number of confs for incoming onchain txs in activity list #2792

Merged
merged 4 commits into from
Nov 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ module.exports = {
medium: 6,
slow: 60,
},
// number of confirmations for the onchain receiving transaction in the context of
// transaction finality
onchainFinality: {
pending: 0,
confirmed: 1,
},

lnurl: {
requirePrompt: true,
Expand Down
35 changes: 32 additions & 3 deletions renderer/components/Activity/Transaction/Transaction.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
import React from 'react'
import PropTypes from 'prop-types'
import findLast from 'lodash/findLast'
import { FormattedTime, FormattedMessage, injectIntl } from 'react-intl'
import { Box, Flex } from 'rebass/styled-components'
import config from 'config'
import { intlShape } from '@zap/i18n'
import { Message, Text } from 'components/UI'
import ChainLink from 'components/Icon/ChainLink'
import { CryptoValue, FiatValue } from 'containers/UI'
import ErrorLink from '../ErrorLink'
import messages from './messages'

const { pending, confirmed } = config.onchainFinality

// finality to color mapping
const DISPLAY_PARAMS = [
{ finality: pending, msg: messages.pending, color: 'primaryAccent' },
{ finality: confirmed, msg: messages.confirmed, color: 'superGreen' },
]

const Transaction = ({ activity, showActivityModal, cryptoUnitName, intl, ...rest }) => {
const amount = activity.amount || activity.limboAmount || 0
const isIncoming = activity.received || activity.limboAmount > 0
Expand All @@ -18,6 +28,27 @@ const Transaction = ({ activity, showActivityModal, cryptoUnitName, intl, ...res
} else if (activity.isClosing) {
type = 'closing'
}
const renderConfirmations = () => {
const { num_confirmations } = activity

// returns color for the current number of confirmations
const getDisplayParams = () =>
findLast(DISPLAY_PARAMS, ({ finality }) => num_confirmations >= finality)

if (num_confirmations > confirmed) {
return (
<Text color="gray" fontSize="xs" fontWeight="normal">
<FormattedTime value={activity.time_stamp * 1000} />
</Text>
)
}
const { color, msg } = getDisplayParams()
return (
<Text color={color} fontSize="xs" fontWeight="normal">
<FormattedMessage {...msg} />
</Text>
)
}

return (
<Flex
Expand Down Expand Up @@ -62,9 +93,7 @@ const Transaction = ({ activity, showActivityModal, cryptoUnitName, intl, ...res
)}
</>
) : (
<Text color="gray" fontSize="xs" fontWeight="normal">
<FormattedTime value={activity.time_stamp * 1000} />
</Text>
renderConfirmations()
)}
</Box>

Expand Down
2 changes: 2 additions & 0 deletions renderer/components/Activity/Transaction/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ export default defineMessages({
closetype_breach_close: 'Breach',
closetype_funding_canceled: 'Funding Canceled',
closetype_abandoned: 'Abandoned',
pending: 'Pending',
confirmed: 'Confirmed',
})
3 changes: 2 additions & 1 deletion renderer/components/Settings/SettingsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import PasswordPromptDialog from 'containers/Settings/PasswordPromptDialog'
import PasswordSetDialog from 'containers/Settings/PasswordSetDialog'
import messages from './messages'

const isSecurityPaneEnabled = window.Zap.getPlatform() !== 'win32' || config.isWinPlatformSupported
const isSecurityPaneEnabled =
window.Zap.getPlatform() !== 'win32' || config.secureStorage.isWinPlatformSupported

const SettingsMenu = ({ group, setGroup, isLoggedIn, ...rest }) => {
// Items accessible to unauthenticated users.
Expand Down
2 changes: 2 additions & 0 deletions translations/af-ZA.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@
"components.Activity.Transaction.closetype_local_force_close": "",
"components.Activity.Transaction.closetype_remote_force_close": "",
"components.Activity.Transaction.closing": "",
"components.Activity.Transaction.confirmed": "",
"components.Activity.Transaction.fee": "",
"components.Activity.Transaction.funding": "",
"components.Activity.Transaction.pending": "",
"components.Activity.Transaction.received": "",
"components.Activity.Transaction.sent": "",
"components.Activity.Transaction.status_error": "",
Expand Down
2 changes: 2 additions & 0 deletions translations/ar-SA.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@
"components.Activity.Transaction.closetype_local_force_close": "",
"components.Activity.Transaction.closetype_remote_force_close": "",
"components.Activity.Transaction.closing": "",
"components.Activity.Transaction.confirmed": "",
"components.Activity.Transaction.fee": "",
"components.Activity.Transaction.funding": "",
"components.Activity.Transaction.pending": "",
"components.Activity.Transaction.received": "",
"components.Activity.Transaction.sent": "",
"components.Activity.Transaction.status_error": "",
Expand Down
2 changes: 2 additions & 0 deletions translations/bg-BG.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@
"components.Activity.Transaction.closetype_local_force_close": "",
"components.Activity.Transaction.closetype_remote_force_close": "",
"components.Activity.Transaction.closing": "",
"components.Activity.Transaction.confirmed": "",
"components.Activity.Transaction.fee": "Такса",
"components.Activity.Transaction.funding": "",
"components.Activity.Transaction.pending": "",
"components.Activity.Transaction.received": "Получени",
"components.Activity.Transaction.sent": "Изпратени",
"components.Activity.Transaction.status_error": "",
Expand Down
2 changes: 2 additions & 0 deletions translations/ca-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@
"components.Activity.Transaction.closetype_local_force_close": "",
"components.Activity.Transaction.closetype_remote_force_close": "",
"components.Activity.Transaction.closing": "",
"components.Activity.Transaction.confirmed": "",
"components.Activity.Transaction.fee": "",
"components.Activity.Transaction.funding": "",
"components.Activity.Transaction.pending": "",
"components.Activity.Transaction.received": "",
"components.Activity.Transaction.sent": "",
"components.Activity.Transaction.status_error": "",
Expand Down
2 changes: 2 additions & 0 deletions translations/cs-CZ.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@
"components.Activity.Transaction.closetype_local_force_close": "Vynutit lokální zavření",
"components.Activity.Transaction.closetype_remote_force_close": "Vynutit vzdálené zavření",
"components.Activity.Transaction.closing": "Zavírání kanálu",
"components.Activity.Transaction.confirmed": "",
"components.Activity.Transaction.fee": "Poplatek",
"components.Activity.Transaction.funding": "Financování kanálu",
"components.Activity.Transaction.pending": "",
"components.Activity.Transaction.received": "Přijato",
"components.Activity.Transaction.sent": "Odesláno",
"components.Activity.Transaction.status_error": "Při odesílání transakce se vyskytl problém.",
Expand Down
2 changes: 2 additions & 0 deletions translations/da-DK.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@
"components.Activity.Transaction.closetype_local_force_close": "Lokal tvungen lukning",
"components.Activity.Transaction.closetype_remote_force_close": "Fjern tvangslukning",
"components.Activity.Transaction.closing": "Kanalen lukkes",
"components.Activity.Transaction.confirmed": "",
"components.Activity.Transaction.fee": "Translations gebyr",
"components.Activity.Transaction.funding": "",
"components.Activity.Transaction.pending": "",
"components.Activity.Transaction.received": "Modtaget",
"components.Activity.Transaction.sent": "Sendt",
"components.Activity.Transaction.status_error": "Der opstod et problem med at sende din betaling.",
Expand Down
2 changes: 2 additions & 0 deletions translations/de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@
"components.Activity.Transaction.closetype_local_force_close": "Erzwungenes lokales Schließen",
"components.Activity.Transaction.closetype_remote_force_close": "Erzwungenes remotes Schließen",
"components.Activity.Transaction.closing": "Channel wird geschlossen",
"components.Activity.Transaction.confirmed": "",
"components.Activity.Transaction.fee": "Gebühr",
"components.Activity.Transaction.funding": "Kanal Finanzierung",
"components.Activity.Transaction.pending": "",
"components.Activity.Transaction.received": "Erhalten",
"components.Activity.Transaction.sent": "Gesendet",
"components.Activity.Transaction.status_error": "Während dem Senden der Transaktion ist ein Fehler aufgetreten.",
Expand Down
2 changes: 2 additions & 0 deletions translations/el-GR.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@
"components.Activity.Transaction.closetype_local_force_close": "",
"components.Activity.Transaction.closetype_remote_force_close": "",
"components.Activity.Transaction.closing": "",
"components.Activity.Transaction.confirmed": "",
"components.Activity.Transaction.fee": "Αμοιβή",
"components.Activity.Transaction.funding": "",
"components.Activity.Transaction.pending": "",
"components.Activity.Transaction.received": "Έλαβε",
"components.Activity.Transaction.sent": "Αποστέλλονται",
"components.Activity.Transaction.status_error": "",
Expand Down
2 changes: 2 additions & 0 deletions translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@
"components.Activity.Transaction.closetype_local_force_close": "Local force close",
"components.Activity.Transaction.closetype_remote_force_close": "Remote force close",
"components.Activity.Transaction.closing": "Channel Closing",
"components.Activity.Transaction.confirmed": "Confirmed",
"components.Activity.Transaction.fee": "Transaction fee",
"components.Activity.Transaction.funding": "Channel Funding",
"components.Activity.Transaction.pending": "Pending",
"components.Activity.Transaction.received": "Received",
"components.Activity.Transaction.sent": "Sent",
"components.Activity.Transaction.status_error": "There was a problem sending your transaction.",
Expand Down
2 changes: 2 additions & 0 deletions translations/es-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@
"components.Activity.Transaction.closetype_local_force_close": "Cierre de fuerza local",
"components.Activity.Transaction.closetype_remote_force_close": "Cierre de fuerza externa",
"components.Activity.Transaction.closing": "Canal Cerrándose",
"components.Activity.Transaction.confirmed": "",
"components.Activity.Transaction.fee": "Comisión",
"components.Activity.Transaction.funding": "Financiamiento de canal",
"components.Activity.Transaction.pending": "",
"components.Activity.Transaction.received": "Recibido",
"components.Activity.Transaction.sent": "Enviado",
"components.Activity.Transaction.status_error": "Ocurrió un error con su transacción",
Expand Down
2 changes: 2 additions & 0 deletions translations/fi-FI.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@
"components.Activity.Transaction.closetype_local_force_close": "",
"components.Activity.Transaction.closetype_remote_force_close": "",
"components.Activity.Transaction.closing": "",
"components.Activity.Transaction.confirmed": "",
"components.Activity.Transaction.fee": "",
"components.Activity.Transaction.funding": "",
"components.Activity.Transaction.pending": "",
"components.Activity.Transaction.received": "",
"components.Activity.Transaction.sent": "",
"components.Activity.Transaction.status_error": "",
Expand Down
2 changes: 2 additions & 0 deletions translations/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@
"components.Activity.Transaction.closetype_local_force_close": "Fermeture forcée locale",
"components.Activity.Transaction.closetype_remote_force_close": "Fermeture forcée distante",
"components.Activity.Transaction.closing": "Fermeture de canal",
"components.Activity.Transaction.confirmed": "",
"components.Activity.Transaction.fee": "Frais",
"components.Activity.Transaction.funding": "Ouverture de canal",
"components.Activity.Transaction.pending": "",
"components.Activity.Transaction.received": "Reçu",
"components.Activity.Transaction.sent": "Envoyé",
"components.Activity.Transaction.status_error": "Un problème est survenu au cours de l'envoi de votre transaction.",
Expand Down
2 changes: 2 additions & 0 deletions translations/ga-IE.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@
"components.Activity.Transaction.closetype_local_force_close": "Dúnann an fórsa áitiúil",
"components.Activity.Transaction.closetype_remote_force_close": "Dún fórsa cianda",
"components.Activity.Transaction.closing": "Dúnadh an Mhuir nIocht",
"components.Activity.Transaction.confirmed": "",
"components.Activity.Transaction.fee": "Táille idirbhirt",
"components.Activity.Transaction.funding": "Maoiniú Cainéil",
"components.Activity.Transaction.pending": "",
"components.Activity.Transaction.received": "Faighte",
"components.Activity.Transaction.sent": "Seolta",
"components.Activity.Transaction.status_error": "Bhí fadhb ann le do idirbheart a sheoladh.",
Expand Down
2 changes: 2 additions & 0 deletions translations/he-IL.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@
"components.Activity.Transaction.closetype_local_force_close": "",
"components.Activity.Transaction.closetype_remote_force_close": "",
"components.Activity.Transaction.closing": "",
"components.Activity.Transaction.confirmed": "",
"components.Activity.Transaction.fee": "",
"components.Activity.Transaction.funding": "",
"components.Activity.Transaction.pending": "",
"components.Activity.Transaction.received": "",
"components.Activity.Transaction.sent": "",
"components.Activity.Transaction.status_error": "",
Expand Down
2 changes: 2 additions & 0 deletions translations/hi-IN.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@
"components.Activity.Transaction.closetype_local_force_close": "",
"components.Activity.Transaction.closetype_remote_force_close": "",
"components.Activity.Transaction.closing": "",
"components.Activity.Transaction.confirmed": "",
"components.Activity.Transaction.fee": "",
"components.Activity.Transaction.funding": "",
"components.Activity.Transaction.pending": "",
"components.Activity.Transaction.received": "",
"components.Activity.Transaction.sent": "",
"components.Activity.Transaction.status_error": "",
Expand Down
2 changes: 2 additions & 0 deletions translations/hr-HR.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@
"components.Activity.Transaction.closetype_local_force_close": "Lokalno prisilno zatvaranje",
"components.Activity.Transaction.closetype_remote_force_close": "Udaljeno prisilno zatvaranje",
"components.Activity.Transaction.closing": "Zatvaranje kanala",
"components.Activity.Transaction.confirmed": "",
"components.Activity.Transaction.fee": "Naknada",
"components.Activity.Transaction.funding": "Financiranje kanala",
"components.Activity.Transaction.pending": "",
"components.Activity.Transaction.received": "Primljeno",
"components.Activity.Transaction.sent": "Poslano",
"components.Activity.Transaction.status_error": "Došlo je do problema prilikom slanja vaše transakcije.",
Expand Down
2 changes: 2 additions & 0 deletions translations/hu-HU.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@
"components.Activity.Transaction.closetype_local_force_close": "",
"components.Activity.Transaction.closetype_remote_force_close": "",
"components.Activity.Transaction.closing": "",
"components.Activity.Transaction.confirmed": "",
"components.Activity.Transaction.fee": "",
"components.Activity.Transaction.funding": "",
"components.Activity.Transaction.pending": "",
"components.Activity.Transaction.received": "",
"components.Activity.Transaction.sent": "",
"components.Activity.Transaction.status_error": "",
Expand Down
2 changes: 2 additions & 0 deletions translations/it-IT.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@
"components.Activity.Transaction.closetype_local_force_close": "",
"components.Activity.Transaction.closetype_remote_force_close": "",
"components.Activity.Transaction.closing": "Canale in chiusura",
"components.Activity.Transaction.confirmed": "",
"components.Activity.Transaction.fee": "Commissione di transazione",
"components.Activity.Transaction.funding": "",
"components.Activity.Transaction.pending": "",
"components.Activity.Transaction.received": "Ricevuto",
"components.Activity.Transaction.sent": "Inviato",
"components.Activity.Transaction.status_error": "Si è verificato un errore durante l'invio della transazione.",
Expand Down
2 changes: 2 additions & 0 deletions translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@
"components.Activity.Transaction.closetype_local_force_close": "ローカル強制終了",
"components.Activity.Transaction.closetype_remote_force_close": "リモート強制終了",
"components.Activity.Transaction.closing": "チャンネルは閉鎖されています",
"components.Activity.Transaction.confirmed": "",
"components.Activity.Transaction.fee": "フィー",
"components.Activity.Transaction.funding": "チャンネルの資金",
"components.Activity.Transaction.pending": "",
"components.Activity.Transaction.received": "受け取る",
"components.Activity.Transaction.sent": "送信した",
"components.Activity.Transaction.status_error": "トランザクションの送信で問題がありました。",
Expand Down
2 changes: 2 additions & 0 deletions translations/ko-KR.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@
"components.Activity.Transaction.closetype_local_force_close": "",
"components.Activity.Transaction.closetype_remote_force_close": "",
"components.Activity.Transaction.closing": "",
"components.Activity.Transaction.confirmed": "",
"components.Activity.Transaction.fee": "",
"components.Activity.Transaction.funding": "",
"components.Activity.Transaction.pending": "",
"components.Activity.Transaction.received": "",
"components.Activity.Transaction.sent": "",
"components.Activity.Transaction.status_error": "",
Expand Down
2 changes: 2 additions & 0 deletions translations/nl-NL.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@
"components.Activity.Transaction.closetype_local_force_close": "",
"components.Activity.Transaction.closetype_remote_force_close": "",
"components.Activity.Transaction.closing": "",
"components.Activity.Transaction.confirmed": "",
"components.Activity.Transaction.fee": "Vergoeding",
"components.Activity.Transaction.funding": "",
"components.Activity.Transaction.pending": "",
"components.Activity.Transaction.received": "Ontvangen",
"components.Activity.Transaction.sent": "Verzonden",
"components.Activity.Transaction.status_error": "",
Expand Down
2 changes: 2 additions & 0 deletions translations/no-NO.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@
"components.Activity.Transaction.closetype_local_force_close": "",
"components.Activity.Transaction.closetype_remote_force_close": "",
"components.Activity.Transaction.closing": "Lukker kanal",
"components.Activity.Transaction.confirmed": "",
"components.Activity.Transaction.fee": "Transaksjonsavgift",
"components.Activity.Transaction.funding": "",
"components.Activity.Transaction.pending": "",
"components.Activity.Transaction.received": "Mottatt",
"components.Activity.Transaction.sent": "Sendt",
"components.Activity.Transaction.status_error": "",
Expand Down
2 changes: 2 additions & 0 deletions translations/pl-PL.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@
"components.Activity.Transaction.closetype_local_force_close": "",
"components.Activity.Transaction.closetype_remote_force_close": "",
"components.Activity.Transaction.closing": "",
"components.Activity.Transaction.confirmed": "",
"components.Activity.Transaction.fee": "",
"components.Activity.Transaction.funding": "",
"components.Activity.Transaction.pending": "",
"components.Activity.Transaction.received": "",
"components.Activity.Transaction.sent": "",
"components.Activity.Transaction.status_error": "",
Expand Down
2 changes: 2 additions & 0 deletions translations/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@
"components.Activity.Transaction.closetype_local_force_close": "",
"components.Activity.Transaction.closetype_remote_force_close": "",
"components.Activity.Transaction.closing": "",
"components.Activity.Transaction.confirmed": "",
"components.Activity.Transaction.fee": "Taxa",
"components.Activity.Transaction.funding": "",
"components.Activity.Transaction.pending": "",
"components.Activity.Transaction.received": "Recebido",
"components.Activity.Transaction.sent": "Enviado",
"components.Activity.Transaction.status_error": "",
Expand Down
2 changes: 2 additions & 0 deletions translations/pt-PT.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@
"components.Activity.Transaction.closetype_local_force_close": "",
"components.Activity.Transaction.closetype_remote_force_close": "",
"components.Activity.Transaction.closing": "",
"components.Activity.Transaction.confirmed": "",
"components.Activity.Transaction.fee": "",
"components.Activity.Transaction.funding": "",
"components.Activity.Transaction.pending": "",
"components.Activity.Transaction.received": "",
"components.Activity.Transaction.sent": "",
"components.Activity.Transaction.status_error": "",
Expand Down
2 changes: 2 additions & 0 deletions translations/ro-RO.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@
"components.Activity.Transaction.closetype_local_force_close": "",
"components.Activity.Transaction.closetype_remote_force_close": "",
"components.Activity.Transaction.closing": "",
"components.Activity.Transaction.confirmed": "",
"components.Activity.Transaction.fee": "Taxa",
"components.Activity.Transaction.funding": "",
"components.Activity.Transaction.pending": "",
"components.Activity.Transaction.received": "Primite",
"components.Activity.Transaction.sent": "Trimis",
"components.Activity.Transaction.status_error": "",
Expand Down
Loading