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

@eoscafe/light-api

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eoscafe/light-api - npm Package Compare versions

Comparing version 3.2.16 to 3.2.17

6

dist/src/jsonrpc.d.ts

@@ -16,6 +16,12 @@ import { GetAccount, GetBalances, GetKeyAccounts, GetCodehash, GetAccountInfo } from "./types/api";

fetchBuiltin: Fetch;
timeout: number;
constructor(chain: string, args?: {
fetch?: Fetch;
endpoint?: string;
timeout?: number;
});
fetchWithTimeout(resource: string, options: {
[key: string]: any;
timeout: number;
}): Promise<Response>;
/**

@@ -22,0 +28,0 @@ * get

68

dist/src/jsonrpc.js
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -37,2 +48,22 @@ return new (P || (P = Promise))(function (resolve, reject) {

};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spread = (this && this.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -56,9 +87,2 @@ var endpoints_1 = require("./endpoints");

};
var keyEndpoints = [
"https://api.light.xeos.me",
"https://lightapi.eosgeneva.io",
"https://lightapi.eosamsterdam.net",
"https://hyperion.coffe.io",
"https://testnet-lightapi.eosams.xeos.me"
];
/**

@@ -76,2 +100,3 @@ * JsonRpc

if (args === void 0) { args = {}; }
this.timeout = 5000;
this.chain = chain;

@@ -88,3 +113,24 @@ this.endpoint = args.endpoint || chainToEndpoint[chain];

}
if (args.timeout) {
this.timeout = args.timeout;
}
}
JsonRpc.prototype.fetchWithTimeout = function (resource, options) {
return __awaiter(this, void 0, void 0, function () {
var timeout, controller, id, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
timeout = options.timeout;
controller = new AbortController();
id = setTimeout(function () { return controller.abort(); }, timeout);
return [4 /*yield*/, this.fetchBuiltin(resource, __assign({}, (options || {}), { signal: controller.signal }))];
case 1:
response = _a.sent();
clearTimeout(id);
return [2 /*return*/, response];
}
});
});
};
/**

@@ -101,3 +147,3 @@ * get

return __awaiter(this, void 0, void 0, function () {
var response, json, url, f, text, e_1;
var response, json, url, text, e_1;
return __generator(this, function (_a) {

@@ -110,5 +156,5 @@ switch (_a.label) {

_a.trys.push([1, 4, , 5]);
f = this.fetchBuiltin;
return [4 /*yield*/, f(url, {
return [4 /*yield*/, this.fetchWithTimeout(url, {
method: "GET",
timeout: this.timeout
})];

@@ -197,3 +243,3 @@ case 2:

case 0:
promises = keyEndpoints.map(function (endpoint) {
promises = __spread(new Set(Object.values(chainToEndpoint))).map(function (endpoint) {
var url = endpoints_1.GET_KEY_ACCOUNTS + "/" + key;

@@ -200,0 +246,0 @@ return _this.get(url, endpoint);

2

package.json
{
"name": "@eoscafe/light-api",
"version": "3.2.16",
"version": "3.2.17",
"description": "Light API HTTP Javascript library",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

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