Skip to content

Commit

Permalink
wallet_revokePermissions
Browse files Browse the repository at this point in the history
  • Loading branch information
estebanmino committed Jun 13, 2024
1 parent 23c3e31 commit 43f8764
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/handleProviderRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ import { toHex } from './utils/hex';
import { errorCodes } from './references/errorCodes';
import { ChainNativeCurrency } from 'viem/_types/types/chain';

interface WalletPermissionsParams {
eth_accounts: object;
}

const buildError = ({
id,
message,
Expand Down Expand Up @@ -48,6 +52,7 @@ export const handleProviderRequest = ({
checkRateLimit,
isSupportedChain,
getActiveSession,
removeAppSession,
getChainNativeCurrency,
getProvider,
messengerProviderRequest,
Expand All @@ -68,6 +73,7 @@ export const handleProviderRequest = ({
}) => Promise<{ id: number; error: Error } | undefined>;
isSupportedChain: (chainId: number) => boolean;
getActiveSession: ({ host }: { host: string }) => ActiveSession;
removeAppSession?: ({ host }: { host: string }) => void;
getChainNativeCurrency: (chainId: number) => ChainNativeCurrency | undefined;
getProvider: (options: { chainId?: number }) => Provider;
messengerProviderRequest: (
Expand Down Expand Up @@ -458,6 +464,16 @@ export const handleProviderRequest = ({
});
break;
}
case 'wallet_revokePermissions': {
if (
!!removeAppSession &&
(params?.[0] as WalletPermissionsParams)?.eth_accounts
) {
removeAppSession?.({ host });
response = null;
}
throw new Error('next');
}
default: {
try {
if (method?.substring(0, 7) === 'wallet_') {
Expand Down

0 comments on commit 43f8764

Please sign in to comment.