Browse Source

Adds tag to transaction details

gre-patch-1
Juan Cortes Ross 6 years ago
parent
commit
8f6f72ec96
No known key found for this signature in database GPG Key ID: 34A99C03E9455EB8
  1. 5
      src/bridge/RippleJSBridge.js
  2. 12
      src/components/modals/OperationDetails.js

5
src/bridge/RippleJSBridge.js

@ -121,7 +121,7 @@ async function signAndBroadcast({ a, t, deviceId, isCancelled, onSigned, onOpera
transactionSequenceNumber: transactionSequenceNumber:
(a.operations.length > 0 ? a.operations[0].transactionSequenceNumber : 0) + (a.operations.length > 0 ? a.operations[0].transactionSequenceNumber : 0) +
a.pendingOperations.length, a.pendingOperations.length,
extra: {}, extra: { tag: t.tag },
} }
onOperationBroadcasted(op) onOperationBroadcasted(op)
} }
@ -164,6 +164,7 @@ type Tx = {
currency: string, currency: string,
value: string, value: string,
}, },
tag?: string,
}, },
paths: string, paths: string,
}, },
@ -233,7 +234,7 @@ const txToOperation = (account: Account) => ({
recipients: [destination.address], recipients: [destination.address],
date: new Date(timestamp), date: new Date(timestamp),
transactionSequenceNumber: sequence, transactionSequenceNumber: sequence,
extra: {}, extra: { tag: destination.tag },
} }
return op return op
} }

12
src/components/modals/OperationDetails.js

@ -3,7 +3,7 @@
import React, { Fragment, Component } from 'react' import React, { Fragment, Component } from 'react'
import { connect } from 'react-redux' import { connect } from 'react-redux'
import { openURL } from 'helpers/linking' import { openURL } from 'helpers/linking'
import { translate } from 'react-i18next' import { Trans, translate } from 'react-i18next'
import styled from 'styled-components' import styled from 'styled-components'
import moment from 'moment' import moment from 'moment'
import { getOperationAmountNumber } from '@ledgerhq/live-common/lib/operation' import { getOperationAmountNumber } from '@ledgerhq/live-common/lib/operation'
@ -114,7 +114,7 @@ type Props = {
const OperationDetails = connect(mapStateToProps)((props: Props) => { const OperationDetails = connect(mapStateToProps)((props: Props) => {
const { t, onClose, operation, account, currencySettings, marketIndicator } = props const { t, onClose, operation, account, currencySettings, marketIndicator } = props
if (!operation || !account || !currencySettings) return null if (!operation || !account || !currencySettings) return null
const { hash, date, senders, type, fee, recipients } = operation const { extra, hash, date, senders, type, fee, recipients } = operation
const { name, unit, currency } = account const { name, unit, currency } = account
const amount = getOperationAmountNumber(operation) const amount = getOperationAmountNumber(operation)
@ -226,6 +226,14 @@ const OperationDetails = connect(mapStateToProps)((props: Props) => {
<OpDetailsTitle>{t('operationDetails.to')}</OpDetailsTitle> <OpDetailsTitle>{t('operationDetails.to')}</OpDetailsTitle>
<DataList lines={recipients} t={t} /> <DataList lines={recipients} t={t} />
</Box> </Box>
{Object.entries(extra).map(([key, value]) => (
<Box key={key}>
<OpDetailsTitle>
<Trans i18nKey={`operationDetails.extra.${key}`} defaults={key} />
</OpDetailsTitle>
<OpDetailsData>{value}</OpDetailsData>
</Box>
))}
</Box> </Box>
</GrowScroll> </GrowScroll>
<GradientBox /> <GradientBox />

Loading…
Cancel
Save