aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/shared/types.go
blob: 46fd5552c0755c4678687e77cc799d42d1deff72 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package shared

import "encoding/json"

// RPC request
type Request struct {
    Id      interface{}     `json:"id"`
    Jsonrpc string          `json:"jsonrpc"`
    Method  string          `json:"method"`
    Params  json.RawMessage `json:"params"`
}

// RPC response
type Response struct {
    Id      interface{} `json:"id"`
    Jsonrpc string      `json:"jsonrpc"`
}

// RPC success response
type SuccessResponse struct {
    Id      interface{} `json:"id"`
    Jsonrpc string      `json:"jsonrpc"`
    Result  interface{} `json:"result"`
}

// RPC error response
type ErrorResponse struct {
    Id      interface{}  `json:"id"`
    Jsonrpc string       `json:"jsonrpc"`
    Error   *ErrorObject `json:"error"`
}

// RPC error response details
type ErrorObject struct {
    Code    int    `json:"code"`
    Message string `json:"message"`
    // Data    interface{} `json:"data"`
}