public async Task <EthereumResponse <OperationResponse> > SendTransferAsync(Guid id, string sign, IAsset asset, string fromAddress, string toAddress, decimal amount) { var response = await _ethereumApi.ApiExchangeTransferPostAsync(new TransferModel { Amount = EthServiceHelpers.ConvertToContract(amount, asset.MultiplierPower, asset.Accuracy), CoinAdapterAddress = asset.AssetAddress, ToAddress = toAddress, FromAddress = fromAddress, Id = id, Sign = sign }); var error = response as ApiException; if (error != null) { return(new EthereumResponse <OperationResponse> { Error = new ErrorResponse { Code = error.Error.Code, Message = error.Error.Message } }); } var res = response as OperationIdResponse; if (res != null) { return(new EthereumResponse <OperationResponse> { Result = new OperationResponse { OperationId = res.OperationId } }); } throw new Exception("Unknown response"); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='model'> /// </param> public static object ApiExchangeTransferPost(this IEthereumApi operations, TransferModel model = default(TransferModel)) { return(operations.ApiExchangeTransferPostAsync(model).GetAwaiter().GetResult()); }