* FIX: getBlocks optional params

* v2.3.0 - new minor version for mempool-js
- Add support for Bisq API
- Add support for Liquid API
- Change the main object to export network objects.
- Change README.md instructions.

Co-authored-by: softsimon <softsimon@users.noreply.github.com>
This commit is contained in:
Miguel Medeiros
2021-04-14 17:27:28 -03:00
committed by GitHub
parent 70d31f2062
commit c80f82a0b1
78 changed files with 3394 additions and 1160 deletions

43
src/services/api/index.ts Normal file
View File

@@ -0,0 +1,43 @@
import axios, { AxiosInstance } from 'axios';
import { MempoolConfig } from './../../interfaces/index';
export const makeBitcoinAPI = ({
hostname,
network,
}: MempoolConfig): { api: AxiosInstance } => {
if (network && ['testnet', 'signet'].includes(network)) {
network = `/${network}`;
} else {
network = '';
}
const api = axios.create({
baseURL: `https://${hostname}${network}/api/`,
});
return {
api,
};
};
export const makeBisqAPI = (hostname?: string): { api: AxiosInstance } => {
const api = axios.create({
baseURL: `https://${hostname}/bisq/api/`,
});
return {
api,
};
};
export const makeLiquidAPI = (hostname?: string): { api: AxiosInstance } => {
const api = axios.create({
baseURL: `https://${hostname}/liquid/api/`,
});
return {
api,
};
};
export default {
makeBitcoinAPI,
makeBisqAPI,
makeLiquidAPI,
};