-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added LineaEstimateGas API Signed-off-by: Nischal Sharma <nischal@web3labs.com> * added changelog Signed-off-by: Nischal Sharma <nischal@web3labs.com> * added tests Signed-off-by: Nischal Sharma <nischal@web3labs.com> * added linea_getProof Signed-off-by: Nischal Sharma <nischal@web3labs.com> * added linea_getTransactionExclusionStatusV1 Signed-off-by: Nischal Sharma <nischal@web3labs.com> --------- Signed-off-by: Nischal Sharma <nischal@web3labs.com>
- Loading branch information
Showing
10 changed files
with
550 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
124 changes: 124 additions & 0 deletions
124
core/src/main/java/org/web3j/protocol/core/methods/response/LineaEstimateGas.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
/* | ||
* Copyright 2025 Web3 Labs Ltd. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
package org.web3j.protocol.core.methods.response; | ||
|
||
import java.io.IOException; | ||
import java.math.BigInteger; | ||
|
||
import com.fasterxml.jackson.core.JsonParser; | ||
import com.fasterxml.jackson.core.JsonToken; | ||
import com.fasterxml.jackson.databind.DeserializationContext; | ||
import com.fasterxml.jackson.databind.JsonDeserializer; | ||
import com.fasterxml.jackson.databind.ObjectReader; | ||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | ||
|
||
import org.web3j.protocol.ObjectMapperFactory; | ||
import org.web3j.protocol.core.Response; | ||
import org.web3j.utils.Numeric; | ||
|
||
public class LineaEstimateGas extends Response<LineaEstimateGas.LineaEstimateGasResponse> { | ||
|
||
@Override | ||
@JsonDeserialize(using = LineaEstimateGas.ResponseDeserialiser.class) | ||
public void setResult(LineaEstimateGas.LineaEstimateGasResponse result) { | ||
super.setResult(result); | ||
} | ||
|
||
public LineaEstimateGas.LineaEstimateGasResponse getLineaEstimateGas() { | ||
return getResult(); | ||
} | ||
|
||
public static class LineaEstimateGasResponse { | ||
private BigInteger baseFeePerGas; | ||
private BigInteger gasLimit; | ||
private BigInteger priorityFeePerGas; | ||
|
||
public LineaEstimateGasResponse() {} | ||
|
||
public LineaEstimateGasResponse( | ||
BigInteger baseFeePerGas, BigInteger gasLimit, BigInteger priorityFeePerGas) { | ||
this.baseFeePerGas = baseFeePerGas; | ||
this.gasLimit = gasLimit; | ||
this.priorityFeePerGas = priorityFeePerGas; | ||
} | ||
|
||
public BigInteger getBaseFeePerGas() { | ||
return baseFeePerGas; | ||
} | ||
|
||
public void setBaseFeePerGas(String baseFeePerGas) { | ||
this.baseFeePerGas = Numeric.decodeQuantity(baseFeePerGas); | ||
} | ||
|
||
public BigInteger getGasLimit() { | ||
return gasLimit; | ||
} | ||
|
||
public void setGasLimit(String gasLimit) { | ||
this.gasLimit = Numeric.decodeQuantity(gasLimit); | ||
} | ||
|
||
public BigInteger getPriorityFeePerGas() { | ||
return priorityFeePerGas; | ||
} | ||
|
||
public void setPriorityFeePerGas(String priorityFeePerGas) { | ||
this.priorityFeePerGas = Numeric.decodeQuantity(priorityFeePerGas); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (!(o instanceof LineaEstimateGasResponse)) { | ||
return false; | ||
} | ||
LineaEstimateGasResponse res = (LineaEstimateGasResponse) o; | ||
|
||
if (getGasLimit() != null | ||
? !getGasLimit().equals(res.getGasLimit()) | ||
: res.getGasLimit() != null) { | ||
return false; | ||
} | ||
|
||
if (getBaseFeePerGas() != null | ||
? !getBaseFeePerGas().equals(res.getBaseFeePerGas()) | ||
: res.getBaseFeePerGas() != null) { | ||
return false; | ||
} | ||
|
||
return getPriorityFeePerGas() != null | ||
? getPriorityFeePerGas().equals(res.getPriorityFeePerGas()) | ||
: res.getPriorityFeePerGas() == null; | ||
} | ||
} | ||
|
||
public static class ResponseDeserialiser | ||
extends JsonDeserializer<LineaEstimateGas.LineaEstimateGasResponse> { | ||
|
||
private ObjectReader objectReader = ObjectMapperFactory.getObjectReader(); | ||
|
||
@Override | ||
public LineaEstimateGas.LineaEstimateGasResponse deserialize( | ||
JsonParser jsonParser, DeserializationContext deserializationContext) | ||
throws IOException { | ||
if (jsonParser.getCurrentToken() != JsonToken.VALUE_NULL) { | ||
return objectReader.readValue( | ||
jsonParser, LineaEstimateGas.LineaEstimateGasResponse.class); | ||
} else { | ||
return null; // null is wrapped by Optional in above getter | ||
} | ||
} | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
core/src/main/java/org/web3j/protocol/core/methods/response/LineaGetProof.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright 2025 Web3 Labs Ltd. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
package org.web3j.protocol.core.methods.response; | ||
|
||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | ||
|
||
import org.web3j.protocol.core.Response; | ||
|
||
public class LineaGetProof extends Response<EthGetProof.Proof> { | ||
|
||
@Override | ||
@JsonDeserialize(using = EthGetProof.ResponseDeserializer.class) | ||
public void setResult(EthGetProof.Proof result) { | ||
super.setResult(result); | ||
} | ||
|
||
/** | ||
* linea get proof result. | ||
* | ||
* @return proof result | ||
*/ | ||
public EthGetProof.Proof getProof() { | ||
return getResult(); | ||
} | ||
} |
Oops, something went wrong.