For the complete documentation index, see llms.txt. This page is also available as Markdown.

使用权限执行交易

用户通过 wallet_requestExecutionPermissions 授权后,Session Accountto 地址)可调用 DelegationManager 的 redeemDelegations,在权限约束内代用户执行链上操作。本节说明如何构造并发送 redeem 交易。

前置条件

  1. 已获得 PermissionResponse(含 contextdelegationManager)。

  2. Session Account 私钥可用,且地址等于授权中的 to

  3. 执行链与授权 chainId 一致。

核心合约接口(EIP-7710)

function redeemDelegations(
  bytes[] calldata permissionContexts,
  bytes32[] calldata modes,
  bytes[] calldata executionCallDatas
) external;
参数
说明

permissionContexts

[grant.context]

modes

执行模式,单笔默认 0x0000...0000(32 字节零)

executionCallDatas

编码后的 Execution 结构

Execution 编码

struct Execution {
  address target;
  uint256 value;
  bytes callData;
}

编码方式

按权限类型构造 Execution

ERC-20 转账

原生币转账

完整 Redeem 示例

使用 viem 构造 calldata 并由 Session Account 发送交易:

执行前检查清单

检查项
说明

to 地址匹配

签名者 = grant.to

链 ID 一致

必要时 wallet_switchEthereumChain

额度充足

periodic/stream 规则 + 链上 enforcer

context 有效

未过期、未撤销

dependencies 已部署

factory 部署完成后再 redeem

Last updated