2020-12-20 16:36:36 +01:00
|
|
|
import config from '../../config';
|
|
|
|
import { AbstractBitcoinApi } from './bitcoin-api-abstract-factory';
|
2020-12-27 22:47:22 +01:00
|
|
|
import EsploraApi from './esplora-api';
|
|
|
|
import BitcoinApi from './bitcoin-api';
|
|
|
|
import ElectrumApi from './electrum-api';
|
2020-12-20 16:36:36 +01:00
|
|
|
|
|
|
|
function bitcoinApiFactory(): AbstractBitcoinApi {
|
|
|
|
switch (config.MEMPOOL.BACKEND) {
|
2020-12-27 22:47:22 +01:00
|
|
|
case 'esplora':
|
|
|
|
return new EsploraApi();
|
|
|
|
case 'electrum':
|
|
|
|
return new ElectrumApi();
|
|
|
|
case 'none':
|
2020-12-20 16:36:36 +01:00
|
|
|
default:
|
2020-12-27 22:47:22 +01:00
|
|
|
return new BitcoinApi();
|
2020-12-20 16:36:36 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default bitcoinApiFactory();
|