Skip to content

Commit 3c4e9d5

Browse files
Preparing to merge TransactionOptions into CodableTransaction,
by setting `gasPrice` to accessibility level `public private (set)`.
1 parent 1760791 commit 3c4e9d5

File tree

4 files changed

+24
-21
lines changed

4 files changed

+24
-21
lines changed

Sources/Core/TransactionOptions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public struct TransactionOptions {
5050
case withMargin(Double)
5151
}
5252

53-
public var gasPrice: GasPricePolicy?
53+
public private (set) var gasPrice: GasPricePolicy?
5454

5555
// new gas parameters for EIP-1559 support
5656
public enum FeePerGasPolicy {

Sources/web3swift/HookedFunctions/Web3+BrowserFunctions.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ extension web3.BrowserFunctions {
140140
guard let _ = options.from else {return (nil, nil)}
141141
let gasPrice = try await self.web3.eth.gasPrice()
142142
transaction.gasPrice = gasPrice
143-
options.gasPrice = .manual(gasPrice)
143+
// FIXME: Make this work again
144+
// options.gasPrice = .manual(gasPrice)
144145
guard let gasEstimate = await self.estimateGas(transaction, transactionOptions: options) else {return (nil, nil)}
145146
transaction.gasLimit = gasEstimate
146147

Sources/web3swift/Web3/Web3+MutatingTransaction.swift

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -148,17 +148,18 @@ public class WriteTransaction: ReadTransaction {
148148
finalOptions.accessList = mergedOptions.accessList
149149

150150
// set the finalized gas parameters
151-
if let gasPrice = finalGasPrice {
152-
finalOptions.gasPrice = .manual(mergedOptions.resolveGasPrice(gasPrice))
153-
}
154-
155-
if let tipFee = finalTipFee {
156-
finalOptions.maxPriorityFeePerGas = .manual(mergedOptions.resolveMaxPriorityFeePerGas(tipFee))
157-
}
158-
159-
if let gasFee = finalGasFee {
160-
finalOptions.maxFeePerGas = .manual(mergedOptions.resolveMaxFeePerGas(gasFee))
161-
}
151+
// FIXME: Make this working again.
152+
// if let gasPrice = finalGasPrice {
153+
// finalOptions.gasPrice = .manual(mergedOptions.resolveGasPrice(gasPrice))
154+
// }
155+
//
156+
// if let tipFee = finalTipFee {
157+
// finalOptions.maxPriorityFeePerGas = .manual(mergedOptions.resolveMaxPriorityFeePerGas(tipFee))
158+
// }
159+
//
160+
// if let gasFee = finalGasFee {
161+
// finalOptions.maxFeePerGas = .manual(mergedOptions.resolveMaxFeePerGas(gasFee))
162+
// }
162163

163164
assembledTransaction.applyOptions(finalOptions)
164165

Sources/web3swift/Web3/Web3+ReadingTransaction.swift

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,15 @@ public class ReadTransaction {
7777
optionsForGasEstimation.value = mergedOptions.value
7878

7979
// MARK: - Fixing estimate gas problem: gas price param shouldn't be nil
80-
if let gasPricePolicy = mergedOptions.gasPrice {
81-
switch gasPricePolicy {
82-
case .manual(_):
83-
optionsForGasEstimation.gasPrice = gasPricePolicy
84-
default:
85-
optionsForGasEstimation.gasPrice = .manual(1) // 1 wei to fix wrong estimating gas problem
86-
}
87-
}
80+
// FIXME: Make this work again.
81+
// if let gasPricePolicy = mergedOptions.gasPrice {
82+
// switch gasPricePolicy {
83+
// case .manual(_):
84+
// optionsForGasEstimation.gasPrice = gasPricePolicy
85+
// default:
86+
// optionsForGasEstimation.gasPrice = .manual(1) // 1 wei to fix wrong estimating gas problem
87+
// }
88+
// }
8889

8990
optionsForGasEstimation.callOnBlock = mergedOptions.callOnBlock
9091
if mergedOptions.value != nil {

0 commit comments

Comments
 (0)