Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix derivation path #544

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 src/hooks/useLedger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const useLedger = () => {

const getLedgerAccounts = useCallback(
async (solana: AppSolana, accounts: LedgerAccount[]): Promise<void> => {
let index = 0
let index = -1
const prevAcct = last(accounts)
if (prevAcct) {
index = prevAcct.accountIndex + 1
Expand Down
7 changes: 6 additions & 1 deletion src/utils/heliumLedger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ import AppSolana from '@ledgerhq/hw-app-solana'
import TransportBLE from '@ledgerhq/react-native-hw-transport-ble'
import TransportHID from '@ledgerhq/react-native-hid'

const mainNetDerivation = (account = 0) => `44'/501'/${account}'` // HD derivation path
const mainNetDerivation = (account = -1) => {
if (account === -1) {
return "44'/501'" // main derivation path
}
return `44'/501'/${account}'` // sub derivation path
}

// Replaces the account alias with the index from the ledger
export const runDerivationScheme = (account = 0) => {
Expand Down
Loading