From 0916bd6bbff7a6cbc2d7fec9cb330d0370d2d1e3 Mon Sep 17 00:00:00 2001 From: sebastiengllmt Date: Fri, 18 Jan 2019 03:30:25 +0900 Subject: [PATCH 1/5] first version --- app/api/ada/index.js | 109 +++++++++++++++--- .../wallet/transactions/Transaction.js | 59 ++++++++-- app/domain/WalletTransaction.js | 13 ++- 3 files changed, 148 insertions(+), 33 deletions(-) diff --git a/app/api/ada/index.js b/app/api/ada/index.js index d8e85be347..4f67312639 100644 --- a/app/api/ada/index.js +++ b/app/api/ada/index.js @@ -10,6 +10,9 @@ import Wallet from '../../domain/Wallet'; import WalletTransaction, { transactionTypes } from '../../domain/WalletTransaction'; +import type { + TransactionType +} from '../../domain/WalletTransaction'; import WalletAddress from '../../domain/WalletAddress'; import { LOVELACES_PER_ADA } from '../../config/numbersConfig'; import { @@ -24,6 +27,7 @@ import { isValidAdaAddress, newExternalAdaAddress, getAdaAddressesByType, + getAdaAddressesList, saveAdaAddress } from './adaAddress'; import { @@ -59,6 +63,7 @@ import type { AdaTransaction, AdaTransactionCondition, AdaTransactionFee, + AdaTransactionInputOutput, AdaTransactions, AdaWallet, AdaWallets, @@ -219,13 +224,15 @@ export default class AdaApi { const transactions = limit ? history[0].slice(skip, skip + limit) : history[0]; - const mappedTransactions = transactions.map(data => ( - _createTransactionFromServerData(data) - )); - return Promise.resolve({ - transactions: mappedTransactions, - total: history[1] + + const mappedTransactions = transactions.map(async data => { + const { type, amount, fee } = await _getTxFinancialInfo(data); + return _createTransactionFromServerData(data, type, amount, fee); }); + return Promise.all(mappedTransactions).then(mappedTxs => Promise.resolve({ + transactions: mappedTxs, + total: history[1] + })); } catch (error) { Logger.error('AdaApi::refreshTransactions error: ' + stringifyError(error)); throw new GenericApiError(); @@ -237,9 +244,10 @@ export default class AdaApi { try { const pendingTxs = await getPendingAdaTxs(); Logger.debug('AdaApi::refreshPendingTransactions success: ' + stringifyData(pendingTxs)); - return pendingTxs.map(data => ( - _createTransactionFromServerData(data) - )); + return Promise.all(pendingTxs.map(async data => { + const { type, amount, fee } = await _getTxFinancialInfo(data); + return _createTransactionFromServerData(data, type, amount, fee); + })); } catch (error) { Logger.error('AdaApi::refreshPendingTransactions error: ' + stringifyError(error)); throw new GenericApiError(); @@ -563,6 +571,77 @@ export default class AdaApi { // ========== TRANSFORM SERVER DATA INTO FRONTEND MODELS ========= +async function _getTxFinancialInfo( + data: AdaTransaction +): Promise<{ + type: TransactionType, + amount: BigNumber, + fee: BigNumber +}> { + // Note: logic taken from the mobile version of Yoroi + + const adaAddresses = await getAdaAddressesList(); + const addresses: Array = adaAddresses.map(addr => addr.cadId); + + const ownInputs = data.ctInputs.filter(input => ( + addresses.includes(input[0]) + )); + + const ownOutputs = data.ctOutputs.filter(output => ( + addresses.includes(output[0]) + )); + + const _sum = (IOs: Array): BigNumber => ( + IOs.reduce( + (accum: BigNumber, io) => accum.plus(new BigNumber(io[1].getCCoin, 10)), + new BigNumber(0), + ) + ); + + const totalIn = _sum(data.ctInputs); + const totalOut = _sum(data.ctOutputs); + const ownIn = _sum(ownInputs); + const ownOut = _sum(ownOutputs); + + const hasOnlyOwnInputs = ownInputs.length === data.ctInputs.length; + const hasOnlyOwnOutputs = ownOutputs.length === data.ctOutputs.length; + const isIntraWallet = hasOnlyOwnInputs && hasOnlyOwnOutputs; + const isMultiParty = + ownInputs.length > 0 && ownInputs.length !== data.ctInputs.length; + + const brutto = ownOut.minus(ownIn); + const totalFee = totalOut.minus(totalIn); // should be negative + + if (isIntraWallet) { + return { + type: transactionTypes.SELF, + amount: new BigNumber(0), + fee: totalFee + }; + } + if (isMultiParty) { + return { + type: transactionTypes.MULTI, + amount: brutto, + // note: fees not accurate but no good way of finding which UTXO paid the fees in Yoroi + fee: new BigNumber(0) + }; + } + if (hasOnlyOwnInputs) { + return { + type: transactionTypes.EXPEND, + amount: brutto.minus(totalFee), + fee: totalFee + }; + } + + return { + type: transactionTypes.INCOME, + amount: brutto, + fee: new BigNumber(0) + }; +} + const _createWalletFromServerData = action( 'AdaApi::_createWalletFromServerData', (adaWallet: AdaWallet) => { @@ -608,18 +687,14 @@ const _conditionToTxState = (condition: AdaTransactionCondition) => { const _createTransactionFromServerData = action( 'AdaApi::_createTransactionFromServerData', - (data: AdaTransaction) => { - const coins = new BigNumber(data.ctAmount.getCCoin); + (data: AdaTransaction, type: TransactionType, amount: BigNumber, fee: BigNumber) => { const { ctmTitle, ctmDescription, ctmDate } = data.ctMeta; return new WalletTransaction({ id: data.ctId, title: ctmTitle || data.ctIsOutgoing ? 'Ada sent' : 'Ada received', - type: data.ctIsOutgoing - ? transactionTypes.EXPEND - : transactionTypes.INCOME, - amount: (data.ctIsOutgoing ? coins.negated() : coins).dividedBy( - LOVELACES_PER_ADA - ), + type, + amount: amount.dividedBy(LOVELACES_PER_ADA).plus(fee.dividedBy(LOVELACES_PER_ADA)), + fee: fee.dividedBy(LOVELACES_PER_ADA), date: new Date(ctmDate), description: ctmDescription || '', numberOfConfirmations: getLastBlockNumber() - data.ctBlockNumber, diff --git a/app/components/wallet/transactions/Transaction.js b/app/components/wallet/transactions/Transaction.js index bbe266da49..5e58f6000a 100644 --- a/app/components/wallet/transactions/Transaction.js +++ b/app/components/wallet/transactions/Transaction.js @@ -11,6 +11,7 @@ import { assuranceLevels } from '../../../config/transactionAssuranceConfig'; import { environmentSpecificMessages } from '../../../i18n/global-messages'; import type { TransactionState } from '../../../domain/WalletTransaction'; import environment from '../../../environment'; +import { Logger } from '../../../utils/logging'; const messages = defineMessages({ card: { @@ -58,6 +59,16 @@ const messages = defineMessages({ defaultMessage: '!!!{currency} received', description: 'Label "{currency} received" for the transaction.', }, + intrawallet: { + id: 'wallet.transaction.intrawallet', + defaultMessage: '!!!{currency} intrawallet transaction', + description: 'both sender & receiver are yourself', + }, + multiparty: { + id: 'wallet.transaction.multiparty', + defaultMessage: '!!!{currency} multiparty transaction', + description: 'only some inputs of tx belong to you', + }, fromAddress: { id: 'wallet.transaction.address.from', defaultMessage: '!!!From address', @@ -142,6 +153,36 @@ export default class Transaction extends Component { this.setState(prevState => ({ isExpanded: !prevState.isExpanded })); } + getTransactionHeaderMsg(intl, currency: string, type: TransactionType): string { + if (type === transactionTypes.EXPEND) { + return intl.formatMessage(messages.sent, { currency }); + } + if (type === transactionTypes.INCOME) { + return intl.formatMessage(messages.received, { currency }); + } + if (type === transactionTypes.SELF) { + return intl.formatMessage(messages.intrawallet, { currency }); + } + if (type === transactionTypes.MULTI) { + Logger.error('MULTI type transaction detected.'); + return intl.formatMessage(messages.multiparty, { currency }); + } + // unused + if (type === transactionTypes.EXCHANGE) { + Logger.error('EXCHANGE type transactions not supported'); + return '???'; + } + } + + getAmountStyle(amt: BigNumber) { + return classNames([ + styles.amount, + amt.lt(0) + ? styles.amountSent + : styles.amountReceived + ]); + } + render() { const data = this.props.data; const { isLastInList, state, assuranceLevel, formattedWalletAmount } = this.props; @@ -164,11 +205,6 @@ export default class Transaction extends Component { isExpanded ? styles.expanded : styles.closed ]); - const amountStyles = classNames([ - styles.amount, - data.type === transactionTypes.EXPEND ? styles.amountSent : styles.amountReceived - ]); - const status = intl.formatMessage(assuranceLevelTranslations[assuranceLevel]); const currency = intl.formatMessage(environmentSpecificMessages[environment.API].currency); const symbol = adaSymbol; @@ -181,10 +217,7 @@ export default class Transaction extends Component {
- {data.type === transactionTypes.EXPEND ? - intl.formatMessage(messages.sent, { currency }) : - intl.formatMessage(messages.received, { currency }) - } + { this.getTransactionHeaderMsg(intl, currency, data.type) }
{moment(data.date).format('hh:mm:ss A')} @@ -196,7 +229,7 @@ export default class Transaction extends Component { {intl.formatMessage(stateTranslations[state])}
)} -
+
{ // hide currency (we are showing symbol instead) formattedWalletAmount(data.amount, false) @@ -225,7 +258,11 @@ export default class Transaction extends Component { )}

- {intl.formatMessage(messages.fromAddresses)} + Fee: +

+ {formattedWalletAmount(data.fee, false)} +

+ {intl.formatMessage(messages.fromAddresses)}

{uniq(data.addresses.from).map(address => ( {address} diff --git a/app/domain/WalletTransaction.js b/app/domain/WalletTransaction.js index e28b3eea4f..7ac1b280fa 100644 --- a/app/domain/WalletTransaction.js +++ b/app/domain/WalletTransaction.js @@ -6,7 +6,7 @@ import { assuranceLevels } from '../config/transactionAssuranceConfig'; export type TrasactionAddresses = { from: Array, to: Array }; export type TransactionState = 'pending' | 'failed' | 'ok'; -export type TransactionType = 'card' | 'expend' | 'income' | 'exchange'; +export type TransactionType = 'card' | 'expend' | 'income' | 'exchange' | 'self' | 'multi'; export const transactionStates: { PENDING: TransactionState, @@ -19,15 +19,17 @@ export const transactionStates: { }; export const transactionTypes: { - CARD: TransactionType, EXPEND: TransactionType, INCOME: TransactionType, EXCHANGE: TransactionType, + SELF: TransactionType, + MULTI: TransactionType } = { - CARD: 'card', EXPEND: 'expend', INCOME: 'income', EXCHANGE: 'exchange', + SELF: 'self', + MULTI: 'multi' }; export default class WalletTransaction { @@ -35,7 +37,8 @@ export default class WalletTransaction { @observable id: string = ''; @observable type: TransactionType; @observable title: string = ''; - @observable amount: BigNumber; + @observable amount: BigNumber; // fee included + @observable fee: BigNumber; @observable date: Date; @observable description: string = ''; @observable numberOfConfirmations: number = 0; @@ -47,6 +50,7 @@ export default class WalletTransaction { type: TransactionType, title: string, amount: BigNumber, + fee: BigNumber, date: Date, description: string, numberOfConfirmations: number, @@ -65,5 +69,4 @@ export default class WalletTransaction { } return assuranceLevels.HIGH; } - } From ee357b65d362cd44b869c0907e34a296831f5ee1 Mon Sep 17 00:00:00 2001 From: sebastiengllmt Date: Fri, 18 Jan 2019 03:52:53 +0900 Subject: [PATCH 2/5] ui fixes --- app/components/wallet/transactions/Transaction.js | 13 ++++--------- app/i18n/locales/en-US.json | 3 ++- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/app/components/wallet/transactions/Transaction.js b/app/components/wallet/transactions/Transaction.js index 5e58f6000a..e1a3d88360 100644 --- a/app/components/wallet/transactions/Transaction.js +++ b/app/components/wallet/transactions/Transaction.js @@ -14,11 +14,6 @@ import environment from '../../../environment'; import { Logger } from '../../../utils/logging'; const messages = defineMessages({ - card: { - id: 'wallet.transaction.type.card', - defaultMessage: '!!!Card payment', - description: 'Transaction type shown for credit card payments.', - }, type: { id: 'wallet.transaction.type', defaultMessage: '!!!{currency} transaction', @@ -60,12 +55,12 @@ const messages = defineMessages({ description: 'Label "{currency} received" for the transaction.', }, intrawallet: { - id: 'wallet.transaction.intrawallet', + id: 'wallet.transaction.type.intrawallet', defaultMessage: '!!!{currency} intrawallet transaction', description: 'both sender & receiver are yourself', }, multiparty: { - id: 'wallet.transaction.multiparty', + id: 'wallet.transaction.type.multiparty', defaultMessage: '!!!{currency} multiparty transaction', description: 'only some inputs of tx belong to you', }, @@ -260,9 +255,9 @@ export default class Transaction extends Component {

Fee:

- {formattedWalletAmount(data.fee, false)} + {formattedWalletAmount(data.fee.abs(), false)}

- {intl.formatMessage(messages.fromAddresses)} + {intl.formatMessage(messages.fromAddresses)}

{uniq(data.addresses.from).map(address => ( {address} diff --git a/app/i18n/locales/en-US.json b/app/i18n/locales/en-US.json index 2e1b1c0f0f..29fb71a7ff 100644 --- a/app/i18n/locales/en-US.json +++ b/app/i18n/locales/en-US.json @@ -235,8 +235,9 @@ "wallet.transaction.transactionAmount": "Transaction amount", "wallet.transaction.transactionId": "Transaction ID", "wallet.transaction.type": "{currency} transaction", - "wallet.transaction.type.card": "Card payment", "wallet.transaction.type.exchange": "Exchange", + "wallet.transaction.type.intrawallet": "{currency} intrawallet transaction", + "wallet.transaction.type.multiparty": "{currency} multiparty transaction", "wallet.trezor.dialog.common.step.link.helpYoroiWithTrezor": "https://youtu.be/Dp0wXwtToX0", "wallet.trezor.dialog.common.step.link.helpYoroiWithTrezor.text": "Click here to learn more about using Yoroi with Trezor", "wallet.trezor.dialog.connect.button.label": "Connect", From a49776d4acd4580a6590cc2add633f4d29a4814e Mon Sep 17 00:00:00 2001 From: sebastiengllmt Date: Fri, 18 Jan 2019 04:15:29 +0900 Subject: [PATCH 3/5] translation strings --- app/i18n/locales/ja-JP.json | 3 ++- app/i18n/locales/ko-KR.json | 3 ++- app/i18n/locales/ru-RU.json | 3 ++- app/i18n/locales/zh-Hans.json | 3 ++- app/i18n/locales/zh-Hant.json | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/i18n/locales/ja-JP.json b/app/i18n/locales/ja-JP.json index 9a21cae69f..5f2bee986c 100644 --- a/app/i18n/locales/ja-JP.json +++ b/app/i18n/locales/ja-JP.json @@ -235,8 +235,9 @@ "wallet.transaction.transactionAmount": "取引額", "wallet.transaction.transactionId": "取引ID", "wallet.transaction.type": "{currency} 取引", - "wallet.transaction.type.card": "カード支払い", "wallet.transaction.type.exchange": "交換", + "wallet.transaction.type.intrawallet": "!!!{currency} intrawallet transaction", + "wallet.transaction.type.multiparty": "!!!{currency} multiparty transaction", "wallet.trezor.dialog.common.step.link.helpYoroiWithTrezor": "https://youtu.be/Dp0wXwtToX0", "wallet.trezor.dialog.common.step.link.helpYoroiWithTrezor.text": "Trezorを使ったヨロイの使用方法はこちら", "wallet.trezor.dialog.connect.button.label": "接続", diff --git a/app/i18n/locales/ko-KR.json b/app/i18n/locales/ko-KR.json index 4ae0e3c2b3..042b29ebd9 100644 --- a/app/i18n/locales/ko-KR.json +++ b/app/i18n/locales/ko-KR.json @@ -235,8 +235,9 @@ "wallet.transaction.transactionAmount": "거래 금액", "wallet.transaction.transactionId": "거래 ID", "wallet.transaction.type": "{currency} 거래", - "wallet.transaction.type.card": "카드 결제", "wallet.transaction.type.exchange": "환율", + "wallet.transaction.type.intrawallet": "!!!{currency} intrawallet transaction", + "wallet.transaction.type.multiparty": "!!!{currency} multiparty transaction", "wallet.trezor.dialog.common.step.link.helpYoroiWithTrezor": "https://youtu.be/Dp0wXwtToX0", "wallet.trezor.dialog.common.step.link.helpYoroiWithTrezor.text": "TREZOR를 이용한 요로이 사용법은 여기를 클릭하십시오.", "wallet.trezor.dialog.connect.button.label": "연결", diff --git a/app/i18n/locales/ru-RU.json b/app/i18n/locales/ru-RU.json index b65ae29bbf..39747706f4 100644 --- a/app/i18n/locales/ru-RU.json +++ b/app/i18n/locales/ru-RU.json @@ -235,8 +235,9 @@ "wallet.transaction.transactionAmount": "Сумма транзакции", "wallet.transaction.transactionId": "ID транзакции", "wallet.transaction.type": "{currency} транзакции", - "wallet.transaction.type.card": "Оплата картой", "wallet.transaction.type.exchange": "Обмен", + "wallet.transaction.type.intrawallet": "!!!{currency} intrawallet transaction", + "wallet.transaction.type.multiparty": "!!!{currency} multiparty transaction", "wallet.trezor.dialog.common.step.link.helpYoroiWithTrezor": "https://youtu.be/Dp0wXwtToX0", "wallet.trezor.dialog.common.step.link.helpYoroiWithTrezor.text": "Нажмите здесь, чтобы узнать больше об использовании Yoroi с Trezor", "wallet.trezor.dialog.connect.button.label": "Подключиться", diff --git a/app/i18n/locales/zh-Hans.json b/app/i18n/locales/zh-Hans.json index 3630d0bd20..690bc26fe9 100644 --- a/app/i18n/locales/zh-Hans.json +++ b/app/i18n/locales/zh-Hans.json @@ -235,8 +235,9 @@ "wallet.transaction.transactionAmount": "交易金额", "wallet.transaction.transactionId": "交易 ID", "wallet.transaction.type": "{currency} 交易", - "wallet.transaction.type.card": "卡支付", "wallet.transaction.type.exchange": "交易所", + "wallet.transaction.type.intrawallet": "!!!{currency} intrawallet transaction", + "wallet.transaction.type.multiparty": "!!!{currency} multiparty transaction", "wallet.trezor.dialog.common.step.link.helpYoroiWithTrezor": "https://youtu.be/Dp0wXwtToX0", "wallet.trezor.dialog.common.step.link.helpYoroiWithTrezor.text": "点击这里了解更多关于使用 Yoroi 与 Trezor", "wallet.trezor.dialog.connect.button.label": "连接", diff --git a/app/i18n/locales/zh-Hant.json b/app/i18n/locales/zh-Hant.json index 3f356b8805..5f652918c1 100644 --- a/app/i18n/locales/zh-Hant.json +++ b/app/i18n/locales/zh-Hant.json @@ -235,8 +235,9 @@ "wallet.transaction.transactionAmount": "交易金額", "wallet.transaction.transactionId": "交易 ID", "wallet.transaction.type": "{currency} 交易", - "wallet.transaction.type.card": "卡支付", "wallet.transaction.type.exchange": "兌換", + "wallet.transaction.type.intrawallet": "!!!{currency} intrawallet transaction", + "wallet.transaction.type.multiparty": "!!!{currency} multiparty transaction", "wallet.trezor.dialog.common.step.link.helpYoroiWithTrezor": "https://youtu.be/Dp0wXwtToX0", "wallet.trezor.dialog.common.step.link.helpYoroiWithTrezor.text": "點擊此處了解有關使用Yoroi和Trezor的更多情報", "wallet.trezor.dialog.connect.button.label": "連接", From ec4e00f162849dfce1a0dac7833a72a41304946e Mon Sep 17 00:00:00 2001 From: sebastiengllmt Date: Fri, 18 Jan 2019 04:32:45 +0900 Subject: [PATCH 4/5] fix tests --- features/step_definitions/tx-history-steps.js | 6 +++--- features/support/mockData.json | 4 ++++ features/support/mockDataBuilder.js | 1 + features/support/mockDataTypes.js | 1 + 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/features/step_definitions/tx-history-steps.js b/features/step_definitions/tx-history-steps.js index 870c7439b3..5e69c4207f 100644 --- a/features/step_definitions/tx-history-steps.js +++ b/features/step_definitions/tx-history-steps.js @@ -7,7 +7,7 @@ import moment from 'moment'; import { getLovefieldTxs, getFeatureData } from '../support/mockDataBuilder'; import i18n from '../support/helpers/i18n-helpers'; -function verifyAllTxsFields(txType, txAmount, txTime, txStatus, txFromList, txToList, +function verifyAllTxsFields(txType, txAmount, txTime, txStatus, txFee, txFromList, txToList, txId, expectedTx, txConfirmations) { chai.expect(txType).to.equal(expectedTx.txType); chai.expect(txAmount.split(' ')[0]).to.equal(expectedTx.txAmount); @@ -109,10 +109,10 @@ Then( await clickeableElement.click(); const txData = await actualTxsList[i].getText(); const txDataFields = txData.split('\n'); - const [txType, txTime, txStatus, txAmount, , txFrom, , txTo, , ...pendingTxFields] + const [txType, txTime, txStatus, txAmount, , txFee, , txFrom, , txTo, , ...pendingTxFields] = txDataFields; const [txId, txConfirmations] = mapPendingTxFields(txExpectedStatus, pendingTxFields); - verifyAllTxsFields(txType, txAmount, txTime, txStatus, [txFrom], + verifyAllTxsFields(txType, txAmount, txTime, txStatus, txFee, [txFrom], [txTo], txId, expectedTxsList[i], txConfirmations); } } diff --git a/features/support/mockData.json b/features/support/mockData.json index 425fb9150a..6bbe6c301a 100644 --- a/features/support/mockData.json +++ b/features/support/mockData.json @@ -348,6 +348,7 @@ "txTimeTitle": "ADA transaction,", "txTime": "2018-01-01T00:02:00.000Z", "txStatus": "TRANSACTION PENDING", + "txFee": "0.000000", "txFrom": ["Ae2tdPwUPEZASB8nPKk1VsePbQZY8ZVv4mGebJ4UwmSBhRo9oR9EqkSzxoA"], "txTo": ["Ae2tdPwUPEZASB8nPKk1VsePbQZY8ZVv4mGebJ4UwmSBhRo9oR9Eqkzyxwv"], "txId": "e97Nafb63e9dc18a54b35cb51i63317461978bc7c90o02661d33lf2464ef693Z" @@ -358,6 +359,7 @@ "txTimeTitle": "ADA transaction,", "txTime": "2018-01-01T00:01:00.000Z", "txStatus": "TRANSACTION PENDING", + "txFee": "0.000000", "txFrom": ["Ae2tdPwUPEZASB8nPKk1VsePbQZY8ZVv4mGebJ4UwmSBhRo9oR9Eqkabcde"], "txTo": ["Ae2tdPwUPEZASB8nPKk1VsePbQZY8ZVv4mGebJ4UwmSBhRo9oR9EqkSzxoA"], "txId": "e97Nafb63e9dc18a54b35cb51i63317461978bc7c90o02661d33lf2464ef693Y" @@ -368,6 +370,7 @@ "txTimeTitle": "ADA transaction,", "txTime": "2018-01-01T00:00:00.000Z", "txStatus": "HIGH", + "txFee": "0.000000", "txFrom": ["Ae2tdPwUPEZASB8nPKk1VsePbQZY8ZVv4mGebJ4UwmSBhRo9oR9EqkSzxoA"], "txTo": ["Ae2tdPwUPEZASB8nPKk1VsePbQZY8ZVv4mGebJ4UwmSBhRo9oR9Eqkzyxwv"], "txConfirmations": "High. 11 confirmations.", @@ -381,6 +384,7 @@ "txTimeTitle": "ADA transaction,", "txTime": "2018-01-01T00:00:00.000Z", "txStatus": "HIGH", + "txFee": "0.000000", "txFrom": [ "DFvfedPwUPEZASB8nPKk1VsePbQZY8ZVv4mGebJ4UwmSBhRo9oREqkSzxoU" ], diff --git a/features/support/mockDataBuilder.js b/features/support/mockDataBuilder.js index 703ff054db..e64115641e 100644 --- a/features/support/mockDataBuilder.js +++ b/features/support/mockDataBuilder.js @@ -144,6 +144,7 @@ function _getLovefieldTxs( txTimeTitle: 'ADA transaction,', txTime: new Date(txTime).toISOString(), txStatus: index < pendingTxsNumber ? 'TRANSACTION PENDING' : 'HIGH', + txFee: '0.000000', txFrom: ['Ae2dddwUPEZASB8nPKk1VsePbQZY8ZVv4mGebJ4UwmSBhRo9oR9Eqkzyxwv'], txTo: [addressesStartingWith + 'W'], txConfirmations: 'High. 45 confirmations.', diff --git a/features/support/mockDataTypes.js b/features/support/mockDataTypes.js index f3bb89478b..915d043304 100644 --- a/features/support/mockDataTypes.js +++ b/features/support/mockDataTypes.js @@ -32,6 +32,7 @@ export type LovefieldShownWalletTx = { txTimeTitle: string, txTime: string, txStatus: string, + txFee: string, txFrom: Array, txTo: Array, txConfirmations: string, From a38abfcb34a3c401f1b45bd8ef0a7c0bfb348a1e Mon Sep 17 00:00:00 2001 From: sebastiengllmt Date: Fri, 18 Jan 2019 12:17:53 +0900 Subject: [PATCH 5/5] PR feedback --- app/api/ada/index.js | 1 + app/components/wallet/transactions/Transaction.js | 7 ++++++- app/i18n/locales/en-US.json | 1 + app/i18n/locales/ja-JP.json | 1 + app/i18n/locales/ko-KR.json | 1 + app/i18n/locales/ru-RU.json | 1 + app/i18n/locales/zh-Hans.json | 1 + app/i18n/locales/zh-Hant.json | 1 + 8 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/api/ada/index.js b/app/api/ada/index.js index 4f67312639..61c92d80ff 100644 --- a/app/api/ada/index.js +++ b/app/api/ada/index.js @@ -579,6 +579,7 @@ async function _getTxFinancialInfo( fee: BigNumber }> { // Note: logic taken from the mobile version of Yoroi + // https://github.com/Emurgo/yoroi-mobile/blob/a3d72218b1e63f6362152aae2f03c8763c168795/src/crypto/transactionUtils.js#L73-L103 const adaAddresses = await getAdaAddressesList(); const addresses: Array = adaAddresses.map(addr => addr.cadId); diff --git a/app/components/wallet/transactions/Transaction.js b/app/components/wallet/transactions/Transaction.js index e1a3d88360..5907d5de31 100644 --- a/app/components/wallet/transactions/Transaction.js +++ b/app/components/wallet/transactions/Transaction.js @@ -69,6 +69,11 @@ const messages = defineMessages({ defaultMessage: '!!!From address', description: 'From address', }, + fee: { + id: 'wallet.transaction.fee', + defaultMessage: '!!!Fee', + description: 'label for fee for tx', + }, fromAddresses: { id: 'wallet.transaction.addresses.from', defaultMessage: '!!!From addresses', @@ -253,7 +258,7 @@ export default class Transaction extends Component { )}

- Fee: + {intl.formatMessage(messages.fee)}

{formattedWalletAmount(data.fee.abs(), false)}

diff --git a/app/i18n/locales/en-US.json b/app/i18n/locales/en-US.json index 29fb71a7ff..8eba727bc8 100644 --- a/app/i18n/locales/en-US.json +++ b/app/i18n/locales/en-US.json @@ -228,6 +228,7 @@ "wallet.transaction.assuranceLevel.medium": "medium", "wallet.transaction.confirmations": "confirmations", "wallet.transaction.conversion.rate": "Conversion rate", + "wallet.transaction.fee": "Fee", "wallet.transaction.received": "{currency} received", "wallet.transaction.sent": "{currency} sent", "wallet.transaction.state.failed": "Transaction failed", diff --git a/app/i18n/locales/ja-JP.json b/app/i18n/locales/ja-JP.json index 5f2bee986c..18349fd173 100644 --- a/app/i18n/locales/ja-JP.json +++ b/app/i18n/locales/ja-JP.json @@ -228,6 +228,7 @@ "wallet.transaction.assuranceLevel.medium": "中", "wallet.transaction.confirmations": "確認", "wallet.transaction.conversion.rate": "コンバージョン率", + "wallet.transaction.fee": "!!!Fee", "wallet.transaction.received": "{currency} 受信済", "wallet.transaction.sent": "{currency} 送信済", "wallet.transaction.state.failed": "処理に失敗しました", diff --git a/app/i18n/locales/ko-KR.json b/app/i18n/locales/ko-KR.json index 042b29ebd9..e6cec8f18b 100644 --- a/app/i18n/locales/ko-KR.json +++ b/app/i18n/locales/ko-KR.json @@ -228,6 +228,7 @@ "wallet.transaction.assuranceLevel.medium": "중간", "wallet.transaction.confirmations": "확인", "wallet.transaction.conversion.rate": "환율", + "wallet.transaction.fee": "!!!Fee", "wallet.transaction.received": "{currency} 받음", "wallet.transaction.sent": "{currency} 보냄", "wallet.transaction.state.failed": "거래 실패", diff --git a/app/i18n/locales/ru-RU.json b/app/i18n/locales/ru-RU.json index 39747706f4..0bcbf8b334 100644 --- a/app/i18n/locales/ru-RU.json +++ b/app/i18n/locales/ru-RU.json @@ -228,6 +228,7 @@ "wallet.transaction.assuranceLevel.medium": "средний", "wallet.transaction.confirmations": "подтверждения", "wallet.transaction.conversion.rate": "Обменный курс", + "wallet.transaction.fee": "!!!Fee", "wallet.transaction.received": "{currency} получено", "wallet.transaction.sent": "{currency} отправлено", "wallet.transaction.state.failed": "Не удалось провести транзакцию", diff --git a/app/i18n/locales/zh-Hans.json b/app/i18n/locales/zh-Hans.json index 690bc26fe9..1f3e91feca 100644 --- a/app/i18n/locales/zh-Hans.json +++ b/app/i18n/locales/zh-Hans.json @@ -228,6 +228,7 @@ "wallet.transaction.assuranceLevel.medium": "中", "wallet.transaction.confirmations": "确认", "wallet.transaction.conversion.rate": "汇价", + "wallet.transaction.fee": "!!!Fee", "wallet.transaction.received": "已接收 {currency}", "wallet.transaction.sent": "已发送 {currency}", "wallet.transaction.state.failed": "交易失败", diff --git a/app/i18n/locales/zh-Hant.json b/app/i18n/locales/zh-Hant.json index 5f652918c1..9d0372de1f 100644 --- a/app/i18n/locales/zh-Hant.json +++ b/app/i18n/locales/zh-Hant.json @@ -228,6 +228,7 @@ "wallet.transaction.assuranceLevel.medium": "適中", "wallet.transaction.confirmations": "確認", "wallet.transaction.conversion.rate": "匯率", + "wallet.transaction.fee": "!!!Fee", "wallet.transaction.received": "已收到 {currency}", "wallet.transaction.sent": "已傳送 {currency}", "wallet.transaction.state.failed": "交易失敗",