@mempool/mempool.js
Advanced tools
Comparing version 2.2.0 to 2.2.1
import { AxiosInstance } from 'axios'; | ||
import { AddressesInstance } from '../../interfaces/bisq/addresses'; | ||
export declare const useAddresses: (api: AxiosInstance) => AddressesInstance; |
@@ -0,0 +0,0 @@ "use strict"; |
import { AxiosInstance } from 'axios'; | ||
import { BlocksInstance } from '../../interfaces/bisq/blocks'; | ||
export declare const useBlocks: (api: AxiosInstance) => BlocksInstance; |
@@ -0,0 +0,0 @@ "use strict"; |
import { AxiosInstance } from 'axios'; | ||
import { StatsInstance } from '../../interfaces/bisq/statistics'; | ||
export declare const useStatistics: (api: AxiosInstance) => StatsInstance; |
@@ -0,0 +0,0 @@ "use strict"; |
import { AxiosInstance } from 'axios'; | ||
import { TransactionsInstance } from '../../interfaces/bisq/transactions'; | ||
export declare const useTransactions: (api: AxiosInstance) => TransactionsInstance; |
@@ -0,0 +0,0 @@ "use strict"; |
import { AxiosInstance } from 'axios'; | ||
import { AddressInstance } from '../../interfaces/bitcoin/addresses'; | ||
export declare const useAddresses: (api: AxiosInstance) => AddressInstance; |
@@ -0,0 +0,0 @@ "use strict"; |
import { AxiosInstance } from 'axios'; | ||
import { BlockInstance } from '../../interfaces/bitcoin/blocks'; | ||
export declare const useBlocks: (api: AxiosInstance) => BlockInstance; |
@@ -0,0 +0,0 @@ "use strict"; |
import { AxiosInstance } from 'axios'; | ||
import { FeeInstance } from '../../interfaces/bitcoin/fees'; | ||
export declare const useFees: (api: AxiosInstance) => FeeInstance; |
@@ -0,0 +0,0 @@ "use strict"; |
import { AxiosInstance } from 'axios'; | ||
import { MempoolInstance } from '../../interfaces/bitcoin/mempool'; | ||
export declare const useMempool: (api: AxiosInstance) => MempoolInstance; |
@@ -0,0 +0,0 @@ "use strict"; |
import { AxiosInstance } from 'axios'; | ||
import { TxInstance } from '../../interfaces/bitcoin/transactions'; | ||
export declare const useTransactions: (api: AxiosInstance) => TxInstance; |
@@ -0,0 +0,0 @@ "use strict"; |
import { WsInstance } from '../../interfaces/bitcoin/websockets'; | ||
export declare const useWebsocket: (hostname?: string | undefined) => WsInstance; | ||
export declare const useWebsocket: (hostname: string) => WsInstance; |
@@ -9,12 +9,12 @@ "use strict"; | ||
var server_1 = __importDefault(require("../../services/ws/server")); | ||
var defaultWs = 'wss://mempool.space/api/v1/ws'; | ||
var useWebsocket = function (hostname) { | ||
var wsEndpoint = "wss://" + hostname + "/api/v1/ws"; | ||
return { | ||
initClient: function (_a) { | ||
var options = _a.options; | ||
return client_1.default(options, defaultWs, hostname); | ||
return client_1.default(options, wsEndpoint); | ||
}, | ||
initServer: function (_a) { | ||
var options = _a.options; | ||
return server_1.default(options, defaultWs, hostname); | ||
return server_1.default(options, wsEndpoint); | ||
}, | ||
@@ -21,0 +21,0 @@ }; |
import { AxiosInstance } from 'axios'; | ||
import { AddressInstance } from '../../interfaces/bitcoin/addresses'; | ||
export declare const useAddresses: (api: AxiosInstance) => AddressInstance; |
@@ -0,0 +0,0 @@ "use strict"; |
import { AxiosInstance } from 'axios'; | ||
import { AssetsInstance } from '../../interfaces/liquid/assets'; | ||
export declare const useAssets: (api: AxiosInstance) => AssetsInstance; |
@@ -0,0 +0,0 @@ "use strict"; |
import { AxiosInstance } from 'axios'; | ||
import { BlockInstance } from '../../interfaces/bitcoin/blocks'; | ||
export declare const useBlocks: (api: AxiosInstance) => BlockInstance; |
@@ -0,0 +0,0 @@ "use strict"; |
import { AxiosInstance } from 'axios'; | ||
import { FeeInstance } from '../../interfaces/bitcoin/fees'; | ||
export declare const useFees: (api: AxiosInstance) => FeeInstance; |
@@ -0,0 +0,0 @@ "use strict"; |
import { AxiosInstance } from 'axios'; | ||
import { MempoolInstance } from '../../interfaces/bitcoin/mempool'; | ||
export declare const useMempool: (api: AxiosInstance) => MempoolInstance; |
@@ -0,0 +0,0 @@ "use strict"; |
import { AxiosInstance } from 'axios'; | ||
import { TxInstance } from '../../interfaces/bitcoin/transactions'; | ||
export declare const useTransactions: (api: AxiosInstance) => TxInstance; |
@@ -0,0 +0,0 @@ "use strict"; |
import { WsInstance } from '../../interfaces/bitcoin/websockets'; | ||
export declare const useWebsocket: (hostname?: string | undefined) => WsInstance; | ||
export declare const useWebsocket: (hostname: string) => WsInstance; |
@@ -9,12 +9,12 @@ "use strict"; | ||
var server_1 = __importDefault(require("../../services/ws/server")); | ||
var defaultWs = 'wss://mempool.space/liquid/api/v1/ws'; | ||
var useWebsocket = function (hostname) { | ||
var wsEndpoint = "wss://" + hostname + "/liquid/api/v1/ws"; | ||
return { | ||
initClient: function (_a) { | ||
var options = _a.options; | ||
return client_1.default(options, defaultWs, hostname); | ||
return client_1.default(options, wsEndpoint); | ||
}, | ||
initServer: function (_a) { | ||
var options = _a.options; | ||
return server_1.default(options, defaultWs, hostname); | ||
return server_1.default(options, wsEndpoint); | ||
}, | ||
@@ -21,0 +21,0 @@ }; |
@@ -0,0 +0,0 @@ import { MempoolConfig, MempoolReturn } from './interfaces/index'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { Tx } from './transactions'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -0,0 +0,0 @@ import { Tx } from './transactions'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -0,0 +0,0 @@ export interface Stats { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -0,0 +0,0 @@ export interface Tx { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -0,0 +0,0 @@ import { Tx, TxStatus } from './transactions'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -0,0 +0,0 @@ import { Tx } from './transactions'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -0,0 +0,0 @@ export interface FeesMempoolBlocks { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -0,0 +0,0 @@ export interface Mempool { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -0,0 +0,0 @@ export interface Tx { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -0,0 +0,0 @@ export interface WsInterface { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -0,0 +0,0 @@ import { AddressInstance } from './bitcoin/addresses'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -0,0 +0,0 @@ export interface Asset { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -0,0 +0,0 @@ import { AxiosInstance } from 'axios'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -1,2 +0,2 @@ | ||
declare const browserWS: (options: string[], defaultWs: string, websocketEndpoint?: string | undefined) => WebSocket; | ||
export default browserWS; | ||
declare const serverWS: (options: string[], endpoint: string) => WebSocket; | ||
export default serverWS; |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var browserWS = function (options, defaultWs, websocketEndpoint) { | ||
var ws = new WebSocket(websocketEndpoint || defaultWs); | ||
ws.addEventListener('open', function open() { | ||
handleMessage(ws, options); | ||
var serverWS = function (options, endpoint) { | ||
var ws = new WebSocket(endpoint); | ||
ws.addEventListener("open", function open() { | ||
ws.send(JSON.stringify({ action: "want", data: options })); | ||
}); | ||
ws.addEventListener("close", function close() { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, sleep(60000)]; | ||
case 1: | ||
_a.sent(); | ||
serverWS(options, endpoint); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}); | ||
return ws; | ||
}; | ||
var handleMessage = function (ws, options) { | ||
ws.send(JSON.stringify({ action: 'init' })); | ||
ws.send(JSON.stringify({ | ||
action: 'want', | ||
data: options, | ||
})); | ||
var sleep = function (ms) { | ||
return new Promise(function (resolve) { | ||
setTimeout(resolve, ms); | ||
}); | ||
}; | ||
exports.default = browserWS; | ||
exports.default = serverWS; |
import WebSocket from 'ws'; | ||
declare const serverWS: (options: string[], defaultWs: string, websocketEndpoint?: string | undefined) => WebSocket; | ||
declare const serverWS: (options: string[], endpoint: string) => WebSocket; | ||
export default serverWS; |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -7,16 +43,33 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
var ws_1 = __importDefault(require("ws")); | ||
var serverWS = function (options, defaultWs, websocketEndpoint) { | ||
var ws = new ws_1.default(websocketEndpoint || defaultWs); | ||
ws.on('open', function open() { | ||
handleMessage(ws, options); | ||
var serverWS = function (options, endpoint) { | ||
var ws = new ws_1.default(endpoint); | ||
var interval = setInterval(function ping() { | ||
ws.ping(); | ||
}, 30000); | ||
ws.on("open", function open() { | ||
ws.send(JSON.stringify({ action: "want", data: options })); | ||
}); | ||
ws.on("close", function close() { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
clearInterval(interval); | ||
ws.terminate(); | ||
return [4 /*yield*/, sleep(60000)]; | ||
case 1: | ||
_a.sent(); | ||
serverWS(options, endpoint); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}); | ||
return ws; | ||
}; | ||
var handleMessage = function (ws, options) { | ||
ws.send(JSON.stringify({ action: 'init' })); | ||
ws.send(JSON.stringify({ | ||
action: 'want', | ||
data: options, | ||
})); | ||
var sleep = function (ms) { | ||
return new Promise(function (resolve) { | ||
setTimeout(resolve, ms); | ||
}); | ||
}; | ||
exports.default = serverWS; |
{ | ||
"name": "@mempool/mempool.js", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "NPM package module for Mempool APIs.", | ||
@@ -19,2 +19,3 @@ "main": "lib/index.js", | ||
"mempool", | ||
"websocket", | ||
"nodejs", | ||
@@ -35,2 +36,3 @@ "typescript" | ||
"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", | ||
"prepare": "npm run build", | ||
@@ -56,2 +58,3 @@ "postversion": "git push && git push --tags" | ||
"tinyify": "^3.0.0", | ||
"ts-node": "^9.1.1", | ||
"typescript": "^4.1.3" | ||
@@ -58,0 +61,0 @@ }, |
@@ -0,0 +0,0 @@ # Mempool JS API |
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
0
106414
11
69
2268