From 32637abf88b5573c73f5749eb2d8e9719f01f004 Mon Sep 17 00:00:00 2001 From: Andrey Chukavin Date: Wed, 1 Feb 2023 17:19:05 +0200 Subject: [PATCH 01/20] IOS-2948 Added external signer protocol / callbacks and an implementation for Tron --- include/TrustWalletCore/TWAnySigner.h | 3 ++ src/Coin.cpp | 7 ++++ src/Coin.h | 3 ++ src/CoinEntry.h | 11 ++++++ src/Tron/Entry.cpp | 5 +++ src/Tron/Entry.h | 2 ++ src/Tron/Signer.cpp | 26 +++++++++++++- src/Tron/Signer.h | 3 ++ src/interface/TWAnySigner.cpp | 17 +++++++++ swift/Sources/AnySigner.swift | 51 +++++++++++++++++++++++++++ 10 files changed, 127 insertions(+), 1 deletion(-) diff --git a/include/TrustWalletCore/TWAnySigner.h b/include/TrustWalletCore/TWAnySigner.h index f3864bcfa83..196626267a7 100644 --- a/include/TrustWalletCore/TWAnySigner.h +++ b/include/TrustWalletCore/TWAnySigner.h @@ -22,6 +22,9 @@ struct TWAnySigner; /// \return The serialized data of a `SigningOutput` proto object. (e.g. TW.Bitcoin.Proto.SigningOutput). extern TWData *_Nonnull TWAnySignerSign(TWData *_Nonnull input, enum TWCoinType coin); +// TANGEM +extern TWData *_Nonnull TWAnySignerSignExternally(TWData *_Nonnull input, enum TWCoinType coin, TWData *_Nonnull (*_Nonnull externalSigner)(TWData *_Nonnull)); + /// Signs a transaction specified by the JSON representation of signing input, coin type and a private key, returning the JSON representation of the signing output. /// /// \param json JSON representation of a signing input diff --git a/src/Coin.cpp b/src/Coin.cpp index 521db9fb0a8..df06af1b155 100644 --- a/src/Coin.cpp +++ b/src/Coin.cpp @@ -264,6 +264,13 @@ void TW::anyCoinSign(TWCoinType coinType, const Data& dataIn, Data& dataOut) { dispatcher->sign(coinType, dataIn, dataOut); } +// TANGEM +void TW::anyCoinSignExternally(TWCoinType coinType, const Data& dataIn, Data& dataOut, std::function externalSigner) { + auto* dispatcher = coinDispatcher(coinType); + assert(dispatcher != nullptr); + dispatcher->signExternally(coinType, dataIn, dataOut, externalSigner); +} + std::string TW::anySignJSON(TWCoinType coinType, const std::string& json, const Data& key) { auto* dispatcher = coinDispatcher(coinType); assert(dispatcher != nullptr); diff --git a/src/Coin.h b/src/Coin.h index a4920fe7419..0a065ad3059 100644 --- a/src/Coin.h +++ b/src/Coin.h @@ -114,6 +114,9 @@ const char* chainId(TWCoinType coin); // Note: use output parameter to avoid unneeded copies void anyCoinSign(TWCoinType coinType, const Data& dataIn, Data& dataOut); +// TANGEM +void anyCoinSignExternally(TWCoinType coinType, const Data& dataIn, Data& dataOut, const std::function externalSigner); + uint32_t slip44Id(TWCoinType coin); std::string anySignJSON(TWCoinType coinType, const std::string& json, const Data& key); diff --git a/src/CoinEntry.h b/src/CoinEntry.h index 5ecb055ddc6..0c7e0083770 100644 --- a/src/CoinEntry.h +++ b/src/CoinEntry.h @@ -49,6 +49,8 @@ class CoinEntry { virtual Data addressToData([[maybe_unused]] TWCoinType coin, [[maybe_unused]] const std::string& address) const { return {}; } // Signing virtual void sign(TWCoinType coin, const Data& dataIn, Data& dataOut) const = 0; + // TANGEM + virtual void signExternally(TWCoinType coin, const Data& dataIn, Data& dataOut, std::function externalSigner) const { } virtual bool supportsJSONSigning() const { return false; } // It is optional, Signing JSON input with private key virtual std::string signJSON([[maybe_unused]] TWCoinType coin, [[maybe_unused]] const std::string& json, [[maybe_unused]] const Data& key) const { return ""; } @@ -79,6 +81,15 @@ void signTemplate(const Data& dataIn, Data& dataOut) { dataOut.insert(dataOut.end(), serializedOut.begin(), serializedOut.end()); } +// TANGEM +template +void signTemplateExternally(const Data& dataIn, Data& dataOut, const std::function externalSigner) { + auto input = Input(); + input.ParseFromArray(dataIn.data(), (int)dataIn.size()); + auto serializedOut = Signer::sign(input, externalSigner).SerializeAsString(); + dataOut.insert(dataOut.end(), serializedOut.begin(), serializedOut.end()); +} + // Note: use output parameter to avoid unneeded copies template void planTemplate(const Data& dataIn, Data& dataOut) { diff --git a/src/Tron/Entry.cpp b/src/Tron/Entry.cpp index 393c6be330d..645c4873133 100644 --- a/src/Tron/Entry.cpp +++ b/src/Tron/Entry.cpp @@ -26,4 +26,9 @@ void Entry::sign([[maybe_unused]] TWCoinType coin, const TW::Data& dataIn, TW::D signTemplate(dataIn, dataOut); } +// TANGEM +void Entry::signExternally([[maybe_unused]] TWCoinType coin, const TW::Data& dataIn, TW::Data& dataOut, const std::function externalSigner) const { + signTemplateExternally(dataIn, dataOut, externalSigner); +} + } // namespace TW::Tron diff --git a/src/Tron/Entry.h b/src/Tron/Entry.h index d689b890aa7..cf47ec9b1ad 100644 --- a/src/Tron/Entry.h +++ b/src/Tron/Entry.h @@ -17,6 +17,8 @@ class Entry final : public CoinEntry { bool validateAddress(TWCoinType coin, const std::string& address, const PrefixVariant& addressPrefix) const; std::string deriveAddress(TWCoinType coin, const PublicKey& publicKey, TWDerivation derivation, const PrefixVariant& addressPrefix) const; void sign(TWCoinType coin, const Data& dataIn, Data& dataOut) const; + // TANGEM + void signExternally(TWCoinType coin, const TW::Data& dataIn, TW::Data& dataOut, const std::function externalSigner) const; }; } // namespace TW::Tron diff --git a/src/Tron/Signer.cpp b/src/Tron/Signer.cpp index 87ed70b30f5..0e74698a408 100644 --- a/src/Tron/Signer.cpp +++ b/src/Tron/Signer.cpp @@ -15,6 +15,7 @@ #include #include +#include namespace TW::Tron { @@ -202,6 +203,11 @@ void setBlockReference(const Proto::Transaction& transaction, protocol::Transact } Proto::SigningOutput Signer::sign(const Proto::SigningInput& input) noexcept { + return Signer::sign(input, nullptr); +} + +// TANGEM +Proto::SigningOutput Signer::sign(const Proto::SigningInput& input, const std::function externalSigner) noexcept { auto internal = protocol::Transaction(); auto output = Proto::SigningOutput(); @@ -310,7 +316,25 @@ Proto::SigningOutput Signer::sign(const Proto::SigningInput& input) noexcept { const auto hash = Hash::sha256(Data(serialized.begin(), serialized.end())); const auto key = PrivateKey(Data(input.private_key().begin(), input.private_key().end())); - const auto signature = key.sign(hash, TWCurveSECP256k1); + auto signature = Data(); + + // TANGEM + if(externalSigner) { + // TODO: remove debug output + std::cout << "Data to sign in C++" << std::endl; + std::cout << hex(hash) << std::endl; + + std::future signedDataFuture = std::async(externalSigner, hash); + + const Data signedData = signedDataFuture.get(); + signature = signedData; + + // TODO: remove debug output + std::cout << "Signed data in C++" << std::endl; + std::cout << hex(signedData) << std::endl; + } else { + signature = key.sign(hash, TWCurveSECP256k1); + } const auto json = transactionJSON(internal, hash, signature).dump(); diff --git a/src/Tron/Signer.h b/src/Tron/Signer.h index 33a06fff775..0fe1ddd0577 100644 --- a/src/Tron/Signer.h +++ b/src/Tron/Signer.h @@ -19,6 +19,9 @@ class Signer { /// Signs the given transaction. static Proto::SigningOutput sign(const Proto::SigningInput& input) noexcept; + + // TANGEM + static Proto::SigningOutput sign(const Proto::SigningInput& input, const std::function externalSigner) noexcept; }; } // namespace TW::Tron diff --git a/src/interface/TWAnySigner.cpp b/src/interface/TWAnySigner.cpp index 64f3dbcc382..f04ca9956e1 100644 --- a/src/interface/TWAnySigner.cpp +++ b/src/interface/TWAnySigner.cpp @@ -17,6 +17,23 @@ TWData* _Nonnull TWAnySignerSign(TWData* _Nonnull data, enum TWCoinType coin) { return TWDataCreateWithBytes(dataOut.data(), dataOut.size()); } +// TANGEM +TWData* _Nonnull TWAnySignerSignExternally(TWData* _Nonnull data, enum TWCoinType coin, TWData* (*externalSigner)(TWData*)) { + // Just a conversion between TWData and TW::Data + auto dataExternalSigner = [externalSigner](Data dataToSign) -> Data { + const TWData* twDataToSign = TWDataCreateWithBytes(dataToSign.data(), dataToSign.size()); + const TWData* twDataSigned = externalSigner(twDataToSign); + + const Data& dataSigned = *(reinterpret_cast(twDataSigned)); + return dataSigned; + }; + + const Data& dataIn = *(reinterpret_cast(data)); + Data dataOut; + TW::anyCoinSignExternally(coin, dataIn, dataOut, dataExternalSigner); + return TWDataCreateWithBytes(dataOut.data(), dataOut.size()); +} + TWString *_Nonnull TWAnySignerSignJSON(TWString *_Nonnull json, TWData *_Nonnull key, enum TWCoinType coin) { const Data& keyData = *(reinterpret_cast(key)); const std::string& jsonString = *(reinterpret_cast(json)); diff --git a/swift/Sources/AnySigner.swift b/swift/Sources/AnySigner.swift index 5abf730b95d..b2af15c96aa 100644 --- a/swift/Sources/AnySigner.swift +++ b/swift/Sources/AnySigner.swift @@ -10,6 +10,14 @@ import SwiftProtobuf public typealias SigningInput = Message public typealias SigningOutput = Message +// TANGEM +public protocol Signer { + func sign(_ data: Data) -> Data +} + +// TANGEM +var externalSigner: Signer? = nil + /// Represents a signer to sign transactions for any blockchain. public final class AnySigner { @@ -27,6 +35,22 @@ public final class AnySigner { fatalError(error.localizedDescription) } } + + // TANGEM + public static func signExternally(input: SigningInput, coin: CoinType, signer: Signer) -> SigningOutput { + defer { + externalSigner = nil + } + + externalSigner = signer + + do { + let outputData = nativeSignExternally(data: try input.serializedData(), coin: coin) + return try SigningOutput(serializedData: outputData) + } catch let error { + fatalError(error.localizedDescription) + } + } /// Signs a transaction by serialized data of a SigningInput and coin type /// @@ -41,6 +65,33 @@ public final class AnySigner { } return TWDataNSData(TWAnySignerSign(inputData, TWCoinType(rawValue: coin.rawValue))) } + + // TANGEM + public static func nativeSignExternally(data: Data, coin: CoinType) -> Data { + let inputData = TWDataCreateWithNSData(data) + defer { + TWDataDelete(inputData) + } + + return TWDataNSData(TWAnySignerSignExternally(inputData, TWCoinType(rawValue: coin.rawValue), { twDataToSign in + guard let externalSigner = externalSigner else { + fatalError("You must set external signer to sign asynchronously") + } + + let dataToSign = TWDataNSData(twDataToSign) + + // TODO: remove debug output + print("Data to sign in swift") + print(dataToSign.hexString) + + let dataSigned = externalSigner.sign(dataToSign) + + print("Signed data in swift") + print(dataSigned.hexString) + + return TWDataCreateWithNSData(dataSigned) + })) + } /// Check if AnySigner supports signing JSON representation of SigningInput for a given coin. public static func supportsJSON(coin: CoinType) -> Bool { From 30338ffb38dd9b6a7c181b5468ea0045f9954c50 Mon Sep 17 00:00:00 2001 From: Andrey Chukavin Date: Wed, 1 Feb 2023 17:19:20 +0200 Subject: [PATCH 02/20] IOS-2948 Added external signer to tron tests --- swift/Tests/Blockchains/TronTests.swift | 43 ++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/swift/Tests/Blockchains/TronTests.swift b/swift/Tests/Blockchains/TronTests.swift index 897c9787973..e95aae8bc33 100644 --- a/swift/Tests/Blockchains/TronTests.swift +++ b/swift/Tests/Blockchains/TronTests.swift @@ -7,6 +7,30 @@ import XCTest import WalletCore +// TANGEM +public struct PrivateKeySigner: Signer { + public let privateKey: PrivateKey + public let coin: CoinType + + public init(privateKey: PrivateKey, coin: CoinType) { + self.privateKey = privateKey + self.coin = coin + } + + public func sign(_ data: Data) -> Data { + usleep(2_000_000) + + // TODO: remove debug output + print("Trying to sign in swift") + print(data.hexString) + + let signedData = privateKey.sign(digest: data, curve: coin.curve)! + print("signed in swift") + print(signedData.hexString) + return signedData //+ Data(hexString: "abcd")! + } +} + class TronTests: XCTestCase { func testTronAddress() { @@ -38,7 +62,24 @@ class TronTests: XCTestCase { $0.privateKey = Data(hexString: "ba005cd605d8a02e3d5dfd04234cef3a3ee4f76bfbad2722d1fb5af8e12e6764")! } - let output: TronSigningOutput = AnySigner.sign(input: input, coin: .tron) + print("") + print("") + print("") + +// let output: TronSigningOutput = AnySigner.sign(input: input, coin: .tron) + + let signer = PrivateKeySigner( + privateKey: PrivateKey(data: input.privateKey)!, + coin: .tron + ) + + let output: TronSigningOutput = AnySigner.signExternally(input: input, coin: .tron, signer: signer) + + print("") + print("") + print("") + + let expectedJSON = """ { "raw_data": { From 525fc1c9cd1abb95e5af685ca482d4d3a9fa3d88 Mon Sep 17 00:00:00 2001 From: Andrey Chukavin Date: Wed, 1 Feb 2023 17:19:35 +0200 Subject: [PATCH 03/20] IOS-2948 Temporarily reduced the amount to build --- swift/fastlane/Fastfile | 8 ++++++-- tools/ios-build | 19 ++++++------------- tools/ios-xcframework | 2 +- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/swift/fastlane/Fastfile b/swift/fastlane/Fastfile index 298bcb35a56..4dfbed3a0cf 100644 --- a/swift/fastlane/Fastfile +++ b/swift/fastlane/Fastfile @@ -13,7 +13,9 @@ platform :ios do create_xcframework( workspace: 'TrustWalletCore.xcworkspace', scheme: 'WalletCore', - destinations: ['iOS', 'macOS'], + clean: false, + # destinations: ['iOS', 'macOS'], + destinations: ['iOS'], xcframework_output_directory: 'build', enable_bitcode: false ) @@ -24,7 +26,9 @@ platform :ios do create_xcframework( workspace: 'TrustWalletCore.xcworkspace', scheme: 'SwiftProtobuf', - destinations: ['iOS', 'macOS'], + # destinations: ['iOS', 'macOS'], + destinations: ['iOS'], + clean: false, xcframework_output_directory: 'build', enable_bitcode: false ) diff --git a/tools/ios-build b/tools/ios-build index 8e12031289e..b9e58860ae2 100755 --- a/tools/ios-build +++ b/tools/ios-build @@ -10,14 +10,7 @@ FRAMEWORK=WalletCoreCommon BUILD_FOLDER=build/ios-frameworks init() { - echo "Cleanup and init..." - pushd swift - xcodegen -s common-xcframework.yml - popd - - rm -rf ${BUILD_FOLDER}/*.xcarchive - rm -rf ${BUILD_FOLDER}/${FRAMEWORK}.xcframework - rm -rf ${BUILD_FOLDER}/${FRAMEWORK}.xcframework.* + echo "" } # build destination archivePath @@ -46,15 +39,15 @@ create_xc_framework() { echo "Createing xcframework..." xcodebuild -create-xcframework -output $BUILD_FOLDER/$FRAMEWORK.xcframework \ -framework $BUILD_FOLDER/ios-arm64.xcarchive/Products/Library/Frameworks/$FRAMEWORK.framework \ - -framework $BUILD_FOLDER/ios-arm64_x86_64-simulator.xcarchive/Products/Library/Frameworks/$FRAMEWORK.framework \ - -framework $BUILD_FOLDER/ios-x86_64_arm64-maccatalyst.xcarchive/Products/Library/Frameworks/$FRAMEWORK.framework \ - -framework $BUILD_FOLDER/macos-arm64_x86_64.xcarchive/Products/Library/Frameworks/$FRAMEWORK.framework + # -framework $BUILD_FOLDER/ios-arm64_x86_64-simulator.xcarchive/Products/Library/Frameworks/$FRAMEWORK.framework \ + # -framework $BUILD_FOLDER/ios-x86_64_arm64-maccatalyst.xcarchive/Products/Library/Frameworks/$FRAMEWORK.framework \ + # -framework $BUILD_FOLDER/macos-arm64_x86_64.xcarchive/Products/Library/Frameworks/$FRAMEWORK.framework } main() { init - build_mac_x64_arm64 && build_ios_mac_catalyst - build_ios_arm64 && build_ios_simulator + # build_mac_x64_arm64 && build_ios_mac_catalyst + build_ios_arm64 #&& build_ios_simulator create_xc_framework } diff --git a/tools/ios-xcframework b/tools/ios-xcframework index d5d667f4b14..96b7886695c 100755 --- a/tools/ios-xcframework +++ b/tools/ios-xcframework @@ -6,7 +6,7 @@ set -e echo "Building Docc..." -tools/ios-doc +# tools/ios-doc echo "Building xcframework..." pushd swift From d0e722e64ba679950ef16659d5114f074e3ff5d1 Mon Sep 17 00:00:00 2001 From: Andrey Chukavin Date: Mon, 6 Feb 2023 19:35:19 +0200 Subject: [PATCH 04/20] IOS-2948 Added error to the signer protocol --- swift/Sources/AnySigner.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/swift/Sources/AnySigner.swift b/swift/Sources/AnySigner.swift index b2af15c96aa..04e919f407d 100644 --- a/swift/Sources/AnySigner.swift +++ b/swift/Sources/AnySigner.swift @@ -12,6 +12,8 @@ public typealias SigningOutput = Message // TANGEM public protocol Signer { + var error: Error? { get } + func sign(_ data: Data) -> Data } From 72fffdc20de9d3cc39a62e96264c21203eb92701 Mon Sep 17 00:00:00 2001 From: Andrey Chukavin Date: Tue, 7 Feb 2023 10:10:49 +0200 Subject: [PATCH 05/20] IOS-2948 Refactoring, cleanup --- swift/Sources/AnySigner.swift | 22 ++++++++++++++++++++++ swift/Tests/Blockchains/TronTests.swift | 24 ------------------------ 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/swift/Sources/AnySigner.swift b/swift/Sources/AnySigner.swift index 04e919f407d..5ac3b521f89 100644 --- a/swift/Sources/AnySigner.swift +++ b/swift/Sources/AnySigner.swift @@ -15,6 +15,28 @@ public protocol Signer { var error: Error? { get } func sign(_ data: Data) -> Data + func sign(_ data: [Data]) -> [Data] +} + +// TANGEM +public struct PrivateKeySigner: Signer { + public var error: Error? + + public let privateKey: PrivateKey + public let coin: CoinType + + public init(privateKey: PrivateKey, coin: CoinType) { + self.privateKey = privateKey + self.coin = coin + } + + public func sign(_ data: Data) -> Data { + privateKey.sign(digest: data, curve: coin.curve)! + } + + public func sign(_ data: [Data]) -> [Data] { + return data.map { privateKey.sign(digest: $0, curve: coin.curve)! } + } } // TANGEM diff --git a/swift/Tests/Blockchains/TronTests.swift b/swift/Tests/Blockchains/TronTests.swift index e95aae8bc33..f69e414ab29 100644 --- a/swift/Tests/Blockchains/TronTests.swift +++ b/swift/Tests/Blockchains/TronTests.swift @@ -7,30 +7,6 @@ import XCTest import WalletCore -// TANGEM -public struct PrivateKeySigner: Signer { - public let privateKey: PrivateKey - public let coin: CoinType - - public init(privateKey: PrivateKey, coin: CoinType) { - self.privateKey = privateKey - self.coin = coin - } - - public func sign(_ data: Data) -> Data { - usleep(2_000_000) - - // TODO: remove debug output - print("Trying to sign in swift") - print(data.hexString) - - let signedData = privateKey.sign(digest: data, curve: coin.curve)! - print("signed in swift") - print(signedData.hexString) - return signedData //+ Data(hexString: "abcd")! - } -} - class TronTests: XCTestCase { func testTronAddress() { From 1381e74ef3d625223efa6ad3b063cb3e000264e6 Mon Sep 17 00:00:00 2001 From: Andrey Chukavin Date: Tue, 7 Feb 2023 11:29:09 +0200 Subject: [PATCH 06/20] IOS-2948 Initial changes for TON --- src/TheOpenNetwork/Entry.cpp | 5 +++++ src/TheOpenNetwork/Entry.h | 2 ++ src/TheOpenNetwork/Signer.cpp | 13 ++++++++++- src/TheOpenNetwork/Signer.h | 6 +++++ src/TheOpenNetwork/wallet/Wallet.cpp | 33 +++++++++++++++++++++++++++- src/TheOpenNetwork/wallet/Wallet.h | 11 ++++++++++ 6 files changed, 68 insertions(+), 2 deletions(-) diff --git a/src/TheOpenNetwork/Entry.cpp b/src/TheOpenNetwork/Entry.cpp index 21f2e19de1b..109c39120ad 100644 --- a/src/TheOpenNetwork/Entry.cpp +++ b/src/TheOpenNetwork/Entry.cpp @@ -30,4 +30,9 @@ void Entry::sign([[maybe_unused]] TWCoinType coin, const TW::Data& dataIn, TW::D signTemplate(dataIn, dataOut); } +// TANGEM +void Entry::signExternally([[maybe_unused]] TWCoinType coin, const TW::Data& dataIn, TW::Data& dataOut, const std::function externalSigner) const { + signTemplateExternally(dataIn, dataOut, externalSigner); +} + } // namespace TW::TheOpenNetwork diff --git a/src/TheOpenNetwork/Entry.h b/src/TheOpenNetwork/Entry.h index a432b493bda..fcc10ea3b16 100644 --- a/src/TheOpenNetwork/Entry.h +++ b/src/TheOpenNetwork/Entry.h @@ -16,6 +16,8 @@ class Entry final : public CoinEntry { std::string normalizeAddress(TWCoinType coin, const std::string& address) const; std::string deriveAddress(TWCoinType coin, const PublicKey& publicKey, TWDerivation derivation, const PrefixVariant& addressPrefix) const; void sign(TWCoinType coin, const Data& dataIn, Data& dataOut) const; + // TANGEM + void signExternally(TWCoinType coin, const Data& dataIn, Data& dataOut, const std::function externalSigner) const; }; } // namespace TW::TheOpenNetwork diff --git a/src/TheOpenNetwork/Signer.cpp b/src/TheOpenNetwork/Signer.cpp index df5e6db1a27..508a1956f2f 100644 --- a/src/TheOpenNetwork/Signer.cpp +++ b/src/TheOpenNetwork/Signer.cpp @@ -14,8 +14,14 @@ namespace TW::TheOpenNetwork { Data Signer::createTransferMessage(std::shared_ptr wallet, const PrivateKey& privateKey, const Proto::Transfer& transfer) { + return createTransferMessage(wallet, privateKey, transfer, nullptr); +} + +// TANGEM +Data Signer::createTransferMessage(std::shared_ptr wallet, const PrivateKey& privateKey, const Proto::Transfer& transfer, const std::function externalSigner) { const auto msg = wallet->createTransferMessage( privateKey, + externalSigner, Address(transfer.dest()), transfer.amount(), transfer.sequence_number(), @@ -30,6 +36,11 @@ Data Signer::createTransferMessage(std::shared_ptr wallet, const Private } Proto::SigningOutput Signer::sign(const Proto::SigningInput &input) noexcept { + return Signer::sign(input, nullptr); +} + +// TANGEM +Proto::SigningOutput Signer::sign(const Proto::SigningInput& input, const std::function externalSigner) noexcept { const auto& privateKey = PrivateKey(input.private_key()); const auto& publicKey = privateKey.getPublicKey(TWPublicKeyTypeED25519); @@ -44,7 +55,7 @@ Proto::SigningOutput Signer::sign(const Proto::SigningInput &input) noexcept { case Proto::WalletVersion::WALLET_V4_R2: { const int8_t workchainId = WorkchainType::Basechain; auto wallet = std::make_shared(publicKey, workchainId); - const auto& transferMessage = Signer::createTransferMessage(wallet, privateKey, transfer); + const auto& transferMessage = Signer::createTransferMessage(wallet, privateKey, transfer, externalSigner); protoOutput.set_encoded(TW::Base64::encode(transferMessage)); break; } diff --git a/src/TheOpenNetwork/Signer.h b/src/TheOpenNetwork/Signer.h index 2ca74fa7cb8..92b4169a1ac 100644 --- a/src/TheOpenNetwork/Signer.h +++ b/src/TheOpenNetwork/Signer.h @@ -22,9 +22,15 @@ class Signer { /// Creates a signed transfer message static Data createTransferMessage(std::shared_ptr wallet, const PrivateKey& privateKey, const Proto::Transfer& transfer); + + // TANGEM + static Data createTransferMessage(std::shared_ptr wallet, const PrivateKey& privateKey, const Proto::Transfer& transfer, const std::function externalSigner); /// Signs a Proto::SigningInput transaction static Proto::SigningOutput sign(const Proto::SigningInput& input) noexcept; + + // TANGEM + static Proto::SigningOutput sign(const Proto::SigningInput& input, const std::function externalSigner) noexcept; }; } // namespace TW::TheOpenNetwork diff --git a/src/TheOpenNetwork/wallet/Wallet.cpp b/src/TheOpenNetwork/wallet/Wallet.cpp index 8a381ecf8a3..521bfab2f7c 100644 --- a/src/TheOpenNetwork/wallet/Wallet.cpp +++ b/src/TheOpenNetwork/wallet/Wallet.cpp @@ -4,6 +4,8 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. +#include + #include "Wallet.h" #include "HexCoding.h" @@ -68,6 +70,28 @@ Cell::Ref Wallet::createTransferMessage( uint8_t mode, uint32_t expireAt, const std::string& comment +) const { + return createTransferMessage( + privateKey, + nullptr, + dest, + amount, + sequence_number, + mode, + expireAt, + comment + ); +} + +Cell::Ref Wallet::createTransferMessage( + const PrivateKey& privateKey, + const std::function externalSigner, + const Address& dest, + uint64_t amount, + uint32_t sequence_number, + uint8_t mode, + uint32_t expireAt, + const std::string& comment ) const { const auto transferMessageHeader = std::make_shared(this->getAddress().addressData); Message transferMessage = Message(MessageData(transferMessageHeader)); @@ -80,7 +104,14 @@ Cell::Ref Wallet::createTransferMessage( CellBuilder bodyBuilder; const Cell::Ref signingMessage = this->createSigningMessage(dest, amount, sequence_number, mode, expireAt, comment); Data data(signingMessage->hash.begin(), signingMessage->hash.end()); - const auto signature = privateKey.sign(data, TWCurveED25519); + + auto signature = Data(); + if(externalSigner) { + std::future signedDataFuture = std::async(externalSigner, data); + signature = signedDataFuture.get(); + } else { + signature = privateKey.sign(data, TWCurveED25519); + } bodyBuilder.appendRaw(signature, static_cast(signature.size()) * 8); bodyBuilder.appendCellSlice(CellSlice(signingMessage.get())); diff --git a/src/TheOpenNetwork/wallet/Wallet.h b/src/TheOpenNetwork/wallet/Wallet.h index 8e081363957..eb7db53de6d 100644 --- a/src/TheOpenNetwork/wallet/Wallet.h +++ b/src/TheOpenNetwork/wallet/Wallet.h @@ -39,6 +39,17 @@ class Wallet { uint32_t expireAt = 0, const std::string& comment = "" ) const; + // TANGEM + [[nodiscard]] Cell::Ref createTransferMessage( + const PrivateKey& privateKey, + const std::function externalSigner, + const Address& dest, + uint64_t amount, + uint32_t sequence_number, + uint8_t mode, + uint32_t expireAt = 0, + const std::string& comment = "" + ) const; protected: [[nodiscard]] virtual Cell::Ref createDataCell() const = 0; From dcd1a041350cdf483bd8f3cf021678e0f53cdd35 Mon Sep 17 00:00:00 2001 From: Andrey Chukavin Date: Tue, 7 Feb 2023 13:42:13 +0200 Subject: [PATCH 07/20] IOS-2948 Passing external signer's publicKey to the signing function --- include/TrustWalletCore/TWAnySigner.h | 2 +- src/Coin.cpp | 4 ++-- src/Coin.h | 2 +- src/CoinEntry.h | 6 +++--- src/TheOpenNetwork/Entry.cpp | 4 ++-- src/TheOpenNetwork/Entry.h | 2 +- src/TheOpenNetwork/Signer.cpp | 10 ++++++---- src/TheOpenNetwork/Signer.h | 2 +- src/Tron/Entry.cpp | 4 ++-- src/Tron/Entry.h | 2 +- src/Tron/Signer.cpp | 4 ++-- src/Tron/Signer.h | 2 +- src/interface/TWAnySigner.cpp | 6 ++++-- swift/Sources/AnySigner.swift | 11 +++++++---- swift/Tests/Blockchains/TheOpenNetworkTests.swift | 13 ++++++++++++- swift/Tests/Blockchains/TronTests.swift | 2 +- 16 files changed, 47 insertions(+), 29 deletions(-) diff --git a/include/TrustWalletCore/TWAnySigner.h b/include/TrustWalletCore/TWAnySigner.h index 196626267a7..36ac661b458 100644 --- a/include/TrustWalletCore/TWAnySigner.h +++ b/include/TrustWalletCore/TWAnySigner.h @@ -23,7 +23,7 @@ struct TWAnySigner; extern TWData *_Nonnull TWAnySignerSign(TWData *_Nonnull input, enum TWCoinType coin); // TANGEM -extern TWData *_Nonnull TWAnySignerSignExternally(TWData *_Nonnull input, enum TWCoinType coin, TWData *_Nonnull (*_Nonnull externalSigner)(TWData *_Nonnull)); +extern TWData *_Nonnull TWAnySignerSignExternally(TWData *_Nonnull input, enum TWCoinType coin, TWData *_Nonnull publicKey, TWData *_Nonnull (*_Nonnull externalSigner)(TWData *_Nonnull)); /// Signs a transaction specified by the JSON representation of signing input, coin type and a private key, returning the JSON representation of the signing output. /// diff --git a/src/Coin.cpp b/src/Coin.cpp index df06af1b155..a2a69a9f9c4 100644 --- a/src/Coin.cpp +++ b/src/Coin.cpp @@ -265,10 +265,10 @@ void TW::anyCoinSign(TWCoinType coinType, const Data& dataIn, Data& dataOut) { } // TANGEM -void TW::anyCoinSignExternally(TWCoinType coinType, const Data& dataIn, Data& dataOut, std::function externalSigner) { +void TW::anyCoinSignExternally(TWCoinType coinType, const Data& dataIn, Data& dataOut, const Data& publicKey, std::function externalSigner) { auto* dispatcher = coinDispatcher(coinType); assert(dispatcher != nullptr); - dispatcher->signExternally(coinType, dataIn, dataOut, externalSigner); + dispatcher->signExternally(coinType, dataIn, dataOut, publicKey, externalSigner); } std::string TW::anySignJSON(TWCoinType coinType, const std::string& json, const Data& key) { diff --git a/src/Coin.h b/src/Coin.h index 0a065ad3059..5836f5e1376 100644 --- a/src/Coin.h +++ b/src/Coin.h @@ -115,7 +115,7 @@ const char* chainId(TWCoinType coin); void anyCoinSign(TWCoinType coinType, const Data& dataIn, Data& dataOut); // TANGEM -void anyCoinSignExternally(TWCoinType coinType, const Data& dataIn, Data& dataOut, const std::function externalSigner); +void anyCoinSignExternally(TWCoinType coinType, const Data& dataIn, Data& dataOut, const Data& publicKey, const std::function externalSigner); uint32_t slip44Id(TWCoinType coin); diff --git a/src/CoinEntry.h b/src/CoinEntry.h index 0c7e0083770..0fa6522621f 100644 --- a/src/CoinEntry.h +++ b/src/CoinEntry.h @@ -50,7 +50,7 @@ class CoinEntry { // Signing virtual void sign(TWCoinType coin, const Data& dataIn, Data& dataOut) const = 0; // TANGEM - virtual void signExternally(TWCoinType coin, const Data& dataIn, Data& dataOut, std::function externalSigner) const { } + virtual void signExternally(TWCoinType coin, const Data& dataIn, Data& dataOut, const Data& publicKey, std::function externalSigner) const { } virtual bool supportsJSONSigning() const { return false; } // It is optional, Signing JSON input with private key virtual std::string signJSON([[maybe_unused]] TWCoinType coin, [[maybe_unused]] const std::string& json, [[maybe_unused]] const Data& key) const { return ""; } @@ -83,10 +83,10 @@ void signTemplate(const Data& dataIn, Data& dataOut) { // TANGEM template -void signTemplateExternally(const Data& dataIn, Data& dataOut, const std::function externalSigner) { +void signTemplateExternally(const Data& dataIn, Data& dataOut, const Data& publicKey, const std::function externalSigner) { auto input = Input(); input.ParseFromArray(dataIn.data(), (int)dataIn.size()); - auto serializedOut = Signer::sign(input, externalSigner).SerializeAsString(); + auto serializedOut = Signer::sign(input, publicKey, externalSigner).SerializeAsString(); dataOut.insert(dataOut.end(), serializedOut.begin(), serializedOut.end()); } diff --git a/src/TheOpenNetwork/Entry.cpp b/src/TheOpenNetwork/Entry.cpp index 109c39120ad..53562de7606 100644 --- a/src/TheOpenNetwork/Entry.cpp +++ b/src/TheOpenNetwork/Entry.cpp @@ -31,8 +31,8 @@ void Entry::sign([[maybe_unused]] TWCoinType coin, const TW::Data& dataIn, TW::D } // TANGEM -void Entry::signExternally([[maybe_unused]] TWCoinType coin, const TW::Data& dataIn, TW::Data& dataOut, const std::function externalSigner) const { - signTemplateExternally(dataIn, dataOut, externalSigner); +void Entry::signExternally([[maybe_unused]] TWCoinType coin, const TW::Data& dataIn, TW::Data& dataOut, const Data& publicKey, const std::function externalSigner) const { + signTemplateExternally(dataIn, dataOut, publicKey, externalSigner); } } // namespace TW::TheOpenNetwork diff --git a/src/TheOpenNetwork/Entry.h b/src/TheOpenNetwork/Entry.h index fcc10ea3b16..e226df52924 100644 --- a/src/TheOpenNetwork/Entry.h +++ b/src/TheOpenNetwork/Entry.h @@ -17,7 +17,7 @@ class Entry final : public CoinEntry { std::string deriveAddress(TWCoinType coin, const PublicKey& publicKey, TWDerivation derivation, const PrefixVariant& addressPrefix) const; void sign(TWCoinType coin, const Data& dataIn, Data& dataOut) const; // TANGEM - void signExternally(TWCoinType coin, const Data& dataIn, Data& dataOut, const std::function externalSigner) const; + void signExternally(TWCoinType coin, const Data& dataIn, Data& dataOut, const Data& publicKey, const std::function externalSigner) const; }; } // namespace TW::TheOpenNetwork diff --git a/src/TheOpenNetwork/Signer.cpp b/src/TheOpenNetwork/Signer.cpp index 508a1956f2f..c492c82a919 100644 --- a/src/TheOpenNetwork/Signer.cpp +++ b/src/TheOpenNetwork/Signer.cpp @@ -36,14 +36,16 @@ Data Signer::createTransferMessage(std::shared_ptr wallet, const Private } Proto::SigningOutput Signer::sign(const Proto::SigningInput &input) noexcept { - return Signer::sign(input, nullptr); + const auto& privateKey = PrivateKey(input.private_key()); + const auto& publicKey = privateKey.getPublicKey(TWPublicKeyTypeED25519); + return Signer::sign(input, publicKey.bytes, nullptr); } // TANGEM -Proto::SigningOutput Signer::sign(const Proto::SigningInput& input, const std::function externalSigner) noexcept { +Proto::SigningOutput Signer::sign(const Proto::SigningInput& input, const Data& publicKeyData, const std::function externalSigner) noexcept { const auto& privateKey = PrivateKey(input.private_key()); - const auto& publicKey = privateKey.getPublicKey(TWPublicKeyTypeED25519); - + const PublicKey publicKey(publicKeyData, TWPublicKeyTypeED25519); + auto protoOutput = Proto::SigningOutput(); switch (input.action_oneof_case()) { diff --git a/src/TheOpenNetwork/Signer.h b/src/TheOpenNetwork/Signer.h index 92b4169a1ac..3facbc05d18 100644 --- a/src/TheOpenNetwork/Signer.h +++ b/src/TheOpenNetwork/Signer.h @@ -30,7 +30,7 @@ class Signer { static Proto::SigningOutput sign(const Proto::SigningInput& input) noexcept; // TANGEM - static Proto::SigningOutput sign(const Proto::SigningInput& input, const std::function externalSigner) noexcept; + static Proto::SigningOutput sign(const Proto::SigningInput& input, const Data& publicKey, const std::function externalSigner) noexcept; }; } // namespace TW::TheOpenNetwork diff --git a/src/Tron/Entry.cpp b/src/Tron/Entry.cpp index 645c4873133..239b431e0a4 100644 --- a/src/Tron/Entry.cpp +++ b/src/Tron/Entry.cpp @@ -27,8 +27,8 @@ void Entry::sign([[maybe_unused]] TWCoinType coin, const TW::Data& dataIn, TW::D } // TANGEM -void Entry::signExternally([[maybe_unused]] TWCoinType coin, const TW::Data& dataIn, TW::Data& dataOut, const std::function externalSigner) const { - signTemplateExternally(dataIn, dataOut, externalSigner); +void Entry::signExternally([[maybe_unused]] TWCoinType coin, const TW::Data& dataIn, TW::Data& dataOut, const Data& publicKey, const std::function externalSigner) const { + signTemplateExternally(dataIn, dataOut, publicKey, externalSigner); } } // namespace TW::Tron diff --git a/src/Tron/Entry.h b/src/Tron/Entry.h index cf47ec9b1ad..73a432444b4 100644 --- a/src/Tron/Entry.h +++ b/src/Tron/Entry.h @@ -18,7 +18,7 @@ class Entry final : public CoinEntry { std::string deriveAddress(TWCoinType coin, const PublicKey& publicKey, TWDerivation derivation, const PrefixVariant& addressPrefix) const; void sign(TWCoinType coin, const Data& dataIn, Data& dataOut) const; // TANGEM - void signExternally(TWCoinType coin, const TW::Data& dataIn, TW::Data& dataOut, const std::function externalSigner) const; + void signExternally(TWCoinType coin, const TW::Data& dataIn, TW::Data& dataOut, const Data& publicKey, const std::function externalSigner) const; }; } // namespace TW::Tron diff --git a/src/Tron/Signer.cpp b/src/Tron/Signer.cpp index 0e74698a408..2e767c20908 100644 --- a/src/Tron/Signer.cpp +++ b/src/Tron/Signer.cpp @@ -203,11 +203,11 @@ void setBlockReference(const Proto::Transaction& transaction, protocol::Transact } Proto::SigningOutput Signer::sign(const Proto::SigningInput& input) noexcept { - return Signer::sign(input, nullptr); + return Signer::sign(input, Data(), nullptr); } // TANGEM -Proto::SigningOutput Signer::sign(const Proto::SigningInput& input, const std::function externalSigner) noexcept { +Proto::SigningOutput Signer::sign(const Proto::SigningInput& input, const Data& publicKey, const std::function externalSigner) noexcept { auto internal = protocol::Transaction(); auto output = Proto::SigningOutput(); diff --git a/src/Tron/Signer.h b/src/Tron/Signer.h index 0fe1ddd0577..2663c8478ca 100644 --- a/src/Tron/Signer.h +++ b/src/Tron/Signer.h @@ -21,7 +21,7 @@ class Signer { static Proto::SigningOutput sign(const Proto::SigningInput& input) noexcept; // TANGEM - static Proto::SigningOutput sign(const Proto::SigningInput& input, const std::function externalSigner) noexcept; + static Proto::SigningOutput sign(const Proto::SigningInput& input, const Data& publicKey, const std::function externalSigner) noexcept; }; } // namespace TW::Tron diff --git a/src/interface/TWAnySigner.cpp b/src/interface/TWAnySigner.cpp index f04ca9956e1..3bc91549578 100644 --- a/src/interface/TWAnySigner.cpp +++ b/src/interface/TWAnySigner.cpp @@ -18,7 +18,7 @@ TWData* _Nonnull TWAnySignerSign(TWData* _Nonnull data, enum TWCoinType coin) { } // TANGEM -TWData* _Nonnull TWAnySignerSignExternally(TWData* _Nonnull data, enum TWCoinType coin, TWData* (*externalSigner)(TWData*)) { +TWData* _Nonnull TWAnySignerSignExternally(TWData* _Nonnull data, enum TWCoinType coin, TWData *_Nonnull publicKey, TWData* (*externalSigner)(TWData*)) { // Just a conversion between TWData and TW::Data auto dataExternalSigner = [externalSigner](Data dataToSign) -> Data { const TWData* twDataToSign = TWDataCreateWithBytes(dataToSign.data(), dataToSign.size()); @@ -27,10 +27,12 @@ TWData* _Nonnull TWAnySignerSignExternally(TWData* _Nonnull data, enum TWCoinTyp const Data& dataSigned = *(reinterpret_cast(twDataSigned)); return dataSigned; }; + + const Data& publicKeyData = *(reinterpret_cast(publicKey)); const Data& dataIn = *(reinterpret_cast(data)); Data dataOut; - TW::anyCoinSignExternally(coin, dataIn, dataOut, dataExternalSigner); + TW::anyCoinSignExternally(coin, dataIn, dataOut, publicKeyData, dataExternalSigner); return TWDataCreateWithBytes(dataOut.data(), dataOut.size()); } diff --git a/swift/Sources/AnySigner.swift b/swift/Sources/AnySigner.swift index 5ac3b521f89..bd04dd2a3ad 100644 --- a/swift/Sources/AnySigner.swift +++ b/swift/Sources/AnySigner.swift @@ -61,7 +61,7 @@ public final class AnySigner { } // TANGEM - public static func signExternally(input: SigningInput, coin: CoinType, signer: Signer) -> SigningOutput { + public static func signExternally(input: SigningInput, coin: CoinType, publicKey: Data, signer: Signer) -> SigningOutput { defer { externalSigner = nil } @@ -69,7 +69,7 @@ public final class AnySigner { externalSigner = signer do { - let outputData = nativeSignExternally(data: try input.serializedData(), coin: coin) + let outputData = nativeSignExternally(data: try input.serializedData(), coin: coin, publicKey: publicKey) return try SigningOutput(serializedData: outputData) } catch let error { fatalError(error.localizedDescription) @@ -91,13 +91,16 @@ public final class AnySigner { } // TANGEM - public static func nativeSignExternally(data: Data, coin: CoinType) -> Data { + public static func nativeSignExternally(data: Data, coin: CoinType, publicKey: Data) -> Data { let inputData = TWDataCreateWithNSData(data) + let publicKeyData = TWDataCreateWithNSData(publicKey) + defer { TWDataDelete(inputData) + TWDataDelete(publicKeyData) } - return TWDataNSData(TWAnySignerSignExternally(inputData, TWCoinType(rawValue: coin.rawValue), { twDataToSign in + return TWDataNSData(TWAnySignerSignExternally(inputData, TWCoinType(rawValue: coin.rawValue), publicKeyData, { twDataToSign in guard let externalSigner = externalSigner else { fatalError("You must set external signer to sign asynchronously") } diff --git a/swift/Tests/Blockchains/TheOpenNetworkTests.swift b/swift/Tests/Blockchains/TheOpenNetworkTests.swift index 506d007fb9d..b4ee97e7c41 100644 --- a/swift/Tests/Blockchains/TheOpenNetworkTests.swift +++ b/swift/Tests/Blockchains/TheOpenNetworkTests.swift @@ -47,7 +47,7 @@ class TheOpenNetworkTests: XCTestCase { $0.expireAt = 1671132440 } - let input = TheOpenNetworkSigningInput.with { + var input = TheOpenNetworkSigningInput.with { $0.transfer = transfer $0.privateKey = privateKeyData } @@ -58,5 +58,16 @@ class TheOpenNetworkTests: XCTestCase { let expectedString = "te6ccgICAAQAAQAAALAAAAFFiAGwt/q8k4SrjbFbQCjJZfQr64ExRxcUMsWqaQODqTUijgwAAQGcEUPkil2aZ4s8KKparSep/OKHMC8vuXafFbW2HGp/9AcTRv0J5T4dwyW1G0JpHw+g5Ov6QI3Xo0O9RFr3KidICimpoxdjm3UYAAAABgADAAIBYmIAM33x4uAd+uQTyXyCZPxflESlNVHpCeoOECtNsqVW9tmIUAAAAAAAAAAAAAAAAAEAAwAA" XCTAssertEqual(output.encoded, expectedString) + + // TANGEM + let privateKey = PrivateKey(data: input.privateKey)! + let publicKey = privateKey.getPublicKey(coinType: .ton).data + let signer = PrivateKeySigner(privateKey: privateKey, coin: .ton) + + input.privateKey = Data(repeating: 1, count: 32) + + let outputExternal: TheOpenNetworkSigningOutput = AnySigner.signExternally(input: input, coin: .ton, publicKey: publicKey, signer: signer) + + XCTAssertEqual(outputExternal.encoded, expectedString) } } diff --git a/swift/Tests/Blockchains/TronTests.swift b/swift/Tests/Blockchains/TronTests.swift index f69e414ab29..2735becc7a2 100644 --- a/swift/Tests/Blockchains/TronTests.swift +++ b/swift/Tests/Blockchains/TronTests.swift @@ -49,7 +49,7 @@ class TronTests: XCTestCase { coin: .tron ) - let output: TronSigningOutput = AnySigner.signExternally(input: input, coin: .tron, signer: signer) + let output: TronSigningOutput = AnySigner.signExternally(input: input, coin: .tron, publicKey: signer.privateKey.getPublicKey(coinType: .tron).data, signer: signer) print("") print("") From 15f5a11701cf54fad49368d3af54197f372cf7de Mon Sep 17 00:00:00 2001 From: Andrey Chukavin Date: Tue, 7 Feb 2023 13:47:55 +0200 Subject: [PATCH 08/20] IOS-2948 Making ExternalSigner provide public key --- swift/Sources/AnySigner.swift | 11 +++++++++-- swift/Tests/Blockchains/TheOpenNetworkTests.swift | 6 ++---- swift/Tests/Blockchains/TronTests.swift | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/swift/Sources/AnySigner.swift b/swift/Sources/AnySigner.swift index bd04dd2a3ad..b0873f50f1c 100644 --- a/swift/Sources/AnySigner.swift +++ b/swift/Sources/AnySigner.swift @@ -14,6 +14,8 @@ public typealias SigningOutput = Message public protocol Signer { var error: Error? { get } + var publicKey: Data { get } + func sign(_ data: Data) -> Data func sign(_ data: [Data]) -> [Data] } @@ -25,6 +27,11 @@ public struct PrivateKeySigner: Signer { public let privateKey: PrivateKey public let coin: CoinType + + public var publicKey: Data { + privateKey.getPublicKey(coinType: coin).data + } + public init(privateKey: PrivateKey, coin: CoinType) { self.privateKey = privateKey self.coin = coin @@ -61,7 +68,7 @@ public final class AnySigner { } // TANGEM - public static func signExternally(input: SigningInput, coin: CoinType, publicKey: Data, signer: Signer) -> SigningOutput { + public static func signExternally(input: SigningInput, coin: CoinType, signer: Signer) -> SigningOutput { defer { externalSigner = nil } @@ -69,7 +76,7 @@ public final class AnySigner { externalSigner = signer do { - let outputData = nativeSignExternally(data: try input.serializedData(), coin: coin, publicKey: publicKey) + let outputData = nativeSignExternally(data: try input.serializedData(), coin: coin, publicKey: signer.publicKey) return try SigningOutput(serializedData: outputData) } catch let error { fatalError(error.localizedDescription) diff --git a/swift/Tests/Blockchains/TheOpenNetworkTests.swift b/swift/Tests/Blockchains/TheOpenNetworkTests.swift index b4ee97e7c41..268ee67bdac 100644 --- a/swift/Tests/Blockchains/TheOpenNetworkTests.swift +++ b/swift/Tests/Blockchains/TheOpenNetworkTests.swift @@ -60,13 +60,11 @@ class TheOpenNetworkTests: XCTestCase { XCTAssertEqual(output.encoded, expectedString) // TANGEM - let privateKey = PrivateKey(data: input.privateKey)! - let publicKey = privateKey.getPublicKey(coinType: .ton).data - let signer = PrivateKeySigner(privateKey: privateKey, coin: .ton) + let signer = PrivateKeySigner(privateKey: PrivateKey(data: input.privateKey)!, coin: .ton) input.privateKey = Data(repeating: 1, count: 32) - let outputExternal: TheOpenNetworkSigningOutput = AnySigner.signExternally(input: input, coin: .ton, publicKey: publicKey, signer: signer) + let outputExternal: TheOpenNetworkSigningOutput = AnySigner.signExternally(input: input, coin: .ton, signer: signer) XCTAssertEqual(outputExternal.encoded, expectedString) } diff --git a/swift/Tests/Blockchains/TronTests.swift b/swift/Tests/Blockchains/TronTests.swift index 2735becc7a2..f69e414ab29 100644 --- a/swift/Tests/Blockchains/TronTests.swift +++ b/swift/Tests/Blockchains/TronTests.swift @@ -49,7 +49,7 @@ class TronTests: XCTestCase { coin: .tron ) - let output: TronSigningOutput = AnySigner.signExternally(input: input, coin: .tron, publicKey: signer.privateKey.getPublicKey(coinType: .tron).data, signer: signer) + let output: TronSigningOutput = AnySigner.signExternally(input: input, coin: .tron, signer: signer) print("") print("") From ea9dc472ef9f1e2a453dd7e51482a46d02b11637 Mon Sep 17 00:00:00 2001 From: Andrey Chukavin Date: Tue, 7 Feb 2023 13:51:50 +0200 Subject: [PATCH 09/20] IOS-2948 Made external signer tests co-exist with standard ones --- .../Blockchains/TheOpenNetworkTests.swift | 4 +-- swift/Tests/Blockchains/TronTests.swift | 27 +++++++------------ 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/swift/Tests/Blockchains/TheOpenNetworkTests.swift b/swift/Tests/Blockchains/TheOpenNetworkTests.swift index 268ee67bdac..805db266195 100644 --- a/swift/Tests/Blockchains/TheOpenNetworkTests.swift +++ b/swift/Tests/Blockchains/TheOpenNetworkTests.swift @@ -61,11 +61,9 @@ class TheOpenNetworkTests: XCTestCase { // TANGEM let signer = PrivateKeySigner(privateKey: PrivateKey(data: input.privateKey)!, coin: .ton) - input.privateKey = Data(repeating: 1, count: 32) - let outputExternal: TheOpenNetworkSigningOutput = AnySigner.signExternally(input: input, coin: .ton, signer: signer) - + XCTAssertEqual(outputExternal.encoded, expectedString) } } diff --git a/swift/Tests/Blockchains/TronTests.swift b/swift/Tests/Blockchains/TronTests.swift index f69e414ab29..c103da52b21 100644 --- a/swift/Tests/Blockchains/TronTests.swift +++ b/swift/Tests/Blockchains/TronTests.swift @@ -21,7 +21,7 @@ class TronTests: XCTestCase { $0.amount = 2000000 } - let input = TronSigningInput.with { + var input = TronSigningInput.with { $0.transaction = TronTransaction.with { $0.contractOneof = .transfer(contract) $0.timestamp = 1539295479000 @@ -38,23 +38,7 @@ class TronTests: XCTestCase { $0.privateKey = Data(hexString: "ba005cd605d8a02e3d5dfd04234cef3a3ee4f76bfbad2722d1fb5af8e12e6764")! } - print("") - print("") - print("") - -// let output: TronSigningOutput = AnySigner.sign(input: input, coin: .tron) - - let signer = PrivateKeySigner( - privateKey: PrivateKey(data: input.privateKey)!, - coin: .tron - ) - - let output: TronSigningOutput = AnySigner.signExternally(input: input, coin: .tron, signer: signer) - - print("") - print("") - print("") - + let output: TronSigningOutput = AnySigner.sign(input: input, coin: .tron) let expectedJSON = """ { @@ -80,5 +64,12 @@ class TronTests: XCTestCase { } """ XCTAssertJSONEqual(output.json, expectedJSON) + + // TANGEM + let signer = PrivateKeySigner(privateKey: PrivateKey(data: input.privateKey)!, coin: .tron) + input.privateKey = Data(repeating: 1, count: 32) + let outputExternal: TronSigningOutput = AnySigner.signExternally(input: input, coin: .tron, signer: signer) + + XCTAssertJSONEqual(outputExternal.json, expectedJSON) } } From 45375aaab42b3f7f9426e7970b68c136a028633d Mon Sep 17 00:00:00 2001 From: Andrey Chukavin Date: Tue, 7 Feb 2023 13:54:35 +0200 Subject: [PATCH 10/20] IOS-2948 Refactoring --- swift/Sources/AnySigner.swift | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/swift/Sources/AnySigner.swift b/swift/Sources/AnySigner.swift index b0873f50f1c..65c77d60e63 100644 --- a/swift/Sources/AnySigner.swift +++ b/swift/Sources/AnySigner.swift @@ -24,14 +24,13 @@ public protocol Signer { public struct PrivateKeySigner: Signer { public var error: Error? - public let privateKey: PrivateKey - public let coin: CoinType - - public var publicKey: Data { privateKey.getPublicKey(coinType: coin).data } + private let privateKey: PrivateKey + private let coin: CoinType + public init(privateKey: PrivateKey, coin: CoinType) { self.privateKey = privateKey self.coin = coin From 4c81b5706d241acd98f455d88cab7e16ba0918d9 Mon Sep 17 00:00:00 2001 From: Andrey Chukavin Date: Tue, 7 Feb 2023 13:54:55 +0200 Subject: [PATCH 11/20] IOS-2948 Refactoring --- src/Tron/Signer.cpp | 12 +----------- swift/Sources/AnySigner.swift | 12 ++---------- swift/Tests/Blockchains/TronTests.swift | 1 - 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/src/Tron/Signer.cpp b/src/Tron/Signer.cpp index 2e767c20908..35fb40404ed 100644 --- a/src/Tron/Signer.cpp +++ b/src/Tron/Signer.cpp @@ -320,18 +320,8 @@ Proto::SigningOutput Signer::sign(const Proto::SigningInput& input, const Data& // TANGEM if(externalSigner) { - // TODO: remove debug output - std::cout << "Data to sign in C++" << std::endl; - std::cout << hex(hash) << std::endl; - std::future signedDataFuture = std::async(externalSigner, hash); - - const Data signedData = signedDataFuture.get(); - signature = signedData; - - // TODO: remove debug output - std::cout << "Signed data in C++" << std::endl; - std::cout << hex(signedData) << std::endl; + signature = signedDataFuture.get(); } else { signature = key.sign(hash, TWCurveSECP256k1); } diff --git a/swift/Sources/AnySigner.swift b/swift/Sources/AnySigner.swift index 65c77d60e63..0c0da53d5e9 100644 --- a/swift/Sources/AnySigner.swift +++ b/swift/Sources/AnySigner.swift @@ -37,7 +37,7 @@ public struct PrivateKeySigner: Signer { } public func sign(_ data: Data) -> Data { - privateKey.sign(digest: data, curve: coin.curve)! + return privateKey.sign(digest: data, curve: coin.curve)! } public func sign(_ data: [Data]) -> [Data] { @@ -46,6 +46,7 @@ public struct PrivateKeySigner: Signer { } // TANGEM +// We can't capture a local variable in a closure we're passing to std::function. Global variables are fine. var externalSigner: Signer? = nil /// Represents a signer to sign transactions for any blockchain. @@ -112,16 +113,7 @@ public final class AnySigner { } let dataToSign = TWDataNSData(twDataToSign) - - // TODO: remove debug output - print("Data to sign in swift") - print(dataToSign.hexString) - let dataSigned = externalSigner.sign(dataToSign) - - print("Signed data in swift") - print(dataSigned.hexString) - return TWDataCreateWithNSData(dataSigned) })) } diff --git a/swift/Tests/Blockchains/TronTests.swift b/swift/Tests/Blockchains/TronTests.swift index c103da52b21..587eb340570 100644 --- a/swift/Tests/Blockchains/TronTests.swift +++ b/swift/Tests/Blockchains/TronTests.swift @@ -39,7 +39,6 @@ class TronTests: XCTestCase { } let output: TronSigningOutput = AnySigner.sign(input: input, coin: .tron) - let expectedJSON = """ { "raw_data": { From 8aa0910ac481231786e145cd4e45f5c1bd5082ca Mon Sep 17 00:00:00 2001 From: Andrey Chukavin Date: Tue, 7 Feb 2023 16:12:54 +0200 Subject: [PATCH 12/20] IOS-2948 Added private key signer clarification --- swift/Sources/AnySigner.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/swift/Sources/AnySigner.swift b/swift/Sources/AnySigner.swift index 0c0da53d5e9..7ff587a807f 100644 --- a/swift/Sources/AnySigner.swift +++ b/swift/Sources/AnySigner.swift @@ -21,6 +21,7 @@ public protocol Signer { } // TANGEM +// For auto tests only public struct PrivateKeySigner: Signer { public var error: Error? From 5396fe078ebeffb8d7e4e7502d2ea118024208c8 Mon Sep 17 00:00:00 2001 From: Andrey Chukavin Date: Wed, 8 Feb 2023 15:01:00 +0200 Subject: [PATCH 13/20] IOS-2948 Resolving name conflicts: made Data(hexString:) and Data.hexString internal, added testable import for WalletCore in tests. --- swift/Sources/Extensions/Data+Hex.swift | 4 ++-- swift/Tests/AESTests.swift | 2 +- swift/Tests/Addresses/BitcoinAddressTests.swift | 2 +- swift/Tests/Addresses/JunoAddressTests.swift | 2 +- swift/Tests/Addresses/NEOAddressTests.swift | 2 +- swift/Tests/Addresses/OntologyAddressTests.swift | 2 +- swift/Tests/Addresses/TronAddressTests.swift | 2 +- swift/Tests/AnyAddressTests.swift | 2 +- swift/Tests/Base32Tests.swift | 2 +- swift/Tests/Base64Tests.swift | 2 +- swift/Tests/Blockchains/AeternityTests.swift | 2 +- swift/Tests/Blockchains/AgoricTests.swift | 2 +- swift/Tests/Blockchains/AionTests.swift | 2 +- swift/Tests/Blockchains/AlgorandTests.swift | 2 +- swift/Tests/Blockchains/AptosTests.swift | 2 +- swift/Tests/Blockchains/AvalancheTests.swift | 2 +- swift/Tests/Blockchains/BandChainTests.swift | 2 +- swift/Tests/Blockchains/BinanceChainTests.swift | 2 +- swift/Tests/Blockchains/BinanceSmartChainTests.swift | 2 +- swift/Tests/Blockchains/BitcoinTests.swift | 2 +- swift/Tests/Blockchains/BitconCashTests.swift | 2 +- swift/Tests/Blockchains/BluzelleTests.swift | 2 +- swift/Tests/Blockchains/CardanoTests.swift | 2 +- swift/Tests/Blockchains/CeloTests.swift | 2 +- swift/Tests/Blockchains/CosmosTests.swift | 2 +- swift/Tests/Blockchains/CronosTests.swift | 2 +- swift/Tests/Blockchains/CryptoorgTests.swift | 2 +- swift/Tests/Blockchains/DashTests.swift | 2 +- swift/Tests/Blockchains/DecredTests.swift | 2 +- swift/Tests/Blockchains/DogeTests.swift | 2 +- swift/Tests/Blockchains/ECashTests.swift | 2 +- swift/Tests/Blockchains/EOSTests.swift | 2 +- swift/Tests/Blockchains/ElrondTests.swift | 2 +- swift/Tests/Blockchains/EthereumAbiTests.swift | 2 +- swift/Tests/Blockchains/EthereumTests.swift | 2 +- swift/Tests/Blockchains/EverscaleTests.swift | 2 +- swift/Tests/Blockchains/EvmosTests.swift | 2 +- swift/Tests/Blockchains/FIOTests.swift | 2 +- swift/Tests/Blockchains/FilecoinTests.swift | 2 +- swift/Tests/Blockchains/GroestlcoinTests.swift | 2 +- .../Tests/Blockchains/GroestlcoinTransactionSignerTests.swift | 2 +- swift/Tests/Blockchains/HarmonyTests.swift | 2 +- swift/Tests/Blockchains/HederaTests.swift | 2 +- swift/Tests/Blockchains/IconTests.swift | 2 +- swift/Tests/Blockchains/IoTeXTests.swift | 2 +- swift/Tests/Blockchains/KavaTests.swift | 2 +- swift/Tests/Blockchains/KinTests.swift | 2 +- swift/Tests/Blockchains/KuCoinCommunityChainTests.swift | 2 +- swift/Tests/Blockchains/KusamaTests.swift | 2 +- swift/Tests/Blockchains/LitecoinTests.swift | 2 +- swift/Tests/Blockchains/MonacoinTests.swift | 2 +- swift/Tests/Blockchains/NEARTests.swift | 2 +- swift/Tests/Blockchains/NEOTests.swift | 2 +- swift/Tests/Blockchains/NULSTests.swift | 2 +- swift/Tests/Blockchains/NanoTests.swift | 2 +- swift/Tests/Blockchains/NativeInjectiveTests.swift | 2 +- swift/Tests/Blockchains/NebulasTests.swift | 2 +- swift/Tests/Blockchains/NervosTests.swift | 2 +- swift/Tests/Blockchains/NimiqTests.swift | 2 +- swift/Tests/Blockchains/OasisTests.swift | 2 +- swift/Tests/Blockchains/OntologyTests.swift | 2 +- swift/Tests/Blockchains/OsmosisTests.swift | 2 +- swift/Tests/Blockchains/PolkadotTests.swift | 2 +- swift/Tests/Blockchains/PolygonTests.swift | 2 +- swift/Tests/Blockchains/QtumTests.swift | 2 +- swift/Tests/Blockchains/RippleTests.swift | 2 +- swift/Tests/Blockchains/RoninTests.swift | 2 +- swift/Tests/Blockchains/SecretTests.swift | 2 +- swift/Tests/Blockchains/SmartBitcoinCashTests.swift | 2 +- swift/Tests/Blockchains/SolanaTests.swift | 2 +- swift/Tests/Blockchains/StarkExTests.swift | 2 +- swift/Tests/Blockchains/StellarTests.swift | 2 +- swift/Tests/Blockchains/THORChainSwapTests.swift | 2 +- swift/Tests/Blockchains/THORChainTests.swift | 2 +- swift/Tests/Blockchains/TerraClassicTests.swift | 2 +- swift/Tests/Blockchains/TerraTests.swift | 2 +- swift/Tests/Blockchains/TezosTests.swift | 2 +- swift/Tests/Blockchains/TheOpenNetworkTests.swift | 2 +- swift/Tests/Blockchains/ThetaTests.swift | 2 +- swift/Tests/Blockchains/TronTests.swift | 2 +- swift/Tests/Blockchains/WanchainTests.swift | 2 +- swift/Tests/Blockchains/WavesTests.swift | 2 +- swift/Tests/Blockchains/ZcashTests.swift | 2 +- swift/Tests/Blockchains/ZcoinTests.swift | 2 +- swift/Tests/Blockchains/ZilliqaTests.swift | 2 +- swift/Tests/CoinAddressDerivationTests.swift | 2 +- swift/Tests/CoinTypeTests.swift | 2 +- swift/Tests/DataTests.swift | 2 +- swift/Tests/DerivationPathTests.swift | 2 +- swift/Tests/HDWalletTests.swift | 2 +- swift/Tests/HashTests.swift | 2 +- swift/Tests/Keystore/AccountTests.swift | 2 +- swift/Tests/Keystore/KeyStoreTests.swift | 2 +- swift/Tests/Keystore/KeystoreKeyTests.swift | 2 +- swift/Tests/Keystore/WalletTests.swift | 2 +- swift/Tests/MnemonicTests.swift | 2 +- swift/Tests/PBKDF2Tests.swift | 2 +- swift/Tests/PrivateKeyTests.swift | 2 +- swift/Tests/PublicKeyTests.swift | 2 +- swift/Tests/TransactionCompilerTests.swift | 2 +- swift/Tests/UniversalAssetIDTests.swift | 2 +- 101 files changed, 102 insertions(+), 102 deletions(-) diff --git a/swift/Sources/Extensions/Data+Hex.swift b/swift/Sources/Extensions/Data+Hex.swift index 3888716e089..6b1bca4a175 100644 --- a/swift/Sources/Extensions/Data+Hex.swift +++ b/swift/Sources/Extensions/Data+Hex.swift @@ -8,7 +8,7 @@ import Foundation extension Data { /// Initializes `Data` with a hex string representation. - public init?(hexString: String) { + init?(hexString: String) { let string: String if hexString.hasPrefix("0x") { string = String(hexString.dropFirst(2)) @@ -58,7 +58,7 @@ extension Data { } /// Returns the hex string representation of the data. - public var hexString: String { + var hexString: String { return map({ String(format: "%02x", $0) }).joined() } } diff --git a/swift/Tests/AESTests.swift b/swift/Tests/AESTests.swift index 868300617de..5155b6bedb4 100644 --- a/swift/Tests/AESTests.swift +++ b/swift/Tests/AESTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class AESTests: XCTestCase { func testDecrypt() throws { diff --git a/swift/Tests/Addresses/BitcoinAddressTests.swift b/swift/Tests/Addresses/BitcoinAddressTests.swift index 14341165f07..64b244e9b5d 100644 --- a/swift/Tests/Addresses/BitcoinAddressTests.swift +++ b/swift/Tests/Addresses/BitcoinAddressTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class BitcoinAddressTests: XCTestCase { diff --git a/swift/Tests/Addresses/JunoAddressTests.swift b/swift/Tests/Addresses/JunoAddressTests.swift index 02935c98c3a..caf6ae246ea 100644 --- a/swift/Tests/Addresses/JunoAddressTests.swift +++ b/swift/Tests/Addresses/JunoAddressTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class JunoAddressTests: XCTestCase { diff --git a/swift/Tests/Addresses/NEOAddressTests.swift b/swift/Tests/Addresses/NEOAddressTests.swift index 35c4b2ea57b..0f285cd7325 100644 --- a/swift/Tests/Addresses/NEOAddressTests.swift +++ b/swift/Tests/Addresses/NEOAddressTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class NEOAddressTests: XCTestCase { diff --git a/swift/Tests/Addresses/OntologyAddressTests.swift b/swift/Tests/Addresses/OntologyAddressTests.swift index 616aa19e309..b6813a2b9e3 100644 --- a/swift/Tests/Addresses/OntologyAddressTests.swift +++ b/swift/Tests/Addresses/OntologyAddressTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class OntologyAddressTests: XCTestCase { diff --git a/swift/Tests/Addresses/TronAddressTests.swift b/swift/Tests/Addresses/TronAddressTests.swift index c8d875a38d0..f7c714cfb9f 100644 --- a/swift/Tests/Addresses/TronAddressTests.swift +++ b/swift/Tests/Addresses/TronAddressTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class TronAddressTests: XCTestCase { diff --git a/swift/Tests/AnyAddressTests.swift b/swift/Tests/AnyAddressTests.swift index dc4f16da527..9d4386a6e74 100644 --- a/swift/Tests/AnyAddressTests.swift +++ b/swift/Tests/AnyAddressTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class AnyAddressTests: XCTestCase { diff --git a/swift/Tests/Base32Tests.swift b/swift/Tests/Base32Tests.swift index 41be00de149..db8b1aedd84 100644 --- a/swift/Tests/Base32Tests.swift +++ b/swift/Tests/Base32Tests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class Base32Tests: XCTestCase { func testEncode() { diff --git a/swift/Tests/Base64Tests.swift b/swift/Tests/Base64Tests.swift index b4fdc17c1cf..7ee2c9dfafd 100644 --- a/swift/Tests/Base64Tests.swift +++ b/swift/Tests/Base64Tests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class Base64Tests: XCTestCase { func testEncode() { diff --git a/swift/Tests/Blockchains/AeternityTests.swift b/swift/Tests/Blockchains/AeternityTests.swift index e92183f72ce..e905ad3e4e9 100644 --- a/swift/Tests/Blockchains/AeternityTests.swift +++ b/swift/Tests/Blockchains/AeternityTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class AeternityTests: XCTestCase { diff --git a/swift/Tests/Blockchains/AgoricTests.swift b/swift/Tests/Blockchains/AgoricTests.swift index 19404b3447b..aaff5ab8598 100644 --- a/swift/Tests/Blockchains/AgoricTests.swift +++ b/swift/Tests/Blockchains/AgoricTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class AgoricTests: XCTestCase { diff --git a/swift/Tests/Blockchains/AionTests.swift b/swift/Tests/Blockchains/AionTests.swift index c65188e041a..2564f6cf0f0 100644 --- a/swift/Tests/Blockchains/AionTests.swift +++ b/swift/Tests/Blockchains/AionTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class AionTests: XCTestCase { diff --git a/swift/Tests/Blockchains/AlgorandTests.swift b/swift/Tests/Blockchains/AlgorandTests.swift index 0df5b148700..b19eaeb81be 100644 --- a/swift/Tests/Blockchains/AlgorandTests.swift +++ b/swift/Tests/Blockchains/AlgorandTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class AlgorandTests: XCTestCase { diff --git a/swift/Tests/Blockchains/AptosTests.swift b/swift/Tests/Blockchains/AptosTests.swift index 66f4b33ae48..fd487cf5573 100644 --- a/swift/Tests/Blockchains/AptosTests.swift +++ b/swift/Tests/Blockchains/AptosTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class AptosTests: XCTestCase { diff --git a/swift/Tests/Blockchains/AvalancheTests.swift b/swift/Tests/Blockchains/AvalancheTests.swift index 6e7b1a81c1d..9097f6a6403 100644 --- a/swift/Tests/Blockchains/AvalancheTests.swift +++ b/swift/Tests/Blockchains/AvalancheTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class AvalancheTests: XCTestCase { diff --git a/swift/Tests/Blockchains/BandChainTests.swift b/swift/Tests/Blockchains/BandChainTests.swift index 03200907d37..857869bec34 100644 --- a/swift/Tests/Blockchains/BandChainTests.swift +++ b/swift/Tests/Blockchains/BandChainTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class BandChainTests: XCTestCase { diff --git a/swift/Tests/Blockchains/BinanceChainTests.swift b/swift/Tests/Blockchains/BinanceChainTests.swift index a1e0a021715..c18d56827a6 100644 --- a/swift/Tests/Blockchains/BinanceChainTests.swift +++ b/swift/Tests/Blockchains/BinanceChainTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class BinanceChainTests: XCTestCase { diff --git a/swift/Tests/Blockchains/BinanceSmartChainTests.swift b/swift/Tests/Blockchains/BinanceSmartChainTests.swift index 972c46c178e..0335c72ede9 100644 --- a/swift/Tests/Blockchains/BinanceSmartChainTests.swift +++ b/swift/Tests/Blockchains/BinanceSmartChainTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class BinanceSmartChainTests: XCTestCase { diff --git a/swift/Tests/Blockchains/BitcoinTests.swift b/swift/Tests/Blockchains/BitcoinTests.swift index 4ace92e08e5..6269fdfe667 100644 --- a/swift/Tests/Blockchains/BitcoinTests.swift +++ b/swift/Tests/Blockchains/BitcoinTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class BitcoinTransactionSignerTests: XCTestCase { override func setUp() { diff --git a/swift/Tests/Blockchains/BitconCashTests.swift b/swift/Tests/Blockchains/BitconCashTests.swift index c5cec4484d5..c288f08547a 100644 --- a/swift/Tests/Blockchains/BitconCashTests.swift +++ b/swift/Tests/Blockchains/BitconCashTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class BitcoinCashTests: XCTestCase { diff --git a/swift/Tests/Blockchains/BluzelleTests.swift b/swift/Tests/Blockchains/BluzelleTests.swift index fde2d9cc4a4..f8ebf9580e5 100644 --- a/swift/Tests/Blockchains/BluzelleTests.swift +++ b/swift/Tests/Blockchains/BluzelleTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class BluzelleAddressTests: XCTestCase { diff --git a/swift/Tests/Blockchains/CardanoTests.swift b/swift/Tests/Blockchains/CardanoTests.swift index 32561ab157d..f772f94ddbb 100644 --- a/swift/Tests/Blockchains/CardanoTests.swift +++ b/swift/Tests/Blockchains/CardanoTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class CardanoTests: XCTestCase { diff --git a/swift/Tests/Blockchains/CeloTests.swift b/swift/Tests/Blockchains/CeloTests.swift index 886490bba7c..09a6390454e 100644 --- a/swift/Tests/Blockchains/CeloTests.swift +++ b/swift/Tests/Blockchains/CeloTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class CeloTests: XCTestCase { func testTransfer() { diff --git a/swift/Tests/Blockchains/CosmosTests.swift b/swift/Tests/Blockchains/CosmosTests.swift index 3d940fe09d5..9faca5848e8 100644 --- a/swift/Tests/Blockchains/CosmosTests.swift +++ b/swift/Tests/Blockchains/CosmosTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class CosmosAddressTests: XCTestCase { func testAddressValidation() { diff --git a/swift/Tests/Blockchains/CronosTests.swift b/swift/Tests/Blockchains/CronosTests.swift index b28a89849bb..bc0475c60e9 100644 --- a/swift/Tests/Blockchains/CronosTests.swift +++ b/swift/Tests/Blockchains/CronosTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class CronosTests: XCTestCase { diff --git a/swift/Tests/Blockchains/CryptoorgTests.swift b/swift/Tests/Blockchains/CryptoorgTests.swift index 7926940b6b5..02fccdc79ff 100644 --- a/swift/Tests/Blockchains/CryptoorgTests.swift +++ b/swift/Tests/Blockchains/CryptoorgTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class CryptoorgTests: XCTestCase { diff --git a/swift/Tests/Blockchains/DashTests.swift b/swift/Tests/Blockchains/DashTests.swift index 655594b9a1c..2a913b42e1f 100644 --- a/swift/Tests/Blockchains/DashTests.swift +++ b/swift/Tests/Blockchains/DashTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class DashAddressTests: XCTestCase { diff --git a/swift/Tests/Blockchains/DecredTests.swift b/swift/Tests/Blockchains/DecredTests.swift index 2f7b3d4e54b..030b3c954bf 100644 --- a/swift/Tests/Blockchains/DecredTests.swift +++ b/swift/Tests/Blockchains/DecredTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class DecredTests: XCTestCase { diff --git a/swift/Tests/Blockchains/DogeTests.swift b/swift/Tests/Blockchains/DogeTests.swift index fd4708d10b8..372d615e355 100644 --- a/swift/Tests/Blockchains/DogeTests.swift +++ b/swift/Tests/Blockchains/DogeTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class DogeTests: XCTestCase { diff --git a/swift/Tests/Blockchains/ECashTests.swift b/swift/Tests/Blockchains/ECashTests.swift index 7826b92e44f..0ecd3b5d80d 100644 --- a/swift/Tests/Blockchains/ECashTests.swift +++ b/swift/Tests/Blockchains/ECashTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class ECashTests: XCTestCase { diff --git a/swift/Tests/Blockchains/EOSTests.swift b/swift/Tests/Blockchains/EOSTests.swift index 30ea50eda7c..64dff943f1f 100644 --- a/swift/Tests/Blockchains/EOSTests.swift +++ b/swift/Tests/Blockchains/EOSTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class EOSTests: XCTestCase { diff --git a/swift/Tests/Blockchains/ElrondTests.swift b/swift/Tests/Blockchains/ElrondTests.swift index fa6a64ee3ca..8461b0e3b61 100644 --- a/swift/Tests/Blockchains/ElrondTests.swift +++ b/swift/Tests/Blockchains/ElrondTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class ElrondTests: XCTestCase { diff --git a/swift/Tests/Blockchains/EthereumAbiTests.swift b/swift/Tests/Blockchains/EthereumAbiTests.swift index a6a18430e5b..ecbb7f90b6a 100644 --- a/swift/Tests/Blockchains/EthereumAbiTests.swift +++ b/swift/Tests/Blockchains/EthereumAbiTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class EthereumAbiTests: XCTestCase { func testAbiEncoder() { diff --git a/swift/Tests/Blockchains/EthereumTests.swift b/swift/Tests/Blockchains/EthereumTests.swift index 1409816761f..ddc45e36377 100644 --- a/swift/Tests/Blockchains/EthereumTests.swift +++ b/swift/Tests/Blockchains/EthereumTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class EthereumTests: XCTestCase { diff --git a/swift/Tests/Blockchains/EverscaleTests.swift b/swift/Tests/Blockchains/EverscaleTests.swift index d3ce3f32293..147b79506f9 100644 --- a/swift/Tests/Blockchains/EverscaleTests.swift +++ b/swift/Tests/Blockchains/EverscaleTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class EverscaleTests: XCTestCase { diff --git a/swift/Tests/Blockchains/EvmosTests.swift b/swift/Tests/Blockchains/EvmosTests.swift index ae10bdc08aa..9322fd7a806 100644 --- a/swift/Tests/Blockchains/EvmosTests.swift +++ b/swift/Tests/Blockchains/EvmosTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class EvmosTests: XCTestCase { diff --git a/swift/Tests/Blockchains/FIOTests.swift b/swift/Tests/Blockchains/FIOTests.swift index 3edbc7cd9d1..a82ba683e6a 100644 --- a/swift/Tests/Blockchains/FIOTests.swift +++ b/swift/Tests/Blockchains/FIOTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class FIOTests: XCTestCase { diff --git a/swift/Tests/Blockchains/FilecoinTests.swift b/swift/Tests/Blockchains/FilecoinTests.swift index ab5a83f6f53..d273adf29c8 100644 --- a/swift/Tests/Blockchains/FilecoinTests.swift +++ b/swift/Tests/Blockchains/FilecoinTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class FilecoinTests: XCTestCase { diff --git a/swift/Tests/Blockchains/GroestlcoinTests.swift b/swift/Tests/Blockchains/GroestlcoinTests.swift index ed0d9b250d5..7de507d482d 100644 --- a/swift/Tests/Blockchains/GroestlcoinTests.swift +++ b/swift/Tests/Blockchains/GroestlcoinTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class GroestlcoinTests: XCTestCase { diff --git a/swift/Tests/Blockchains/GroestlcoinTransactionSignerTests.swift b/swift/Tests/Blockchains/GroestlcoinTransactionSignerTests.swift index 58ab98538a9..9adbb7c3883 100644 --- a/swift/Tests/Blockchains/GroestlcoinTransactionSignerTests.swift +++ b/swift/Tests/Blockchains/GroestlcoinTransactionSignerTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class GroestlcoinTransactionSignerTests: XCTestCase { override func setUp() { diff --git a/swift/Tests/Blockchains/HarmonyTests.swift b/swift/Tests/Blockchains/HarmonyTests.swift index c74eca95520..939d1e3cce1 100644 --- a/swift/Tests/Blockchains/HarmonyTests.swift +++ b/swift/Tests/Blockchains/HarmonyTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class HarmonyTests: XCTestCase { diff --git a/swift/Tests/Blockchains/HederaTests.swift b/swift/Tests/Blockchains/HederaTests.swift index c71dd7d1f87..cd204158796 100644 --- a/swift/Tests/Blockchains/HederaTests.swift +++ b/swift/Tests/Blockchains/HederaTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class HederaTests: XCTestCase { diff --git a/swift/Tests/Blockchains/IconTests.swift b/swift/Tests/Blockchains/IconTests.swift index 4745b55be81..54ee81edb76 100644 --- a/swift/Tests/Blockchains/IconTests.swift +++ b/swift/Tests/Blockchains/IconTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class IconTests: XCTestCase { diff --git a/swift/Tests/Blockchains/IoTeXTests.swift b/swift/Tests/Blockchains/IoTeXTests.swift index 0c91d1f18f1..5d60e0348ab 100644 --- a/swift/Tests/Blockchains/IoTeXTests.swift +++ b/swift/Tests/Blockchains/IoTeXTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class IoTeXTests: XCTestCase { func testSign() { diff --git a/swift/Tests/Blockchains/KavaTests.swift b/swift/Tests/Blockchains/KavaTests.swift index f9a5f8957a5..cdecd30d0a3 100644 --- a/swift/Tests/Blockchains/KavaTests.swift +++ b/swift/Tests/Blockchains/KavaTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class KavaTests: XCTestCase { diff --git a/swift/Tests/Blockchains/KinTests.swift b/swift/Tests/Blockchains/KinTests.swift index 7dfec26b99b..6d0dfe1d5dc 100644 --- a/swift/Tests/Blockchains/KinTests.swift +++ b/swift/Tests/Blockchains/KinTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class KinTests: XCTestCase { diff --git a/swift/Tests/Blockchains/KuCoinCommunityChainTests.swift b/swift/Tests/Blockchains/KuCoinCommunityChainTests.swift index df42dfc52fb..3b53697e8f1 100644 --- a/swift/Tests/Blockchains/KuCoinCommunityChainTests.swift +++ b/swift/Tests/Blockchains/KuCoinCommunityChainTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class KuCoinCommunityChainTests: XCTestCase { diff --git a/swift/Tests/Blockchains/KusamaTests.swift b/swift/Tests/Blockchains/KusamaTests.swift index ae5fd1ea397..b9eef2eebae 100644 --- a/swift/Tests/Blockchains/KusamaTests.swift +++ b/swift/Tests/Blockchains/KusamaTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class KusamaTests: XCTestCase { diff --git a/swift/Tests/Blockchains/LitecoinTests.swift b/swift/Tests/Blockchains/LitecoinTests.swift index 01fb5b275b0..9ccea0f9335 100644 --- a/swift/Tests/Blockchains/LitecoinTests.swift +++ b/swift/Tests/Blockchains/LitecoinTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class LitecoinTests: XCTestCase { diff --git a/swift/Tests/Blockchains/MonacoinTests.swift b/swift/Tests/Blockchains/MonacoinTests.swift index e34a22a022b..198384fc29c 100644 --- a/swift/Tests/Blockchains/MonacoinTests.swift +++ b/swift/Tests/Blockchains/MonacoinTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class MonacoinTests: XCTestCase { diff --git a/swift/Tests/Blockchains/NEARTests.swift b/swift/Tests/Blockchains/NEARTests.swift index d275f2059ec..e18cccdcc70 100644 --- a/swift/Tests/Blockchains/NEARTests.swift +++ b/swift/Tests/Blockchains/NEARTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class NEARTests: XCTestCase { diff --git a/swift/Tests/Blockchains/NEOTests.swift b/swift/Tests/Blockchains/NEOTests.swift index 89754e3e28e..1bf5aa56898 100644 --- a/swift/Tests/Blockchains/NEOTests.swift +++ b/swift/Tests/Blockchains/NEOTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class NEOTests: XCTestCase { diff --git a/swift/Tests/Blockchains/NULSTests.swift b/swift/Tests/Blockchains/NULSTests.swift index 3bafd7b654a..477446c7cc4 100644 --- a/swift/Tests/Blockchains/NULSTests.swift +++ b/swift/Tests/Blockchains/NULSTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class NULSTests: XCTestCase { diff --git a/swift/Tests/Blockchains/NanoTests.swift b/swift/Tests/Blockchains/NanoTests.swift index 2e7e631c173..94a507fe0ea 100644 --- a/swift/Tests/Blockchains/NanoTests.swift +++ b/swift/Tests/Blockchains/NanoTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class NanoTests: XCTestCase { diff --git a/swift/Tests/Blockchains/NativeInjectiveTests.swift b/swift/Tests/Blockchains/NativeInjectiveTests.swift index 6a95b53e85f..850895cd15e 100644 --- a/swift/Tests/Blockchains/NativeInjectiveTests.swift +++ b/swift/Tests/Blockchains/NativeInjectiveTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class NativeInjectiveTests: XCTestCase { diff --git a/swift/Tests/Blockchains/NebulasTests.swift b/swift/Tests/Blockchains/NebulasTests.swift index 7cfe7e63747..747daf175c1 100644 --- a/swift/Tests/Blockchains/NebulasTests.swift +++ b/swift/Tests/Blockchains/NebulasTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class NebulasTests: XCTestCase { diff --git a/swift/Tests/Blockchains/NervosTests.swift b/swift/Tests/Blockchains/NervosTests.swift index e250869c9ad..3c00b319656 100644 --- a/swift/Tests/Blockchains/NervosTests.swift +++ b/swift/Tests/Blockchains/NervosTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class NervosTests: XCTestCase { diff --git a/swift/Tests/Blockchains/NimiqTests.swift b/swift/Tests/Blockchains/NimiqTests.swift index d056302a5e3..6d85f2e6a3c 100644 --- a/swift/Tests/Blockchains/NimiqTests.swift +++ b/swift/Tests/Blockchains/NimiqTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class NimiqTests: XCTestCase { diff --git a/swift/Tests/Blockchains/OasisTests.swift b/swift/Tests/Blockchains/OasisTests.swift index 03ad91930f7..05cf7ecee74 100644 --- a/swift/Tests/Blockchains/OasisTests.swift +++ b/swift/Tests/Blockchains/OasisTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class OasisTests: XCTestCase { diff --git a/swift/Tests/Blockchains/OntologyTests.swift b/swift/Tests/Blockchains/OntologyTests.swift index 3779918b0f7..cdab9c60654 100644 --- a/swift/Tests/Blockchains/OntologyTests.swift +++ b/swift/Tests/Blockchains/OntologyTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class OntologyTests: XCTestCase { diff --git a/swift/Tests/Blockchains/OsmosisTests.swift b/swift/Tests/Blockchains/OsmosisTests.swift index bd7303dbe51..314d868f1ab 100644 --- a/swift/Tests/Blockchains/OsmosisTests.swift +++ b/swift/Tests/Blockchains/OsmosisTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class OsmosisTests: XCTestCase { diff --git a/swift/Tests/Blockchains/PolkadotTests.swift b/swift/Tests/Blockchains/PolkadotTests.swift index c4414e5f607..309001d6024 100644 --- a/swift/Tests/Blockchains/PolkadotTests.swift +++ b/swift/Tests/Blockchains/PolkadotTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class PolkadotTests: XCTestCase { diff --git a/swift/Tests/Blockchains/PolygonTests.swift b/swift/Tests/Blockchains/PolygonTests.swift index cba7eb17b76..373ffd86c68 100644 --- a/swift/Tests/Blockchains/PolygonTests.swift +++ b/swift/Tests/Blockchains/PolygonTests.swift @@ -3,7 +3,7 @@ // This file is part of Trust. The full Trust copyright notice, including // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class PolygonTests: XCTestCase { diff --git a/swift/Tests/Blockchains/QtumTests.swift b/swift/Tests/Blockchains/QtumTests.swift index b6cd3394538..611ff8d2397 100644 --- a/swift/Tests/Blockchains/QtumTests.swift +++ b/swift/Tests/Blockchains/QtumTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class QtumTests: XCTestCase { diff --git a/swift/Tests/Blockchains/RippleTests.swift b/swift/Tests/Blockchains/RippleTests.swift index c2e96a65781..e51b215e1e1 100644 --- a/swift/Tests/Blockchains/RippleTests.swift +++ b/swift/Tests/Blockchains/RippleTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class RippleTests: XCTestCase { diff --git a/swift/Tests/Blockchains/RoninTests.swift b/swift/Tests/Blockchains/RoninTests.swift index 2cb54acb389..cb76b2a3362 100644 --- a/swift/Tests/Blockchains/RoninTests.swift +++ b/swift/Tests/Blockchains/RoninTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class RoninTests: XCTestCase { diff --git a/swift/Tests/Blockchains/SecretTests.swift b/swift/Tests/Blockchains/SecretTests.swift index 5abd8ff81b9..de44ddb1532 100644 --- a/swift/Tests/Blockchains/SecretTests.swift +++ b/swift/Tests/Blockchains/SecretTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class SecretTests: XCTestCase { diff --git a/swift/Tests/Blockchains/SmartBitcoinCashTests.swift b/swift/Tests/Blockchains/SmartBitcoinCashTests.swift index 48d5a6aca65..92cfe76e506 100644 --- a/swift/Tests/Blockchains/SmartBitcoinCashTests.swift +++ b/swift/Tests/Blockchains/SmartBitcoinCashTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class SmartBitcoinCashTests: XCTestCase { diff --git a/swift/Tests/Blockchains/SolanaTests.swift b/swift/Tests/Blockchains/SolanaTests.swift index a0632941a0c..5717ce9ab14 100644 --- a/swift/Tests/Blockchains/SolanaTests.swift +++ b/swift/Tests/Blockchains/SolanaTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class SolanaTests: XCTestCase { diff --git a/swift/Tests/Blockchains/StarkExTests.swift b/swift/Tests/Blockchains/StarkExTests.swift index 88e868ab10c..0ade84e2aae 100644 --- a/swift/Tests/Blockchains/StarkExTests.swift +++ b/swift/Tests/Blockchains/StarkExTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class StarkExTests: XCTestCase { func testMessageAndVerifySigner() { diff --git a/swift/Tests/Blockchains/StellarTests.swift b/swift/Tests/Blockchains/StellarTests.swift index 9ff0754b748..88522050eb4 100644 --- a/swift/Tests/Blockchains/StellarTests.swift +++ b/swift/Tests/Blockchains/StellarTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class StellarTests: XCTestCase { diff --git a/swift/Tests/Blockchains/THORChainSwapTests.swift b/swift/Tests/Blockchains/THORChainSwapTests.swift index 8a7dc4a2ff6..03a41905f48 100644 --- a/swift/Tests/Blockchains/THORChainSwapTests.swift +++ b/swift/Tests/Blockchains/THORChainSwapTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class THORSwapTests: XCTestCase { diff --git a/swift/Tests/Blockchains/THORChainTests.swift b/swift/Tests/Blockchains/THORChainTests.swift index 45d9cb3ac80..def279e678d 100644 --- a/swift/Tests/Blockchains/THORChainTests.swift +++ b/swift/Tests/Blockchains/THORChainTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class THORChainAddressTests: XCTestCase { func testAddressValidation() { diff --git a/swift/Tests/Blockchains/TerraClassicTests.swift b/swift/Tests/Blockchains/TerraClassicTests.swift index bb1e8c81e21..882e1dea4a8 100644 --- a/swift/Tests/Blockchains/TerraClassicTests.swift +++ b/swift/Tests/Blockchains/TerraClassicTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class TerraClassicTests: XCTestCase { diff --git a/swift/Tests/Blockchains/TerraTests.swift b/swift/Tests/Blockchains/TerraTests.swift index 02a264beadf..b32444992b4 100644 --- a/swift/Tests/Blockchains/TerraTests.swift +++ b/swift/Tests/Blockchains/TerraTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class TerraTests: XCTestCase { diff --git a/swift/Tests/Blockchains/TezosTests.swift b/swift/Tests/Blockchains/TezosTests.swift index 67a26a6c971..0210dbd3c19 100644 --- a/swift/Tests/Blockchains/TezosTests.swift +++ b/swift/Tests/Blockchains/TezosTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class TezosTests: XCTestCase { diff --git a/swift/Tests/Blockchains/TheOpenNetworkTests.swift b/swift/Tests/Blockchains/TheOpenNetworkTests.swift index 805db266195..cdb3de4f05f 100644 --- a/swift/Tests/Blockchains/TheOpenNetworkTests.swift +++ b/swift/Tests/Blockchains/TheOpenNetworkTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class TheOpenNetworkTests: XCTestCase { diff --git a/swift/Tests/Blockchains/ThetaTests.swift b/swift/Tests/Blockchains/ThetaTests.swift index 17176fdbc71..167b7d58a06 100644 --- a/swift/Tests/Blockchains/ThetaTests.swift +++ b/swift/Tests/Blockchains/ThetaTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class ThetaTests: XCTestCase { func testSigner() { diff --git a/swift/Tests/Blockchains/TronTests.swift b/swift/Tests/Blockchains/TronTests.swift index 587eb340570..a9243da7856 100644 --- a/swift/Tests/Blockchains/TronTests.swift +++ b/swift/Tests/Blockchains/TronTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class TronTests: XCTestCase { diff --git a/swift/Tests/Blockchains/WanchainTests.swift b/swift/Tests/Blockchains/WanchainTests.swift index 8718ce3cd9b..e9d043421f7 100644 --- a/swift/Tests/Blockchains/WanchainTests.swift +++ b/swift/Tests/Blockchains/WanchainTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class WanchainTests: XCTestCase { diff --git a/swift/Tests/Blockchains/WavesTests.swift b/swift/Tests/Blockchains/WavesTests.swift index 75c9f4b6154..6121b8289c6 100644 --- a/swift/Tests/Blockchains/WavesTests.swift +++ b/swift/Tests/Blockchains/WavesTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class WavesTests: XCTestCase { diff --git a/swift/Tests/Blockchains/ZcashTests.swift b/swift/Tests/Blockchains/ZcashTests.swift index bd7a861a0f4..a42a60f0a42 100644 --- a/swift/Tests/Blockchains/ZcashTests.swift +++ b/swift/Tests/Blockchains/ZcashTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class ZcashTests: XCTestCase { diff --git a/swift/Tests/Blockchains/ZcoinTests.swift b/swift/Tests/Blockchains/ZcoinTests.swift index 7014d4e274d..ee0d7b2abf8 100644 --- a/swift/Tests/Blockchains/ZcoinTests.swift +++ b/swift/Tests/Blockchains/ZcoinTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class ZcoinTests: XCTestCase { let coin = CoinType.firo diff --git a/swift/Tests/Blockchains/ZilliqaTests.swift b/swift/Tests/Blockchains/ZilliqaTests.swift index a523cd26c97..adbcbd94f38 100644 --- a/swift/Tests/Blockchains/ZilliqaTests.swift +++ b/swift/Tests/Blockchains/ZilliqaTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class ZilliqaTests: XCTestCase { diff --git a/swift/Tests/CoinAddressDerivationTests.swift b/swift/Tests/CoinAddressDerivationTests.swift index 1863b13d3b5..1184ca3f8eb 100644 --- a/swift/Tests/CoinAddressDerivationTests.swift +++ b/swift/Tests/CoinAddressDerivationTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class CoinAddressDerivationTests: XCTestCase { diff --git a/swift/Tests/CoinTypeTests.swift b/swift/Tests/CoinTypeTests.swift index 353b85cf729..75c91114df0 100644 --- a/swift/Tests/CoinTypeTests.swift +++ b/swift/Tests/CoinTypeTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class CoinTypeTests: XCTestCase { diff --git a/swift/Tests/DataTests.swift b/swift/Tests/DataTests.swift index eee71d6743a..37e93bb4f09 100644 --- a/swift/Tests/DataTests.swift +++ b/swift/Tests/DataTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class DataTests: XCTestCase { diff --git a/swift/Tests/DerivationPathTests.swift b/swift/Tests/DerivationPathTests.swift index 3867d434847..4e4a6649af3 100644 --- a/swift/Tests/DerivationPathTests.swift +++ b/swift/Tests/DerivationPathTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class DerivationPathTests: XCTestCase { diff --git a/swift/Tests/HDWalletTests.swift b/swift/Tests/HDWalletTests.swift index 537f8b0a961..978efee5737 100644 --- a/swift/Tests/HDWalletTests.swift +++ b/swift/Tests/HDWalletTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest extension HDWallet { diff --git a/swift/Tests/HashTests.swift b/swift/Tests/HashTests.swift index fc192dceebe..481b4d03cf6 100644 --- a/swift/Tests/HashTests.swift +++ b/swift/Tests/HashTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class HashTests: XCTestCase { diff --git a/swift/Tests/Keystore/AccountTests.swift b/swift/Tests/Keystore/AccountTests.swift index 772e741ea56..ec7b6963765 100755 --- a/swift/Tests/Keystore/AccountTests.swift +++ b/swift/Tests/Keystore/AccountTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class AccountTests: XCTestCase { diff --git a/swift/Tests/Keystore/KeyStoreTests.swift b/swift/Tests/Keystore/KeyStoreTests.swift index 62d907ccfaf..916d2366071 100755 --- a/swift/Tests/Keystore/KeyStoreTests.swift +++ b/swift/Tests/Keystore/KeyStoreTests.swift @@ -6,7 +6,7 @@ @testable import WalletCore -import WalletCore +@testable import WalletCore import XCTest extension KeyStore { diff --git a/swift/Tests/Keystore/KeystoreKeyTests.swift b/swift/Tests/Keystore/KeystoreKeyTests.swift index b33659ceaef..d71694b0fe1 100755 --- a/swift/Tests/Keystore/KeystoreKeyTests.swift +++ b/swift/Tests/Keystore/KeystoreKeyTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class KeystoreKeyTests: XCTestCase { diff --git a/swift/Tests/Keystore/WalletTests.swift b/swift/Tests/Keystore/WalletTests.swift index 00815ed0271..29b5f2c02ed 100755 --- a/swift/Tests/Keystore/WalletTests.swift +++ b/swift/Tests/Keystore/WalletTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class WalletTests: XCTestCase { func testSeparateAccounts() throws { diff --git a/swift/Tests/MnemonicTests.swift b/swift/Tests/MnemonicTests.swift index e76baa79185..01e2be9116a 100644 --- a/swift/Tests/MnemonicTests.swift +++ b/swift/Tests/MnemonicTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class MnemonicTests: XCTestCase { diff --git a/swift/Tests/PBKDF2Tests.swift b/swift/Tests/PBKDF2Tests.swift index c5ccbadc1af..25538740dd3 100644 --- a/swift/Tests/PBKDF2Tests.swift +++ b/swift/Tests/PBKDF2Tests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class PBKDF2Tests: XCTestCase { diff --git a/swift/Tests/PrivateKeyTests.swift b/swift/Tests/PrivateKeyTests.swift index bc9ae7e13ff..41f51d8fdfd 100644 --- a/swift/Tests/PrivateKeyTests.swift +++ b/swift/Tests/PrivateKeyTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class PrivateKeyTests: XCTestCase { diff --git a/swift/Tests/PublicKeyTests.swift b/swift/Tests/PublicKeyTests.swift index 5819e3d3ed0..488f3538e45 100644 --- a/swift/Tests/PublicKeyTests.swift +++ b/swift/Tests/PublicKeyTests.swift @@ -4,7 +4,7 @@ // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. -import WalletCore +@testable import WalletCore import XCTest class PublicKeyTests: XCTestCase { diff --git a/swift/Tests/TransactionCompilerTests.swift b/swift/Tests/TransactionCompilerTests.swift index 05ff08f7457..eb3cbf3ed3f 100644 --- a/swift/Tests/TransactionCompilerTests.swift +++ b/swift/Tests/TransactionCompilerTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore class TransactionCompilerTests: XCTestCase { override func setUp() { diff --git a/swift/Tests/UniversalAssetIDTests.swift b/swift/Tests/UniversalAssetIDTests.swift index 73ad5ac8358..a69c8a6aa40 100644 --- a/swift/Tests/UniversalAssetIDTests.swift +++ b/swift/Tests/UniversalAssetIDTests.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import XCTest -import WalletCore +@testable import WalletCore public extension UniversalAssetID { init(coin: CoinType) { From 5cce8934657bac6cba611467faf68f00b154752a Mon Sep 17 00:00:00 2001 From: Andrey Chukavin Date: Wed, 8 Feb 2023 17:05:24 +0200 Subject: [PATCH 14/20] IOS-2948 Revert "IOS-2948 Temporarily reduced the amount to build" This reverts commit 525fc1c9cd1abb95e5af685ca482d4d3a9fa3d88. --- swift/fastlane/Fastfile | 8 ++------ tools/ios-build | 19 +++++++++++++------ tools/ios-xcframework | 2 +- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/swift/fastlane/Fastfile b/swift/fastlane/Fastfile index 4dfbed3a0cf..298bcb35a56 100644 --- a/swift/fastlane/Fastfile +++ b/swift/fastlane/Fastfile @@ -13,9 +13,7 @@ platform :ios do create_xcframework( workspace: 'TrustWalletCore.xcworkspace', scheme: 'WalletCore', - clean: false, - # destinations: ['iOS', 'macOS'], - destinations: ['iOS'], + destinations: ['iOS', 'macOS'], xcframework_output_directory: 'build', enable_bitcode: false ) @@ -26,9 +24,7 @@ platform :ios do create_xcframework( workspace: 'TrustWalletCore.xcworkspace', scheme: 'SwiftProtobuf', - # destinations: ['iOS', 'macOS'], - destinations: ['iOS'], - clean: false, + destinations: ['iOS', 'macOS'], xcframework_output_directory: 'build', enable_bitcode: false ) diff --git a/tools/ios-build b/tools/ios-build index b9e58860ae2..8e12031289e 100755 --- a/tools/ios-build +++ b/tools/ios-build @@ -10,7 +10,14 @@ FRAMEWORK=WalletCoreCommon BUILD_FOLDER=build/ios-frameworks init() { - echo "" + echo "Cleanup and init..." + pushd swift + xcodegen -s common-xcframework.yml + popd + + rm -rf ${BUILD_FOLDER}/*.xcarchive + rm -rf ${BUILD_FOLDER}/${FRAMEWORK}.xcframework + rm -rf ${BUILD_FOLDER}/${FRAMEWORK}.xcframework.* } # build destination archivePath @@ -39,15 +46,15 @@ create_xc_framework() { echo "Createing xcframework..." xcodebuild -create-xcframework -output $BUILD_FOLDER/$FRAMEWORK.xcframework \ -framework $BUILD_FOLDER/ios-arm64.xcarchive/Products/Library/Frameworks/$FRAMEWORK.framework \ - # -framework $BUILD_FOLDER/ios-arm64_x86_64-simulator.xcarchive/Products/Library/Frameworks/$FRAMEWORK.framework \ - # -framework $BUILD_FOLDER/ios-x86_64_arm64-maccatalyst.xcarchive/Products/Library/Frameworks/$FRAMEWORK.framework \ - # -framework $BUILD_FOLDER/macos-arm64_x86_64.xcarchive/Products/Library/Frameworks/$FRAMEWORK.framework + -framework $BUILD_FOLDER/ios-arm64_x86_64-simulator.xcarchive/Products/Library/Frameworks/$FRAMEWORK.framework \ + -framework $BUILD_FOLDER/ios-x86_64_arm64-maccatalyst.xcarchive/Products/Library/Frameworks/$FRAMEWORK.framework \ + -framework $BUILD_FOLDER/macos-arm64_x86_64.xcarchive/Products/Library/Frameworks/$FRAMEWORK.framework } main() { init - # build_mac_x64_arm64 && build_ios_mac_catalyst - build_ios_arm64 #&& build_ios_simulator + build_mac_x64_arm64 && build_ios_mac_catalyst + build_ios_arm64 && build_ios_simulator create_xc_framework } diff --git a/tools/ios-xcframework b/tools/ios-xcframework index 96b7886695c..d5d667f4b14 100755 --- a/tools/ios-xcframework +++ b/tools/ios-xcframework @@ -6,7 +6,7 @@ set -e echo "Building Docc..." -# tools/ios-doc +tools/ios-doc echo "Building xcframework..." pushd swift From 4c07c611a19e1aa9f3480db8486d8811d94f5e64 Mon Sep 17 00:00:00 2001 From: Andrey Chukavin Date: Wed, 8 Feb 2023 17:08:04 +0200 Subject: [PATCH 15/20] IOS-2948 Added script to build JUST xcframeworks, without docs --- tools/ios-xcframework-with-no-docs | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 tools/ios-xcframework-with-no-docs diff --git a/tools/ios-xcframework-with-no-docs b/tools/ios-xcframework-with-no-docs new file mode 100755 index 00000000000..cdb84355649 --- /dev/null +++ b/tools/ios-xcframework-with-no-docs @@ -0,0 +1,11 @@ +#!/bin/bash +# +# This script builds dynamic WalletCore and SwiftProtobuf xcframework for SPM and CocoaPods +# + +set -e + +echo "Building xcframework..." +pushd swift +fastlane ios xcframework +popd From a6927ab4e1906c54c285e0add997cf57e7c31fb3 Mon Sep 17 00:00:00 2001 From: Andrey Chukavin Date: Wed, 8 Feb 2023 17:10:34 +0200 Subject: [PATCH 16/20] IOS-2948 Added tangem tags in the source code --- src/TheOpenNetwork/wallet/Wallet.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/TheOpenNetwork/wallet/Wallet.cpp b/src/TheOpenNetwork/wallet/Wallet.cpp index 521bfab2f7c..04172204197 100644 --- a/src/TheOpenNetwork/wallet/Wallet.cpp +++ b/src/TheOpenNetwork/wallet/Wallet.cpp @@ -83,6 +83,7 @@ Cell::Ref Wallet::createTransferMessage( ); } +// TANGEM Cell::Ref Wallet::createTransferMessage( const PrivateKey& privateKey, const std::function externalSigner, @@ -105,6 +106,7 @@ Cell::Ref Wallet::createTransferMessage( const Cell::Ref signingMessage = this->createSigningMessage(dest, amount, sequence_number, mode, expireAt, comment); Data data(signingMessage->hash.begin(), signingMessage->hash.end()); + // TANGEM auto signature = Data(); if(externalSigner) { std::future signedDataFuture = std::async(externalSigner, data); From e75db9358393db586660bad4c3eb8c7c35569893 Mon Sep 17 00:00:00 2001 From: Andrey Chukavin Date: Thu, 9 Feb 2023 16:43:10 +0200 Subject: [PATCH 17/20] IOS-2948 Added podspec for TrustWalletCore --- TrustWalletCore.podspec | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 TrustWalletCore.podspec diff --git a/TrustWalletCore.podspec b/TrustWalletCore.podspec new file mode 100644 index 00000000000..5157a94f1a5 --- /dev/null +++ b/TrustWalletCore.podspec @@ -0,0 +1,37 @@ +Pod::Spec.new do |s| + s.name = 'TrustWalletCore' + s.version = '3.1.9-tangem0' + s.summary = 'Trust Wallet core data structures and algorithms.' + s.homepage = 'https://github.com/trustwallet/wallet-core' + s.license = 'MIT' + s.authors = { 'Alejandro Isaza' => 'al@isaza.ca' } + s.module_name = 'WalletCore' + s.ios.deployment_target = '12.0' + s.osx.deployment_target = '10.14' + s.swift_version = '5.1' + s.source = { + http: 'https://github.com/tangem/wallet-core/releases/download/3.1.9-tangem0/TrustWalletCore-3.1.9.tar.xz' + } + s.default_subspec = 'Core' + s.subspec 'Types' do |ss| + ss.source_files = + 'Sources/Types/*.swift', + 'Sources/Generated/Enums/*.swift', + 'Sources/Generated/Protobuf/*.swift' + ss.dependency 'SwiftProtobuf' + end + s.subspec 'Core' do |ss| + ss.vendored_frameworks = '*.xcframework' + ss.exclude_files = 'Sources/Generated/WalletCore.h' + ss.source_files = + 'include/**/*.h', + 'Sources/*.{swift,h,m,cpp}', + 'Sources/Extensions/*.swift', + 'Sources/Generated/*.{swift,h}' + ss.public_header_files = + 'include/**/*.h', + 'Sources/*.h' + ss.libraries = 'c++' + ss.dependency 'TrustWalletCore/Types' + end +end From c6e5a4b1939cf69a356cd3d93eabc4d83b1a6c74 Mon Sep 17 00:00:00 2001 From: Andrey Chukavin Date: Fri, 3 Mar 2023 19:07:26 +0200 Subject: [PATCH 18/20] IOS-2948 Disable the mac/catalyst build for now --- swift/fastlane/Fastfile | 4 ++-- tools/rust-bindgen | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/swift/fastlane/Fastfile b/swift/fastlane/Fastfile index 298bcb35a56..5fa18ea4945 100644 --- a/swift/fastlane/Fastfile +++ b/swift/fastlane/Fastfile @@ -13,7 +13,7 @@ platform :ios do create_xcframework( workspace: 'TrustWalletCore.xcworkspace', scheme: 'WalletCore', - destinations: ['iOS', 'macOS'], + destinations: ['iOS'], xcframework_output_directory: 'build', enable_bitcode: false ) @@ -24,7 +24,7 @@ platform :ios do create_xcframework( workspace: 'TrustWalletCore.xcworkspace', scheme: 'SwiftProtobuf', - destinations: ['iOS', 'macOS'], + destinations: ['iOS'], xcframework_output_directory: 'build', enable_bitcode: false ) diff --git a/tools/rust-bindgen b/tools/rust-bindgen index ab885868d1c..305d50b1dd8 100755 --- a/tools/rust-bindgen +++ b/tools/rust-bindgen @@ -8,7 +8,7 @@ HEADER_NAME="WalletCoreRSBindgen.h" create_xc_framework() { rm -rf $TARGET_XCFRAMEWORK_NAME - xcodebuild -create-xcframework -library $BUILD_FOLDER/$TARGET_NAME -library $BUILD_FOLDER/darwin_universal/$TARGET_NAME -library $BUILD_FOLDER/aarch64-apple-ios/release/$TARGET_NAME -library $BUILD_FOLDER/catalyst/$TARGET_NAME -output $TARGET_XCFRAMEWORK_NAME + xcodebuild -create-xcframework -library $BUILD_FOLDER/$TARGET_NAME -library $BUILD_FOLDER/darwin_universal/$TARGET_NAME -library $BUILD_FOLDER/aarch64-apple-ios/release/$TARGET_NAME -output $TARGET_XCFRAMEWORK_NAME } cd rust From f9f5f984687675f04f04751f286b8cdd4abcf5a9 Mon Sep 17 00:00:00 2001 From: Andrey Chukavin Date: Fri, 3 Mar 2023 19:41:03 +0200 Subject: [PATCH 19/20] IOS-2948 Useless code --- TrustWalletCore.podspec | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 TrustWalletCore.podspec diff --git a/TrustWalletCore.podspec b/TrustWalletCore.podspec deleted file mode 100644 index 5157a94f1a5..00000000000 --- a/TrustWalletCore.podspec +++ /dev/null @@ -1,37 +0,0 @@ -Pod::Spec.new do |s| - s.name = 'TrustWalletCore' - s.version = '3.1.9-tangem0' - s.summary = 'Trust Wallet core data structures and algorithms.' - s.homepage = 'https://github.com/trustwallet/wallet-core' - s.license = 'MIT' - s.authors = { 'Alejandro Isaza' => 'al@isaza.ca' } - s.module_name = 'WalletCore' - s.ios.deployment_target = '12.0' - s.osx.deployment_target = '10.14' - s.swift_version = '5.1' - s.source = { - http: 'https://github.com/tangem/wallet-core/releases/download/3.1.9-tangem0/TrustWalletCore-3.1.9.tar.xz' - } - s.default_subspec = 'Core' - s.subspec 'Types' do |ss| - ss.source_files = - 'Sources/Types/*.swift', - 'Sources/Generated/Enums/*.swift', - 'Sources/Generated/Protobuf/*.swift' - ss.dependency 'SwiftProtobuf' - end - s.subspec 'Core' do |ss| - ss.vendored_frameworks = '*.xcframework' - ss.exclude_files = 'Sources/Generated/WalletCore.h' - ss.source_files = - 'include/**/*.h', - 'Sources/*.{swift,h,m,cpp}', - 'Sources/Extensions/*.swift', - 'Sources/Generated/*.{swift,h}' - ss.public_header_files = - 'include/**/*.h', - 'Sources/*.h' - ss.libraries = 'c++' - ss.dependency 'TrustWalletCore/Types' - end -end From f01afbb59c4ef38545648acd5b4f9b684e54ab3d Mon Sep 17 00:00:00 2001 From: Andrey Chukavin Date: Fri, 3 Mar 2023 19:52:24 +0200 Subject: [PATCH 20/20] IOS-2948 Useless script --- tools/ios-xcframework-with-no-docs | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100755 tools/ios-xcframework-with-no-docs diff --git a/tools/ios-xcframework-with-no-docs b/tools/ios-xcframework-with-no-docs deleted file mode 100755 index cdb84355649..00000000000 --- a/tools/ios-xcframework-with-no-docs +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -# -# This script builds dynamic WalletCore and SwiftProtobuf xcframework for SPM and CocoaPods -# - -set -e - -echo "Building xcframework..." -pushd swift -fastlane ios xcframework -popd