mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-20 14:48:07 +01:00
Add CoinGecko to CurrencyConversionManager
This commit is contained in:
@@ -12,13 +12,13 @@ import jakarta.validation.constraints.NotNull;
|
||||
import java.net.http.HttpClient;
|
||||
import java.util.Map;
|
||||
import org.whispersystems.textsecuregcm.configuration.secrets.SecretString;
|
||||
import org.whispersystems.textsecuregcm.currency.CoinMarketCapClient;
|
||||
import org.whispersystems.textsecuregcm.currency.CoinGeckoClient;
|
||||
import org.whispersystems.textsecuregcm.currency.FixerClient;
|
||||
|
||||
@JsonTypeName("default")
|
||||
public record PaymentsServiceClientsConfiguration(@NotNull SecretString coinMarketCapApiKey,
|
||||
public record PaymentsServiceClientsConfiguration(@NotNull SecretString coinGeckoApiKey,
|
||||
@NotNull SecretString fixerApiKey,
|
||||
@NotEmpty Map<@NotBlank String, Integer> coinMarketCapCurrencyIds) implements
|
||||
@NotEmpty Map<@NotBlank String, String> coinGeckoCurrencyIds) implements
|
||||
PaymentsServiceClientsFactory {
|
||||
|
||||
@Override
|
||||
@@ -27,7 +27,7 @@ public record PaymentsServiceClientsConfiguration(@NotNull SecretString coinMark
|
||||
}
|
||||
|
||||
@Override
|
||||
public CoinMarketCapClient buildCoinMarketCapClient(final HttpClient httpClient) {
|
||||
return new CoinMarketCapClient(httpClient, coinMarketCapApiKey.value(), coinMarketCapCurrencyIds);
|
||||
public CoinGeckoClient buildCoinGeckoClient(final HttpClient httpClient) {
|
||||
return new CoinGeckoClient(httpClient, coinGeckoApiKey.value(), coinGeckoCurrencyIds);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ package org.whispersystems.textsecuregcm.configuration;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import io.dropwizard.jackson.Discoverable;
|
||||
import org.whispersystems.textsecuregcm.currency.CoinMarketCapClient;
|
||||
import org.whispersystems.textsecuregcm.currency.CoinGeckoClient;
|
||||
import org.whispersystems.textsecuregcm.currency.FixerClient;
|
||||
import java.net.http.HttpClient;
|
||||
|
||||
@@ -16,5 +16,5 @@ public interface PaymentsServiceClientsFactory extends Discoverable {
|
||||
|
||||
FixerClient buildFixerClient(final HttpClient httpClient);
|
||||
|
||||
CoinMarketCapClient buildCoinMarketCapClient(HttpClient httpClient);
|
||||
CoinGeckoClient buildCoinGeckoClient(HttpClient httpClient);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user