-
Fork the repository:
- Click the "Fork" button at the top right of the repository page.
-
Clone your fork:
git clone https://github.com/<your-username>/snap-7715-permissions.git
-
Create Working Branch:
git checkout -b feat/example-branch
This mono-repository contains the @metamask/permissions-kernel-snap
and @metamask/gator-permissions-snap
that implement ERC-7715 and the Permissions registry. dApps may request a permission via the exposed JSON-RPC interface. A user can grant granular permissions as cryptographic capabilities to allow dApps to execute transactions on their behalf.
This Snap manages a permissions offer registry
, which lists all the permissions a user is willing to grant via a ERC-7715 permissions request. When a dApp makes a 7715 request to the kernel, the kernel forwards it to a permissions provider Snap for user review and attenuation. If the dApp requests any permission not listed in the registry, the kernel automatically rejects the request.
This Snap creates a DeleGator account and enables the site to request ERC-7715 permissions from that account. Users can review and adjust the granted permissions through a custom interactive confirmation dialog rendered by the Snap.
Read more on "@metamask/gator-permissions-snap" ->
Prerequisites
- MetaMask Flask >= 12.14.2
- Nodejs
20.0.0
or >22.0.0
(specified in.nvmrc
) - yarn 3.2.1
The snap origin to use(defaults to local if not defined): ./packages/site/.env
. Local development values can be found in ./packages/site/.env.example.
The snap will throw errors during build process if values are not defined: ./packages/permissions-kernel-snap/.env
. Development values can be found in ./packages/permissions-kernel-snap/.env.example.
The snap will throw errors during build process if values are not defined: ./packages/gator-permissions-snap/.env
. Development values can be found in ./packages/gator-permissions-snap/.env.example.
Ensure the appropriate environment variables values are set:
./packages/permissions-kernel-snap/.env
./packages/gator-permissions-snap/.env
./packages/site/.env
# Install dependencies and sets up submodule
yarn prepare:snap
# Starts local @metamask/permissions-kernel-snap and @metamask/gator-permissions-snap
yarn start
The development site will start up on http://localhost:8000/
@metamask/permissions-kernel-snap
is served fromlocal:http://localhost:8081
@metamask/gator-permissions-snap
is served fromlocal:http://localhost:8082
# Install dependencies and sets up submodule
yarn prepare:snap
# Starts local @metamask/message-signing-snap
yarn start:message-signing-snap
# In new terminal window, start local @metamask/permissions-kernel-snap and @metamask/gator-permissions-snap
yarn start
The development site will start up on http://localhost:8000/
@metamask/message-signing-snap
is served fromlocal:http://localhost:8080
@metamask/permissions-kernel-snap
is served fromlocal:http://localhost:8081
@metamask/gator-permissions-snap
is served fromlocal:http://localhost:8082
Note:
@metamask/snaps-jest
assumes that the snap is built in the directory you're running Jest from. If you're using a different directory, you can specify the path to the snap using theroot
option, or by running your own HTTP server.Right now it's not possible to use
@metamask/snaps-jest
with a snap that isn't built.
Ensure the appropriate environment variables values are set:
./packages/permissions-kernel-snap/.env
./packages/gator-permissions-snap/.env
yarn build
yarn test
To run the linter.
yarn lint
To run the linter and fix any automatically fixable issues.
yarn lint:fix
Scripts are disabled by default for security reasons. If you need to use NPM
packages with scripts, you can run yarn allow-scripts auto
, and enable the
script in the lavamoat.allowScripts
section of package.json
.
See the documentation for @lavamoat/allow-scripts for more information.