Skip to content

Commit

Permalink
Merge branch 'v2-integration' into fix/ddw-1128-rp-error-with-dropdow…
Browse files Browse the repository at this point in the history
…n-and-window-resize
  • Loading branch information
nikolaglumac committed Dec 13, 2019
2 parents e455ce6 + 83ecea8 commit 1631dbc
Show file tree
Hide file tree
Showing 13 changed files with 149 additions and 59 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -19,6 +19,7 @@ Changelog

### Fixes

- Fixed the display of headlines on the "Network" splash screen ([PR 1770](https://github.com/input-output-hk/daedalus/pull/1770))
- Fixed spending password error handling ([PR 1767](https://github.com/input-output-hk/daedalus/pull/1767))
- Fixed an issue where "Balance" wallet notification wasn't offering an option to create a "Rewards" wallet in case none are available ([PR 1761](https://github.com/input-output-hk/daedalus/pull/1761))
- Fixed the middle ellipsis for different addresses lengths ([PR 1736](https://github.com/input-output-hk/daedalus/pull/1736))
Expand All @@ -36,6 +37,7 @@ Changelog

### Chores

- Updated wallet delegation / undelegation ([PR 1766](https://github.com/input-output-hk/daedalus/pull/1766))
- Updated `webpack` package to version `4.39.1` ([PR 1769](https://github.com/input-output-hk/daedalus/pull/1769))
- Improved "Delegration Center" epoch countdown to use epoch info from the Api ([PR 1751](https://github.com/input-output-hk/daedalus/pull/1751))
- Updated `cardano-wallet` to revision `555b5e82` ([PR 1764](https://github.com/input-output-hk/daedalus/pull/1764))
Expand Down
6 changes: 5 additions & 1 deletion source/renderer/app/actions/staking-actions.js
@@ -1,10 +1,14 @@
// @flow
import Action from './lib/Action';
import type { JoinStakePoolRequest } from '../api/staking/types';
import type {
JoinStakePoolRequest,
QuitStakePoolRequest,
} from '../api/staking/types';
// ======= STAKING ACTIONS =======

export default class StakingActions {
goToStakingInfoPage: Action<any> = new Action();
goToStakingDelegationCenterPage: Action<any> = new Action();
joinStakePool: Action<JoinStakePoolRequest> = new Action();
quitStakePool: Action<QuitStakePoolRequest> = new Action();
}
11 changes: 5 additions & 6 deletions source/renderer/app/api/api.js
Expand Up @@ -37,7 +37,6 @@ import { deleteLegacyTransaction } from './transactions/requests/deleteLegacyTra

// Wallets requests
import { changeSpendingPassword } from './wallets/requests/changeSpendingPassword';
import { quitStakePool } from './wallets/requests/quitStakePool';
import { deleteWallet } from './wallets/requests/deleteWallet';
import { deleteLegacyWallet } from './wallets/requests/deleteLegacyWallet';
import { exportWalletAsJSON } from './wallets/requests/exportWalletAsJSON';
Expand All @@ -56,8 +55,6 @@ import { transferFundsCalculateFee } from './wallets/requests/transferFundsCalcu
import { transferFunds } from './wallets/requests/transferFunds';

// Staking
import { getStakePools } from './staking/requests/getStakePools';
import { getDelegationFee } from './staking/requests/getDelegationFee';
import StakePool from '../domains/StakePool';
import stakingStakePoolsMissingApiData from '../config/stakingStakePoolsMissingApiData.dummy.json';
import { EPOCH_LENGTH_ITN } from '../config/epochsConfig';
Expand All @@ -66,7 +63,10 @@ import { EPOCH_LENGTH_ITN } from '../config/epochsConfig';
import { getNews } from './news/requests/getNews';

// Stake Pools request
import { getStakePools } from './staking/requests/getStakePools';
import { getDelegationFee } from './staking/requests/getDelegationFee';
import { joinStakePool } from './staking/requests/joinStakePool';
import { quitStakePool } from './staking/requests/quitStakePool';

// Utility functions
import {
Expand Down Expand Up @@ -145,8 +145,6 @@ import type {
TransferFundsCalculateFeeResponse,
TransferFundsRequest,
TransferFundsResponse,
QuitStakePoolRequest,
QuitStakePoolResponse,
} from './wallets/types';

// News Types
Expand All @@ -159,6 +157,7 @@ import type {
DelegationFee,
AdaApiStakePools,
AdaApiStakePool,
QuitStakePoolRequest,
} from './staking/types';

// Common errors
Expand Down Expand Up @@ -960,7 +959,7 @@ export default class AdaApi {

quitStakePool = async (
request: QuitStakePoolRequest
): Promise<QuitStakePoolResponse> => {
): Promise<Transaction> => {
Logger.debug('AdaApi::quitStakePool called', {
parameters: filterLogData(request),
});
Expand Down
@@ -1,12 +1,13 @@
// @flow
import type { RequestConfig } from '../../common/types';
import type { QuitStakePoolRequest, QuitStakePoolResponse } from '../types';
import type { QuitStakePoolRequest } from '../types';
import type { Transaction } from '../../transactions/types';
import { request } from '../../utils/request';

export const quitStakePool = (
config: RequestConfig,
{ stakePoolId, walletId, passphrase }: QuitStakePoolRequest
): Promise<QuitStakePoolResponse> =>
): Promise<Transaction> =>
request(
{
method: 'DELETE',
Expand Down
6 changes: 6 additions & 0 deletions source/renderer/app/api/staking/types.js
Expand Up @@ -75,3 +75,9 @@ export type DelegationFee = {
unit: WalletUnits.LOVELACE,
},
};

export type QuitStakePoolRequest = {
stakePoolId: string,
walletId: string,
passphrase: string,
};
27 changes: 0 additions & 27 deletions source/renderer/app/api/wallets/types.js
Expand Up @@ -148,33 +148,6 @@ export type DeleteWalletRequest = {
isLegacy: boolean,
};

export type QuitStakePoolRequest = {
stakePoolId: string,
walletId: string,
passphrase: string,
};

export type QuitStakePoolResponse = {
id: string,
amount: WalletBalance,
inserted_at: {
time: string,
block: Block,
},
pending_since: {
time: string,
block: Block,
},
depth: {
quantity: number,
unit: 'block',
},
direction: string,
inputs: [Input],
outputs: [Output],
status: string,
};

export type GetWalletUtxosRequest = {
walletId: string,
};
Expand Down
6 changes: 3 additions & 3 deletions source/renderer/app/components/splash/Network.scss
Expand Up @@ -81,8 +81,8 @@

.title {
color: var(--theme-splash-network-title-color);
font-family: var(--font-semibold);
font-size: 20px;
font-weight: 600;
letter-spacing: 1px;
line-height: 1.2;
margin-bottom: 5px;
Expand All @@ -91,17 +91,17 @@

.subTitle1 {
color: var(--theme-splash-network-subTitle1-color);
font-family: var(--font-semibold);
font-size: 20px;
font-weight: 600;
letter-spacing: 1px;
line-height: 1.2;
margin-bottom: 5px;
}

.subTitle2 {
color: var(--theme-splash-network-subTitle2-color);
font-family: var(--font-semibold);
font-size: 16px;
font-weight: 600;
letter-spacing: 0.8px;
line-height: 1.38;
margin-bottom: 20px;
Expand Down
Expand Up @@ -180,7 +180,7 @@ export default class DelegationStepsConfirmationDialog extends Component<Props>
label: intl.formatMessage(messages.confirmButtonLabel),
onClick: this.submit,
primary: true,
disabled: !spendingPasswordField.isValid,
disabled: !spendingPasswordField.isValid || isSubmitting,
},
];

Expand Down
5 changes: 5 additions & 0 deletions source/renderer/app/config/stakingConfig.js
Expand Up @@ -20,5 +20,10 @@ export const TOOLTIP_AVG_HEIGHT = (TOOLTIP_MIN_HEIGHT + TOOLTIP_MAX_HEIGHT) / 2;
export const TOOLTIP_WIDTH = 240;
export const CONTAINER_MARGIN = 21;
export const RECENT_STAKE_POOLS_COUNT = 6;

// Timers

export const STAKE_POOL_TRANSACTION_CHECK_INTERVAL = 1 * 1000; // 1 second | unit: milliseconds;
export const STAKE_POOL_TRANSACTION_CHECKER_TIMEOUT = 30 * 1000; // 30 seconds | unit: milliseconds;
export const STAKE_POOLS_INTERVAL = 30 * 60 * 1000; // 30 minutes | unit: milliseconds;
export const STAKE_POOLS_FAST_INTERVAL = 1000; // 1 second | unit: milliseconds;
Expand Up @@ -153,6 +153,7 @@ export default class DelegationSetupWizardDialogContainer extends Component<
recentStakePools,
joinStakePoolRequest,
getStakePoolById,
isDelegatioTransactionPending,
} = staking;
const { network, rawNetwork } = environment;
const futureEpochStartTime = get(futureEpoch, 'epochStart', 0);
Expand Down Expand Up @@ -202,7 +203,9 @@ export default class DelegationSetupWizardDialogContainer extends Component<
onLearnMoreClick={this.handleLearnMoreClick}
onConfirm={this.handleConfirm}
getStakePoolById={getStakePoolById}
isSubmitting={joinStakePoolRequest.isExecuting}
isSubmitting={
joinStakePoolRequest.isExecuting || isDelegatioTransactionPending
}
error={joinStakePoolRequest.error}
/>
);
Expand Down
Expand Up @@ -26,19 +26,22 @@ export default class UndelegateDialogContainer extends Component<Props> {
const { futureEpoch } = networkStatus;
const { currentLocale } = profile;
const {
getStakePoolById,
quitStakePoolRequest,
getWalletById,
undelegateWalletSubmissionSuccess,
} = wallets;
isDelegatioTransactionPending,
} = staking;
const { getWalletById, undelegateWalletSubmissionSuccess } = wallets;
const futureEpochStartTime = get(futureEpoch, 'epochStart', 0);

const walletToBeUndelegated = getWalletById(walletId);
if (!walletToBeUndelegated) return null;

const { name: walletName, delegatedStakePoolId } = walletToBeUndelegated;
const delegatedStakePool = staking.getStakePoolById(delegatedStakePoolId);

if (undelegateWalletSubmissionSuccess) {
if (
(!delegatedStakePoolId || !isDelegatioTransactionPending) &&
undelegateWalletSubmissionSuccess
) {
return (
<UndelegateConfirmationResultDialog
walletName={walletName}
Expand All @@ -55,6 +58,7 @@ export default class UndelegateDialogContainer extends Component<Props> {
);
}

const delegatedStakePool = getStakePoolById(delegatedStakePoolId);
const stakePoolId = get(walletToBeUndelegated, 'delegatedStakePoolId');
const stakePoolName = get(delegatedStakePool, 'name', '');
const stakePoolTicker = get(delegatedStakePool, 'ticker');
Expand All @@ -79,7 +83,9 @@ export default class UndelegateDialogContainer extends Component<Props> {
});
}}
onExternalLinkClick={onExternalLinkClick}
isSubmitting={quitStakePoolRequest.isExecuting}
isSubmitting={
quitStakePoolRequest.isExecuting || isDelegatioTransactionPending
}
error={quitStakePoolRequest.error}
fees={stakePoolQuitFee}
/>
Expand Down

0 comments on commit 1631dbc

Please sign in to comment.