Skip to content

Commit

Permalink
Merge pull request tahowallet#1102 from kimpers/kim/feat/support-lega…
Browse files Browse the repository at this point in the history
…cy-derivation

feat: Support Legacy (MEW/MyCrypto) Ledger HW wallet derivation path
  • Loading branch information
Balint Ferencz authored Mar 16, 2022
2 parents 27adfa1 + cd4933d commit c769dd9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
12 changes: 7 additions & 5 deletions ui/components/Onboarding/OnboardingDerivationPathSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,10 @@ import React, {
import SharedButton from "../Shared/SharedButton"
import SharedInput from "../Shared/SharedInput"
import SharedModal from "../Shared/SharedModal"
import SharedSelect from "../Shared/SharedSelect"
import SharedSelect, { Option } from "../Shared/SharedSelect"

// TODO make this network specific
const initialDerivationPaths: {
value: string
label: string
}[] = [
const initialDerivationPaths: Option[] = [
{
value: "m/44'/60'/x'/0/0",
label: "Ledger Live",
Expand All @@ -31,6 +28,11 @@ const initialDerivationPaths: {
value: "m/44'/61'/0'/0",
label: "Trezor",
},
{
value: "m/44'/60'/0'",
label: "Ledger Legacy",
hideActiveValue: true,
},
{
value: "m/44'/137'/0'/0",
label: "RSK",
Expand Down
5 changes: 3 additions & 2 deletions ui/components/Shared/SharedSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import classNames from "classnames"

import { useOnClickOutside } from "../../hooks"

type Option = { value: string; label: string }
export type Option = { value: string; label: string; hideActiveValue?: boolean }

type Props = {
options: Option[] | string[]
Expand Down Expand Up @@ -65,6 +65,7 @@ export default function SharedSelect(props: Props): ReactElement {
: null
const currentLabel = currentOption?.label ?? null
const currentValue = currentOption?.value ?? null
const currentHideActiveValue = currentOption?.hideActiveValue ?? false

useEffect(() => {
if (currentValue) onChange(currentValue)
Expand Down Expand Up @@ -98,7 +99,7 @@ export default function SharedSelect(props: Props): ReactElement {
tabIndex={0}
>
<span>
{showValue && activeIndex
{showValue && activeIndex && !currentHideActiveValue
? `${currentLabel} - ${currentValue}`
: `${currentLabel}`}
</span>
Expand Down

0 comments on commit c769dd9

Please sign in to comment.