Skip to content

Commit

Permalink
Demo setup
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolaglumac committed Jul 1, 2020
1 parent 9d29db8 commit fc9da24
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 49 deletions.
10 changes: 5 additions & 5 deletions source/renderer/app/api/api.js
Expand Up @@ -189,7 +189,7 @@ import { deleteTransaction } from './transactions/requests/deleteTransaction';
import { WALLET_BYRON_KINDS } from '../config/walletRestoreConfig';
import ApiError from '../domains/ApiError';

const { isIncentivizedTestnet, isShelleyTestnet } = global;
const { isIncentivizedTestnet } = global;

export default class AdaApi {
config: RequestConfig;
Expand All @@ -209,9 +209,9 @@ export default class AdaApi {
const wallets: AdaWallets = isIncentivizedTestnet
? await getWallets(this.config)
: [];
const legacyWallets: LegacyAdaWallets = !isShelleyTestnet
? await getLegacyWallets(this.config)
: [];
const legacyWallets: LegacyAdaWallets = await getLegacyWallets(
this.config
);
logger.debug('AdaApi::getWallets success', { wallets, legacyWallets });

map(legacyWallets, legacyAdaWallet => {
Expand Down Expand Up @@ -1771,7 +1771,7 @@ const _createWalletFromServerData = action(
balance.available.unit === WalletUnits.LOVELACE
? new BigNumber(balance.available.quantity).dividedBy(LOVELACES_PER_ADA)
: new BigNumber(balance.available.quantity);
let walletRewardAmount = 0;
let walletRewardAmount = new BigNumber(0);
if (!isLegacy) {
walletRewardAmount =
balance.reward.unit === WalletUnits.LOVELACE
Expand Down
Expand Up @@ -71,10 +71,10 @@ export default class StakingNavigation extends Component<Props> {
];
if (!isIncentivizedTestnet) {
navigationItems.push(
{
id: 'epochs',
label: intl.formatMessage(messages.epochs),
},
// {
// id: 'epochs',
// label: intl.formatMessage(messages.epochs),
// },
{
id: 'info',
label: intl.formatMessage(messages.info),
Expand Down
24 changes: 13 additions & 11 deletions source/renderer/app/components/wallet/summary/WalletSummary.js
Expand Up @@ -77,18 +77,20 @@ export default class WalletSummary extends Component<Props> {
/>
</div>

<div className={styles.balancesWrapper}>
<div className={styles.walletBalance}>
{intl.formatMessage(messages.walletBalancelabel)}:&nbsp;
{wallet.amount.toFormat(DECIMAL_PLACES_IN_ADA)}
<SVGInline svg={adaSymbol} className={styles.currencySymbol} />
</div>
<div className={styles.rewardsAccountBalance}>
{intl.formatMessage(messages.rewardsAccountBalancelabel)}:&nbsp;
{wallet.reward.toFormat(DECIMAL_PLACES_IN_ADA)}
<SVGInline svg={adaSymbol} className={styles.currencySymbol} />
{!wallet.isLegacy && (
<div className={styles.balancesWrapper}>
<div className={styles.walletBalance}>
{intl.formatMessage(messages.walletBalancelabel)}:&nbsp;
{wallet.amount.toFormat(DECIMAL_PLACES_IN_ADA)}
<SVGInline svg={adaSymbol} className={styles.currencySymbol} />
</div>
<div className={styles.rewardsAccountBalance}>
{intl.formatMessage(messages.rewardsAccountBalancelabel)}:&nbsp;
{wallet.reward.toFormat(DECIMAL_PLACES_IN_ADA)}
<SVGInline svg={adaSymbol} className={styles.currencySymbol} />
</div>
</div>
</div>
)}

{!isLoadingTransactions ? (
<div className={styles.transactionsCountWrapper}>
Expand Down
Expand Up @@ -175,9 +175,6 @@ export default class WalletTypeDialog extends Component<Props, State> {
}
return {
key: kind,
disabled:
isShelleyTestnet &&
(kind.includes('Byron') || kind.includes('Paper')),
label: <FormattedHTMLMessage {...msg} />,
selected: value === kind,
onChange: () => this.props.onSetWalletKind(kind, kindParam),
Expand Down
44 changes: 23 additions & 21 deletions source/renderer/app/containers/staking/Staking.js
Expand Up @@ -16,30 +16,30 @@ type Props = InjectedContainerProps;
export default class Staking extends Component<Props> {
static defaultProps = { actions: null, stores: null };
// TODO: Uncomment when the we need the countdown logic
// componentDidMount() {
// this.handleDelegationRoute();
// }
componentDidMount() {
this.handleDelegationRoute();
}

// handleDelegationRoute = () => {
// const {
// actions,
// stores: { staking },
// } = this.props;
handleDelegationRoute = () => {
const {
actions,
stores: { staking },
} = this.props;

// if (staking.showCountdown() && !staking.isStakingDelegationCountdown) {
// return actions.router.goToRoute.trigger({
// route: ROUTES.STAKING.DELEGATION_COUNTDOWN,
// });
// }
if (staking.showCountdown() && !staking.isStakingDelegationCountdown) {
return actions.router.goToRoute.trigger({
route: ROUTES.STAKING.COUNTDOWN,
});
}

// if (!staking.showCountdown() && staking.isStakingDelegationCountdown) {
// return actions.router.goToRoute.trigger({
// route: ROUTES.STAKING.INFO,
// });
// }
if (!staking.showCountdown() && staking.isStakingDelegationCountdown) {
return actions.router.goToRoute.trigger({
route: ROUTES.STAKING.INFO,
});
}

// return true;
// };
return true;
};

isActiveNavItem = (page: string, item: NavDropdownProps) => {
const { app } = this.props.stores;
Expand Down Expand Up @@ -95,7 +95,9 @@ export default class Staking extends Component<Props> {
isActiveNavItem={this.isActiveNavItem}
onNavItemClick={this.handleNavItemClick}
activeItem={app.currentPage}
isIncentivizedTestnet={global.isIncentivizedTestnet}
isIncentivizedTestnet={
global.isIncentivizedTestnet && !global.isShelleyTestnet
}
>
{children}
</StakingWithNavigation>
Expand Down
Expand Up @@ -21,7 +21,7 @@ export default class StakingEpochsPage extends Component<Props> {
},
} = this.props;

if (global.isIncentivizedTestnet) {
if (global.isIncentivizedTestnet && !global.isShelleyTestnet) {
goToStakingDelegationCenterPage.trigger();
}
}
Expand Down
2 changes: 1 addition & 1 deletion source/renderer/app/containers/staking/StakingInfoPage.js
Expand Up @@ -31,7 +31,7 @@ export default class StakingInfoPage extends Component<Props> {
},
} = this.props;

if (global.isIncentivizedTestnet) {
if (global.isIncentivizedTestnet && !global.isShelleyTestnet) {
goToStakingDelegationCenterPage.trigger();
}
}
Expand Down
4 changes: 2 additions & 2 deletions source/renderer/app/i18n/locales/en-US.json
Expand Up @@ -643,9 +643,9 @@
"wallet.restore.dialog.step.walletKind.hardwareWalletDisclaimer1": "Hardware wallets keep your private keys stored securely on a physical device that is immune to common computer threats such as viruses and software bugs. Recovery phrases for hardware wallets should always be kept offline. By entering your hardware wallet recovery phrase in Daedalus, you are exposing your hardware wallet private keys to the security risks associated with computers and software.",
"wallet.restore.dialog.step.walletKind.hardwareWalletDisclaimer2": "We strongly recommend that you delete the Balance wallet which is restored from your hardware wallet once you have moved any funds into a Rewards wallet.",
"wallet.restore.dialog.step.walletKind.label.daedalusWalletKind": "What kind of Daedalus wallet would you like to restore?",
"wallet.restore.dialog.step.walletKind.label.daedalusWalletKind12WordByron": "12 words (Byron legacy wallet)",
"wallet.restore.dialog.step.walletKind.label.daedalusWalletKind12WordByron": "12 words <em>(Byron legacy wallet)</em>",
"wallet.restore.dialog.step.walletKind.label.daedalusWalletKind15WordShelley": "15 words <em>(Shelley wallet)</em>",
"wallet.restore.dialog.step.walletKind.label.daedalusWalletKind27WordPaper": "27 words - paper wallet (Byron legacy wallet)",
"wallet.restore.dialog.step.walletKind.label.daedalusWalletKind27WordPaper": "27 words - paper wallet <em>(Byron legacy wallet)</em>",
"wallet.restore.dialog.step.walletKind.label.hardwareWalletKind": "What kind of hardware wallet would you like to restore?",
"wallet.restore.dialog.step.walletKind.label.hardwareWalletKindLedger": "12, 18 or 24 words - Ledger Nano S or Nano X (Balance wallet)",
"wallet.restore.dialog.step.walletKind.label.hardwareWalletKindTrezor": "12, 18 or 24 words - Trezor (Balance wallet)",
Expand Down
2 changes: 2 additions & 0 deletions source/renderer/app/stores/SidebarStore.js
Expand Up @@ -88,6 +88,8 @@ export default class SidebarStore extends Store {
} = global;
if (isFlight) {
this.CATEGORIES = sidebarConfig.CATEGORIES;
} else if (isShelleyTestnet) {
this.CATEGORIES = sidebarConfig.CATEGORIES_WITH_DELEGATION_COUNTDOWN; // sidebarConfig.CATEGORIES_WITHOUT_DELEGATION_COUNTDOWN
} else if (isIncentivizedTestnet || isShelleyTestnet) {
this.CATEGORIES = sidebarConfig.CATEGORIES_WITHOUT_DELEGATION_COUNTDOWN;
} else if (environment.isDev) {
Expand Down
2 changes: 1 addition & 1 deletion source/renderer/app/stores/StakingStore.js
Expand Up @@ -31,7 +31,7 @@ export default class StakingStore extends Store {
refreshPolling: ?IntervalID = null;
delegationCheckTimeInterval: ?IntervalID = null;

startDateTime: string = '2019-12-09T00:00:00.161Z';
startDateTime: string = '2020-07-29T00:00:00.161Z';
decentralizationProgress: number = 10;
adaValue: BigNumber = new BigNumber(82650.15);
percentage: number = 14;
Expand Down

0 comments on commit fc9da24

Please sign in to comment.