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

@eth-sdk/query

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eth-sdk/query - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

1

build/providers/HttpProvider.d.ts

@@ -5,2 +5,3 @@ import { BehaviorSubject } from 'rxjs';

private endpoint;
private static detectFetch;
private readonly fetch;

@@ -7,0 +8,0 @@ constructor(endpoint: string, options?: HttpProvider.IOptions);

19

build/providers/HttpProvider.js

@@ -7,8 +7,19 @@ "use strict";

this.endpoint = endpoint;
this.fetch = typeof fetch !== 'undefined'
? fetch
: options.fetch;
if (!this.fetch) {
this.fetch = HttpProvider.detectFetch(options.fetch);
}
static detectFetch(option = null) {
let result;
if (option) {
result = option;
}
else {
result = (typeof window !== 'undefined' &&
typeof window.fetch !== 'undefined')
? window.fetch.bind(window)
: null;
}
if (!result) {
new Error('fetch not found. Please use `node-fetch` via options.fetch');
}
return result;
}

@@ -15,0 +26,0 @@ get connected$() {

@@ -7,2 +7,3 @@ import { BehaviorSubject } from 'rxjs';

static DEFAULT_REQUEST_TIMEOUT: number;
private static detectWebSocketConstructor;
connected$: BehaviorSubject<boolean>;

@@ -9,0 +10,0 @@ notification$: BehaviorSubject<IProvider.INotification>;

@@ -16,8 +16,3 @@ "use strict";

this.reconnectTimeout = null;
this.webSocketConstructor = typeof WebSocket !== 'undefined'
? WebSocket
: options.webSocketConstructor;
if (!this.webSocketConstructor) {
throw new Error('please setup options.webSocketConstructor');
}
this.webSocketConstructor = WebSocketProvider.detectWebSocketConstructor(options.webSocketConstructor);
this.options = Object.assign(Object.assign({ connect: false, reconnectTime: WebSocketProvider.DEFAULT_RECONNECT_TIME, requestTimeout: WebSocketProvider.DEFAULT_REQUEST_TIMEOUT }, options), { webSocketConstructor: null });

@@ -45,2 +40,17 @@ this

}
static detectWebSocketConstructor(option = null) {
let result;
if (option) {
result = option;
}
else {
result = (typeof WebSocket !== 'undefined')
? WebSocket
: null;
}
if (!result) {
throw new Error('please setup options.webSocketConstructor');
}
return result;
}
get connected() {

@@ -47,0 +57,0 @@ return this.state === WebSocketProvider.States.Connected;

{
"name": "@eth-sdk/query",
"version": "0.2.1",
"version": "0.2.2",
"description": "Eth sdk query",

@@ -5,0 +5,0 @@ "author": {

Sorry, the diff of this file is not supported yet

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