btcpayserver/BTCPayServer/Services/Altcoins/Zcash/RPC/ZcashDaemonCallbackController.cs
hhanh00 f4153ade92
Zcash integration (#3400)
* zcash

* Use Channel instead of Queue
2022-02-14 17:04:34 +09:00

40 lines
1.1 KiB
C#

#if ALTCOINS
using BTCPayServer.Filters;
using Microsoft.AspNetCore.Mvc;
namespace BTCPayServer.Services.Altcoins.Zcash.RPC
{
[Route("[controller]")]
[OnlyIfSupportAttribute("ZEC")]
public class ZcashLikeDaemonCallbackController : Controller
{
private readonly EventAggregator _eventAggregator;
public ZcashLikeDaemonCallbackController(EventAggregator eventAggregator)
{
_eventAggregator = eventAggregator;
}
[HttpGet("block")]
public IActionResult OnBlockNotify(string hash, string cryptoCode)
{
_eventAggregator.Publish(new ZcashEvent()
{
BlockHash = hash,
CryptoCode = cryptoCode.ToUpperInvariant()
});
return Ok();
}
[HttpGet("tx")]
public IActionResult OnTransactionNotify(string hash, string cryptoCode)
{
_eventAggregator.Publish(new ZcashEvent()
{
TransactionHash = hash,
CryptoCode = cryptoCode.ToUpperInvariant()
});
return Ok();
}
}
}
#endif