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.17 to 3.2.18

7

dist/src/jsonrpc.d.ts
import { GetAccount, GetBalances, GetKeyAccounts, GetCodehash, GetAccountInfo } from "./types/api";
export declare type Fetch = (url: string | Request, init?: RequestInit) => Promise<Response>;
/**

@@ -15,13 +14,7 @@ * JsonRpc

chain: string;
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>;
/**

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

48

dist/src/jsonrpc.js

@@ -68,5 +68,9 @@ "use strict";

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var endpoints_1 = require("./endpoints");
var rpcerror_1 = require("./rpcerror");
var cross_fetch_1 = __importDefault(require("cross-fetch"));
var chainToEndpoint = {

@@ -87,2 +91,20 @@ eos: "https://api.light.xeos.me",

};
function fetchWithTimeout(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*/, cross_fetch_1.default(resource, __assign({}, (options || {}), { signal: controller.signal }))];
case 1:
response = _a.sent();
clearTimeout(id);
return [2 /*return*/, response];
}
});
});
}
/**

@@ -106,8 +128,2 @@ * JsonRpc

}
if (args.fetch) {
this.fetchBuiltin = args.fetch;
}
else {
this.fetchBuiltin = global.fetch;
}
if (args.timeout) {

@@ -117,20 +133,2 @@ 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];
}
});
});
};
/**

@@ -155,3 +153,3 @@ * get

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

@@ -158,0 +156,0 @@ timeout: this.timeout

{
"name": "@eoscafe/light-api",
"version": "3.2.17",
"version": "3.2.18",
"description": "Light API HTTP Javascript library",

@@ -42,3 +42,6 @@ "main": "dist/index.js",

},
"gitHead": "a1affc3ddd1c5626ac56d9e02a29a31683edea6d"
"gitHead": "a1affc3ddd1c5626ac56d9e02a29a31683edea6d",
"dependencies": {
"cross-fetch": "^3.1.5"
}
}

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