snaps icon indicating copy to clipboard operation
snaps copied to clipboard

uncustomizable PORT

Open coderSomya opened this issue 2 years ago • 2 comments

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.

coderSomya avatar Dec 10 '23 15:12 coderSomya

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 avatar Dec 11 '23 19:12 Montoya

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"

Montoya avatar Dec 11 '23 19:12 Montoya