mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-24 06:47:50 +01:00
Add Tests Add Index, XPub to payment data Add Note on local ETH node Fix Sync Summary and Race Condition
41 lines
1.8 KiB
C#
41 lines
1.8 KiB
C#
#if ALTCOINS
|
|
using System.Net;
|
|
using System.Net.Http;
|
|
using BTCPayServer.Contracts;
|
|
using BTCPayServer.HostedServices;
|
|
using BTCPayServer.Payments;
|
|
using BTCPayServer.Services.Altcoins.Ethereum.Payments;
|
|
using BTCPayServer.Services.Altcoins.Ethereum.Services;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Hosting;
|
|
|
|
namespace BTCPayServer.Services.Altcoins.Ethereum
|
|
{
|
|
public static class EthereumLikeExtensions
|
|
{
|
|
public const string EthereumInvoiceCheckHttpClient = "EthereumCheck";
|
|
public const string EthereumInvoiceCreateHttpClient = "EthereumCreate";
|
|
public static IServiceCollection AddEthereumLike(this IServiceCollection serviceCollection)
|
|
{
|
|
serviceCollection.AddSingleton<EthereumService>();
|
|
serviceCollection.AddSingleton<IHostedService, EthereumService>(provider => provider.GetService<EthereumService>());
|
|
serviceCollection.AddSingleton<EthereumLikePaymentMethodHandler>();
|
|
serviceCollection.AddSingleton<IPaymentMethodHandler>(provider => provider.GetService<EthereumLikePaymentMethodHandler>());
|
|
serviceCollection.AddSingleton<IStoreNavExtension, EthereumStoreNavExtension>();
|
|
serviceCollection.AddTransient<NoRedirectHttpClientHandler>();
|
|
serviceCollection.AddSingleton<ISyncSummaryProvider, EthereumSyncSummaryProvider>();
|
|
serviceCollection.AddHttpClient(EthereumInvoiceCreateHttpClient)
|
|
.ConfigurePrimaryHttpMessageHandler<NoRedirectHttpClientHandler>();
|
|
return serviceCollection;
|
|
}
|
|
}
|
|
|
|
public class NoRedirectHttpClientHandler : HttpClientHandler
|
|
{
|
|
public NoRedirectHttpClientHandler()
|
|
{
|
|
this.AllowAutoRedirect = false;
|
|
}
|
|
}
|
|
}
|
|
#endif
|