diff --git a/src/handleProviderRequest.ts b/src/handleProviderRequest.ts index 63eb85a..5edec43 100644 --- a/src/handleProviderRequest.ts +++ b/src/handleProviderRequest.ts @@ -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, @@ -48,6 +52,7 @@ export const handleProviderRequest = ({ checkRateLimit, isSupportedChain, getActiveSession, + removeAppSession, getChainNativeCurrency, getProvider, messengerProviderRequest, @@ -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: ( @@ -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_') {