diff --git a/jsconfig.json b/jsconfig.json index 49f83b2180..e28e5526f3 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -9,6 +9,7 @@ "@block/*": ["./packages/block/*"], "@bookmark/*": ["./packages/bookmark/*"], "@common/*": ["./packages/common/*"], + "@legacy/*": ["./packages/legacy/*"], "@dpos/*": ["./packages/dpos/*"], "@network/*": ["./packages/network/*"], "@settings/*": ["./packages/settings/*"], @@ -16,7 +17,6 @@ "@transaction/*": ["./packages/transaction/*"], "@updater/*": ["./packages/updater/*"], "@wallet/*": ["./packages/wallet/*"], - "@legacy/*": ["./packages/legacy/*"], "@views/*": ["./packages/views/*"], "@shared/*": ["./packages/views/shared/*"], "@basics/*": ["./packages/views/basics/*"], diff --git a/packages/block/store/reducer.test.js b/packages/block/store/reducer.test.js index 0b800a26b2..0346eb884f 100644 --- a/packages/block/store/reducer.test.js +++ b/packages/block/store/reducer.test.js @@ -1,4 +1,4 @@ -import accounts from '@tests/constants/accounts'; +import accounts from '@tests/constants/wallets'; import actionTypes from './actionTypes'; import blocksReducer from './reducer'; diff --git a/packages/bookmark/list/list.js b/packages/bookmark/list/list.js index 9b30537ef1..7240f8fd92 100644 --- a/packages/bookmark/list/list.js +++ b/packages/bookmark/list/list.js @@ -9,7 +9,7 @@ import Tooltip from '@basics/tooltip/tooltip'; import { truncateAddress } from '@wallet/utilities/account'; import { Input } from '@basics/inputs'; import { PrimaryButton, TertiaryButton } from '@basics/buttons'; -import AccountVisual from '@wallet/detail/info/accountVisual'; +import WalletVisual from '@wallet/detail/identity/walletVisual'; import Box from '@basics/box'; import BoxHeader from '@basics/box/header'; import BoxContent from '@basics/box/content'; @@ -163,13 +163,13 @@ export class BookmarksList extends React.Component { onClick={e => this.onRowClick(e, bookmark)} key={bookmark.address} className={`${styles.row} ${editedAddress === bookmark.address ? styles.editing : ''} ${bookmark.disabled ? styles.disabled : ''} bookmark-list-row`} - to={`${routes.account.path}?address=${bookmark.address}`} + to={`${routes.explorer.path}?address=${bookmark.address}`} >
{ token.active === tokenMap.LSK.key ? ( - diff --git a/packages/bookmark/store/action.js b/packages/bookmark/store/action.js index 8ca4d043a8..9ad6694f18 100644 --- a/packages/bookmark/store/action.js +++ b/packages/bookmark/store/action.js @@ -11,9 +11,9 @@ export const bookmarksRetrieved = () => (dispatch) => { getFromStorage('bookmarks', emptyBookmarks, (data) => { const bookmarks = { BTC: data.BTC, - LSK: data.LSK.map(account => ({ - ...account, - disabled: validateAddress('LSK', account.address) === 1, + LSK: data.LSK.map(wallet => ({ + ...wallet, + disabled: validateAddress('LSK', wallet.address) === 1, })), }; dispatch({ @@ -23,13 +23,13 @@ export const bookmarksRetrieved = () => (dispatch) => { }); }; -export const bookmarkAdded = ({ account, token = tokenMap.LSK.key }) => ({ - data: { account, token }, +export const bookmarkAdded = ({ wallet, token = tokenMap.LSK.key }) => ({ + data: { wallet, token }, type: actionTypes.bookmarkAdded, }); -export const bookmarkUpdated = ({ account, token = tokenMap.LSK.key }) => ({ - data: { account, token }, +export const bookmarkUpdated = ({ wallet, token = tokenMap.LSK.key }) => ({ + data: { wallet, token }, type: actionTypes.bookmarkUpdated, }); diff --git a/packages/bookmark/store/action.test.js b/packages/bookmark/store/action.test.js index e046dd48ff..e267a115d6 100644 --- a/packages/bookmark/store/action.test.js +++ b/packages/bookmark/store/action.test.js @@ -1,7 +1,7 @@ import { tokenMap } from '@token/configuration/tokens'; import { getFromStorage } from '@common/utilities/localJSONStorage'; import { emptyBookmarks } from '@bookmark/utilities/bookmarks'; -import accounts from '@tests/constants/accounts'; +import wallets from '@tests/constants/wallets'; import actionTypes from './actionTypes'; import { bookmarksRetrieved, @@ -16,11 +16,11 @@ jest.mock('@common/utilities/localJSONStorage', () => ({ describe('actions: boomarks', () => { const data = { - account: { - address: accounts.genesis.summary.address, - publicKey: accounts.genesis.summary.publicKey, - balance: accounts.genesis.balance, - title: accounts.genesis.summary.address, + wallet: { + address: wallets.genesis.summary.address, + publicKey: wallets.genesis.summary.publicKey, + balance: wallets.genesis.balance, + title: wallets.genesis.summary.address, }, token: tokenMap.LSK.key, }; @@ -53,27 +53,27 @@ describe('actions: boomarks', () => { }); }); - it('should create an action to add a bookmark account', () => { + it('should create an action to add a bookmark wallet', () => { const expectedAction = { data, type: actionTypes.bookmarkAdded, }; expect(bookmarkAdded(data)).toEqual(expectedAction); - expect(bookmarkAdded({ account: data.account })).toEqual(expectedAction); + expect(bookmarkAdded({ wallet: data.wallet })).toEqual(expectedAction); }); - it('should create an action to update a bookmark account', () => { + it('should create an action to update a bookmark wallet', () => { const expectedAction = { data, type: actionTypes.bookmarkUpdated, }; expect(bookmarkUpdated(data)).toEqual(expectedAction); - expect(bookmarkUpdated({ account: data.account })).toEqual(expectedAction); + expect(bookmarkUpdated({ wallet: data.wallet })).toEqual(expectedAction); }); - it('should create an action to remove a bookmark account', () => { + it('should create an action to remove a bookmark wallet', () => { const removedData = { - address: accounts.genesis.summary.address, + address: wallets.genesis.summary.address, token: tokenMap.LSK.key, }; const expectedAction = { @@ -81,6 +81,6 @@ describe('actions: boomarks', () => { type: actionTypes.bookmarkRemoved, }; expect(bookmarkRemoved(removedData)).toEqual(expectedAction); - expect(bookmarkRemoved({ address: accounts.genesis.summary.address })).toEqual(expectedAction); + expect(bookmarkRemoved({ address: wallets.genesis.summary.address })).toEqual(expectedAction); }); }); diff --git a/packages/bookmark/store/middleware.test.js b/packages/bookmark/store/middleware.test.js index 00d878ba49..04b8b483ee 100644 --- a/packages/bookmark/store/middleware.test.js +++ b/packages/bookmark/store/middleware.test.js @@ -1,5 +1,5 @@ import * as localJSONStorage from '@common/utilities/localJSONStorage'; -import accounts from '@tests/constants/accounts'; +import accounts from '@tests/constants/wallets'; import actionTypes from './actionTypes'; import bookmarksMiddleware from './middleware'; diff --git a/packages/bookmark/store/reducer.js b/packages/bookmark/store/reducer.js index 1657c967d2..9063a7477d 100644 --- a/packages/bookmark/store/reducer.js +++ b/packages/bookmark/store/reducer.js @@ -10,18 +10,18 @@ const bookmarks = (state = emptyBookmarks, action) => { ...state, [action.data.token]: [ { - ...action.data.account, - title: action.data.account.title.trim(), + ...action.data.wallet, + title: action.data.wallet.title.trim(), }, ...state[action.data.token], ], }; case actionTypes.bookmarkUpdated: { - const { account, token } = action.data; + const { wallet, token } = action.data; const tokenBookmarks = state[token]; const indexOfBookmark = getIndexOfBookmark(state, { - address: account.address, + address: wallet.address, token, }); return (indexOfBookmark !== -1 @@ -31,9 +31,9 @@ const bookmarks = (state = emptyBookmarks, action) => { ...tokenBookmarks.slice(0, indexOfBookmark), { ...tokenBookmarks[indexOfBookmark], - address: account.address, - title: account.title.trim(), - publicKey: account.publicKey, + address: wallet.address, + title: wallet.title.trim(), + publicKey: wallet.publicKey, }, ...tokenBookmarks.slice(indexOfBookmark + 1), ], diff --git a/packages/bookmark/store/reducer.test.js b/packages/bookmark/store/reducer.test.js index 406db38e1c..1f55c34618 100644 --- a/packages/bookmark/store/reducer.test.js +++ b/packages/bookmark/store/reducer.test.js @@ -1,112 +1,112 @@ import { bookmarkAdded, bookmarkUpdated, bookmarkRemoved, } from '@common/store/actions'; -import accounts from '@tests/constants/accounts'; +import wallets from '@tests/constants/wallets'; import actionTypes from './actionTypes'; import bookmarks from './reducer'; // eslint-disable-next-line camelcase -const { genesis, delegate, empty_account } = accounts; +const { genesis, delegate, empty_wallet } = wallets; describe('Reducer: bookmarks(state, action)', () => { - const account = { + const wallet = { address: genesis.summary.address, title: genesis.summary.address, publicKey: genesis.summary.publicKey, }; - const account2 = { + const wallet2 = { address: delegate.summary.address, title: genesis.summary.address, publicKey: delegate.summary.publicKey, }; - it(`should return accounts with added account if action.type is ${actionTypes.bookmarkAdded}`, () => { - const account3 = { - address: empty_account.summary.address, - title: empty_account.summary.address, - publicKey: empty_account.summary.publicKey, + it(`should return wallets with added wallet if action.type is ${actionTypes.bookmarkAdded}`, () => { + const wallet3 = { + address: empty_wallet.summary.address, + title: empty_wallet.summary.address, + publicKey: empty_wallet.summary.publicKey, }; - const state = { LSK: [account, account2], BTC: [] }; - const action = bookmarkAdded({ account: account3, token: 'BTC' }); + const state = { LSK: [wallet, wallet2], BTC: [] }; + const action = bookmarkAdded({ wallet: wallet3, token: 'BTC' }); const changedState = bookmarks(state, action); - expect(changedState.LSK[0]).toEqual(account); - expect(changedState.LSK[1]).toEqual(account2); - expect(changedState.BTC[0]).toMatchObject(account3); + expect(changedState.LSK[0]).toEqual(wallet); + expect(changedState.LSK[1]).toEqual(wallet2); + expect(changedState.BTC[0]).toMatchObject(wallet3); }); - it(`should return accounts with added account and trimmed title if action.type is ${actionTypes.bookmarkAdded}`, () => { - const account3 = { - address: empty_account.summary.address, - title: empty_account.summary.address, - publicKey: empty_account.summary.publicKey, + it(`should return wallets with added wallet and trimmed title if action.type is ${actionTypes.bookmarkAdded}`, () => { + const wallet3 = { + address: empty_wallet.summary.address, + title: empty_wallet.summary.address, + publicKey: empty_wallet.summary.publicKey, }; - const state = { LSK: [account, account2], BTC: [] }; + const state = { LSK: [wallet, wallet2], BTC: [] }; const action = bookmarkAdded({ - account: { - ...account3, - title: ` ${account3.title} `, + wallet: { + ...wallet3, + title: ` ${wallet3.title} `, }, token: 'BTC', }); const changedState = bookmarks(state, action); - expect(changedState.LSK[0]).toEqual(account); - expect(changedState.LSK[1]).toEqual(account2); - expect(changedState.BTC[0]).toMatchObject(account3); + expect(changedState.LSK[0]).toEqual(wallet); + expect(changedState.LSK[1]).toEqual(wallet2); + expect(changedState.BTC[0]).toMatchObject(wallet3); }); - it(`should return accounts with updated account if action.type is ${actionTypes.bookmarkUpdated}`, () => { - const updatedAccount = { + it(`should return wallets with updated wallet if action.type is ${actionTypes.bookmarkUpdated}`, () => { + const updatedWallet = { address: delegate.summary.address, title: 'bob', publicKey: delegate.summary.publicKey, }; - const state = { LSK: [account, account2], BTC: [] }; - const action = bookmarkUpdated({ account: updatedAccount }); + const state = { LSK: [wallet, wallet2], BTC: [] }; + const action = bookmarkUpdated({ wallet: updatedWallet }); const changedState = bookmarks(state, action); - expect(changedState.LSK[0]).toEqual(account); - expect(changedState.LSK[1]).toEqual(updatedAccount); + expect(changedState.LSK[0]).toEqual(wallet); + expect(changedState.LSK[1]).toEqual(updatedWallet); }); - it(`should return accounts with updated account and trimmed title if action.type is ${actionTypes.bookmarkUpdated}`, () => { - const updatedAccount = { + it(`should return wallets with updated wallet and trimmed title if action.type is ${actionTypes.bookmarkUpdated}`, () => { + const updatedWallet = { address: delegate.summary.address, title: 'bob', publicKey: delegate.summary.publicKey, }; - const state = { LSK: [account, account2], BTC: [] }; + const state = { LSK: [wallet, wallet2], BTC: [] }; const action = bookmarkUpdated({ - account: { - ...updatedAccount, + wallet: { + ...updatedWallet, title: ' bob ', }, }); const changedState = bookmarks(state, action); - expect(changedState.LSK[0]).toEqual(account); - expect(changedState.LSK[1]).toEqual(updatedAccount); + expect(changedState.LSK[0]).toEqual(wallet); + expect(changedState.LSK[1]).toEqual(updatedWallet); }); - it(`should return accounts without deleted account if action.type is ${actionTypes.bookmarkRemoved}`, () => { - const state = { LSK: [account, account2] }; - const action = bookmarkRemoved({ address: account2.address, token: 'LSK' }); + it(`should return wallets without deleted wallet if action.type is ${actionTypes.bookmarkRemoved}`, () => { + const state = { LSK: [wallet, wallet2] }; + const action = bookmarkRemoved({ address: wallet2.address, token: 'LSK' }); const changedState = bookmarks(state, action); - expect(changedState.LSK[0]).toEqual(account); + expect(changedState.LSK[0]).toEqual(wallet); expect(changedState.LSK[1]).toEqual(undefined); }); it('should return validated bookmarks if action.type = actionType.bookmarksRetrieved', () => { const action = { type: actionTypes.bookmarksRetrieved, - data: { LSK: [account, account2], BTC: [] }, + data: { LSK: [wallet, wallet2], BTC: [] }, }; let state; diff --git a/packages/common/store/actions/urlProcessor.test.js b/packages/common/store/actions/urlProcessor.test.js index 8f28709d61..99e693627d 100644 --- a/packages/common/store/actions/urlProcessor.test.js +++ b/packages/common/store/actions/urlProcessor.test.js @@ -1,5 +1,5 @@ import * as accounts from '@wallet/utilities/api'; -import mockAccounts from '@tests/constants/accounts'; +import mockAccounts from '@tests/constants/wallets'; import setVotesByLaunchProtocol from './urlProcessor'; jest.mock('@wallet/utilities/api', () => ({ diff --git a/packages/common/store/middlewares/hwManager.test.js b/packages/common/store/middlewares/hwManager.test.js index 3ec86144ac..8c4529e345 100644 --- a/packages/common/store/middlewares/hwManager.test.js +++ b/packages/common/store/middlewares/hwManager.test.js @@ -1,7 +1,7 @@ import { toast } from 'react-toastify'; import { subscribeToDeviceConnected, subscribeToDeviceDisconnected } from '@wallet/utilities/hwManager'; import { addSearchParamsToUrl } from '@screens/router/searchParams'; -import accounts from '@tests/constants/accounts'; +import accounts from '@tests/constants/wallets'; import actionTypes from '../actions/actionTypes'; import hwManagerMiddleware from './hwManager'; diff --git a/packages/common/store/reducers/index.js b/packages/common/store/reducers/index.js index 16d5040067..9e5ef1c96b 100644 --- a/packages/common/store/reducers/index.js +++ b/packages/common/store/reducers/index.js @@ -1,4 +1,4 @@ -export { default as account } from '@wallet/store/reducer'; +export { default as wallet } from '@wallet/store/reducer'; export { default as blocks } from '@block/store/reducer'; export { default as bookmarks } from '@bookmark/store/reducer'; export { default as network } from '@network/store/reducer'; diff --git a/packages/common/store/selectors.js b/packages/common/store/selectors.js index e8e2eda24a..566afdf634 100644 --- a/packages/common/store/selectors.js +++ b/packages/common/store/selectors.js @@ -1,24 +1,24 @@ -const selectAccount = state => state.account; +const selectAccount = state => state.wallet; const selectActiveToken = state => state.settings.token.active; -const selectAddress = state => state.account.info[state.settings.token.active].address; +const selectAddress = state => state.wallet.info[state.settings.token.active].address; const selectLSKAddress = state => - (state.account.info ? state.account.info.LSK.summary.address : undefined); + (state.wallet.info ? state.wallet.info.LSK.summary.address : undefined); const selectBTCAddress = state => - (state.account.info ? state.account.info.BTC.summary.address : undefined); -const selectPublicKey = state => state.account.info[state.settings.token.active].publicKey; + (state.wallet.info ? state.wallet.info.BTC.summary.address : undefined); +const selectPublicKey = state => state.wallet.info[state.settings.token.active].publicKey; const selectTransactions = state => state.transactions; const selectActiveTokenAccount = (state) => { - if (!state.account.info) { + if (!state.wallet.info) { return {}; } return { - ...state.account.info[state.settings.token.active], + ...state.wallet.info[state.settings.token.active], passphrase: state.passphrase, hwInfo: state.hwInfo, }; }; const selectAccountBalance = state => ( - state.account.info ? state.account.info[state.settings.token.active].summary.balance : undefined); + state.wallet.info ? state.wallet.info[state.settings.token.active].summary.balance : undefined); const selectBookmarks = state => state.bookmarks[state.settings.token.active]; const selectBookmark = (state, address) => state.bookmarks[state.settings.token.active].find(item => (item.address === address)); diff --git a/packages/common/utilities/login.test.js b/packages/common/utilities/login.test.js index 3f9701204c..b5bc690c3c 100644 --- a/packages/common/utilities/login.test.js +++ b/packages/common/utilities/login.test.js @@ -1,4 +1,4 @@ -import accounts from '@tests/constants/accounts'; +import accounts from '@tests/constants/wallets'; import { validateUrl, shouldAutoLogIn, addHttp } from './login'; describe('Login', () => { diff --git a/packages/common/utilities/validators.test.js b/packages/common/utilities/validators.test.js index 5d958dbb66..e139e130d9 100644 --- a/packages/common/utilities/validators.test.js +++ b/packages/common/utilities/validators.test.js @@ -1,6 +1,6 @@ import networks from '@network/configuration/networks'; import i18n from '@setup/i18n/i18n'; -import accounts from '@tests/constants/accounts'; +import accounts from '@tests/constants/wallets'; import { validateAddress, validateLSKPublicKey, diff --git a/packages/dpos/detail/info/warnPunishedDelegate/warnPunishedDelegate.js b/packages/dpos/detail/info/warnPunishedDelegate/warnPunishedDelegate.js index 071c05195e..a977615a57 100644 --- a/packages/dpos/detail/info/warnPunishedDelegate/warnPunishedDelegate.js +++ b/packages/dpos/detail/info/warnPunishedDelegate/warnPunishedDelegate.js @@ -21,7 +21,7 @@ const WarnPunishedDelegate = ({ const theme = useTheme(); useEffect(() => { - if (history.location.pathname !== routes.account.path) { + if (history.location.pathname !== routes.explorer.path) { FlashMessageHolder.deleteMessage('WarnPunishedDelegate'); } }, [history.location.pathname]); diff --git a/packages/dpos/store/actions/voting.js b/packages/dpos/store/actions/voting.js index c9b27779f0..9209256358 100644 --- a/packages/dpos/store/actions/voting.js +++ b/packages/dpos/store/actions/voting.js @@ -49,10 +49,10 @@ export const voteEdited = data => async (dispatch, getState) => { if (vote.username) { return vote; } - const account = (await getAccount({ + const wallet = (await getAccount({ network, params: { address: vote.address }, }, settings.token.active)) || {}; - const username = account.dpos?.delegate?.username ?? ''; + const username = wallet.dpos?.delegate?.username ?? ''; return { ...vote, username }; })); @@ -77,20 +77,20 @@ export const votesSubmitted = ({ fee, votes }) => async (dispatch, getState) => { const state = getState(); // @todo Fix this by #3898 - const activeAccount = { - ...state.account.info.LSK, - hwInfo: isEmpty(state.account.hwInfo) ? undefined : state.account.hwInfo, - passphrase: state.account.passphrase, + const activeWallet = { + ...state.wallet.info.LSK, + hwInfo: isEmpty(state.wallet.hwInfo) ? undefined : state.wallet.hwInfo, + passphrase: state.wallet.passphrase, }; const [error, tx] = await to(create({ network: state.network, - account: activeAccount, + wallet: activeWallet, transactionObject: { fee, votes, - nonce: activeAccount.sequence.nonce, - senderPublicKey: activeAccount.summary.publicKey, + nonce: activeWallet.sequence.nonce, + senderPublicKey: activeWallet.summary.publicKey, moduleAssetId: MODULE_ASSETS_NAME_ID_MAP.voteDelegate, }, }, tokenMap.LSK.key)); @@ -111,12 +111,12 @@ export const votesSubmitted = ({ fee, votes }) => }; /** - * Fetches the list of votes of the host account. + * Fetches the list of votes of the host wallet. */ export const votesRetrieved = () => async (dispatch, getState) => { - const { account, network } = getState(); - const address = account.info[tokenMap.LSK.key].summary.address; + const { wallet, network } = getState(); + const address = wallet.info[tokenMap.LSK.key].summary.address; try { const votes = await getVotes({ network, params: { address } }); dispatch({ @@ -127,7 +127,7 @@ export const votesRetrieved = () => dispatch({ type: actionTypes.votesRetrieved, data: { - account: {}, + wallet: {}, }, }); } diff --git a/packages/dpos/store/actions/voting.test.js b/packages/dpos/store/actions/voting.test.js index 3f8c87e661..efb30a78cf 100644 --- a/packages/dpos/store/actions/voting.test.js +++ b/packages/dpos/store/actions/voting.test.js @@ -1,11 +1,11 @@ -import { loginTypes } from '@views/configuration'; +import loginTypes from '@wallet/configuration/loginTypes'; import networks from '@network/configuration/networks'; import * as transactionApi from '@transaction/utilities/api'; import * as delegateApi from '@dpos/utilities/api'; import * as accountApi from '@wallet/utilities/api'; import * as hwManager from '@transaction/utilities/hwManager'; import sampleVotes from '@tests/constants/votes'; -import accounts from '@tests/constants/accounts'; +import wallets from '@tests/constants/wallets'; import actionTypes from './actionTypes'; import { voteEdited, @@ -42,7 +42,7 @@ describe('actions: voting', () => { }, }, }, - account: { + wallet: { loginType: 0, info: { LSK: { @@ -71,7 +71,7 @@ describe('actions: voting', () => { describe('voteEdited', () => { it('should create an action to add data to toggle the vote status for any given delegate', async () => { - accountApi.getAccount.mockResolvedValue({ data: accounts.genesis }); + accountApi.getAccount.mockResolvedValue({ data: wallets.genesis }); const data = [{ address: 'dummy', amount: 1e10, diff --git a/packages/dpos/utilities/api/index.test.js b/packages/dpos/utilities/api/index.test.js index 18d496f132..9288863928 100644 --- a/packages/dpos/utilities/api/index.test.js +++ b/packages/dpos/utilities/api/index.test.js @@ -1,6 +1,6 @@ import http from '@common/utilities/api/http'; import ws, { subscribe, unsubscribe } from '@common/utilities/api/ws'; -import accounts from '@tests/constants/accounts'; +import accounts from '@tests/constants/wallets'; import * as delegate from './index'; diff --git a/packages/legacy/detail/info/accountMigration/accountMigration.test.js b/packages/legacy/detail/info/accountMigration/accountMigration.test.js deleted file mode 100644 index 33570d0e80..0000000000 --- a/packages/legacy/detail/info/accountMigration/accountMigration.test.js +++ /dev/null @@ -1,27 +0,0 @@ -import React from 'react'; -import { mount } from 'enzyme'; -import { truncateAddress } from '@wallet/utilities/account'; -import accounts from '@tests/constants/accounts'; -import AccountMigration from './index'; - -describe('AccountMigration component', () => { - const props = { - account: accounts.empty_account, - showBalance: true, - }; - - it('should render properly', () => { - const wrapper = mount(); - const html = wrapper.html(); - expect(html).toContain(accounts.empty_account.legacy.address); - expect(html).toContain(truncateAddress(accounts.empty_account.summary.address, 'medium')); - expect(html).toContain('98,970,000 LSK'); - }); - - it('should not render balance', () => { - const wrapper = mount(); - const html = wrapper.html(); - expect(html).toContain(accounts.empty_account.legacy.address, 'medium'); - expect(html).toContain(truncateAddress(accounts.empty_account.summary.address, 'medium')); - }); -}); diff --git a/packages/legacy/detail/info/accountMigration/index.js b/packages/legacy/detail/info/accountMigration/index.js deleted file mode 100644 index 0af0e99259..0000000000 --- a/packages/legacy/detail/info/accountMigration/index.js +++ /dev/null @@ -1,44 +0,0 @@ -import React from 'react'; -import { withTranslation } from 'react-i18next'; -import CopyToClipboard from '@basics/copyToClipboard'; -import Icon from '@basics/icon'; -import LiskAmount from '@shared/liskAmount'; -import AccountVisualWithAddress from '@wallet/detail/info/accountVisual/accountVisualWithAddress'; -import { tokenMap } from '@token/configuration/tokens'; -import styles from './index.css'; - -const token = tokenMap.LSK.key; - -const AccountMigration = ({ t, account, showBalance }) => ( -
-
-
{t('Old account')}
-
- - -
- {showBalance && ( -

- {`${t('Balance')}: `} - -

- )} -
- -
-
{t('New account')}
-
- - -
- {showBalance && ( -

- {`${t('Balance')}: `} - -

- )} -
-
-); - -export default withTranslation()(AccountMigration); diff --git a/packages/legacy/detail/info/accountMigration/index.css b/packages/legacy/detail/info/walletMigration/index.css similarity index 100% rename from packages/legacy/detail/info/accountMigration/index.css rename to packages/legacy/detail/info/walletMigration/index.css diff --git a/packages/legacy/detail/info/walletMigration/index.js b/packages/legacy/detail/info/walletMigration/index.js new file mode 100644 index 0000000000..3284986fce --- /dev/null +++ b/packages/legacy/detail/info/walletMigration/index.js @@ -0,0 +1,47 @@ +import React from 'react'; +import { useTranslation } from 'react-i18next'; +import CopyToClipboard from '@basics/copyToClipboard'; +import Icon from '@basics/icon'; +import LiskAmount from '@shared/liskAmount'; +import WalletVisualWithAddress from '@wallet/detail/identity/walletVisual/walletVisualWithAddress'; +import { tokenMap } from '@token/configuration/tokens'; +import styles from './index.css'; + +const token = tokenMap.LSK.key; + +const WalletMigration = ({ wallet, showBalance }) => { + const { t } = useTranslation(); + return ( +
+
+
{t('Old account')}
+
+ + +
+ {showBalance && ( +

+ {`${t('Balance')}: `} + +

+ )} +
+ +
+
{t('New account')}
+
+ + +
+ {showBalance && ( +

+ {`${t('Balance')}: `} + +

+ )} +
+
+ ); +}; + +export default WalletMigration; diff --git a/packages/legacy/detail/info/walletMigration/walletMigration.test.js b/packages/legacy/detail/info/walletMigration/walletMigration.test.js new file mode 100644 index 0000000000..d4bc215a36 --- /dev/null +++ b/packages/legacy/detail/info/walletMigration/walletMigration.test.js @@ -0,0 +1,27 @@ +import React from 'react'; +import { mount } from 'enzyme'; +import { truncateAddress } from '@wallet/utilities/account'; +import wallets from '@tests/constants/wallets'; +import WalletMigration from './index'; + +describe('WalletMigration component', () => { + const props = { + wallet: wallets.empty_wallet, + showBalance: true, + }; + + it('should render properly', () => { + const wrapper = mount(); + const html = wrapper.html(); + expect(html).toContain(wallets.empty_wallet.legacy.address); + expect(html).toContain(truncateAddress(wallets.empty_wallet.summary.address, 'medium')); + expect(html).toContain('98,970,000 LSK'); + }); + + it('should not render balance', () => { + const wrapper = mount(); + const html = wrapper.html(); + expect(html).toContain(wallets.empty_wallet.legacy.address, 'medium'); + expect(html).toContain(truncateAddress(wallets.empty_wallet.summary.address, 'medium')); + }); +}); diff --git a/packages/settings/setters/selectors/currencySelector.js b/packages/settings/setters/selectors/currencySelector.js index 84c54783d5..4086226f7b 100644 --- a/packages/settings/setters/selectors/currencySelector.js +++ b/packages/settings/setters/selectors/currencySelector.js @@ -1,11 +1,13 @@ import React, { useMemo } from 'react'; +import { useTranslation } from 'react-i18next'; import { toast } from 'react-toastify'; import Select from '@basics/inputs/select'; import settingConstants from '@settings/configuration/settingConstants'; import useSettings from '@settings/hooks/useSettings'; import Piwik from '@common/utilities/piwik'; -function CurrencySelector({ t }) { +function CurrencySelector() { + const { t } = useTranslation(); const { currency, toggleSetting } = useSettings( settingConstants.keys.currency, ); diff --git a/packages/transaction/detail/info/multiSignatureReview/index.js b/packages/transaction/detail/info/multiSignatureReview/index.js index cf95df1b13..eb13259a25 100644 --- a/packages/transaction/detail/info/multiSignatureReview/index.js +++ b/packages/transaction/detail/info/multiSignatureReview/index.js @@ -4,7 +4,7 @@ import { tokenMap } from '@token/configuration/tokens'; import { toRawLsk } from '@token/utilities/lsk'; import { truncateAddress } from '@wallet/utilities/account'; import LiskAmount from '@shared/liskAmount'; -import AccountVisual from '@wallet/detail/info/accountVisual'; +import WalletVisual from '@wallet/detail/identity/walletVisual'; import styles from './styles.css'; @@ -25,7 +25,7 @@ const getAccountRoleText = (accountRole, t) => { const Member = ({ member, i, t }) => (

{`${i + 1}.`}

- +

{member.name || truncateAddress(member.address)} diff --git a/packages/transaction/detail/info/transactionInfo/index.js b/packages/transaction/detail/info/transactionInfo/index.js index 08157dcbeb..9ba6e1c06e 100644 --- a/packages/transaction/detail/info/transactionInfo/index.js +++ b/packages/transaction/detail/info/transactionInfo/index.js @@ -1,6 +1,6 @@ import React from 'react'; import { withTranslation } from 'react-i18next'; -import AccountVisual from '@wallet/detail/info/accountVisual'; +import WalletVisual from '@wallet/detail/identity/walletVisual'; import LiskAmount from '@shared/liskAmount'; import { tokenMap } from '@token/configuration/tokens'; import { MODULE_ASSETS_NAME_ID_MAP } from '@transaction/configuration/moduleAssets'; @@ -35,7 +35,7 @@ const Members = ({ members, t }) => ( className={styles.memberInfo} key={i + 1} > - +

{member.address} diff --git a/packages/transaction/detail/info/transactionInfo/reclaim.js b/packages/transaction/detail/info/transactionInfo/reclaim.js index 8d602d3ce0..c1199a19e2 100644 --- a/packages/transaction/detail/info/transactionInfo/reclaim.js +++ b/packages/transaction/detail/info/transactionInfo/reclaim.js @@ -1,12 +1,12 @@ import React from 'react'; -import AccountMigration from '@legacy/detail/info/accountMigration'; +import WalletMigration from '@legacy/detail/info/walletMigration'; import LiskAmount from '@shared/liskAmount'; import { tokenMap } from '@token/configuration/tokens'; const Reclaim = ({ account, t }) => ( <>

- +
diff --git a/packages/transaction/detail/info/transactionInfo/registerDelegate.js b/packages/transaction/detail/info/transactionInfo/registerDelegate.js index 625551c2c2..fb61f4bee1 100644 --- a/packages/transaction/detail/info/transactionInfo/registerDelegate.js +++ b/packages/transaction/detail/info/transactionInfo/registerDelegate.js @@ -1,13 +1,13 @@ import React from 'react'; -import AccountVisual from '@wallet/detail/info/accountVisual'; +import WalletVisual from '@wallet/detail/identity/walletVisual'; import styles from './transactionInfo.css'; const RegisterDelegate = ({ account, username, t }) => (
- diff --git a/packages/transaction/detail/info/transactionInfo/send.js b/packages/transaction/detail/info/transactionInfo/send.js index 824f6221e1..398a9ad153 100644 --- a/packages/transaction/detail/info/transactionInfo/send.js +++ b/packages/transaction/detail/info/transactionInfo/send.js @@ -1,5 +1,5 @@ import React from 'react'; -import AccountVisual from '@wallet/detail/info/accountVisual'; +import WalletVisual from '@wallet/detail/identity/walletVisual'; import LiskAmount from '@shared/liskAmount'; import { toRawLsk } from '@token/utilities/lsk'; import styles from './transactionInfo.css'; @@ -11,7 +11,7 @@ const Send = ({