From 02f02e0e113a1ac7982c3baaab888e51a7ba4b18 Mon Sep 17 00:00:00 2001 From: Shane Jonas Date: Wed, 25 Jan 2023 10:41:25 -0500 Subject: [PATCH 1/3] Added caip25 + caip2 to requestPermissions + routing method --- openrpc.json | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 89 insertions(+), 1 deletion(-) diff --git a/openrpc.json b/openrpc.json index 6de704d..d421798 100644 --- a/openrpc.json +++ b/openrpc.json @@ -5,6 +5,31 @@ "version": "1.0.0" }, "methods": [ + { + "name": "metamask_multiChain", + "tags": [ + { + "$ref": "#/components/tags/Metamask" + } + ], + "summary": "Call a method on a chain", + "description": "Call a method on a chain. This method is used to call methods on chains that are not the currently active chain. This method is only available if the user has added the chain to their wallet. Introduced by [EIP-3085](https://eips.ethereum.org/EIPS/eip-3085).", + "params": [ + { + "name": "MultiChainParameter", + "description": "The MultiChainParameter", + "schema": { + "$ref": "#/components/schemas/MultiChainParameter" + } + } + ], + "result": { + "name": "MultiChainResult", + "schema": { + "$ref": "#/components/schemas/MultiChainResult" + } + } + }, { "name": "wallet_addEthereumChain", "tags": [ @@ -84,7 +109,7 @@ ], "result": { "name": "wallet_addEthereumChainExampleResult", - "value": "null" + "value": null } } ] @@ -163,6 +188,41 @@ "schema": { "title": "requestPermissionObject", "type": "object", + "patternProperties": { + "[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}": { + "type": "object", + "description": "Define a multi-chain connection via CAIP-2 chainIds", + "required": ["methods"], + "properties": { + "chains": { + "description": "Array of CAIP-2 chainIds", + "type": "array", + "items": { + "pattern": "[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}", + "type": "string" + } + }, + "methods": { + "description": "Array of method names that the chain must implement", + "type": "array", + "items": { + "title": "method", + "description": "Method name", + "type": "string" + } + }, + "notifications": { + "description": "Array of notifications that the chain must implement", + "type": "array", + "items": { + "title": "notification", + "description": "Notification name", + "type": "string" + } + } + } + } + }, "properties": { "eth_accounts": { "type": "object" @@ -425,6 +485,34 @@ ], "components": { "schemas": { + "MultiChainParameter": { + "title": "MultiChainParameter", + "type": "object", + "required": [ + "chainId" + ], + "properties": { + "chainId": { + "description": "MUST specify the integer ID of the chain as a hexadecimal string, per the eth_chainId Ethereum RPC method. The wallet SHOULD compare the specified chainId value with the eth_chainId return value from the endpoint. If these values are not identical, the wallet MUST reject the request.", + "type": "string" + }, + "request": { + "description": "The request object to send to the specific chainId.", + "type": "object", + "properties": { + "method": { + "description": "The RPC method to send to the specific chainId.", + "type": "string" + }, + "params": { + "description": "The RPC params to send to the specific chainId.", + "type": "array" + } + } + } + } + }, + "MultiChainResult": true, "AddEthereumChainParameter": { "title": "AddEthereumChainParameter", "type": "object", From 300030cf3abf0225cf626183d24bb3fffefba693 Mon Sep 17 00:00:00 2001 From: Shane Jonas Date: Thu, 26 Jan 2023 09:05:24 -0500 Subject: [PATCH 2/3] Added openrpc doc and permissions --- openrpc.json | 51 ++++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/openrpc.json b/openrpc.json index d421798..d8f977a 100644 --- a/openrpc.json +++ b/openrpc.json @@ -191,33 +191,16 @@ "patternProperties": { "[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}": { "type": "object", - "description": "Define a multi-chain connection via CAIP-2 chainIds", - "required": ["methods"], "properties": { - "chains": { - "description": "Array of CAIP-2 chainIds", - "type": "array", - "items": { - "pattern": "[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}", - "type": "string" - } - }, - "methods": { - "description": "Array of method names that the chain must implement", - "type": "array", - "items": { - "title": "method", - "description": "Method name", - "type": "string" - } + "openrpcDocument": { + "$ref": "https://raw.githubusercontent.com/open-rpc/meta-schema/master/schema.json" }, - "notifications": { - "description": "Array of notifications that the chain must implement", - "type": "array", - "items": { - "title": "notification", - "description": "Notification name", - "type": "string" + "permissions": { + "type": "object", + "patternProperties": { + "": { + "type": "object" + } } } } @@ -253,6 +236,24 @@ "name": "permissionList", "value": {} } + }, + { + "name": "requestPermissionObjectExampleMultiChain", + "description": "example for a permission request for multi-chain", + "params": [ + { + "name": "requestPermissionObject", + "value": { + "eip155:2": { + "methods": ["eth_accounts", "eth_sendTransaction"] + } + } + } + ], + "result": { + "name": "permissionList", + "value": {} + } } ] }, From 30405776b13114cf8c5d9d64948152a39abd3c61 Mon Sep 17 00:00:00 2001 From: Shane Jonas Date: Thu, 26 Jan 2023 09:34:07 -0500 Subject: [PATCH 3/3] Added example for requestPermissions multichain --- openrpc.json | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/openrpc.json b/openrpc.json index d8f977a..4b8967d 100644 --- a/openrpc.json +++ b/openrpc.json @@ -245,7 +245,32 @@ "name": "requestPermissionObject", "value": { "eip155:2": { - "methods": ["eth_accounts", "eth_sendTransaction"] + "openrpcDocument": { + "info": { + "title": "EIP-155 Chain 2", + "version": "1.0.0" + }, + "methods": [ + { + "name": "eth_accounts", + "summary": "List accounts", + "description": "Returns a list of addresses owned by the user.", + "params": [], + "result": { + "name": "accounts", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + ] + }, + "permissions": { + "eth_accounts": {} + } } } }