Updated on 2026-08-14
This commit is contained in:
parent
e98780ff93
commit
479d142807
283 changed files with 2338 additions and 2730 deletions
|
|
@ -5,7 +5,7 @@ import com.tangem.blockchain.common.Token
|
|||
import com.tangem.common.card.EllipticCurve
|
||||
import java.math.BigDecimal
|
||||
|
||||
|
||||
@Suppress("MagicNumber")
|
||||
fun Blockchain.amountToCreateAccount(token: Token? = null): BigDecimal? {
|
||||
return when (this) {
|
||||
Blockchain.Stellar -> if (token?.symbol == NODL) BigDecimal(1.5) else BigDecimal.ONE
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ val CardDTO.isTangemWallet: Boolean
|
|||
&& firmwareVersion >= FirmwareVersion.MultiWalletAvailable
|
||||
&& !isSaltPay
|
||||
|
||||
@Suppress("UnnecessaryParentheses")
|
||||
fun CardDTO.hasSignedHashes(): Boolean {
|
||||
return wallets.any { (it.totalSignedHashes ?: 0) > 0 }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ fun WalletManagerFactory.makeWalletManagerForApp(
|
|||
curve = wallet.curve,
|
||||
)
|
||||
}
|
||||
scanResponse.card.isHdWalletAllowedByApp && (seedKey != null && derivationParams != null) -> {
|
||||
scanResponse.card.isHdWalletAllowedByApp && seedKey != null && derivationParams != null -> {
|
||||
val derivedKeys = scanResponse.derivedKeys[wallet.publicKey.toMapKey()]
|
||||
val derivationPath = when (derivationParams) {
|
||||
is DerivationParams.Default -> blockchain.derivationPath(derivationParams.style)
|
||||
|
|
@ -143,12 +143,13 @@ fun WalletManagerFactory.makeSaltPayWalletManager(
|
|||
scanResponse: ScanResponse,
|
||||
): EthereumWalletManager {
|
||||
val blockchain = scanResponse.getBlockchain()
|
||||
if (blockchain != Blockchain.SaltPay)
|
||||
throw IllegalArgumentException("WalletManager for the SaltPay can be created based only on Blockchain.SaltPay")
|
||||
if (blockchain != Blockchain.SaltPay) {
|
||||
error("WalletManager for the SaltPay can be created based only on Blockchain.SaltPay")
|
||||
}
|
||||
|
||||
val token = SaltPayWorkaround.tokenFrom(blockchain)
|
||||
val cardWallet = scanResponse.card.wallets.firstOrNull().guard {
|
||||
throw NullPointerException("SaltPay card must have one wallet at least")
|
||||
error("SaltPay card must have one wallet at least")
|
||||
}
|
||||
|
||||
return makeWalletManager(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue