Show live swap status, explorer links, and full kyc.rip route details
This commit is contained in:
@@ -11,6 +11,26 @@ enum Chain: String, Codable, CaseIterable {
|
||||
}
|
||||
}
|
||||
|
||||
/// Web block explorers used for "view on the web" links.
|
||||
enum BlockExplorer {
|
||||
static func transactionURL(chain: Chain, hash: String) -> URL? {
|
||||
guard !hash.isEmpty else { return nil }
|
||||
switch chain {
|
||||
case .xmr: return URL(string: "https://xmrchain.net/tx/\(hash)")
|
||||
case .xrp: return URL(string: "https://livenet.xrpl.org/transactions/\(hash)")
|
||||
}
|
||||
}
|
||||
|
||||
/// Same lookup for a raw ticker ("XMR"/"XRP"), as used by the swap API.
|
||||
static func transactionURL(ticker: String, hash: String) -> URL? {
|
||||
switch ticker.uppercased() {
|
||||
case "XMR": return transactionURL(chain: .xmr, hash: hash)
|
||||
case "XRP": return transactionURL(chain: .xrp, hash: hash)
|
||||
default: return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct WalletRecord: Codable, Identifiable, Equatable {
|
||||
let id: String
|
||||
var name: String
|
||||
|
||||
Reference in New Issue
Block a user