mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-26 15:41:29 +01:00
* Payout Destination Handling fixes #2765 This PR: * reactivates the BIP21 support for payouts. * allows LNUrl destinations to be reusable. * allows addresses to be reused in claims as long as the other claims are in a final state * Ensure bolt amount matches the payout amount * fixes * reduce duplicate parsing of bolt * make hash the id of bolt * better bolt11 tostring * use cached payment request from lnurl
31 lines
935 B
C#
31 lines
935 B
C#
#nullable enable
|
|
using System;
|
|
using NBitcoin;
|
|
using NBitcoin.Payment;
|
|
|
|
namespace BTCPayServer.Data
|
|
{
|
|
public class UriClaimDestination : IBitcoinLikeClaimDestination
|
|
{
|
|
private readonly BitcoinUrlBuilder _bitcoinUrl;
|
|
|
|
public UriClaimDestination(BitcoinUrlBuilder bitcoinUrl)
|
|
{
|
|
if (bitcoinUrl == null)
|
|
throw new ArgumentNullException(nameof(bitcoinUrl));
|
|
if (bitcoinUrl.Address is null)
|
|
throw new ArgumentException(nameof(bitcoinUrl));
|
|
_bitcoinUrl = bitcoinUrl;
|
|
}
|
|
public BitcoinUrlBuilder BitcoinUrl => _bitcoinUrl;
|
|
|
|
public BitcoinAddress Address => _bitcoinUrl.Address;
|
|
public override string ToString()
|
|
{
|
|
return _bitcoinUrl.ToString();
|
|
}
|
|
|
|
public string Id => Address.ToString();
|
|
public decimal? Amount => _bitcoinUrl.Amount?.ToDecimal(MoneyUnit.BTC);
|
|
}
|
|
}
|