Browse Source
Merge pull request #621 from gre/fix-ripple
Fix ripple and other rendering bugs
master
Gaëtan Renaudeau
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with
38 additions and
31 deletions
-
src/bridge/RippleJSBridge.js
-
src/components/OperationsList/index.js
-
src/components/TranslatedError.js
-
static/i18n/en/errors.yml
-
static/i18n/fr/errors.yml
|
|
@ -256,6 +256,7 @@ const RippleJSBridge: WalletBridge<Transaction> = { |
|
|
|
|
|
|
|
const derivations = getDerivations(currency) |
|
|
|
for (const derivation of derivations) { |
|
|
|
const legacy = derivation !== derivations[derivations.length - 1] |
|
|
|
for (let index = 0; index < 255; index++) { |
|
|
|
const freshAddressPath = derivation({ currency, x: index, segwit: false }) |
|
|
|
const { address, publicKey } = await await getAddress |
|
|
@ -280,6 +281,7 @@ const RippleJSBridge: WalletBridge<Transaction> = { |
|
|
|
if (!info) { |
|
|
|
// account does not exist in Ripple server
|
|
|
|
// we are generating a new account locally
|
|
|
|
if (!legacy) { |
|
|
|
next({ |
|
|
|
id: accountId, |
|
|
|
xpub: '', |
|
|
@ -296,6 +298,7 @@ const RippleJSBridge: WalletBridge<Transaction> = { |
|
|
|
archived: false, |
|
|
|
lastSyncDate: new Date(), |
|
|
|
}) |
|
|
|
} |
|
|
|
break |
|
|
|
} |
|
|
|
|
|
|
@ -315,7 +318,7 @@ const RippleJSBridge: WalletBridge<Transaction> = { |
|
|
|
const account: $Exact<Account> = { |
|
|
|
id: accountId, |
|
|
|
xpub: '', |
|
|
|
name: getAccountPlaceholderName(currency, index), |
|
|
|
name: getAccountPlaceholderName(currency, index, legacy), |
|
|
|
freshAddress, |
|
|
|
freshAddressPath, |
|
|
|
balance, |
|
|
|
|
|
@ -119,7 +119,7 @@ export class OperationsList extends PureComponent<Props, State> { |
|
|
|
<OperationC |
|
|
|
operation={operation} |
|
|
|
account={account} |
|
|
|
key={operation.id} |
|
|
|
key={`${account.id}_${operation.id}`} |
|
|
|
onOperationClick={this.handleClickOperation} |
|
|
|
t={t} |
|
|
|
withAccount={withAccount} |
|
|
|
|
|
@ -4,6 +4,7 @@ |
|
|
|
// - an error can have parameters, to use them, just use field of the Error object, that's what we give to `t()`
|
|
|
|
// - returned value is intentially not styled (is universal). wrap this in whatever you need
|
|
|
|
|
|
|
|
import logger from 'logger' |
|
|
|
import { PureComponent } from 'react' |
|
|
|
import { translate } from 'react-i18next' |
|
|
|
import type { T } from 'types/common' |
|
|
@ -18,7 +19,12 @@ class TranslatedError extends PureComponent<Props> { |
|
|
|
const { t, error } = this.props |
|
|
|
if (!error) return null |
|
|
|
if (typeof error === 'string') return error |
|
|
|
return t(`errors:${error.name}`, error) |
|
|
|
const translation = t(`errors:${error.name}`, error) |
|
|
|
if (translation) { |
|
|
|
return translation |
|
|
|
} |
|
|
|
logger.warn('TranslatedError: no transation!', error.name, error) |
|
|
|
return error.message || error.name || t('errors:generic') |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -1,7 +1,8 @@ |
|
|
|
RangeError: {{message}} |
|
|
|
Error: {{message}} |
|
|
|
LedgerAPIErrorWithMessage: {{message}} |
|
|
|
TransportStatusError: {{message}} |
|
|
|
generic: An error occurred |
|
|
|
RangeError: '{{message}}' |
|
|
|
Error: '{{message}}' |
|
|
|
LedgerAPIErrorWithMessage: '{{message}}' |
|
|
|
TransportStatusError: '{{message}}' |
|
|
|
FeeEstimationFailed: 'fee estimation failed (status: {{status}})' |
|
|
|
NotEnoughBalance: 'Not enough balance' |
|
|
|
BtcUnmatchedApp: 'You must open application ‘{{currencyName}}’ on the device' |
|
|
|
|
|
@ -1,12 +1,9 @@ |
|
|
|
--- |
|
|
|
RangeError: |
|
|
|
- message |
|
|
|
Error: |
|
|
|
- message |
|
|
|
LedgerAPIErrorWithMessage: |
|
|
|
- message |
|
|
|
TransportStatusError: |
|
|
|
- message |
|
|
|
generic: An error occurred |
|
|
|
RangeError: '{{message}}' |
|
|
|
Error: '{{message}}' |
|
|
|
LedgerAPIErrorWithMessage: '{{message}}' |
|
|
|
TransportStatusError: '{{message}}' |
|
|
|
FeeEstimationFailed: 'fee estimation failed (status: {{status}})' |
|
|
|
NotEnoughBalance: 'Not enough balance' |
|
|
|
BtcUnmatchedApp: 'You must open application ‘{{currencyName}}’ on the device' |
|
|
|