Skip to content

Commit 6082330

Browse files
[DDW-123] Disable address generation for Yoroi wallets (#1961)
* [DDW-123] Disable address generation for Yoroi wallets * [DDW-123] Removes hardcoded API data * [DDW-123] Adjustment in progress * [DDW-123] Typo * [DDW-123] Code improvements, README update * [DDW-123] Update README * [DDD-123] Yoroi addresses rendering issues * [DDW-123] Removes console logs * [DDW-123] Update text copy Co-authored-by: Nikola Glumac <[email protected]>
1 parent 0baa6fe commit 6082330

31 files changed

+568
-389
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Changelog
1818

1919
### Fixes
2020

21+
- Disabled address generation for Yoroi wallets ([PR 1961](https://github.com/input-output-hk/daedalus/pull/1961))
2122
- Fixed "Restoration" dialog validation ([PR 1951](https://github.com/input-output-hk/daedalus/pull/1951))
2223
- Fixed the `EPERM` errors thrown in the console upon changing wallet name on the "Wallet Settings" screen ([PR 1944](https://github.com/input-output-hk/daedalus/pull/1944))
2324

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Daedalus - Cryptocurrency Wallet
4747

4848
1. Run `yarn nix:selfnode` from `daedalus`.
4949
2. Run `yarn dev` from the subsequent `nix-shell`
50-
3. Once Daedalus has started, and has gotten past the loading screen, run `yarn byron:wallet:importer` from a new terminal window. This is only required if you wish to import some funded wallets.
50+
3. Once Daedalus has started, and has gotten past the loading screen, run `yarn byron:wallet:importer` from a new terminal window. This is only required if you wish to import some funded wallets. It is also possible to import funded Yoroi wallets by running `yarn yoroi:wallet:importer` script.
5151

5252
#### Mainnet
5353

nix/sources.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@
4141
"homepage": null,
4242
"owner": "input-output-hk",
4343
"repo": "cardano-wallet",
44-
"rev": "7140ff0886908e884eb7d1944ebdd59cbe3b1511",
45-
"sha256": "0fg9bvd3dlbnszip0l1gxvwg17j0ryjmm8f31yvb33gjk0x6h94g",
44+
"rev": "b97553a2b734a0fa25e0ef27f9fe15e46175f406",
45+
"sha256": "026as7bdmmamcyjn05al4mfqyhg9w7q09h9zv9vx917l36jy76pa",
4646
"type": "tarball",
47-
"url": "https://github.com/input-output-hk/cardano-wallet/archive/7140ff0886908e884eb7d1944ebdd59cbe3b1511.tar.gz",
47+
"url": "https://github.com/input-output-hk/cardano-wallet/archive/b97553a2b734a0fa25e0ef27f9fe15e46175f406.tar.gz",
4848
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz",
4949
"version": "v2020-04-07"
5050
},

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"byron:wallet:importer": "node utils/api-importer/byron-wallet-importer.js",
5656
"itn:byron:wallet:importer": "node utils/api-importer/itn-byron-wallet-importer.js",
5757
"itn:shelley:wallet:importer": "node utils/api-importer/itn-shelley-wallet-importer.js",
58+
"yoroi:wallet:importer": "node utils/api-importer/yoroi-wallet-importer.js",
5859
"js-launcher": "node utils/js-launcher/index.js",
5960
"create-news-verification-hashes": "node utils/create-news-verification-hashes/index.js",
6061
"lockfile:check": "node utils/lockfile-checker/index.js --check",

source/renderer/app/api/api.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1896,6 +1896,7 @@ const _createWalletFromServerData = action(
18961896
delegation,
18971897
state: syncState,
18981898
isLegacy = false,
1899+
discovery,
18991900
} = wallet;
19001901

19011902
const id = isLegacy ? getLegacyWalletId(rawWalletId) : rawWalletId;
@@ -1945,6 +1946,7 @@ const _createWalletFromServerData = action(
19451946
delegationStakePoolStatus,
19461947
lastDelegationStakePoolId,
19471948
pendingDelegations: next,
1949+
discovery,
19481950
});
19491951
}
19501952
);

source/renderer/app/api/wallets/types.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export type AdaWallet = {
4848
last_updated_at: string,
4949
},
5050
state: WalletSyncState,
51+
discovery: Discovery,
5152
isLegacy: boolean,
5253
};
5354

@@ -63,6 +64,7 @@ export type LegacyAdaWallet = {
6364
last_updated_at: string,
6465
},
6566
state: WalletSyncState,
67+
discovery: Discovery,
6668
tip: Block,
6769
};
6870

@@ -78,6 +80,8 @@ export type SyncStateStatus =
7880
| 'syncing'
7981
| 'not_responding';
8082

83+
export type Discovery = 'random' | 'sequential';
84+
8185
export type DelegationStatus = 'delegating' | 'not_delegating';
8286

8387
export type WalletSyncStateProgress = {

source/renderer/app/components/wallet/receive/Address.js

Lines changed: 0 additions & 49 deletions
This file was deleted.

source/renderer/app/components/wallet/receive/Address.scss

Lines changed: 0 additions & 53 deletions
This file was deleted.
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
// @flow
2+
import React, { Component } from 'react';
3+
import { observer } from 'mobx-react';
4+
import classnames from 'classnames';
5+
import CopyToClipboard from 'react-copy-to-clipboard';
6+
import { defineMessages, intlShape } from 'react-intl';
7+
import SVGInline from 'react-svg-inline';
8+
import styles from './AddressActions.scss';
9+
import iconQR from '../../../assets/images/qr-code.inline.svg';
10+
import iconCopy from '../../../assets/images/clipboard-ic.inline.svg';
11+
import WalletAddress from '../../../domains/WalletAddress';
12+
13+
const messages = defineMessages({
14+
instructionsTitle: {
15+
id: 'wallet.receive.page.instructions.instructionsTitle',
16+
defaultMessage: '!!!Your wallet addresses',
17+
description: 'Instructions Title on the wallet "Receive page"',
18+
},
19+
instructionsDescription: {
20+
id: 'wallet.receive.page.instructions.instructionsDescription',
21+
defaultMessage:
22+
'!!!Share this wallet address to receive payments. To protect your privacy, new addresses are generated automatically once you use them.',
23+
description: 'Instructions Description on the wallet "Receive page"',
24+
},
25+
addressesTitle: {
26+
id: 'wallet.receive.page.addresses.addressesTitle',
27+
defaultMessage: '!!!Addresses',
28+
description: 'Addresses Title on the wallet "Receive page"',
29+
},
30+
showUsedLabel: {
31+
id: 'wallet.receive.page.showUsedLabel',
32+
defaultMessage: '!!!show used',
33+
description:
34+
'Label for "show used" wallet addresses link on the wallet "Receive page"',
35+
},
36+
shareAddressLabel: {
37+
id: 'wallet.receive.page.shareAddressLabel',
38+
defaultMessage: '!!!Share',
39+
description: 'Label for "Share" link on the wallet "Receive page"',
40+
},
41+
copyAddressLabel: {
42+
id: 'wallet.receive.page.copyAddressLabel',
43+
defaultMessage: '!!!Copy address',
44+
description: 'Label for "Copy address" link on the wallet "Receive page"',
45+
},
46+
});
47+
48+
type Props = {
49+
address: WalletAddress,
50+
onShareAddress: Function,
51+
onCopyAddress: Function,
52+
type?: 'share' | 'copy',
53+
};
54+
55+
@observer
56+
export default class AddressActions extends Component<Props> {
57+
static defaultProps = {
58+
type: 'copy',
59+
};
60+
static contextTypes = {
61+
intl: intlShape.isRequired,
62+
};
63+
64+
addressElement: ?HTMLElement;
65+
addressContainerElement: ?HTMLElement;
66+
67+
render() {
68+
const { intl } = this.context;
69+
const {
70+
address,
71+
onShareAddress,
72+
onCopyAddress,
73+
type = 'copy',
74+
} = this.props;
75+
const { id: addressId, used: isUsed } = address;
76+
const componentClasses = classnames(styles[`${type}Actions`], {
77+
[styles.isUsed]: isUsed,
78+
});
79+
return (
80+
<div className={componentClasses}>
81+
{type === 'copy' ? (
82+
<CopyToClipboard
83+
text={addressId}
84+
onCopy={() => onCopyAddress(addressId)}
85+
>
86+
<span className={styles.copyAddress}>
87+
<SVGInline svg={iconCopy} className={styles.copyIcon} />
88+
<span className={styles.copyAddressLabel}>
89+
{intl.formatMessage(messages.copyAddressLabel)}
90+
</span>
91+
</span>
92+
</CopyToClipboard>
93+
) : (
94+
<button
95+
className={styles.shareAddressButton}
96+
onClick={() => onShareAddress(address)}
97+
>
98+
<SVGInline svg={iconQR} className={styles.shareIcon} />
99+
<span className={styles.shareAddressLabel}>
100+
{intl.formatMessage(messages.shareAddressLabel)}
101+
</span>
102+
</button>
103+
)}
104+
</div>
105+
);
106+
}
107+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
.shareActions {
2+
display: flex;
3+
flex-direction: row;
4+
flex-shrink: 0;
5+
height: 18px;
6+
justify-content: flex-end;
7+
}
8+
.copyActions {
9+
}
10+
.isUsed {
11+
.copyAddress .copyIcon {
12+
opacity: 0.4;
13+
}
14+
.copyAddress .copyAddressLabel {
15+
opacity: 0.2;
16+
}
17+
}
18+
19+
/* COPY */
20+
.copyAddress {
21+
cursor: pointer;
22+
display: flex;
23+
white-space: nowrap;
24+
}
25+
.copyAddressLabel {
26+
color: var(--theme-label-button-color);
27+
font-size: 14px;
28+
margin-left: 6px;
29+
opacity: 0.5;
30+
}
31+
.copyIcon {
32+
cursor: pointer;
33+
margin-left: 4px;
34+
object-fit: contain;
35+
& > svg {
36+
height: 12px;
37+
width: 10px;
38+
path {
39+
fill: var(--theme-icon-copy-address-color);
40+
}
41+
}
42+
}
43+
44+
/* SHARE */
45+
.shareAddressButton {
46+
cursor: pointer;
47+
line-height: 1.36;
48+
white-space: nowrap;
49+
}
50+
.shareIcon {
51+
& > svg {
52+
height: 12px;
53+
width: 12px;
54+
path {
55+
fill: var(--theme-icon-copy-address-color);
56+
}
57+
}
58+
}
59+
.shareAddressLabel {
60+
color: var(--theme-label-button-color);
61+
font-size: 14px;
62+
margin-left: 6px;
63+
opacity: 0.5;
64+
}

0 commit comments

Comments
 (0)