Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cosmology/lcd

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cosmology/lcd - npm Package Compare versions

Comparing version 0.12.0 to 0.13.0

29

main/index.js
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _rest = require("./rest");
Object.keys(_rest).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _rest[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _rest[key];
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
});
});
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./rest"), exports);
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LCDClient = void 0;
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 _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _axios = _interopRequireDefault(require("axios"));
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var LCDClient = /*#__PURE__*/function () {
function LCDClient(_ref) {
var restEndpoint = _ref.restEndpoint;
(0, _classCallCheck2["default"])(this, LCDClient);
(0, _defineProperty2["default"])(this, "restEndpoint", void 0);
(0, _defineProperty2["default"])(this, "instance", void 0);
this.restEndpoint = restEndpoint.endsWith('/') ? restEndpoint : "".concat(restEndpoint, "/");
this.instance = _axios["default"].create({
baseURL: this.restEndpoint,
timeout: 10000,
headers: {}
});
this.get = this.get.bind(this);
this.post = this.post.bind(this);
}
(0, _createClass2["default"])(LCDClient, [{
key: "get",
value: function get(endpoint) {
var _this = this;
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return new Promise( /*#__PURE__*/function () {
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(resolve, reject) {
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.instance.get(endpoint, _objectSpread({
timeout: 10000
}, opts));
case 3:
response = _context.sent;
const axios_1 = __importDefault(require("axios"));
class LCDClient {
restEndpoint;
instance;
constructor({ restEndpoint }) {
this.restEndpoint = restEndpoint.endsWith('/') ? restEndpoint : `${restEndpoint}/`;
this.instance = axios_1.default.create({
baseURL: this.restEndpoint,
timeout: 10000,
headers: {}
});
this.get = this.get.bind(this);
this.post = this.post.bind(this);
}
get(endpoint, opts = {}) {
return new Promise(async (resolve, reject) => {
try {
const response = await this.instance.get(endpoint, {
timeout: 10000,
...opts
});
if (response && response.data) {
resolve(response.data);
} else {
reject('no response data');
resolve(response.data);
}
_context.next = 10;
break;
case 7:
_context.prev = 7;
_context.t0 = _context["catch"](0);
return _context.abrupt("return", reject(_context.t0));
case 10:
case "end":
return _context.stop();
else {
reject('no response data');
}
}
}, _callee, null, [[0, 7]]);
}));
return function (_x, _x2) {
return _ref2.apply(this, arguments);
};
}());
catch (e) {
return reject(e);
}
});
}
}, {
key: "post",
value: function post(endpoint) {
var _this2 = this;
var body = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
return new Promise( /*#__PURE__*/function () {
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(resolve, reject) {
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 _this2.instance.post(endpoint, body, _objectSpread({
timeout: 10000
}, opts));
case 3:
response = _context2.sent;
post(endpoint, body = {}, opts = {}) {
return new Promise(async (resolve, reject) => {
try {
const response = await this.instance.post(endpoint, body, {
timeout: 10000,
...opts
});
if (response && response.data) {
resolve(response.data);
} else {
reject('no response data');
resolve(response.data);
}
_context2.next = 10;
break;
case 7:
_context2.prev = 7;
_context2.t0 = _context2["catch"](0);
return _context2.abrupt("return", reject(_context2.t0));
case 10:
case "end":
return _context2.stop();
else {
reject('no response data');
}
}
}, _callee2, null, [[0, 7]]);
}));
return function (_x3, _x4) {
return _ref3.apply(this, arguments);
};
}());
catch (e) {
return reject(e);
}
});
}
}]);
return LCDClient;
}();
exports.LCDClient = LCDClient;
}
exports.LCDClient = LCDClient;

@@ -1,1 +0,1 @@

export * from './rest';
export * from './rest';

@@ -1,52 +0,53 @@

import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
import axios from 'axios';
export class LCDClient {
constructor({
restEndpoint
}) {
_defineProperty(this, "restEndpoint", void 0);
_defineProperty(this, "instance", void 0);
this.restEndpoint = restEndpoint.endsWith('/') ? restEndpoint : `${restEndpoint}/`;
this.instance = axios.create({
baseURL: this.restEndpoint,
timeout: 10000,
headers: {}
});
this.get = this.get.bind(this);
this.post = this.post.bind(this);
}
get(endpoint, opts = {}) {
return new Promise(async (resolve, reject) => {
try {
const response = await this.instance.get(endpoint, _objectSpread({
timeout: 10000
}, opts));
if (response && response.data) {
resolve(response.data);
} else {
reject('no response data');
}
} catch (e) {
return reject(e);
}
});
}
post(endpoint, body = {}, opts = {}) {
return new Promise(async (resolve, reject) => {
try {
const response = await this.instance.post(endpoint, body, _objectSpread({
timeout: 10000
}, opts));
if (response && response.data) {
resolve(response.data);
} else {
reject('no response data');
}
} catch (e) {
return reject(e);
}
});
}
}
restEndpoint;
instance;
constructor({ restEndpoint }) {
this.restEndpoint = restEndpoint.endsWith('/') ? restEndpoint : `${restEndpoint}/`;
this.instance = axios.create({
baseURL: this.restEndpoint,
timeout: 10000,
headers: {}
});
this.get = this.get.bind(this);
this.post = this.post.bind(this);
}
get(endpoint, opts = {}) {
return new Promise(async (resolve, reject) => {
try {
const response = await this.instance.get(endpoint, {
timeout: 10000,
...opts
});
if (response && response.data) {
resolve(response.data);
}
else {
reject('no response data');
}
}
catch (e) {
return reject(e);
}
});
}
post(endpoint, body = {}, opts = {}) {
return new Promise(async (resolve, reject) => {
try {
const response = await this.instance.post(endpoint, body, {
timeout: 10000,
...opts
});
if (response && response.data) {
resolve(response.data);
}
else {
reject('no response data');
}
}
catch (e) {
return reject(e);
}
});
}
}
{
"name": "@cosmology/lcd",
"version": "0.12.0",
"version": "0.13.0",
"description": "Telescope LCDClient helpers",

@@ -22,7 +22,6 @@ "author": "Dan Lynch <pyramation@gmail.com>",

"scripts": {
"build:main": "cross-env BABEL_ENV=production babel src --out-dir main --delete-dir-on-start --extensions \".tsx,.ts,.js\"",
"build:module": "cross-env MODULE=true babel src --out-dir module --delete-dir-on-start --extensions \".tsx,.ts,.js\"",
"build:ts": "tsc --project ./tsconfig.json",
"build:main": "yarn tsc -p tsconfig.json --outDir main --module commonjs",
"build:module": "yarn tsc -p tsconfig.json --outDir module --module es2022",
"build": "npm run build:module && npm run build:main",
"buidl": "npm run build && npm run build:ts",
"buidl": "npm run build",
"buidl:clean": "npm run clean && npm run buidl",

@@ -52,19 +51,3 @@ "clean": "rimraf ./types",

"devDependencies": {
"@babel/cli": "7.21.0",
"@babel/core": "7.21.4",
"@babel/eslint-parser": "^7.21.3",
"@babel/generator": "7.21.4",
"@babel/node": "^7.20.7",
"@babel/parser": "^7.21.4",
"@babel/plugin-proposal-class-properties": "7.18.6",
"@babel/plugin-proposal-export-default-from": "7.18.10",
"@babel/plugin-proposal-object-rest-spread": "7.20.7",
"@babel/plugin-transform-runtime": "7.21.4",
"@babel/preset-env": "7.21.4",
"@babel/preset-typescript": "^7.21.4",
"@babel/traverse": "7.21.4",
"@types/jest": "^29.5.0",
"babel-core": "7.0.0-bridge.0",
"babel-jest": "29.5.0",
"babel-watch": "^7.7.2",
"cross-env": "^7.0.2",

@@ -74,2 +57,3 @@ "eslint": "8.38.0",

"eslint-plugin-prettier": "^4.0.0",
"esprima": "4.0.1",
"jest": "^29.5.0",

@@ -84,6 +68,5 @@ "jest-in-case": "^1.0.2",

"dependencies": {
"@babel/runtime": "^7.21.0",
"axios": "0.27.2"
},
"gitHead": "733718140024f72ad4be364dc58780ef6b8e47dd"
"gitHead": "e37f2e1292191a716178f3d5bccc9c6f8339f9b7"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc