UNPKG

2.89 kBTypeScriptView Raw
1import {EpochNumber, Address, Quantity} from "./index";
2
3export interface BlockHeader {
4 adaptive: boolean;
5 blame: number;
6 deferredLogsBloomHash: string;
7 deferredReceiptsRoot: string;
8 deferredStateRoot: string;
9 difficulty: number;
10 epochNumber: EpochNumber | null;
11 gasLimit: number;
12 hash: string | null;
13 height: number | null;
14 miner: Address;
15 nonce: string | null;
16 parentHash: string;
17 powQuality: string | null;
18 refereeHashes: string[];
19 size: number;
20 timestamp: number;
21 transactionsRoot: string
22}
23
24export interface Block extends BlockHeader {
25 transactions: string[] | Transaction[];
26}
27
28// transaction config
29export interface TransactionConfig {
30 from: Address;
31 to: Address;
32 value: Quantity;
33 nonce?: number;
34 gasPrice?: number;
35 gas?: number;
36 storageLimit?: number;
37 epochHeight?: number;
38 data?: string;
39 chainId?: number;
40}
41
42export interface Transaction {
43 blockHash: string | null;
44 contractCreated: string | null;
45 data: string;
46 from: Address;
47 gas: number;
48 gasPrice: number;
49 hash: string;
50 nonce: number;
51 r: string;
52 s: string;
53 status: number | null;
54 to: Address | null;
55 transactionIndex: number | null;
56 v: number;
57 value: Quantity;
58}
59
60export interface StorageRoot {
61 delta: string;
62 intermediate: string;
63 snapshot: string;
64}
65
66export interface SponsorInfo {
67 sponsorBalanceForCollateral: number;
68 sponsorBalanceForGas: number;
69 sponsorGasBound: number;
70 sponsorForCollateral: string;
71 sponsorForGas: string;
72}
73
74export interface CfxCallConfig {
75 from: Address;
76 to: Address;
77 gasPrice: number;
78 gas: number;
79 value: Quantity;
80 data: string;
81 nonce: number;
82}
83
84export interface CfxLogConfig{
85 fromEpoch: EpochNumber;
86 toEpoch: EpochNumber;
87 blockHashes: string[];
88 address: string[];
89 topics: string[];
90 limit: number;
91}
92
93export interface CfxLog {
94 address: Address;
95 topics: string[];
96 data: string;
97 blockHash: string;
98 epochNumber: EpochNumber;
99 transactionHash: string;
100 transactionIndex: number;
101 logIndex: number;
102 transactionLogIndex: number;
103}
104
105export interface TransactionReceipt {
106 transactionHash: string;
107 index: number;
108 blockHash: string;
109 epochNumber: EpochNumber;
110 from: Address;
111 to: Address | null;
112 gasUsed: string;
113 contractCreated: string | null;
114 stateRoot: string;
115 outcomeStatus: number;
116 logsBloom: string;
117 logs: CfxLog[];
118}
119
120export interface Account {
121 balance: Quantity;
122 nonce: number;
123 codeHash: number;
124 stakingBalance: Quantity;
125 collateralForStorage: number;
126 accumulatedInterestReturn: number;
127 admin: Address;
128}