diff --git a/Multisig/Data/Services/Safe Client Gateway Service/SCGModels.swift b/Multisig/Data/Services/Safe Client Gateway Service/SCGModels.swift index 295ca32c2..c9504fb24 100644 --- a/Multisig/Data/Services/Safe Client Gateway Service/SCGModels.swift +++ b/Multisig/Data/Services/Safe Client Gateway Service/SCGModels.swift @@ -386,11 +386,44 @@ extension SCGModels { struct SwapOrder: Decodable { var uid: String var explorerUrl: URL + var fullAppData: AppData? + + // limit, twap, market + var orderType: String { + fullAppData?.metadata?.orderClass?.orderClass ?? "market" + } + + var swapOrderDisplayName: String { + orderType == "limit" ? "Limit order" : "Swap order" + } + + var swapTransferDisplayName: String { + switch orderType { + case "limit": return "Limit order settlement" + case "twap": return "TWAP order settlement" + case "liquidity": return "Liquidity order settlement" + case "market": return "Swap order settlement" + default: return "Swap order settlement" + } + } + + struct AppData: Codable { + var metadata: Metadata? + } + + struct Metadata: Codable { + var orderClass: OrderClass? + } + + struct OrderClass: Codable { + var orderClass: String? + } } struct TwapOrder: Codable { var kind: String var status: String + var displayName: String { "Twap order" } } } diff --git a/Multisig/UI/Transaction/TransactionDetailsViewController/TransactionDetailCellBuilder.swift b/Multisig/UI/Transaction/TransactionDetailsViewController/TransactionDetailCellBuilder.swift index 9b5ae70e5..91515250e 100644 --- a/Multisig/UI/Transaction/TransactionDetailsViewController/TransactionDetailCellBuilder.swift +++ b/Multisig/UI/Transaction/TransactionDetailsViewController/TransactionDetailCellBuilder.swift @@ -375,13 +375,13 @@ class TransactionDetailCellBuilder { rejectionHeader(nonce: nil, isQueued: tx.txStatus.isInQueue) } case .swapOrder(let orderInfo): - text("Swap order", title: "Contract Interaction", expandableTitle: nil, copyText: nil) + text(orderInfo.swapOrderDisplayName, title: "Contract Interaction", expandableTitle: nil, copyText: nil) externalURL(text: "Order details", url: orderInfo.explorerUrl) case .swapTransfer(let orderInfo): - text("Swap transfer", title: "Contract Interaction", expandableTitle: nil, copyText: nil) + text(orderInfo.swapTransferDisplayName, title: "Contract Interaction", expandableTitle: nil, copyText: nil) externalURL(text: "Order details", url: orderInfo.explorerUrl) - case .twapOrder(_): - text("Twap order", title: "Contract Interaction", expandableTitle: nil, copyText: nil) + case .twapOrder(let order): + text(order.displayName, title: "Contract Interaction", expandableTitle: nil, copyText: nil) case .creation(_): // ignore fallthrough @@ -666,14 +666,14 @@ class TransactionDetailCellBuilder { case .creation(_): type = "Safe Account created" icon = UIImage(named: "ico-settings-tx") - case .swapOrder(_): - type = "Swap order" + case .swapOrder(let order): + type = order.swapOrderDisplayName icon = UIImage(named: "ico-custom-tx") - case .swapTransfer(_): - type = "Swap transfer" + case .swapTransfer(let order): + type = order.swapTransferDisplayName icon = UIImage(named: "ico-custom-tx") - case .twapOrder(_): - type = "Twap order" + case .twapOrder(let order): + type = order.displayName icon = UIImage(named: "ico-custom-tx") case .unknown: type = "Unknown operation" diff --git a/Multisig/UI/Transaction/TransactionListViewController/TransactionListViewController.swift b/Multisig/UI/Transaction/TransactionListViewController/TransactionListViewController.swift index 57896820f..edd619609 100644 --- a/Multisig/UI/Transaction/TransactionListViewController/TransactionListViewController.swift +++ b/Multisig/UI/Transaction/TransactionListViewController/TransactionListViewController.swift @@ -365,15 +365,15 @@ class TransactionListViewController: LoadableViewController, UITableViewDelegate case .creation(_): image = UIImage(named: "ico-settings-tx") title = "Safe Account created" - case .swapOrder(_): + case .swapOrder(let order): image = UIImage(named: "ico-custom-tx") - title = "Swap order" - case .swapTransfer(_): + title = order.swapOrderDisplayName + case .swapTransfer(let order): image = UIImage(named: "ico-custom-tx") - title = "Swap transfer" - case .twapOrder(_): + title = order.swapTransferDisplayName + case .twapOrder(let order): image = UIImage(named: "ico-custom-tx") - title = "Twap order" + title = order.displayName case .unknown: image = UIImage(named: "ico-custom-tx") title = "Unknown operation" diff --git a/Multisig/UI/WalletConnect/Server/Safes/Incoming Transaction/WCIncomingTransactionRequestViewController.swift b/Multisig/UI/WalletConnect/Server/Safes/Incoming Transaction/WCIncomingTransactionRequestViewController.swift index 85845f395..d72957f08 100644 --- a/Multisig/UI/WalletConnect/Server/Safes/Incoming Transaction/WCIncomingTransactionRequestViewController.swift +++ b/Multisig/UI/WalletConnect/Server/Safes/Incoming Transaction/WCIncomingTransactionRequestViewController.swift @@ -137,15 +137,15 @@ class WCIncomingTransactionRequestViewController: ReviewSafeTransactionViewContr case .creation(_): imageName = "ico-settings-tx" name = "Safe Account created" - case .swapOrder(_): + case .swapOrder(let order): imageName = "ico-custom-tx" - name = "Swap order" - case .swapTransfer(_): + name = order.swapOrderDisplayName + case .swapTransfer(let order): imageName = "ico-custom-tx" - name = "Swap transfer" - case .twapOrder(_): + name = order.swapTransferDisplayName + case .twapOrder(let order): imageName = "ico-custom-tx" - name = "Twap transfer" + name = order.displayName case .unknown: imageName = "ico-custom-tx" name = "Unknown operation"