Skip to content

Commit ef324fa

Browse files
authored
Merge pull request #389 from ChainAgnostic/pedrouid-patch-12
CAIP-27: Rename "scope" to "chainId"
2 parents 5f01868 + 4643e53 commit ef324fa

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

CAIPs/caip-27.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ The application would interface with an JSON-RPC provider to make request as fol
4747
"method": "wallet_invokeMethod",
4848
"params": {
4949
"sessionId": "0xdeadbeef",
50-
"scope": "eip155:1",
50+
"chainId": "eip155:1",
5151
"request": {
5252
"method": "eth_sendTransaction",
5353
"params": [
@@ -77,16 +77,16 @@ The application would interface with an JSON-RPC provider to make request as fol
7777
The JSON-RPC method is labeled as `wallet_invokeMethod` and expects three parameters, **two of them required**:
7878

7979
- **sessionId** (conditional) - [CAIP-171][] `SessionId` disambiguates an open session in a multi-session actor; it is required in some sessions, such as [CAIP-25][] sessions created by a response containing one, and SHOULD be omitted in other sessions, such as [CAIP-25] sessions created by a response not containing one (see [CAIP-316]).
80-
- **scope** (required) - a valid [CAIP-2][] network identifier, previously authorized by or within a `scopeObject` in the active session
80+
- **chainId** (required) - a valid [CAIP-2][] network identifier, previously authorized by or within a `scopeObject` in the active session
8181
- **request** (required) - an object containing the fields:
8282
- **method** (required) - the JSON-RPC method to invoke (previously authorized for the targeted network)
8383
- **params** (required) - JSON-RPC parameters to invoke (may be empty but must be set)
8484
- **capabilities** (optional) - an object containing metadata pertaining to a capability announced by the wallet in the [CAIP-25][] return object, to be invoked with this method
8585

8686
### Validation
8787

88-
1. A respondent SHOULD check the `scope` against active session's `scopeObject`s before executing or responding to such a request, and SHOULD invalidate a request for a scope not previously authorized.
89-
2. The respondent SHOULD check that `request.method` is authorized for the specified scope, and SHOULD invalidate a request for a scope not previously authorized.
88+
1. A respondent SHOULD check the `chainId` against active session's `scopeObject`s before executing or responding to such a request, and SHOULD invalidate a request for a chainId not previously authorized.
89+
2. The respondent SHOULD check that `request.method` is authorized for the specified chainId, and SHOULD invalidate a request for a chainId not previously authorized.
9090
3. The respondent MAY check that the `request.params` are valid for `request.method`, if its syntax is known to it.
9191
4. The respondent MAY apply other logic or validation.
9292
5. The respondent MAY chose to drop invalid requests or return an error message, but it MUST NOT route or submit them.
@@ -102,7 +102,7 @@ If the targeted network returns a response to the respondent, the respondent MAY
102102
"jsonrpc": "2.0",
103103
"result": {
104104
"sessionId": "0xdeadbeef",
105-
"scope": "eip155:1",
105+
"chainId": "eip155:1",
106106
"result": {
107107
"method": "eth_sendTransaction",
108108
"result": "0x4e306b5a5a37532e1734503f7d2427a86f2c992fbe471f5be403b9f734e667c8"
@@ -136,7 +136,7 @@ Conversely, errors specific to the method passed or its RPC namespace should be
136136
"jsonrpc": "2.0",
137137
"result": {
138138
"sessionId": "0xdeadbeef",
139-
"scope": "eip155:1",
139+
"chainId": "eip155:1",
140140
"error": {
141141
"code": 4100,
142142
"message": "The requested account and/or method has not been authorized by the user."
@@ -149,7 +149,7 @@ The latter category of error depend on the design of the passed method defined w
149149

150150
## Backwards Compatibility
151151

152-
Early drafts of this specification did not constrain `scope` to [CAIP-2] identifiers, but rather to any [valid scopeStrings][CAIP-217] previously-authorized, including namespace-wide ones.
152+
Early drafts of this specification did not constrain `chainId` to [CAIP-2] identifiers, but rather to any [valid scopeStrings][CAIP-217] previously-authorized, including namespace-wide ones.
153153
No known implementations in production took advantage of this affordance, as to date no RPC [namespaces] have been defined that could receive such requests regardless of [CAIP-2] network identifiers.
154154

155155
## Links

0 commit comments

Comments
 (0)