Skip to content

Commit

Permalink
Done
Browse files Browse the repository at this point in the history
  • Loading branch information
kugel3 committed Jun 8, 2023
1 parent dbcb26a commit 5c9b4af
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ public struct FungibleResourceAsset: Sendable, FeatureReducer {
return .send(.delegate(.amountChanged))

case .maxAmountTapped:
let fee: BigDecimal = .temporaryStandardFee
let sumOfOthers = state.totalTransferSum - (state.transferAmount ?? .zero)
let remainingAmount = max(state.balance - sumOfOthers, 0)
let remainingAmount = max(state.balance - sumOfOthers - fee, 0)
state.transferAmount = remainingAmount
state.transferAmountStr = remainingAmount.droppingTrailingZeros.formatWithoutRounding()
return .send(.delegate(.amountChanged))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,20 @@ extension SelectFeePayer {
Text(L10n.TransactionReview.SelectFeePayer.navigationTitle)
.textStyle(.sheetTitle)
.foregroundColor(.app.gray1)
.padding(.top, .small2)
.padding(.top, .medium3)
.padding(.horizontal, .medium1)
.padding(.bottom, .small2)

Text(L10n.TransactionReview.SelectFeePayer.body)
.textStyle(.body1HighImportance)
.foregroundColor(.app.gray2)
.padding(.horizontal, .large3)
.padding(.bottom, .small1)

Text(L10n.TransactionReview.SelectFeePayer.selectAccount)
.textStyle(.body1HighImportance)
.foregroundColor(.app.gray2)
.padding(.horizontal, .large3)

ScrollView {
VStack(spacing: .small1) {
Expand All @@ -66,10 +69,10 @@ extension SelectFeePayer {
)
}
}
.padding(.horizontal, .medium1)
.padding(.bottom, .medium2)
}
}
.padding(.horizontal, .medium1)
.navigationTitle(L10n.TransactionReview.SelectFeePayer.navigationTitle)
}
.footer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public struct TransactionReview: Sendable, FeatureReducer {
nonce: Nonce,
signTransactionPurpose: SigningPurpose.SignTransactionPurpose,
message: String?,
feeToAdd: BigDecimal = 10, // fix me use estimate from `analyze`
feeToAdd: BigDecimal = .temporaryStandardFee, // fix me use estimate from `analyze`
ephemeralNotaryPrivateKey: Curve25519.Signing.PrivateKey = .init(),
customizeGuarantees: TransactionReviewGuarantees.State? = nil
) {
Expand Down
5 changes: 5 additions & 0 deletions Sources/Prelude/Extensions/BigDecimal+Extensions.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import BigDecimal
import Foundation

extension BigDecimal {
// FIXME: This should not be used once we can get the actual fees
public static let temporaryStandardFee: BigDecimal = 10
}

extension BigDecimal {
public func format(
fiatCurrency: FiatCurrency,
Expand Down

0 comments on commit 5c9b4af

Please sign in to comment.