-
Notifications
You must be signed in to change notification settings - Fork 41
Home
Welcome to Filecoin snap wiki!
Filecoin snap (plugin) enables Filecoin network inside Metamask and by doing this provides DAPPs easy integration.
Wiki covers snap architecture and integration steps, as well as detailed API documentation.
Filecoin Metamask snap is installed using metamask-filecoin-adapter. Ussage flow is represented in the diagram below and described in more details inside integration steps.
- Add metamask-filecoin-adapter package to your project.
npm i @nodefactory/metamask-filecoin-adapter
- [Optional] Add types for the adapter to your project in case you will interact with snap specific API.
npm i @nodefactory/metamask-filecoin-types
-
Install snap by calling
enableFilecoinSnap()
from@nodefactory/metamask-filecoin-adapter
package.
This will prompt user to:
- accept the snap installation
- accept all snap permissions
This function accepts the configuration object for defining network properties, same as configure
method from Filecoin Snap API.
After successful installation, it will return MetamaskFilecoinSnap
object (see Architecture overview for details).
- Invoke Filecoin Snap API
MetamaskFilecoinSnap
object has an exposed method for obtaining API getFilecoinSnapApi(): Promise<FilecoinSnapApi>
. For more details about exposed API see API documentation.