2020-12-23 06:00:38 +01:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Net.Http;
|
|
|
|
using System.Threading;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using BTCPayServer.Client.Models;
|
2024-04-04 09:31:04 +02:00
|
|
|
using Newtonsoft.Json.Linq;
|
2020-12-23 06:00:38 +01:00
|
|
|
|
2024-06-19 15:25:33 +02:00
|
|
|
namespace BTCPayServer.Client;
|
|
|
|
|
|
|
|
public partial class BTCPayServerClient
|
2020-12-23 06:00:38 +01:00
|
|
|
{
|
2024-06-19 15:25:33 +02:00
|
|
|
public virtual async Task<OnChainPaymentMethodPreviewResultData>
|
|
|
|
PreviewProposedStoreOnChainPaymentMethodAddresses(
|
|
|
|
string storeId, string paymentMethodId, string derivationScheme, int offset = 0,
|
|
|
|
int amount = 10,
|
|
|
|
CancellationToken token = default)
|
|
|
|
{
|
2024-09-12 08:19:10 +02:00
|
|
|
return await SendHttpRequest<UpdatePaymentMethodRequest, OnChainPaymentMethodPreviewResultData>($"api/v1/stores/{storeId}/payment-methods/{paymentMethodId}/wallet/preview",
|
2024-06-19 15:25:33 +02:00
|
|
|
new Dictionary<string, object> { { "offset", offset }, { "amount", amount } },
|
|
|
|
new UpdatePaymentMethodRequest { Config = JValue.CreateString(derivationScheme) },
|
|
|
|
HttpMethod.Post, token);
|
|
|
|
}
|
2024-04-04 09:31:04 +02:00
|
|
|
|
2024-06-19 15:25:33 +02:00
|
|
|
public virtual async Task<OnChainPaymentMethodPreviewResultData> PreviewStoreOnChainPaymentMethodAddresses(
|
|
|
|
string storeId, string paymentMethodId, int offset = 0, int amount = 10,
|
|
|
|
CancellationToken token = default)
|
|
|
|
{
|
2024-09-12 08:19:10 +02:00
|
|
|
return await SendHttpRequest<OnChainPaymentMethodPreviewResultData>($"api/v1/stores/{storeId}/payment-methods/{paymentMethodId}/wallet/preview",
|
2024-06-19 15:25:33 +02:00
|
|
|
new Dictionary<string, object> { { "offset", offset }, { "amount", amount } }, HttpMethod.Get, token);
|
|
|
|
}
|
2024-04-04 09:31:04 +02:00
|
|
|
|
2024-06-19 15:25:33 +02:00
|
|
|
public virtual async Task<GenerateOnChainWalletResponse> GenerateOnChainWallet(string storeId,
|
|
|
|
string paymentMethodId, GenerateOnChainWalletRequest request,
|
|
|
|
CancellationToken token = default)
|
|
|
|
{
|
2024-09-12 08:19:10 +02:00
|
|
|
return await SendHttpRequest<GenerateOnChainWalletResponse>($"api/v1/stores/{storeId}/payment-methods/{paymentMethodId}/wallet/generate", request, HttpMethod.Post, token);
|
2024-06-19 15:25:33 +02:00
|
|
|
}
|
2024-04-04 09:31:04 +02:00
|
|
|
|
2020-12-23 06:00:38 +01:00
|
|
|
}
|