Skip to content

Commit 9b6dff5

Browse files
Adds guide to get supported permissions
* add guide to request supported permissions * fix typo * resolve reviewer's comment
1 parent c74eb2b commit 9b6dff5

3 files changed

Lines changed: 67 additions & 1 deletion

File tree

gator-sidebar.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ const sidebar = {
104104
key: 'advanced-permissions-guides',
105105
items: [
106106
'guides/advanced-permissions/execute-on-metamask-users-behalf',
107+
'guides/advanced-permissions/get-supported-permissions',
107108
{
108109
type: 'category',
109110
label: 'Use permissions',

smart-accounts-kit/guides/advanced-permissions/execute-on-metamask-users-behalf.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,5 +315,6 @@ export const calldata = encodeFunctionData({
315315

316316
## Next steps
317317

318-
See how to configure different [ERC-20 token permissions](use-permissions/erc20-token.md) and
318+
- See how to [get the supported execution permissions](get-supported-permissions.md).
319+
- See how to configure different [ERC-20 token permissions](use-permissions/erc20-token.md) and
319320
[native token permissions](use-permissions/native-token.md).
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
description: Learn how to get supported execution permissions for a wallet.
3+
sidebar_label: Get supported permisisons
4+
keywords: [advanced permissions, supported execution permissions, erc-7715, 7715]
5+
---
6+
7+
import Tabs from "@theme/Tabs";
8+
import TabItem from "@theme/TabItem";
9+
10+
# Get supported permissions
11+
12+
[ERC-7715](https://eip.tools/eip/7715) defines an RPC method that returns the execution permissions
13+
a wallet supports. Use the method to verify the available permission types and rules before sending requests.
14+
15+
16+
## Prerequisites
17+
18+
- [Install and set up the Smart Accounts Kit](../../get-started/install.md)
19+
- [Learn about Advanced Permissions](../../concepts/advanced-permissions.md)
20+
21+
22+
## Request supported permissions
23+
24+
Request the supported execution permission types for a wallet with the
25+
Wallet Client's `getSupportedExecutionPermissions` action.
26+
27+
<Tabs>
28+
<TabItem value="example.ts">
29+
30+
```typescript
31+
import { walletClient } from "./config.ts";
32+
33+
const supportedPermissions = await walletClient.getSupportedExecutionPermissions();
34+
35+
// Example response:
36+
// {
37+
// "native-token-stream": {
38+
// "chainIds": [
39+
// "0x1",
40+
// "0xa",
41+
// ],
42+
// "ruleTypes": [
43+
// "expiry"
44+
// ]
45+
// },
46+
// // ...
47+
// }
48+
```
49+
50+
</TabItem>
51+
52+
<TabItem value="config.ts">
53+
54+
```ts
55+
import { createWalletClient, custom } from "viem";;
56+
import { erc7715ProviderActions } from "@metamask/smart-accounts-kit/actions";
57+
58+
export const walletClient = createWalletClient({
59+
transport: custom(window.ethereum),
60+
}).extend(erc7715ProviderActions());
61+
62+
```
63+
</TabItem>
64+
</Tabs>

0 commit comments

Comments
 (0)