Skip to content

Commit

Permalink
Merge pull request #250 from forbole/dev
Browse files Browse the repository at this point in the history
fix ledger add account to wallet issue
  • Loading branch information
calvinkei committed Sep 2, 2021
2 parents 3397bb3 + 464510e commit 4580fcf
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 13 deletions.
14 changes: 10 additions & 4 deletions components/AddAccountButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { Dialog, IconButton, useTheme } from '@material-ui/core'
import useTranslation from 'next-translate/useTranslation'
import React from 'react'
import get from 'lodash/get'
import useStyles from './styles'
import { useWalletsContext } from '../../contexts/WalletsContext'
import useIconProps from '../../misc/useIconProps'
Expand Down Expand Up @@ -71,6 +72,7 @@ const AddAccountButton: React.FC<AddAccountButtonProps> = ({ walletId }) => {

React.useEffect(() => {
if (dialogOpen) {
setCrypto('')
setSecurityPassword('')
setStage(wallet.type === 'ledger' ? Stage.ConnectLedger : Stage.SecurityPassword, true)
}
Expand All @@ -93,10 +95,14 @@ const AddAccountButton: React.FC<AddAccountButtonProps> = ({ walletId }) => {
{stage === Stage.ConnectLedger ? (
<ConnectLedgerDialogContent
onConnect={(transport) => {
ledgerTransport = transport
setStage(Stage.SelectNetwork)
if (!crypto) {
setStage(Stage.SelectNetwork)
} else {
ledgerTransport = transport
setStage(Stage.SelectAddresses)
}
}}
ledgerAppName={cryptocurrencies[crypto].ledgerAppName}
ledgerAppName={get(cryptocurrencies[crypto], 'ledgerAppName')}
/>
) : null}
{stage === Stage.SecurityPassword ? (
Expand All @@ -113,7 +119,7 @@ const AddAccountButton: React.FC<AddAccountButtonProps> = ({ walletId }) => {
<SelectNetworkContent
onSelect={(c) => {
setCrypto(c)
setStage(Stage.SelectAddresses)
setStage(wallet.type === 'ledger' ? Stage.ConnectLedger : Stage.SelectAddresses)
}}
/>
) : null}
Expand Down
2 changes: 1 addition & 1 deletion components/AssetDistributionChart/ValidatorPopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const ValidatorPopover: React.FC<ValidatorPopoverProps> = ({
</Box>
<Box p={2} pt={0}>
<Typography variant="body2" color="textSecondary">
{t('total delegated amount')}
{t('total delegation amount')}
</Typography>
<Typography>{formatCurrency(getTokenAmountBalance(balance), currency, lang)}</Typography>
</Box>
Expand Down
2 changes: 1 addition & 1 deletion components/DelegationDialog/SelectAmount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const SelectAmount: React.FC<SelectAmountProps> = ({ account, onConfirm, availab
{formatTokenAmount(availableAmount, account.crypto, lang, ', ')}
</b>
</Typography>
<Typography>{t('total delegated amount')}</Typography>
<Typography>{t('total delegation amount')}</Typography>
<TokenAmountInput
value={amount}
denom={denom || ''}
Expand Down
2 changes: 1 addition & 1 deletion components/DelegationDialog/SelectValidators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const SelectValidators: React.FC<SelectValidatorsProps> = ({
<DialogContent className={classes.dialogContent}>
<Box ml={4} minHeight={360} maxHeight={600}>
<Typography className={classes.marginBottom}>
{t('total delegated amount')}{' '}
{t('total delegation amount')}{' '}
<b className={classes.marginLeft}>{formatCrypto(amount, denom, lang)}</b>
</Typography>
<Grid container spacing={4}>
Expand Down
2 changes: 1 addition & 1 deletion components/RedelegateDialog/SelectAmount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const SelectAmount: React.FC<SelectAmountProps> = ({
<DialogContent className={classes.dialogContent}>
<Box ml={4} minHeight={360} maxHeight={600}>
<Typography className={classes.marginBottom}>
{t('total delegated amount')}{' '}
{t('total delegation amount')}{' '}
<b className={classes.marginLeft}>
{formatTokenAmount(availableAmount, account.crypto, lang, ', ')}
</b>
Expand Down
2 changes: 1 addition & 1 deletion components/RedelegateDialog/SelectValidators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const SelectValidators: React.FC<SelectValidatorsProps> = ({
<DialogContent className={classes.dialogContent}>
<Box ml={4} minHeight={360} maxHeight={600}>
<Typography className={classes.marginBottom}>
{t('total delegated amount')}{' '}
{t('total delegation amount')}{' '}
<b className={classes.marginLeft}>{formatCrypto(amount, denom, lang)}</b>
</Typography>
<Grid container spacing={4}>
Expand Down
2 changes: 1 addition & 1 deletion components/UndelegateDialog/SelectValidators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const SelectValidators: React.FC<SelectValidatorsProps> = ({
<DialogContent className={classes.dialogContent}>
<Box ml={4} minHeight={360} maxHeight={600}>
<Typography className={classes.marginBottom}>
{t('total delegated amount')}{' '}
{t('total delegation amount')}{' '}
<b className={classes.marginLeft}>
{formatTokenAmount(availableAmount, denom, lang, ', ')}
</b>
Expand Down
2 changes: 1 addition & 1 deletion locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
"fundActivity": "funded",
"toCommunityPool": "to community pool",
"available amount": "Available amount",
"total delegated amount": "Total Delegated Amount",
"total delegation amount": "Total Delegation Amount",
"delegate to": "Delegate to",
"select validator": "Select validator",
"amount": "Amount",
Expand Down
2 changes: 1 addition & 1 deletion locales/zh/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
"fundActivity": "[zh] funded",
"toCommunityPool": "[zh] to community pool",
"available amount": "[zh] Available amount",
"total delegated amount": "[zh] Total Delegated Amount",
"total delegation amount": "[zh] total delegation amount",
"delegate to": "[zh] Delegate to",
"select validator": "[zh] Select validator",
"amount": "[zh] Amount",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "forbole-x",
"version": "0.4.3",
"version": "0.4.4",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down

0 comments on commit 4580fcf

Please sign in to comment.