public async Task <WithdrawalPlacementResult> PlaceWithdrawalAsync(WithdrawalPlacementContext context) { var api = ApiProvider.GetApi(context); var body = CreateHitBtcRequestBody(); body.Add("currency", context.Amount.Asset.ShortCode); body.Add("amount", context.Amount.ToDecimalValue()); body.Add("address", context.Address.Address); if (context.HasDescription) { body.Add("paymentId", context.Description); } if (context.HasCustomFee) { body.Add("networkFee", context.CustomFee.Value.ToDecimalValue()); } // body.Add("includeFee", ""); // Not analyzed and checked. body.Add("autoCommit", true); var rRaw = await api.WithdrawCryptoAsync(body).ConfigureAwait(false); CheckResponseErrors(rRaw); var r = rRaw.GetContent(); return(new WithdrawalPlacementResult() { WithdrawalRemoteId = r.id }); }
public async Task <WithdrawalPlacementResult> PlaceWithdrawalAsync(WithdrawalPlacementContext context) { var api = ApiProviderPrivate.GetApi(context); if (context.HasDescription) { throw new ApiResponseException("Exchange does not support tags.", this); } var body = CreatePostBody(); body.Add("method", ApiMethodsConfig[ApiMethodNamesTiLiWe.WithdrawCoin]); body.Add("coinName", context.Amount.Asset.ShortCode); body.Add("amount", context.Amount.ToDecimalValue()); body.Add("address", context.Address.Address); var r = await api.WithdrawCoinAsync(body).ConfigureAwait(false); CheckResponse(r); return(new WithdrawalPlacementResult() { WithdrawalRemoteId = r.return_.tId.ToString() }); }
public async Task <WithdrawalPlacementResult> PlaceWithdrawalAsync(WithdrawalPlacementContext context) { var api = ApiProvider.GetApi(context); var body = new Dictionary <string, object>(); if (!String.IsNullOrWhiteSpace(context.AuthenticationToken)) { body.Add("otpToken", context.AuthenticationToken); } body.Add("currency", context.Amount.Asset.ToRemoteCode(this)); body.Add("amount", context.Amount.ToDecimalValue() / ConversionRate); body.Add("address", context.Address.Address + ":" + context.Address.Tag); if (!context.HasCustomFee) { throw new ContextArgumentException("Custom fee is required for withdrawal", this); } body.Add("fee", context.CustomFee.Value.ToDecimalValue() / ConversionRate); var r = await api.RequestWithdrawalAsync(body).ConfigureAwait(false); return(new WithdrawalPlacementResult() { WithdrawalRemoteId = r.transactID }); }
public async Task <WithdrawalPlacementResult> PlaceWithdrawalAsync(WithdrawalPlacementContext context) { var api = ApiProvider.GetApi(context); var body = new CryptopiaSchema.SubmitWithdrawRequest { Address = context.Address.Address, Amount = context.Amount, Currency = context.Amount.Asset.ToRemoteCode(this), PaymentId = context.Description }; var rRaw = await api.SubmitWithdrawAsync(body).ConfigureAwait(false); CheckCryptopiaResponseErrors(rRaw); var r = rRaw.GetContent(); if (!r.Data.HasValue) { throw new ApiResponseException("Remote withdrawal ID is not returned", this); } return(new WithdrawalPlacementResult() { WithdrawalRemoteId = r.Data.ToString() }); }
private async Task <Response <CoinmateSchema.WithdrawalRequestResponse> > SubmitWithdrawalRequestAsync( WithdrawalPlacementContext context) { var api = ApiProvider.GetApi(context); var body = new Dictionary <string, object> { { "coinName", context.Amount.Asset.ShortCode }, { "amount", context.Amount.ToDecimalValue() }, { "address", context.Address.Address } }; if (context.Amount.Asset.Equals(Asset.Btc)) { return(await api.SubmitWithdrawRequestBitcoinAsync(body).ConfigureAwait(false)); } if (context.Amount.Asset.Equals(Asset.Ltc)) { return(await api.SubmitWithdrawRequestLitecoinAsync(body).ConfigureAwait(false)); } if (context.Amount.Asset.Equals(Asset.Bch)) { return(await api.SubmitWithdrawRequestBitcoinCashAsync(body).ConfigureAwait(false)); } throw new ApiBaseException($"Withdrawal of '{context.Amount.Asset}' is not supported by exchange", this); }
public void TestPlaceWithdrawal(WithdrawalPlacementContext context) { var p = IsType <IWithdrawalPlacementProvider>(); if (p.Success) { PlaceWithdrawal(p.Provider, context); } }
public async Task <WithdrawalPlacementResult> PlaceWithdrawalAsync(WithdrawalPlacementContext context) { var api = ApiProvider.GetApi(context); var rRaw = await api.SubmitWithdrawRequestAsync(context.Amount.Asset.ShortCode, context.Amount.ToDecimalValue(), context.Address.Address).ConfigureAwait(false); CheckResponseErrors(rRaw); // No id is returned from exchange. return(new WithdrawalPlacementResult()); }
public override void TestPlaceWithdrawal() { // TODO: AY: Bitfinex - test with real money. var context = new WithdrawalPlacementContext(UserContext.Current) { Address = new WalletAddress("6a51d6a5wda6w5d1"), Amount = new Money(10000, "UAH".ToAssetRaw()), Description = "DESC" }; base.TestPlaceWithdrawal(context); }
public async Task <WithdrawalPlacementResult> PlaceWithdrawalAsync(WithdrawalPlacementContext context) { var rRaw = await SubmitWithdrawalRequestAsync(context).ConfigureAwait(false); CheckResponseErrors(rRaw); var r = rRaw.GetContent(); return(new WithdrawalPlacementResult() { WithdrawalRemoteId = r.data }); }
private void PlaceWithdrawal(IWithdrawalPlacementProvider provider, WalletAddress address, Money amount, string description = null, Money?customFee = null, string authToken = null) { var context = new WithdrawalPlacementContext(address, amount, UserContext.Current) { Description = description, CustomFee = customFee, AuthenticationToken = authToken }; var r = AsyncContext.Run(() => provider.PlaceWithdrawalAsync(context)); Assert.IsTrue(r != null); Trace.WriteLine($"Withdrawal request remote id: {r.WithdrawalRemoteId}"); }
//[TestMethod] public override void TestPlaceWithdrawal() { var token2fa = "249723"; var context = new WithdrawalPlacementContext(UserContext.Current) { Amount = new Money(1000, Asset.Btc), Address = null, AuthenticationToken = token2fa, CustomFee = new Money(0.004m, Asset.Btc), Description = "Debug payment" }; base.TestPlaceWithdrawal(context); }
public async Task <WithdrawalPlacementResult> PlaceWithdrawalAsync(WithdrawalPlacementContext context) { var api = ApiProvider.GetApi(context); var rRaw = await api.SubmitWithdrawRequestAsync(context.Amount.Asset.ShortCode, context.Address.Address, context.Amount.ToDecimalValue(), context.Description, "Primary test").ConfigureAwait(false); CheckResponseErrors(rRaw); var r = rRaw.GetContent(); return(new WithdrawalPlacementResult() { WithdrawalRemoteId = r.id }); }
public async Task <WithdrawalPlacementResult> PlaceWithdrawalAsync(WithdrawalPlacementContext context) { var api = ApiProvider.GetApi(context); var body = new Dictionary <string, object> { { "currency", context.Amount.Asset.ShortCode.ToLower() }, { "sum", context.Amount.ToDecimalValue() }, { "address", context.Address.Address } }; var rRaw = await api.SubmitWithdrawRequestAsync(body).ConfigureAwait(false); CheckResponseErrors(rRaw); return(new WithdrawalPlacementResult()); }
public async Task <WithdrawalPlacementResult> PlaceWithdrawalAsync(WithdrawalPlacementContext context) { var api = ApiProviderPrivate.GetApi(context); var body = CreateBody(); body.Add("method", "WithdrawCoinsToAddress"); body.Add("coinName", context.Amount.Asset.ShortCode); body.Add("amount", context.Amount.ToDecimalValue()); body.Add("address", context.Address.Address); var rRaw = await api.SubmitWithdrawRequestAsync(body).ConfigureAwait(false); CheckResponseErrors(rRaw); // No id is returned from exchange. return(new WithdrawalPlacementResult()); }
private void PlaceWithdrawal(IWithdrawalPlacementProvider provider, WithdrawalPlacementContext context) { if (context == null) { return; } try { var r = AsyncContext.Run(() => provider.PlaceWithdrawalAsync(context)); // Assert.IsTrue(r); } catch (Exception e) { Assert.Fail(e.Message); } }
public async Task <WithdrawalPlacementResult> PlaceWithdrawalAsync(WithdrawalPlacementContext context) { var api = ApiProvider.GetApi(context); var rRaw = context.HasDescription ? await api.Withdraw(context.Amount.Asset.ToRemoteCode(this), context.Amount.ToDecimalValue(), context.Address.Address, context.Description).ConfigureAwait(false) : await api.Withdraw(context.Amount.Asset.ToRemoteCode(this), context.Amount.ToDecimalValue(), context.Address.Address).ConfigureAwait(false); CheckResponseErrors(rRaw); var r = rRaw.GetContent(); return(new WithdrawalPlacementResult() { WithdrawalRemoteId = r.result.uuid }); }
private void PlaceWithdrawal(IWithdrawalPlacementProvider provider, WithdrawalPlacementContext context) { if (context == null) { return; } try { var r = AsyncContext.Run(() => provider.PlaceWithdrawalAsync(context)); Assert.IsTrue(r != null); Trace.WriteLine($"Withdrawal request remote id: {r.WithdrawalRemoteId}"); } catch (Exception e) { Assert.Fail(e.Message); } }
public async Task <WithdrawalPlacementResult> PlaceWithdrawalAsync(WithdrawalPlacementContext context) { var api = ApiProvider.GetApi(context); var body = CreatePoloniexBody(PoloniexBodyType.Withdraw); body.Add("currency", context.Amount.Asset.ToRemoteCode(this)); body.Add("amount", context.Amount.ToDecimalValue()); body.Add("address", context.Address.Address); if (context.HasDescription) { body.Add("paymentId", context.Description); } var rRaw = await api.WithdrawAsync(body).ConfigureAwait(false); CheckResponseErrors(rRaw); return(new WithdrawalPlacementResult()); }
public async Task <WithdrawalPlacementResult> PlaceWithdrawalAsync(WithdrawalPlacementContext context) { var api = ApiProvider.GetApi(context); var timestamp = (long)DateTime.UtcNow.ToUnixTimeStamp(); var body = new Dictionary <string, object> { { "method", "transfer" }, { "moment", timestamp }, { "currency", context.Amount.Asset.ShortCode }, { "quantity", context.Amount.ToDecimalValue() }, { "address", context.Address.Address } }; var rRaw = await api.SubmitWithdrawRequestAsync(body).ConfigureAwait(false); CheckResponseErrors(rRaw); // No id is returned from exchange. return(new WithdrawalPlacementResult()); }
public bool IsWithdrawalFeeIncluded => false; // Confirmed. When 100 XRP is queried for withdrawal 100.02 will be charged. public async Task <WithdrawalPlacementResult> PlaceWithdrawalAsync(WithdrawalPlacementContext context) { var api = ApiProvider.GetApi(context); var body = new BitfinexSchema.WithdrawalRequest.Descriptor(); if (!WithdrawalAssetsToTypes.Value.TryGetValue(context.Amount.Asset, out var withdrawalType)) { throw new ApiResponseException("Withdrawal of specified asset is not supported", this); } body.withdraw_type = withdrawalType; body.walletselected = "exchange"; // Can be trading, exchange, deposit. body.amount = context.Amount.ToDecimalValue().ToString(CultureInfo.InvariantCulture); body.address = context.Address.Address; body.payment_id = context.HasDescription ? null : context.Description; var rRaw = await api.WithdrawAsync(body).ConfigureAwait(false); CheckBitfinexResponseErrors(rRaw); var r = rRaw.GetContent().FirstOrDefault(); if (r == null) { throw new ApiResponseException("No result return after withdrawal operation", this); } if (r.status.Equals("error", StringComparison.InvariantCultureIgnoreCase)) { throw new ApiResponseException(r.message, this); } return(new WithdrawalPlacementResult() { WithdrawalRemoteId = r.withdrawal_id.ToString() }); }
public async Task <WithdrawalPlacementResult> PlaceWithdrawalAsync(WithdrawalPlacementContext context) { var api = ApiProviderPrivate.GetApi(context); var body = new Dictionary <string, object> { { "coinName", context.Amount.Asset.ShortCode }, { "amount", context.Amount.ToDecimalValue() }, { "address", context.Address.Address } }; var rRaw = await api.SubmitWithdrawRequestAsync(body).ConfigureAwait(false); CheckResponseErrors(rRaw); if (rRaw.GetContent().success == false) { throw new ApiResponseException("Unsuccessful request in PlaceWithdrawalAsync"); } // No id is returned. return(new WithdrawalPlacementResult()); }
public async Task <WithdrawalPlacementResult> PlaceWithdrawalAsync(WithdrawalPlacementContext context) { //TODO: SC - This needs to be implemented throw new NotImplementedException(); }