From 3b904e7ef46829dd005c58e995f8699ab63406e5 Mon Sep 17 00:00:00 2001 From: Tangem Date: Sat, 10 Sep 2022 12:20:17 +0300 Subject: [PATCH 1/6] Updated on 2026-08-14 --- .../main/java/com/tangem/domain/common/extensions/CardSdk.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/domain/src/main/java/com/tangem/domain/common/extensions/CardSdk.kt b/domain/src/main/java/com/tangem/domain/common/extensions/CardSdk.kt index ea805497c6..204602df42 100644 --- a/domain/src/main/java/com/tangem/domain/common/extensions/CardSdk.kt +++ b/domain/src/main/java/com/tangem/domain/common/extensions/CardSdk.kt @@ -18,8 +18,7 @@ fun Card.supportedBlockchains(): List { Blockchain.fromCurve(EllipticCurve.Secp256k1) } else -> { - Blockchain.fromCurve(EllipticCurve.Secp256k1) + - Blockchain.fromCurve(EllipticCurve.Ed25519) + (Blockchain.fromCurve(EllipticCurve.Secp256k1) + Blockchain.fromCurve(EllipticCurve.Ed25519)).distinct() } } val filtered = supportedBlockchains.filter { isTestCard == it.isTestnet() } From f45da41502a07bb6591e9ee5ef3bc8ccc06ab165 Mon Sep 17 00:00:00 2001 From: Tangem Date: Sat, 10 Sep 2022 13:25:10 +0300 Subject: [PATCH 2/6] Updated on 2026-08-14 --- .../main/java/com/tangem/domain/common/extensions/Blockchain.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/domain/src/main/java/com/tangem/domain/common/extensions/Blockchain.kt b/domain/src/main/java/com/tangem/domain/common/extensions/Blockchain.kt index 139bc99365..3ced07e447 100644 --- a/domain/src/main/java/com/tangem/domain/common/extensions/Blockchain.kt +++ b/domain/src/main/java/com/tangem/domain/common/extensions/Blockchain.kt @@ -5,7 +5,7 @@ import com.tangem.blockchain.common.Blockchain fun Blockchain.Companion.fromNetworkId(networkId: String): Blockchain? { return when (networkId) { "arbitrum-one" -> Blockchain.Arbitrum - "arbitrum-one/test" -> Blockchain.ArbitrumTestnet + "arbitrum/test" -> Blockchain.ArbitrumTestnet "avalanche", "avalanche-2" -> Blockchain.Avalanche "avalanche/test", "avalanche-2/test" -> Blockchain.AvalancheTestnet "binancecoin" -> Blockchain.Binance From b6e2da91c002b538a2d972a5ff7f4dadfc9e185a Mon Sep 17 00:00:00 2001 From: Tangem Date: Sat, 10 Sep 2022 13:25:47 +0300 Subject: [PATCH 3/6] Updated on 2026-08-14 --- .../features/BlockchainNetworkIdTests.kt | 29 +++++++++++++++++++ .../tangem/domain/features/ExampleUnitTest.kt | 16 ---------- 2 files changed, 29 insertions(+), 16 deletions(-) create mode 100644 domain/src/test/java/com/tangem/domain/features/BlockchainNetworkIdTests.kt delete mode 100644 domain/src/test/java/com/tangem/domain/features/ExampleUnitTest.kt diff --git a/domain/src/test/java/com/tangem/domain/features/BlockchainNetworkIdTests.kt b/domain/src/test/java/com/tangem/domain/features/BlockchainNetworkIdTests.kt new file mode 100644 index 0000000000..9982a61c80 --- /dev/null +++ b/domain/src/test/java/com/tangem/domain/features/BlockchainNetworkIdTests.kt @@ -0,0 +1,29 @@ +package com.tangem.domain.features + +import com.google.common.truth.Truth +import com.tangem.blockchain.common.Blockchain +import com.tangem.domain.common.extensions.fromNetworkId +import com.tangem.domain.common.extensions.toNetworkId +import org.junit.Test + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class BlockchainNetworkIdTests { + @Test + fun checkAppropriateImplementationForNetworkIds() { + val unimplementedIds = Blockchain.values() + .toMutableList() + .apply { remove(Blockchain.Unknown) }.map { + val networkId = it.toNetworkId() + networkId to Blockchain.fromNetworkId(networkId) + }.filter { it.second == null } + + if (unimplementedIds.isEmpty()) return + + val message = unimplementedIds.joinToString("\n") { it.first } + Truth.assert_().withMessage(message).fail() + } +} \ No newline at end of file diff --git a/domain/src/test/java/com/tangem/domain/features/ExampleUnitTest.kt b/domain/src/test/java/com/tangem/domain/features/ExampleUnitTest.kt deleted file mode 100644 index 99368f65e4..0000000000 --- a/domain/src/test/java/com/tangem/domain/features/ExampleUnitTest.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.tangem.domain.features - -import org.junit.Assert.assertEquals -import org.junit.Test - -/** - * Example local unit test, which will execute on the development machine (host). - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -class ExampleUnitTest { - @Test - fun addition_isCorrect() { - assertEquals(4, 2 + 2) - } -} \ No newline at end of file From 07732b4b55c6508476d1246e6332527004e37a17 Mon Sep 17 00:00:00 2001 From: Tangem Date: Sat, 10 Sep 2022 13:27:13 +0300 Subject: [PATCH 4/6] Updated on 2026-08-14 --- dependencies.gradle | 2 +- .../java/com/tangem/domain/common/extensions/Blockchain.kt | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/dependencies.gradle b/dependencies.gradle index 4717ab51df..394b8cc997 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -2,7 +2,7 @@ ext.versions = [ kotlin : '1.6.10', build_gradle : '7.1.3', tangem_card_sdk : 'develop-159', - tangem_blockchain_sdk: 'develop-107', + tangem_blockchain_sdk: 'develop-111', // tangem_blockchain_sdk: '0.0.1', ] diff --git a/domain/src/main/java/com/tangem/domain/common/extensions/Blockchain.kt b/domain/src/main/java/com/tangem/domain/common/extensions/Blockchain.kt index 3ced07e447..a162d197b2 100644 --- a/domain/src/main/java/com/tangem/domain/common/extensions/Blockchain.kt +++ b/domain/src/main/java/com/tangem/domain/common/extensions/Blockchain.kt @@ -40,6 +40,7 @@ fun Blockchain.Companion.fromNetworkId(networkId: String): Blockchain? { "xdai" -> Blockchain.Gnosis "polkadot" -> Blockchain.Polkadot "polkadot/test" -> Blockchain.PolkadotTestnet + "kusama" -> Blockchain.Kusama else -> null } } @@ -84,6 +85,7 @@ fun Blockchain.toNetworkId(): String { Blockchain.Gnosis -> "xdai" Blockchain.Polkadot -> "polkadot" Blockchain.PolkadotTestnet -> "polkadot/test" + Blockchain.Kusama -> "kusama" } } @@ -101,15 +103,16 @@ fun Blockchain.toCoinId(): String { Blockchain.Avalanche, Blockchain.AvalancheTestnet -> "avalanche-2" Blockchain.Solana, Blockchain.SolanaTestnet -> "solana" Blockchain.Fantom, Blockchain.FantomTestnet -> "fantom" + Blockchain.Tron, Blockchain.TronTestnet -> "tron" + Blockchain.Polkadot, Blockchain.PolkadotTestnet -> "polkadot" Blockchain.Ducatus -> "ducatus" Blockchain.Litecoin -> "litecoin" Blockchain.RSK -> "rootstock" Blockchain.Tezos -> "tezos" Blockchain.XRP -> "ripple" Blockchain.Dogecoin -> "dogecoin" - Blockchain.Tron, Blockchain.TronTestnet -> "tron" Blockchain.Gnosis -> "xdai" - Blockchain.Polkadot, Blockchain.PolkadotTestnet -> "polkadot" + Blockchain.Kusama -> "kusama" Blockchain.Unknown -> "unknown" } } \ No newline at end of file From a67df03d6306980a140f0752d8aad418c9ecbc2f Mon Sep 17 00:00:00 2001 From: Tangem Date: Sat, 10 Sep 2022 13:31:45 +0300 Subject: [PATCH 5/6] Updated on 2026-08-14 --- .../domain/features/BlockchainNetworkIdTests.kt | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/domain/src/test/java/com/tangem/domain/features/BlockchainNetworkIdTests.kt b/domain/src/test/java/com/tangem/domain/features/BlockchainNetworkIdTests.kt index 9982a61c80..ff5079bdf4 100644 --- a/domain/src/test/java/com/tangem/domain/features/BlockchainNetworkIdTests.kt +++ b/domain/src/test/java/com/tangem/domain/features/BlockchainNetworkIdTests.kt @@ -6,24 +6,18 @@ import com.tangem.domain.common.extensions.fromNetworkId import com.tangem.domain.common.extensions.toNetworkId import org.junit.Test -/** - * Example local unit test, which will execute on the development machine (host). - * - * See [testing documentation](http://d.android.com/tools/testing). - */ class BlockchainNetworkIdTests { @Test fun checkAppropriateImplementationForNetworkIds() { val unimplementedIds = Blockchain.values() .toMutableList() - .apply { remove(Blockchain.Unknown) }.map { - val networkId = it.toNetworkId() - networkId to Blockchain.fromNetworkId(networkId) - }.filter { it.second == null } + .apply { remove(Blockchain.Unknown) } + .map { it to Blockchain.fromNetworkId(it.toNetworkId()) } + .filter { it.second == null } if (unimplementedIds.isEmpty()) return - val message = unimplementedIds.joinToString("\n") { it.first } + val message = unimplementedIds.joinToString("\n") { it.first.fullName } Truth.assert_().withMessage(message).fail() } } \ No newline at end of file From d835307af9a5f0606ab30fd2000046067ab01733 Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 15 Sep 2022 11:36:29 +0300 Subject: [PATCH 6/6] Updated on 2026-08-14 --- ...BlockchainNetworkIdTests.kt => BlockchainTests.kt} | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) rename domain/src/test/java/com/tangem/domain/features/{BlockchainNetworkIdTests.kt => BlockchainTests.kt} (60%) diff --git a/domain/src/test/java/com/tangem/domain/features/BlockchainNetworkIdTests.kt b/domain/src/test/java/com/tangem/domain/features/BlockchainTests.kt similarity index 60% rename from domain/src/test/java/com/tangem/domain/features/BlockchainNetworkIdTests.kt rename to domain/src/test/java/com/tangem/domain/features/BlockchainTests.kt index ff5079bdf4..b8291b93ac 100644 --- a/domain/src/test/java/com/tangem/domain/features/BlockchainNetworkIdTests.kt +++ b/domain/src/test/java/com/tangem/domain/features/BlockchainTests.kt @@ -6,18 +6,15 @@ import com.tangem.domain.common.extensions.fromNetworkId import com.tangem.domain.common.extensions.toNetworkId import org.junit.Test -class BlockchainNetworkIdTests { +class BlockchainTests { @Test - fun checkAppropriateImplementationForNetworkIds() { + fun allNetworkIdsAreImplemented() { val unimplementedIds = Blockchain.values() .toMutableList() .apply { remove(Blockchain.Unknown) } .map { it to Blockchain.fromNetworkId(it.toNetworkId()) } - .filter { it.second == null } + .mapNotNull { if(it.second == null) it.first else null } - if (unimplementedIds.isEmpty()) return - - val message = unimplementedIds.joinToString("\n") { it.first.fullName } - Truth.assert_().withMessage(message).fail() + Truth.assertThat(unimplementedIds).isEmpty() } } \ No newline at end of file