Added OpenRPC doc for CAIP-25#212
Conversation
assets/CAIP-25/openrpc.json
Outdated
| "methods": [ | ||
| { | ||
| "name": "provider_authorization", | ||
| "paramStructure": "by-position", |
There was a problem hiding this comment.
shouldn't this be "by-name"?
There was a problem hiding this comment.
ah yes, I think we were playing around with this setting when we were chatting.
There was a problem hiding this comment.
I think by-position might be better, at least as written, because the requiredScopes and optionalScopes objects, as currently specified, are both optional-- by-name/key-locked array parsing would expect empty ones (arrays with 0 members) rather than null arrays at that keyvalue, right?
There was a problem hiding this comment.
In JSON-RPC, the params key can either be an object or an array. The example in CAIP-25 uses the by-name format, where params is an object. It is not specified if this is a requirement or if using params: [] as an array is also allowed.
There was a problem hiding this comment.
my question was about a request with no optionalScopes -- am I misreading or would a response without an optional object still be valid under by-name parsing?
There was a problem hiding this comment.
by-name would be
{
"id": 1,
"jsonrpc": "2.0",
"method": "provider_authorization",
"params": {
"requiredNamespaces": {
"eip155": {
"chains": [
"eip155:1",
"eip155:137"
],
"methods": [
"eth_sendTransaction",
"eth_signTransaction",
"eth_sign",
"get_balance",
"personal_sign"
],
"events": [
"accountsChanged",
"chainChanged"
]
},
"eip155:10": {
"methods": [
"get_balance"
],
"events": [
"accountsChanged",
"chainChanged"
]
},
"cosmos": {}
},
"optionalNamespaces": {
"eip155:42161": {
"methods": [
"eth_sendTransaction",
"eth_signTransaction",
"get_balance",
"personal_sign"
],
"events": [
"accountsChanged",
"chainChanged"
]
}
},
"sessionProperties": {
"expiry": "2022-12-24T17:07:31+00:00"
}
}
}
by position would look like:
{
"jsonrpc": "2.0",
"method": "provider_authorization",
"params": [
{
"eip155": {
"chains": [
"eip155:1",
"eip155:137"
],
"methods": [
"eth_sendTransaction",
"eth_signTransaction",
"eth_sign",
"get_balance",
"personal_sign"
],
"events": [
"accountsChanged",
"chainChanged"
]
},
"eip155:10": {
"methods": [
"get_balance"
],
"events": [
"accountsChanged",
"chainChanged"
]
},
"cosmos": {}
},
{
"eip155:42161": {
"methods": [
"eth_sendTransaction",
"eth_signTransaction",
"get_balance",
"personal_sign"
],
"events": [
"accountsChanged",
"chainChanged"
]
}
},
{
"expiry": "2022-12-24T17:07:31+00:00"
}
],
"id": 0
}
|
This is super helpful! I'll update and merge this after we decide other PRs (which would change the names of the properties and make this obsolete, haha). Some questions before our next meeting:
|
|
@bumblefudge, the OpenRPC Document would serve as the formal/machine readable spec for the API, incorporating information from CAIP-25, CAIP-207, and any other relevant CAIPs. |
|
|
It looks like 217 might cover this - @shanejonas is it okay if we move this to close? |
|
@shanejonas @hmalik88 @bumblefudge @obstropolos I think we can close this in favor of #217 |
yeah, that's fine. |
|
Two weeks since original request for closing - closing for now. |
This pull request adds an OpenRPC document to describe CAIP-25, not sure where to link to it in the markdown, let me know if you have any suggestions.
Here is a preview in the playground:
https://playground.open-rpc.org?url=https://raw.githubusercontent.com/shanejonas/CAIPs/caip-25-openrpc/assets/CAIP-25/openrpc.json