> For the complete documentation index, see [llms.txt](https://help.tokenpocket.pro/developer-en/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.tokenpocket.pro/developer-en/agentic-wallet/eip-7715-account-with-permissions/query-supported-permission-types.md).

# Query Supported Permission Types

Use `wallet_getSupportedExecutionPermissions` to retrieve the permission types currently supported by TokenPocket, applicable chain IDs, and bindable rule types. It is recommended to call this before initiating authorization to avoid requesting an unsupported `permission.type` or `chainId`.

### RPC Method <a href="#rpc-method" id="rpc-method"></a>

```
wallet_getSupportedExecutionPermissions
```

#### Request <a href="#request" id="request"></a>

```typescript
const result = await provider.request({
  method: "wallet_getSupportedExecutionPermissions",
  params: [],
});
```

#### Response Structure <a href="#response-structure" id="response-structure"></a>

```typescript
type GetSupportedExecutionPermissionsResult = Record<
  string, // permission type
  {
    chainIds: `0x${string}`[];
    ruleTypes: string[]; // 如 ['expiry']
  }
>;
```

#### Response Example <a href="#response-example" id="response-example"></a>

```json
{
  "erc20-token-periodic": {
    "chainIds": ["0x1", "0x38", "0x89"],
    "ruleTypes": ["expiry"]
  },
  "native-token-periodic": {
    "chainIds": ["0x1", "0x38"],
    "ruleTypes": ["expiry"]
  },
  "erc20-token-stream": {
    "chainIds": ["0x38", "0x89"],
    "ruleTypes": ["expiry"]
  },
  "native-token-stream": {
    "chainIds": ["0x38"],
    "ruleTypes": ["expiry"]
  }
}
```

> The above is an illustrative structure; the actual return value depends on the wallet version and chain configuration.

### Capability Probe Example <a href="#capability-probe-example" id="capability-probe-example"></a>

Validate the target chain and permission type before initiating authorization:

```typescript
const toHexChainId = (id: number) => `0x${id.toString(16)}` as `0x${string}`;

async function assertPermissionSupported(
  provider: {
    request: (args: { method: string; params: unknown[] }) => Promise<unknown>;
  },
  permissionType: string,
  chainId: number,
) {
  const supported = (await provider.request({
    method: "wallet_getSupportedExecutionPermissions",
    params: [],
  })) as Record<string, { chainIds: string[]; ruleTypes: string[] }>;

  const entry = supported[permissionType];
  if (!entry) {
    throw new Error(`Not supported: ${permissionType}`);
  }

  const chainHex = toHexChainId(chainId).toLowerCase();
  const supportedChains = entry.chainIds.map((id) => id.toLowerCase());

  if (!supportedChains.includes(chainHex)) {
    throw new Error(`${permissionType} don't support chainId ${chainId}`);
  }

  return entry;
}
```
