Skip to content

Commit 0334476

Browse files
committed
Transaction Response Add author
Signed-off-by: dylan.yang <[email protected]>
1 parent 693441d commit 0334476

File tree

2 files changed

+96
-2
lines changed

2 files changed

+96
-2
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
package org.web3j.protocol.core.methods.response;
2+
3+
/**
4+
* @Author DylanYang
5+
* @Date 2025/3/8
6+
*/
7+
public class Authorization {
8+
private String chainId;
9+
private String nonce;
10+
private String address;
11+
private String yParity;
12+
private String s;
13+
private String r;
14+
15+
public Authorization(String chainId, String r, String nonce, String address, String yParity, String s) {
16+
this.chainId = chainId;
17+
this.r = r;
18+
this.nonce = nonce;
19+
this.address = address;
20+
this.yParity = yParity;
21+
this.s = s;
22+
}
23+
24+
public Authorization() {
25+
}
26+
27+
public String getChainId() {
28+
return chainId;
29+
}
30+
31+
public void setChainId(String chainId) {
32+
this.chainId = chainId;
33+
}
34+
35+
public String getNonce() {
36+
return nonce;
37+
}
38+
39+
public void setNonce(String nonce) {
40+
this.nonce = nonce;
41+
}
42+
43+
public String getAddress() {
44+
return address;
45+
}
46+
47+
public void setAddress(String address) {
48+
this.address = address;
49+
}
50+
51+
public String getyParity() {
52+
return yParity;
53+
}
54+
55+
public void setyParity(String yParity) {
56+
this.yParity = yParity;
57+
}
58+
59+
public String getS() {
60+
return s;
61+
}
62+
63+
public void setS(String s) {
64+
this.s = s;
65+
}
66+
67+
public String getR() {
68+
return r;
69+
}
70+
71+
public void setR(String r) {
72+
this.r = r;
73+
}
74+
}

core/src/main/java/org/web3j/protocol/core/methods/response/Transaction.java

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public class Transaction {
4545
private List<AccessListObject> accessList;
4646
private String maxFeePerBlobGas;
4747
private List<String> blobVersionedHashes;
48+
private List<Authorization> authorizationList;
4849

4950
public Transaction() {}
5051

@@ -118,7 +119,9 @@ public Transaction(
118119
String type,
119120
String maxFeePerGas,
120121
String maxPriorityFeePerGas,
121-
List accessList) {
122+
List accessList,
123+
List<Authorization> authorizationList
124+
) {
122125
this.hash = hash;
123126
this.nonce = nonce;
124127
this.blockHash = blockHash;
@@ -142,6 +145,7 @@ public Transaction(
142145
this.maxFeePerGas = maxFeePerGas;
143146
this.maxPriorityFeePerGas = maxPriorityFeePerGas;
144147
this.accessList = accessList;
148+
this.authorizationList = authorizationList;
145149
}
146150

147151
public Transaction(
@@ -169,7 +173,9 @@ public Transaction(
169173
String maxPriorityFeePerGas,
170174
List accessList,
171175
String maxFeePerBlobGas,
172-
List versionedHashes) {
176+
List versionedHashes,
177+
List<Authorization> authorizationList
178+
) {
173179
this.hash = hash;
174180
this.nonce = nonce;
175181
this.blockHash = blockHash;
@@ -195,6 +201,7 @@ public Transaction(
195201
this.accessList = accessList;
196202
this.maxFeePerBlobGas = maxFeePerBlobGas;
197203
this.blobVersionedHashes = versionedHashes;
204+
this.authorizationList = authorizationList;
198205
}
199206

200207
public void setChainId(String chainId) {
@@ -357,6 +364,14 @@ public long getV() {
357364
return v;
358365
}
359366

367+
public List<Authorization> getAuthorizationList() {
368+
return authorizationList;
369+
}
370+
371+
public void setAuthorizationList(List<Authorization> authorizationList) {
372+
this.authorizationList = authorizationList;
373+
}
374+
360375
// Workaround until Geth & Parity return consistent values. At present
361376
// Parity returns a byte value, Geth returns a hex-encoded string
362377
// https://github.com/ethereum/go-ethereum/issues/3339
@@ -575,6 +590,10 @@ public boolean equals(Object o) {
575590
: that.getAccessList() != null) {
576591
return false;
577592
}
593+
if (getAuthorizationList() !=null ? !getAuthorizationList().equals(that.getAuthorizationList()) :
594+
that.getAuthorizationList() != null) {
595+
return false;
596+
}
578597
return getS() != null ? getS().equals(that.getS()) : that.getS() == null;
579598
}
580599

@@ -621,6 +640,7 @@ public int hashCode() {
621640
? getBlobVersionedHashes().hashCode()
622641
: 0);
623642
result = 31 * result + (getAccessList() != null ? getAccessList().hashCode() : 0);
643+
result = 31 * result + (getAuthorizationList() != null ? getAuthorizationList().hashCode() : 0);
624644
return result;
625645
}
626646
}

0 commit comments

Comments
 (0)