mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-20 23:16:49 +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:
@@ -483,7 +483,7 @@ func ExchangeOrderSubmit(args ...objects.Object) (objects.Object, error) {
|
||||
|
||||
// ExchangeDepositAddress returns deposit address (if supported by exchange)
|
||||
func ExchangeDepositAddress(args ...objects.Object) (objects.Object, error) {
|
||||
if len(args) != 2 {
|
||||
if len(args) != 3 {
|
||||
return nil, objects.ErrWrongNumArguments
|
||||
}
|
||||
|
||||
@@ -495,15 +495,24 @@ func ExchangeDepositAddress(args ...objects.Object) (objects.Object, error) {
|
||||
if !ok {
|
||||
return nil, fmt.Errorf(ErrParameterConvertFailed, currencyCode)
|
||||
}
|
||||
chain, ok := objects.ToString(args[2])
|
||||
if !ok {
|
||||
return nil, fmt.Errorf(ErrParameterConvertFailed, chain)
|
||||
}
|
||||
|
||||
currCode := currency.NewCode(currencyCode)
|
||||
|
||||
rtn, err := wrappers.GetWrapper().DepositAddress(exchangeName, currCode)
|
||||
rtn, err := wrappers.GetWrapper().DepositAddress(exchangeName, chain, currCode)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &objects.String{Value: rtn}, nil
|
||||
data := make(map[string]objects.Object, 2)
|
||||
data["address"] = &objects.String{Value: rtn.Address}
|
||||
data["tag"] = &objects.String{Value: rtn.Tag}
|
||||
return &objects.Map{
|
||||
Value: data,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// ExchangeWithdrawCrypto submit request to withdraw crypto assets
|
||||
|
||||
@@ -245,12 +245,13 @@ func TestExchangeDepositAddress(t *testing.T) {
|
||||
}
|
||||
|
||||
currCode := &objects.String{Value: "BTC"}
|
||||
_, err = ExchangeDepositAddress(exch, currCode)
|
||||
chain := &objects.String{Value: ""}
|
||||
_, err = ExchangeDepositAddress(exch, currCode, chain)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
_, err = ExchangeDepositAddress(exchError, currCode)
|
||||
_, err = ExchangeDepositAddress(exchError, currCode, chain)
|
||||
if err != nil && !errors.Is(err, errTestFailed) {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user