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

Gh 2682/error on review tx screen #2684

Merged
merged 4 commits into from
Sep 21, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions Multisig/Data/ClaimingAppController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class ClaimingAppController {

static let mainnet = Configuration(
safeToken: "0x5aFE3855358E112B5647B952709E6165e1c1eEEe",
userAirdrop: "0x590d38Af0b484e7FB9a54a9669dcfFFB25D2DF35",
ecosystemAirdrop: "0x3eCD46C973d815e30F604619B7F3EB9B30c0e963",
userAirdrop: "0xA0b937D5c8E32a80E3a8ed4227CD020221544ee6",
ecosystemAirdrop: "0x29067F28306419923BCfF96E37F95E0f58ABdBBe",
// https://github.com/gnosis/delegate-registry/blob/feature/fix_deployment/networks.json
delegateRegistry: "0x469788fE6E9E9681C6ebF3bF78e7Fd26Fc015446",
chainId: "1"
Expand Down
3 changes: 3 additions & 0 deletions Multisig/UI/ClaimToken/ClaimSafeTokenFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class ClaimSafeTokenFlow: UIFlow {
var factory: ClaimSafeTokenFlowFactory!
var safe: Safe
var amount: Sol.UInt128?
var maxAmountSelected: Bool = false
var claimData: ClaimingAppController.ClaimingData?
var timestamp: TimeInterval?
var selectedGuardian: Guardian?
Expand Down Expand Up @@ -243,6 +244,7 @@ class ClaimSafeTokenFlow: UIFlow {
amount = claimVC.inputAmount
claimData = claimVC.claimData
timestamp = claimVC.timestamp
maxAmountSelected = claimVC.hasSelectedMaxAmount

review()
}
Expand All @@ -262,6 +264,7 @@ class ClaimSafeTokenFlow: UIFlow {
let reviewVC = ReviewClaimSafeTokenTransactionViewController(
safe: safe,
amount: amount!,
maxAmountSelected: maxAmountSelected,
claimData: claimData!,
timestamp: timestamp!,
guardian: selectedGuardian,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class ClaimTokensViewController: LoadableViewController {
override func reloadData() {
super.reloadData()

timestamp = Date().timeIntervalSince1970
timestamp = lastBlockTimestampEstimation()
keyboardBehavior.hideKeyboard()

claimButton.isEnabled = false
Expand Down Expand Up @@ -242,6 +242,11 @@ class ClaimTokensViewController: LoadableViewController {

return isAmountCorrect && isDelegateCorrect
}

private func lastBlockTimestampEstimation() -> TimeInterval {
// This to make sure that the last block time interval is less than the used one
Date().timeIntervalSince1970 - 30
}
}

extension ClaimTokensViewController: UITableViewDelegate, UITableViewDataSource {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ class ReviewClaimSafeTokenTransactionViewController: ReviewSafeTransactionViewCo
var selectedGuardian: Guardian?
var selectedCustomAddress: Address?
var controller: ClaimingAppController!

var maxAmountSelected: Bool = false

var onSuccess: ((SCGModels.TransactionDetails) -> ())?

convenience init(
safe: Safe,
amount: Sol.UInt128,
maxAmountSelected: Bool = false,
claimData: ClaimingAppController.ClaimingData,
timestamp: TimeInterval,
guardian: Guardian?,
Expand All @@ -32,6 +34,7 @@ class ReviewClaimSafeTokenTransactionViewController: ReviewSafeTransactionViewCo
) {
self.init(safe: safe)
self.amount = amount
self.maxAmountSelected = maxAmountSelected
self.claimData = claimData
self.timestamp = timestamp
self.selectedGuardian = guardian
Expand Down Expand Up @@ -74,7 +77,7 @@ class ReviewClaimSafeTokenTransactionViewController: ReviewSafeTransactionViewCo
override func createTransaction() -> Transaction? {
var result = controller.claimingTransaction(
safe: self.safe,
amount: amount,
amount: maxAmountSelected ? Sol.UInt128.max : amount,
delegate: newDelegateAddress,
data: claimData,
timestamp: timestamp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class WCIncomingTransactionRequestViewController: ReviewSafeTransactionViewContr
addressInfo = transactionPreview?.txData?.to
}

cell.setDapp(imageURL: session.dAppInfo.peerMeta.icons[0], name: session.dAppInfo.peerMeta.name)
cell.setDapp(imageURL: session.dAppInfo.peerMeta.icons.first, name: session.dAppInfo.peerMeta.name)
let (addressName, imageURL) = NamingPolicy.name(for: transaction.to.address,
info: addressInfo?.addressInfo,
chainId: safe.chain!.id!)
Expand Down