forked from block-vision/sui-go-sdk
/
read_system.go
216 lines (195 loc) · 11 KB
/
read_system.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
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
package models
type SuiGetCheckpointRequest struct {
CheckpointID string `json:"id"`
}
type EpochRollingGasCostSummary struct {
ComputationCost string `json:"computationCost"`
StorageCost string `json:"storageCost"`
StorageRebate string `json:"storageRebate"`
NonRefundableStorageFee string `json:"nonRefundableStorageFee"`
}
type CheckpointResponse struct {
Epoch string `json:"epoch"`
SequenceNumber string `json:"sequenceNumber"`
Digest string `json:"digest"`
NetworkTotalTransactions string `json:"networkTotalTransactions"`
PreviousDigest string `json:"previousDigest"`
EpochRollingGasCostSummary EpochRollingGasCostSummary `json:"epochRollingGasCostSummary"`
TimestampMs string `json:"timestampMs"`
Transactions []string `json:"transactions"`
CheckpointCommitments []interface{} `json:"checkpointCommitments"`
ValidatorSignature string `json:"validatorSignature"`
}
type SuiGetCheckpointsRequest struct {
// optional paging cursor
Cursor interface{} `json:"cursor"`
// maximum number of items per page
Limit uint64 `json:"limit" validate:"lte=50"`
// query result ordering, default to false (ascending order), oldest record first
DescendingOrder bool `json:"descendingOrder"`
}
type PaginatedCheckpointsResponse struct {
Data []CheckpointResponse `json:"data"`
NextCursor string `json:"nextCursor"`
HasNextPage bool `json:"hasNextPage"`
}
type SuiXGetCommitteeInfoRequest struct {
Epoch string `json:"epoch"`
}
type SuiXGetCommitteeInfoResponse struct {
Epoch string `json:"epoch"`
Validators [][]string `json:"validators"`
}
type SuiXGetStakesRequest struct {
Owner string `json:"owner"`
}
type SuiXGetStakesByIdsRequest struct {
StakedSuiIds []string `json:"stakedSuiIds"`
}
type DelegatedStakeInfo struct {
StakedSuiId string `json:"stakedSuiId"`
StakeRequestEpoch string `json:"stakeRequestEpoch"`
StakeActiveEpoch string `json:"stakeActiveEpoch"`
Principal string `json:"principal"`
Status string `json:"status"`
EstimatedReward string `json:"estimatedReward"`
}
type DelegatedStakesResponse struct {
ValidatorAddress string `json:"validatorAddress"`
StakingPool string `json:"stakingPool"`
Stakes []DelegatedStakeInfo `json:"stakes"`
}
type SuiXGetEpochsRequest struct {
// optional paging cursor
Cursor interface{} `json:"cursor"`
// maximum number of items per page
Limit uint64 `json:"limit" validate:"lte=50"`
// query result ordering, default to false (ascending order), oldest record first
DescendingOrder bool `json:"descendingOrder"`
}
type SuiValidatorSummary struct {
SuiAddress SuiAddress `json:"suiAddress"`
ProtocolPubkeyBytes string `json:"protocolPubkeyBytes"`
NetworkPubkeyBytes string `json:"networkPubkeyBytes"`
WorkerPubkeyBytes string `json:"workerPubkeyBytes"`
ProofOfPossessionBytes string `json:"proofOfPossessionBytes"`
OperationCapId string `json:"operationCapId"`
Name string `json:"name"`
Description string `json:"description"`
ImageUrl string `json:"imageUrl"`
ProjectUrl string `json:"projectUrl"`
P2pAddress string `json:"p2pAddress"`
NetAddress string `json:"netAddress"`
PrimaryAddress string `json:"primaryAddress"`
WorkerAddress string `json:"workerAddress"`
NextEpochProtocolPubkeyBytes string `json:"nextEpochProtocolPubkeyBytes"`
NextEpochProofOfPossession string `json:"nextEpochProofOfPossession"`
NextEpochNetworkPubkeyBytes string `json:"nextEpochNetworkPubkeyBytes"`
NextEpochWorkerPubkeyBytes string `json:"nextEpochWorkerPubkeyBytes"`
NextEpochNetAddress string `json:"nextEpochNetAddress"`
NextEpochP2pAddress string `json:"nextEpochP2pAddress"`
NextEpochPrimaryAddress string `json:"nextEpochPrimaryAddress"`
NextEpochWorkerAddress string `json:"nextEpochWorkerAddress"`
VotingPower string `json:"votingPower"`
GasPrice string `json:"gasPrice"`
CommissionRate string `json:"commissionRate"`
NextEpochStake string `json:"nextEpochStake"`
NextEpochGasPrice string `json:"nextEpochGasPrice"`
NextEpochCommissionRate string `json:"nextEpochCommissionRate"`
StakingPoolId string `json:"stakingPoolId"`
StakingPoolActivationEpoch string `json:"stakingPoolActivationEpoch"`
StakingPoolDeactivationEpoch string `json:"stakingPoolDeactivationEpoch"`
StakingPoolSuiBalance string `json:"stakingPoolSuiBalance"`
RewardsPool string `json:"rewardsPool"`
PoolTokenBalance string `json:"poolTokenBalance"`
PendingStake string `json:"pendingStake"`
PendingPoolTokenWithdraw string `json:"pendingPoolTokenWithdraw"`
PendingTotalSuiWithdraw string `json:"pendingTotalSuiWithdraw"`
ExchangeRatesId string `json:"exchangeRatesId"`
ExchangeRatesSize string `json:"exchangeRatesSize"`
}
type EndOfEpochInfo struct {
LastCheckpointId string `json:"lastCheckpointId"`
EpochEndTimestamp string `json:"epochEndTimestamp"`
ProtocolVersion string `json:"protocolVersion"`
ReferenceGasPrice string `json:"referenceGasPrice"`
TotalStake string `json:"totalStake"`
StorageFundReinvestment string `json:"storageFundReinvestment"`
StorageCharge string `json:"storageCharge"`
StorageRebate string `json:"storageRebate"`
StorageFundBalance string `json:"storageFundBalance"`
StakeSubsidyAmount string `json:"stakeSubsidyAmount"`
TotalGasFees string `json:"totalGasFees"`
TotalStakeRewardsDistributed string `json:"totalStakeRewardsDistributed"`
LeftoverStorageFundInflow string `json:"leftoverStorageFundInflow"`
}
type EpochInfo struct {
Epoch string `json:"epoch"`
Validators []SuiValidatorSummary `json:"validators"`
EpochTotalTransactions string `json:"epochTotalTransactions"`
FirstCheckpointId string `json:"firstCheckpointId"`
EpochStartTimestamp string `json:"epochStartTimestamp"`
EndOfEpochInfo EndOfEpochInfo `json:"endOfEpochInfo"`
}
type PaginatedEpochInfoResponse struct {
Data []EpochInfo `json:"data"`
NextCursor string `json:"nextCursor"`
HasNextPage bool `json:"hasNextPage"`
}
type SuiSystemStateSummary struct {
Epoch string `json:"epoch"`
ProtocolVersion string `json:"protocolVersion"`
SystemStateVersion string `json:"systemStateVersion"`
StorageFundTotalObjectStorageRebates string `json:"storageFundTotalObjectStorageRebates"`
StorageFundNonRefundableBalance string `json:"storageFundNonRefundableBalance"`
ReferenceGasPrice string `json:"referenceGasPrice"`
SafeMode bool `json:"safeMode"`
SafeModeStorageRewards string `json:"safeModeStorageRewards"`
SafeModeComputationRewards string `json:"safeModeComputationRewards"`
SafeModeStorageRebates string `json:"safeModeStorageRebates"`
SafeModeNonRefundableStorageFee string `json:"safeModeNonRefundableStorageFee"`
EpochStartTimestampMs string `json:"epochStartTimestampMs"`
EpochDurationMs string `json:"epochDurationMs"`
StakeSubsidyStartEpoch string `json:"stakeSubsidyStartEpoch"`
MaxValidatorCount string `json:"maxValidatorCount"`
MinValidatorJoiningStake string `json:"minValidatorJoiningStake"`
ValidatorLowStakeThreshold string `json:"validatorLowStakeThreshold"`
ValidatorVeryLowStakeThreshold string `json:"validatorVeryLowStakeThreshold"`
ValidatorLowStakeGracePeriod string `json:"validatorLowStakeGracePeriod"`
StakeSubsidyBalance string `json:"stakeSubsidyBalance"`
StakeSubsidyDistributionCounter string `json:"stakeSubsidyDistributionCounter"`
StakeSubsidyCurrentDistributionAmount string `json:"stakeSubsidyCurrentDistributionAmount"`
StakeSubsidyPeriodLength string `json:"stakeSubsidyPeriodLength"`
StakeSubsidyDecreaseRate int `json:"stakeSubsidyDecreaseRate"`
TotalStake string `json:"totalStake"`
ActiveValidators []SuiValidatorSummary `json:"activeValidators"`
PendingActiveValidatorsId string `json:"pendingActiveValidatorsId"`
PendingActiveValidatorsSize string `json:"pendingActiveValidatorsSize"`
PendingRemovals []string `json:"pendingRemovals"`
StakingPoolMappingsId string `json:"stakingPoolMappingsId"`
StakingPoolMappingsSize string `json:"stakingPoolMappingsSize"`
InactivePoolsId string `json:"inactivePoolsId"`
InactivePoolsSize string `json:"inactivePoolsSize"`
ValidatorCandidatesId string `json:"validatorCandidatesId"`
ValidatorCandidatesSize string `json:"validatorCandidatesSize"`
AtRiskValidators []string `json:"atRiskValidators"`
ValidatorReportRecords [][]interface{} `json:"validatorReportRecords"`
}
type ValidatorsApy struct {
Apys []Apy `json:"apys"`
Epoch string `json:"epoch"`
}
type Apy struct {
Address string `json:"address"`
Apy float64 `json:"apy"`
}
type SuiGetProtocolConfigRequest struct {
Version string `json:"version"`
}
type ProtocolConfigResponse struct {
MinSupportedProtocolVersion string `json:"minSupportedProtocolVersion"`
MaxSupportedProtocolVersion string `json:"maxSupportedProtocolVersion"`
ProtocolVersion string `json:"protocolVersion"`
FeatureFlags map[string]bool `json:"featureFlags"`
Attributes map[string]map[string]string `json:"attributes"`
}