mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-23 15:10:15 +00:00
exchanges/engine: Add multichain deposit/withdrawal support (#794)
* Add exchange multichain support * Start tidying up * Add multichain transfer support for Bitfinex and fix poloniex bug * Add Coinbene multichain support * Start adjusting the deposit address manager * Fix deposit tests and further enhancements * Cleanup * Add bypass flag, expand tests plus error coverage for Huobi Adjust helpers * Address nitterinos * BFX wd changes * Address nitterinos * Minor fixes rebasing on master * Fix BFX acceptableMethods test * Add some TO-DOs for 2 tests WRT races * Fix acceptableMethods test round 2 * Address nitterinos
This commit is contained in:
@@ -347,7 +347,7 @@ func TestGetDepositAddress(t *testing.T) {
|
||||
if !areTestAPIKeysSet() {
|
||||
t.Skip("API keys not set, skipping test")
|
||||
}
|
||||
_, err := b.GetDepositAddress(context.Background(), currency.XRP, "")
|
||||
_, err := b.GetDepositAddress(context.Background(), currency.BTC, "", "")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import (
|
||||
exchange "github.com/thrasher-corp/gocryptotrader/exchanges"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/account"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/asset"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/deposit"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/kline"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/order"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/orderbook"
|
||||
@@ -687,22 +688,39 @@ func (b *BTSE) GetOrderInfo(ctx context.Context, orderID string, pair currency.P
|
||||
}
|
||||
|
||||
// GetDepositAddress returns a deposit address for a specified currency
|
||||
func (b *BTSE) GetDepositAddress(ctx context.Context, c currency.Code, accountID string) (string, error) {
|
||||
func (b *BTSE) GetDepositAddress(ctx context.Context, c currency.Code, accountID, _ string) (*deposit.Address, error) {
|
||||
address, err := b.GetWalletAddress(ctx, c.String())
|
||||
if err != nil {
|
||||
return "", err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
exctractor := func(addr string) (string, string) {
|
||||
if strings.Contains(addr, ":") {
|
||||
split := strings.Split(addr, ":")
|
||||
return split[0], split[1]
|
||||
}
|
||||
return addr, ""
|
||||
}
|
||||
|
||||
if len(address) == 0 {
|
||||
addressCreate, err := b.CreateWalletAddress(ctx, c.String())
|
||||
if err != nil {
|
||||
return "", err
|
||||
return nil, err
|
||||
}
|
||||
if len(addressCreate) != 0 {
|
||||
return addressCreate[0].Address, nil
|
||||
addr, tag := exctractor(addressCreate[0].Address)
|
||||
return &deposit.Address{
|
||||
Address: addr,
|
||||
Tag: tag,
|
||||
}, nil
|
||||
}
|
||||
return "", errors.New("address not found")
|
||||
return nil, errors.New("address not found")
|
||||
}
|
||||
return address[0].Address, nil
|
||||
addr, tag := exctractor(address[0].Address)
|
||||
return &deposit.Address{
|
||||
Address: addr,
|
||||
Tag: tag,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is
|
||||
|
||||
Reference in New Issue
Block a user