Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6,067 changes: 2,742 additions & 3,325 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"@toruslabs/eslint-config-typescript": "^4.1.4",
"@toruslabs/torus-scripts": "^7.1.6",
"@types/color": "^4.2.0",
"@types/deep-freeze-strict": "^1.1.2",
"@types/elliptic": "^6.4.18",
"@types/end-of-stream": "^1.4.4",
"@types/json-stable-stringify": "^1.2.0",
Expand Down Expand Up @@ -129,11 +130,13 @@
"base64url": "^3.0.1",
"bip39": "^3.1.0",
"bn.js": "^5.2.2",
"deep-freeze-strict": "^1.1.1",
"deepmerge": "^4.3.1",
"enc-utils": "^3.0.0",
"end-of-stream": "^1.4.5",
"events": "^3.3.0",
"json-stable-stringify": "^1.3.0",
"klona": "^2.0.6",
"loglevel": "^1.9.2",
"once": "^1.4.0",
"pump": "^3.0.3",
Expand Down
13 changes: 7 additions & 6 deletions src/jrpc/errors/error-classes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,14 @@
};

if (this.data !== undefined) {
// `this.data` is not guaranteed to be a plain object, but this simplifies
// the type guard below. We can safely cast it because we know it's a
// JSON-serializable value.
serialized.data = this.data as { [key: string]: Json };

if (isPlainObject(this.data)) {
serialized.data.cause = serializeCause((this.data as { cause?: unknown }).cause);
// Spread to avoid mutating `this.data` when setting `cause`.
serialized.data = {
...(this.data as { [key: string]: Json }),
cause: serializeCause((this.data as { cause?: unknown }).cause),
};
} else {
serialized.data = this.data as { [key: string]: Json };
}
}

Expand All @@ -112,7 +113,7 @@

/**
* Error subclass implementing Ethereum Provider errors per EIP-1193.
* Permits integer error codes in the [ 1000 <= 4999 ] range.

Check warning on line 116 in src/jrpc/errors/error-classes.ts

View workflow job for this annotation

GitHub Actions / test (22.x, ubuntu-latest)

tsdoc-malformed-html-name: Invalid HTML element: Expecting an HTML name
*/
export class EthereumProviderError<Data extends OptionalDataWithOptionalCause> extends JsonRpcError<Data> {
/**
Expand Down
5 changes: 5 additions & 0 deletions src/jrpc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@ export { PostMessageStream } from "./postMessageStream";
export { SafeEventEmitter } from "./safeEventEmitter";
export { SerializableError } from "./serializableError";
export { Substream } from "./substream";

/**
* Export the v2 module.
*/
export * from "./v2";
1 change: 1 addition & 0 deletions src/jrpc/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface JRPCNotification<Params extends JRPCParams = JRPCParams> {
}

export interface JRPCRequest<Params extends JRPCParams = JRPCParams> extends JRPCBase {
id: JRPCId;
method: string;
params?: Params;
}
Expand Down
Loading
Loading