Repository navigation
Expand file tree
/
Copy pathblock.ts
More file actions
188 lines (167 loc) · 4.92 KB
/
Copy pathblock.ts
File metadata and controls
188 lines (167 loc) · 4.92 KB
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
import type { AddressParam } from 'types/api/addressParams';
import type { Reward } from 'types/api/reward';
import type { Transaction } from 'types/api/transaction';
import type { ArbitrumBatchStatus, ArbitrumL2TxData } from './arbitrumL2';
import type { OptimisticL2BatchDataContainer, OptimisticL2BlobTypeEip4844, OptimisticL2BlobTypeCelestia } from './optimisticL2';
import type { TokenInfo } from './token';
import type { TokenTransfer } from './tokenTransfer';
import type { ZkSyncBatchesItem } from './zkSyncL2';
export type BlockType = 'block' | 'reorg' | 'uncle';
export interface BlockBaseFeeCelo {
amount: string;
breakdown: Array<{ amount: string; percentage: number; address: AddressParam }>;
recipient: AddressParam;
token: TokenInfo;
}
export interface Block {
height: number;
timestamp: string;
transaction_count: number;
miner: AddressParam;
size: number;
hash: string;
parent_hash: string;
difficulty: string;
total_difficulty: string | null;
gas_used: string | null;
gas_limit: string;
nonce: string;
base_fee_per_gas: string | null;
burnt_fees: string | null;
priority_fee: string | null;
extra_data: string | null;
state_root: string | null;
rewards?: Array<Reward>;
gas_target_percentage: number | null;
gas_used_percentage: number | null;
burnt_fees_percentage: number | null;
type: BlockType;
transaction_fees: string | null;
uncles_hashes: Array<string>;
withdrawals_count?: number;
// ROOTSTOCK FIELDS
bitcoin_merged_mining_coinbase_transaction?: string | null;
bitcoin_merged_mining_header?: string | null;
bitcoin_merged_mining_merkle_proof?: string | null;
hash_for_merged_mining?: string | null;
minimum_gas_price?: string | null;
// BLOB FIELDS
blob_gas_price?: string;
blob_gas_used?: string;
burnt_blob_fees?: string;
excess_blob_gas?: string;
blob_transaction_count?: number;
// ZKSYNC FIELDS
zksync?: Omit<ZkSyncBatchesItem, 'number' | 'transaction_count' | 'timestamp'> & {
batch_number: number | null;
};
arbitrum?: ArbitrumBlockData;
optimism?: OptimismBlockData;
// CELO FIELDS
celo?: {
epoch_number: number;
is_epoch_block: boolean;
base_fee?: BlockBaseFeeCelo;
};
// ZILLIQA FIELDS
zilliqa?: ZilliqaBlockData;
}
type ArbitrumBlockData = {
batch_number: number;
commitment_transaction: ArbitrumL2TxData;
confirmation_transaction: ArbitrumL2TxData;
delayed_messages: number;
l1_block_height: number;
send_count: number;
send_root: string;
status: ArbitrumBatchStatus;
};
export interface OptimismBlockData {
batch_data_container: OptimisticL2BatchDataContainer;
internal_id: number;
blobs: Array<OptimisticL2BlobTypeEip4844> | Array<OptimisticL2BlobTypeCelestia> | null;
l1_timestamp: string;
l1_transaction_hashes: Array<string>;
}
export interface ZilliqaBlockData {
view: number;
quorum_certificate: ZilliqaQuorumCertificate;
aggregate_quorum_certificate: (ZilliqaQuorumCertificate & {
nested_quorum_certificates: Array<ZilliqaNestedQuorumCertificate>;
}) | null;
}
export interface ZilliqaQuorumCertificate {
view: number;
signature: string;
signers: Array<number>;
}
export interface ZilliqaNestedQuorumCertificate extends ZilliqaQuorumCertificate {
proposed_by_validator_index: number;
}
export interface BlocksResponse {
items: Array<Block>;
next_page_params: {
block_number: number;
items_count: number;
} | null;
}
export interface BlockTransactionsResponse {
items: Array<Transaction>;
next_page_params: {
block_number: number;
items_count: number;
index: number;
} | null;
}
export interface NewBlockSocketResponse {
average_block_time: string;
block: Block;
}
export interface BlockFilters {
type?: BlockType;
}
export type BlockWithdrawalsResponse = {
items: Array<BlockWithdrawalsItem>;
next_page_params: {
index: number;
items_count: number;
} | null;
};
export type BlockWithdrawalsItem = {
amount: string;
index: number;
receiver: AddressParam;
validator_index: number;
};
export interface BlockCountdownResponse {
result: {
CountdownBlock: string;
CurrentBlock: string;
EstimateTimeInSec: string;
RemainingBlock: string;
} | null;
}
export interface BlockEpochElectionReward {
count: number;
token: TokenInfo<'ERC-20'>;
total: string;
}
export type EpochRewardsType = 'group' | 'validator' | 'delegated_payment' | 'voter';
export interface BlockEpoch {
number: number;
distribution: {
carbon_offsetting_transfer: TokenTransfer | null;
community_transfer: TokenTransfer | null;
reserve_bolster_transfer: TokenTransfer | null;
};
aggregated_election_rewards: Record<EpochRewardsType, BlockEpochElectionReward | null>;
}
export interface BlockEpochElectionRewardDetails {
account: AddressParam;
amount: string;
associated_account: AddressParam;
}
export interface BlockEpochElectionRewardDetailsResponse {
items: Array<BlockEpochElectionRewardDetails>;
next_page_params: null;
}