Skip to content
This repository has been archived by the owner on Jun 16, 2022. It is now read-only.

LIVE-1004 Hedera integration #4966

Open
wants to merge 41 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
4e7187e
(Market): updated logic to limit refreshes in between pages (#4861)
LFBarreto Apr 5, 2022
69f6bd4
Sunset Libcore (#4867)
gre Apr 5, 2022
11d1af9
[LIVE-1174] - Feature: Upgrade NFT architecture (#4870)
lambertkevin Apr 5, 2022
4cf9a9d
LIVE-1569 Add "Hide NFT Collection" feature (#4868)
grsoares21 Apr 5, 2022
ca2231d
Add ETH goerli (#4876)
hzheng-ledger Apr 5, 2022
7a59cfb
update screenshots (windows)
ledgerlive Apr 5, 2022
308f3da
update screenshots (linux)
ledgerlive Apr 6, 2022
d4484a7
Fix NFT transaction summary error (#4898)
lambertkevin Apr 6, 2022
b0378ac
Bump minimist from 1.2.5 to 1.2.6 (#4866)
dependabot[bot] Apr 7, 2022
104ecd9
Bump plist from 3.0.4 to 3.0.5 (#4890)
dependabot[bot] Apr 7, 2022
fe04f33
Bump url-parse from 1.5.7 to 1.5.10 (#4891)
dependabot[bot] Apr 7, 2022
ad0534a
LIVE-1751 Solana staking (#4884)
Apr 7, 2022
6117c65
[LIVE-1911] Feature - Add collection name resolver to eth familly (#4…
lambertkevin Apr 7, 2022
a4adeca
Bugfix: Solana linting (#4902)
lambertkevin Apr 11, 2022
8970be2
Update links to use the new explorer from metadata (#4912)
lambertkevin Apr 11, 2022
af9fb9d
v2.41.0
lambertkevin Apr 6, 2022
7d3220e
Add LLC#22.0.0 dependency
lambertkevin Apr 12, 2022
15ad917
Add hedera to the set of supported currencies
mehcode Oct 6, 2021
ddb4636
feat: handle virtual addresses (set by ll, unverified) in receive
mehcode Oct 6, 2021
582f4cf
hedera: use hederaResources.accountId over virtualAddress
mehcode Oct 19, 2021
879e52d
feat: add support article link to account creation step
jackthta Jan 13, 2022
13bc1d8
chore: remove @hashgraph/sdk
jackthta Jan 27, 2022
53c8156
refactor: scope `messageIfVirtual` i18n key under Hedera
jackthta Jan 27, 2022
4ad9d41
refactor: add specific UI for `StepReceiveFunds`
jackthta Feb 25, 2022
2931891
refactor: relocate hedera support article link
jackthta Mar 9, 2022
92a1c36
refactor: lowercase 'Hedera' in i18n
jackthta Mar 9, 2022
0d090b0
fix: remove duplicate import
jackthta Mar 21, 2022
0d29577
refactor: restructure `StepReceiveFunds` into custom hedera UI component
jackthta Mar 23, 2022
97899b3
refactor: restructure 'no associated account text' inside `StepImport…
jackthta Mar 24, 2022
ff35ed8
Target LLC commit
hakim-adamik Apr 12, 2022
85767e4
Merge remote-tracking branch 'ledgerhq/develop' into HEAD
hakim-adamik May 3, 2022
60b2c4c
Update live-common commit to use
hakim-adamik May 3, 2022
65742ca
Update yarn.lock
hakim-adamik May 3, 2022
be9d7db
Fix corrupt files after bad merge
hakim-adamik May 5, 2022
bd89fe4
Update cryptoassets.md
hakim-adamik May 5, 2022
5dd139e
Update live-common commit to use
hakim-adamik May 6, 2022
a2981e9
Update live-common commit to use
hakim-adamik May 6, 2022
ba56086
Fix some lint issues
hakim-adamik May 12, 2022
f160234
fix: lint errors (#4978)
jackthta May 12, 2022
f052598
Merge remote-tracking branch 'ledgerhq/develop' into HEAD
hakim-adamik May 13, 2022
b58835f
Merge remote-tracking branch 'ledgerhq/develop' into HEAD
hakim-adamik May 17, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cryptoassets.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
| Elrond | EGLD | YES | elrond |
| Ethereum | ETH | YES | ethereum |
| Ethereum Classic | ETC | YES | ethereum_classic |
| Hedera | HBAR | YES | hedera |
| Horizen | ZEN | YES | zencash |
| Komodo | KMD | YES | komodo |
| Litecoin | LTC | YES | litecoin |
Expand Down Expand Up @@ -60,7 +61,6 @@
| GameCredits | GAME | NO | game_credits |
| GoChain | GO | NO | gochain |
| Groestlcoin | GRS | NO | groestcoin |
| Hedera | HBAR | NO | hedera |
| Helium | HNT | NO | helium |
| High Performance Blockchain | HPB | NO | hpb |
| Hycon | HYC | NO | hycon |
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@ledgerhq/hw-transport": "6.27.1",
"@ledgerhq/hw-transport-http": "6.27.1",
"@ledgerhq/hw-transport-node-hid-singleton": "6.27.1",
"@ledgerhq/live-common": "https://github.com/LedgerHQ/ledger-live-common.git#develop",
"@ledgerhq/live-common": "https://github.com/LedgerHQ/ledger-live-common.git#03617053fe9c3e1f1910d94eaa95018cab4aa559",
"@ledgerhq/logs": "6.10.0",
"@ledgerhq/react-ui": "^0.7.5",
"@open-wc/webpack-import-meta-loader": "^0.4.7",
Expand Down
4 changes: 3 additions & 1 deletion scripts/sync-families-dispatch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ SendWarning.js \
ReceiveWarning.js \
AccountBalanceSummaryFooter.js \
TokenList.js \
AccountHeaderManageActions.js
AccountHeaderManageActions.js \
StepReceiveFunds.js \
NoAssociatedAccounts.js
"

cd ../src/renderer
Expand Down
4 changes: 4 additions & 0 deletions src/config/urls.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,4 +215,8 @@ export const urls = {
recipient_info: "https://support.ledger.com",
ledgerByFigmentTC: "https://drive.google.com/file/d/1vlIh2gTwtbMon8_bzFQGjCLhTUqS5uQc",
},
hedera: {
supportArticleLink:
"https://launchbadge.com/blog/using-a-ledger-nano-to-create-your-hedera-account",
},
};
1 change: 1 addition & 0 deletions src/live-common-set-supported-currencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ setSupportedCurrencies([
"ethereum_ropsten",
"ethereum_goerli",
"cosmos_testnet",
"hedera",
]);
25 changes: 25 additions & 0 deletions src/renderer/families/hedera/NoAssociatedAccounts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// @flow
import React from "react";
import { Trans } from "react-i18next";

import { openURL } from "~/renderer/linking";
import { urls } from "~/config/urls";
import LinkWithExternalIcon from "~/renderer/components/LinkWithExternalIcon";

import type { StepProps } from "~/renderer/modals/AddAccounts/index";

// "no associated accounts" text when adding/importing accounts
const NoAssociatedAccounts = ({ t }: StepProps) => {
return (
<div>
<Trans i18nKey="hedera.createHederaAccountHelp.text"></Trans>{" "}
<LinkWithExternalIcon
fontSize={3}
onClick={() => openURL(urls.hedera.supportArticleLink)}
label={t("hedera.createHederaAccountHelp.link")}
/>
</div>
);
};

export default NoAssociatedAccounts;
149 changes: 149 additions & 0 deletions src/renderer/families/hedera/StepReceiveFunds.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
// @flow

import React, { useRef, useCallback, useState } from "react";
import { Trans } from "react-i18next";
import invariant from "invariant";
import { getMainAccount, getAccountName } from "@ledgerhq/live-common/lib/account";
import styled from "styled-components";

import TrackPage from "~/renderer/analytics/TrackPage";
import Box from "~/renderer/components/Box";
import ErrorDisplay from "~/renderer/components/ErrorDisplay";
import Text from "~/renderer/components/Text";
import Ellipsis from "~/renderer/components/Ellipsis";
import ReadOnlyAddressField from "~/renderer/components/ReadOnlyAddressField";
import LinkShowQRCode from "~/renderer/components/LinkShowQRCode";
import Modal from "~/renderer/components/Modal";
import ModalBody from "~/renderer/components/Modal/ModalBody";
import Alert from "~/renderer/components/Alert";
import QRCode from "~/renderer/components/QRCode";
import AccountTagDerivationMode from "~/renderer/components/AccountTagDerivationMode";

import type { StepProps } from "~/renderer/modals/Receive/Body";
import type { AccountLike } from "@ledgerhq/live-common/lib/types";

const QRCodeWrapper = styled.div`
border: 24px solid white;
height: 208px;
width: 208px;
background: white;
`;

const Receive1ShareAddress = ({
account,
name,
address,
showQRCodeModal,
}: {
account: AccountLike,
name: string,
address: string,
showQRCodeModal: () => void,
}) => {
return (
<>
<Box horizontal alignItems="center" flow={2} mb={4}>
<Text style={{ flex: 1 }} ff="Inter|SemiBold" color="palette.text.shade100" fontSize={4}>
{name ? (
<Box horizontal alignItems="center" flexWrap="wrap">
<Ellipsis>
<Trans i18nKey="currentAddress.for">
{"Address for "}
<strong>{name}</strong>
</Trans>
</Ellipsis>
<AccountTagDerivationMode account={account} />
</Box>
) : (
<Trans i18nKey="currentAddress.title" />
)}
</Text>
<LinkShowQRCode onClick={showQRCodeModal} address={address} />
</Box>
<ReadOnlyAddressField address={address} />
</>
);
};

const StepReceiveFunds = ({
isAddressVerified,
account,
parentAccount,
device,
onChangeAddressVerified,
transitionTo,
onResetSkip,
verifyAddressError,
token,
onClose,
eventType,
currencyName,
}: StepProps) => {
const mainAccount = account ? getMainAccount(account, parentAccount) : null;
invariant(account && mainAccount, "No account given");
const name = token ? token.name : getAccountName(account);
const initialDevice = useRef(device);
const address = mainAccount.hederaResources?.accountId?.toString() ?? mainAccount.freshAddress;
const [modalVisible, setModalVisible] = useState(false);

const hideQRCodeModal = useCallback(() => setModalVisible(false), [setModalVisible]);
const showQRCodeModal = useCallback(() => setModalVisible(true), [setModalVisible]);

const onVerify = useCallback(() => {
// if device has changed since the beginning, we need to re-entry device
if (device !== initialDevice.current || !isAddressVerified) {
transitionTo("device");
}
onChangeAddressVerified(null);
onResetSkip();
});

return (
<>
<Box px={2}>
<TrackPage
category={`Receive Flow${eventType ? ` (${eventType})` : ""}`}
name="Step 3"
currencyName={currencyName}
/>
{verifyAddressError ? (
<ErrorDisplay error={verifyAddressError} onRetry={onVerify} />
) : device ? (
// verification with device
<>
<Receive1ShareAddress
account={mainAccount}
name={name}
address={address}
showQRCodeModal={showQRCodeModal}
/>

{/* show warning for unverified address */}
<Alert type="security" mt={4}>
<Trans i18nKey="hedera.currentAddress.messageIfVirtual" values={{ name }} />
</Alert>
</>
) : null // should not happen
}
</Box>

<Modal isOpened={modalVisible} onClose={hideQRCodeModal} centered width={460}>
<ModalBody
onClose={hideQRCodeModal}
render={() => (
<Box alignItems="center">
<QRCodeWrapper>
<QRCode size={160} data={address} />
</QRCodeWrapper>
<Box mt={6}>
<ReadOnlyAddressField address={address} />
</Box>
</Box>
)}
/>
</Modal>
</>
);
};

export default StepReceiveFunds;
23 changes: 17 additions & 6 deletions src/renderer/modals/AddAccounts/steps/StepImport.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import Switch from "~/renderer/components/Switch";
import type { StepProps } from "..";
import InfoCircle from "~/renderer/icons/InfoCircle";
import ToolTip from "~/renderer/components/Tooltip";
import byFamily from "~/renderer/generated/NoAssociatedAccounts";

// $FlowFixMe
const remapTransportError = (err: mixed, appName: string): Error => {
Expand Down Expand Up @@ -277,24 +278,34 @@ class StepImport extends PureComponent<StepProps, { showAllCreatedAccounts: bool
: [preferredNewAccountScheme],
});

const emptyTexts = {
importable: t("addAccounts.noAccountToImport", { currencyName }),

creatable: alreadyEmptyAccount ? (
let creatable;
const NoAssociatedAccounts = byFamily[currency.family];
if (alreadyEmptyAccount) {
creatable = (
<Trans i18nKey="addAccounts.createNewAccount.noOperationOnLastAccount" parent="div">
{" "}
<Text ff="Inter|SemiBold" color="palette.text.shade100">
{alreadyEmptyAccount.name}
</Text>{" "}
</Trans>
) : (
);
} else if (NoAssociatedAccounts) {
// custom family UI for "no associated accounts"
creatable = <NoAssociatedAccounts {...this.props} />;
} else {
creatable = (
<Trans i18nKey="addAccounts.createNewAccount.noAccountToCreate" parent="div">
{" "}
<Text ff="Inter|SemiBold" color="palette.text.shade100">
{currencyName}
</Text>{" "}
</Trans>
),
);
}

const emptyTexts = {
importable: t("addAccounts.noAccountToImport", { currencyName }),
creatable,
};

return (
Expand Down
38 changes: 24 additions & 14 deletions src/renderer/modals/Receive/steps/StepReceiveFunds.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import ModalBody from "~/renderer/components/Modal/ModalBody";
import QRCode from "~/renderer/components/QRCode";
import { getEnv } from "@ledgerhq/live-common/lib/env";
import AccountTagDerivationMode from "~/renderer/components/AccountTagDerivationMode";
import byFamily from "~/renderer/generated/StepReceiveFunds";

const Separator = styled.div`
border-top: 1px solid #99999933;
Expand Down Expand Up @@ -123,22 +124,25 @@ const Receive2Device = ({
);
};

const StepReceiveFunds = ({
isAddressVerified,
account,
parentAccount,
device,
onChangeAddressVerified,
transitionTo,
onResetSkip,
verifyAddressError,
token,
onClose,
eventType,
currencyName,
}: StepProps) => {
const StepReceiveFunds = (props: StepProps) => {
const {
isAddressVerified,
account,
parentAccount,
device,
onChangeAddressVerified,
transitionTo,
onResetSkip,
verifyAddressError,
token,
onClose,
eventType,
currencyName,
} = props;

const mainAccount = account ? getMainAccount(account, parentAccount) : null;
invariant(account && mainAccount, "No account given");

const name = token ? token.name : getAccountName(account);
const initialDevice = useRef(device);
const address = mainAccount.freshAddress;
Expand Down Expand Up @@ -190,6 +194,12 @@ const StepReceiveFunds = ({
}
}, [isAddressVerified, confirmAddress]);

// custom family UI for StepReceiveFunds
const CustomStepReceiveFunds = byFamily[mainAccount.currency.family];
if (CustomStepReceiveFunds) {
return <CustomStepReceiveFunds {...props} />;
}

return (
<>
<Box px={2}>
Expand Down
10 changes: 10 additions & 0 deletions static/i18n/en/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -4342,5 +4342,15 @@
"memo": "Memo",
"memoPlaceholder": "Optional",
"memoWarningText": "When using a memo, carefully check the information with the recipient"
},
"hedera": {
"name": "hedera",
"createHederaAccountHelp": {
"text": "Please refer to this support article for",
"link": "how to create a Hedera account"
},
"currentAddress": {
"messageIfVirtual": "Your {{name}} address cannot be confirmed on your Ledger device. Use at your own risk."
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading