From 10da43dc2aeb41ef7dce65d427d804261a18118a Mon Sep 17 00:00:00 2001 From: Sergei Balashov Date: Mon, 26 Aug 2024 13:12:34 +0300 Subject: [PATCH] IOS-7486 Update CardanoTransactionBuilder.swift --- .../Cardano/CardanoTransactionBuilder.swift | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/BlockchainSdk/Blockchains/Cardano/CardanoTransactionBuilder.swift b/BlockchainSdk/Blockchains/Cardano/CardanoTransactionBuilder.swift index 0f3b49bce..eab5945e8 100644 --- a/BlockchainSdk/Blockchains/Cardano/CardanoTransactionBuilder.swift +++ b/BlockchainSdk/Blockchains/Cardano/CardanoTransactionBuilder.swift @@ -23,7 +23,19 @@ class CardanoTransactionBuilder { extension CardanoTransactionBuilder { func update(outputs: [CardanoUnspentOutput]) { - self.outputs = outputs + self.outputs = outputs.filter { output in + let containsIncorrectAssetNameHex = output.assets.contains(where: { asset in + // We have to exclude assets with the incorrect hex name like `000de14064655f76696c6c69657273` + // Which fails to meet utf8 standards + String(data: Data(hexString: asset.assetNameHex), encoding: .utf8) == nil + }) + + if containsIncorrectAssetNameHex { + Log.debug("CardanoTransactionBuilder will exclude output: \(output)") + } + + return !containsIncorrectAssetNameHex + } } func buildForSign(transaction: Transaction) throws -> Data {