Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ABW-2168] Bug fix - Show totalExecutionCost under "NETWORK EXECUTION" (instead of executionCost) #703

Merged
merged 4 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,44 @@ struct FeeViewState: Equatable, Sendable, Identifiable {
extension TransactionFee.AdvancedFeeCustomization {
var viewStates: IdentifiedArrayOf<FeeViewState> {
let base = IdentifiedArrayOf<FeeViewState>(uncheckedUniqueElements: [
.init(name: L10n.TransactionReview.CustomizeNetworkFeeSheet.networkExecution, amount: feeSummary.executionCost, isUserConfigurable: false),
.init(name: L10n.TransactionReview.CustomizeNetworkFeeSheet.networkFinalization, amount: feeSummary.finalizationCost, isUserConfigurable: false),
.init(name: L10n.TransactionReview.CustomizeNetworkFeeSheet.effectiveTip, amount: tipAmount, isUserConfigurable: true),
.init(name: L10n.TransactionReview.CustomizeNetworkFeeSheet.networkStorage, amount: feeSummary.storageExpansionCost, isUserConfigurable: false),
.init(name: L10n.TransactionReview.CustomizeNetworkFeeSheet.padding, amount: paddingFee, isUserConfigurable: true),
.init(name: L10n.TransactionReview.CustomizeNetworkFeeSheet.royalties, amount: feeSummary.royaltyCost, isUserConfigurable: false),
.init(
name: L10n.TransactionReview.CustomizeNetworkFeeSheet.networkExecution,
amount: feeSummary.totalExecutionCost,
isUserConfigurable: false
),
.init(
name: L10n.TransactionReview.CustomizeNetworkFeeSheet.networkFinalization,
amount: feeSummary.finalizationCost,
isUserConfigurable: false
),
.init(
name: L10n.TransactionReview.CustomizeNetworkFeeSheet.effectiveTip,
amount: tipAmount,
isUserConfigurable: true
),
.init(
name: L10n.TransactionReview.CustomizeNetworkFeeSheet.networkStorage,
amount: feeSummary.storageExpansionCost,
isUserConfigurable: false
),
.init(
name: L10n.TransactionReview.CustomizeNetworkFeeSheet.padding,
amount: paddingFee,
isUserConfigurable: true
),
.init(
name: L10n.TransactionReview.CustomizeNetworkFeeSheet.royalties,
amount: feeSummary.royaltyCost,
isUserConfigurable: false
),
])

if paidByDapps > .zero {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I would prefer base to be mutable and called result, and you append to it. Failing that, at least put return base in an else. This is just stylistic, obviously.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not my code, but agreed, will fix

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

return base + [.init(name: L10n.TransactionReview.CustomizeNetworkFeeSheet.paidByDApps, amount: paidByDapps, isUserConfigurable: false)]
return base + [.init(
name: L10n.TransactionReview.CustomizeNetworkFeeSheet.paidByDApps,
amount: paidByDapps,
isUserConfigurable: false
)]
}
return base
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,8 @@ public struct TransactionReview: Sendable, FeatureReducer {

case let .customizeFees(.delegate(.updated(reviewedTransaction))):
state.reviewedTransaction = reviewedTransaction
if let reviewedTransaction = state.reviewedTransaction {
state.networkFee = .init(reviewedTransaction: reviewedTransaction)
}
state.networkFee = .init(reviewedTransaction: reviewedTransaction)
// printFeePayerInfo()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A FIXME?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will be fixed now, when merging main into this PR

return .none

case .customizeFees:
Expand Down
Loading