Skip to content

Commit

Permalink
Improve typing
Browse files Browse the repository at this point in the history
  • Loading branch information
FrederikBolding committed Dec 13, 2024
1 parent 5d70af9 commit 0c62acf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
8 changes: 6 additions & 2 deletions packages/snaps-controllers/src/multichain/MultichainRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ import {
import type { Json, JsonRpcRequest, SnapId } from '@metamask/snaps-sdk';
import type { Caip2ChainId } from '@metamask/snaps-utils';
import { HandlerType } from '@metamask/snaps-utils';
import type { CaipAccountId, CaipChainId } from '@metamask/utils';
import type {
CaipAccountId,
CaipChainId,
JsonRpcParams,
} from '@metamask/utils';
import { hasProperty, parseCaipAccountId } from '@metamask/utils';

import { getRunnableSnaps } from '../snaps';
Expand Down Expand Up @@ -245,7 +249,7 @@ export class MultichainRouter {
scope,
request: {
method,
params,
params: params as JsonRpcParams,
},
}),
);
Expand Down
12 changes: 6 additions & 6 deletions packages/snaps-controllers/src/test-utils/multichain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { PermissionConstraint } from '@metamask/permission-controller';
import { SnapEndowments } from '@metamask/snaps-rpc-methods';
import { SnapCaveatType } from '@metamask/snaps-utils';
import { MOCK_SNAP_ID } from '@metamask/snaps-utils/test-utils';
import type { CaipAccountId, CaipChainId } from '@metamask/utils';
import type { CaipAccountId, CaipChainId, Json } from '@metamask/utils';

export const BTC_CAIP2 =
'bip122:000000000019d6689c085ae165831e93' as CaipChainId;
Expand Down Expand Up @@ -89,13 +89,13 @@ export const MOCK_SOLANA_SNAP_PERMISSIONS: Record<
};

type MockSnapKeyring = {
submitRequest: (request: unknown) => Promise<unknown>;
resolveAccountAddress: (options: unknown) => Promise<unknown>;
submitRequest: (request: unknown) => Promise<Json>;
resolveAccountAddress: (
options: unknown,
) => Promise<{ address: CaipAccountId } | null>;
};

type MockOperationCallback = <ReturnType>(
keyring: MockSnapKeyring,
) => Promise<ReturnType>;
type MockOperationCallback = (keyring: MockSnapKeyring) => Promise<Json>;

export const getMockWithSnapKeyring = (
{ submitRequest = jest.fn(), resolveAccountAddress = jest.fn() } = {
Expand Down

0 comments on commit 0c62acf

Please sign in to comment.