Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
implementCountervalues({
storeSelector: state => state.countervalues,
pairsSelector: () => [],
setExchangePairsAction: () => {},
})
setErrorRemapping(e => {
// NB ideally we should solve it in ledgerjs
if (e && e.message && e.message.indexOf('HID') >= 0) {
return throwError(new DisconnectedDevice(e.message))
}
return throwError(e)
})
if (getEnv('DEVICE_PROXY_URL')) {
const Tr = TransportHttp(getEnv('DEVICE_PROXY_URL').split('|'))
registerTransportModule({
id: 'proxy',
open: () => retry(() => Tr.create(3000, 5000)),
disconnect: () => Promise.resolve(),
})
} else {
registerTransportModule({
id: 'hid',
open: devicePath =>
retry(
() =>
getEnv('EXPERIMENTAL_USB')
? TransportNodeHidSingleton.open()
: TransportNodeHid.open(devicePath),
{ maxRetry: 4 },
implementCountervalues({
storeSelector: state => state.countervalues,
pairsSelector: () => [],
setExchangePairsAction: () => {},
})
setErrorRemapping(e => {
// NB ideally we should solve it in ledgerjs
if (e && e.message && e.message.indexOf('HID') >= 0) {
return throwError(new DisconnectedDevice(e.message))
}
return throwError(e)
})
if (getEnv('DEVICE_PROXY_URL')) {
const Tr = TransportHttp(getEnv('DEVICE_PROXY_URL').split('|'))
registerTransportModule({
id: 'proxy',
open: () => retry(() => Tr.create(3000, 5000)),
disconnect: () => Promise.resolve(),
})
} else {
registerTransportModule({
id: 'hid',
open: devicePath =>
retry(
() =>
getEnv('EXPERIMENTAL_USB')
? TransportNodeHidSingleton.open()
: TransportNodeHid.open(devicePath),
export const getCurrencyBridge = (currency: CryptoCurrency): CurrencyBridge => {
if (getEnv('MOCK')) return mockCurrencyBridge
switch (currency.family) {
case 'ripple':
return RippleJSBridge.currencyBridge
case 'ethereum':
if (libcoreNoGo.includes(currency.id)) {
return EthereumJSBridge.currencyBridge
}
return LibcoreBridge.currencyBridge
case 'bitcoin':
return LibcoreBridge.currencyBridge
default:
return mockCurrencyBridge // fallback mock until we implement it all!
}
}
() => getEnv('HIDE_EMPTY_TOKEN_ACCOUNTS'), // The result of this func is not used but it allows the input params to be different so that reselect recompute the output
(accounts, ids) => flattenFilterAndSort(accounts, ids, { enforceHideEmptySubAccounts: true }),
getAPIBaseURL: () => getEnv('LEDGER_COUNTERVALUES_API'),
storeSelector: state => state.countervalues,
export const getLanguages = () =>
getEnv('EXPERIMENTAL_LANGUAGES') ? allLanguages : prodStableLanguages
countervalueFirst: false,
hasPassword: false,
autoLockTimeout: 10,
selectedTimeRange: 'month',
marketIndicator: 'western',
currenciesSettings: {},
pairExchanges: {},
developerMode: !!process.env.__DEV__,
loaded: false,
shareAnalytics: true,
sentryLogs: true,
lastUsedVersion: __APP_VERSION__,
dismissedBanners: [],
accountsViewMode: 'list',
showAccountsHelperBanner: true,
hideEmptyTokenAccounts: getEnv('HIDE_EMPTY_TOKEN_ACCOUNTS'),
sidebarCollapsed: false,
}
const pairHash = (from, to) => `${from.ticker}_${to.ticker}`
const handlers: Object = {
SETTINGS_SET_PAIRS: (
state: SettingsState,
{
pairs,
}: {
pairs: Array<{
from: Currency,
to: Currency,
exchange: string,
}>,
async fetchAppList() {
const { deviceInfo } = this.props
try {
const filteredAppVersionsList = await manager.getAppsList(
deviceInfo,
getEnv('MANAGER_DEV_MODE'),
() => currenciesByMarketcap(listCryptoCurrencies()),
)
const eth = filteredAppVersionsList.find(c => c.name === 'Ethereum')
if (!this._unmounted) {
this.setState({
status: 'idle',
filteredAppVersionsList,
appsLoaded: true,
eth,
})
}
} catch (err) {
this.setState({ status: 'error', error: err })
}
export const getManagerPageRoute = () =>
getEnv('EXPERIMENTAL_MANAGER') ? '/managerv2' : '/manager'