Skip to content

Commit 849a61d

Browse files
committed
Bump @metamask/utils to ^11.7.0
The only change that affects this package is in 11.3.0, where some types were changed so that if they take a type parameter that `extends Json`, they default to `Json` itself. Because of our lint rules that forced some changes in this PR itself. There should be no backward-incompatible changes, however. `object` is deprecated, so we do need to adapt to that at some point, but we can address that in a future PR.
1 parent 815f352 commit 849a61d

13 files changed

+44
-43
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
- **BREAKING:** `createFetchMiddleware` no longer takes `fetch`, `btoa`, `rpcUrl`, and `originHttpHeaderKey` ([#402](https://github.com/MetaMask/eth-json-rpc-middleware/pull/402))
1313
- The existing signature (`rpcService` and `options`) is now the only way to use this function; please use that instead.
14+
- Bump `@metamask/utils` to `^11.7.0` ([#404](https://github.com/MetaMask/eth-json-rpc-middleware/pull/404))
1415

1516
### Removed
1617

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"@metamask/json-rpc-engine": "^10.0.2",
3636
"@metamask/rpc-errors": "^7.0.2",
3737
"@metamask/superstruct": "^3.1.0",
38-
"@metamask/utils": "^11.1.0",
38+
"@metamask/utils": "^11.7.0",
3939
"@types/bn.js": "^5.1.5",
4040
"bn.js": "^5.2.1",
4141
"klona": "^2.0.6",

src/block-tracker-inspector.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function hasProperty<ObjectToCheck, Property extends ValidPropertyType>(
3939
}
4040

4141
function getResultBlockNumber(
42-
response: PendingJsonRpcResponse<Json>,
42+
response: PendingJsonRpcResponse,
4343
): string | undefined {
4444
const { result } = response;
4545
if (

src/inflight-cache.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { projectLogger, createModuleLogger } from './logging-utils';
1010
import type { JsonRpcRequestToCache, JsonRpcCacheMiddleware } from './types';
1111
import { cacheIdentifierForRequest } from './utils/cache';
1212

13-
type RequestHandlers = (handledRes: PendingJsonRpcResponse<Json>) => void;
13+
type RequestHandlers = (handledRes: PendingJsonRpcResponse) => void;
1414
interface InflightRequest {
1515
[cacheId: string]: RequestHandlers[];
1616
}
@@ -72,11 +72,11 @@ export function createInflightCacheMiddleware(): JsonRpcCacheMiddleware<
7272
);
7373

7474
async function createActiveRequestHandler(
75-
res: PendingJsonRpcResponse<Json>,
75+
res: PendingJsonRpcResponse,
7676
activeRequestHandlers: RequestHandlers[],
7777
): Promise<void> {
7878
const { resolve, promise } = deferredPromise();
79-
activeRequestHandlers.push((handledRes: PendingJsonRpcResponse<Json>) => {
79+
activeRequestHandlers.push((handledRes: PendingJsonRpcResponse) => {
8080
// append a copy of the result and error to the response
8181
res.result = klona(handledRes.result);
8282
res.error = klona(handledRes.error);
@@ -86,7 +86,7 @@ export function createInflightCacheMiddleware(): JsonRpcCacheMiddleware<
8686
}
8787

8888
function handleActiveRequest(
89-
res: PendingJsonRpcResponse<Json>,
89+
res: PendingJsonRpcResponse,
9090
activeRequestHandlers: RequestHandlers[],
9191
): void {
9292
// use setTimeout so we can resolve our original request first

src/methods/wallet-get-calls-status.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export type GetCallsStatusHook = (
5151

5252
export async function walletGetCallsStatus(
5353
req: JsonRpcRequest,
54-
res: PendingJsonRpcResponse<Json>,
54+
res: PendingJsonRpcResponse,
5555
{
5656
getCallsStatus,
5757
}: {

src/methods/wallet-get-capabilities.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export type GetCapabilitiesHook = (
3030

3131
export async function walletGetCapabilities(
3232
req: JsonRpcRequest,
33-
res: PendingJsonRpcResponse<Json>,
33+
res: PendingJsonRpcResponse,
3434
{
3535
getAccounts,
3636
getCapabilities,

src/methods/wallet-request-execution-permissions.test.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import type {
2-
Json,
3-
JsonRpcRequest,
4-
PendingJsonRpcResponse,
5-
} from '@metamask/utils';
1+
import type { JsonRpcRequest, PendingJsonRpcResponse } from '@metamask/utils';
62
import { klona } from 'klona';
73

84
import type {
@@ -70,7 +66,7 @@ const RESULT_MOCK: RequestExecutionPermissionsResult = [
7066
describe('wallet_requestExecutionPermissions', () => {
7167
let request: JsonRpcRequest;
7268
let params: RequestExecutionPermissionsRequestParams;
73-
let response: PendingJsonRpcResponse<Json>;
69+
let response: PendingJsonRpcResponse;
7470
let processRequestExecutionPermissionsMock: jest.MockedFunction<ProcessRequestExecutionPermissionsHook>;
7571

7672
async function callMethod() {
@@ -85,7 +81,7 @@ describe('wallet_requestExecutionPermissions', () => {
8581

8682
request = klona(REQUEST_MOCK);
8783
params = request.params as RequestExecutionPermissionsRequestParams;
88-
response = {} as PendingJsonRpcResponse<Json>;
84+
response = {} as PendingJsonRpcResponse;
8985

9086
processRequestExecutionPermissionsMock = jest.fn();
9187
processRequestExecutionPermissionsMock.mockResolvedValue(RESULT_MOCK);

src/methods/wallet-request-execution-permissions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export type ProcessRequestExecutionPermissionsHook = (
6868

6969
export async function walletRequestExecutionPermissions(
7070
req: JsonRpcRequest,
71-
res: PendingJsonRpcResponse<Json>,
71+
res: PendingJsonRpcResponse,
7272
{
7373
processRequestExecutionPermissions,
7474
}: {

src/methods/wallet-revoke-execution-permission.test.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import type {
2-
Json,
3-
JsonRpcRequest,
4-
PendingJsonRpcResponse,
5-
} from '@metamask/utils';
1+
import type { JsonRpcRequest, PendingJsonRpcResponse } from '@metamask/utils';
62
import { klona } from 'klona';
73

84
import type {
@@ -22,7 +18,7 @@ const REQUEST_MOCK = {
2218
describe('wallet_revokeExecutionPermission', () => {
2319
let request: JsonRpcRequest<RevokeExecutionPermissionRequestParams>;
2420
let params: RevokeExecutionPermissionRequestParams;
25-
let response: PendingJsonRpcResponse<Json>;
21+
let response: PendingJsonRpcResponse;
2622
let processRevokeExecutionPermissionMock: jest.MockedFunction<ProcessRevokeExecutionPermissionHook>;
2723

2824
async function callMethod() {
@@ -36,7 +32,7 @@ describe('wallet_revokeExecutionPermission', () => {
3632

3733
request = klona(REQUEST_MOCK);
3834
params = request.params as RevokeExecutionPermissionRequestParams;
39-
response = {} as PendingJsonRpcResponse<Json>;
35+
response = {} as PendingJsonRpcResponse;
4036

4137
processRevokeExecutionPermissionMock = jest.fn();
4238
processRevokeExecutionPermissionMock.mockResolvedValue({});

src/methods/wallet-revoke-execution-permission.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { rpcErrors } from '@metamask/rpc-errors';
22
import type { Infer } from '@metamask/superstruct';
33
import {
4-
type Json,
54
type JsonRpcRequest,
65
object,
76
type PendingJsonRpcResponse,
@@ -31,7 +30,7 @@ export type ProcessRevokeExecutionPermissionHook = (
3130

3231
export async function walletRevokeExecutionPermission(
3332
req: JsonRpcRequest,
34-
res: PendingJsonRpcResponse<Json>,
33+
res: PendingJsonRpcResponse,
3534
{
3635
processRevokeExecutionPermission,
3736
}: {

0 commit comments

Comments
 (0)