Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6d19b73

Browse files
committed
[2.0.0-SNAPSHOT]
Gas related fields replaced to Wei
1 parent63f8909 commit6d19b73

File tree

10 files changed

+180
-144
lines changed

10 files changed

+180
-144
lines changed

‎src/main/java/io/goodforgod/api/etherscan/model/BaseTx.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ public String getInput() {
5656
returninput;
5757
}
5858

59-
publicBigIntegergetGas() {
60-
returngas;
59+
publicWeigetGas() {
60+
returnWei.ofWei(gas);
6161
}
6262

63-
publicBigIntegergetGasUsed() {
64-
returngasUsed;
63+
publicWeigetGasUsed() {
64+
returnWei.ofWei(gasUsed);
6565
}
6666
// </editor-fold>
6767

‎src/main/java/io/goodforgod/api/etherscan/model/Tx.java‎

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,20 @@ public int getTransactionIndex() {
4141
returntransactionIndex;
4242
}
4343

44-
publicBigIntegergetGasPrice() {
45-
returngasPrice;
44+
publicWeigetGasPrice() {
45+
returnWei.ofWei(gasPrice);
4646
}
4747

4848
publicbooleanhaveError() {
4949
return !BasicUtils.isEmpty(isError) && !isError.equals("0");
5050
}
5151

52-
publicStringgetTxreceipt_status() {
52+
publicStringgetTxReceiptStatus() {
5353
returntxreceipt_status;
5454
}
5555

56-
publicBigIntegergetCumulativeGasUsed() {
57-
returncumulativeGasUsed;
56+
publicWeigetGasUsedCumulative() {
57+
returnWei.ofWei(cumulativeGasUsed);
5858
}
5959

6060
publiclonggetConfirmations() {
@@ -112,16 +112,16 @@ public static final class TxBuilder {
112112
privateBigIntegervalue;
113113
privateStringcontractAddress;
114114
privateStringinput;
115-
privateBigIntegergas;
116-
privateBigIntegergasUsed;
115+
privateWeigas;
116+
privateWeigasUsed;
117117
privatelongnonce;
118118
privateStringblockHash;
119119
privateinttransactionIndex;
120-
privateBigIntegergasPrice;
121-
privateBigIntegercumulativeGasUsed;
120+
privateWeigasPrice;
121+
privateWeicumulativeGasUsed;
122122
privatelongconfirmations;
123123
privateStringisError;
124-
privateStringtxreceiptStatus;
124+
privateStringtxReceiptStatus;
125125

126126
privateTxBuilder() {}
127127

@@ -165,12 +165,12 @@ public TxBuilder withInput(String input) {
165165
returnthis;
166166
}
167167

168-
publicTxBuilderwithGas(BigIntegergas) {
168+
publicTxBuilderwithGas(Weigas) {
169169
this.gas =gas;
170170
returnthis;
171171
}
172172

173-
publicTxBuilderwithGasUsed(BigIntegergasUsed) {
173+
publicTxBuilderwithGasUsed(WeigasUsed) {
174174
this.gasUsed =gasUsed;
175175
returnthis;
176176
}
@@ -190,12 +190,12 @@ public TxBuilder withTransactionIndex(int transactionIndex) {
190190
returnthis;
191191
}
192192

193-
publicTxBuilderwithGasPrice(BigIntegergasPrice) {
193+
publicTxBuilderwithGasPrice(WeigasPrice) {
194194
this.gasPrice =gasPrice;
195195
returnthis;
196196
}
197197

198-
publicTxBuilderwithCumulativeGasUsed(BigIntegercumulativeGasUsed) {
198+
publicTxBuilderwithCumulativeGasUsed(WeicumulativeGasUsed) {
199199
this.cumulativeGasUsed =cumulativeGasUsed;
200200
returnthis;
201201
}
@@ -210,20 +210,30 @@ public TxBuilder withIsError(String isError) {
210210
returnthis;
211211
}
212212

213-
publicTxBuilderwithTxreceiptStatus(StringtxreceiptStatus) {
214-
this.txreceiptStatus =txreceiptStatus;
213+
publicTxBuilderwithTxReceiptStatus(StringtxReceiptStatus) {
214+
this.txReceiptStatus =txReceiptStatus;
215215
returnthis;
216216
}
217217

218218
publicTxbuild() {
219219
Txtx =newTx();
220-
tx.gas =this.gas;
221220
tx.isError =this.isError;
222221
tx.blockHash =this.blockHash;
223222
tx.hash =this.hash;
224-
tx.gasUsed =this.gasUsed;
223+
if (this.gas !=null) {
224+
tx.gas =this.gas.asWei();
225+
}
226+
if (this.gasUsed !=null) {
227+
tx.gasUsed =this.gasUsed.asWei();
228+
}
229+
if (this.gasPrice !=null) {
230+
tx.gasPrice =this.gasPrice.asWei();
231+
}
232+
if (this.cumulativeGasUsed !=null) {
233+
tx.cumulativeGasUsed =this.cumulativeGasUsed.asWei();
234+
}
225235
tx.from =this.from;
226-
tx.txreceipt_status =this.txreceiptStatus;
236+
tx.txreceipt_status =this.txReceiptStatus;
227237
tx.contractAddress =this.contractAddress;
228238
tx.value =this.value;
229239
tx.transactionIndex =this.transactionIndex;
@@ -236,8 +246,6 @@ public Tx build() {
236246
tx.blockNumber =this.blockNumber;
237247
tx.to =this.to;
238248
tx.input =this.input;
239-
tx.cumulativeGasUsed =this.cumulativeGasUsed;
240-
tx.gasPrice =this.gasPrice;
241249
returntx;
242250
}
243251
}

‎src/main/java/io/goodforgod/api/etherscan/model/TxErc1155.java‎

Lines changed: 42 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ public int getTransactionIndex() {
5353
returntransactionIndex;
5454
}
5555

56-
publicBigIntegergetGasPrice() {
57-
returngasPrice;
56+
publicWeigetGasPrice() {
57+
returnWei.ofWei(gasPrice);
5858
}
5959

60-
publicBigIntegergetCumulativeGasUsed() {
61-
returncumulativeGasUsed;
60+
publicWeigetGasUsedCumulative() {
61+
returnWei.ofWei(cumulativeGasUsed);
6262
}
6363

6464
publiclonggetConfirmations() {
@@ -113,17 +113,17 @@ public static final class TxErc1155Builder {
113113
privateStringto;
114114
privateStringcontractAddress;
115115
privateStringinput;
116-
privateBigIntegergas;
117-
privateBigIntegergasUsed;
118116
privatelongnonce;
119117
privateStringblockHash;
120118
privateStringtokenID;
121119
privateStringtokenName;
122120
privateStringtokenSymbol;
123121
privateStringtokenValue;
124122
privateinttransactionIndex;
125-
privateBigIntegergasPrice;
126-
privateBigIntegercumulativeGasUsed;
123+
privateWeigas;
124+
privateWeigasUsed;
125+
privateWeigasPrice;
126+
privateWeicumulativeGasUsed;
127127
privatelongconfirmations;
128128

129129
privateTxErc1155Builder() {}
@@ -163,12 +163,12 @@ public TxErc1155Builder withInput(String input) {
163163
returnthis;
164164
}
165165

166-
publicTxErc1155BuilderwithGas(BigIntegergas) {
166+
publicTxErc1155BuilderwithGas(Weigas) {
167167
this.gas =gas;
168168
returnthis;
169169
}
170170

171-
publicTxErc1155BuilderwithGasUsed(BigIntegergasUsed) {
171+
publicTxErc1155BuilderwithGasUsed(WeigasUsed) {
172172
this.gasUsed =gasUsed;
173173
returnthis;
174174
}
@@ -208,12 +208,12 @@ public TxErc1155Builder withTransactionIndex(int transactionIndex) {
208208
returnthis;
209209
}
210210

211-
publicTxErc1155BuilderwithGasPrice(BigIntegergasPrice) {
211+
publicTxErc1155BuilderwithGasPrice(WeigasPrice) {
212212
this.gasPrice =gasPrice;
213213
returnthis;
214214
}
215215

216-
publicTxErc1155BuilderwithCumulativeGasUsed(BigIntegercumulativeGasUsed) {
216+
publicTxErc1155BuilderwithCumulativeGasUsed(WeicumulativeGasUsed) {
217217
this.cumulativeGasUsed =cumulativeGasUsed;
218218
returnthis;
219219
}
@@ -224,30 +224,38 @@ public TxErc1155Builder withConfirmations(long confirmations) {
224224
}
225225

226226
publicTxErc1155build() {
227-
TxErc1155txERC721 =newTxErc1155();
228-
txERC721.gas =this.gas;
229-
txERC721.tokenName =this.tokenName;
230-
txERC721.hash =this.hash;
231-
txERC721.gasUsed =this.gasUsed;
232-
txERC721.nonce =this.nonce;
233-
txERC721.from =this.from;
234-
txERC721.gasPrice =this.gasPrice;
235-
txERC721.contractAddress =this.contractAddress;
236-
txERC721.cumulativeGasUsed =this.cumulativeGasUsed;
237-
txERC721.tokenID =this.tokenID;
227+
TxErc1155txERC1155 =newTxErc1155();
228+
txERC1155.tokenName =this.tokenName;
229+
txERC1155.hash =this.hash;
230+
txERC1155.nonce =this.nonce;
231+
txERC1155.from =this.from;
232+
if (this.gas !=null) {
233+
txERC1155.gas =this.gas.asWei();
234+
}
235+
if (this.gasUsed !=null) {
236+
txERC1155.gasUsed =this.gasUsed.asWei();
237+
}
238+
if (this.gasPrice !=null) {
239+
txERC1155.gasPrice =this.gasPrice.asWei();
240+
}
241+
if (this.cumulativeGasUsed !=null) {
242+
txERC1155.cumulativeGasUsed =this.cumulativeGasUsed.asWei();
243+
}
244+
txERC1155.contractAddress =this.contractAddress;
245+
txERC1155.tokenID =this.tokenID;
238246
if (this.timeStamp !=null) {
239-
txERC721.timeStamp =String.valueOf(this.timeStamp.toEpochSecond(ZoneOffset.UTC));
240-
txERC721._timeStamp =this.timeStamp;
247+
txERC1155.timeStamp =String.valueOf(this.timeStamp.toEpochSecond(ZoneOffset.UTC));
248+
txERC1155._timeStamp =this.timeStamp;
241249
}
242-
txERC721.blockNumber =this.blockNumber;
243-
txERC721.tokenValue =this.tokenValue;
244-
txERC721.transactionIndex =this.transactionIndex;
245-
txERC721.to =this.to;
246-
txERC721.confirmations =this.confirmations;
247-
txERC721.input =this.input;
248-
txERC721.blockHash =this.blockHash;
249-
txERC721.tokenSymbol =this.tokenSymbol;
250-
returntxERC721;
250+
txERC1155.blockNumber =this.blockNumber;
251+
txERC1155.tokenValue =this.tokenValue;
252+
txERC1155.transactionIndex =this.transactionIndex;
253+
txERC1155.to =this.to;
254+
txERC1155.confirmations =this.confirmations;
255+
txERC1155.input =this.input;
256+
txERC1155.blockHash =this.blockHash;
257+
txERC1155.tokenSymbol =this.tokenSymbol;
258+
returntxERC1155;
251259
}
252260
}
253261
}

‎src/main/java/io/goodforgod/api/etherscan/model/TxErc20.java‎

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ public int getTransactionIndex() {
5353
returntransactionIndex;
5454
}
5555

56-
publicBigIntegergetGasPrice() {
57-
returngasPrice;
56+
publicWeigetGasPrice() {
57+
returnWei.ofWei(gasPrice);
5858
}
5959

60-
publicBigIntegergetCumulativeGasUsed() {
61-
returncumulativeGasUsed;
60+
publicWeigetGasUsedCumulative() {
61+
returnWei.ofWei(cumulativeGasUsed);
6262
}
6363

6464
publiclonggetConfirmations() {
@@ -114,16 +114,16 @@ public static final class TxERC20Builder {
114114
privateBigIntegervalue;
115115
privateStringcontractAddress;
116116
privateStringinput;
117-
privateBigIntegergas;
118-
privateBigIntegergasUsed;
117+
privateWeigas;
118+
privateWeigasUsed;
119119
privatelongnonce;
120120
privateStringblockHash;
121121
privateStringtokenName;
122122
privateStringtokenSymbol;
123123
privateStringtokenDecimal;
124124
privateinttransactionIndex;
125-
privateBigIntegergasPrice;
126-
privateBigIntegercumulativeGasUsed;
125+
privateWeigasPrice;
126+
privateWeicumulativeGasUsed;
127127
privatelongconfirmations;
128128

129129
privateTxERC20Builder() {}
@@ -168,12 +168,12 @@ public TxERC20Builder withInput(String input) {
168168
returnthis;
169169
}
170170

171-
publicTxERC20BuilderwithGas(BigIntegergas) {
171+
publicTxERC20BuilderwithGas(Weigas) {
172172
this.gas =gas;
173173
returnthis;
174174
}
175175

176-
publicTxERC20BuilderwithGasUsed(BigIntegergasUsed) {
176+
publicTxERC20BuilderwithGasUsed(WeigasUsed) {
177177
this.gasUsed =gasUsed;
178178
returnthis;
179179
}
@@ -208,12 +208,12 @@ public TxERC20Builder withTransactionIndex(int transactionIndex) {
208208
returnthis;
209209
}
210210

211-
publicTxERC20BuilderwithGasPrice(BigIntegergasPrice) {
211+
publicTxERC20BuilderwithGasPrice(WeigasPrice) {
212212
this.gasPrice =gasPrice;
213213
returnthis;
214214
}
215215

216-
publicTxERC20BuilderwithCumulativeGasUsed(BigIntegercumulativeGasUsed) {
216+
publicTxERC20BuilderwithCumulativeGasUsed(WeicumulativeGasUsed) {
217217
this.cumulativeGasUsed =cumulativeGasUsed;
218218
returnthis;
219219
}
@@ -225,11 +225,20 @@ public TxERC20Builder withConfirmations(long confirmations) {
225225

226226
publicTxErc20build() {
227227
TxErc20txERC20 =newTxErc20();
228-
txERC20.gas =this.gas;
229228
txERC20.tokenName =this.tokenName;
230229
txERC20.hash =this.hash;
231-
txERC20.gasUsed =this.gasUsed;
232-
txERC20.cumulativeGasUsed =this.cumulativeGasUsed;
230+
if (this.gas !=null) {
231+
txERC20.gas =this.gas.asWei();
232+
}
233+
if (this.gasUsed !=null) {
234+
txERC20.gasUsed =this.gasUsed.asWei();
235+
}
236+
if (this.gasPrice !=null) {
237+
txERC20.gasPrice =this.gasPrice.asWei();
238+
}
239+
if (this.cumulativeGasUsed !=null) {
240+
txERC20.cumulativeGasUsed =this.cumulativeGasUsed.asWei();
241+
}
233242
txERC20.from =this.from;
234243
txERC20.tokenSymbol =this.tokenSymbol;
235244
txERC20.transactionIndex =this.transactionIndex;
@@ -243,7 +252,6 @@ public TxErc20 build() {
243252
}
244253
txERC20.blockHash =this.blockHash;
245254
txERC20.blockNumber =this.blockNumber;
246-
txERC20.gasPrice =this.gasPrice;
247255
txERC20.to =this.to;
248256
txERC20.input =this.input;
249257
txERC20.tokenDecimal =this.tokenDecimal;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp