Skip to content
Permalink
Browse files

[DDW-879] Merges-in chore/ddw-876-get-wallet-utxo-statistics-v2-api-i…

…ntegration and fix conflicts
  • Loading branch information...
tomothespian committed Sep 11, 2019
2 parents aca7772 + 5213014 commit 4e76eb5b8c5aefa186e554560a5700b39c59cce2
Showing with 475 additions and 524 deletions.
  1. +8 −1 CHANGELOG.md
  2. +5 −5 features/send-money-to-receiver.feature
  3. +1 −1 features/tests/e2e/steps/select-language-steps.js
  4. +1 −1 features/tests/e2e/steps/settings-steps.js
  5. +1 −1 package.json
  6. +1 −0 source/renderer/app/actions/wallets-actions.js
  7. +17 −1 source/renderer/app/api/api.js
  8. +12 −17 source/renderer/app/api/utils/request.js
  9. +14 −0 source/renderer/app/api/wallets/requests/getWallet.js
  10. +1 −1 source/renderer/app/api/wallets/requests/updateWallet.js
  11. +4 −0 source/renderer/app/api/wallets/types.js
  12. +1 −1 source/renderer/app/components/loading/system-time-error/SystemTimeError.scss
  13. +2 −28 source/renderer/app/components/notifications/RestoreNotification.js
  14. +2 −2 source/renderer/app/components/profile/data-layer-migration/DataLayerMigrationForm.scss
  15. +1 −0 source/renderer/app/components/staking/countdown/StakingCountdown.scss
  16. +6 −0 ...ce/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsChooseWalletDialog.scss
  17. +1 −1 ...ce/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsConfirmationDialog.scss
  18. +1 −1 source/renderer/app/components/staking/epochs/StakingEpochs.scss
  19. +1 −0 source/renderer/app/components/staking/info/StakingInfo.scss
  20. +1 −1 source/renderer/app/components/staking/rewards/StakingRewards.scss
  21. +2 −2 source/renderer/app/components/wallet/WalletCreateDialog.js
  22. +0 −1 source/renderer/app/components/wallet/WalletCreateDialog.scss
  23. +2 −2 source/renderer/app/components/wallet/WalletRestoreDialog.js
  24. +0 −1 source/renderer/app/components/wallet/WalletRestoreDialog.scss
  25. +11 −10 source/renderer/app/components/wallet/WalletSendForm.js
  26. +0 −1 source/renderer/app/components/wallet/file-import/WalletFileImportDialog.scss
  27. +1 −0 source/renderer/app/components/wallet/receive/VirtualAddressesList.scss
  28. +2 −2 source/renderer/app/components/wallet/settings/ChangeSpendingPasswordDialog.js
  29. +0 −1 source/renderer/app/components/wallet/settings/ChangeSpendingPasswordDialog.scss
  30. +0 −36 source/renderer/app/components/wallet/settings/WalletSettings.js
  31. +35 −80 source/renderer/app/components/wallet/transactions/Transaction.js
  32. +14 −21 source/renderer/app/components/wallet/transactions/Transaction.scss
  33. +2 −2 source/renderer/app/components/wallet/utxo/WalletUtxo.js
  34. +5 −15 source/renderer/app/containers/wallet/Wallet.js
  35. +0 −10 source/renderer/app/i18n/global-messages.js
  36. +3 −3 source/renderer/app/i18n/locales/de-DE.json
  37. +103 −103 source/renderer/app/i18n/locales/defaultMessages.json
  38. +4 −4 source/renderer/app/i18n/locales/en-US.json
  39. +3 −3 source/renderer/app/i18n/locales/hr-HR.json
  40. +2 −2 source/renderer/app/i18n/locales/ja-JP.json
  41. +3 −3 source/renderer/app/i18n/locales/ko-KR.json
  42. +3 −3 source/renderer/app/i18n/locales/zh-CN.json
  43. +25 −21 source/renderer/app/themes/daedalus/cardano.js
  44. +25 −23 source/renderer/app/themes/daedalus/dark-blue.js
  45. +40 −35 source/renderer/app/themes/daedalus/dark-cardano.js
  46. +23 −20 source/renderer/app/themes/daedalus/light-blue.js
  47. +23 −22 source/renderer/app/themes/daedalus/white.js
  48. +30 −26 source/renderer/app/themes/daedalus/yellow.js
  49. +3 −0 source/renderer/app/themes/index.global.scss
  50. +9 −0 source/renderer/app/themes/overrides/OptionsOverrides.scss
  51. +2 −1 source/renderer/app/themes/overrides/SelectOverrides.scss
  52. +3 −0 source/renderer/app/themes/overrides/index.js
  53. +2 −0 source/renderer/app/themes/utils/createShades.js
  54. +11 −6 source/renderer/app/themes/utils/createTheme.js
  55. +3 −3 yarn.lock
@@ -5,6 +5,8 @@ Changelog

### Features

- Integrated Cardano V2 API endpoints ([PR 1548](https://github.com/input-output-hk/daedalus/pull/1548), [PR 1551](https://github.com/input-output-hk/daedalus/pull/1551), [PR 1552](https://github.com/input-output-hk/daedalus/pull/1552), [PR 1553](https://github.com/input-output-hk/daedalus/pull/1553), [PR 1555](https://github.com/input-output-hk/daedalus/pull/1555), [PR 1556](https://github.com/input-output-hk/daedalus/pull/1556), [PR 1557](https://github.com/input-output-hk/daedalus/pull/1557), [PR 1558](https://github.com/input-output-hk/daedalus/pull/1558), [PR 1559](https://github.com/input-output-hk/daedalus/pull/1559))
- Removed select dropdown arrow ([PR 1550](https://github.com/input-output-hk/daedalus/pull/1550))
- Implemented automated and manual update flows unification ([PR 1491](https://github.com/input-output-hk/daedalus/pull/1491))
- Updated behavior of system dialogs ([PR 1494](https://github.com/input-output-hk/daedalus/pull/1494))
- Implemented the new "Wallet Creation" process ([PR 1499](https://github.com/input-output-hk/daedalus/pull/1499), [PR 1515](https://github.com/input-output-hk/daedalus/pull/1515), [PR 1530](https://github.com/input-output-hk/daedalus/issues/1530))
@@ -17,6 +19,7 @@ Changelog

### Fixes

- Fixed UI issues across different app themes ([PR 1547](https://github.com/input-output-hk/daedalus/pull/1547))
- Fixed minor UI issues on the "Delegation center" screen and "Delegation setup" wizard ([PR 1545](https://github.com/input-output-hk/daedalus/pull/1545))
- Fixed "White" theme styles ([PR 1532](https://github.com/input-output-hk/daedalus/pull/1532))
- Removed tooltip on Diagnostics Screen connection error message ([PR 1535](https://github.com/input-output-hk/daedalus/pull/1535))
@@ -29,7 +32,11 @@ Changelog

### Chores

<<<<<<< HEAD
- Integration of the V2 API ([PR 1557](https://github.com/input-output-hk/daedalus/pull/1557), [PR 1558](https://github.com/input-output-hk/daedalus/pull/1558), [PR 1559](https://github.com/input-output-hk/daedalus/pull/1559), [PR 1560](https://github.com/input-output-hk/daedalus/pull/1560))
=======
- Use improved `NumericInput` component of `React-Polymorph` v0.9.0 ([1511](https://github.com/input-output-hk/daedalus/pull/1511))
>>>>>>> chore/ddw-876-get-wallet-utxo-statistics-v2-api-integration
- Added minimum heights of main app window for different environments (Windows, Linux, MacOS) ([1485](https://github.com/input-output-hk/daedalus/pull/1485))
- Removed "Ada Redemption" feature ([PR 1510](https://github.com/input-output-hk/daedalus/pull/1510))
- Changed `themes:check` to `themes:check:createTheme` and added a 4 part "Theme Management in Daedalus" tutorial series to a README document in the themes directory ([PR 1525](https://github.com/input-output-hk/daedalus/pull/1525))
@@ -748,4 +755,4 @@ and support for submitting the form with enter key
### Chore

- Updated to react-router v4
- Testing setup with cucumber & spectron
- Testing setup with cucumber & spectron
@@ -61,10 +61,10 @@ Feature: Send Money to Receiver
| title | amount |
| my transaction | <WRONG_AMOUNT> |
Then I should see the following error messages on the wallet send form:
| message |
| wallet.send.form.errors.invalidAmount |
| message |
| <ERROR> |

Examples:
| WRONG_AMOUNT |
| 45000000001 |
| 0 |
| WRONG_AMOUNT | ERROR |
| 99999999 | api.errors.NotEnoughFundsForTransactionError |
| 0 | wallet.send.form.errors.invalidAmount |
@@ -28,7 +28,7 @@ When(/^I open language selection dropdown$/, function() {

When(/^I select Japanese language$/, function() {
return this.waitAndClick(
'//*[@class="SimpleOptions_label"][contains(text(), "Japanese")]'
'//*[@class="SimpleOptions_option"]//*[contains(text(), "Japanese")]'
);
});

@@ -103,7 +103,7 @@ When(

When(/^I select "Strict" assurance level$/, function() {
return this.waitAndClick(
'//*[@class="SimpleOptions_label"][contains(text(), "Strict")]'
'//*[@class="SimpleOptions_option"]//*[contains(text(), "Strict")]'
);
});

@@ -178,7 +178,7 @@
"react-lottie": "1.2.3",
"react-markdown": "3.1.0",
"react-number-format": "3.0.3",
"react-polymorph": "0.8.7",
"react-polymorph": "0.9.0-rc.15",
"react-router": "3.2.1",
"react-svg-inline": "2.1.0",
"react-virtualized": "9.21.0",
@@ -42,4 +42,5 @@ export default class WalletsActions {
closeCertificateGeneration: Action<any> = new Action();
setCertificateTemplate: Action<{ selectedTemplate: string }> = new Action();
finishCertificate: Action<any> = new Action();
getWallet: Action<{ walletId: string }> = new Action();
}
@@ -41,6 +41,7 @@ import { createWallet } from './wallets/requests/createWallet';
import { restoreWallet } from './wallets/requests/restoreWallet';
import { updateWallet } from './wallets/requests/updateWallet';
import { getWalletUtxos } from './wallets/requests/getWalletUtxos';
import { getWallet } from './wallets/requests/getWallet';

// utility functions
import {
@@ -128,6 +129,7 @@ import type {
ImportWalletFromFileRequest,
UpdateWalletRequest,
GetWalletUtxosRequest,
GetWalletRequest,
} from './wallets/types';

// Common errors
@@ -181,6 +183,21 @@ export default class AdaApi {
}
};

getWallet = async (request: GetWalletRequest): Promise<Wallet> => {
Logger.debug('AdaApi::getWallet called', {
parameters: filterLogData(request),
});
try {
const { walletId } = request;
const wallet: AdaWallet = await getWallet(this.config, { walletId });
Logger.debug('AdaApi::getWallet success', { wallet });
return _createWalletFromServerData(wallet);
} catch (error) {
Logger.error('AdaApi::getWallet error', { error });
throw new GenericApiError();
}
};

getAddresses = async (
request: GetAddressesRequest
): Promise<GetAddressesResponse> => {
@@ -197,7 +214,6 @@ export default class AdaApi {

Logger.debug('AdaApi::getAddresses success', { addresses: response });
const addresses = response.map(_createAddressFromServerData);

return new Promise(resolve => resolve({ accountIndex: 0, addresses }));
} catch (error) {
Logger.error('AdaApi::getAddresses error', { error });
@@ -17,16 +17,17 @@ export type RequestOptions = {
},
};

const ALLOWED_ERROR_EXCEPTION_PATHS = [
'/api/internal/next-update', // when nextAdaUpdate receives a 404, it isn't an error
];

function typedRequest<Response>(
httpOptions: RequestOptions,
queryParams?: {},
rawBodyParams?: any
// requestOptions?: { returnMeta: boolean }
): Promise<Response> {
return new Promise((resolve, reject) => {
const allowedErrorExceptionPaths = [
'/api/internal/next-update', // when nextAdaUpdate receives a 404, it isn't an error
];
const options: RequestOptions = Object.assign({}, httpOptions);
// const { returnMeta } = Object.assign({}, requestOptions);
let hasRequestBody = false;
@@ -69,13 +70,7 @@ function typedRequest<Response>(
}

// @API TODO: Delete once HTTPS is supported by the new API
const httpOnlyOptions = {
...options,
hostname: options.hostname,
method: options.method,
path: options.path,
port: options.port,
};
const httpOnlyOptions = omit(options, ['ca', 'cert', 'key']);

// @API TODO: Uncomment / switch once HTTPS is supported by the new API
// const httpsRequest = global.https.request(options);
@@ -96,12 +91,12 @@ function typedRequest<Response>(
response.on('end', () => {
try {
const { statusCode, statusMessage } = response;
const successResponse =
const isSuccessResponse =
(statusCode >= 200 && statusCode <= 206) ||
(statusCode === 404 &&
includes(allowedErrorExceptionPaths, options.path));
includes(ALLOWED_ERROR_EXCEPTION_PATHS, options.path));

if (successResponse) {
if (isSuccessResponse) {
const data =
statusCode === 404
? 'null'
@@ -116,16 +111,16 @@ function typedRequest<Response>(
}
resolve(JSON.parse(body));
} else if (body) {
// Error response with a body
const parsedBody = JSON.parse(body);
if (parsedBody.code && parsedBody.message) {
reject(parsedBody);
} else {
// TODO: find a way to record this case and report to the backend team
reject(new Error('Unknown response from backend.'));
reject(new Error('Unknown API response'));
}
} else {
// TODO: find a way to record this case and report to the backend team
reject(new Error('Unknown response from backend.'));
// Error response without a body
reject(new Error('Unknown API response'));
}
} catch (error) {
// Handle internal server errors (e.g. HTTP 500 - 'Something went wrong')
@@ -0,0 +1,14 @@
// @flow
import type { RequestConfig } from '../../common/types';
import type { GetWalletRequest, AdaWallet } from '../types';
import { request } from '../../utils/request';

export const getWallet = (
config: RequestConfig,
{ walletId }: GetWalletRequest
): Promise<AdaWallet> =>
request({
method: 'GET',
path: `/v2/wallets/${walletId}`,
...config,
});
@@ -15,7 +15,7 @@ export const updateWallet = (
request(
{
method: 'PUT',
path: `/api/v1/wallets/${walletId}`,
path: `/v2/wallets/${walletId}`,
...config,
},
{},
@@ -126,3 +126,7 @@ export type GetWalletRecoveryPhraseFromCertificateRequest = {
passphrase: string,
scrambledInput: string,
};

export type GetWalletRequest = {
walletId: string,
};
@@ -57,7 +57,7 @@

a {
@include link(--theme-system-error-overlay-support-link-icon-color);
border-bottom: 2px solid var(--theme-system-error-overlay-text-color);
border-bottom: 1px solid var(--theme-system-error-overlay-text-color);
color: var(--theme-system-error-overlay-text-color);
}

@@ -3,7 +3,6 @@ import React, { Component } from 'react';
import classnames from 'classnames';
import { observer } from 'mobx-react';
import SVGInline from 'react-svg-inline';
import humanizeDuration from 'humanize-duration';
import { defineMessages, intlShape } from 'react-intl';
import spinnerIcon from '../../assets/images/spinner-dark.inline.svg';
import styles from './RestoreNotification.scss';
@@ -18,9 +17,7 @@ const messages = defineMessages({
});

type Props = {
currentLocale: string,
restoreProgress: number,
restoreETA: number,
};

@observer
@@ -31,41 +28,18 @@ export default class RestoreNotification extends Component<Props> {

render() {
const { intl } = this.context;
const { currentLocale, restoreProgress, restoreETA } = this.props;
const { restoreProgress } = this.props;

const restoreNotificationClasses = classnames([
styles.component,
'ActiveRestoreNotification',
]);

let humanizedDurationLanguage;
switch (currentLocale) {
case 'ja-JP':
humanizedDurationLanguage = 'ja';
break;
case 'zh-CN':
humanizedDurationLanguage = 'zh_CN';
break;
case 'ko-KR':
humanizedDurationLanguage = 'ko';
break;
case 'de-DE':
humanizedDurationLanguage = 'de';
break;
default:
humanizedDurationLanguage = 'en';
}

const estimatedCompletionTime = humanizeDuration(restoreETA, {
round: true, // round seconds to prevent e.g. 1 day 3 hours *11,56 seconds*
language: humanizedDurationLanguage,
});

return (
<div className={restoreNotificationClasses}>
<span className={styles.text}>
{intl.formatMessage(messages.activeRestoreMessage)}: {restoreProgress}
% ({estimatedCompletionTime})
%
</span>
<SVGInline svg={spinnerIcon} className={styles.icon} />
</div>
@@ -53,7 +53,7 @@
}

.submitButton {
background: none !important;
background-color: var(--theme-data-migration-layer-button-background-color);
border: solid 1px var(--theme-data-migration-button-border-color) !important;
color: var(--theme-data-migration-button-label-color) !important;
line-height: 1.36 !important;
@@ -67,7 +67,7 @@
background: var(
--theme-data-migration-layer-button-background-color-hover
) !important;
color: var(--theme-data-migration-layer-background-color) !important;
color: var(--theme-data-migration-layer-text-color-hover) !important;
}
}

@@ -18,6 +18,7 @@

.description {
@extend %regularText;
color: var(--theme-staking-font-color-light);
margin-bottom: 24px;
}

@@ -86,5 +86,11 @@
opacity: 0.5;
}
}

:global {
.SimpleOptions_option {
padding: 8px 20px;
}
}
}
}
@@ -10,7 +10,7 @@
font-size: 16px;
font-weight: 500;
line-height: 1.38;
margin-bottom: 20px;
margin-bottom: 0;
.feesLabel {
color: var(--theme-delegation-steps-confirmation-fees-label-color);
margin-bottom: 6px;
@@ -175,7 +175,7 @@
word-break: break-all;

.stakePoolReference {
color: var(--theme-staking-table-body-highlighted-text-color);
color: var(--theme-staking-font-color-regular);
font-family: var(--font-medium);
}
}
@@ -34,6 +34,7 @@

.description {
@extend %regularText;
color: var(--theme-staking-font-color-light);
margin-bottom: 24px;
}

@@ -20,7 +20,7 @@
font-family: var(--font-medium);
font-size: 14px;
&:hover {
color: var(--theme-staking-font-color);
color: var(--theme-staking-font-color-light);
}
}
}
@@ -8,7 +8,7 @@ import { Input } from 'react-polymorph/lib/components/Input';
import { SwitchSkin } from 'react-polymorph/lib/skins/simple/SwitchSkin';
import { InputSkin } from 'react-polymorph/lib/skins/simple/InputSkin';
import { IDENTIFIERS } from 'react-polymorph/lib/themes/API';
import { defineMessages, intlShape } from 'react-intl';
import { defineMessages, intlShape, FormattedHTMLMessage } from 'react-intl';
import ReactToolboxMobxForm, {
handleFormErrors,
} from '../../utils/ReactToolboxMobxForm';
@@ -280,7 +280,7 @@ export default class WalletCreateDialog extends Component<Props, State> {
skin={InputSkin}
/>
<p className={styles.passwordInstructions}>
{intl.formatMessage(globalMessages.passwordInstructions)}
<FormattedHTMLMessage {...globalMessages.passwordInstructions} />
</p>
</div>
</div>

0 comments on commit 4e76eb5

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