public static async Task <TransferResult> ExchangeThrowFail(this ITransferService src, string assetId, string sourceAddress, string destAddress, decimal?amount = null) { TransferResult transferResult = await src.ExecuteAsync(assetId, sourceAddress, destAddress, amount); foreach (var transactionResult in transferResult.Transactions) { if (transactionResult.ErrorType == TransactionErrorType.NotEnoughFunds) { throw new InsufficientFundsException(sourceAddress, assetId); } } if (!transferResult.HasSuccess()) { throw new ExchangeOperationFailedException(transferResult.GetErrors()); } if (transferResult.HasError()) { throw new ExchangeOperationPartiallyFailedException(transferResult.GetErrors()); } return(transferResult); }
public static async Task <TransferResult> SettleThrowFail(this ITransferService src, string assetId, string sourceAddress, string destAddress, decimal?amount = null) { TransferResult transferResult = await src.ExecuteAsync(assetId, sourceAddress, destAddress, amount); if (!transferResult.HasSuccess()) { throw new SettlementOperationFailedException(transferResult.GetErrors()); } if (transferResult.HasError()) { throw new SettlementOperationPartiallyFailedException(transferResult.GetErrors()); } return(transferResult); }