Skip to content

Commit

Permalink
Merge branch 'development' into 1960-implement-delegates-onboarding-m…
Browse files Browse the repository at this point in the history
…odule
  • Loading branch information
massao committed May 22, 2019
2 parents c28919a + 120aaa9 commit cb33fd2
Show file tree
Hide file tree
Showing 108 changed files with 929 additions and 2,416 deletions.
2 changes: 1 addition & 1 deletion app/src/ledger.js
Expand Up @@ -75,7 +75,7 @@ const ledgerObserver = {
// eslint-disable-next-line max-statements
next: async ({ device, type }) => {
if (device) {
if (type === 'add' && process.platform !== 'linux') {
if (type === 'add') {
const ledgerDevice = createLedgerHWDevice(device.path);
ledgerDevice.openApp = await isInsideLedgerApp(device.path);
addConnectedDevices(ledgerDevice);
Expand Down
5 changes: 2 additions & 3 deletions docs/EXTENSIONS_GUIDE.md
Expand Up @@ -30,11 +30,10 @@ data = {
search,
}
actions={
testExtensions,
loadTransactions,
sent,
loadTransaction,
transactionsFilterSet,
loadSingleTransaction,
loadTransactions,
searchDelegate,
searchVotes,
searchAccount,
Expand Down
2 changes: 1 addition & 1 deletion docs/REDUX_ACTIONS.md
Expand Up @@ -97,7 +97,7 @@ and every 10 seconds dispatches [`newBlockCreated`](https://github.com/LiskHQ/li
- [`newBlockCreated`](https://github.com/LiskHQ/lisk-hub/blob/e71527bd273af2f16d6980fe3b0c1a379694c45b/src/store/reducers/blocks.js#L5)<br/>
↪️ Account Middleware<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;⬇️ [`updateAccountData`](https://github.com/LiskHQ/lisk-hub/blob/77b6defdf98b6f67f005c25c28ea85378d375817/src/store/middlewares/account.js#L21)<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;⬇️ [`transactionsUpdated`](https://github.com/LiskHQ/lisk-hub/blob/77b6defdf98b6f67f005c25c28ea85378d375817/src/store/middlewares/account.js#L97)<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;⬇️ [`updateTransactions`](https://github.com/LiskHQ/lisk-hub/blob/77b6defdf98b6f67f005c25c28ea85378d375817/src/store/middlewares/account.js#L97)<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;↪️ Account Middleware<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;⬇️ [`votesFetched`](https://github.com/LiskHQ/lisk-hub/blob/77b6defdf98b6f67f005c25c28ea85378d375817/src/store/middlewares/account.js#L156) (sometimes)<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;⬇️ [`updateDelegateAccount`](https://github.com/LiskHQ/lisk-hub/blob/77b6defdf98b6f67f005c25c28ea85378d375817/src/store/middlewares/account.js#L155) (sometimes)<br/>
Expand Down
26 changes: 16 additions & 10 deletions i18n/locales/en/common.json
Expand Up @@ -20,19 +20,17 @@
"Account bookmarked": "Account bookmarked",
"Account name": "Account name",
"Accounts": "Accounts",
"Accounts on Ledger": "Accounts on Ledger",
"Accounts on Trezor": "Accounts on Trezor",
"Action Denied by User": "Action Denied by User",
"Active": "Active",
"Add Extension": "Add Extension",
"Add a Lisk ID": "Add a Lisk ID",
"Add a Lisk ID to follow": "Add a Lisk ID to follow",
"Add a bookmark": "Add a bookmark",
"Add new": "Add new",
"Add some LSK to your Lisk Hub account now!": "Add some LSK to your Lisk Hub account now!",
"Add to bookmarks": "Add to bookmarks",
"Add to list": "Add to list",
"Added Votes": "Added Votes",
"Added votes": "Added votes",
"Adding extensions is currently disabled in production version of Lisk Hub": "Adding extensions is currently disabled in production version of Lisk Hub",
"Address": "Address",
"Advanced features": "Advanced features",
Expand Down Expand Up @@ -72,6 +70,7 @@
"By voting you decide who is trusted to verify transactions and maintain the Lisk network, whilst collecting the rewards for doing so.": "By voting you decide who is trusted to verify transactions and maintain the Lisk network, whilst collecting the rewards for doing so.",
"Bytes counter": "Bytes counter",
"Cancel": "Cancel",
"Cancel voting": "Cancel voting",
"Check for updates...": "Check for updates...",
"Check spelling – name does not exist on mainnet": "Check spelling – name does not exist on mainnet",
"Choose": "Choose",
Expand All @@ -90,7 +89,7 @@
"Confirm on {{deviceModel}}": "Confirm on {{deviceModel}}",
"Confirm to register your second passphrase on the blockchain.": "Confirm to register your second passphrase on the blockchain.",
"Confirm transaction on {{deviceModel}}": "Confirm transaction on {{deviceModel}}",
"Confirm vote on Ledger Nano S": "Confirm vote on Ledger Nano S",
"Confirm vote on {{deviceModel}}": "Confirm vote on {{deviceModel}}",
"Confirm your name": "Confirm your name",
"Confirm your passphrase": "Confirm your passphrase",
"Confirmation in the next step": "Confirmation in the next step",
Expand Down Expand Up @@ -151,6 +150,7 @@
"Downvotes": "Downvotes",
"Drag to reveal": "Drag to reveal",
"Each LSK token is worth one vote.": "Each LSK token is worth one vote.",
"Each time you add or remove a vote it is counted as an action. There's {{fee}} LSK fee per every 33 actions.": "Each time you add or remove a vote it is counted as an action. There's {{fee}} LSK fee per every 33 actions.",
"Edit": "Edit",
"Edit transaction": "Edit transaction",
"Enter URL of the *.js file with the extension": "Enter URL of the *.js file with the extension",
Expand Down Expand Up @@ -198,7 +198,6 @@
"Great!\nYou’re almost done": "Great!\nYou’re almost done",
"Guest mode": "Guest mode",
"Hardware Wallet Type not recognized": "Hardware Wallet Type not recognized",
"Hardware login (beta): ": "Hardware login (beta): ",
"Height": "Height",
"Help": "Help",
"Help Center": "Help Center",
Expand Down Expand Up @@ -260,7 +259,7 @@
"Lisk Explorer": "Lisk Explorer",
"Lisk Help Center": "Lisk Help Center",
"Lisk Hub": "Lisk Hub",
"Lisk Hub currently supports Ledger Nano S and Trezor wallets": "Lisk Hub currently supports Ledger Nano S and Trezor wallets",
"Lisk Hub currently supports Ledger Nano S and Trezor Model T wallets": "Lisk Hub currently supports Ledger Nano S and Trezor Model T wallets",
"Lisk Hub {{newVersion}} is available. You have {{oldVersion}}. Would you like to download it now?": "Lisk Hub {{newVersion}} is available. You have {{oldVersion}}. Would you like to download it now?",
"Lisk ID": "Lisk ID",
"Lisk Terms of Use": "Lisk Terms of Use",
Expand All @@ -270,7 +269,6 @@
"Lisk passphrase backup": "Lisk passphrase backup",
"Lisk.Chat": "Lisk.Chat",
"Load More": "Load More",
"Loading accounts": "Loading accounts",
"Local": "Local",
"Log Out": "Log Out",
"Login Type not recognized.": "Login Type not recognized.",
Expand All @@ -296,6 +294,7 @@
"My Account": "My Account",
"My Wallet": "My Wallet",
"My Wallet Details": "My Wallet Details",
"My votes after confirmation": "My votes after confirmation",
"Name": "Name",
"Name is already taken!": "Name is already taken!",
"Name is available": "Name is available",
Expand All @@ -305,11 +304,14 @@
"New version available": "New version available",
"News": "News",
"Next": "Next",
"No Public Key": "No Public Key",
"No Updates": "No Updates",
"No delegates found.": "No delegates found.",
"No newsfeed available": "No newsfeed available",
"No results": "No results",
"No results found": "No results found",
"No results found.": "No results found.",
"No search result in given criteria.": "No search result in given criteria.",
"No transactions yet": "No transactions yet",
"No, thanks": "No, thanks",
"Not Yet Implemented. Sorry.": "Not Yet Implemented. Sorry.",
Expand All @@ -323,8 +325,6 @@
"On your dashboard": "On your dashboard",
"Oops! Wrong passphrase": "Oops! Wrong passphrase",
"Oops, looks like something went wrong. Please try again.": "Oops, looks like something went wrong. Please try again.",
"Open the Lisk App": "Open the Lisk App",
"Open the Lisk App with your Ledger Nano S": "Open the Lisk App with your Ledger Nano S",
"Out": "Out",
"Outgoing": "Outgoing",
"Outgoing transactions": "Outgoing transactions",
Expand Down Expand Up @@ -365,6 +365,7 @@
"Redo": "Redo",
"Reference": "Reference",
"Register": "Register",
"Register as a Delegate": "Register as a Delegate",
"Registered": "Registered",
"Registrant": "Registrant",
"Release Notes": "Release Notes",
Expand All @@ -373,6 +374,7 @@
"Remove Extension": "Remove Extension",
"Remove from bookmarks": "Remove from bookmarks",
"Removed Votes": "Removed Votes",
"Removed votes": "Removed votes",
"Report the error via E-Mail": "Report the error via E-Mail",
"Request": "Request",
"Request LSK": "Request LSK",
Expand Down Expand Up @@ -407,6 +409,7 @@
"Select device": "Select device",
"Select the missing words to confirm": "Select the missing words to confirm",
"Select this account": "Select this account",
"Selecting Delegates": "Selecting Delegates",
"Selection": "Selection",
"Send": "Send",
"Send LSK": "Send LSK",
Expand Down Expand Up @@ -439,6 +442,7 @@
"Since Last Login": "Since Last Login",
"Some delegates offer to share a certain percentage of their earnings from running the network with the users who vote for them. You can find more information on Lisk’s Reddit or Rocketchat.": "Some delegates offer to share a certain percentage of their earnings from running the network with the users who vote for them. You can find more information on Lisk’s Reddit or Rocketchat.",
"Standby": "Standby",
"Start by Selecting the delegates you’d like to vote for.": "Start by Selecting the delegates you’d like to vote for.",
"Start here": "Start here",
"Start voting": "Start voting",
"Stats": "Stats",
Expand Down Expand Up @@ -477,6 +481,8 @@
"To recover you can": "To recover you can",
"Toggle full screen": "Toggle full screen",
"Total": "Total",
"Total actions (": "Total actions (",
"Total fee: ": "Total fee: ",
"Transaction": "Transaction",
"Transaction Fee": "Transaction Fee",
"Transaction ID": "Transaction ID",
Expand All @@ -489,7 +495,6 @@
"Transaction summary": "Transaction summary",
"Transactions": "Transactions",
"Transfer Transaction": "Transfer Transaction",
"Try Again": "Try Again",
"Try again": "Try again",
"Try using menu for navigation.": "Try using menu for navigation.",
"Type": "Type",
Expand Down Expand Up @@ -552,6 +557,7 @@
"You have cancelled the transaction on your hardware wallet.": "You have cancelled the transaction on your hardware wallet.",
"You have cancelled the transaction on your hardware wallet. You can either continue or retry.": "You have cancelled the transaction on your hardware wallet. You can either continue or retry.",
"You have cancelled voting on your hardware wallet.": "You have cancelled voting on your hardware wallet.",
"You have not voted yet.": "You have not voted yet.",
"You will be able to select the desired network when signing in": "You will be able to select the desired network when signing in",
"You will be signed out in a minute due to no network activity. You can turn off Auto-Logout in the settings.": "You will be signed out in a minute due to no network activity. You can turn off Auto-Logout in the settings.",
"You will need it to use your Lisk ID, like sending and voting. You are responsible for keeping your second passphrase safe. No one can restore it, not even Lisk.": "You will need it to use your Lisk ID, like sending and voting. You are responsible for keeping your second passphrase safe. No one can restore it, not even Lisk.",
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Expand Up @@ -32,7 +32,7 @@ module.exports = {
'^.+\\.css$': 'identity-obj-proxy',
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/__mocks__/fileMock.js',
},
collectCoverage: true,
collectCoverage: !process.env.NO_COV,
coverageDirectory: '<rootDir>/coverage/jest',
collectCoverageFrom: process.env.NO_COV ? [] : [
'src/**/*.js',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -135,7 +135,7 @@
"cpx": "=1.5.0",
"css-hot-loader": "1.4.3",
"css-loader": "0.28.7",
"cypress": "3.2.0",
"cypress": "3.3.0",
"cypress-pipe": "1.3.3",
"del-cli": "1.1.0",
"electron": "3.0.11",
Expand Down
62 changes: 7 additions & 55 deletions src/actions/account.js
@@ -1,12 +1,10 @@
/* eslint-disable max-lines */
// TODO figure out how to reduce size of this file
import i18next from 'i18next';
import actionTypes from '../constants/actions';
import { getAccount, setSecondPassphrase } from '../utils/api/account';
import { registerDelegate, getDelegate, getAllVotes } from '../utils/api/delegate';
import { registerDelegate, getDelegate } from '../utils/api/delegate';
import { getTransactions } from '../utils/api/transactions';
import { getBlocks } from '../utils/api/blocks';
import { loadTransactionsFinish, transactionsUpdated } from './transactions';
import { updateTransactions } from './transactions';
import { delegateRegisteredFailure } from './delegate';
import { secondPassphraseRegisteredFailure } from './secondPassphrase';
import { liskAPIClientUpdate } from './peers';
Expand Down Expand Up @@ -79,20 +77,6 @@ export const delegateStatsLoaded = data => ({
data,
});

/**
* Gets list of all votes
*/
export const accountVotesFetched = ({ address }) =>
(dispatch, getState) => {
const liskAPIClient = getState().peers.liskAPIClient;
return getAllVotes(liskAPIClient, address).then(({ data }) => {
dispatch({
type: actionTypes.accountAddVotes,
votes: data.votes,
});
});
};

/**
*
*/
Expand All @@ -111,7 +95,7 @@ export const secondPassphraseRegistered = ({ secondPassphrase, account, passphra
fee: Fees.setSecondPassphrase,
type: transactionTypes.setSecondPassphrase,
},
type: actionTypes.transactionAdded,
type: actionTypes.addPendingTransaction,
});
}).catch((error) => {
const text = (error && error.message) ? error.message : i18next.t('An error occurred while registering your second passphrase. Please try again.');
Expand Down Expand Up @@ -155,7 +139,7 @@ export const delegateRegistered = ({
fee: Fees.registerDelegate,
type: transactionTypes.registerDelegate,
},
type: actionTypes.transactionAdded,
type: actionTypes.addPendingTransaction,
});
})
.catch((error) => {
Expand All @@ -177,36 +161,6 @@ export const loadDelegate = ({ publicKey }) =>
});
};

export const loadAccount = ({
address,
transactionsResponse,
isSameAccount,
}) =>
(dispatch, getState) => {
const networkConfig = getState().network;
getAccount({ networkConfig, address })
.then((response) => {
let accountDataUpdated = {
confirmed: transactionsResponse.data,
count: parseInt(transactionsResponse.meta.count, 10),
balance: response.balance,
address,
};

if (!isSameAccount && response.publicKey) {
dispatch(loadDelegate({
publicKey: response.publicKey,
}));
} else if (isSameAccount && response.delegate && response.delegate.username) {
accountDataUpdated = {
...accountDataUpdated,
delegate: response.delegate,
};
}
dispatch(loadTransactionsFinish(accountDataUpdated));
});
};

export const updateTransactionsIfNeeded = ({ transactions, account }, windowFocus) =>
(dispatch) => {
const hasRecentTransactions = txs => (
Expand All @@ -215,15 +169,13 @@ export const updateTransactionsIfNeeded = ({ transactions, account }, windowFocu
);

if (windowFocus || hasRecentTransactions(transactions)) {
const { filter, customFilters } = transactions;
const { filters } = transactions;
const address = transactions.account ? transactions.account.address : account.address;

dispatch(transactionsUpdated({
dispatch(updateTransactions({
pendingTransactions: transactions.pending,
address,
limit: 25,
filter,
customFilters,
filters,
}));
}
};
Expand Down

0 comments on commit cb33fd2

Please sign in to comment.