Skip to content

Commit 0c7eb2e

Browse files
feat: Implement MultichainRouter and onProtocolRequest (SIP-26) (#2875)
This PR adds a `MultichainRouter` that can handle routing of non-EVM requests received via the multichain API. The multichain API should integrate this by calling `MultichainRouter.handleRequest` for any requests that are not understood by our existing JSON-RPC stack. Additionally this PR implements `onProtocolRequest`, a new handler that Snaps can choose to register if they want to service protocol (non signing) requests for a given set of methods for one or more chains. The endowment is registered as follows: ```json5 "initialPermissions": { "endowment:protocol": { "scopes": { "<caip2_chainId>": { "methods": [ // List of supported methods ], "notifications": [ // List of supported notifications ] } } } } ``` This implementation follows https://metamask.github.io/SIPs/SIPS/sip-26 Closes #2898 --------- Co-authored-by: Maarten Zuidhoorn <[email protected]>
1 parent ce86a74 commit 0c7eb2e

File tree

31 files changed

+1568
-22
lines changed

31 files changed

+1568
-22
lines changed

packages/examples/packages/browserify-plugin/snap.manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"url": "https://github.com/MetaMask/snaps.git"
88
},
99
"source": {
10-
"shasum": "R4WjwqkDLNMUtU07n8AGq0WZKjsqjTjQXlASF++J4ws=",
10+
"shasum": "Yzt/aRJTbRwAn3zbbK7W3MjgVVt2f6jLMGSc6pe2oyg=",
1111
"location": {
1212
"npm": {
1313
"filePath": "dist/bundle.js",

packages/examples/packages/browserify/snap.manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"url": "https://github.com/MetaMask/snaps.git"
88
},
99
"source": {
10-
"shasum": "06xWu+ehUlNMpbJQxTZi2mlnAJId3cLHEK6fWD2Z9rc=",
10+
"shasum": "J+fHvBGBrcoSZ5R1dEiIO3PegqNGFElb1i4h9Zw4zxg=",
1111
"location": {
1212
"npm": {
1313
"filePath": "dist/bundle.js",
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"branches": 93.06,
3-
"functions": 96.61,
4-
"lines": 98.08,
5-
"statements": 97.8
2+
"branches": 93.28,
3+
"functions": 96.8,
4+
"lines": 98.15,
5+
"statements": 97.88
66
}

packages/snaps-controllers/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ export * from './utils';
55
export * from './cronjob';
66
export * from './interface';
77
export * from './insights';
8+
export * from './multichain';

0 commit comments

Comments
 (0)