chore: add getAccountType util
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
// you can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import { BraveWallet, WalletAccountType } from '../constants/types'
|
||||
import { AccountInfo, BraveWallet, WalletAccountType } from '../constants/types'
|
||||
|
||||
export const sortAccountsByName = (accounts: WalletAccountType[]) => {
|
||||
return [...accounts].sort(function (a: WalletAccountType, b: WalletAccountType) {
|
||||
@@ -37,3 +37,10 @@ export const findAccountName = (accounts: WalletAccountType[], address: string)
|
||||
export const createTokenBalanceRegistryKey = (token: BraveWallet.BlockchainToken) => {
|
||||
return token.isErc721 ? `${token.contractAddress.toLowerCase()}#${token.tokenId}` : token.contractAddress.toLowerCase()
|
||||
}
|
||||
|
||||
export const getAccountType = (info: AccountInfo) => {
|
||||
if (info.hardware) {
|
||||
return info.hardware.vendor
|
||||
}
|
||||
return info.isImported ? 'Secondary' : 'Primary'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user