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

web3-core-helpers

Package Overview
Dependencies
Maintainers
2
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

web3-core-helpers - npm Package Compare versions

Comparing version 1.2.6 to 1.2.7-rc.0

14

package.json
{
"name": "web3-core-helpers",
"version": "1.2.6",
"version": "1.2.7-rc.0",
"description": "Web3 core tools helper for sub packages. This is an internal package.",

@@ -12,3 +12,3 @@ "repository": "https://github.com/ethereum/web3.js/tree/1.x/packages/web3-core-helpers",

"scripts": {
"dtslint": "dtslint types --onlyTestTsNext"
"dtslint": "dtslint types"
},

@@ -18,11 +18,11 @@ "main": "src/index.js",

"underscore": "1.9.1",
"web3-eth-iban": "1.2.6",
"web3-utils": "1.2.6"
"web3-eth-iban": "1.2.7-rc.0",
"web3-utils": "1.2.7-rc.0"
},
"devDependencies": {
"@types/node": "^12.12.5",
"definitelytyped-header-parser": "^1.0.1",
"dtslint": "0.4.2"
"definitelytyped-header-parser": "^3.9.0",
"dtslint": "^3.4.1"
},
"gitHead": "c20bcf09b04f773406ce3532e88fd105bb04e244"
"gitHead": "598e53163890660670c46d84bb6a6cbee4693e41"
}
# web3-core-helpers
[![NPM Package][npm-image]][npm-url] [![Dependency Status][deps-image]][deps-url] [![Dev Dependency Status][deps-dev-image]][deps-dev-url]
This is a sub package of [web3.js][repo]

@@ -29,5 +31,11 @@

All the typescript typings are placed in the types folder.
All the TypeScript typings are placed in the `types` folder.
[docs]: http://web3js.readthedocs.io/en/1.0/
[repo]: https://github.com/ethereum/web3.js
[npm-image]: https://img.shields.io/npm/v/web3-core-helpers.svg
[npm-url]: https://npmjs.org/package/web3-core-helpers
[deps-image]: https://david-dm.org/ethereum/web3.js/1.x/status.svg?path=packages/web3-core-helpers
[deps-url]: https://david-dm.org/ethereum/web3.js/1.x?path=packages/web3-core-helpers
[deps-dev-image]: https://david-dm.org/ethereum/web3.js/1.x/dev-status.svg?path=packages/web3-core-helpers
[deps-dev-url]: https://david-dm.org/ethereum/web3.js/1.x?type=dev&path=packages/web3-core-helpers

@@ -34,4 +34,4 @@ /*

},
InvalidConnection: function (host){
return new Error('CONNECTION ERROR: Couldn\'t connect to node '+ host +'.');
InvalidConnection: function (host, event){
return this.ConnectionError('CONNECTION ERROR: Couldn\'t connect to node '+ host +'.', event);
},

@@ -48,2 +48,32 @@ InvalidProvider: function () {

},
ConnectionNotOpenError: function (event){
return this.ConnectionError('connection not open on send()', event);
},
ConnectionCloseError: function (event){
if (typeof event === 'object' && event.code && event.reason) {
return this.ConnectionError(
'CONNECTION ERROR: The connection got closed with ' +
'the close code `' + event.code + '` and the following ' +
'reason string `' + event.reason + '`',
event
);
}
return new Error('CONNECTION ERROR: The connection closed unexpectedly');
},
MaxAttemptsReachedOnReconnectingError: function (){
return new Error('Maximum number of reconnect attempts reached!');
},
PendingRequestsOnReconnectingError: function (){
return new Error('CONNECTION ERROR: Provider started to reconnect before the response got received!');
},
ConnectionError: function (msg, event){
const error = new Error(msg);
if (event) {
error.code = event.code;
error.reason = event.reason;
}
return error;
},
RevertInstructionError: function(reason, signature) {

@@ -50,0 +80,0 @@ var error = new Error('Your request got reverted with the following reason string: ' + reason);

@@ -20,2 +20,4 @@ /*

// Minimum TypeScript Version: 3.0
import * as net from 'net';

@@ -68,6 +70,11 @@ import * as http from 'http';

): Error;
static InvalidConnection(host: string): Error;
static InvalidConnection(host: string, event?: WebSocketEvent): ConnectionError;
static InvalidProvider(): Error;
static InvalidResponse(result: Error): Error;
static ConnectionTimeout(ms: string): Error;
static ConnectionNotOpenError(): Error;
static ConnectionCloseError(event: WebSocketEvent | boolean): Error | ConnectionError;
static MaxAttemptsReachedOnReconnectingError(): Error;
static PendingRequestsOnReconnectingError(): Error;
static ConnectionError(msg: string, event?: WebSocketEvent): ConnectionError;
static RevertInstructionError(reason: string, signature: string): RevertInstructionError

@@ -87,9 +94,7 @@ static TransactionRevertInstructionError(reason: string, signature: string, receipt: object): TransactionRevertInstructionError

responseCallbacks: any;
notificationCallbacks: any;
requestQueue: Map<string, RequestItem>;
responseQueue: Map<string, RequestItem>;
connected: boolean;
connection: any;
addDefaultEvents(): void;
supportsSubscriptions(): boolean;

@@ -113,2 +118,6 @@

disconnect(code: number, reason: string): void;
connect(): void;
reconnect(): void;
}

@@ -190,4 +199,17 @@

origin?: string;
reconnect?: ReconnectOptions;
}
export interface ReconnectOptions {
auto?: boolean;
delay?: number;
maxAttempts?: number;
onTimeout?: boolean;
}
export interface RequestItem {
payload: JsonRpcPayload;
callback: (error: any, result: any) => void;
}
export interface JsonRpcPayload {

@@ -220,1 +242,11 @@ jsonrpc: string;

}
export interface ConnectionError extends Error {
code: string | undefined;
reason: string | undefined;
}
export interface WebSocketEvent {
code?: number;
reason?: string;
}

@@ -20,3 +20,3 @@ /*

import { errors } from 'web3-core-helpers';
import { errors, WebSocketEvent } from 'web3-core-helpers';

@@ -29,3 +29,3 @@ // $ExpectType Error

// $ExpectType Error
// $ExpectType ConnectionError
errors.InvalidConnection('https://localhost:2345432');

@@ -42,2 +42,21 @@

// $ExpectType Error
errors.ConnectionNotOpenError();
// $ExpectType Error
errors.MaxAttemptsReachedOnReconnectingError();
// $ExpectType Error
errors.PendingRequestsOnReconnectingError();
const event: WebSocketEvent = {code: 100, reason: 'reason'};
// $ExpectType ConnectionError
errors.ConnectionError('msg', event);
// $ExpectType Error | ConnectionError
errors.ConnectionCloseError(event);
// $ExpectType Error | ConnectionError
errors.ConnectionCloseError(true);
// $ExpectType RevertInstructionError

@@ -48,1 +67,16 @@ errors.RevertInstructionError('reason', 'signature');

errors.TransactionRevertInstructionError('reason', 'signature', {});
// $ExpectType TransactionError
errors.TransactionError('reason', {});
// $ExpectType TransactionError
errors.NoContractAddressFoundError({});
// $ExpectType TransactionError
errors.ContractCodeNotStoredError({});
// $ExpectType TransactionError
errors.TransactionRevertedWithoutReasonError({});
// $ExpectType TransactionError
errors.TransactionOutOfGasError({});
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