|
5 | 5 | import io.goodforgod.api.etherscan.error.EtherScanResponseException;
|
6 | 6 | import io.goodforgod.api.etherscan.http.EthHttpClient;
|
7 | 7 | import io.goodforgod.api.etherscan.manager.RequestQueueManager;
|
| 8 | +import io.goodforgod.api.etherscan.model.Wei; |
8 | 9 | import io.goodforgod.api.etherscan.model.proxy.BlockProxy;
|
9 | 10 | import io.goodforgod.api.etherscan.model.proxy.ReceiptProxy;
|
10 | 11 | import io.goodforgod.api.etherscan.model.proxy.TxProxy;
|
|
13 | 14 | import io.goodforgod.api.etherscan.model.proxy.utility.TxInfoProxyTO;
|
14 | 15 | import io.goodforgod.api.etherscan.model.proxy.utility.TxProxyTO;
|
15 | 16 | import io.goodforgod.api.etherscan.util.BasicUtils;
|
16 |
| -import java.math.BigInteger; |
17 | 17 | import java.util.Optional;
|
18 | 18 | import java.util.regex.Pattern;
|
19 | 19 | import org.jetbrains.annotations.NotNull;
|
@@ -197,29 +197,29 @@ public Optional<String> storageAt(String address, long position) throws EtherSca
|
197 | 197 |
|
198 | 198 | @NotNull
|
199 | 199 | @Override
|
200 |
| - public BigInteger gasPrice() throws EtherScanException { |
| 200 | + public Wei gasPrice() throws EtherScanException { |
201 | 201 | final StringProxyTO response = getRequest(ACT_GASPRICE_PARAM, StringProxyTO.class);
|
202 | 202 | return (BasicUtils.isEmpty(response.getResult()))
|
203 |
| - ? BigInteger.valueOf(-1) |
204 |
| - : BasicUtils.parseHex(response.getResult()); |
| 203 | + ? new Wei(0) |
| 204 | + : new Wei(BasicUtils.parseHex(response.getResult())); |
205 | 205 | }
|
206 | 206 |
|
207 | 207 | @NotNull
|
208 | 208 | @Override
|
209 |
| - public BigInteger gasEstimated() throws EtherScanException { |
| 209 | + public Wei gasEstimated() throws EtherScanException { |
210 | 210 | return gasEstimated("606060405260728060106000396000f360606040526000");
|
211 | 211 | }
|
212 | 212 |
|
213 | 213 | @NotNull
|
214 | 214 | @Override
|
215 |
| - public BigInteger gasEstimated(String hexData) throws EtherScanException { |
| 215 | + public Wei gasEstimated(String hexData) throws EtherScanException { |
216 | 216 | if (!BasicUtils.isEmpty(hexData) && BasicUtils.isNotHex(hexData))
|
217 | 217 | throw new EtherScanInvalidDataHexException("Data is not in hex format.");
|
218 | 218 |
|
219 | 219 | final String urlParams = ACT_ESTIMATEGAS_PARAM + DATA_PARAM + hexData + GAS_PARAM + "2000000000000000";
|
220 | 220 | final StringProxyTO response = getRequest(urlParams, StringProxyTO.class);
|
221 | 221 | return (BasicUtils.isEmpty(response.getResult()))
|
222 |
| - ? BigInteger.valueOf(-1) |
223 |
| - : BasicUtils.parseHex(response.getResult()); |
| 222 | + ? new Wei(0) |
| 223 | + : new Wei(BasicUtils.parseHex(response.getResult())); |
224 | 224 | }
|
225 | 225 | }
|
0 commit comments