MetaMask / snaps

Extend the functionality of MetaMask using Snaps
https://metamask.io/snaps/
Other
712 stars 548 forks source link

uncustomizable PORT #2028

Open coderSomya opened 7 months ago

coderSomya commented 7 months ago

The snaps can communicate to site, running mandatorily on PORT = 8000, and nothing else. How to ensure that we can run the app on some other port and still have access to the snap.

Montoya commented 7 months ago

Hi, the template is configured to work with the dapp running on port 8000. If you want to connect the Snap to a dapp on a different port or a different URL, there is nothing in the Snap template that prevents that. What you have to do is implement a connect button for that dapp. Here is a doc explaining how to do it: https://docs.metamask.io/snaps/how-to/work-with-existing-snaps/

Basically, any dapp has to connect to the Snap in order to use the Snap's methods.

Montoya commented 7 months ago

If you are trying to modify the port used by Gatsby in the template, you can modify this line: https://github.com/MetaMask/template-snap-monorepo/blob/main/packages/site/package.json#L14

to look like:

"start": "GATSBY_TELEMETRY_DISABLED=1 gatsby develop -p 4000"