Skip to content

Commit 39dad34

Browse files
committed
lint
1 parent 082735b commit 39dad34

File tree

7 files changed

+24
-27
lines changed

7 files changed

+24
-27
lines changed

packages/multichain/src/adapters/caip-permission-adapter-session-scopes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CaipChainId, isCaipChainId, KnownCaipNamespace } from '@metamask/utils';
1+
import { type CaipChainId, isCaipChainId, KnownCaipNamespace } from '@metamask/utils';
22

33
import type { Caip25CaveatValue } from '../caip25Permission';
44
import {

packages/multichain/src/caip25Permission.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ type Caip25EndowmentCaveatSpecificationBuilderOptions = {
8080
* @param options - The specification builder options.
8181
* @param options.findNetworkClientIdByChainId - The hook for getting the networkClientId that serves a chainId.
8282
* @param options.listAccounts - The hook for getting internalAccount objects for all evm accounts.
83+
* @param options.isNonEvmScopeSupported - The hook that determines if an non EVM scopeString is supported.
84+
* @param options.getNonEvmAccountAddresses - The hook that returns the supported CAIP-10 account addresses for a non EVM scope.
8385
* @returns The specification for the `caip25` caveat.
8486
*/
8587
export const caip25CaveatBuilder = ({

packages/multichain/src/handlers/wallet-invokeMethod.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,15 @@ export type WalletInvokeMethodRequest = JsonRpcRequest & {
3535
* and instead uses the singular session for the origin if available.
3636
*
3737
* @param request - The request object.
38-
* @param _response - The response object. Unused.
38+
* @param response - The response object. Unused.
3939
* @param next - The next middleware function.
4040
* @param end - The end function.
4141
* @param hooks - The hooks object.
4242
* @param hooks.getCaveatForOrigin - the hook for getting a caveat from a permission for an origin.
4343
* @param hooks.findNetworkClientIdByChainId - the hook for finding the networkClientId for a chainId.
4444
* @param hooks.getSelectedNetworkClientId - the hook for getting the current globally selected networkClientId.
4545
* @param hooks.getNonEvmSupportedMethods - A function that returns the supported methods for a non EVM scope.
46+
* @param hooks.handleNonEvmRequestForOrigin - A function that sends a request to the MultichainRouter for processing.
4647
*/
4748
async function walletInvokeMethodHandler(
4849
request: WalletInvokeMethodRequest,
@@ -100,17 +101,15 @@ async function walletInvokeMethodHandler(
100101

101102
if (isEvmRequest) {
102103
let networkClientId;
103-
switch (namespace) {
104-
case 'wallet':
104+
if (namespace === KnownCaipNamespace.Wallet) {
105105
networkClientId = hooks.getSelectedNetworkClientId();
106-
break;
107-
case 'eip155':
108-
if (reference) {
109-
networkClientId = hooks.findNetworkClientIdByChainId(
110-
numberToHex(parseInt(reference, 10)),
111-
);
112-
}
113-
break;
106+
}
107+
else if (namespace === KnownCaipNamespace.Eip155) {
108+
if (reference) {
109+
networkClientId = hooks.findNetworkClientIdByChainId(
110+
numberToHex(parseInt(reference, 10)),
111+
);
112+
}
114113
}
115114

116115
if (!networkClientId) {

packages/multichain/src/scope/assert.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {
2-
CaipChainId,
2+
type CaipChainId,
33
hasProperty,
44
isCaipAccountId,
55
isCaipChainId,

packages/multichain/src/scope/filter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CaipChainId, type Hex } from '@metamask/utils';
1+
import type { CaipChainId, Hex } from '@metamask/utils';
22

33
import { assertIsInternalScopeString, assertScopeSupported } from './assert';
44
import { isSupportedMethod, isSupportedNotification } from './supported';

packages/multichain/src/scope/supported.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -372,10 +372,10 @@ describe('Scope Support', () => {
372372
});
373373

374374
it('gets the non-evm account addresses for the scope if wallet namespace with non-evm reference', () => {
375-
isSupportedAccount('wallet:nonevm:0xdeadbeef', {
376-
getEvmInternalAccounts,
377-
getNonEvmAccountAddresses
378-
}),
375+
isSupportedAccount('wallet:nonevm:0xdeadbeef', {
376+
getEvmInternalAccounts,
377+
getNonEvmAccountAddresses
378+
})
379379

380380
expect(getNonEvmAccountAddresses).toHaveBeenCalledWith('wallet:nonevm')
381381
});
@@ -404,7 +404,7 @@ describe('Scope Support', () => {
404404
isSupportedAccount('foo:bar:0xdeadbeef', {
405405
getEvmInternalAccounts,
406406
getNonEvmAccountAddresses
407-
}),
407+
})
408408

409409
expect(getNonEvmAccountAddresses).toHaveBeenCalledWith('foo:bar')
410410
});

packages/multichain/src/scope/supported.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@ export const isSupportedScopeString = (
3434
case KnownCaipNamespace.Wallet:
3535
if (!reference || reference === KnownCaipNamespace.Eip155) {
3636
return true
37-
} else {
38-
return isCaipChainId(scopeString) ? isNonEvmScopeSupported(scopeString) : false
3937
}
38+
return isCaipChainId(scopeString) ? isNonEvmScopeSupported(scopeString) : false
4039
case KnownCaipNamespace.Eip155:
4140
return (
4241
!reference ||
@@ -86,9 +85,8 @@ export const isSupportedAccount = (
8685
case KnownCaipNamespace.Wallet:
8786
if(reference === KnownCaipNamespace.Eip155) {
8887
return isSupportedEip155Account()
89-
} else {
90-
return isSupportedNonEvmAccount()
9188
}
89+
return isSupportedNonEvmAccount()
9290
case KnownCaipNamespace.Eip155:
9391
return isSupportedEip155Account();
9492
default:
@@ -127,17 +125,15 @@ export const isSupportedMethod = (
127125
if (reference) {
128126
if (reference === KnownCaipNamespace.Eip155) {
129127
return KnownWalletNamespaceRpcMethods[reference].includes(method);
130-
} else {
131-
return isSupportedNonEvmMethod()
132128
}
129+
return isSupportedNonEvmMethod()
133130
}
134131

135132
return KnownWalletRpcMethods.includes(method);
136133
} else if ( namespace === KnownCaipNamespace.Eip155) {
137134
return KnownRpcMethods[namespace].includes(method);
138-
} else {
139-
return isSupportedNonEvmMethod()
140135
}
136+
return isSupportedNonEvmMethod()
141137
};
142138

143139
/**

0 commit comments

Comments
 (0)