Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function checkAccountSupported(account: Account): ?Error {
if (!getAllDerivationModes().includes(account.derivationMode)) {
return new AccountNotSupported(
"derivation not supported " + account.derivationMode,
{ reason: account.derivationMode }
);
}
if (!isCurrencySupported(account.currency)) {
return new CurrencyNotSupported("currency not supported", {
currencyName: account.currency.name
});
}
}
const createTransaction = a => {
throw new CurrencyNotSupported("tron currency not supported", {
currencyName: a.currency.name
});
};
const createTransaction = a => {
throw new CurrencyNotSupported("neo currency not supported", {
currencyName: a.currency.name
});
};
const getTransactionStatus = a =>
Promise.reject(
new CurrencyNotSupported("tron currency not supported", {
currencyName: a.currency.name
})
);
const getTransactionStatus = a =>
Promise.reject(
new CurrencyNotSupported("neo currency not supported", {
currencyName: a.currency.name
})
);
const mainAccount = account.type === 'Account' ? account : parentAccount
if (!mainAccount) throw new Error('an account expected')
const supportedError = checkAccountSupported(mainAccount)
if (supportedError) {
throw supportedError
}
const { type } = decodeAccountId(mainAccount.id)
if (type === 'mock') return mockAccountBridge
if (type === 'libcore') return LibcoreBridge.accountBridge
switch (mainAccount.currency.family) {
case 'ripple':
return RippleJSBridge.accountBridge
case 'ethereum':
return EthereumJSBridge.accountBridge
default:
throw new CurrencyNotSupported('currency not supported', {
currencyName: mainAccount.currency.name,
})
}
}