Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

account.revokePermission()

Revoke a previously granted permission.

Type: instance async

Signature

async revokePermission(
  permissionId: Hex,
  paymasterUrlOverride?: string,
  paymasterContextOverride?: Record<string, unknown>,
  address?: Address
): Promise<RevokePermissionApiResponse>

Parameters

permissionId

Type: Hex

The permission ID (hash) to revoke. This is the id field returned from grantPermissions().

paymasterUrlOverride (optional)

Type: string

Custom paymaster URL for gas sponsorship or ERC-20 token payment.

paymasterContextOverride (optional)

Type: Record<string, unknown>

Custom paymaster context.

address (optional)

Type: Address

Target account address to revoke the permission on. The signer must be a registered owner on that account.

Returns

Promise<RevokePermissionApiResponse> - The revocation response.

interface RevokePermissionApiResponse {
  /** Whether the revocation was successful */
  success: boolean;
  /** Transaction hash if on-chain revocation was needed */
  transactionHash?: Hex;
}

Behavior

  1. Sends a revocation request to the JAW relay
  2. Signs the revocation with the smart account
  3. The permission is invalidated and can no longer be used
  4. Returns confirmation of the revocation

Example

import { Account } from '@jaw.id/core';
 
const account = await Account.get({
  chainId: 1,
  apiKey: 'your-api-key',
});
 
// Revoke a permission by its ID
const response = await account.revokePermission(
  '0x1234567890abcdef...' // Permission ID from grantPermissions()
);
 
if (response.success) {
  console.log('Permission revoked successfully');
} else {
  console.log('Revocation failed');
}

Related