Skip to main content
Version: pre-release (v0.78)

Submit JSON-RPC request to wallet API

POST 

/v2/requests

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.

Request

Header Parameters

    Origin stringrequired

    The origin of the request. If this header is missing, the request will be rejected as an unauthorized request (401 Unauthorized).

    Authorization string

    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).

    Examples:

    Example: VWT stuTxgheMY8RZyISS9voyLjXHBaQFS7DRqDyXCM7Xx6rcj8zP84U1XNAIhf8110S

Body

required

The JSON-RPC v2 request

    jsonrpc string

    Possible values: [2.0]

    method string
    params object
    id string

    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.

Responses

The request is successful. On this endpoint, only this type of response format should be expected.

Schema
    jsonrpc string

    Possible values: [2.0]

    result object
    errors object
    code number
    message string
    data string
    id string
Loading...