code.vegaprotocol.io/vega@v0.79.0/wallet/service/openapi.json (about) 1 { 2 "openapi": "3.0.3", 3 "info": { 4 "title": "Wallet API", 5 "description": "The version 2 of the wallet HTTP API leverages the wallet JSON-RPC API.\n\n## Workflow\n1. Use `GET /v2/methods` to ensure the JSON-RPC API exposes all the methods your application requires.\n\n2. Use `POST /v2/requests` endpoint to submit requests to the JSON-RPC API.\n## Useful links\n- [JSON-RPC 2.0 Specification](https://www.jsonrpc.org/specification)", 6 "version": "2.0.0" 7 }, 8 "servers": [ 9 { "url": "http://localhost:1789/api/", "description": "Local wallet" } 10 ], 11 "externalDocs": { 12 "description": "Find out more about Vega REST APIs.", 13 "url": "https://docs.vega.xyz/docs/mainnet/api/rest/overview" 14 }, 15 "paths": { 16 "/v2/requests": { 17 "post": { 18 "summary": "Submit JSON-RPC request to wallet API", 19 "description": "This endpoint is the main entry point to submit JSON-RPC requests. The body of the HTTP request should be formatted as a JSON-RPC v2 request. The HTTP response is formatted as the JSON-RPC v2 response.\n\nThe `ID` should be specified. See [the JSON-RPC notification documentation](https://www.jsonrpc.org/specification#notification) for more details.\n\n# Content type\nThis endpoint returns a response with a specific `Content-Type` header: `application/json-rpc`.\n\nThis content type is used to help third-party applications differentiate the different JSON formats returned by the service. \n\nNote that `application/json-rpc` is not a standard HTTP content type.\n\n# Authentication\n\n## Workflow\nWhen connecting to a wallet, a connection token will be received back through the `Authorisation` header.\n\nWhen accessing protected JSON-RPC methods, the connection token must be set to the `Authorisation` header. If the connection token is not valid, the server returns a response with the HTTP code 401, and the `WWW-Authenticate` header set to `VWT` as required by the HTTP standards.\n\n### Community implementation of the wallet service\nPeople might be willing to implement their own wallet service with their own authentication system. It's recommended that any community implementations follow the same workflow.\n\nThis will save third-party applications from having to _explicitly_ support different authentication schemes, and make the community implementations fully interoperable with all third-party applications, out of the box.\n\n### Token format\n\n\nThe token will be formatted as follows:\n`VWT \\<YOUR_TOKEN\\>`\n\n`VWT` scheme stands for \"Vega Wallet Token\" and is not a standard authorisation scheme.\n\n`YOUR_TOKEN` is a randomly generated string of 64 characters with numbers and letters. Each session generates a unique one.", 20 "tags": ["Wallet"], 21 "parameters": [ 22 { 23 "in": "header", 24 "name": "Origin", 25 "description": "The origin of the request. If this header is missing, the request will be rejected as an unauthorized request (401 Unauthorized).", 26 "required": true, 27 "schema": { 28 "type": "string" 29 } 30 }, 31 { 32 "in": "header", 33 "name": "Authorization", 34 "description": "The token used to access the protected methods. The format is `VWT YOUR_TOKEN`. VWT is a non-standard scheme that stands for Vega Wallet Token. If this header is missing when accessing protected methods, the request will be rejected as an unauthorized request (401 Unauthorized).", 35 "schema": { 36 "type": "string" 37 }, 38 "examples": { 39 "test": { 40 "value": "VWT stuTxgheMY8RZyISS9voyLjXHBaQFS7DRqDyXCM7Xx6rcj8zP84U1XNAIhf8110S" 41 } 42 } 43 } 44 ], 45 "requestBody": { 46 "description": "The JSON-RPC v2 request", 47 "content": { 48 "application/json-rpc": { 49 "schema": { 50 "$ref": "#/components/schemas/JsonRpcRequest" 51 } 52 } 53 }, 54 "required": true 55 }, 56 "responses": { 57 "200": { 58 "description": "The request is successful. On this endpoint, only this type of response format should be expected.", 59 "content": { 60 "application/json-rpc": { 61 "schema": { 62 "$ref": "#/components/schemas/JsonRpcResponse" 63 } 64 } 65 } 66 }, 67 "204": { 68 "description": "This response is returned when there is no `id` property valued in the JSON-RPC request. Concretely, when a JSON-RPC request doesn't have an ID, it is considered a JSON-RPC notification and, as such, no result is to be expected, even in case of failure." 69 }, 70 "400": { 71 "description": "Something went wrong", 72 "content": { 73 "application/json-rpc": { 74 "schema": { 75 "type": "object", 76 "description": "This payload is returned when an error occurs at the JSON-RPC API level. See [the JSON-RPC response documentation](https://www.jsonrpc.org/specification#response_object) for more details.", 77 "properties": { 78 "jsonrpc": { 79 "type": "string", 80 "required": true, 81 "enum": [ 82 "2.0" 83 ] 84 }, 85 "errors": { 86 "type": "object", 87 "properties": { 88 "code": { 89 "type": "number" 90 }, 91 "message": { 92 "type": "string" 93 }, 94 "data": { 95 "type": "string" 96 } 97 } 98 }, 99 "id": { 100 "type": "string" 101 } 102 } 103 } 104 } 105 } 106 }, 107 "401": { 108 "description": "This error code is returned when the authentication failed." 109 }, 110 "500": { 111 "description": "Something failed internally. Nothing can be done about it on the client side. Reporting the issue to the wallet software developers is encouraged." 112 } 113 } 114 } 115 }, 116 "/v2/methods": { 117 "get": { 118 "summary": "List the available methods on the JSON-RPC API", 119 "description": "The JSON-RPC API behind this HTTP API can have an arbitrary set of endpoints enabled.\n\nThis method allows an application to check for the existence of the JSON-RPC before calling the requests method.", 120 "tags": ["Wallet"], 121 "responses": { 122 "200": { 123 "description": "Successful listing", 124 "content": { 125 "application/json": { 126 "examples": { 127 "Example 1": { 128 "summary" : "Listing the registered methods", 129 "value" : { 130 "result": { 131 "registeredMethods": [ 132 "client.connect_wallet", 133 "client.disconnect_wallet", 134 "client.list_keys", 135 "client.send_transaction" 136 ] 137 } 138 } 139 } 140 }, 141 "schema": { 142 "type": "object", 143 "properties": { 144 "result": { 145 "type": "object", 146 "properties": { 147 "registeredMethods": { 148 "type": "array", 149 "required": true 150 } 151 } 152 } 153 } 154 } 155 } 156 } 157 }, 158 "400": { 159 "description": "Something went wrong", 160 "content": { 161 "application/json": { 162 "schema": { 163 "type": "object", 164 "properties": { 165 "errors": { 166 "type": "object", 167 "properties": { 168 "message": { 169 "type": "string" 170 }, 171 "data": { 172 "type": "string" 173 } 174 } 175 } 176 } 177 } 178 } 179 } 180 }, 181 "500": { 182 "description": "Something failed internally. Nothing can be done about it." 183 } 184 } 185 } 186 }, 187 "/v2/health": { 188 "get": { 189 "summary": "Checks if service is up and running", 190 "description": "If the service is running, this endpoint returns 200, otherwise the endpoint will be unreachable.", 191 "tags": ["Wallet"], 192 "responses": { 193 "200": { 194 "description": "The service is alive." 195 }, 196 "500": { 197 "description": "Something failed internally. Nothing can be done about it." 198 } 199 } 200 } 201 } 202 }, 203 "components": { 204 "schemas": { 205 "JsonResponse": { 206 "type": "object", 207 "description": "This payload is returned by HTTP handlers. It's the generic envelope for all HTTP responses that do not come from the JSON-RPC API.", 208 "properties": { 209 "result": { 210 "type": "object" 211 }, 212 "errors": { 213 "type": "object", 214 "properties": { 215 "message": { 216 "type": "string" 217 }, 218 "data": { 219 "type": "string" 220 } 221 } 222 } 223 } 224 }, 225 "JsonRpcRequest": { 226 "type": "object", 227 "description": "This request payload is used to query the JSON-RPC API. See [the JSON-RPC request documentation](https://www.jsonrpc.org/specification#request_object) for more details.", 228 "properties": { 229 "jsonrpc": { 230 "required": true, 231 "type": "string", 232 "enum": [ 233 "2.0" 234 ] 235 }, 236 "method": { 237 "required": true, 238 "type": "string" 239 }, 240 "params": { 241 "type": "object" 242 }, 243 "id": { 244 "description": "According to the JSON-RPC v2 standard, if the ID is not specified, an empty response should be returned, whatever the state is (success or error). In the Vega implementation, this empty response corresponds to `204 No content`.", 245 "type": "string" 246 } 247 } 248 }, 249 "JsonRpcResponse": { 250 "type": "object", 251 "description": "This payload is returned by the JSON-RPC API sitting behind the `/v2/requests` endpoint. See [the JSON-RPC response documentation](https://www.jsonrpc.org/specification#response_object) for more details.", 252 "properties": { 253 "jsonrpc": { 254 "type": "string", 255 "required": true, 256 "enum": [ 257 "2.0" 258 ] 259 }, 260 "result": { 261 "type": "object" 262 }, 263 "errors": { 264 "type": "object", 265 "properties": { 266 "code": { 267 "type": "number" 268 }, 269 "message": { 270 "type": "string" 271 }, 272 "data": { 273 "type": "string" 274 } 275 } 276 }, 277 "id": { 278 "type": "string" 279 } 280 } 281 } 282 } 283 } 284 }