Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public getInstance(bitgo: BitGo, name: string): BaseCoin {
let staticsCoin;
try {
staticsCoin = coins.get(name);
} catch (e) {
if (!(e instanceof CoinNotDefinedError)) {
throw e;
}
}
const constructor = this.coinConstructors.get(name);
if (constructor) {
return constructor(bitgo, staticsCoin);
}
const ethConstructor = this.coinConstructors.get('eth');
if (ethConstructor) {
const ethCoin = ethConstructor(bitgo, staticsCoin);
if (ethCoin.isValidAddress(name)) {
const unknownTokenConstructor = Token.createTokenConstructor({