btcpayserver/BTCPayServer/Services/Altcoins/Monero/RPC/MoneroDaemonCallbackController.cs

41 lines
1.1 KiB
C#
Raw Normal View History

#if ALTCOINS
using BTCPayServer.Filters;
2019-09-30 10:32:43 +02:00
using Microsoft.AspNetCore.Mvc;
namespace BTCPayServer.Services.Altcoins.Monero.RPC
2019-09-30 10:32:43 +02:00
{
[Route("[controller]")]
[OnlyIfSupportAttribute("XMR")]
2019-09-30 10:32:43 +02:00
public class MoneroLikeDaemonCallbackController : Controller
{
private readonly EventAggregator _eventAggregator;
public MoneroLikeDaemonCallbackController(EventAggregator eventAggregator)
{
_eventAggregator = eventAggregator;
}
[HttpGet("block")]
public IActionResult OnBlockNotify(string hash, string cryptoCode)
{
_eventAggregator.Publish(new MoneroEvent()
{
BlockHash = hash,
CryptoCode = cryptoCode.ToUpperInvariant()
});
return Ok();
}
[HttpGet("tx")]
public IActionResult OnTransactionNotify(string hash, string cryptoCode)
{
_eventAggregator.Publish(new MoneroEvent()
{
TransactionHash = hash,
CryptoCode = cryptoCode.ToUpperInvariant()
});
return Ok();
}
}
}
2020-07-28 22:48:51 +02:00
#endif