You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The session account can now [redeem the delegation](../experimental/erc-7710-redeem-delegations.md). The redeem transaction is sent to the `DelegationManager` contract, which validates the delegation and executes actions on the user's behalf.
188
+
The session account can now redeem the permissions. The redeem transaction is sent to the `DelegationManager` contract, which validates the delegation and executes actions on the user's behalf.
187
189
188
-
To redeem the permissions, use the appropriate client action based on your session account type:
190
+
To redeem the permissions, use the client action based on your session account type.
191
+
A smart account uses the Bundler Client's [`sendUserOperationWithDelegation`](../../reference/erc7715/bundler-client.md#senduseroperationwithdelegation) action,
192
+
and an EOA uses the Wallet Client's [`sendTransactionWithDelegation`](../../reference/erc7715/wallet-client.md#sendtransactionwithdelegation) action:
The following API methods are related to `CaveatEnforcerClient` used to [check the delegation state](../../guides/delegation/check-delegation-state.md).
The following API methods are related to the [Viem Bundler Client](https://viem.sh/account-abstraction/clients/bundler).
13
+
The following actions are related to the [Viem Bundler Client](https://viem.sh/account-abstraction/clients/bundler) used to [execute on a MetaMask user's behalf](../../guides/erc7715/execute-on-metamask-users-behalf.md).
13
14
14
15
## `sendUserOperationWithDelegation`
15
16
16
-
Sends a user operation to redeem delegated permissions according to the [ERC-7710](https://eips.ethereum.org/EIPS/eip-7710) specifications.
17
+
Sends a user operation with redeem permissions according to the [ERC-7710](https://eips.ethereum.org/EIPS/eip-7710) specifications.
17
18
18
19
:::info
19
20
To use `sendUserOperationWithDelegation`, the Viem Bundler Client must be
@@ -29,16 +30,16 @@ Objects in the `calls` array also require the following parameters:
|`delegationManager`|`0x${string}`| Yes | The address of Delegation Manager. |
33
-
|`permissionsContext`|`0x${string}`| Yes | Encoded calldata for redeeming delegations. If you're not using ERC-7715, you can use the [`redeemDelegations`](../delegation/index.md#redeemdelegations) utility function to generate the calldata manually. |
33
+
|`delegationManager`|`Address`| Yes | The address of Delegation Manager. |
34
+
|`permissionsContext`|`Hex`| Yes | Encoded calldata for redeeming permissions. If you're not using ERC-7715, you can use the [`redeemDelegations`](../delegation/index.md#redeemdelegations) utility function to generate the calldata manually. |
When [executing on a MetaMask user's behalf](../../guides/erc7715/execute-on-metamask-users-behalf.md), you can request the following permission types for ERC-20 token and native token transfers.
10
10
Learn [how to use ERC-7715 permissions](../../guides/erc7715/use-permissions/erc20-token.md).
The following API methods are related to the [Viem Wallet Client](https://viem.sh/docs/clients/wallet).
13
+
The following actions are related to the [Viem Wallet Client](https://viem.sh/docs/clients/wallet) used to [execute on a MetaMask user's behalf](../../guides/erc7715/execute-on-metamask-users-behalf.md).
13
14
14
-
## `grantPermissions`
15
+
## `requestExecutionPermissions`
15
16
16
17
Requests permissions from the MetaMask extension account according to the [ERC-7715](https://eips.ethereum.org/EIPS/eip-7715) specifications.
17
18
18
19
:::info
19
-
To use `grantPermissions`, the Viem Wallet Client must be extended with `erc7715ProviderActions`.
20
+
To use `requestExecutionPermissions`, the Viem Wallet Client must be extended with `erc7715ProviderActions`.
20
21
:::
21
22
22
23
### Parameters
@@ -26,9 +27,9 @@ To use `grantPermissions`, the Viem Wallet Client must be extended with `erc7715
26
27
|`chainId`|`number`| Yes | The chain ID on which the permission is being requested. |
27
28
|`address`|`Address`| No | Address of the wallet to which the permission is being requested. |
28
29
|`expiry`|`number`| Yes | The timestamp (in seconds) by which the permission must expire. |
29
-
|`permission`|`Permission`| Yes | The permission to grant to the user. |
30
-
|`signer`|`Signer`| Yes | The account to which the permission will be assigned. |
31
-
|`isAdjustmentAllowed`|`boolean`|No|Whether the user is allowed to modify the requested permission. The default is `true`. |
30
+
|`permission`|`SupportedPermissionParams`| Yes | The permission to be requested. The toolkit supports multiple [ERC-7715 permissions](permissions.md). |
31
+
|`signer`|`SignerParam`| Yes | The account to which the permission will be assigned. |
32
+
|`isAdjustmentAllowed`|`boolean`|Yes|Defines whether the user is allowed to modify the requested permission. |
32
33
33
34
### Example
34
35
@@ -37,39 +38,36 @@ To use `grantPermissions`, the Viem Wallet Client must be extended with `erc7715
37
38
38
39
```ts
39
40
import { sepoliaaschain } from"viem/chains";
40
-
import { walletClient } from"./config.ts";
41
+
import { parseUnits } from"viem";
42
+
import { walletClient } from"./client.ts";
41
43
42
-
constexpiry=Math.floor(Date.now() /1000+604_800); // 1 week from now.
43
-
constcurrentTime=Math.floor(Date.now() /1000); // now
44
+
constcurrentTime=Math.floor(Date.now() /1000);
45
+
constexpiry=currentTime+604800;
44
46
45
-
// Address of the wallet that will manage the session. It can
46
-
// be either a smart account or an externally owned account (EOA)
|`delegationManager`|`0x${string}`| Yes | The address of the Delegation Manager. |
103
-
|`permissionsContext`|`0x${string}`| Yes | Encoded calldata for redeeming delegations. If you're not using ERC-7715, you can use the [`redeemDelegations`](../delegation/index.md#redeemdelegations) utility function to generate the calldata manually. |
100
+
|`delegationManager`|`Address`| Yes | The address of the Delegation Manager. |
101
+
|`permissionsContext`|`Hex`| Yes | Encoded calldata for redeeming delegations. If you're not using ERC-7715, you can use the [`redeemDelegations`](../delegation/index.md#redeemdelegations) utility function to generate the calldata manually. |
0 commit comments