Merge branch 'master' into feature/stealth-mode

pull/454/head
slowbackspace 5 years ago
commit 7c37d6745b

@ -93,13 +93,21 @@ export const toggleSidebar = (): WalletAction => ({
export const fetchLocale = (locale: string): ThunkAction => (dispatch: Dispatch): void => {
fetch(`./l10n/${locale}.json`)
.then(response => response.json())
.then(response => {
if (response.ok) {
return response.json();
}
throw Error(response.statusText);
})
.then(messages => {
dispatch({
type: WALLET.SET_LANGUAGE,
locale,
messages,
});
})
.catch(error => {
console.error(error);
});
};

@ -131,15 +131,12 @@ export const recalculateTotalAmount = ($state: State): PayloadAction<State> => (
} else {
const b = new BigNumber(account.balance).minus(pendingAmount);
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);

@ -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&param2=hah')).toEqual({
address: 'www.trezor.io/TT',
param1: 'aha',
param2: 'hah',
});
});
});

@ -65,7 +65,6 @@ const buildCurrencyOption = currency => {
const WalletSettings = (props: Props) => (
<Content>
{console.log(props)}
<Section>
<LabelTop>
<FormattedMessage {...l10nMessages.TR_LOCAL_CURRENCY} />

Loading…
Cancel
Save