Skip to content

Commit 8e37322

Browse files
committed
feat: default keyring origin to metamask.io if not set
1 parent cec48b6 commit 8e37322

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

packages/snap/snap.manifest.json

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"url": "https://github.com/MetaMask/snap-solana-wallet.git"
88
},
99
"source": {
10-
"shasum": "X8H3lT9QgY8uutnCltqzyrV3KhRAA3jQP24gG18JTGc=",
10+
"shasum": "mMVemDA4i1CdbFKeeuBUd+SMDzHAbIvc+XE5vH3evG8=",
1111
"location": {
1212
"npm": {
1313
"filePath": "dist/bundle.js",
@@ -19,19 +19,15 @@
1919
"locales": ["locales/en.json"]
2020
},
2121
"initialConnections": {
22-
"https://portfolio.metamask.io": {},
23-
"http://localhost:3000": {}
22+
"https://portfolio.metamask.io": {}
2423
},
2524
"initialPermissions": {
2625
"endowment:rpc": {
2726
"dapps": true,
2827
"snaps": false
2928
},
3029
"endowment:keyring": {
31-
"allowedOrigins": [
32-
"https://portfolio.metamask.io",
33-
"http://localhost:3000"
34-
]
30+
"allowedOrigins": ["https://portfolio.metamask.io"]
3531
},
3632
"snap_getBip32Entropy": [
3733
{

packages/snap/src/index.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,17 @@ export const onKeyringRequest: OnKeyringRequestHandler = async ({
108108

109109
validateOrigin(origin, request.method);
110110

111+
// This is a temporal fix to prevent the swap/bridge functionality breaking
112+
// TODO: Remove this once changes in bridge-status-controller are in place
113+
const updatedRequest = {
114+
...request,
115+
// default to metamask.io if origin is not set
116+
origin: 'origin' in request ? request.origin : 'https://metamask.io',
117+
};
118+
111119
return (await handleKeyringRequest(
112120
keyring,
113-
request,
121+
updatedRequest,
114122
)) as unknown as Promise<Json>;
115123
} catch (error: any) {
116124
let snapError = error;

0 commit comments

Comments
 (0)