web3-core-helpers
Advanced tools
Comparing version 1.2.6 to 1.2.7-rc.0
{ | ||
"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({}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34280
864
40
2
1
+ Addedweb3-eth-iban@1.2.7-rc.0(transitive)
+ Addedweb3-utils@1.2.7-rc.0(transitive)
- Removedweb3-eth-iban@1.2.6(transitive)
- Removedweb3-utils@1.2.6(transitive)
Updatedweb3-eth-iban@1.2.7-rc.0
Updatedweb3-utils@1.2.7-rc.0