2021-04-14 17:27:28 -03:00
|
|
|
import { MempoolConfig, MempoolReturn } from './interfaces/index';
|
|
|
|
|
import {
|
|
|
|
|
makeBitcoinAPI,
|
|
|
|
|
makeBisqAPI,
|
|
|
|
|
makeLiquidAPI,
|
|
|
|
|
} from './services/api/index';
|
2021-02-08 16:54:37 -03:00
|
|
|
|
2021-04-14 17:27:28 -03:00
|
|
|
import { useAddresses } from './app/bitcoin/addresses';
|
|
|
|
|
import { useBlocks } from './app/bitcoin/blocks';
|
|
|
|
|
import { useFees } from './app/bitcoin/fees';
|
|
|
|
|
import { useMempool } from './app/bitcoin/mempool';
|
|
|
|
|
import { useTransactions } from './app/bitcoin/transactions';
|
|
|
|
|
import { useWebsocket } from './app/bitcoin/websocket';
|
2021-02-08 16:54:37 -03:00
|
|
|
|
2021-04-14 17:27:28 -03:00
|
|
|
import { useAddresses as useAddressesBisq } from './app/bisq/addresses';
|
|
|
|
|
import { useBlocks as useBlocksBisq } from './app/bisq/blocks';
|
|
|
|
|
import { useStatistics as useStatisticsBisq } from './app/bisq/statistics';
|
|
|
|
|
import { useTransactions as useTransactionsBisq } from './app/bisq/transactions';
|
|
|
|
|
|
|
|
|
|
import { useAssets as useAssetsLiquid } from './app/liquid/assets';
|
|
|
|
|
import { useAddresses as useAddressesLiquid } from './app/liquid/addresses';
|
|
|
|
|
import { useBlocks as useBlocksLiquid } from './app/liquid/blocks';
|
|
|
|
|
import { useFees as useFeesLiquid } from './app/liquid/fees';
|
|
|
|
|
import { useMempool as useMempoolLiquid } from './app/liquid/mempool';
|
|
|
|
|
import { useTransactions as useTransactionsLiquid } from './app/liquid/transactions';
|
|
|
|
|
import { useWebsocket as useWebsocketLiquid } from './app/liquid/websocket';
|
|
|
|
|
|
|
|
|
|
const hostnameEndpointDefault = 'mempool.space';
|
|
|
|
|
const networkEndpointDefault = 'main';
|
2021-04-08 10:15:30 -03:00
|
|
|
|
|
|
|
|
const mempool = (
|
2021-04-14 17:27:28 -03:00
|
|
|
{ hostname, network }: MempoolConfig = {
|
|
|
|
|
hostname: hostnameEndpointDefault,
|
|
|
|
|
network: networkEndpointDefault,
|
2021-04-08 10:15:30 -03:00
|
|
|
}
|
|
|
|
|
): MempoolReturn => {
|
2021-04-14 17:27:28 -03:00
|
|
|
if (!hostname) hostname = hostnameEndpointDefault;
|
|
|
|
|
if (!network) network = networkEndpointDefault;
|
|
|
|
|
|
|
|
|
|
const { api: apiBitcoin } = makeBitcoinAPI({ hostname, network });
|
|
|
|
|
const { api: apiBisq } = makeBisqAPI(hostname);
|
|
|
|
|
const { api: apiLiquid } = makeLiquidAPI(hostname);
|
2021-04-08 10:15:30 -03:00
|
|
|
|
|
|
|
|
return {
|
2021-04-14 17:27:28 -03:00
|
|
|
bitcoin: {
|
|
|
|
|
addresses: useAddresses(apiBitcoin),
|
|
|
|
|
blocks: useBlocks(apiBitcoin),
|
|
|
|
|
fees: useFees(apiBitcoin),
|
|
|
|
|
mempool: useMempool(apiBitcoin),
|
|
|
|
|
transactions: useTransactions(apiBitcoin),
|
|
|
|
|
websocket: useWebsocket(hostname),
|
|
|
|
|
},
|
|
|
|
|
bisq: {
|
|
|
|
|
statistics: useStatisticsBisq(apiBisq),
|
|
|
|
|
addresses: useAddressesBisq(apiBisq),
|
|
|
|
|
blocks: useBlocksBisq(apiBisq),
|
|
|
|
|
transactions: useTransactionsBisq(apiBisq),
|
|
|
|
|
},
|
|
|
|
|
liquid: {
|
|
|
|
|
addresses: useAddressesLiquid(apiLiquid),
|
|
|
|
|
assets: useAssetsLiquid(apiLiquid),
|
|
|
|
|
blocks: useBlocksLiquid(apiLiquid),
|
|
|
|
|
fees: useFeesLiquid(apiLiquid),
|
|
|
|
|
mempool: useMempoolLiquid(apiLiquid),
|
|
|
|
|
transactions: useTransactionsLiquid(apiLiquid),
|
|
|
|
|
websocket: useWebsocketLiquid(hostname),
|
|
|
|
|
},
|
2021-04-08 10:15:30 -03:00
|
|
|
};
|
2021-02-08 16:54:37 -03:00
|
|
|
};
|
2021-04-08 10:15:30 -03:00
|
|
|
|
|
|
|
|
mempool.default = mempool;
|
|
|
|
|
export = mempool;
|