v2.3.0 (#12)
* 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:
43
src/services/api/index.ts
Normal file
43
src/services/api/index.ts
Normal 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,
|
||||
};
|
||||
Reference in New Issue
Block a user