-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c7b8879
commit 81abd08
Showing
10 changed files
with
129 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import React, { ReactElement } from "react" | ||
import { useTranslation } from "react-i18next" | ||
import { | ||
derivationPathChange, | ||
setSelectedNetwork, | ||
} from "@tallyho/tally-background/redux-slices/ui" | ||
import { ROOTSTOCK, ETHEREUM } from "@tallyho/tally-background/constants" | ||
import { EVMNetwork } from "@tallyho/tally-background/networks" | ||
import { useBackgroundDispatch } from "../../hooks" | ||
import SelectDerivationPath from "../../components/Onboarding/OnboardingDerivationPathSelect" | ||
|
||
const DERIVATION_PATH_TO_NETWORK: { [key: string]: EVMNetwork } = { | ||
"m/44'/137'/0'/0": ROOTSTOCK, | ||
"m/44'/60'/0'/0": ETHEREUM, | ||
"m/44'/1'/0'/0": ETHEREUM, | ||
"m/44'/60'/0'": ETHEREUM, | ||
} | ||
|
||
export default function LedgerSelectDerivationPath(): ReactElement { | ||
const dispatch = useBackgroundDispatch() | ||
const { t } = useTranslation("translation", { | ||
keyPrefix: "ledger.onboarding.prepare", | ||
}) | ||
|
||
const onDerivationPathChange = (path: string) => { | ||
if (!path.includes("x")) { | ||
dispatch(derivationPathChange(path.slice(2))) | ||
dispatch(setSelectedNetwork(DERIVATION_PATH_TO_NETWORK[path])) | ||
} | ||
} | ||
|
||
return ( | ||
<> | ||
<div className="derivation_path_heading">{t("derivationPath")}</div> | ||
<div className="derivation_path"> | ||
<SelectDerivationPath onChange={onDerivationPathChange} /> | ||
</div> | ||
<style jsx>{` | ||
.derivation_path { | ||
margin: 0.5rem 0; | ||
padding: 1rem 1.5rem; | ||
border-radius: 4px; | ||
background: var(--hunter-green); | ||
} | ||
.derivation_path_heading { | ||
margin: 0.25rem; | ||
font-size: 16px; | ||
line-height: 24px; | ||
text-align: center; | ||
color: var(--green-40); | ||
} | ||
`}</style> | ||
</> | ||
) | ||
} |