mirror of
https://github.com/trezor/trezor-wallet
synced 2025-06-18 14:08:49 +00:00
Merge branch 'master' into feature/stealth-mode
This commit is contained in:
commit
7c37d6745b
@ -93,13 +93,21 @@ export const toggleSidebar = (): WalletAction => ({
|
|||||||
|
|
||||||
export const fetchLocale = (locale: string): ThunkAction => (dispatch: Dispatch): void => {
|
export const fetchLocale = (locale: string): ThunkAction => (dispatch: Dispatch): void => {
|
||||||
fetch(`./l10n/${locale}.json`)
|
fetch(`./l10n/${locale}.json`)
|
||||||
.then(response => response.json())
|
.then(response => {
|
||||||
|
if (response.ok) {
|
||||||
|
return response.json();
|
||||||
|
}
|
||||||
|
throw Error(response.statusText);
|
||||||
|
})
|
||||||
.then(messages => {
|
.then(messages => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: WALLET.SET_LANGUAGE,
|
type: WALLET.SET_LANGUAGE,
|
||||||
locale,
|
locale,
|
||||||
messages,
|
messages,
|
||||||
});
|
});
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error(error);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -131,15 +131,12 @@ export const recalculateTotalAmount = ($state: State): PayloadAction<State> => (
|
|||||||
} else {
|
} else {
|
||||||
const b = new BigNumber(account.balance).minus(pendingAmount);
|
const b = new BigNumber(account.balance).minus(pendingAmount);
|
||||||
state.amount = calculateMaxAmount(b, state.gasPrice, state.gasLimit);
|
state.amount = calculateMaxAmount(b, state.gasPrice, state.gasLimit);
|
||||||
|
|
||||||
// calculate amount in local currency
|
|
||||||
const { localCurrency } = getState().sendFormEthereum;
|
|
||||||
const fiatRates = getState().fiat.find(f => f.network === state.networkName);
|
|
||||||
const localAmount = toFiatCurrency(state.amount, localCurrency, fiatRates);
|
|
||||||
if (localAmount) {
|
|
||||||
state.localAmount = localAmount;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// calculate amount in local currency
|
||||||
|
const { localCurrency } = getState().sendFormEthereum;
|
||||||
|
const fiatRates = getState().fiat.find(f => f.network === state.currency.toLowerCase());
|
||||||
|
const localAmount = toFiatCurrency(state.amount, localCurrency, fiatRates);
|
||||||
|
state.localAmount = localAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
state.total = calculateTotal(isToken ? '0' : state.amount, state.gasPrice, state.gasLimit);
|
state.total = calculateTotal(isToken ? '0' : state.amount, state.gasPrice, state.gasLimit);
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
import * as utils from '../cryptoUriParser';
|
|
||||||
|
|
||||||
describe('crypto uri parser', () => {
|
|
||||||
it('parseUri', () => {
|
|
||||||
expect(utils.parseUri('http://www.trezor.io')).toEqual({ address: '//www.trezor.io' }); // TODO: Error in function
|
|
||||||
expect(utils.parseUri('www.trezor.io')).toEqual({ address: 'www.trezor.io' });
|
|
||||||
expect(utils.parseUri('www.trezor.io/TT')).toEqual({ address: 'www.trezor.io/TT' });
|
|
||||||
expect(utils.parseUri('www.trezor.io/TT?param1=aha')).toEqual({
|
|
||||||
address: 'www.trezor.io/TT',
|
|
||||||
param1: 'aha',
|
|
||||||
});
|
|
||||||
expect(utils.parseUri('www.trezor.io/TT?param1=aha¶m2=hah')).toEqual({
|
|
||||||
address: 'www.trezor.io/TT',
|
|
||||||
param1: 'aha',
|
|
||||||
param2: 'hah',
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
@ -65,7 +65,6 @@ const buildCurrencyOption = currency => {
|
|||||||
|
|
||||||
const WalletSettings = (props: Props) => (
|
const WalletSettings = (props: Props) => (
|
||||||
<Content>
|
<Content>
|
||||||
{console.log(props)}
|
|
||||||
<Section>
|
<Section>
|
||||||
<LabelTop>
|
<LabelTop>
|
||||||
<FormattedMessage {...l10nMessages.TR_LOCAL_CURRENCY} />
|
<FormattedMessage {...l10nMessages.TR_LOCAL_CURRENCY} />
|
||||||
|
Loading…
Reference in New Issue
Block a user