Open huweihong opened 2 months ago
I create two site A and site B in localhost. In site A, I have installed snap A(running in 8080). The snap's config is:
{ "version": "0.1.0", "description": "SnapA", "proposedName": "SnapA", "repository": { "type": "git", "url": "https://github.com/MetaMask/template-snap-monorepo.git" }, "source": { "shasum": "63qRiHOi37RFs/GvzuscNwJ3wmyzz16bpckmJM7VUqI=", "location": { "npm": { "filePath": "dist/bundle.js", "packageName": "snap-a", "registry": "https://registry.npmjs.org/", "iconPath": "images/logo.svg" } } }, "initialPermissions": { "snap_dialog": {}, "endowment:rpc": { "dapps": true, "snaps": true }, "snap_manageState": {}, "endowment:network-access": {}, "endowment:page-home": {}, "endowment:ethereum-provider": {}, "endowment:cronjob": { "jobs": [ { "expression": "*/10 * * * * *", "request": { "method": "alert" } } ] } }, "manifestVersion": "0.1" }
And in site B, I used wallet_requestSnaps to request permission to connect to the snap A, there is always an install dialog to install snap A.
const snap = await request({ method: 'wallet_requestSnaps', params: { 'local:http://localhost:8080': {}, }, });
I create two site A and site B in localhost. In site A, I have installed snap A(running in 8080). The snap's config is:
And in site B, I used wallet_requestSnaps to request permission to connect to the snap A, there is always an install dialog to install snap A.