mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-23 14:40:36 +01:00
31 lines
1.1 KiB
C#
31 lines
1.1 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using NBitcoin;
|
|
using NBXplorer;
|
|
using NBXplorer.Models;
|
|
|
|
namespace BTCPayServer
|
|
{
|
|
public class ElementsBTCPayNetwork : BTCPayNetwork
|
|
{
|
|
public string NetworkCryptoCode { get; set; }
|
|
public uint256 AssetId { get; set; }
|
|
public override bool ReadonlyWallet { get; set; } = true;
|
|
|
|
public override IEnumerable<(MatchedOutput matchedOutput, OutPoint outPoint)> GetValidOutputs(
|
|
NewTransactionEvent evtOutputs)
|
|
{
|
|
return evtOutputs.Outputs.Where(output =>
|
|
output.Value is AssetMoney assetMoney && assetMoney.AssetId == AssetId).Select(output =>
|
|
{
|
|
var outpoint = new OutPoint(evtOutputs.TransactionData.TransactionHash, output.Index);
|
|
return (output, outpoint);
|
|
});
|
|
}
|
|
|
|
public override string GenerateBIP21(string cryptoInfoAddress, Money cryptoInfoDue)
|
|
{
|
|
return $"{base.GenerateBIP21(cryptoInfoAddress, cryptoInfoDue)}&assetid={AssetId}";
|
|
}
|
|
}
|
|
}
|