Submit JSON-RPC request to wallet API
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.
The ID
should be specified. See the JSON-RPC notification documentation for more details.
Content type
This endpoint returns a response with a specific Content-Type
header: application/json-rpc
.
This content type is used to help third-party applications differentiate the different JSON formats returned by the service.
Note that application/json-rpc
is not a standard HTTP content type.
Authentication
Workflow
When connecting to a wallet, a connection token will be received back through the Authorisation
header.
When 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.
Community implementation of the wallet service
People 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.
This 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.
Token format
The token will be formatted as follows:
VWT \<YOUR_TOKEN\>
VWT
scheme stands for "Vega Wallet Token" and is not a standard authorisation scheme.
YOUR_TOKEN
is a randomly generated string of 64 characters with numbers and letters. Each session generates a unique one.
Header Parameters
The origin of the request. If this header is missing, the request will be rejected as an unauthorized request (401 Unauthorized).
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).
Example: VWT stuTxgheMY8RZyISS9voyLjXHBaQFS7DRqDyXCM7Xx6rcj8zP84U1XNAIhf8110S
Request Body required
The JSON-RPC v2 request
Possible values: [2.0
]
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
.
- 200
- 204
- 400
- 401
- 500
The request is successful. On this endpoint, only this type of response format should be expected.
Schema
Possible values: [2.0
]
errors object
{
"jsonrpc": "2.0",
"result": {},
"errors": {
"code": 0,
"message": "string",
"data": "string"
},
"id": "string"
}
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.
Something went wrong
Schema
Possible values: [2.0
]
errors object
{
"jsonrpc": "2.0",
"errors": {
"code": 0,
"message": "string",
"data": "string"
},
"id": "string"
}
This error code is returned when the authentication failed.
Something failed internally. Nothing can be done about it on the client side. Reporting the issue to the wallet software developers is encouraged.