-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
118 lines (99 loc) · 3.49 KB
/
types.go
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
package gosol
import "net/http"
// Client represents a JSON-RPC client with a base URL.
type Client struct {
BaseURL string
HttpClient *http.Client
}
type ClientOptions struct {
HttpClient *http.Client
}
// RPCRequest represents a JSON-RPC request object.
type RPCRequest struct {
JSONRPC string `json:"jsonrpc"`
ID int `json:"id"`
Method string `json:"method"`
Params interface{} `json:"params"`
}
type RPCResponse[T any | Result[T] | int64] struct {
ID int64 `json:"id,omitempty"`
Jsonrpc string `json:"jsonrpc,omitempty"`
Result T `json:"result,omitempty"`
}
type Result[T any] struct {
Context *Context `json:"context,omitempty"`
Value *T `json:"value,omitempty"`
}
type Context struct {
APIVersion string `json:"apiVersion,omitempty"`
Slot int64 `json:"slot,omitempty"`
}
type AccountInfo struct {
Data []string `json:"data,omitempty"`
Executable bool `json:"executable,omitempty"`
Lamports int64 `json:"lamports,omitempty"`
Owner string `json:"owner,omitempty"`
RentEpoch int64 `json:"rentEpoch,omitempty"`
Space int64 `json:"space,omitempty"`
}
type GetBlockProps struct {
Encoding string `json:"encoding"`
MaxSupportedTransactionVersion int64 `json:"maxSupportedTransactionVersion"`
TransactionDetails string `json:"transactionDetails"`
Rewards bool `json:"rewards"`
}
type BlockResult struct {
BlockHeight int64 `json:"blockHeight"`
BlockTime interface{} `json:"blockTime"`
Blockhash string `json:"blockhash"`
ParentSlot int64 `json:"parentSlot"`
PreviousBlockhash string `json:"previousBlockhash"`
Transactions []TransactionElement `json:"transactions"`
}
type TransactionElement struct {
Meta *Meta `json:"meta"`
Transaction *TransactionTransaction `json:"transaction"`
}
type Meta struct {
Err interface{} `json:"err"`
Fee int64 `json:"fee"`
InnerInstructions []interface{} `json:"innerInstructions"`
LogMessages []interface{} `json:"logMessages"`
PostBalances []int64 `json:"postBalances"`
PostTokenBalances []interface{} `json:"postTokenBalances"`
PreBalances []int64 `json:"preBalances"`
PreTokenBalances []interface{} `json:"preTokenBalances"`
Rewards interface{} `json:"rewards"`
Status *Status `json:"status"`
}
type Status struct {
Ok interface{} `json:"Ok"`
}
type TransactionTransaction struct {
Message *Message `json:"message"`
Signatures []string `json:"signatures"`
}
type Message struct {
AccountKeys []string `json:"accountKeys"`
Header *Header `json:"header"`
Instructions []Instruction `json:"instructions"`
RecentBlockhash string `json:"recentBlockhash"`
}
type Header struct {
NumReadonlySignedAccounts int64 `json:"numReadonlySignedAccounts"`
NumReadonlyUnsignedAccounts int64 `json:"numReadonlyUnsignedAccounts"`
NumRequiredSignatures int64 `json:"numRequiredSignatures"`
}
type Instruction struct {
Accounts []int64 `json:"accounts"`
Data string `json:"data"`
ProgramIDIndex int64 `json:"programIdIndex"`
}
type GetBlockProdResponse struct {
ByIdentity map[string][]int64 `json:"byIdentity"`
Range *Range `json:"range"`
}
type Range struct {
FirstSlot int64 `json:"firstSlot"`
LastSlot int64 `json:"lastSlot"`
}