Skip to content

Instantly share code, notes, and snippets.

@StefH
Last active September 10, 2019 17:21
Show Gist options
  • Save StefH/f0c74235f5b972cb8b4ae7ae1a7136a0 to your computer and use it in GitHub Desktop.
Save StefH/f0c74235f5b972cb8b4ae7ae1a7136a0 to your computer and use it in GitHub Desktop.
AzureFunction DeploySmartContract
[FunctionName("QuerySmartContractFunction")]
public async Task<IActionResult> RunQueryFunctionAsync(
[HttpTrigger(AuthorizationLevel.Function, "post")]HttpRequest req)
{
_logger.LogInformation("RunDeployContract");
string body = await req.ReadAsStringAsync();
var request = JsonConvert.DeserializeObject<SmartContractDeployRequest>(body);
try
{
var result = await _service.DeployContractAsync(request);
return new JsonResult(result, JsonSerializerSettings);
}
catch (Exception exception)
{
_logger.LogError(exception, "RunDeployContract failed");
return new JsonResult(new { exception.Message }, JsonSerializerSettings);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment