diff --git a/unstoppable-ios-app/domains-manager-ios/Modules/MPC/MPCWalletsService/MPCWalletSubServices/Fireblocks+UD/Entities/FB_UD_MPCOperationReadyResponse.swift b/unstoppable-ios-app/domains-manager-ios/Modules/MPC/MPCWalletsService/MPCWalletSubServices/Fireblocks+UD/Entities/FB_UD_MPCOperationReadyResponse.swift index 99935621c..02c2e5247 100644 --- a/unstoppable-ios-app/domains-manager-ios/Modules/MPC/MPCWalletsService/MPCWalletSubServices/Fireblocks+UD/Entities/FB_UD_MPCOperationReadyResponse.swift +++ b/unstoppable-ios-app/domains-manager-ios/Modules/MPC/MPCWalletsService/MPCWalletSubServices/Fireblocks+UD/Entities/FB_UD_MPCOperationReadyResponse.swift @@ -12,6 +12,7 @@ extension FB_UD_MPC { enum OperationReadyResponse { case txReady(txId: String) case signed(signature: String) + case finished(txHash: String) } } diff --git a/unstoppable-ios-app/domains-manager-ios/Modules/MPC/MPCWalletsService/MPCWalletSubServices/Fireblocks+UD/FB_UD_MPCConnectionService.swift b/unstoppable-ios-app/domains-manager-ios/Modules/MPC/MPCWalletsService/MPCWalletSubServices/Fireblocks+UD/FB_UD_MPCConnectionService.swift index f5807eebb..d355a0fe1 100644 --- a/unstoppable-ios-app/domains-manager-ios/Modules/MPC/MPCWalletsService/MPCWalletSubServices/Fireblocks+UD/FB_UD_MPCConnectionService.swift +++ b/unstoppable-ios-app/domains-manager-ios/Modules/MPC/MPCWalletsService/MPCWalletSubServices/Fireblocks+UD/FB_UD_MPCConnectionService.swift @@ -216,6 +216,9 @@ extension FB_UD_MPC.MPCConnectionService: MPCWalletProviderSubServiceProtocol { case .signed(let signature): logMPC("It took \(Date().timeIntervalSince(start)) to sign message") return signature + case .finished: + logMPC("It took \(Date().timeIntervalSince(start)) to sign message") + throw MPCConnectionServiceError.incorrectOperationState } } } @@ -306,6 +309,9 @@ extension FB_UD_MPC.MPCConnectionService: MPCWalletProviderSubServiceProtocol { operationId: operationId) logMPC("It took \(Date().timeIntervalSince(start)) to finish tx") return txHash + case .finished(let txHash): + logMPC("It took \(Date().timeIntervalSince(start)) to finish tx") + return txHash case .signed: logMPC("It took \(Date().timeIntervalSince(start)) to finish tx") throw MPCConnectionServiceError.incorrectOperationState diff --git a/unstoppable-ios-app/domains-manager-ios/Modules/MPC/MPCWalletsService/MPCWalletSubServices/Fireblocks+UD/Network/FB_UD_DefaultMPCConnectionNetworkService.swift b/unstoppable-ios-app/domains-manager-ios/Modules/MPC/MPCWalletsService/MPCWalletSubServices/Fireblocks+UD/Network/FB_UD_DefaultMPCConnectionNetworkService.swift index 62569f775..026fb9919 100644 --- a/unstoppable-ios-app/domains-manager-ios/Modules/MPC/MPCWalletsService/MPCWalletSubServices/Fireblocks+UD/Network/FB_UD_DefaultMPCConnectionNetworkService.swift +++ b/unstoppable-ios-app/domains-manager-ios/Modules/MPC/MPCWalletsService/MPCWalletSubServices/Fireblocks+UD/Network/FB_UD_DefaultMPCConnectionNetworkService.swift @@ -322,10 +322,12 @@ extension FB_UD_MPC { } return .txReady(txId: transactionId) } else { - guard let signature = operation.result?.signature else { - throw MPCNetworkServiceError.missingSignatureInSignTransactionOperation + if let signature = operation.result?.signature { + return .signed(signature: signature) + } else if let txHash = operation.transaction?.id { + return .finished(txHash: txHash) } - return .signed(signature: signature) + throw MPCNetworkServiceError.completedTransactionMissingResultValue } } @@ -345,10 +347,10 @@ extension FB_UD_MPC { let operation = try await waitForOperationStatuses(accessToken: accessToken, operationId: operationId, statuses: [.processing, .completed]) - guard let signature = operation.transaction?.id else { + guard let txHash = operation.transaction?.id else { throw MPCNetworkServiceError.missingTxIdInTransactionOperation } - return signature + return txHash } func fetchCryptoPortfolioForMPC(wallet: String, accessToken: String) async throws -> [WalletTokenPortfolio] { @@ -469,6 +471,7 @@ extension FB_UD_MPC { case waitForKeyOperationStatusTimeout case missingVendorIdInSignTransactionOperation case missingSignatureInSignTransactionOperation + case completedTransactionMissingResultValue case missingTxIdInTransactionOperation case badRequestData case operationFailed