@@ -41,6 +41,12 @@ public struct EIP1559Envelope: EIP2718Envelope {
41
41
public var maxFeePerGas : BigUInt
42
42
public var accessList : [ AccessListEntry ] // from EIP-2930
43
43
44
+ /// EIP-1159 trnsactions do not have a gasPrice parameter
45
+ /// However, it appears that some nodes report a gasPrice, even for EIP-1159 transactions
46
+ /// thus for a temporary workaround we capture and store gasPrice if initialized from a JSON transaction
47
+ /// decided form a node. This is currently needed for Oracle to work
48
+ private var gasPrice : BigUInt = 0
49
+
44
50
// for CustomStringConvertible
45
51
public var description : String {
46
52
var toReturn = " "
@@ -70,6 +76,9 @@ public struct EIP1559Envelope: EIP2718Envelope {
70
76
value: value,
71
77
data: data,
72
78
gasLimit: gasLimit,
79
+ // MARK: workaround for gasPrice coming from nodes for EIP-1159 - this allows Oracle to work for now
80
+ gasPrice: gasPrice,
81
+
73
82
maxFeePerGas: maxFeePerGas,
74
83
maxPriorityFeePerGas: maxPriorityFeePerGas,
75
84
accessList: accessList
@@ -85,6 +94,8 @@ public struct EIP1559Envelope: EIP2718Envelope {
85
94
maxFeePerGas = val. maxFeePerGas ?? maxFeePerGas
86
95
maxPriorityFeePerGas = val. maxPriorityFeePerGas ?? maxPriorityFeePerGas
87
96
accessList = val. accessList ?? accessList
97
+ // MARK: workaround for gasPrice coming from nodes for EIP-1159 - this allows Oracle to work for now
98
+ gasPrice = val. gasPrice ?? gasPrice
88
99
}
89
100
}
90
101
@@ -106,6 +117,8 @@ extension EIP1559Envelope {
106
117
case v
107
118
case r
108
119
case s
120
+ // MARK: workaround for gasPrice coming from nodes for EIP-1159 - this allows Oracle to work for now
121
+ case gasPrice
109
122
}
110
123
111
124
public init ? ( from decoder: Decoder ) throws {
@@ -133,6 +146,10 @@ extension EIP1559Envelope {
133
146
// swiftlint:enable force_unwrapping
134
147
self . to = ethAddr
135
148
}
149
+
150
+ // MARK: workaround for gasPrice coming from nodes for EIP-1159 - this allows Oracle to work for now
151
+ self . gasPrice = try container. decodeHexIfPresent ( BigUInt . self, forKey: . gasPrice) ?? 5000000000
152
+
136
153
self . value = try container. decodeHexIfPresent ( BigUInt . self, forKey: . value) ?? 0
137
154
self . maxPriorityFeePerGas = try container. decodeHexIfPresent ( BigUInt . self, forKey: . maxPriorityFeePerGas) ?? 0
138
155
self . maxFeePerGas = try container. decodeHexIfPresent ( BigUInt . self, forKey: . maxFeePerGas) ?? 0
0 commit comments