-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(wallet): Add main badge to accounts with the
0/0/0
derivation …
…path (#2664) * feat(explorer): bip path main label. Signed-off-by: Eugene Panteleymonchuk <[email protected]> * feat(explorer): add badge "main" to manage accounts. Signed-off-by: Eugene Panteleymonchuk <[email protected]> * feat(explorer): update badgeConfig variable; Signed-off-by: Eugene Panteleymonchuk <[email protected]> --------- Signed-off-by: Eugene Panteleymonchuk <[email protected]> Co-authored-by: Bran <[email protected]> Co-authored-by: Begoña Álvarez de la Cruz <[email protected]>
- Loading branch information
1 parent
0220d2b
commit 7321872
Showing
4 changed files
with
70 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { isLedgerAccountSerializedUI } from '_src/background/accounts/LedgerAccount'; | ||
import { isMnemonicSerializedUiAccount } from '_src/background/accounts/MnemonicAccount'; | ||
import { isSeedSerializedUiAccount } from '_src/background/accounts/SeedAccount'; | ||
import { parseDerivationPath } from '_src/background/account-sources/bip44Path'; | ||
import type { SerializedUIAccount } from '_src/background/accounts/Account'; | ||
|
||
export function isMainAccount(account: SerializedUIAccount | null) { | ||
{ | ||
if (!account) { | ||
return false; | ||
} | ||
|
||
if ( | ||
isLedgerAccountSerializedUI(account) || | ||
isMnemonicSerializedUiAccount(account) || | ||
isSeedSerializedUiAccount(account) | ||
) { | ||
const { addressIndex, changeIndex, accountIndex } = parseDerivationPath( | ||
account.derivationPath, | ||
); | ||
|
||
return addressIndex === 0 && changeIndex === 0 && accountIndex === 0; | ||
} | ||
} | ||
} |
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