Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AND-9157 Fact0rn support empty classes #844

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.tangem.blockchain.blockchains.factorn

import com.tangem.blockchain.common.address.AddressService
import com.tangem.common.card.EllipticCurve

internal class Fact0rnAddressService : AddressService() {

override fun makeAddress(walletPublicKey: ByteArray, curve: EllipticCurve?): String {
TODO("Not yet implemented")
}

override fun validate(address: String): Boolean {
TODO("Not yet implemented")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.tangem.blockchain.blockchains.factorn

import com.tangem.blockchain.common.Blockchain
import com.tangem.blockchain.common.network.providers.OnlyPublicProvidersBuilder
import com.tangem.blockchain.common.network.providers.ProviderType
import com.tangem.blockchain.network.electrum.ElectrumNetworkProvider
import com.tangem.blockchain.network.electrum.ElectrumNetworkProviderFactory

internal class Fact0rnProvidersBuilder(
override val providerTypes: List<ProviderType>,
) : OnlyPublicProvidersBuilder<ElectrumNetworkProvider>(providerTypes) {

override fun createProvider(url: String, blockchain: Blockchain): ElectrumNetworkProvider {
return ElectrumNetworkProviderFactory.create(
wssUrl = url,
blockchain = blockchain,
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.tangem.blockchain.blockchains.factorn

import com.tangem.blockchain.blockchains.factorn.network.Fact0rnNetworkService
import com.tangem.blockchain.common.*
import com.tangem.blockchain.common.transaction.TransactionFee
import com.tangem.blockchain.common.transaction.TransactionSendResult
import com.tangem.blockchain.extensions.Result
import com.tangem.blockchain.network.electrum.ElectrumNetworkProvider

internal class Fact0rnWalletManager(
wallet: Wallet,
networkProviders: List<ElectrumNetworkProvider>,
) : WalletManager(wallet) {

private val networkService = Fact0rnNetworkService(networkProviders)

override val currentHost: String get() = networkService.baseUrl

override suspend fun updateInternal() {
TODO("Not yet implemented")
}

override suspend fun send(
transactionData: TransactionData,
signer: TransactionSigner,
): Result<TransactionSendResult> {
TODO("Not yet implemented")
}

override suspend fun getFee(amount: Amount, destination: String): Result<TransactionFee> {
TODO("Not yet implemented")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.tangem.blockchain.blockchains.factorn.network

import com.tangem.blockchain.common.NetworkProvider
import com.tangem.blockchain.network.MultiNetworkProvider
import com.tangem.blockchain.network.electrum.ElectrumNetworkProvider

internal class Fact0rnNetworkService(providers: List<ElectrumNetworkProvider>) : NetworkProvider {

override val baseUrl: String
get() = multiProvider.currentProvider.baseUrl

private val multiProvider = MultiNetworkProvider(providers)
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import com.tangem.blockchain.blockchains.chia.ChiaAddressService
import com.tangem.blockchain.blockchains.decimal.DecimalAddressService
import com.tangem.blockchain.blockchains.ethereum.Chain
import com.tangem.blockchain.blockchains.ethereum.EthereumAddressService
import com.tangem.blockchain.blockchains.factorn.Fact0rnAddressService
import com.tangem.blockchain.blockchains.hedera.HederaAddressService
import com.tangem.blockchain.blockchains.kaspa.KaspaAddressService
import com.tangem.blockchain.blockchains.koinos.KoinosAddressService
Expand Down Expand Up @@ -145,6 +146,7 @@ enum class Blockchain(
MoonriverTestnet("moonriver/test", "MOVR", "Moonriver Testnet"),
Mantle("mantle", "MNT", "Mantle"),
MantleTestnet("mantle/test", "MNT", "Mantle Testnet"),
Fact0rn("fact0rn", "FACT", "Fact0rn"),
Flare("flare", "FLR", "Flare"),
FlareTestnet("flare/test", "FLR", "Flare Testnet"),
Taraxa("taraxa", "TARA", "Taraxa"),
Expand Down Expand Up @@ -215,6 +217,7 @@ enum class Blockchain(
Aptos, AptosTestnet,
Hedera, HederaTestnet,
Radiant,
Fact0rn,
Koinos, KoinosTestnet,
InternetComputer,
-> 8
Expand Down Expand Up @@ -388,6 +391,7 @@ enum class Blockchain(
Nexa, NexaTestnet -> NexaAddressService(this.isTestnet())
Koinos, KoinosTestnet -> KoinosAddressService()
Radiant -> RadiantAddressService()
Fact0rn -> Fact0rnAddressService()
Casper, CasperTestnet -> CasperAddressService()
Unknown -> error("unsupported blockchain")
}
Expand Down Expand Up @@ -537,6 +541,7 @@ enum class Blockchain(
Manta, MantaTestnet,
PolygonZkEVM, PolygonZkEVMTestnet,
Radiant,
Fact0rn,
Base, BaseTestnet,
Moonriver, MoonriverTestnet,
Mantle, MantleTestnet,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ class WalletManagerFactory(
Blockchain.Hedera, Blockchain.HederaTestnet -> HederaWalletManagerAssembly(dataStorage, accountCreator)
Blockchain.Nexa, Blockchain.NexaTestnet -> NexaWalletManagerAssembly
Blockchain.Radiant -> RadiantWalletManagerAssembly
Blockchain.Fact0rn -> Fact0rnWalletManagerAssembly
Blockchain.Koinos, Blockchain.KoinosTestnet -> KoinosWalletManagerAssembly
Blockchain.Filecoin -> FilecoinWalletManagerAssembly
Blockchain.Sei, Blockchain.SeiTestnet -> SeiWalletManagerAssembly
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class EstimationFeeAddressFactory {
-> "RT5qKgXdmh9pqtz71cgfL834VfeXFVH1sG"
Blockchain.Solana -> "9wuDg6Y4H4j86Kg5aUGrUeaBa3sAUzjMs37KbeGFnRuM"
Blockchain.Radiant -> "1K8jBuCKzuwvFCjL7Qpqq69k1hnVXJ31Nc"
Blockchain.Fact0rn -> TODO("Fact0rn")
// EVM-like
Blockchain.EthereumClassic, Blockchain.EthereumClassicTestnet ->
"0xc49722a6f4Fe5A1347710dEAAa1fafF4c275689b"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.tangem.blockchain.common.assembly.impl

import com.tangem.blockchain.blockchains.factorn.Fact0rnProvidersBuilder
import com.tangem.blockchain.blockchains.factorn.Fact0rnWalletManager
import com.tangem.blockchain.common.assembly.WalletManagerAssembly
import com.tangem.blockchain.common.assembly.WalletManagerAssemblyInput

internal object Fact0rnWalletManagerAssembly : WalletManagerAssembly<Fact0rnWalletManager>() {

override fun make(input: WalletManagerAssemblyInput): Fact0rnWalletManager {
return with(input.wallet) {
Fact0rnWalletManager(
wallet = this,
networkProviders = Fact0rnProvidersBuilder(input.providerTypes).build(blockchain),
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ object DerivationConfigV1 : DerivationConfig() {
Blockchain.NexaTestnet,
-> mapOf(AddressType.Default to DerivationPath("m/44'/29223'/0'/0/0"))
Blockchain.Radiant -> mapOf(AddressType.Default to DerivationPath("m/44'/512'/0'/0/0"))
Blockchain.Fact0rn -> mapOf(AddressType.Default to DerivationPath("m/44'/42069'/0'/0/0"))
Blockchain.Koinos,
Blockchain.KoinosTestnet,
-> mapOf(AddressType.Default to DerivationPath("m/44'/659'/0'/0/0"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ object DerivationConfigV2 : DerivationConfig() {
Blockchain.NexaTestnet,
-> mapOf(AddressType.Default to DerivationPath("m/44'/29223'/0'/0/0"))
Blockchain.Radiant -> mapOf(AddressType.Default to DerivationPath("m/44'/512'/0'/0/0"))
Blockchain.Fact0rn -> mapOf(AddressType.Default to DerivationPath("m/44'/42069'/0'/0/0"))
Blockchain.Koinos,
Blockchain.KoinosTestnet,
-> mapOf(AddressType.Default to DerivationPath("m/44'/659'/0'/0/0"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ object DerivationConfigV3 : DerivationConfig() {
Blockchain.NexaTestnet,
-> mapOf(AddressType.Default to DerivationPath("m/44'/29223'/0'/0/0"))
Blockchain.Radiant -> mapOf(AddressType.Default to DerivationPath("m/44'/512'/0'/0/0"))
Blockchain.Fact0rn -> mapOf(AddressType.Default to DerivationPath("m/44'/42069'/0'/0/0"))
Blockchain.Koinos,
Blockchain.KoinosTestnet,
-> mapOf(AddressType.Default to DerivationPath("m/44'/659'/0'/0/0"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ internal object ExternalLinkProviderFactory {
Blockchain.Flare, Blockchain.FlareTestnet -> FlareExternalLinkProvider(isTestnet)
Blockchain.Taraxa, Blockchain.TaraxaTestnet -> TaraxaExternalLinkProvider(isTestnet)
Blockchain.Radiant -> RadiantExternalLinkProvider()
Blockchain.Fact0rn -> Fact0rnExternalLinkProvider()
Blockchain.Koinos, Blockchain.KoinosTestnet -> KoinosExternalLinkProvider(isTestnet)
Blockchain.Filecoin -> FilecoinExternalLinkProvider()
Blockchain.Blast, Blockchain.BlastTestnet -> BlastLinkProvider(isTestnet)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.tangem.blockchain.externallinkprovider.providers

import com.tangem.blockchain.externallinkprovider.ExternalLinkProvider
import com.tangem.blockchain.externallinkprovider.TxExploreState

internal class Fact0rnExternalLinkProvider : ExternalLinkProvider {

override val explorerBaseUrl: String = "https://explorer.fact0rn.io/"

override fun explorerUrl(walletAddress: String, contractAddress: String?): String {
return explorerBaseUrl + "address/$walletAddress"
}

override fun getExplorerTxUrl(transactionHash: String): TxExploreState {
return TxExploreState.Url(explorerBaseUrl + "tx/$transactionHash")
}
}
2 changes: 1 addition & 1 deletion tangem-android-tools
Loading