Updated on 2026-08-14
This commit is contained in:
parent
d1c77b00cf
commit
7805d46f92
48 changed files with 279 additions and 260 deletions
|
|
@ -42,8 +42,16 @@ internal class BuyExchangeService(
|
|||
cryptoCurrencyName: String,
|
||||
fiatCurrencyName: String,
|
||||
walletAddress: String,
|
||||
isDarkTheme: Boolean,
|
||||
): String? {
|
||||
return currentService.getUrl(action, blockchain, cryptoCurrencyName, fiatCurrencyName, walletAddress)
|
||||
return currentService.getUrl(
|
||||
action,
|
||||
blockchain,
|
||||
cryptoCurrencyName,
|
||||
fiatCurrencyName,
|
||||
walletAddress,
|
||||
isDarkTheme,
|
||||
)
|
||||
}
|
||||
|
||||
override fun getSellCryptoReceiptUrl(action: CurrencyExchangeManager.Action, transactionId: String): String? {
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ class CurrencyExchangeManager(
|
|||
cryptoCurrencyName: CryptoCurrencyName,
|
||||
fiatCurrencyName: String,
|
||||
walletAddress: String,
|
||||
isDarkTheme: Boolean,
|
||||
): String? {
|
||||
if (blockchain.isTestnet()) return blockchain.getTestnetTopUpUrl()
|
||||
|
||||
|
|
@ -60,6 +61,7 @@ class CurrencyExchangeManager(
|
|||
cryptoCurrencyName,
|
||||
fiatCurrencyName,
|
||||
walletAddress,
|
||||
isDarkTheme,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ interface ExchangeService : Feature, Exchanger, ExchangeUrlBuilder {
|
|||
cryptoCurrencyName: String,
|
||||
fiatCurrencyName: String,
|
||||
walletAddress: String,
|
||||
isDarkTheme: Boolean,
|
||||
): String? = null
|
||||
|
||||
override fun getSellCryptoReceiptUrl(
|
||||
|
|
@ -52,12 +53,14 @@ interface ExchangeRules : Feature, Exchanger {
|
|||
}
|
||||
|
||||
interface ExchangeUrlBuilder {
|
||||
@Suppress("LongParameterList")
|
||||
fun getUrl(
|
||||
action: CurrencyExchangeManager.Action,
|
||||
blockchain: Blockchain,
|
||||
cryptoCurrencyName: String,
|
||||
fiatCurrencyName: String,
|
||||
walletAddress: String,
|
||||
isDarkTheme: Boolean,
|
||||
): String?
|
||||
|
||||
fun getSellCryptoReceiptUrl(action: CurrencyExchangeManager.Action, transactionId: String): String?
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ internal class MercuryoService(private val environment: MercuryoEnvironment) : E
|
|||
cryptoCurrencyName: CryptoCurrencyName,
|
||||
fiatCurrencyName: String,
|
||||
walletAddress: String,
|
||||
isDarkTheme: Boolean,
|
||||
): String {
|
||||
if (action == CurrencyExchangeManager.Action.Sell) throw UnsupportedOperationException()
|
||||
|
||||
|
|
@ -92,6 +93,7 @@ internal class MercuryoService(private val environment: MercuryoEnvironment) : E
|
|||
.appendQueryParameter("signature", signature(walletAddress))
|
||||
.appendQueryParameter("fix_currency", "true")
|
||||
.appendQueryParameter("return_url", ExchangeUrlBuilder.SUCCESS_URL)
|
||||
if (isDarkTheme) builder.appendQueryParameter("theme", "1inch")
|
||||
|
||||
return builder.build().toString()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ class MoonPayService(
|
|||
cryptoCurrencyName: CryptoCurrencyName,
|
||||
fatCurrency: String,
|
||||
walletAddress: String,
|
||||
isDarkTheme: Boolean,
|
||||
): String {
|
||||
if (action == CurrencyExchangeManager.Action.Buy) throw UnsupportedOperationException()
|
||||
|
||||
|
|
@ -112,6 +113,7 @@ class MoonPayService(
|
|||
.appendQueryParameter("baseCurrencyCode", cryptoCurrencyName)
|
||||
.appendQueryParameter("refundWalletAddress", walletAddress)
|
||||
.appendQueryParameter("redirectURL", "tangem://sell-request.tangem.com")
|
||||
if (isDarkTheme) uri.appendQueryParameter("theme", "dark")
|
||||
|
||||
val originalQuery = uri.build().encodedQuery ?: uri.build().toString()
|
||||
val signature = createSignature(originalQuery)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue