@@ -50,7 +50,7 @@ struct EthTransaction: @unchecked Sendable {
5050 let from : String
5151 let to : String
5252 let gasUsed : Decimal ?
53- let gasPrice : Decimal
53+ let gasPrice : Decimal ?
5454 let confirmations : String ?
5555 let isError : Bool
5656 let receiptStatus : TransactionReceipt . TXStatus
@@ -149,10 +149,10 @@ extension EthTransaction: TransactionDetails {
149149 var feeCurrencySymbol : String ? { EthWalletService . currencySymbol }
150150
151151 var feeValue : Decimal ? {
152- guard let gasUsed = gasUsed else {
153- return nil
154- }
155-
152+ guard let gasUsed = gasUsed,
153+ let gasPrice
154+ else { return nil }
155+
156156 return gasPrice * gasUsed
157157 }
158158
@@ -207,12 +207,14 @@ extension CodableTransaction {
207207 txValue = nil
208208 }
209209
210- let feePrice : BigUInt
211- if type == . eip1559 {
212- feePrice = ( maxFeePerGas ?? BigUInt ( 0 ) ) + ( maxPriorityFeePerGas ?? BigUInt ( 0 ) )
213- } else {
214- feePrice = gasPrice ?? BigUInt ( 0 )
215- }
210+ let feePrice : BigUInt ? = {
211+ if type == . eip1559 {
212+ guard let maxFeePerGas, let maxPriorityFeePerGas else { return nil }
213+ return maxFeePerGas + maxPriorityFeePerGas
214+ } else {
215+ return gasPrice
216+ }
217+ } ( )
216218
217219 let gasPrice = gasPrice ?? feePrice
218220
@@ -223,7 +225,7 @@ extension CodableTransaction {
223225 from: sender? . address ?? " " ,
224226 to: recipient. address,
225227 gasUsed: gasUsed? . asDecimal ( exponent: 0 ) ,
226- gasPrice: gasPrice. asDecimal ( exponent: EthWalletService . currencyExponent) ,
228+ gasPrice: gasPrice? . asDecimal ( exponent: EthWalletService . currencyExponent) ,
227229 confirmations: confirmations,
228230 isError: receiptStatus != . failed,
229231 receiptStatus: receiptStatus,
0 commit comments