You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Sources/web3swift/API/APIMethod.swift
+84-13Lines changed: 84 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -75,34 +75,104 @@ public typealias TransactionHash = Hash // 64 chars length without 0x
75
75
/// - `protocol APIRequestParameterElementType: Encodable` — this type purpose is the same as ``APIRequestParameterType` one except this one is made for `Element`s of an `Array` s when the latter is an associated type of a given `RequestParameter` case.
76
76
publicenumAPIRequest{
77
77
// MARK: - Official API
78
-
// 0 parameter in call
78
+
79
79
/// Gas price request
80
80
case gasPrice
81
+
82
+
/// Get last block number
81
83
case blockNumber
84
+
85
+
/// Get current network
82
86
case getNetwork
87
+
88
+
/// Get accounts
83
89
case getAccounts
84
-
// ??
90
+
91
+
/// Estimate required gas amount for transaction
92
+
/// - Parameters:
93
+
/// - TransactionParameters: parameters of planned transaction
94
+
/// - BlockNumber: block where it should be evalueated
85
95
case estimateGas(TransactionParameters,BlockNumber)
96
+
97
+
/// Send raw transaction
98
+
/// - Parameters:
99
+
/// - Hash: String representation of a transaction data
86
100
case sendRawTransaction(Hash)
101
+
102
+
/// Send transaction object
103
+
/// - Parameters:
104
+
/// - TransactionParameters: transaction to be sent into chain
87
105
case sendTransaction(TransactionParameters)
106
+
107
+
/// Get transaction by hash
108
+
/// - Parameters:
109
+
/// - Hash: transaction hash ID
88
110
case getTransactionByHash(Hash)
111
+
112
+
/// Get transaction receipt
113
+
/// - Paramters:
114
+
/// - Hash: transaction hash ID
89
115
case getTransactionReceipt(Hash)
116
+
117
+
/// Get logs
118
+
/// - Parameters:
119
+
/// - EventFilterParameters: event filter parameters for interaction with node
90
120
case getLogs(EventFilterParameters)
121
+
122
+
/// Sign given string by users private key
123
+
/// - Parameters:
124
+
/// - Address: address where to sign
125
+
/// - String: custom string to be signed
91
126
case personalSign(Address,String)
127
+
128
+
/// Call a given contract
129
+
///
130
+
/// Mostly could be used for intreacting with a contracts, but also could be used for simple transaction sending
131
+
/// - Parameters:
132
+
/// - TransactionParameters: transaction to be sent into chain
133
+
/// - BlockNumber: block where it should be evalueated
92
134
case call(TransactionParameters,BlockNumber)
135
+
136
+
/// Get a transaction counts on a given block
137
+
///
138
+
/// Consider that there's no out of the box way to get counts of all transactions sent by the address
139
+
/// except calling this method on each and every block in the chain by rather self or any third party service.
140
+
///
141
+
/// - Parameters:
142
+
/// - Address: address which is engaged in transaction
143
+
/// - BlockNumber: block to check
93
144
case getTransactionCount(Address,BlockNumber)
145
+
146
+
/// Get a balance of a given address
147
+
/// - Parameters:
148
+
/// - Address: address which balance would be recieved
149
+
/// - BlockNumber: block to check
94
150
case getBalance(Address,BlockNumber)
95
151
96
152
/// Returns the value from a storage position at a given address.
97
153
///
98
154
/// - Parameters:
99
-
/// - Address: Address
100
-
/// - Storage: slot
101
-
/// - BlockNumber: sd
102
-
case getStorageAt(Address,Hash,BlockNumber)
155
+
/// - Address: Address
156
+
/// - Position: Integer of the position in the storage.
157
+
/// - BlockNumber: block to check
158
+
case getStorageAt(Address,BigUInt,BlockNumber)
103
159
160
+
/// Returns code of a given address
161
+
/// - Parameters:
162
+
/// - Address: address what code to get
163
+
/// - BlockNumber: block to check
104
164
case getCode(Address,BlockNumber)
165
+
166
+
/// Get block object by hash
167
+
/// - Parameters:
168
+
/// - Hash: Hash of the block to reach
169
+
/// - Bool: Transaction included in block could be received as just array of their hashes or as Transaction objects, set true for latter.
105
170
case getBlockByHash(Hash,Bool)
171
+
172
+
/// Get block object by its number
173
+
/// - Parameters:
174
+
/// - Hash: Number of the block to reach
175
+
/// - Bool: Transaction included in block could be received as just array of their hashes or as Transaction objects, set true for latter.
106
176
case getBlockByNumber(BlockNumber,Bool)
107
177
108
178
/// Returns fee history with a respect to given setup
@@ -112,14 +182,15 @@ public enum APIRequest {
112
182
/// than the amount of gas actually used by the transaction, for a variety of reasons including EVM mechanics and node performance.
113
183
///
114
184
/// - Parameters:
115
-
/// - UInt: Requested range of blocks. Clients will return less than the requested range if not all blocks are available.
116
-
/// - BlockNumber: Highest block of the requested range.
117
-
/// - [Double]: A monotonically increasing list of percentile values.
118
-
/// For each block in the requested range, the transactions will be sorted in ascending order
119
-
/// by effective tip per gas and the coresponding effective tip for the percentile will be determined, accounting for gas consumed."
185
+
/// - UInt: Requested range of blocks. Clients will return less than the requested range if not all blocks are available.
186
+
/// - BlockNumber: Highest block of the requested range.
187
+
/// - [Double]: A monotonically increasing list of percentile values.
188
+
/// For each block in the requested range, the transactions will be sorted in ascending order
189
+
/// by effective tip per gas and the coresponding effective tip for the percentile will be determined, accounting for gas consumed."
120
190
case feeHistory(BigUInt,BlockNumber,[Double])
121
191
122
192
// MARK: - Additional API
193
+
123
194
/// Creates new account.
124
195
///
125
196
/// Note: it becomes the new current unlocked account. There can only be one unlocked account at a time.
0 commit comments