forked from Syndica/sig
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.zig
146 lines (127 loc) · 3.14 KB
/
types.zig
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
const std = @import("std");
const sig = @import("../sig.zig");
const TransactionError = sig.ledger.transaction_status.TransactionError;
pub const Commitment = enum {
finalized,
confirmed,
processed,
};
pub const Context = struct {
slot: u64,
apiVersion: []const u8,
};
pub const AccountInfo = struct {
context: Context,
value: ?Value,
pub const Value = struct {
data: []const u8,
executable: bool,
lamports: u64,
owner: []const u8,
rentEpoch: u64,
space: u64,
};
};
pub const Balance = struct {
context: Context,
value: u64,
};
pub const BlockCommitment = struct {
commitment: ?[]const u64,
totalStake: u64,
};
// TODO: BlockProduction
// TODO: BlockTime
// TODO: Blocks
// TODO: BlocksWithLimit
pub const RpcContactInfo = struct {
/// Pubkey of the node as a base-58 string
pubkey: []const u8,
/// Gossip port
gossip: ?[]const u8,
/// Tvu UDP port
tvu: ?[]const u8,
/// Tpu UDP port
tpu: ?[]const u8,
/// Tpu QUIC port
tpuQuic: ?[]const u8,
/// Tpu UDP forwards port
tpuForwards: ?[]const u8,
/// Tpu QUIC forwards port
tpuForwardsQuic: ?[]const u8,
/// Tpu UDP vote port
tpuVote: ?[]const u8,
/// Server repair UDP port
serveRepair: ?[]const u8,
/// JSON RPC port
rpc: ?[]const u8,
/// WebSocket PubSub port
pubsub: ?[]const u8,
/// Software version
version: ?[]const u8,
/// First 4 bytes of the FeatureSet identifier
featureSet: ?u32,
/// Shred version
shredVersion: ?u16,
};
pub const EpochInfo = struct {
absoluteSlot: u64,
blockHeight: u64,
epoch: u64,
slotIndex: u64,
slotsInEpoch: u64,
transactionCount: u64,
};
// TODO: EpochSchedule
// TODO: FeeForMessage
// TODO: FirstAvailableBlock
// TODO: GenesisHash
// TODO: Health
// TODO: HighestSnapshotSlot
// TODO: Identity
// TODO: InflationGovernor
// TODO: InflationRate
// TODO: InflationReward
// TODO: LargeAccounts
pub const LatestBlockhash = struct {
context: Context,
value: Value,
pub const Value = struct {
blockhash: []const u8,
lastValidBlockHeight: u64,
};
};
pub const LeaderSchedule = std.StringArrayHashMap([]const u64);
// TODO: MaxRetransmitSlot
// TODO: MaxShredInsertSlot
// TODO: MinimumBalanceForRentExemption
// TODO: MultipleAccounts
// TODO: ProgramAccounts
// TODO: RecentPerformanceSamples
// TODO: RecentPrioritizationFees
pub const SignatureStatuses = struct {
context: Context,
value: []const ?TransactionStatus,
pub const TransactionStatus = struct {
slot: u64,
confirmations: ?usize,
err: ?TransactionError,
confirmationStatus: ?[]const u8,
};
};
pub const ClusterType = union(enum(u8)) {
MainnetBeta,
Testnet,
Devnet,
LocalHost,
Custom: struct {
url: []const u8,
},
};
pub const RpcVersionInfo = struct {
// TODO: figure out how to support "solana_core" and "feature_set"
// rn to correctly parse the json response we need to have '-' in the field name
@"solana-core": []const u8,
@"feature-set": ?u32,
};
pub const Signature = []const u8;