File tree Expand file tree Collapse file tree 4 files changed +5
-10
lines changed Expand file tree Collapse file tree 4 files changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -136,8 +136,7 @@ final public class Oracle {
136
136
let block : BigUInt = try await combineRequest ( request: . blockNumber)
137
137
latestBlockNumber = block
138
138
case let . exact( number) : latestBlockNumber = number
139
- // Error throws since pending and erliest are unable to be used in this method.
140
- default : throw Web3Error . valueError ( )
139
+ default : throw Web3Error . valueError ( desc: " Unable to use ' \( block) ' policy to resolve block number to calculate gas fee suggestion. " )
141
140
}
142
141
143
142
/// checking if latest block number is greather than number of blocks to take in account
Original file line number Diff line number Diff line change @@ -53,5 +53,5 @@ public struct Policies {
53
53
self . maxPriorityFeePerGasPolicy = maxPriorityFeePerGasPolicy
54
54
}
55
55
56
- public private ( set ) static var auto = Policies ( )
56
+ public static let auto = Policies ( )
57
57
}
Original file line number Diff line number Diff line change @@ -36,7 +36,6 @@ public class ReadOperation {
36
36
37
37
// TODO: Remove type erasing here, some broad wide protocol should be added instead
38
38
public func callContractMethod( ) async throws -> [ String : Any ] {
39
- try await policyResolver. resolveAll ( for: & transaction)
40
39
// MARK: Read data from ABI flow
41
40
// FIXME: This should be dropped, and after `execute()` call, just to decode raw data.
42
41
let data : Data = try await self . web3. eth. callTransaction ( transaction)
Original file line number Diff line number Diff line change @@ -36,10 +36,9 @@ public class PolicyResolver {
36
36
}
37
37
38
38
public func resolveGasBaseFee( for policy: FeePerGasPolicy ) async -> BigUInt {
39
- let oracle = Oracle ( provider)
40
39
switch policy {
41
40
case . automatic:
42
- return await oracle . baseFeePercentiles ( ) . max ( ) ?? 0
41
+ return await Oracle ( provider ) . baseFeePercentiles ( ) . max ( ) ?? 0
43
42
case . manual( let value) :
44
43
return value
45
44
}
@@ -62,20 +61,18 @@ public class PolicyResolver {
62
61
}
63
62
64
63
public func resolveGasPrice( for policy: GasPricePolicy ) async -> BigUInt {
65
- let oracle = Oracle ( provider)
66
64
switch policy {
67
65
case . automatic, . withMargin:
68
- return await oracle . gasPriceLegacyPercentiles ( ) . max ( ) ?? 0
66
+ return await Oracle ( provider ) . gasPriceLegacyPercentiles ( ) . max ( ) ?? 0
69
67
case . manual( let value) :
70
68
return value
71
69
}
72
70
}
73
71
74
72
public func resolveGasPriorityFee( for policy: PriorityFeePerGasPolicy ) async -> BigUInt {
75
- let oracle = Oracle ( provider)
76
73
switch policy {
77
74
case . automatic:
78
- return await oracle . tipFeePercentiles ( ) . max ( ) ?? 0
75
+ return await Oracle ( provider ) . tipFeePercentiles ( ) . max ( ) ?? 0
79
76
case . manual( let value) :
80
77
return value
81
78
}
You can’t perform that action at this time.
0 commit comments