@@ -139,62 +139,96 @@ export function createRpcHandler(config: {
139139 * @returns Success confirmation.
140140 */
141141 const submitRevocation = async ( params : Json ) : Promise < Json > => {
142- logger . debug ( 'submitRevocation()' , params ) ;
142+ console . log ( '================================================2' ) ;
143+ logger . debug ( '=== SUBMIT REVOCATION RPC CALLED ===' ) ;
144+ logger . debug ( 'submitRevocation() called with params:' , params ) ;
145+ logger . debug ( 'Params type:' , typeof params ) ;
146+ logger . debug ( 'Params stringified:' , JSON . stringify ( params , null , 2 ) ) ;
143147
144148 const { delegationHash } = validateRevocationParams ( params ) ;
149+ logger . debug ( 'Validated delegationHash:' , delegationHash ) ;
145150
146151 // First, get the existing permission to validate it exists
152+ logger . debug (
153+ 'Looking up existing permission for delegationHash:' ,
154+ delegationHash ,
155+ ) ;
147156 const existingPermission =
148157 await profileSyncManager . getGrantedPermissionByDelegationHash (
149158 delegationHash ,
150159 ) ;
151160
152161 if ( ! existingPermission ) {
162+ logger . debug (
163+ '❌ Permission not found for delegationHash:' ,
164+ delegationHash ,
165+ ) ;
153166 throw new InvalidInputError (
154167 `Permission not found for delegation hash: ${ delegationHash } ` ,
155168 ) ;
156169 }
157170
171+ logger . debug ( '✅ Found existing permission:' , {
172+ delegationHash,
173+ isRevoked : existingPermission . isRevoked ,
174+ siteOrigin : existingPermission . siteOrigin ,
175+ } ) ;
176+
158177 // Extract delegationManager and chainId from the permission response for logging
159178 const { chainId : permissionChainId , signerMeta } =
160179 existingPermission . permissionResponse ;
161180 const { delegationManager } = signerMeta ;
162181
163- logger . debug (
164- `Found permission - chainId: ${ permissionChainId } , delegationManager: ${ delegationManager ?? 'undefined' } ` ,
165- ) ;
182+ logger . debug ( 'Permission details extracted:' , {
183+ chainId : permissionChainId ,
184+ delegationManager : delegationManager ?? 'undefined' ,
185+ signerMeta : signerMeta ,
186+ } ) ;
166187
167188 // Check if the delegation is actually disabled on-chain
168189 if ( ! delegationManager ) {
190+ logger . debug ( '❌ No delegation manager found' ) ;
169191 throw new InvalidInputError (
170192 `No delegation manager found for delegation hash: ${ delegationHash } ` ,
171193 ) ;
172194 }
173195
196+ logger . debug ( 'Checking if delegation is disabled on-chain...' , {
197+ delegationHash,
198+ chainId : permissionChainId ,
199+ delegationManager,
200+ } ) ;
201+
174202 const isDelegationDisabled =
175203 await profileSyncManager . checkDelegationDisabledOnChain (
176204 delegationHash ,
177205 permissionChainId ,
178206 delegationManager ,
179207 ) ;
180208
209+ logger . debug ( 'On-chain check result:' , { isDelegationDisabled } ) ;
210+
181211 if ( ! isDelegationDisabled ) {
212+ logger . debug ( '❌ Delegation is not disabled on-chain' ) ;
182213 throw new InvalidInputError (
183214 `Delegation ${ delegationHash } is not disabled on-chain. Cannot process revocation.` ,
184215 ) ;
185216 }
186217
187218 logger . debug (
188- `Processing revocation for delegation ${ delegationHash } - validated on-chain` ,
219+ '✅ Delegation is disabled on-chain, proceeding with revocation' ,
189220 ) ;
190221
191222 // Update the permission's revocation status using the optimized method
192223 // This avoids re-fetching the permission we already have
224+ logger . debug ( 'Updating permission revocation status to true...' ) ;
193225 await profileSyncManager . updatePermissionRevocationStatusWithPermission (
194226 existingPermission ,
195227 true ,
196228 ) ;
197229
230+ logger . debug ( '✅ Revocation completed successfully' ) ;
231+ logger . debug ( '=== SUBMIT REVOCATION RPC COMPLETED ===' ) ;
198232 return { success : true } ;
199233 } ;
200234
0 commit comments