2020-07-28 22:48:51 +02:00
|
|
|
#if ALTCOINS_RELEASE || DEBUG
|
2019-10-01 15:30:27 +09:00
|
|
|
using BTCPayServer.Filters;
|
2019-09-30 10:32:43 +02:00
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
2019-10-02 22:41:53 -05:00
|
|
|
namespace BTCPayServer.Services.Altcoins.Monero.RPC
|
2019-09-30 10:32:43 +02:00
|
|
|
{
|
|
|
|
[Route("[controller]")]
|
2019-10-01 15:30:27 +09:00
|
|
|
[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
|