Updated on 2026-08-14
This commit is contained in:
parent
9c7a2f3ab1
commit
77cd7c78ee
3 changed files with 42 additions and 1 deletions
|
|
@ -56,6 +56,7 @@ class BitcoinAddressService(private val blockchain: Blockchain) : AddressService
|
|||
Blockchain.Bitcoin -> LegacyAddress.fromBase58(MainNetParams(), address)
|
||||
Blockchain.BitcoinTestnet -> LegacyAddress.fromBase58(TestNet3Params(), address)
|
||||
Blockchain.Litecoin -> LegacyAddress.fromBase58(LitecoinMainNetParams(), address)
|
||||
Blockchain.Ducatus -> LegacyAddress.fromBase58(DucatusMainNetParams(), address)
|
||||
else -> return false
|
||||
}
|
||||
true
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
package com.tangem.blockchain.blockchains.ducatus
|
||||
|
||||
import com.google.common.truth.Truth
|
||||
import com.tangem.blockchain.blockchains.bitcoin.BitcoinAddressService
|
||||
import com.tangem.blockchain.common.Blockchain
|
||||
import com.tangem.common.extensions.hexToBytes
|
||||
import org.junit.Test
|
||||
|
||||
class DucatusAddressTest {
|
||||
|
||||
private val addressService = BitcoinAddressService(Blockchain.Ducatus)
|
||||
|
||||
@Test
|
||||
fun makeAddressFromCorrectPublicKey() {
|
||||
val walletPublicKey = "0485D520C8B907F0BC5E03FCBBAC212CCD270764BBFF4990A28653A2FB0D656C342DF143C4D52C43582289E20A81D5D014C1384A1FFFEA1D121903AD7ED35A01EA".hexToBytes()
|
||||
val expected = "Ly3SZetcgr5gkZMwiNwVrts2z2r3jYieAG"
|
||||
|
||||
Truth.assertThat(addressService.makeAddress(walletPublicKey))
|
||||
.isEqualTo(expected)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun validateCorrectAddress() {
|
||||
val address = "Ly3SZetcgr5gkZMwiNwVrts2z2r3jYieAG"
|
||||
Truth.assertThat(addressService.validate(address))
|
||||
.isTrue()
|
||||
}
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ import com.tangem.blockchain.blockchains.binance.BinanceWalletManager
|
|||
import com.tangem.blockchain.blockchains.bitcoin.BitcoinWalletManager
|
||||
import com.tangem.blockchain.blockchains.bitcoincash.BitcoinCashWalletManager
|
||||
import com.tangem.blockchain.blockchains.cardano.CardanoWalletManager
|
||||
import com.tangem.blockchain.blockchains.ducatus.DucatusWalletManager
|
||||
import com.tangem.blockchain.blockchains.ethereum.EthereumWalletManager
|
||||
import com.tangem.blockchain.blockchains.litecoin.LitecoinWalletManager
|
||||
import com.tangem.blockchain.blockchains.stellar.StellarWalletManager
|
||||
|
|
@ -107,7 +108,7 @@ internal class WalletManagerFactoryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun createLTezosWalletManager() {
|
||||
fun createTezosWalletManager() {
|
||||
val data = "0108BB00000000000080200754414E47454D00020102800A322E3432642053444B0003410436CFC5D0A11353AE6AFEEDC84A2D02B2635C044DEEE47F99913072B8D166D14E557230AC5FB5272F1A0E523332CCE1A744B51DB53102FF7D3FDE023DC3477C460A04041E76310C638102FFFF8A0101820407E40514830B54414E47454D2053444B00840554455A4F538640C752685B29333CFB0DB0A7347579A0AE763F2B5C4BB09FD68E0B81A06CD01EC51347001732815A3ECFFCD78DDE4E53877581B9E4914B069570629D0C40A771B93041045F16BD1D2EAFE463E62A335A09E6B2BBCBD04452526885CB679FC4D27AF1BD22F553C7DEEFB54FD3D4F361D14E6DC3F11B7D4EA183250A60720EBDF9E110CD26050865643235353139000804000186A0070100602098E0E504F3A5FDE704400302ABB0A2EFB0DF0F95C166C91D7F207DEDCE10CBA362040001869F6304000000010F01009000"
|
||||
val responseApdu = ResponseApdu(data.hexToBytes())
|
||||
val card = ReadCommand().deserialize(SessionEnvironment(), responseApdu)
|
||||
|
|
@ -116,4 +117,15 @@ internal class WalletManagerFactoryTest {
|
|||
Truth.assertThat(walletManager)
|
||||
.isInstanceOf(TezosWalletManager::class.java)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun createDucatusWalletManager() {
|
||||
val data = "0108BB00000000000098200754414E47454D00020102800A322E3432642053444B000341041B5FD7C590938E836B388B996AE451FDED54F625FF2CF05E26E5AADF6F690AEF125E3D0F23CB6B8D1F78040DF6F71B40D098F2D8BE504DDEE2E1F99BEADD90500A04041E76310C618102FFFF8A0101820407E40515830B54414E47454D2053444B00840344554386401B453C10A092A3448FA83CAFD4FC3D7EB5EA1BBBDD6A020CAAC8CED36BB2661F41EF0B0C7418214F670DFE1200DCE18597158119BEF6CC52A4FF3B7E021A53B93041045F16BD1D2EAFE463E62A335A09E6B2BBCBD04452526885CB679FC4D27AF1BD22F553C7DEEFB54FD3D4F361D14E6DC3F11B7D4EA183250A60720EBDF9E110CD26050A736563703235366B31000804000186A007010060410485D520C8B907F0BC5E03FCBBAC212CCD270764BBFF4990A28653A2FB0D656C342DF143C4D52C43582289E20A81D5D014C1384A1FFFEA1D121903AD7ED35A01EA62040001869D6304000000030F01009000"
|
||||
val responseApdu = ResponseApdu(data.hexToBytes())
|
||||
val card = ReadCommand().deserialize(SessionEnvironment(), responseApdu)
|
||||
val walletManager = WalletManagerFactory.makeWalletManager(card)
|
||||
|
||||
Truth.assertThat(walletManager)
|
||||
.isInstanceOf(DucatusWalletManager::class.java)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue