@@ -55,8 +55,12 @@ public struct EncodableTransaction {
55
55
}
56
56
57
57
/// the native value of the transaction
58
- public var value : BigUInt
58
+ public var value : BigUInt {
59
+ get { return envelope. value }
60
+ set { envelope. value = newValue }
61
+ }
59
62
63
+ // MARK: - Ruins signing and decoding tests if tied to envelop
60
64
/// any additional data for the transaction
61
65
public var data : Data
62
66
@@ -169,7 +173,7 @@ public struct EncodableTransaction {
169
173
public init ? ( rawValue: Data ) {
170
174
guard let env = EnvelopeFactory . createEnvelope ( rawValue: rawValue) else { return nil }
171
175
self . envelope = env
172
- value = 0
176
+ // FIXME: This is duplication and should be fixed.
173
177
data = Data ( )
174
178
}
175
179
@@ -216,7 +220,7 @@ extension EncodableTransaction: Codable {
216
220
public init ( from decoder: Decoder ) throws {
217
221
guard let env = try EnvelopeFactory . createEnvelope ( from: decoder) else { throw Web3Error . dataError }
218
222
self . envelope = env
219
- value = 0
223
+ // FIXME: This is duplication and should be fixed.
220
224
data = Data ( )
221
225
222
226
// capture any metadata that might be present
@@ -289,10 +293,8 @@ extension EncodableTransaction {
289
293
public init ( type: TransactionType ? = nil , to: EthereumAddress , nonce: BigUInt = 0 ,
290
294
chainID: BigUInt ? = nil , value: BigUInt ? = nil , data: Data = Data ( ) ,
291
295
v: BigUInt = 1 , r: BigUInt = 0 , s: BigUInt = 0 ) {
292
-
293
- self . value = value ?? 0
296
+ // FIXME: This is duplication and should be fixed.
294
297
self . data = data
295
-
296
298
self . envelope = EnvelopeFactory . createEnvelope ( type: type, to: to, nonce: nonce, v: v, r: r, s: s)
297
299
}
298
300
}
0 commit comments