mirror of
https://github.com/aljazceru/BTCPayServerPlugins.git
synced 2025-12-18 08:04:26 +01:00
upd bl
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Product>Blink</Product>
|
<Product>Blink</Product>
|
||||||
<Description>Brink Lightning support</Description>
|
<Description>Brink Lightning support</Description>
|
||||||
<Version>1.0.1</Version>
|
<Version>1.0.2</Version>
|
||||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||||
<RootNamespace>BTCPayServer.Plugins.Blink</RootNamespace>
|
<RootNamespace>BTCPayServer.Plugins.Blink</RootNamespace>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ public class BlinkLightningClient : ILightningClient
|
|||||||
private readonly string _apiKey;
|
private readonly string _apiKey;
|
||||||
private readonly Uri _apiEndpoint;
|
private readonly Uri _apiEndpoint;
|
||||||
public string? WalletId { get; set; }
|
public string? WalletId { get; set; }
|
||||||
|
|
||||||
|
public string? WalletCurrency { get; set; }
|
||||||
|
|
||||||
private readonly Network _network;
|
private readonly Network _network;
|
||||||
private readonly NBXplorerDashboard _nbXplorerDashboard;
|
private readonly NBXplorerDashboard _nbXplorerDashboard;
|
||||||
private readonly GraphQLHttpClient _client;
|
private readonly GraphQLHttpClient _client;
|
||||||
@@ -301,8 +304,8 @@ query Transactions($walletId: WalletId!) {
|
|||||||
var reques = new GraphQLRequest
|
var reques = new GraphQLRequest
|
||||||
{
|
{
|
||||||
Query = @"
|
Query = @"
|
||||||
mutation LnInvoiceCreate($input: LnInvoiceCreateInput!) {
|
mutation lnInvoiceCreateOnBehalfOfRecipient($input: LnInvoiceCreateOnBehalfOfRecipientInput!) {
|
||||||
lnInvoiceCreate(input: $input) {
|
lnInvoiceCreateOnBehalfOfRecipient(input: $input) {
|
||||||
invoice {
|
invoice {
|
||||||
createdAt
|
createdAt
|
||||||
paymentHash
|
paymentHash
|
||||||
@@ -310,7 +313,6 @@ mutation LnInvoiceCreate($input: LnInvoiceCreateInput!) {
|
|||||||
paymentSecret
|
paymentSecret
|
||||||
paymentStatus
|
paymentStatus
|
||||||
satoshis
|
satoshis
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}",
|
}",
|
||||||
@@ -319,8 +321,9 @@ mutation LnInvoiceCreate($input: LnInvoiceCreateInput!) {
|
|||||||
{
|
{
|
||||||
input = new
|
input = new
|
||||||
{
|
{
|
||||||
walletId = WalletId,
|
recipientWalletId = WalletId,
|
||||||
memo = createInvoiceRequest.Description?? createInvoiceRequest.DescriptionHash?.ToString(),
|
memo = createInvoiceRequest.Description,
|
||||||
|
descriptionHash = createInvoiceRequest.DescriptionHash?.ToString(),
|
||||||
amount = (long)createInvoiceRequest.Amount.ToUnit(LightMoneyUnit.Satoshi),
|
amount = (long)createInvoiceRequest.Amount.ToUnit(LightMoneyUnit.Satoshi),
|
||||||
expiresIn = (int)createInvoiceRequest.Expiry.TotalMinutes
|
expiresIn = (int)createInvoiceRequest.Expiry.TotalMinutes
|
||||||
|
|
||||||
@@ -543,6 +546,7 @@ query GetWallet($walletId: WalletId!) {
|
|||||||
|
|
||||||
var response = await _client.SendQueryAsync<dynamic>(request, cancellation);
|
var response = await _client.SendQueryAsync<dynamic>(request, cancellation);
|
||||||
|
|
||||||
|
WalletCurrency = response.Data.me.defaultAccount.walletById.walletCurrency;
|
||||||
if (response.Data.me.defaultAccount.walletById.walletCurrency == "BTC")
|
if (response.Data.me.defaultAccount.walletById.walletCurrency == "BTC")
|
||||||
{
|
{
|
||||||
return new LightningNodeBalance()
|
return new LightningNodeBalance()
|
||||||
@@ -556,8 +560,6 @@ query GetWallet($walletId: WalletId!) {
|
|||||||
|
|
||||||
return new LightningNodeBalance();
|
return new LightningNodeBalance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public async Task<PayResponse> Pay(PayInvoiceParams payParams,
|
public async Task<PayResponse> Pay(PayInvoiceParams payParams,
|
||||||
CancellationToken cancellation = new CancellationToken())
|
CancellationToken cancellation = new CancellationToken())
|
||||||
|
|||||||
@@ -109,6 +109,12 @@ public class BlinkLightningConnectionStringHandler : ILightningConnectionStringH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
bclient.GetBalance().GetAwaiter().GetResult();
|
bclient.GetBalance().GetAwaiter().GetResult();
|
||||||
|
if (!bclient.WalletCurrency.Equals("btc", StringComparison.InvariantCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
error = "Cannot use a non BTC denominated wallet";
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user