Skip to content

Commit

Permalink
devDeps: json-rpc-engine@^6.1.0 -> @metamask/[email protected]
Browse files Browse the repository at this point in the history
  • Loading branch information
legobeat committed Aug 22, 2023
1 parent 74eb0f9 commit 87e3e10
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"@metamask/eslint-config-jest": "^12.0.0",
"@metamask/eslint-config-nodejs": "^12.0.0",
"@metamask/eslint-config-typescript": "^12.0.0",
"@metamask/json-rpc-engine": "^7.0.0",
"@types/jest": "^29.1.2",
"@types/json-rpc-random-id": "^1.0.1",
"@types/node": "^17.0.23",
Expand All @@ -54,7 +55,6 @@
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.1.1",
"jest": "^29.1.2",
"json-rpc-engine": "^6.1.0",
"prettier": "^2.7.1",
"prettier-plugin-packagejson": "^2.2.11",
"rimraf": "^3.0.2",
Expand Down
6 changes: 3 additions & 3 deletions src/PollingBlockTracker.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { SafeEventEmitterProvider } from '@metamask/eth-json-rpc-provider';
import SafeEventEmitter from '@metamask/safe-event-emitter';
import type { JsonRpcRequest } from 'json-rpc-engine';
import type { JsonRpcRequest } from '@metamask/utils';
import getCreateRandomId from 'json-rpc-random-id';
import pify from 'pify';

Expand All @@ -25,7 +25,7 @@ export interface PollingBlockTrackerOptions {
usePastBlocks?: boolean;
}

interface ExtendedJsonRpcRequest<T> extends JsonRpcRequest<T> {
interface ExtendedJsonRpcRequest extends JsonRpcRequest<[]> {
skipCache?: boolean;
}

Expand Down Expand Up @@ -283,7 +283,7 @@ export class PollingBlockTracker
}

private async _fetchLatestBlock(): Promise<string> {
const req: ExtendedJsonRpcRequest<[]> = {
const req: ExtendedJsonRpcRequest = {
jsonrpc: '2.0',
id: createRandomId(),
method: 'eth_blockNumber',
Expand Down
11 changes: 8 additions & 3 deletions src/SubscribeBlockTracker.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import type { SafeEventEmitterProvider } from '@metamask/eth-json-rpc-provider';
import SafeEventEmitter from '@metamask/safe-event-emitter';
import type { JsonRpcNotification, JsonRpcSuccess } from 'json-rpc-engine';
import type {
Json,
JsonRpcNotification,
JsonRpcSuccess,
} from '@metamask/utils';
import getCreateRandomId from 'json-rpc-random-id';

import type { BlockTracker } from './BlockTracker';
Expand All @@ -20,6 +24,7 @@ export interface SubscribeBlockTrackerOptions {
}

interface SubscriptionNotificationParams {
[key: string]: Json;
subscription: string;
result: { number: string };
}
Expand Down Expand Up @@ -250,7 +255,7 @@ export class SubscribeBlockTracker
}
}

private async _call(method: string, ...params: unknown[]): Promise<unknown> {
private async _call(method: string, ...params: Json[]): Promise<unknown> {
return new Promise((resolve, reject) => {
this._provider.sendAsync(
{
Expand All @@ -263,7 +268,7 @@ export class SubscribeBlockTracker
if (err) {
reject(err);
} else {
resolve((res as JsonRpcSuccess<unknown>).result);
resolve((res as JsonRpcSuccess<Json>).result);
}
},
);
Expand Down
8 changes: 4 additions & 4 deletions tests/withBlockTracker.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { providerFromEngine } from '@metamask/eth-json-rpc-provider';
import type { SafeEventEmitterProvider } from '@metamask/eth-json-rpc-provider';
import type { JsonRpcRequest, JsonRpcResponse } from 'json-rpc-engine';
import { JsonRpcEngine } from 'json-rpc-engine';
import { JsonRpcEngine } from '@metamask/json-rpc-engine';
import type { JsonRpcRequest, JsonRpcResponse } from '@metamask/utils';
import util from 'util';

import type {
Expand Down Expand Up @@ -122,8 +122,8 @@ function getFakeProvider({
.spyOn(provider, 'sendAsync')
.mockImplementation(
(
request: JsonRpcRequest<unknown>,
callback: (err: unknown, response?: JsonRpcResponse<unknown>) => void,
request: JsonRpcRequest,
callback: (err: unknown, response?: JsonRpcResponse<any>) => void,
) => {
const index = stubs.findIndex(
(stub) => stub.methodName === request.method,
Expand Down
28 changes: 28 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,23 @@
"@metamask/safe-event-emitter" "^2.0.0"
json-rpc-engine "^6.1.0"

"@metamask/json-rpc-engine@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/@metamask/json-rpc-engine/-/json-rpc-engine-7.0.0.tgz#5110d7e90a75aab4e515621fafff5adf7174b6e3"
integrity sha512-qIfQvEOD3vFMZpXQUcXjuVDnkznzjARRSa9mUjZnYImhoxgvPdTery31I+zkRuksNLffvJc08SL2cQaC3uVfYA==
dependencies:
"@metamask/rpc-errors" "^5.0.0"
"@metamask/safe-event-emitter" "^2.0.0"
"@metamask/utils" "^5.0.1"

"@metamask/rpc-errors@^5.0.0":
version "5.1.1"
resolved "https://registry.yarnpkg.com/@metamask/rpc-errors/-/rpc-errors-5.1.1.tgz#f82732ad0952d34d219eca42699c0c74bee95a9e"
integrity sha512-JjZnDi2y2CfvbohhBl+FOQRzmFlJpybcQlIk37zEX8B96eVSPbH/T8S0p7cSF8IE33IWx6JkD8Ycsd+2TXFxCw==
dependencies:
"@metamask/utils" "^5.0.0"
fast-safe-stringify "^2.0.6"

"@metamask/safe-event-emitter@^2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@metamask/safe-event-emitter/-/safe-event-emitter-2.0.0.tgz#af577b477c683fad17c619a78208cede06f9605c"
Expand All @@ -811,6 +828,17 @@
resolved "https://registry.yarnpkg.com/@metamask/safe-event-emitter/-/safe-event-emitter-3.0.0.tgz#8c2b9073fe0722d48693143b0dc8448840daa3bd"
integrity sha512-j6Z47VOmVyGMlnKXZmL0fyvWfEYtKWCA9yGZkU3FCsGZUT5lHGmvaV9JA5F2Y+010y7+ROtR3WMXIkvl/nVzqQ==

"@metamask/utils@^5.0.0", "@metamask/utils@^5.0.1":
version "5.0.2"
resolved "https://registry.yarnpkg.com/@metamask/utils/-/utils-5.0.2.tgz#140ba5061d90d9dac0280c19cab101bc18c8857c"
integrity sha512-yfmE79bRQtnMzarnKfX7AEJBwFTxvTyw3nBQlu/5rmGXrjAeAMltoGxO62TFurxrQAFMNa/fEjIHNvungZp0+g==
dependencies:
"@ethereumjs/tx" "^4.1.2"
"@types/debug" "^4.1.7"
debug "^4.3.4"
semver "^7.3.8"
superstruct "^1.0.3"

"@metamask/utils@^7.1.0":
version "7.1.0"
resolved "https://registry.yarnpkg.com/@metamask/utils/-/utils-7.1.0.tgz#0eb60de7608391a469b24320510c003dd4774b70"
Expand Down

0 comments on commit 87e3e10

Please sign in to comment.