Skip to content
Permalink
Browse files

Merge branch 'develop' into chore/ddw-611-implement-new-network-statu…

…s-dialog-design

# Conflicts:
#	CHANGELOG.md
  • Loading branch information...
DeeJayElly committed May 15, 2019
2 parents 0de1325 + fb8c35d commit 9b7e68d6a890934dea6d528d025a3276da2e8244
Showing with 2,110 additions and 324 deletions.
  1. +2 −0 CHANGELOG.md
  2. +1 −0 default.nix
  3. +64 −0 features/tests/e2e/steps/wallets-utxos-steps.js
  4. +7 −0 features/tests/unit/setup/utxo-helpers.js
  5. +130 −0 features/tests/unit/steps/utxos-chart-steps.js
  6. +91 −0 features/utxos-chart.feature
  7. +27 −0 features/wallet-utxos.feature
  8. +1 −0 installers/nix/nix-installer.nix
  9. +2 −1 package.json
  10. +2 −0 source/renderer/app/Routes.js
  11. +2 −0 source/renderer/app/actions/wallet-settings-actions.js
  12. +22 −0 source/renderer/app/api/api.js
  13. +2 −5 source/renderer/app/api/wallets/requests/deleteWallet.js
  14. +14 −0 source/renderer/app/api/wallets/requests/getWalletUtxos.js
  15. +16 −0 source/renderer/app/api/wallets/types.js
  16. +3 −0 source/renderer/app/assets/images/exclamation-point.inline.svg
  17. +3 −0 source/renderer/app/assets/images/question-mark.inline.svg
  18. +17 −0 source/renderer/app/components/loading/StatusIcons-tooltip.scss
  19. +4 −3 source/renderer/app/components/loading/StatusIcons.js
  20. +14 −0 source/renderer/app/components/loading/StatusIcons.scss
  21. +8 −1 source/renderer/app/components/wallet/layouts/WalletWithNavigation.js
  22. +6 −0 source/renderer/app/components/wallet/layouts/WalletWithNavigation.scss
  23. +45 −0 source/renderer/app/components/wallet/navigation/WalletNavDropdown.js
  24. +45 −0 source/renderer/app/components/wallet/navigation/WalletNavDropdown.scss
  25. +37 −0 source/renderer/app/components/wallet/navigation/WalletNavOptionsStyles.scss
  26. +62 −0 source/renderer/app/components/wallet/navigation/WalletNavSelectSkin.js
  27. +4 −0 source/renderer/app/components/wallet/navigation/WalletNavSelectStyles.scss
  28. +29 −5 source/renderer/app/components/wallet/navigation/WalletNavigation.js
  29. +11 −11 source/renderer/app/components/wallet/{ → settings}/WalletSettings.js
  30. +1 −1 source/renderer/app/components/wallet/{ → settings}/WalletSettings.scss
  31. +173 −0 source/renderer/app/components/wallet/utxo/WalletUtxo.js
  32. +79 −0 source/renderer/app/components/wallet/utxo/WalletUtxo.scss
  33. +36 −0 source/renderer/app/components/wallet/utxo/WalletUtxoCursor.js
  34. +5 −0 source/renderer/app/components/wallet/utxo/WalletUtxoCursor.scss
  35. +37 −0 source/renderer/app/components/wallet/utxo/WalletUtxoTick.js
  36. +14 −0 source/renderer/app/components/wallet/utxo/WalletUtxoTick.scss
  37. +76 −0 source/renderer/app/components/wallet/utxo/WalletUtxoTooltip.js
  38. +19 −0 source/renderer/app/components/wallet/utxo/WalletUtxoTooltip.scss
  39. +8 −0 source/renderer/app/components/widgets/forms/FormFieldSkinTooltip-tooltip.scss
  40. +67 −0 source/renderer/app/components/widgets/forms/FormFieldSkinTooltip.js
  41. +22 −0 source/renderer/app/components/widgets/forms/FormFieldSkinTooltip.scss
  42. +8 −0 source/renderer/app/components/widgets/forms/InlineEditingDropdown-tooltip.scss
  43. +28 −1 source/renderer/app/components/widgets/forms/InlineEditingDropdown.js
  44. +27 −1 source/renderer/app/components/widgets/forms/InlineEditingDropdown.scss
  45. +1 −0 source/renderer/app/config/timingConfig.js
  46. +14 −0 source/renderer/app/config/utxoConfig.js
  47. +2 −1 source/renderer/app/containers/wallet/Wallet.js
  48. +1 −1 source/renderer/app/containers/wallet/WalletSettingsPage.js
  49. +43 −0 source/renderer/app/containers/wallet/WalletUtxoPage.js
  50. +10 −0 source/renderer/app/i18n/locales/de-DE.json
  51. +251 −101 source/renderer/app/i18n/locales/defaultMessages.json
  52. +10 −0 source/renderer/app/i18n/locales/en-US.json
  53. +10 −0 source/renderer/app/i18n/locales/hr-HR.json
  54. +10 −0 source/renderer/app/i18n/locales/ja-JP.json
  55. +10 −0 source/renderer/app/i18n/locales/ko-KR.json
  56. +10 −0 source/renderer/app/i18n/locales/zh-CN.json
  57. +1 −0 source/renderer/app/routes-config.js
  58. +4 −0 source/renderer/app/stores/AppStore.js
  59. +66 −7 source/renderer/app/stores/WalletSettingsStore.js
  60. +8 −0 source/renderer/app/stores/WalletsStore.js
  61. +16 −0 source/renderer/app/themes/daedalus/cardano.js
  62. +16 −0 source/renderer/app/themes/daedalus/dark-blue.js
  63. +16 −0 source/renderer/app/themes/daedalus/light-blue.js
  64. +1 −28 source/renderer/app/themes/overrides/TooltipOverrides.scss
  65. +5 −0 source/renderer/app/utils/formatters.js
  66. +57 −0 source/renderer/app/utils/utxoUtils.js
  67. +109 −0 storybook/stories/WalletScreens-Settings.stories.js
  68. +58 −0 storybook/stories/WalletScreens-Utxo.stories.js
  69. +13 −104 storybook/stories/WalletScreens.stories.js
  70. +1 −1 storybook/stories/support/StoryProvider.js
  71. +95 −52 yarn.lock
  72. +1 −0 yarn2nix.nix
@@ -5,6 +5,7 @@ Changelog

### Features

- Implemented the wallet UTxO statistics screen ([PR 1353](https://github.com/input-output-hk/daedalus/pull/1353))
- Implemented scroll error message into view ([PR 1383](https://github.com/input-output-hk/daedalus/pull/1383))
- Implemented new Block-consolidation status design ([PR 1377](https://github.com/input-output-hk/daedalus/pull/1377))
- Implemented "In progress" download logs notification ([PR 1341](https://github.com/input-output-hk/daedalus/pull/1341))
@@ -21,6 +22,7 @@ Changelog
### Chores

- Implemented new Network Status dialog design ([PR 1370](https://github.com/input-output-hk/daedalus/pull/1370)
- Setup storybook build script to deploy previews for the QA team to Netlify ([1391](https://github.com/input-output-hk/daedalus/pull/1391))
- Added unit tests for mnemonic generation and validation ([PR 1379](https://github.com/input-output-hk/daedalus/pull/1379))
- Simplified the test setup ([PR 1378](https://github.com/input-output-hk/daedalus/pull/1378))
- Updated PR template ([PR 1376](https://github.com/input-output-hk/daedalus/pull/1376))
@@ -279,6 +279,7 @@ let
mkdir -p etc
cat /etc/hosts > etc/hosts
cat /etc/nsswitch.conf > etc/nsswitch.conf
cat /etc/localtime > etc/localtime
cat /etc/machine-id > etc/machine-id
cat /etc/resolv.conf > etc/resolv.conf
@@ -0,0 +1,64 @@
import { Then } from 'cucumber';
import { expect } from 'chai';
import { BigNumber } from 'bignumber.js';
import { getVisibleTextsForSelector } from '../helpers/shared-helpers';
import { getWalletUtxosTotalAmount } from '../../../../source/renderer/app/utils/utxoUtils';

const container = '.WalletUtxo_container';

const selectors = {
container,
title: `${container} > h1`,
description: `${container} > p`,
chart: '.WalletUtxo_responsiveContainer',
walletAmount: `${container} > p b:nth-child(1)`,
walletUtxosAmount: `${container} > p b:nth-child(2)`,
};

Then('the {string} element renders the following text:', async function(
element,
data
) {
const [expectedTextData] = data.hashes();
const [renderedText] = await getVisibleTextsForSelector(
this.client,
selectors[element]
);
const expectedText = await this.intl(expectedTextData.message);
expect(renderedText).to.equal(expectedText);
});

Then(
'the page description displays the correct wallet and UTXOs amount',
async function() {
const [renderedWalletAmount] = await getVisibleTextsForSelector(
this.client,
selectors.walletAmount
);
const [renderedWalletUtxosAmount] = await getVisibleTextsForSelector(
this.client,
selectors.walletUtxosAmount
);

const {
value: { expextedWalletAmount, histogram },
} = await this.client.executeAsync(done =>
done({
expextedWalletAmount: daedalus.stores.wallets.activeValue,
histogram: daedalus.stores.walletSettings.walletUtxos.histogram,
})
);

const expectedWalletUtxosAmount = getWalletUtxosTotalAmount(histogram);

expect(expextedWalletAmount).to.equal(renderedWalletAmount);
expect(expectedWalletUtxosAmount).to.equal(
parseInt(renderedWalletUtxosAmount, 10)
);
}
);

Then(/^the UTXOs chart is (hidden|visible)/, async function(state) {
const isVisible = state === 'visible';
await this.client.waitForVisible(selectors.chart, null, !isVisible);
});
@@ -0,0 +1,7 @@
export const getHistogramFromTable = data => {
let histogram = {};
data.hashes().forEach(({ walletAmount, walletUtxosAmount }) => {
histogram[walletAmount] = walletUtxosAmount;
});
return histogram;
};
@@ -0,0 +1,130 @@
import { Given, When, Then } from 'cucumber';
import { expect } from 'chai';
import { isValidSpendingPassword } from '../../../../source/renderer/app/utils/validations';
import {
formattedAmountToLovelace,
formattedLovelaceToAmount,
} from '../../../../source/renderer/app/utils/formatters';
import {
getUtxoChartData,
getUtxoWalletPrettyAmount,
getWalletUtxosTotalAmount,
} from '../../../../source/renderer/app/utils/utxoUtils';
import { getHistogramFromTable } from '../setup/utxo-helpers';

Given('the `getUtxoChartData` function receives the following props:', function(
data
) {
const histogram = getHistogramFromTable(data);
const utxoChartData = getUtxoChartData(histogram);
this.context.histogram = histogram;
this.context.utxoChartData = utxoChartData;
this.context.response = utxoChartData;
this.context.sortedHistogram = Object.entries(histogram).sort();
});

Then('the wallet amounts should be sorted sorted ascending', function() {
const { utxoChartData: arr } = this.context;
const isSorted = arr.every(({ walletAmount }, i) =>
i < arr.length - 1 ? walletAmount <= arr[i + 1].walletAmount : true
);
expect(isSorted).to.be.true;
});

Then(
'the wallet amounts should be formatted into human-readable text',
function() {
const { utxoChartData, sortedHistogram } = this.context;
const isFormatted = utxoChartData.every(
({ walletAmount }, index) =>
walletAmount === formattedLovelaceToAmount(sortedHistogram[index][0])
);
expect(isFormatted).to.be.true;
}
);

Then('there should be no wallet amounts greater than 100K', function() {
return this.context.utxoChartData.every(
({ walletRawAmount }) => walletRawAmount <= 100000
);
});

Then(
'the wallet UTXO amounts for wallet amounts greater than {int} should be aggregated',
function(walletAmount) {
const walletAmountThreshold = formattedAmountToLovelace(
String(walletAmount)
);
const { histogram, utxoChartData, sortedHistogram } = this.context;
const expectedAggregatedUtxosAmount = sortedHistogram.reduce(
(sum, [walletAmount, walletUtxosAmount]) => {
if (walletAmount >= walletAmountThreshold)
sum += parseInt(walletUtxosAmount, 10);
return sum;
},
0
);
const {
walletUtxosAmount: calculatedAggregatedUtxosAmount,
} = utxoChartData.find(({ walletRawAmount }) => walletRawAmount === 100000);
expect(expectedAggregatedUtxosAmount).to.equal(
calculatedAggregatedUtxosAmount
);
}
);

function getUtxoChartDataReceivesAWalletAmount(walletAmount) {
this.context.walletRawAmount = walletAmount;
const walletPrettyAmount = getUtxoWalletPrettyAmount(walletAmount);
this.context.walletAmount = walletPrettyAmount;
this.context.response = walletPrettyAmount;
}

Given(
'the `getUtxoWalletPrettyAmount` function receives the following {float}',
getUtxoChartDataReceivesAWalletAmount
);
Given(
'the `getUtxoWalletPrettyAmount` function receives the following {int}',
getUtxoChartDataReceivesAWalletAmount
);

Then('the response should have type {string}', function(type) {
const { response } = this.context;
if (type === 'array') {
return expect(Array.isArray(response)).to.be.true;
}
expect(typeof response).to.equal(type);
});

Then('wallet amounts less than {int} should not be modified', function(amount) {
const { walletAmount, walletRawAmount } = this.context;
if (walletRawAmount < amount) {
expect(walletAmount).to.equal(String(walletRawAmount));
expect(/[a-zA-Z]/.test(walletAmount)).to.be.false;
}
});

Then(
'wallet amounts equal or greater than {int} should be formatted into human-readable text',
function(amount) {
const { walletAmount, walletRawAmount } = this.context;
if (walletRawAmount >= amount) {
expect(walletAmount).to.not.equal(String(walletRawAmount));
expect(/[a-zA-Z]/.test(walletAmount)).to.be.true;
}
}
);

Given(
'the `getWalletUtxosTotalAmount` function receives the following props:',
function(data) {
const histogram = getHistogramFromTable(data);
this.context.histogram = histogram;
this.context.response = getWalletUtxosTotalAmount(histogram);
}
);

Then('the response should be the number {int}', function(response) {
expect(response).to.equal(this.context.response);
});
@@ -0,0 +1,91 @@
@unit
Feature: UTXOs chart data

Scenario: The histogram data is sent to the `getUtxoChartData` function
Given the `getUtxoChartData` function receives the following props:
| walletAmount | walletUtxosAmount |
| 10 | 0 |
| 100 | 0 |
| 1000 | 3 |
| 10000 | 0 |
| 100000 | 0 |
| 1000000 | 0 |
| 10000000 | 4 |
| 100000000 | 0 |
| 1000000000 | 0 |
| 10000000000 | 0 |
| 100000000000 | 0 |
| 1000000000000 | 0 |
| 10000000000000 | 2 |
| 100000000000000 | 0 |
| 1000000000000000 | 0 |
| 10000000000000000 | 1 |
| 45000000000000000 | 1 |
Then the response should have type "array"
And wallet amounts equal or greater than 1000 should be formatted into human-readable text
And there should be no wallet amounts greater than 100K
And the wallet UTXO amounts for wallet amounts greater than 1000000 should be aggregated

Scenario Outline: A wallet amount is sent to the `getUtxoWalletPrettyAmount` function
Given the `getUtxoWalletPrettyAmount` function receives the following <AMOUNT>
Then the response should have type "string"
And wallet amounts less than 1000 should not be modified
And wallet amounts equal or greater than 1000 should be formatted into human-readable text

Examples:
| AMOUNT |
| 0.0001 |
| 0.001 |
| 0.01 |
| 0.1 |
| 1 |
| 10 |
| 100 |
| 1000 |
| 10000 |
| 100000 |

Scenario: The histogram data is sent to the `getWalletUtxosTotalAmount` function
Given the `getWalletUtxosTotalAmount` function receives the following props:
| walletAmount | walletUtxosAmount |
| 10 | 0 |
| 100 | 0 |
| 1000 | 3 |
| 10000 | 0 |
| 100000 | 0 |
| 1000000 | 0 |
| 10000000 | 4 |
| 100000000 | 0 |
| 1000000000 | 0 |
| 10000000000 | 0 |
| 100000000000 | 0 |
| 1000000000000 | 0 |
| 10000000000000 | 2 |
| 100000000000000 | 0 |
| 1000000000000000 | 0 |
| 10000000000000000 | 1 |
| 45000000000000000 | 1 |
Then the response should have type "number"
And the response should be the number 11






















@@ -0,0 +1,27 @@
@e2e
Feature: Wallet - UTXOs

Background:
Given I have completed the basic setup

Scenario: Chart visible. Page title and description
Given I have a "Imported Wallet" with funds
When I am on the "Imported Wallet" wallet "utxo" screen
Then the "title" element renders the following text:
| message |
| wallet.settings.utxos.title |
And the page description displays the correct wallet and UTXOs amount
And the UTXOs chart is visible

Scenario: The wallet does not contain any UTxOs
Given I have the following wallets:
| name |
| NewWallet |
When I am on the "NewWallet" wallet "utxo" screen
Then the "title" element renders the following text:
| message |
| wallet.settings.utxos.title |
Then the "description" element renders the following text:
| message |
| wallet.settings.utxos.emptyWallet |
And the UTXOs chart is hidden
@@ -64,6 +64,7 @@ let
mkdir -p etc
cat /etc/hosts > etc/hosts
cat /etc/nsswitch.conf > etc/nsswitch.conf
cat /etc/localtime > etc/localtime
cat /etc/machine-id > etc/machine-id
cat /etc/resolv.conf > etc/resolv.conf
@@ -27,6 +27,7 @@
"prettier:format": "yarn prettier --write --loglevel warn",
"manage:translations": "gulp purge:translations && gulp clear:cache && gulp build && node ./translations/translation-runner.js",
"storybook": "start-storybook -p 6006 -c storybook",
"storybook:build": "build-storybook -c storybook -o dist/storybook",
"clear:cache": "gulp clear:cache",
"nix:dev": "nix-shell --arg autoStartBackend true --arg allowFaultInjection true --arg systemStart",
"nix:staging": "nix-shell --arg autoStartBackend true --argstr cluster staging"
@@ -166,7 +167,7 @@
"react-router": "3.2.1",
"react-svg-inline": "2.1.0",
"react-virtualized": "9.21.0",
"recharts": "1.0.0-beta.10",
"recharts": "1.5.0",
"retry": "0.12.0",
"route-parser": "0.0.5",
"rust-cardano-crypto": "0.2.0",
@@ -23,6 +23,7 @@ import WalletSendPage from './containers/wallet/WalletSendPage';
import WalletReceivePage from './containers/wallet/WalletReceivePage';
import WalletTransactionsPage from './containers/wallet/WalletTransactionsPage';
import WalletSettingsPage from './containers/wallet/WalletSettingsPage';
import WalletUtxoPage from './containers/wallet/WalletUtxoPage';
// import StakingPage from './containers/staking/StakingPage';

export const Routes = (
@@ -53,6 +54,7 @@ export const Routes = (
<Route path={ROUTES.WALLETS.SEND} component={WalletSendPage} />
<Route path={ROUTES.WALLETS.RECEIVE} component={WalletReceivePage} />
<Route path={ROUTES.WALLETS.SETTINGS} component={WalletSettingsPage} />
<Route path={ROUTES.WALLETS.UTXO} component={WalletUtxoPage} />
</Route>
<Route path={ROUTES.SETTINGS.ROOT} component={Settings}>
<IndexRedirect to={ROUTES.SETTINGS.GENERAL} />
@@ -20,4 +20,6 @@ export default class WalletSettingsActions {
newPassword: ?string,
}> = new Action();
exportToFile: Action<WalletExportToFileParams> = new Action();
startWalletUtxoPolling: Action<any> = new Action();
stopWalletUtxoPolling: Action<any> = new Action();
}
Oops, something went wrong.

0 comments on commit 9b7e68d

Please sign in to comment.
You can’t perform that action at this time.