2019-12-24 08:20:44 +01:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using NBitcoin;
|
|
|
|
using NBXplorer;
|
|
|
|
using NBXplorer.Models;
|
|
|
|
|
|
|
|
namespace BTCPayServer
|
|
|
|
{
|
2020-01-21 14:28:13 +01:00
|
|
|
public class ElementsBTCPayNetwork : BTCPayNetwork
|
2019-12-24 08:20:44 +01:00
|
|
|
{
|
|
|
|
public string NetworkCryptoCode { get; set; }
|
|
|
|
public uint256 AssetId { get; set; }
|
2019-12-29 17:08:30 +01:00
|
|
|
public override bool ReadonlyWallet { get; set; } = true;
|
2019-12-24 08:20:44 +01:00
|
|
|
|
2020-01-21 14:28:13 +01:00
|
|
|
public override IEnumerable<(MatchedOutput matchedOutput, OutPoint outPoint)> GetValidOutputs(
|
|
|
|
NewTransactionEvent evtOutputs)
|
2019-12-24 08:20:44 +01:00
|
|
|
{
|
2020-01-21 14:28:13 +01:00
|
|
|
return evtOutputs.Outputs.Where(output =>
|
2019-12-24 08:20:44 +01:00
|
|
|
output.Value is AssetMoney assetMoney && assetMoney.AssetId == AssetId).Select(output =>
|
|
|
|
{
|
|
|
|
var outpoint = new OutPoint(evtOutputs.TransactionData.TransactionHash, output.Index);
|
|
|
|
return (output, outpoint);
|
|
|
|
});
|
|
|
|
}
|
2020-01-16 07:01:01 +01:00
|
|
|
|
2020-01-21 14:28:13 +01:00
|
|
|
public override string GenerateBIP21(string cryptoInfoAddress, Money cryptoInfoDue)
|
2020-01-16 07:01:01 +01:00
|
|
|
{
|
|
|
|
return $"{base.GenerateBIP21(cryptoInfoAddress, cryptoInfoDue)}&assetid={AssetId}";
|
|
|
|
}
|
2019-12-24 08:20:44 +01:00
|
|
|
}
|
|
|
|
}
|