Skip to content

Commit ba9aeea

Browse files
committed
Add the new metadata struct to EthereumTransaction
1 parent 2bf9639 commit ba9aeea

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Sources/web3swift/Transaction/EthereumTransaction.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ public struct EthereumTransaction: CustomStringConvertible {
1414
/// and type specific implementation
1515
internal var envelope: AbstractEnvelope
1616

17+
/// storage container for additional metadata returned by the node
18+
/// when a transaction is decoded form a JSON stream
19+
public var meta: EthereumMetadata?
20+
1721
// convenience accessors to the common envelope fields
1822
// everything else should come from getOpts/setOpts
1923
/// The type of the transacton being represented, see TransactionType enum
@@ -227,6 +231,8 @@ extension EthereumTransaction: Decodable {
227231
public init(from decoder: Decoder) throws {
228232
guard let env = try EnvelopeFactory.createEnvelope(from: decoder) else { throw Web3Error.dataError }
229233
self.envelope = env
234+
// capture any metadata that might be present
235+
self.meta = try EthereumMetadata(from: decoder)
230236
}
231237
}
232238

0 commit comments

Comments
 (0)