mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-08 07:26:48 +00:00
Withdraw Crypto wrapper mapping (#226)
* Initial commit * Updates signature for all withdrawal methods to use new withdrawRequest struct type * Implements crypto withdraw features & tests for Alphapoint, ANX, Binance, Bitfinex, Bitflyer, Bithumb, Bitmex, Bitstamp, Bittrex, BTCC, BTCmarkets, CoinbasePro, Coinut. Updates WithdrawRequest type with more members. Breaking change to update real order testing for increased code coverage * Updates all realOrder tests to run when no API key is present. Updates exchange functions to handle errors better * Implements crypto withdrawals for Exmo, GateIO, Gemini, HitBTC, Huobi, HuobiHadax, Kraken, LakeBTC, Liqui, Localbitcoins, OKCoin, OKEX, Poloniex, Wex, Yobit and ZB. Updates real order test formatting for all real order tests * Update alphapoint. Fixes anx typos. Adds function WithdrawFiatFundsToInternationalBank to exchange wrapper interface. Adds WithdrawFiatFundsToInternationalBank to alphapoint, bitmex, coinbasepro. Updates Kraken to use TradePassword property * Reverts alphapoint to use ErrNotYetImplemented * Fixes line spacing and removes unnecessary line
This commit is contained in:
@@ -483,15 +483,12 @@ func (b *Bitstamp) GetWithdrawalRequests(timedelta int64) ([]WithdrawalRequests,
|
||||
// symbol - the type of crypto ie "ltc", "btc", "eth"
|
||||
// destTag - only for XRP default to ""
|
||||
// instant - only for bitcoins
|
||||
func (b *Bitstamp) CryptoWithdrawal(amount float64, address, symbol, destTag string, instant bool) (string, error) {
|
||||
func (b *Bitstamp) CryptoWithdrawal(amount float64, address, symbol, destTag string, instant bool) (CryptoWithdrawalResponse, error) {
|
||||
var req = url.Values{}
|
||||
req.Add("amount", strconv.FormatFloat(amount, 'f', -1, 64))
|
||||
req.Add("address", address)
|
||||
|
||||
type response struct {
|
||||
ID string `json:"id"`
|
||||
}
|
||||
resp := response{}
|
||||
resp := CryptoWithdrawalResponse{}
|
||||
var endpoint string
|
||||
|
||||
switch common.StringToLower(symbol) {
|
||||
case "btc":
|
||||
@@ -500,23 +497,21 @@ func (b *Bitstamp) CryptoWithdrawal(amount float64, address, symbol, destTag str
|
||||
} else {
|
||||
req.Add("instant", "0")
|
||||
}
|
||||
return resp.ID,
|
||||
b.SendAuthenticatedHTTPRequest(bitstampAPIBitcoinWithdrawal, false, req, &resp)
|
||||
endpoint = bitstampAPIBitcoinWithdrawal
|
||||
case "ltc":
|
||||
return resp.ID,
|
||||
b.SendAuthenticatedHTTPRequest(bitstampAPILTCWithdrawal, true, req, &resp)
|
||||
endpoint = bitstampAPILTCWithdrawal
|
||||
case "eth":
|
||||
return resp.ID,
|
||||
b.SendAuthenticatedHTTPRequest(bitstampAPIETHWithdrawal, true, req, &resp)
|
||||
endpoint = bitstampAPIETHWithdrawal
|
||||
case "xrp":
|
||||
if destTag != "" {
|
||||
req.Add("destination_tag", destTag)
|
||||
}
|
||||
return resp.ID,
|
||||
b.SendAuthenticatedHTTPRequest(bitstampAPIXrpWithdrawal, true, req, &resp)
|
||||
endpoint = bitstampAPIXrpWithdrawal
|
||||
default:
|
||||
return resp, errors.New("incorrect symbol")
|
||||
}
|
||||
return resp.ID,
|
||||
errors.New("incorrect symbol")
|
||||
|
||||
return resp, b.SendAuthenticatedHTTPRequest(endpoint, false, req, &resp)
|
||||
}
|
||||
|
||||
// GetCryptoDepositAddress returns a depositing address by crypto
|
||||
|
||||
Reference in New Issue
Block a user