Greenfield: Fix GetDepositAddress return type (#3790)

The local clients GetFromActionResult cannot handle the JValue return type, because it gets invoked with GetFromActionResult<string>.
This commit is contained in:
d11n
2022-05-31 12:15:38 +02:00
committed by GitHub
parent ff66e66f21
commit 46b9760179
2 changed files with 3 additions and 1 deletions

View File

@@ -160,7 +160,8 @@ namespace BTCPayServer.Controllers.Greenfield
public virtual async Task<IActionResult> GetDepositAddress(string cryptoCode, CancellationToken cancellationToken = default) public virtual async Task<IActionResult> GetDepositAddress(string cryptoCode, CancellationToken cancellationToken = default)
{ {
var lightningClient = await GetLightningClient(cryptoCode, true); var lightningClient = await GetLightningClient(cryptoCode, true);
return Ok(new JValue((await lightningClient.GetDepositAddress(cancellationToken)).ToString())); var addr = await lightningClient.GetDepositAddress(cancellationToken);
return Ok(new JValue(addr.ToString()));
} }
public virtual async Task<IActionResult> GetPayment(string cryptoCode, string paymentHash, CancellationToken cancellationToken = default) public virtual async Task<IActionResult> GetPayment(string cryptoCode, string paymentHash, CancellationToken cancellationToken = default)

View File

@@ -601,6 +601,7 @@ namespace BTCPayServer.Controllers.Greenfield
{ {
JsonResult jsonResult => (T)jsonResult.Value, JsonResult jsonResult => (T)jsonResult.Value,
OkObjectResult { Value: T res } => res, OkObjectResult { Value: T res } => res,
OkObjectResult { Value: JValue res } => res.Value<T>(),
_ => default _ => default
}; };
} }