-
Notifications
You must be signed in to change notification settings - Fork 4
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
Tx display info refactoring #595
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ struct WalletTransactionDisplayInfo: Hashable, Identifiable { | |
let link: URL? | ||
let imageUrl: URL? | ||
let symbol: String | ||
let chain: String | ||
let nftName: String | ||
let type: TransactionType | ||
let from: Participant | ||
|
@@ -72,6 +73,7 @@ extension WalletTransactionDisplayInfo { | |
self.gas = serializedTransaction.gas | ||
self.link = URL(string: serializedTransaction.link) | ||
self.imageUrl = URL(string: serializedTransaction.imageUrl ?? "") | ||
self.chain = serializedTransaction.symbol | ||
if serializedTransaction.type == "erc20" { | ||
self.symbol = serializedTransaction.method | ||
} else { | ||
|
@@ -116,3 +118,25 @@ extension WalletTransactionDisplayInfo { | |
} | ||
} | ||
} | ||
|
||
import UIKit | ||
|
||
extension WalletTransactionDisplayInfo { | ||
var chainFullName: String { | ||
if let blockchainType = BlockchainType(rawValue: chain) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line and line 135 repeat the code because the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The issue is much deeper.
It is not possible to mix them, and therefore there's places where multiple use cases collides. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Oleg-Pecheneg agreed to make a deeper refactoring. Please create me a ticket, we'll discuss details tomorrow. Thanks! |
||
return blockchainType.fullName | ||
} else if let blockchainType = SemiSupportedBlockchainType(rawValue: chain) { | ||
return blockchainType.fullName | ||
} | ||
return chain | ||
} | ||
|
||
var chainIcon: UIImage { | ||
if let blockchainType = BlockchainType(rawValue: chain) { | ||
return blockchainType.chainIcon | ||
} else if let blockchainType = SemiSupportedBlockchainType(rawValue: chain) { | ||
return blockchainType.chainIcon | ||
} | ||
return .alertCircle | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be precise, let's call it
chainName
. Though having chainID would be the perfect thing to do -- mappingsymbol
from the response into a proper value representing a chainThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll update property to
chainName
.chainId
to be discussed