Skip to content

Commit a893bf8

Browse files
committed
minor consolidation in TransactionOptions
1 parent 95f8515 commit a893bf8

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

Sources/web3swift/Transaction/TransactionOptions.swift

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,12 @@ public struct TransactionOptions {
4747
public var gasPrice: GasPricePolicy?
4848

4949
// new gas parameters for EIP-1559 support
50-
public enum MaxFeePerGasPolicy {
50+
public enum FeePerGasPolicy {
5151
case automatic
5252
case manual(BigUInt)
5353
}
54-
public var maxFeePerGas: MaxFeePerGasPolicy?
55-
56-
public enum MaxPriorityFeePerGasPolicy {
57-
case automatic
58-
case manual(BigUInt)
59-
}
60-
public var maxPriorityFeePerGas: MaxPriorityFeePerGasPolicy?
54+
public var maxFeePerGas: FeePerGasPolicy?
55+
public var maxPriorityFeePerGas: FeePerGasPolicy?
6156

6257
/// The value transferred for the transaction in wei, also the endowment if it’s a contract-creation transaction.
6358
public var value: BigUInt?
@@ -130,12 +125,10 @@ public struct TransactionOptions {
130125
public func resolveGasLimit(_ suggestedByNode: BigUInt) -> BigUInt {
131126
guard let gasLimitPolicy = self.gasLimit else { return suggestedByNode }
132127
switch gasLimitPolicy {
133-
case .automatic:
128+
case .automatic, .withMargin:
134129
return suggestedByNode
135130
case .manual(let value):
136131
return value
137-
case .withMargin:
138-
return suggestedByNode
139132
case .limited(let limit):
140133
if limit <= suggestedByNode {
141134
return suggestedByNode

0 commit comments

Comments
 (0)