use of org.knowm.xchange.bitstamp.dto.BitstampException in project XChange by knowm.
the class BitstampAccountServiceRaw method withdrawXLM.
public BitstampWithdrawal withdrawXLM(BigDecimal amount, String address, String memo) throws IOException {
try {
Long longMemo = null;
if (memo != null) {
try {
longMemo = Long.valueOf(memo);
} catch (NumberFormatException exception) {
throw new RuntimeException("Bitstamp supports only numbers for xlm memo field");
}
}
BitstampWithdrawal response = bitstampAuthenticatedV2.withdrawXLM(apiKeyForV2Requests, signatureCreatorV2, uuidNonceFactory, timestampFactory, API_VERSION, amount, address, longMemo);
return checkAndReturnWithdrawal(response);
} catch (BitstampException e) {
throw handleError(e);
}
}
use of org.knowm.xchange.bitstamp.dto.BitstampException in project XChange by knowm.
the class BitstampAccountServiceRaw method withdrawAddrAmount.
/**
* To prevent code repetition we try to resolve client method
*/
public BitstampWithdrawal withdrawAddrAmount(Currency currency, BigDecimal amount, String address) {
try {
Class<? extends BitstampAuthenticatedV2> clientClass = bitstampAuthenticatedV2.getClass();
Method withdrawMethod = clientClass.getMethod("withdraw" + currency.getCurrencyCode(), String.class, ParamsDigest.class, SynchronizedValueFactory.class, SynchronizedValueFactory.class, String.class, BigDecimal.class, String.class);
BitstampWithdrawal response = (BitstampWithdrawal) withdrawMethod.invoke(bitstampAuthenticatedV2, apiKeyForV2Requests, signatureCreatorV2, uuidNonceFactory, timestampFactory, API_VERSION, amount, address);
return checkAndReturnWithdrawal(response);
} catch (BitstampException e) {
throw handleError(e);
} catch (Exception e) {
throw new RuntimeException("Failed to call bitstamp withdraw method on authenticated client", e);
}
}
use of org.knowm.xchange.bitstamp.dto.BitstampException in project XChange by knowm.
the class BitstampAccountServiceRaw method withdrawRippleFunds.
public BitstampWithdrawal withdrawRippleFunds(BigDecimal amount, String address, Long destinationTag) throws IOException {
BitstampRippleDepositAddress addressAndDt;
// even if tag was not explicitly provided in method call, it can still be there as part of
// address as addr?dt=tag
addressAndDt = new BitstampRippleDepositAddress(null, address, destinationTag);
try {
BitstampWithdrawal response = bitstampAuthenticatedV2.withdrawXRP(apiKeyForV2Requests, signatureCreatorV2, uuidNonceFactory, timestampFactory, API_VERSION, amount, addressAndDt.getAddress(), addressAndDt.getDestinationTag());
return checkAndReturnWithdrawal(response);
} catch (BitstampException e) {
throw handleError(e);
}
}
Aggregations