> For the complete documentation index, see [llms.txt](https://help.tokenpocket.pro/developer-cn/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-cn/agentic-wallet/eip-7715-account-with-permissions/cha-xun-zhi-chi-de-quan-xian-lei-xing.md).

# 查询支持的权限类型

使用 `wallet_getSupportedExecutionPermissions` 获取 TokenPocket 当前支持的权限类型、适用链 ID 及可绑定的规则类型。建议在发起授权前调用，避免请求不支持的 `permission.type` 或 `chainId`。

### RPC 方法 <a href="#rpc-e6-96-b9-e6-b3-95" id="rpc-e6-96-b9-e6-b3-95"></a>

```
wallet_getSupportedExecutionPermissions
```

#### 请求 <a href="#e8-af-b7-e6-b1-82" id="e8-af-b7-e6-b1-82"></a>

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

#### 响应结构 <a href="#e5-93-8d-e5-ba-94-e7-bb-93-e6-9e-84" id="e5-93-8d-e5-ba-94-e7-bb-93-e6-9e-84"></a>

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

#### 响应示例 <a href="#e5-93-8d-e5-ba-94-e7-a4-ba-e4-be-8b" id="e5-93-8d-e5-ba-94-e7-a4-ba-e4-be-8b"></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"]
  }
}
```

> 以上为示意结构，实际返回值以钱包版本与链配置为准。

### 能力探测示例 <a href="#e8-83-bd-e5-8a-9b-e6-8e-a2-e6-b5-8b-e7-a4-ba-e4-be-8b" id="e8-83-bd-e5-8a-9b-e6-8e-a2-e6-b5-8b-e7-a4-ba-e4-be-8b"></a>

在发起授权前校验目标链与权限类型：

```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(`钱包不支持权限类型: ${permissionType}`);
  }

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

  if (!supportedChains.includes(chainHex)) {
    throw new Error(`权限 ${permissionType} 不支持 chainId ${chainId}`);
  }

  return entry;
}
```
