@@ -289,6 +289,8 @@ export default class GatorPermissionsController extends BaseController<
289289 }
290290
291291 #registerMessageHandlers( ) : void {
292+ console . log ( '[GatorPermissionsController] Registering message handlers...' ) ;
293+
292294 this . messagingSystem . registerActionHandler (
293295 `${ controllerName } :fetchAndUpdateGatorPermissions` ,
294296 this . fetchAndUpdateGatorPermissions . bind ( this ) ,
@@ -309,10 +311,18 @@ export default class GatorPermissionsController extends BaseController<
309311 this . decodePermissionFromPermissionContextForOrigin . bind ( this ) ,
310312 ) ;
311313
314+ const submitRevocationAction = `${ controllerName } :submitRevocation` ;
315+ console . log (
316+ '[GatorPermissionsController] Registering submitRevocation action:' ,
317+ submitRevocationAction ,
318+ ) ;
312319 this . messagingSystem . registerActionHandler (
313- ` ${ controllerName } :submitRevocation` ,
320+ submitRevocationAction ,
314321 this . submitRevocation . bind ( this ) ,
315322 ) ;
323+ console . log (
324+ '[GatorPermissionsController] submitRevocation action registered successfully' ,
325+ ) ;
316326 }
317327
318328 /**
@@ -617,18 +627,57 @@ export default class GatorPermissionsController extends BaseController<
617627 /**
618628 * Submits a revocation to the gator permissions provider snap.
619629 *
620- * @param revocationParams - The revocation parameters containing the delegation hash .
630+ * @param revocationParams - The revocation parameters containing the permission context .
621631 * @returns A promise that resolves when the revocation is submitted successfully.
622632 * @throws {GatorPermissionsNotEnabledError } If the gator permissions are not enabled.
623633 * @throws {GatorPermissionsProviderError } If the snap request fails.
624634 */
625635 public async submitRevocation (
626636 revocationParams : RevocationParams ,
627637 ) : Promise < void > {
628- this . #assertGatorPermissionsEnabled( ) ;
638+ console . log (
639+ '[GatorPermissionsController] submitRevocation called with permissionContext:' ,
640+ revocationParams . permissionContext ,
641+ ) ;
642+ controllerLog ( 'submitRevocation method called' , {
643+ permissionContext : revocationParams . permissionContext ,
644+ } ) ;
645+
646+ console . log (
647+ '[GatorPermissionsController] Checking if gator permissions are enabled...' ,
648+ ) ;
649+ console . log (
650+ '[GatorPermissionsController] isGatorPermissionsEnabled:' ,
651+ this . state . isGatorPermissionsEnabled ,
652+ ) ;
629653
630654 try {
631- await this . messagingSystem . call ( 'SnapController:handleRequest' , {
655+ this . #assertGatorPermissionsEnabled( ) ;
656+ console . log (
657+ '[GatorPermissionsController] Gator permissions are enabled, proceeding...' ,
658+ ) ;
659+ } catch ( error ) {
660+ console . error (
661+ '[GatorPermissionsController] Gator permissions not enabled:' ,
662+ error ,
663+ ) ;
664+ throw error ;
665+ }
666+
667+ console . log ( '[GatorPermissionsController] Preparing snap request...' ) ;
668+ console . log (
669+ '[GatorPermissionsController] snapId:' ,
670+ this . state . gatorPermissionsProviderSnapId ,
671+ ) ;
672+ console . log (
673+ '[GatorPermissionsController] method:' ,
674+ GatorPermissionsSnapRpcMethod . PermissionProviderSubmitRevocation ,
675+ ) ;
676+
677+ try {
678+ console . log ( '[GatorPermissionsController] Making snap request...' ) ;
679+
680+ const snapRequest = {
632681 snapId : this . state . gatorPermissionsProviderSnapId ,
633682 origin : 'metamask' ,
634683 handler : HandlerType . OnRpcRequest ,
@@ -638,11 +687,33 @@ export default class GatorPermissionsController extends BaseController<
638687 GatorPermissionsSnapRpcMethod . PermissionProviderSubmitRevocation ,
639688 params : revocationParams ,
640689 } ,
641- } ) ;
690+ } ;
691+
692+ console . log (
693+ '[GatorPermissionsController] Snap request payload:' ,
694+ JSON . stringify ( snapRequest , null , 2 ) ,
695+ ) ;
642696
643- controllerLog ( 'Successfully submitted revocation' , revocationParams ) ;
697+ const result = await this . messagingSystem . call (
698+ 'SnapController:handleRequest' ,
699+ snapRequest ,
700+ ) ;
701+
702+ console . log (
703+ '[GatorPermissionsController] Snap request successful, result:' ,
704+ result ,
705+ ) ;
706+ controllerLog ( 'Successfully submitted revocation' , {
707+ permissionContext : revocationParams . permissionContext ,
708+ result,
709+ } ) ;
644710 } catch ( error ) {
645- controllerLog ( 'Failed to submit revocation' , error ) ;
711+ console . error ( '[GatorPermissionsController] Snap request failed:' , error ) ;
712+ controllerLog ( 'Failed to submit revocation' , {
713+ error,
714+ permissionContext : revocationParams . permissionContext ,
715+ } ) ;
716+
646717 throw new GatorPermissionsProviderError ( {
647718 method :
648719 GatorPermissionsSnapRpcMethod . PermissionProviderSubmitRevocation ,
0 commit comments