# wallet_fetchPermissions Proposal As we've been building out session keys for Coinbase Smart Wallet, we've felt that there has been something missing: the ability for developers to fetch information about previously granted permissions. This document proposes a new RPC that interacts with the [wallet server](https://hackmd.io/@lsr/H1ALRaPsR#The-Wallet-Server-Model) to provide this information. ## Specification Accepts a user's address and a signer ID. A signer ID is obtainted by: ```typescript! keccak256( utf8ToHex( JSON.stringify( canonicalize( permissionsRequest.signer ) ) ) ) ``` where `canonicalize` is an [RFC 8785](https://www.rfc-editor.org/rfc/rfc8785) canonicalization. The rationale for the specified `signerId` is: - Wallet servers will want to query for permissions given a specific signer. - Querying will be made easier if we can assume all signers can be identified by a uniform 32 byte string. #### Parameters ```typescript! type FetchPermissionsParams = { address: `0x${string}` signerId: `0x${string}` } ``` ##### Example Parameters ```typescript! wallet_fetchPermissions({ address: '0x...', signerId: '0x...' }) ``` #### Return Value ```typescript! type FetchPermissionsReturnValue = (PermissionResponse & { state: { type: string; data: Record<string, any> } })[] ``` ##### Example Return Value ```typescript! [ { signer: { type: 'key', data: { ... } }, permissions: [ { type: 'native-token-recurring-allowance', data: { allowance: '0x...', start: 124, period: 125 }, }, { type: 'erc20-recurring-allowance', data: { token: '0x...', allowance: '0x...', start: 124, period: 125 } } ], context: '0x...', state: [ { type: 'native-token-recurring-allowance', data: { remainingAllowance: '0x...', cycleStart: 123, cycleEnd: 124 } }, { type: 'erc20-recurring-allowance', data: { token: '0x...', remainingAllowance: '0x...', cycleStart: 123, cycleEnd: 124 } } ] } ] ``` The above example shows a single granted permission along with its state. If applicable, every permission type definition should include a definition for its state.