From 06e53c6f30bde77c214306c953f604a0849e33bb Mon Sep 17 00:00:00 2001 From: Shane Date: Thu, 27 Jun 2024 09:55:54 -0400 Subject: [PATCH] fix: add caip-27 + fix strings in yaml for multichain (#238) --- multichain/openrpc.yaml | 226 ++++++++++++++++++++++++---------------- 1 file changed, 135 insertions(+), 91 deletions(-) diff --git a/multichain/openrpc.yaml b/multichain/openrpc.yaml index cf200a7..2ae0560 100644 --- a/multichain/openrpc.yaml +++ b/multichain/openrpc.yaml @@ -5,179 +5,223 @@ info: description: >- This provides the specs for the MultiChain API Layer for the MetaMask API methods: - - name: "provider_authorize" - paramStructure: "by-name" + - name: provider_request + paramStructure: by-name params: - - name: "requiredScopes" - description: "Scopes that the wallet must support in order to be used with this provider." + - name: scope + description: a valid `scopeObject` that has been previously authorized via `provider_authorize` + required: true + schema: + $ref: "#/components/schemas/Scope" + - name: request + description: an object containing a JSON-RPC request with `method` and `params` + deprecated: false + required: true schema: type: "object" + properties: + method: + type: "string" + params: + true + - name: "sessionId" + description: >- + [CAIP-171](https://chainagnostic.org/CAIPs/caip-171) `SessionId` referencing a known, open session + schema: + type: "string" + result: + name: provider_requestResult + schema: + true + examples: + - name: provider_requestExample + params: + - name: scope + value: eip155:1 + - name: request + value: + method: eth_getBalance + params: [] + - name: sessionId + value: "0xdeadbeef" + result: + name: provider_requestResult + value: "0x1" + - name: provider_authorize + paramStructure: by-name + params: + - name: requiredScopes + description: Scopes that the wallet must support in order to be used with this provider. + schema: + type: object patternProperties: "[-a-z0-9]{3,8}(:[-_a-zA-Z0-9]{1,32})?": $ref: "#/components/schemas/Scope" - - name: "optionalScopes" - description: "Scopes that the wallet may support in order to be used with this provider." + - name: optionalScopes + description: Scopes that the wallet may support in order to be used with this provider. schema: - type: "object" + type: object patternProperties: "[-a-z0-9]{3,8}(:[-_a-zA-Z0-9]{1,32})?": $ref: "#/components/schemas/Scope" - - name: "sessionProperties" - description: "Properties that the wallet may use to determine if the session is valid." + - name: sessionProperties + description: Properties that the wallet may use to determine if the session is valid. schema: - type: "object" + type: object properties: expiry: - type: "string" - format: "date-time" + type: string + format: date-time result: - name: "provider_authorizeResult" + name: provider_authorizeResult schema: - type: "object" + type: object properties: sessionId: - description: "A unique identifier for the session. Defined by [CAIP-171](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-171.md)" - type: "string" + description: A unique identifier for the session. Defined by [CAIP-171](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-171.md) + type: string sessionScopes: - type: "object" + type: object patternProperties: "[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}": $ref: "#/components/schemas/Scope" sessionProperties: - type: "object" + type: object properties: expiry: - type: "string" - format: "date-time" + type: string + format: date-time examples: - - name: "provider_authorizeExample" - description: "Example of a provider authorization request." + - name: provider_authorizeExample + description: Example of a provider authorization request. params: - - name: "requiredScopes" + - name: requiredScopes value: eip155: chains: - - "eip155:1" - - "eip155:137" + - eip155:1 + - eip155:137 methods: - - "eth_sendTransaction" - - "eth_getBalance" - - "personal_sign" + - eth_sendTransaction + - eth_getBalance + - personal_sign notifications: - - "accountsChanged" - - "chainChanged" - "eip155:10": + - accountsChanged + - chainChanged + eip155:10: methods: - - "eth_getBalance" + - eth_getBalance notifications: - - "accountsChanged" - - "chainChanged" - - name: "optionalScopes" + - accountsChanged + - chainChanged + - name: optionalScopes value: - "eip155:42161": + eip155:42161: methods: - - "eth_sendTransaction" - - "eth_getBalance" - - "personal_sign" + - eth_sendTransaction + - eth_getBalance + - personal_sign notifications: - - "accountsChanged" - - "chainChanged" - - name: "sessionProperties" + - accountsChanged + - chainChanged + - name: sessionProperties value: expiry: "2022-12-24T17:07:31+00:00" result: - name: "provider_authorizationResultExample" + name: provider_authorizationResultExample value: sessionId: "0xdeadbeef" sessionScopes: eip155: chains: - - "eip155:1" - - "eip155:137" + - eip155:1 + - eip155:137 methods: - - "eth_sendTransaction" - - "eth_getBalance" - - "personal_sign" + - eth_sendTransaction + - eth_getBalance + - personal_sign notifications: - - "accountsChanged" - - "chainChanged" + - accountsChanged + - chainChanged accounts: - - "eip155:1:0xab16a96d359ec26a11e2c2b3d8f8b8942d5bfcdb" - - "eip155:137:0xab16a96d359ec26a11e2c2b3d8f8b8942d5bfcdb" - "eip155:10": + - eip155:1:0xab16a96d359ec26a11e2c2b3d8f8b8942d5bfcdb + - eip155:137:0xab16a96d359ec26a11e2c2b3d8f8b8942d5bfcdb + eip155:10: methods: - - "eth_getBalance" + - eth_getBalance notifications: - - "accountsChanged" - - "chainChanged" + - accountsChanged + - chainChanged accounts: [] - "eip155:42161": + eip155:42161: methods: - - "personal_sign" + - personal_sign notifications: - - "accountsChanged" - - "chainChanged" + - accountsChanged + - chainChanged accounts: - - "eip155:42161:0x0910e12C68d02B561a34569E1367c9AAb42bd810" + - eip155:42161:0x0910e12C68d02B561a34569E1367c9AAb42bd810 cosmos: {} sessionProperties: expiry: "2022-11-31T17:07:31+00:00" errors: - code: 5000 - message: "User disapproved requested chains" + message: User disapproved requested chains - code: 5001 - message: "User disapproved requested methods" + message: User disapproved requested methods - code: 5002 - message: "User disapproved requested notifications" + message: User disapproved requested notifications - code: 5100 - message: "Requested chains are not supported" + message: Requested chains are not supported - code: 5101 - message: "Requested methods are not supported" + message: Requested methods are not supported - code: 5102 - message: "Requested notifications are not supported" + message: Requested notifications are not supported - code: 5103 - message: "Scope/chain mismatch" + message: Scope/chain mismatch - code: 5104 - message: "ChainId defined in two different scopes" + message: ChainId defined in two different scopes - code: 5200 - message: "Invalid Session Properties requested" + message: Invalid Session Properties requested - code: 5201 - message: "Session Properties can only be optional" + message: Session Properties can only be optional components: schemas: + ScopeString: + type: string + pattern: "[-a-z0-9]{3,8}(:[-_a-zA-Z0-9]{1,32})?" Scope: - type: "object" - title: "Scope" - description: "Scope for a multi-chain connection" + type: object + title: Scope + description: Scope for a multi-chain connection additionalProperties: true required: - notifications - methods properties: chains: - type: "array" + type: array items: - type: "string" - pattern: "[-a-z0-9]{3,8}(:[-_a-zA-Z0-9]{1,32})?" + $ref: "#/components/schemas/ScopeString" methods: - description: "Methods that the wallet must support in order to be used with this provider." - type: "array" + description: Methods that the wallet must support in order to be used with this provider. + type: array items: - type: "string" + type: string notifications: - description: "notifications that the wallet must support in order to be used with this provider." - type: "array" + description: Notifications that the wallet must support in order to be used with this provider. + type: array items: - type: "string" + type: string rpcEndpoints: - description: "JSON-RPC endpoints for this namespace." - type: "array" + description: JSON-RPC endpoints for this namespace. + type: array items: - type: "string" - format: "uri" + type: string + format: uri rpcDocuments: - type: "array" - description: "OpenRPC documents that define RPC methods in which to anchor the methods authorized in a CAIP-25 interaction." + type: array + description: OpenRPC documents that define RPC methods in which to anchor the methods authorized in a CAIP-25 interaction. items: - type: "string" - format: "uri" + type: string + format: uri