-
-
Notifications
You must be signed in to change notification settings - Fork 14
Add ERC-7715 execution permission methods #311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
247ee16
132f415
1e8b942
72cca9f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -781,6 +781,144 @@ methods: | |
| '0xaa36a7': | ||
| atomic: | ||
| status: ready | ||
| - name: wallet_requestExecutionPermissions | ||
| tags: | ||
| - $ref: '#/components/tags/MetaMask' | ||
| - $ref: '#/components/tags/Experimental' | ||
| - $ref: '#/components/tags/Multichain' | ||
| summary: Requests ERC-7715 execution permissions. | ||
| description: >- | ||
| Requests that the user grant one or more ERC-7715 execution permissions, | ||
| allowing a delegate account to perform a constrained set of actions on | ||
| behalf of the user's account. Specified by | ||
| [ERC-7715](https://eips.ethereum.org/EIPS/eip-7715). | ||
| params: | ||
| - name: Permission requests | ||
| required: true | ||
| description: An array of execution permission requests. | ||
| schema: | ||
| type: array | ||
| items: | ||
| $ref: '#/components/schemas/ExecutionPermissionRequest' | ||
| result: | ||
| name: Granted permissions | ||
| description: An array of the granted execution permissions. | ||
| schema: | ||
| type: array | ||
| items: | ||
| $ref: '#/components/schemas/ExecutionPermissionResponse' | ||
| errors: | ||
| - $ref: '#/components/errors/InvalidParams' | ||
| - $ref: '#/components/errors/UserRejected' | ||
| - $ref: '#/components/errors/Unauthorized' | ||
| examples: | ||
| - name: wallet_requestExecutionPermissions example | ||
| params: | ||
| - name: Permission requests | ||
| value: | ||
| - chainId: '0xaa36a7' | ||
| to: '0x4B0897b0513FdBeEc7C469D9aF4fA6C0752aBea7' | ||
| permission: | ||
| type: native-token-periodic | ||
| isAdjustmentAllowed: true | ||
| data: | ||
| periodAmount: '0x38d7ea4c68000' | ||
| periodDuration: 86400 | ||
| justification: Permission to transfer 0.001 ETH every day | ||
| rules: | ||
| - type: expiry | ||
| data: | ||
| timestamp: 1893456000 | ||
| result: | ||
| name: Granted permissions | ||
| value: | ||
| - chainId: '0xaa36a7' | ||
| to: '0x4B0897b0513FdBeEc7C469D9aF4fA6C0752aBea7' | ||
| permission: | ||
| type: native-token-periodic | ||
| isAdjustmentAllowed: true | ||
| data: | ||
| periodAmount: '0x38d7ea4c68000' | ||
| periodDuration: 86400 | ||
| justification: Permission to transfer 0.001 ETH every day | ||
| rules: | ||
| - type: expiry | ||
| data: | ||
| timestamp: 1893456000 | ||
| context: '0x00000000000000000000000000000000000000000000000000000000000000' | ||
| delegationManager: '0x2D48e6f5Ae053e4E918d2be53570961D880905F2' | ||
| dependencies: [] | ||
| - name: wallet_getGrantedExecutionPermissions | ||
| tags: | ||
| - $ref: '#/components/tags/MetaMask' | ||
| - $ref: '#/components/tags/Experimental' | ||
| - $ref: '#/components/tags/Multichain' | ||
| summary: Gets granted ERC-7715 execution permissions. | ||
| description: >- | ||
| Returns the ERC-7715 execution permissions that the user has previously | ||
| granted to the requesting dapp. Specified by | ||
| [ERC-7715](https://eips.ethereum.org/EIPS/eip-7715). | ||
| params: [] | ||
| result: | ||
| name: Granted permissions | ||
| description: An array of the granted execution permissions. | ||
| schema: | ||
| type: array | ||
| items: | ||
| $ref: '#/components/schemas/ExecutionPermissionResponse' | ||
| errors: | ||
| - $ref: '#/components/errors/Unauthorized' | ||
| examples: | ||
| - name: wallet_getGrantedExecutionPermissions example | ||
| params: [] | ||
| result: | ||
| name: Granted permissions | ||
| value: [] | ||
| - name: wallet_getSupportedExecutionPermissions | ||
| tags: | ||
| - $ref: '#/components/tags/MetaMask' | ||
| - $ref: '#/components/tags/Experimental' | ||
| - $ref: '#/components/tags/Multichain' | ||
| summary: Gets supported ERC-7715 execution permissions. | ||
| description: >- | ||
| Returns the ERC-7715 execution permission types supported by the wallet, | ||
| keyed by permission type, including the chain IDs and rule types each | ||
| permission supports. Specified by | ||
| [ERC-7715](https://eips.ethereum.org/EIPS/eip-7715). | ||
| params: [] | ||
| result: | ||
| name: Supported permissions | ||
| description: >- | ||
| An object keyed by permission type. Each entry describes the chain IDs | ||
| and rule types supported for that permission type. | ||
| schema: | ||
| type: object | ||
| additionalProperties: | ||
| type: object | ||
| properties: | ||
| chainIds: | ||
| description: The chain IDs that support the permission type. | ||
| type: array | ||
| items: | ||
| $ref: '#/components/schemas/uint' | ||
| ruleTypes: | ||
| description: The rule types supported for the permission type. | ||
| type: array | ||
| items: | ||
| type: string | ||
| errors: | ||
| - $ref: '#/components/errors/Unauthorized' | ||
| examples: | ||
| - name: wallet_getSupportedExecutionPermissions example | ||
| params: [] | ||
| result: | ||
| name: Supported permissions | ||
| value: | ||
| native-token-periodic: | ||
| chainIds: | ||
| - '0xaa36a7' | ||
| ruleTypes: | ||
| - expiry | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing
|
||
| - name: eth_requestAccounts | ||
| tags: | ||
| - $ref: '#/components/tags/MetaMask' | ||
|
|
@@ -1262,6 +1400,128 @@ components: | |
| Dapps can use this object to communicate with the wallet about | ||
| supported capabilities. | ||
| type: object | ||
| ExecutionPermission: | ||
| title: ExecutionPermission | ||
| description: >- | ||
| An ERC-7715 execution permission. The `type` determines the shape of the | ||
| `data` object (for example `native-token-periodic`, `native-token-stream`, | ||
| `erc20-token-periodic`, `erc20-token-allowance`). | ||
| type: object | ||
| required: | ||
| - type | ||
| - isAdjustmentAllowed | ||
| - data | ||
| properties: | ||
| type: | ||
| description: The permission type. | ||
| type: string | ||
| isAdjustmentAllowed: | ||
| description: >- | ||
| Whether the wallet is allowed to adjust the requested permission | ||
| (for example to a lower allowance) before granting it. | ||
| type: boolean | ||
| data: | ||
| description: >- | ||
| Permission-type-specific data. All amounts are `0x`-prefixed | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is true of token amounts - timestamps and durations (amount of seconds 🤷) are represented as number type. |
||
| hexadecimal strings. | ||
| type: object | ||
| additionalProperties: true | ||
| properties: | ||
| justification: | ||
| description: A human-readable explanation of why the permission is requested. | ||
| type: string | ||
| ExecutionPermissionRule: | ||
| title: ExecutionPermissionRule | ||
| description: >- | ||
| A rule that constrains an ERC-7715 execution permission, such as an | ||
| `expiry`, `redeemer`, or `payee` rule. | ||
| type: object | ||
| required: | ||
| - type | ||
| - data | ||
| properties: | ||
| type: | ||
| description: The rule type. | ||
| type: string | ||
| data: | ||
| description: Rule-type-specific data. | ||
| type: object | ||
| additionalProperties: true | ||
| ExecutionPermissionRequest: | ||
| title: ExecutionPermissionRequest | ||
| description: An object describing a single ERC-7715 execution permission request. | ||
| type: object | ||
| required: | ||
| - chainId | ||
| - to | ||
| - permission | ||
| - rules | ||
| properties: | ||
| chainId: | ||
| description: >- | ||
| The [EIP-155](https://eips.ethereum.org/EIPS/eip-155) chain ID the | ||
| permission applies to, as a `0x`-prefixed hexadecimal string. | ||
| $ref: '#/components/schemas/uint' | ||
| from: | ||
| description: >- | ||
| (Optional) The account the permission should be granted from. Useful | ||
| when a connection has been established and multiple accounts have | ||
| been exposed; lets the user choose which account to grant the | ||
| permission for. | ||
| $ref: '#/components/schemas/address' | ||
|
cursor[bot] marked this conversation as resolved.
|
||
| to: | ||
| description: The address the permission is granted to (the redeemer/delegate). | ||
| $ref: '#/components/schemas/address' | ||
| permission: | ||
| $ref: '#/components/schemas/ExecutionPermission' | ||
| rules: | ||
| description: >- | ||
| An array of rules constraining the permission. Time-bounded | ||
| permissions are expressed as an `expiry` rule (with a UNIX | ||
| `timestamp` in its `data`) rather than a top-level field. Pass an | ||
| empty array to apply no constraints. | ||
| type: array | ||
| items: | ||
| $ref: '#/components/schemas/ExecutionPermissionRule' | ||
| ExecutionPermissionResponse: | ||
|
jiexi marked this conversation as resolved.
|
||
| title: ExecutionPermissionResponse | ||
| description: >- | ||
| A granted ERC-7715 execution permission. Contains the original request | ||
| fields plus the data needed to redeem the permission. | ||
| allOf: | ||
| - $ref: '#/components/schemas/ExecutionPermissionRequest' | ||
| - type: object | ||
| required: | ||
| - context | ||
| - dependencies | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it's important to note here, but for interests' sake, |
||
| - delegationManager | ||
| properties: | ||
| context: | ||
| description: >- | ||
| An opaque `0x`-prefixed context used to identify and redeem the | ||
| granted permission. | ||
| $ref: '#/components/schemas/bytes' | ||
| delegationManager: | ||
| description: The address of the delegation manager contract. | ||
| $ref: '#/components/schemas/address' | ||
| dependencies: | ||
| description: >- | ||
| Account deployment dependencies required to redeem the | ||
| permission (for example a smart account factory and its data). | ||
| type: array | ||
| items: | ||
| title: ExecutionPermissionDependency | ||
| type: object | ||
| required: | ||
| - factory | ||
| - factoryData | ||
| properties: | ||
| factory: | ||
| description: The address of the account factory contract. | ||
| $ref: '#/components/schemas/address' | ||
| factoryData: | ||
| description: The calldata to pass to the account factory. | ||
| $ref: '#/components/schemas/bytes' | ||
| AddEthereumChainParameter: | ||
| title: Chain | ||
| description: Object containing information about the chain to add. | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's also a required
startTimeparameter onnative-token-periodic'sdata- this indicates the start of the first "period", and should be reflected in the example result also.