Updated on 2026-08-14
This commit is contained in:
parent
acec0b6bed
commit
f2d431f726
1 changed files with 10 additions and 7 deletions
|
|
@ -23,21 +23,21 @@ internal fun getNetwork(
|
|||
id = Network.ID(blockchain.id),
|
||||
name = blockchain.fullName,
|
||||
isTestnet = blockchain.isTestnet(),
|
||||
derivationPath = getDerivationPath(blockchain, extraDerivationPath, derivationStyleProvider),
|
||||
derivationPath = getNetworkDerivationPath(blockchain, extraDerivationPath, derivationStyleProvider),
|
||||
standardType = getNetworkStandardType(blockchain),
|
||||
)
|
||||
}
|
||||
|
||||
private fun getDerivationPath(
|
||||
private fun getNetworkDerivationPath(
|
||||
blockchain: Blockchain,
|
||||
extraDerivationPath: String?,
|
||||
derivationStyleProvider: DerivationStyleProvider,
|
||||
cardDerivationStyleProvider: DerivationStyleProvider,
|
||||
): Network.DerivationPath {
|
||||
val cardDerivationPath = getCardDerivationPath(blockchain, derivationStyleProvider)
|
||||
val defaultDerivationPath = getDefaultDerivationPath(blockchain, cardDerivationStyleProvider)
|
||||
|
||||
return when {
|
||||
cardDerivationPath.isNullOrBlank() -> Network.DerivationPath.None
|
||||
extraDerivationPath == cardDerivationPath -> Network.DerivationPath.Card(extraDerivationPath)
|
||||
defaultDerivationPath.isNullOrBlank() -> Network.DerivationPath.None
|
||||
extraDerivationPath == defaultDerivationPath -> Network.DerivationPath.Card(extraDerivationPath)
|
||||
!extraDerivationPath.isNullOrBlank() -> Network.DerivationPath.Custom(extraDerivationPath)
|
||||
else -> Network.DerivationPath.None
|
||||
}
|
||||
|
|
@ -53,6 +53,9 @@ private fun getNetworkStandardType(blockchain: Blockchain): Network.StandardType
|
|||
}
|
||||
}
|
||||
|
||||
private fun getCardDerivationPath(blockchain: Blockchain, derivationStyleProvider: DerivationStyleProvider): String? {
|
||||
private fun getDefaultDerivationPath(
|
||||
blockchain: Blockchain,
|
||||
derivationStyleProvider: DerivationStyleProvider,
|
||||
): String? {
|
||||
return blockchain.derivationPath(derivationStyleProvider.getDerivationStyle())?.rawPath
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue