Moved withdraw structs into own package

This commit is contained in:
Andrew Jackson
2019-12-12 14:16:45 +11:00
parent 473092a69c
commit a91d147781
64 changed files with 323 additions and 260 deletions

View File

@@ -10,6 +10,7 @@ import (
"github.com/thrasher-corp/gocryptotrader/currency"
exchange "github.com/thrasher-corp/gocryptotrader/exchanges"
"github.com/thrasher-corp/gocryptotrader/exchanges/order"
"github.com/thrasher-corp/gocryptotrader/exchanges/withdraw"
)
// Please supply your own keys here for due diligence testing
@@ -448,8 +449,8 @@ func TestWithdraw(t *testing.T) {
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
}
withdrawCryptoRequest := exchange.CryptoWithdrawRequest{
GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{
withdrawCryptoRequest := withdraw.CryptoWithdrawRequest{
GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{
Amount: -1,
Currency: currency.BTC,
Description: "WITHDRAW IT ALL",
@@ -472,8 +473,8 @@ func TestWithdrawFiat(t *testing.T) {
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
}
var withdrawFiatRequest = exchange.FiatWithdrawRequest{
GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{
var withdrawFiatRequest = withdraw.FiatWithdrawRequest{
GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{
Amount: -1,
Currency: currency.USD,
Description: "WITHDRAW IT ALL",
@@ -506,7 +507,7 @@ func TestWithdrawInternationalBank(t *testing.T) {
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
}
var withdrawFiatRequest = exchange.FiatWithdrawRequest{}
var withdrawFiatRequest = withdraw.FiatWithdrawRequest{}
_, err := b.WithdrawFiatFundsToInternationalBank(&withdrawFiatRequest)
if err != common.ErrFunctionNotSupported {
t.Errorf("Expected '%v', received: '%v'", common.ErrFunctionNotSupported, err)

View File

@@ -19,6 +19,7 @@ import (
"github.com/thrasher-corp/gocryptotrader/exchanges/request"
"github.com/thrasher-corp/gocryptotrader/exchanges/ticker"
"github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler"
"github.com/thrasher-corp/gocryptotrader/exchanges/withdraw"
log "github.com/thrasher-corp/gocryptotrader/logger"
)
@@ -407,7 +408,7 @@ func (b *Bithumb) GetDepositAddress(cryptocurrency currency.Code, _ string) (str
// WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is
// submitted
func (b *Bithumb) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWithdrawRequest) (string, error) {
func (b *Bithumb) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.CryptoWithdrawRequest) (string, error) {
_, err := b.WithdrawCrypto(withdrawRequest.Address,
withdrawRequest.AddressTag,
withdrawRequest.Currency.String(),
@@ -417,7 +418,7 @@ func (b *Bithumb) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWi
// WithdrawFiatFunds returns a withdrawal ID when a
// withdrawal is submitted
func (b *Bithumb) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) {
func (b *Bithumb) WithdrawFiatFunds(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) {
if math.Mod(withdrawRequest.Amount, 1) != 0 {
return "", errors.New("currency KRW does not support decimal places")
}
@@ -438,7 +439,7 @@ func (b *Bithumb) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawReques
}
// WithdrawFiatFundsToInternationalBank is not supported as Bithumb only withdraws KRW to South Korean banks
func (b *Bithumb) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) {
func (b *Bithumb) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) {
return "", common.ErrFunctionNotSupported
}