Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

7702 support : Transaction Response Add authorization #2162

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package org.web3j.protocol.core.methods.response;

/**
* @Author DylanYang
* @Date 2025/3/8
*/
public class Authorization {
private String chainId;
private String nonce;
private String address;
private String yParity;
private String s;
private String r;

public Authorization(String chainId, String r, String nonce, String address, String yParity, String s) {
this.chainId = chainId;
this.r = r;
this.nonce = nonce;
this.address = address;
this.yParity = yParity;
this.s = s;
}

public Authorization() {
}

public String getChainId() {
return chainId;
}

public void setChainId(String chainId) {
this.chainId = chainId;
}

public String getNonce() {
return nonce;
}

public void setNonce(String nonce) {
this.nonce = nonce;
}

public String getAddress() {
return address;
}

public void setAddress(String address) {
this.address = address;
}

public String getyParity() {
return yParity;
}

public void setyParity(String yParity) {
this.yParity = yParity;
}

public String getS() {
return s;
}

public void setS(String s) {
this.s = s;
}

public String getR() {
return r;
}

public void setR(String r) {
this.r = r;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public class Transaction {
private List<AccessListObject> accessList;
private String maxFeePerBlobGas;
private List<String> blobVersionedHashes;
private List<Authorization> authorizationList;

public Transaction() {}

Expand Down Expand Up @@ -118,7 +119,9 @@ public Transaction(
String type,
String maxFeePerGas,
String maxPriorityFeePerGas,
List accessList) {
List accessList,
List<Authorization> authorizationList
) {
this.hash = hash;
this.nonce = nonce;
this.blockHash = blockHash;
Expand All @@ -142,6 +145,7 @@ public Transaction(
this.maxFeePerGas = maxFeePerGas;
this.maxPriorityFeePerGas = maxPriorityFeePerGas;
this.accessList = accessList;
this.authorizationList = authorizationList;
}

public Transaction(
Expand Down Expand Up @@ -169,7 +173,9 @@ public Transaction(
String maxPriorityFeePerGas,
List accessList,
String maxFeePerBlobGas,
List versionedHashes) {
List versionedHashes,
List<Authorization> authorizationList
) {
this.hash = hash;
this.nonce = nonce;
this.blockHash = blockHash;
Expand All @@ -195,6 +201,7 @@ public Transaction(
this.accessList = accessList;
this.maxFeePerBlobGas = maxFeePerBlobGas;
this.blobVersionedHashes = versionedHashes;
this.authorizationList = authorizationList;
}

public void setChainId(String chainId) {
Expand Down Expand Up @@ -357,6 +364,14 @@ public long getV() {
return v;
}

public List<Authorization> getAuthorizationList() {
return authorizationList;
}

public void setAuthorizationList(List<Authorization> authorizationList) {
this.authorizationList = authorizationList;
}

// Workaround until Geth & Parity return consistent values. At present
// Parity returns a byte value, Geth returns a hex-encoded string
// https://github.com/ethereum/go-ethereum/issues/3339
Expand Down Expand Up @@ -575,6 +590,10 @@ public boolean equals(Object o) {
: that.getAccessList() != null) {
return false;
}
if (getAuthorizationList() !=null ? !getAuthorizationList().equals(that.getAuthorizationList()) :
that.getAuthorizationList() != null) {
return false;
}
return getS() != null ? getS().equals(that.getS()) : that.getS() == null;
}

Expand Down Expand Up @@ -621,6 +640,7 @@ public int hashCode() {
? getBlobVersionedHashes().hashCode()
: 0);
result = 31 * result + (getAccessList() != null ? getAccessList().hashCode() : 0);
result = 31 * result + (getAuthorizationList() != null ? getAuthorizationList().hashCode() : 0);
return result;
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
group=org.web3j
version=4.13.0-SNAPSHOT
version=4.13.1-SNAPSHOT