@mempool/mempool.js
Advanced tools
Comparing version 2.2.2 to 2.2.3
@@ -107,2 +107,13 @@ "use strict"; | ||
}); }; | ||
var getBlockHeader = function (params) { return __awaiter(void 0, void 0, void 0, function () { | ||
var data; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, api.get("/block/" + params.hash + "/header")]; | ||
case 1: | ||
data = (_a.sent()).data; | ||
return [2 /*return*/, data]; | ||
} | ||
}); | ||
}); }; | ||
var getBlockHeight = function (params) { return __awaiter(void 0, void 0, void 0, function () { | ||
@@ -160,2 +171,3 @@ var data; | ||
getBlockRaw: getBlockRaw, | ||
getBlockHeader: getBlockHeader, | ||
getBlockHeight: getBlockHeight, | ||
@@ -162,0 +174,0 @@ getBlocksTipHash: getBlocksTipHash, |
import { AxiosInstance } from 'axios'; | ||
import { BlockInstance } from '../../interfaces/bitcoin/blocks'; | ||
export declare const useBlocks: (api: AxiosInstance) => BlockInstance; | ||
import { BlockLiquidInstance } from '../../interfaces/liquid/block'; | ||
export declare const useBlocks: (api: AxiosInstance) => BlockLiquidInstance; |
@@ -5,2 +5,3 @@ "use strict"; | ||
var blocks_1 = require("./app/bitcoin/blocks"); | ||
var difficulty_1 = require("./app/bitcoin/difficulty"); | ||
var fees_1 = require("./app/bitcoin/fees"); | ||
@@ -39,2 +40,3 @@ var mempool_1 = require("./app/bitcoin/mempool"); | ||
blocks: blocks_1.useBlocks(apiBitcoin), | ||
difficulty: difficulty_1.useDifficulty(apiBitcoin), | ||
fees: fees_1.useFees(apiBitcoin), | ||
@@ -41,0 +43,0 @@ mempool: mempool_1.useMempool(apiBitcoin), |
@@ -46,2 +46,5 @@ import { Tx } from './transactions'; | ||
}) => Promise<string>; | ||
getBlockHeader: (params: { | ||
hash: string; | ||
}) => Promise<string>; | ||
getBlockHeight: (params: { | ||
@@ -48,0 +51,0 @@ height: number; |
import { AddressInstance } from './bitcoin/addresses'; | ||
import { BlockInstance } from './bitcoin/blocks'; | ||
import { DifficultyInstance } from './bitcoin/difficulty'; | ||
import { FeeInstance } from './bitcoin/fees'; | ||
@@ -12,2 +13,3 @@ import { MempoolInstance } from './bitcoin/mempool'; | ||
import { AssetsInstance } from './liquid/assets'; | ||
import { BlockLiquidInstance } from './liquid/block'; | ||
export interface MempoolConfig { | ||
@@ -21,2 +23,3 @@ hostname?: string; | ||
blocks: BlockInstance; | ||
difficulty: DifficultyInstance; | ||
fees: FeeInstance; | ||
@@ -36,3 +39,3 @@ mempool: MempoolInstance; | ||
addresses: AddressInstance; | ||
blocks: BlockInstance; | ||
blocks: BlockLiquidInstance; | ||
fees: FeeInstance; | ||
@@ -39,0 +42,0 @@ mempool: MempoolInstance; |
@@ -16,2 +16,10 @@ "use strict"; | ||
} | ||
if (hostname === null || hostname === void 0 ? void 0 : hostname.includes("localhost")) { | ||
var api_1 = axios_1.default.create({ | ||
baseURL: "http://" + hostname + network + "/api/", | ||
}); | ||
return { | ||
api: api_1, | ||
}; | ||
} | ||
var api = axios_1.default.create({ | ||
@@ -26,2 +34,10 @@ baseURL: "https://" + hostname + network + "/api/", | ||
var makeBisqAPI = function (hostname) { | ||
if (hostname === null || hostname === void 0 ? void 0 : hostname.includes("localhost")) { | ||
var api_2 = axios_1.default.create({ | ||
baseURL: "http://" + hostname + "/bisq/api/", | ||
}); | ||
return { | ||
api: api_2, | ||
}; | ||
} | ||
var api = axios_1.default.create({ | ||
@@ -36,2 +52,10 @@ baseURL: "https://" + hostname + "/bisq/api/", | ||
var makeLiquidAPI = function (hostname) { | ||
if (hostname === null || hostname === void 0 ? void 0 : hostname.includes("localhost")) { | ||
var api_3 = axios_1.default.create({ | ||
baseURL: "http://" + hostname + "/liquid/api/", | ||
}); | ||
return { | ||
api: api_3, | ||
}; | ||
} | ||
var api = axios_1.default.create({ | ||
@@ -38,0 +62,0 @@ baseURL: "https://" + hostname + "/liquid/api/", |
{ | ||
"name": "@mempool/mempool.js", | ||
"version": "2.2.2", | ||
"version": "2.2.3", | ||
"description": "NPM package module for Mempool APIs.", | ||
@@ -34,4 +34,5 @@ "main": "lib/index.js", | ||
"dev": "nodemon src/index.ts", | ||
"build": "tsc | browserify lib/index.js --standalone mempoolJS > dist/mempool.js | browserify -p tinyify lib/index.js --standalone mempoolJS > dist/mempool.min.js", | ||
"build-tsc": "tsc", | ||
"examples-nodemon": "nodemon --watch 'examples/nodejs/**' --ext 'ts,json' --ignore 'src/**/*.spec.ts' --exec 'ts-node examples/nodejs/index.ts'", | ||
"build": "tsc", | ||
"export-js": "tsc | browserify lib/index.js --standalone mempoolJS > dist/mempool.js | browserify -p tinyify lib/index.js --standalone mempoolJS > dist/mempool.min.js", | ||
"prepare": "npm run build", | ||
@@ -38,0 +39,0 @@ "postversion": "git push && git push --tags" |
@@ -10,3 +10,3 @@ # Mempool JS API | ||
Documentation: [https://mempool.tools/mempoolJS](https://mempool.tools/mempoolJS) | ||
Documentation: [https://mempool.space/api](https://mempool.space/api) | ||
@@ -74,2 +74,3 @@ --- | ||
- [Blocks](./README-bitcoin.md#get-blocks) | ||
- [Difficulty Adjustment](./README-bitcoin.md#get-difficulty-adjustment) | ||
- [Fees](./README-bitcoin.md#get-fees) | ||
@@ -76,0 +77,0 @@ - [Mempool](./README-bitcoin.md#get-mempool) |
113508
75
2437
103