Changeset View
Changeset View
Standalone View
Standalone View
cashtab/src/components/Common/WalletLabel.js
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | const WalletOption = styled.option` | ||||
background-color: ${props => props.theme.walletInfoContainer}; | background-color: ${props => props.theme.walletInfoContainer}; | ||||
:hover { | :hover { | ||||
color: ${props => props.theme.eCashPurple}; | color: ${props => props.theme.eCashPurple}; | ||||
background-color: ${props => props.theme.walletInfoContainer}; | background-color: ${props => props.theme.walletInfoContainer}; | ||||
} | } | ||||
`; | `; | ||||
const WalletLabel = ({ wallets, settings, updateCashtabState }) => { | const WalletLabel = ({ wallets, settings, updateCashtabState }) => { | ||||
const address = wallets[0].paths.find( | const address = wallets[0].paths.get(1899).address; | ||||
pathInfo => pathInfo.path === 1899, | |||||
).address; | |||||
const handleSelectWallet = e => { | const handleSelectWallet = e => { | ||||
const walletName = e.target.value; | const walletName = e.target.value; | ||||
// Get the active wallet by name | // Get the active wallet by name | ||||
const walletToActivate = wallets.find( | const walletToActivate = wallets.find( | ||||
wallet => wallet.name === e.target.value, | wallet => wallet.name === e.target.value, | ||||
); | ); | ||||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | const WalletLabel = ({ wallets, settings, updateCashtabState }) => { | ||||
); | ); | ||||
}; | }; | ||||
WalletLabel.propTypes = { | WalletLabel.propTypes = { | ||||
wallets: PropTypes.arrayOf( | wallets: PropTypes.arrayOf( | ||||
PropTypes.shape({ | PropTypes.shape({ | ||||
mnemonic: PropTypes.string, | mnemonic: PropTypes.string, | ||||
name: PropTypes.string, | name: PropTypes.string, | ||||
paths: PropTypes.arrayOf( | paths: PropTypes.instanceOf(Map), | ||||
PropTypes.shape({ | |||||
address: PropTypes.string, | |||||
hash: PropTypes.string, | |||||
path: PropTypes.number, | |||||
wif: PropTypes.string, | |||||
}), | |||||
), | |||||
state: PropTypes.shape({ | state: PropTypes.shape({ | ||||
balanceSats: PropTypes.number, | balanceSats: PropTypes.number, | ||||
nonSlpUtxos: PropTypes.array, // Tx_InNode[] | nonSlpUtxos: PropTypes.array, // Tx_InNode[] | ||||
slpUtxos: PropTypes.array, // Tx_InNode[] | slpUtxos: PropTypes.array, // Tx_InNode[] | ||||
tokens: PropTypes.array, | tokens: PropTypes.instanceOf(Map), | ||||
parsedTxHistory: PropTypes.array, | parsedTxHistory: PropTypes.array, | ||||
}), | }), | ||||
}), | }), | ||||
), | ), | ||||
settings: PropTypes.oneOfType([ | settings: PropTypes.oneOfType([ | ||||
PropTypes.shape({ | PropTypes.shape({ | ||||
fiatCurrency: PropTypes.string, | fiatCurrency: PropTypes.string, | ||||
sendModal: PropTypes.bool, | sendModal: PropTypes.bool, | ||||
Show All 10 Lines |