@oipwg/insight-explorer
Advanced tools
Comparing version 2.0.0-beta.0 to 2.0.1
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
var _Insight = _interopRequireDefault(require("./Insight")); | ||
module.exports = { | ||
Insight: _Insight["default"] | ||
}; |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator")); | ||
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); | ||
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator")); | ||
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _axios = _interopRequireDefault(require("axios")); | ||
module.exports = | ||
/*#__PURE__*/ | ||
function () { | ||
module.exports = /*#__PURE__*/function () { | ||
function Insight(url) { | ||
@@ -27,39 +18,29 @@ (0, _classCallCheck2["default"])(this, Insight); | ||
} | ||
(0, _createClass2["default"])(Insight, [{ | ||
key: "getBlock", | ||
value: function () { | ||
var _getBlock = (0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee(hash) { | ||
var _getBlock = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(hash) { | ||
var response; | ||
return _regenerator["default"].wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
_context.prev = 0; | ||
_context.next = 3; | ||
return this.api.get('/block/' + hash); | ||
case 3: | ||
response = _context.sent; | ||
return _context.abrupt("return", response.data); | ||
case 7: | ||
_context.prev = 7; | ||
_context.t0 = _context["catch"](0); | ||
throw this.createErrorString('getBlock', _context.t0); | ||
case 10: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
while (1) switch (_context.prev = _context.next) { | ||
case 0: | ||
_context.prev = 0; | ||
_context.next = 3; | ||
return this.api.get('/block/' + hash); | ||
case 3: | ||
response = _context.sent; | ||
return _context.abrupt("return", response.data); | ||
case 7: | ||
_context.prev = 7; | ||
_context.t0 = _context["catch"](0); | ||
throw this.createErrorString('getBlock', _context.t0); | ||
case 10: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
}, _callee, this, [[0, 7]]); | ||
})); | ||
function getBlock(_x) { | ||
return _getBlock.apply(this, arguments); | ||
} | ||
return getBlock; | ||
@@ -70,35 +51,26 @@ }() | ||
value: function () { | ||
var _getBlockIndex = (0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee2(height) { | ||
var _getBlockIndex = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(height) { | ||
var response; | ||
return _regenerator["default"].wrap(function _callee2$(_context2) { | ||
while (1) { | ||
switch (_context2.prev = _context2.next) { | ||
case 0: | ||
_context2.prev = 0; | ||
_context2.next = 3; | ||
return this.api.get('/block-index/' + height); | ||
case 3: | ||
response = _context2.sent; | ||
return _context2.abrupt("return", response.data); | ||
case 7: | ||
_context2.prev = 7; | ||
_context2.t0 = _context2["catch"](0); | ||
throw this.createErrorString('getBlockIndex', _context2.t0); | ||
case 10: | ||
case "end": | ||
return _context2.stop(); | ||
} | ||
while (1) switch (_context2.prev = _context2.next) { | ||
case 0: | ||
_context2.prev = 0; | ||
_context2.next = 3; | ||
return this.api.get('/block-index/' + height); | ||
case 3: | ||
response = _context2.sent; | ||
return _context2.abrupt("return", response.data); | ||
case 7: | ||
_context2.prev = 7; | ||
_context2.t0 = _context2["catch"](0); | ||
throw this.createErrorString('getBlockIndex', _context2.t0); | ||
case 10: | ||
case "end": | ||
return _context2.stop(); | ||
} | ||
}, _callee2, this, [[0, 7]]); | ||
})); | ||
function getBlockIndex(_x2) { | ||
return _getBlockIndex.apply(this, arguments); | ||
} | ||
return getBlockIndex; | ||
@@ -109,35 +81,26 @@ }() | ||
value: function () { | ||
var _getRawBlock = (0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee3(block) { | ||
var _getRawBlock = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(block) { | ||
var response; | ||
return _regenerator["default"].wrap(function _callee3$(_context3) { | ||
while (1) { | ||
switch (_context3.prev = _context3.next) { | ||
case 0: | ||
_context3.prev = 0; | ||
_context3.next = 3; | ||
return this.api.get('/rawblock/' + block); | ||
case 3: | ||
response = _context3.sent; | ||
return _context3.abrupt("return", response.data); | ||
case 7: | ||
_context3.prev = 7; | ||
_context3.t0 = _context3["catch"](0); | ||
throw this.createErrorString('getRawBlock', _context3.t0); | ||
case 10: | ||
case "end": | ||
return _context3.stop(); | ||
} | ||
while (1) switch (_context3.prev = _context3.next) { | ||
case 0: | ||
_context3.prev = 0; | ||
_context3.next = 3; | ||
return this.api.get('/rawblock/' + block); | ||
case 3: | ||
response = _context3.sent; | ||
return _context3.abrupt("return", response.data); | ||
case 7: | ||
_context3.prev = 7; | ||
_context3.t0 = _context3["catch"](0); | ||
throw this.createErrorString('getRawBlock', _context3.t0); | ||
case 10: | ||
case "end": | ||
return _context3.stop(); | ||
} | ||
}, _callee3, this, [[0, 7]]); | ||
})); | ||
function getRawBlock(_x3) { | ||
return _getRawBlock.apply(this, arguments); | ||
} | ||
return getRawBlock; | ||
@@ -148,48 +111,36 @@ }() | ||
value: function () { | ||
var _getBlockSummary = (0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee4(limit, blockDate) { | ||
var _getBlockSummary = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(limit, blockDate) { | ||
var reqURL, q, response; | ||
return _regenerator["default"].wrap(function _callee4$(_context4) { | ||
while (1) { | ||
switch (_context4.prev = _context4.next) { | ||
case 0: | ||
reqURL = '/blocks'; | ||
q = {}; | ||
if (limit && limit !== '') { | ||
q.limit = limit; | ||
} | ||
if (blockDate && blockDate !== '') { | ||
q.blockDate = blockDate; | ||
} | ||
_context4.prev = 4; | ||
_context4.next = 7; | ||
return this.api.get(reqURL, { | ||
params: q | ||
}); | ||
case 7: | ||
response = _context4.sent; | ||
return _context4.abrupt("return", response.data); | ||
case 11: | ||
_context4.prev = 11; | ||
_context4.t0 = _context4["catch"](4); | ||
throw this.createErrorString('getBlockSummary', _context4.t0); | ||
case 14: | ||
case "end": | ||
return _context4.stop(); | ||
} | ||
while (1) switch (_context4.prev = _context4.next) { | ||
case 0: | ||
reqURL = '/blocks'; | ||
q = {}; | ||
if (limit && limit !== '') { | ||
q.limit = limit; | ||
} | ||
if (blockDate && blockDate !== '') { | ||
q.blockDate = blockDate; | ||
} | ||
_context4.prev = 4; | ||
_context4.next = 7; | ||
return this.api.get(reqURL, { | ||
params: q | ||
}); | ||
case 7: | ||
response = _context4.sent; | ||
return _context4.abrupt("return", response.data); | ||
case 11: | ||
_context4.prev = 11; | ||
_context4.t0 = _context4["catch"](4); | ||
throw this.createErrorString('getBlockSummary', _context4.t0); | ||
case 14: | ||
case "end": | ||
return _context4.stop(); | ||
} | ||
}, _callee4, this, [[4, 11]]); | ||
})); | ||
function getBlockSummary(_x4, _x5) { | ||
return _getBlockSummary.apply(this, arguments); | ||
} | ||
return getBlockSummary; | ||
@@ -200,35 +151,26 @@ }() | ||
value: function () { | ||
var _getTransaction = (0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee5(txid) { | ||
var _getTransaction = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(txid) { | ||
var response; | ||
return _regenerator["default"].wrap(function _callee5$(_context5) { | ||
while (1) { | ||
switch (_context5.prev = _context5.next) { | ||
case 0: | ||
_context5.prev = 0; | ||
_context5.next = 3; | ||
return this.api.get('/tx/' + txid); | ||
case 3: | ||
response = _context5.sent; | ||
return _context5.abrupt("return", response.data); | ||
case 7: | ||
_context5.prev = 7; | ||
_context5.t0 = _context5["catch"](0); | ||
throw this.createErrorString('getTransaction', _context5.t0); | ||
case 10: | ||
case "end": | ||
return _context5.stop(); | ||
} | ||
while (1) switch (_context5.prev = _context5.next) { | ||
case 0: | ||
_context5.prev = 0; | ||
_context5.next = 3; | ||
return this.api.get('/tx/' + txid); | ||
case 3: | ||
response = _context5.sent; | ||
return _context5.abrupt("return", response.data); | ||
case 7: | ||
_context5.prev = 7; | ||
_context5.t0 = _context5["catch"](0); | ||
throw this.createErrorString('getTransaction', _context5.t0); | ||
case 10: | ||
case "end": | ||
return _context5.stop(); | ||
} | ||
}, _callee5, this, [[0, 7]]); | ||
})); | ||
function getTransaction(_x6) { | ||
return _getTransaction.apply(this, arguments); | ||
} | ||
return getTransaction; | ||
@@ -239,35 +181,26 @@ }() | ||
value: function () { | ||
var _getRawTransaction = (0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee6(txid) { | ||
var _getRawTransaction = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(txid) { | ||
var response; | ||
return _regenerator["default"].wrap(function _callee6$(_context6) { | ||
while (1) { | ||
switch (_context6.prev = _context6.next) { | ||
case 0: | ||
_context6.prev = 0; | ||
_context6.next = 3; | ||
return this.api.get('/rawtx/' + txid); | ||
case 3: | ||
response = _context6.sent; | ||
return _context6.abrupt("return", response.data); | ||
case 7: | ||
_context6.prev = 7; | ||
_context6.t0 = _context6["catch"](0); | ||
throw this.createErrorString('getRawTransaction', _context6.t0); | ||
case 10: | ||
case "end": | ||
return _context6.stop(); | ||
} | ||
while (1) switch (_context6.prev = _context6.next) { | ||
case 0: | ||
_context6.prev = 0; | ||
_context6.next = 3; | ||
return this.api.get('/rawtx/' + txid); | ||
case 3: | ||
response = _context6.sent; | ||
return _context6.abrupt("return", response.data); | ||
case 7: | ||
_context6.prev = 7; | ||
_context6.t0 = _context6["catch"](0); | ||
throw this.createErrorString('getRawTransaction', _context6.t0); | ||
case 10: | ||
case "end": | ||
return _context6.stop(); | ||
} | ||
}, _callee6, this, [[0, 7]]); | ||
})); | ||
function getRawTransaction(_x7) { | ||
return _getRawTransaction.apply(this, arguments); | ||
} | ||
return getRawTransaction; | ||
@@ -278,54 +211,41 @@ }() | ||
value: function () { | ||
var _getAddress = (0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee7(address, options) { | ||
var _getAddress = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(address, options) { | ||
var reqURL, q, response; | ||
return _regenerator["default"].wrap(function _callee7$(_context7) { | ||
while (1) { | ||
switch (_context7.prev = _context7.next) { | ||
case 0: | ||
reqURL = '/addr/' + address + '?'; | ||
q = {}; | ||
if (options) { | ||
if (options.noTxList) { | ||
q.noTxList = options.noTxList; | ||
} | ||
if (options.from) { | ||
q.from = options.from; | ||
} | ||
if (options.to) { | ||
q.to = options.to; | ||
} | ||
while (1) switch (_context7.prev = _context7.next) { | ||
case 0: | ||
reqURL = '/addr/' + address + '?'; | ||
q = {}; | ||
if (options) { | ||
if (options.noTxList) { | ||
q.noTxList = options.noTxList; | ||
} | ||
_context7.prev = 3; | ||
_context7.next = 6; | ||
return this.api.get(reqURL, { | ||
params: q | ||
}); | ||
case 6: | ||
response = _context7.sent; | ||
return _context7.abrupt("return", response.data); | ||
case 10: | ||
_context7.prev = 10; | ||
_context7.t0 = _context7["catch"](3); | ||
throw this.createErrorString('getAddress', _context7.t0); | ||
case 13: | ||
case "end": | ||
return _context7.stop(); | ||
} | ||
if (options.from) { | ||
q.from = options.from; | ||
} | ||
if (options.to) { | ||
q.to = options.to; | ||
} | ||
} | ||
_context7.prev = 3; | ||
_context7.next = 6; | ||
return this.api.get(reqURL, { | ||
params: q | ||
}); | ||
case 6: | ||
response = _context7.sent; | ||
return _context7.abrupt("return", response.data); | ||
case 10: | ||
_context7.prev = 10; | ||
_context7.t0 = _context7["catch"](3); | ||
throw this.createErrorString('getAddress', _context7.t0); | ||
case 13: | ||
case "end": | ||
return _context7.stop(); | ||
} | ||
}, _callee7, this, [[3, 10]]); | ||
})); | ||
function getAddress(_x8, _x9) { | ||
return _getAddress.apply(this, arguments); | ||
} | ||
return getAddress; | ||
@@ -336,35 +256,26 @@ }() | ||
value: function () { | ||
var _getAddressProperties = (0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee8(address, property) { | ||
var _getAddressProperties = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(address, property) { | ||
var response; | ||
return _regenerator["default"].wrap(function _callee8$(_context8) { | ||
while (1) { | ||
switch (_context8.prev = _context8.next) { | ||
case 0: | ||
_context8.prev = 0; | ||
_context8.next = 3; | ||
return this.api.get('/addr/' + address + '/' + property); | ||
case 3: | ||
response = _context8.sent; | ||
return _context8.abrupt("return", response.data); | ||
case 7: | ||
_context8.prev = 7; | ||
_context8.t0 = _context8["catch"](0); | ||
throw this.createErrorString('getAddressProperties', _context8.t0); | ||
case 10: | ||
case "end": | ||
return _context8.stop(); | ||
} | ||
while (1) switch (_context8.prev = _context8.next) { | ||
case 0: | ||
_context8.prev = 0; | ||
_context8.next = 3; | ||
return this.api.get('/addr/' + address + '/' + property); | ||
case 3: | ||
response = _context8.sent; | ||
return _context8.abrupt("return", response.data); | ||
case 7: | ||
_context8.prev = 7; | ||
_context8.t0 = _context8["catch"](0); | ||
throw this.createErrorString('getAddressProperties', _context8.t0); | ||
case 10: | ||
case "end": | ||
return _context8.stop(); | ||
} | ||
}, _callee8, this, [[0, 7]]); | ||
})); | ||
function getAddressProperties(_x10, _x11) { | ||
return _getAddressProperties.apply(this, arguments); | ||
} | ||
return getAddressProperties; | ||
@@ -375,35 +286,26 @@ }() | ||
value: function () { | ||
var _getAddressUtxo = (0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee9(address) { | ||
var _getAddressUtxo = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(address) { | ||
var response; | ||
return _regenerator["default"].wrap(function _callee9$(_context9) { | ||
while (1) { | ||
switch (_context9.prev = _context9.next) { | ||
case 0: | ||
_context9.prev = 0; | ||
_context9.next = 3; | ||
return this.api.get('/addr/' + address + '/utxo'); | ||
case 3: | ||
response = _context9.sent; | ||
return _context9.abrupt("return", response.data); | ||
case 7: | ||
_context9.prev = 7; | ||
_context9.t0 = _context9["catch"](0); | ||
throw this.createErrorString('getAddressUtxo', _context9.t0); | ||
case 10: | ||
case "end": | ||
return _context9.stop(); | ||
} | ||
while (1) switch (_context9.prev = _context9.next) { | ||
case 0: | ||
_context9.prev = 0; | ||
_context9.next = 3; | ||
return this.api.get('/addr/' + address + '/utxo'); | ||
case 3: | ||
response = _context9.sent; | ||
return _context9.abrupt("return", response.data); | ||
case 7: | ||
_context9.prev = 7; | ||
_context9.t0 = _context9["catch"](0); | ||
throw this.createErrorString('getAddressUtxo', _context9.t0); | ||
case 10: | ||
case "end": | ||
return _context9.stop(); | ||
} | ||
}, _callee9, this, [[0, 7]]); | ||
})); | ||
function getAddressUtxo(_x12) { | ||
return _getAddressUtxo.apply(this, arguments); | ||
} | ||
return getAddressUtxo; | ||
@@ -414,37 +316,28 @@ }() | ||
value: function () { | ||
var _getAddressesUtxo = (0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee10(addresses) { | ||
var _getAddressesUtxo = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(addresses) { | ||
var response; | ||
return _regenerator["default"].wrap(function _callee10$(_context10) { | ||
while (1) { | ||
switch (_context10.prev = _context10.next) { | ||
case 0: | ||
_context10.prev = 0; | ||
_context10.next = 3; | ||
return this.api.post('/addrs/utxo', { | ||
addrs: addresses.join() | ||
}); | ||
case 3: | ||
response = _context10.sent; | ||
return _context10.abrupt("return", response.data); | ||
case 7: | ||
_context10.prev = 7; | ||
_context10.t0 = _context10["catch"](0); | ||
throw this.createErrorString('getAddressesUtxo', _context10.t0); | ||
case 10: | ||
case "end": | ||
return _context10.stop(); | ||
} | ||
while (1) switch (_context10.prev = _context10.next) { | ||
case 0: | ||
_context10.prev = 0; | ||
_context10.next = 3; | ||
return this.api.post('/addrs/utxo', { | ||
addrs: addresses.join() | ||
}); | ||
case 3: | ||
response = _context10.sent; | ||
return _context10.abrupt("return", response.data); | ||
case 7: | ||
_context10.prev = 7; | ||
_context10.t0 = _context10["catch"](0); | ||
throw this.createErrorString('getAddressesUtxo', _context10.t0); | ||
case 10: | ||
case "end": | ||
return _context10.stop(); | ||
} | ||
}, _callee10, this, [[0, 7]]); | ||
})); | ||
function getAddressesUtxo(_x13) { | ||
return _getAddressesUtxo.apply(this, arguments); | ||
} | ||
return getAddressesUtxo; | ||
@@ -455,35 +348,26 @@ }() | ||
value: function () { | ||
var _getTransactionsForBlock = (0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee11(hash) { | ||
var _getTransactionsForBlock = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(hash) { | ||
var response; | ||
return _regenerator["default"].wrap(function _callee11$(_context11) { | ||
while (1) { | ||
switch (_context11.prev = _context11.next) { | ||
case 0: | ||
_context11.prev = 0; | ||
_context11.next = 3; | ||
return this.api.get('/txs/?block=' + hash); | ||
case 3: | ||
response = _context11.sent; | ||
return _context11.abrupt("return", response.data); | ||
case 7: | ||
_context11.prev = 7; | ||
_context11.t0 = _context11["catch"](0); | ||
throw this.createErrorString('getTransactionsForBlock', _context11.t0); | ||
case 10: | ||
case "end": | ||
return _context11.stop(); | ||
} | ||
while (1) switch (_context11.prev = _context11.next) { | ||
case 0: | ||
_context11.prev = 0; | ||
_context11.next = 3; | ||
return this.api.get('/txs/?block=' + hash); | ||
case 3: | ||
response = _context11.sent; | ||
return _context11.abrupt("return", response.data); | ||
case 7: | ||
_context11.prev = 7; | ||
_context11.t0 = _context11["catch"](0); | ||
throw this.createErrorString('getTransactionsForBlock', _context11.t0); | ||
case 10: | ||
case "end": | ||
return _context11.stop(); | ||
} | ||
}, _callee11, this, [[0, 7]]); | ||
})); | ||
function getTransactionsForBlock(_x14) { | ||
return _getTransactionsForBlock.apply(this, arguments); | ||
} | ||
return getTransactionsForBlock; | ||
@@ -494,35 +378,26 @@ }() | ||
value: function () { | ||
var _getTransactionsForAddress = (0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee12(address) { | ||
var _getTransactionsForAddress = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(address) { | ||
var response; | ||
return _regenerator["default"].wrap(function _callee12$(_context12) { | ||
while (1) { | ||
switch (_context12.prev = _context12.next) { | ||
case 0: | ||
_context12.prev = 0; | ||
_context12.next = 3; | ||
return this.api.get('/txs/?address=' + address); | ||
case 3: | ||
response = _context12.sent; | ||
return _context12.abrupt("return", response.data); | ||
case 7: | ||
_context12.prev = 7; | ||
_context12.t0 = _context12["catch"](0); | ||
throw this.createErrorString('getTransactionsForAddress', _context12.t0); | ||
case 10: | ||
case "end": | ||
return _context12.stop(); | ||
} | ||
while (1) switch (_context12.prev = _context12.next) { | ||
case 0: | ||
_context12.prev = 0; | ||
_context12.next = 3; | ||
return this.api.get('/txs/?address=' + address); | ||
case 3: | ||
response = _context12.sent; | ||
return _context12.abrupt("return", response.data); | ||
case 7: | ||
_context12.prev = 7; | ||
_context12.t0 = _context12["catch"](0); | ||
throw this.createErrorString('getTransactionsForAddress', _context12.t0); | ||
case 10: | ||
case "end": | ||
return _context12.stop(); | ||
} | ||
}, _callee12, this, [[0, 7]]); | ||
})); | ||
function getTransactionsForAddress(_x15) { | ||
return _getTransactionsForAddress.apply(this, arguments); | ||
} | ||
return getTransactionsForAddress; | ||
@@ -533,37 +408,28 @@ }() | ||
value: function () { | ||
var _getTransactionsForAddresses = (0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee13(addresses, options) { | ||
var _getTransactionsForAddresses = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(addresses, options) { | ||
var opts, response; | ||
return _regenerator["default"].wrap(function _callee13$(_context13) { | ||
while (1) { | ||
switch (_context13.prev = _context13.next) { | ||
case 0: | ||
opts = options || {}; | ||
opts.addrs = addresses.join(); | ||
_context13.prev = 2; | ||
_context13.next = 5; | ||
return this.api.post('/addrs/txs', opts); | ||
case 5: | ||
response = _context13.sent; | ||
return _context13.abrupt("return", response.data); | ||
case 9: | ||
_context13.prev = 9; | ||
_context13.t0 = _context13["catch"](2); | ||
throw this.createErrorString('getTransactionsForAddresses', _context13.t0); | ||
case 12: | ||
case "end": | ||
return _context13.stop(); | ||
} | ||
while (1) switch (_context13.prev = _context13.next) { | ||
case 0: | ||
opts = options || {}; | ||
opts.addrs = addresses.join(); | ||
_context13.prev = 2; | ||
_context13.next = 5; | ||
return this.api.post('/addrs/txs', opts); | ||
case 5: | ||
response = _context13.sent; | ||
return _context13.abrupt("return", response.data); | ||
case 9: | ||
_context13.prev = 9; | ||
_context13.t0 = _context13["catch"](2); | ||
throw this.createErrorString('getTransactionsForAddresses', _context13.t0); | ||
case 12: | ||
case "end": | ||
return _context13.stop(); | ||
} | ||
}, _callee13, this, [[2, 9]]); | ||
})); | ||
function getTransactionsForAddresses(_x16, _x17) { | ||
return _getTransactionsForAddresses.apply(this, arguments); | ||
} | ||
return getTransactionsForAddresses; | ||
@@ -574,47 +440,35 @@ }() | ||
value: function () { | ||
var _broadcastRawTransaction = (0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee14(rawtx, options) { | ||
var _broadcastRawTransaction = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14(rawtx, options) { | ||
var opts, response; | ||
return _regenerator["default"].wrap(function _callee14$(_context14) { | ||
while (1) { | ||
switch (_context14.prev = _context14.next) { | ||
case 0: | ||
opts = options || {}; | ||
opts.rawtx = rawtx; | ||
_context14.prev = 2; | ||
_context14.next = 5; | ||
return this.api.post('/tx/send', opts); | ||
case 5: | ||
response = _context14.sent; | ||
if (!(response.data && (0, _typeof2["default"])(response.data.txid) === 'object')) { | ||
_context14.next = 9; | ||
break; | ||
} | ||
response.data.txid = response.data.txid.result; | ||
return _context14.abrupt("return", response.data); | ||
case 9: | ||
return _context14.abrupt("return", response.data); | ||
case 12: | ||
_context14.prev = 12; | ||
_context14.t0 = _context14["catch"](2); | ||
throw this.createErrorString('broadcastRawTransaction', _context14.t0); | ||
case 15: | ||
case "end": | ||
return _context14.stop(); | ||
} | ||
while (1) switch (_context14.prev = _context14.next) { | ||
case 0: | ||
opts = options || {}; | ||
opts.rawtx = rawtx; | ||
_context14.prev = 2; | ||
_context14.next = 5; | ||
return this.api.post('/tx/send', opts); | ||
case 5: | ||
response = _context14.sent; | ||
if (!(response.data && (0, _typeof2["default"])(response.data.txid) === 'object')) { | ||
_context14.next = 9; | ||
break; | ||
} | ||
response.data.txid = response.data.txid.result; | ||
return _context14.abrupt("return", response.data); | ||
case 9: | ||
return _context14.abrupt("return", response.data); | ||
case 12: | ||
_context14.prev = 12; | ||
_context14.t0 = _context14["catch"](2); | ||
throw this.createErrorString('broadcastRawTransaction', _context14.t0); | ||
case 15: | ||
case "end": | ||
return _context14.stop(); | ||
} | ||
}, _callee14, this, [[2, 12]]); | ||
})); | ||
function broadcastRawTransaction(_x18, _x19) { | ||
return _broadcastRawTransaction.apply(this, arguments); | ||
} | ||
return broadcastRawTransaction; | ||
@@ -625,35 +479,26 @@ }() | ||
value: function () { | ||
var _getSync = (0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee15() { | ||
var _getSync = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15() { | ||
var response; | ||
return _regenerator["default"].wrap(function _callee15$(_context15) { | ||
while (1) { | ||
switch (_context15.prev = _context15.next) { | ||
case 0: | ||
_context15.prev = 0; | ||
_context15.next = 3; | ||
return this.api.get('/sync'); | ||
case 3: | ||
response = _context15.sent; | ||
return _context15.abrupt("return", response.data); | ||
case 7: | ||
_context15.prev = 7; | ||
_context15.t0 = _context15["catch"](0); | ||
throw this.createErrorString('getSync', _context15.t0); | ||
case 10: | ||
case "end": | ||
return _context15.stop(); | ||
} | ||
while (1) switch (_context15.prev = _context15.next) { | ||
case 0: | ||
_context15.prev = 0; | ||
_context15.next = 3; | ||
return this.api.get('/sync'); | ||
case 3: | ||
response = _context15.sent; | ||
return _context15.abrupt("return", response.data); | ||
case 7: | ||
_context15.prev = 7; | ||
_context15.t0 = _context15["catch"](0); | ||
throw this.createErrorString('getSync', _context15.t0); | ||
case 10: | ||
case "end": | ||
return _context15.stop(); | ||
} | ||
}, _callee15, this, [[0, 7]]); | ||
})); | ||
function getSync() { | ||
return _getSync.apply(this, arguments); | ||
} | ||
return getSync; | ||
@@ -664,35 +509,26 @@ }() | ||
value: function () { | ||
var _getPeer = (0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee16() { | ||
var _getPeer = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee16() { | ||
var response; | ||
return _regenerator["default"].wrap(function _callee16$(_context16) { | ||
while (1) { | ||
switch (_context16.prev = _context16.next) { | ||
case 0: | ||
_context16.prev = 0; | ||
_context16.next = 3; | ||
return this.api.get('/peer'); | ||
case 3: | ||
response = _context16.sent; | ||
return _context16.abrupt("return", response.data); | ||
case 7: | ||
_context16.prev = 7; | ||
_context16.t0 = _context16["catch"](0); | ||
throw this.createErrorString('getPeer', _context16.t0); | ||
case 10: | ||
case "end": | ||
return _context16.stop(); | ||
} | ||
while (1) switch (_context16.prev = _context16.next) { | ||
case 0: | ||
_context16.prev = 0; | ||
_context16.next = 3; | ||
return this.api.get('/peer'); | ||
case 3: | ||
response = _context16.sent; | ||
return _context16.abrupt("return", response.data); | ||
case 7: | ||
_context16.prev = 7; | ||
_context16.t0 = _context16["catch"](0); | ||
throw this.createErrorString('getPeer', _context16.t0); | ||
case 10: | ||
case "end": | ||
return _context16.stop(); | ||
} | ||
}, _callee16, this, [[0, 7]]); | ||
})); | ||
function getPeer() { | ||
return _getPeer.apply(this, arguments); | ||
} | ||
return getPeer; | ||
@@ -703,35 +539,26 @@ }() | ||
value: function () { | ||
var _getStatus = (0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee17(query) { | ||
var _getStatus = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee17(query) { | ||
var response; | ||
return _regenerator["default"].wrap(function _callee17$(_context17) { | ||
while (1) { | ||
switch (_context17.prev = _context17.next) { | ||
case 0: | ||
_context17.prev = 0; | ||
_context17.next = 3; | ||
return this.api.get('/status?q=' + query); | ||
case 3: | ||
response = _context17.sent; | ||
return _context17.abrupt("return", response.data); | ||
case 7: | ||
_context17.prev = 7; | ||
_context17.t0 = _context17["catch"](0); | ||
throw this.createErrorString('getStatus', _context17.t0); | ||
case 10: | ||
case "end": | ||
return _context17.stop(); | ||
} | ||
while (1) switch (_context17.prev = _context17.next) { | ||
case 0: | ||
_context17.prev = 0; | ||
_context17.next = 3; | ||
return this.api.get('/status?q=' + query); | ||
case 3: | ||
response = _context17.sent; | ||
return _context17.abrupt("return", response.data); | ||
case 7: | ||
_context17.prev = 7; | ||
_context17.t0 = _context17["catch"](0); | ||
throw this.createErrorString('getStatus', _context17.t0); | ||
case 10: | ||
case "end": | ||
return _context17.stop(); | ||
} | ||
}, _callee17, this, [[0, 7]]); | ||
})); | ||
function getStatus(_x20) { | ||
return _getStatus.apply(this, arguments); | ||
} | ||
return getStatus; | ||
@@ -742,35 +569,26 @@ }() | ||
value: function () { | ||
var _getExchangeRate = (0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee18() { | ||
var _getExchangeRate = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee18() { | ||
var response; | ||
return _regenerator["default"].wrap(function _callee18$(_context18) { | ||
while (1) { | ||
switch (_context18.prev = _context18.next) { | ||
case 0: | ||
_context18.prev = 0; | ||
_context18.next = 3; | ||
return this.api.get('/currency'); | ||
case 3: | ||
response = _context18.sent; | ||
return _context18.abrupt("return", response.data); | ||
case 7: | ||
_context18.prev = 7; | ||
_context18.t0 = _context18["catch"](0); | ||
throw this.createErrorString('getExchangeRate', _context18.t0); | ||
case 10: | ||
case "end": | ||
return _context18.stop(); | ||
} | ||
while (1) switch (_context18.prev = _context18.next) { | ||
case 0: | ||
_context18.prev = 0; | ||
_context18.next = 3; | ||
return this.api.get('/currency'); | ||
case 3: | ||
response = _context18.sent; | ||
return _context18.abrupt("return", response.data); | ||
case 7: | ||
_context18.prev = 7; | ||
_context18.t0 = _context18["catch"](0); | ||
throw this.createErrorString('getExchangeRate', _context18.t0); | ||
case 10: | ||
case "end": | ||
return _context18.stop(); | ||
} | ||
}, _callee18, this, [[0, 7]]); | ||
})); | ||
function getExchangeRate() { | ||
return _getExchangeRate.apply(this, arguments); | ||
} | ||
return getExchangeRate; | ||
@@ -781,44 +599,33 @@ }() | ||
value: function () { | ||
var _estimateFee = (0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee19(nbBlocks) { | ||
var _estimateFee = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee19(nbBlocks) { | ||
var reqURL, q, response; | ||
return _regenerator["default"].wrap(function _callee19$(_context19) { | ||
while (1) { | ||
switch (_context19.prev = _context19.next) { | ||
case 0: | ||
reqURL = '/utils/estimatefee'; | ||
q = {}; | ||
if (nbBlocks && nbBlocks !== '') { | ||
q.nbBlocks = nbBlocks; | ||
} | ||
_context19.prev = 3; | ||
_context19.next = 6; | ||
return this.api.get(reqURL, { | ||
params: q | ||
}); | ||
case 6: | ||
response = _context19.sent; | ||
return _context19.abrupt("return", response.data); | ||
case 10: | ||
_context19.prev = 10; | ||
_context19.t0 = _context19["catch"](3); | ||
throw this.createErrorString('estimateFee', _context19.t0); | ||
case 13: | ||
case "end": | ||
return _context19.stop(); | ||
} | ||
while (1) switch (_context19.prev = _context19.next) { | ||
case 0: | ||
reqURL = '/utils/estimatefee'; | ||
q = {}; | ||
if (nbBlocks && nbBlocks !== '') { | ||
q.nbBlocks = nbBlocks; | ||
} | ||
_context19.prev = 3; | ||
_context19.next = 6; | ||
return this.api.get(reqURL, { | ||
params: q | ||
}); | ||
case 6: | ||
response = _context19.sent; | ||
return _context19.abrupt("return", response.data); | ||
case 10: | ||
_context19.prev = 10; | ||
_context19.t0 = _context19["catch"](3); | ||
throw this.createErrorString('estimateFee', _context19.t0); | ||
case 13: | ||
case "end": | ||
return _context19.stop(); | ||
} | ||
}, _callee19, this, [[3, 10]]); | ||
})); | ||
function estimateFee(_x21) { | ||
return _estimateFee.apply(this, arguments); | ||
} | ||
return estimateFee; | ||
@@ -830,3 +637,2 @@ }() | ||
var extraErrorText = ''; | ||
if (error && error.response) { | ||
@@ -836,7 +642,5 @@ if (error.response.status) { | ||
} | ||
if (error.response.statusText) { | ||
extraErrorText += error.response.statusText + ' | '; | ||
} | ||
if (error.response.data) { | ||
@@ -848,3 +652,2 @@ extraErrorText += error.response.data; | ||
} | ||
return new Error('Unable to ' + functionName + ': ' + extraErrorText); | ||
@@ -851,0 +654,0 @@ } |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
module.exports = | ||
/*#__PURE__*/ | ||
function () { | ||
module.exports = /*#__PURE__*/function () { | ||
function InsightGroup(url) { | ||
@@ -16,3 +11,2 @@ (0, _classCallCheck2["default"])(this, InsightGroup); | ||
} | ||
(0, _createClass2["default"])(InsightGroup, [{ | ||
@@ -19,0 +13,0 @@ key: "getBlock", |
{ | ||
"name": "@oipwg/insight-explorer", | ||
"version": "2.0.0-beta.0", | ||
"version": "2.0.1", | ||
"description": "Easily retrieve information about transactions and addresses from any insight api explorer", | ||
@@ -34,12 +34,12 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"axios": "^0.19.2" | ||
"axios": "^1.3.4" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.8.4", | ||
"@babel/cli": "^7.8.4", | ||
"@babel/preset-env": "^7.8.4", | ||
"@babel/runtime": "^7.8.4", | ||
"@babel/plugin-transform-runtime": "^7.8.3", | ||
"jest": "^25.1.0", | ||
"standard": "^14.3.1" | ||
"@babel/core": "^7.21.0", | ||
"@babel/cli": "^7.21.0", | ||
"@babel/preset-env": "^7.20.2", | ||
"@babel/runtime": "^7.21.0", | ||
"@babel/plugin-transform-runtime": "^7.21.0", | ||
"jest": "^29.5.0", | ||
"standard": "^17.0.0" | ||
}, | ||
@@ -46,0 +46,0 @@ "jest": { |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
37550
709
1
+ Addedasynckit@0.4.0(transitive)
+ Addedaxios@1.7.9(transitive)
+ Addedcall-bind-apply-helpers@1.0.2(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addeddunder-proto@1.0.1(transitive)
+ Addedes-define-property@1.0.1(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedes-object-atoms@1.1.1(transitive)
+ Addedes-set-tostringtag@2.1.0(transitive)
+ Addedfollow-redirects@1.15.9(transitive)
+ Addedform-data@4.0.2(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-intrinsic@1.3.0(transitive)
+ Addedget-proto@1.0.1(transitive)
+ Addedgopd@1.2.0(transitive)
+ Addedhas-symbols@1.1.0(transitive)
+ Addedhas-tostringtag@1.0.2(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedmath-intrinsics@1.1.0(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedproxy-from-env@1.1.0(transitive)
- Removedaxios@0.19.2(transitive)
- Removedfollow-redirects@1.5.10(transitive)
Updatedaxios@^1.3.4