account.getPermission()
Get details of a previously granted permission.
Type: instance async
Signature
async getPermission(permissionId: Hex): Promise<WalletGrantPermissionsResponse>Parameters
permissionId
Type: Hex
The permission ID (hash) to fetch. This is the permissionId field returned from grantPermissions().
Returns
Promise<WalletGrantPermissionsResponse> - The permission details.
interface WalletGrantPermissionsResponse {
/** Smart account this permission is valid for */
account: Address;
/** Entity that can use this permission */
spender: Address;
/** Timestamp (in seconds) that specifies when this permission becomes valid */
start: number;
/** Timestamp (in seconds) that specifies the time by which this permission expires */
end: number;
/** Salt used for permission uniqueness (as hex string) */
salt: Hex;
/** Array of call permissions */
calls: CallPermissionDetail[];
/** Array of spend permissions */
spends: SpendPermissionDetail[];
/** Permission identifier - the permission hash from the contract */
permissionId: Hex;
/** Chain ID in hex format */
chainId: Hex;
}Behavior
- Fetches the permission from the JAW relay by ID
- Returns the full permission details in the same format as
grantPermissions() - Throws if the permission is not found
Example
import { Account } from '@jaw.id/core';
const account = await Account.get({
chainId: 1,
apiKey: 'your-api-key',
});
const permission = await account.getPermission(
'0x1234567890abcdef...' // Permission ID
);
console.log('Spender:', permission.spender);
console.log('Expires:', new Date(permission.end * 1000));
console.log('Call permissions:', permission.calls);
console.log('Spend permissions:', permission.spends);Related
- account.grantPermissions() - Grant new permissions
- account.revokePermission() - Revoke a permission
- Subscription Payments Guide - Learn about the permission system