/
explorer-types.ts
173 lines (150 loc) · 3.7 KB
/
explorer-types.ts
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
export type HostedPoolMetadata = {
name: string
description: string
ticker: string
homepage: string
extended?: string
}
export type StakePoolInfo = {
pledge: string
margin: number
fixedCost: string
name: string
ticker: string
homepage: string
}
export type StakePoolInfoExtended = StakePoolInfo & {
poolHash: string
liveStake: string
roa: string
epochBlocks: string
lifeTimeBlocks: string
saturatedPercentage: number
}
export type DelegationHistoryEntry = StakePoolInfoExtended & {
txHash: string
time: string
epochNo: number
}
export enum RewardType {
REGULAR = 'REGULAR',
ITN = 'ITN',
TREASURY = 'TREASURY',
}
export type RewardsHistoryEntry = StakePoolInfoExtended & {
time: string
epochNo: number
forDelegationInEpoch: number
amount: string
rewardType: RewardType
}
export type WithdrawalsHistoryEntry = {
time: string
epochNo: number
txHash: string
amount: string
}
export type StakeRegistrationHistoryEntry = {
txHash: string
time: string
epochNo: number
action: 'registration' | 'deregistration'
}
export type ValidStakePoolsMapping = {
[poolId: string]: StakePoolInfo & {
url: string
}
}
export type NextRewardDetail = StakePoolInfoExtended & {
forEpoch: number
rewardDate: string
}
export type StakingInfoResponse = {
currentEpoch: number
delegation: StakePoolInfoExtended & {
retiringEpoch: number | null
url: string
}
hasStakingKey: boolean
rewards: string
nextRewardDetails: Array<NextRewardDetail>
}
export type BestSlotResponse = {
Right: {
bestSlot: number
}
}
export type RewardWithMetadata = NextRewardDetail & {
distributionEpoch?: number
pool: HostedPoolMetadata | Object // TODO after refactor
}
export type NextRewardDetailsFormatted = {
upcoming: Array<RewardWithMetadata>
nearest: RewardWithMetadata
currentDelegation: RewardWithMetadata
}
export enum PoolRecommendationStatus {
INVALID = 'GivenPoolInvalid',
SATURATED = 'GivenPoolSaturated',
BEYOND_OPTIMUM = 'GivenPoolBeyondOptimum',
OK = 'GivenPoolOk',
UNDER_MINIMUM = 'GivenPoolUnderMinimum',
}
export type PoolRecommendationResponse = StakePoolInfoExtended & {
status: PoolRecommendationStatus
recommendedPoolHash: string
isInRecommendedPoolSet: boolean
}
export type CoinObject = {
getCoin: string
}
export type AddressCoinTuple = [string, CoinObject]
export type CaTxEntry = {
ctbId: string
ctbTimeIssued: number
ctbInputs: Array<AddressCoinTuple>
ctbOutputs: Array<AddressCoinTuple>
ctbInputSum: CoinObject
ctbOutputSum: CoinObject
fee: string
}
export type BulkAddressesSummary = {
caAddresses: Array<string>
caTxNum: number
caBalance: CoinObject
caTxList: Array<CaTxEntry>
}
export type TxSummary = {
ctsId: string
ctsTxTimeIssued: number
ctsBlockTimeIssued: number
ctsBlockHeight: number
ctsBlockEpoch: number
ctsBlockSlot: number
ctsBlockHash: string
ctsRelayedBy: null
ctsTotalInput: CoinObject
ctsTotalOutput: CoinObject
ctsFees: CoinObject
ctsInputs: Array<AddressCoinTuple>
ctsOutputs: Array<AddressCoinTuple>
}
export type FailureResponse = {Left: string}
export type SuccessResponse<T> = {
Right: T
}
export type TxSummaryResponse = SuccessResponse<TxSummary> | FailureResponse
export type BulkAddressesSummaryResponse = SuccessResponse<BulkAddressesSummary> | FailureResponse
export type TxSubmission = {txHash: string}
export type TxSubmissionFailure = FailureResponse & {
statusCode?: number
}
export type SubmitResponse = SuccessResponse<TxSubmission> | TxSubmissionFailure
export type Utxo = {
tag: string
cuId: string
cuOutIndex: number
cuAddress: string
cuCoins: CoinObject
}
export type BulkAdressesUtxoResponse = SuccessResponse<Array<Utxo>> | TxSubmissionFailure