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:
Adrian Gallagher
2021-10-15 15:55:38 +11:00
committed by GitHub
parent b093a7df19
commit 0c00b7e1df
145 changed files with 46329 additions and 5507 deletions

View File

@@ -271,10 +271,10 @@ func (b *Bithumb) GetAccountBalance(ctx context.Context, c string) (FullBalance,
// GetWalletAddress returns customer wallet address
//
// currency e.g. btc, ltc or "", will default to btc without currency specified
func (b *Bithumb) GetWalletAddress(ctx context.Context, currency string) (WalletAddressRes, error) {
func (b *Bithumb) GetWalletAddress(ctx context.Context, curr currency.Code) (WalletAddressRes, error) {
response := WalletAddressRes{}
params := url.Values{}
params.Set("currency", strings.ToUpper(currency))
params.Set("currency", curr.Upper().String())
err := b.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, privateWalletAdd, params, &response)
if err != nil {
@@ -284,7 +284,30 @@ func (b *Bithumb) GetWalletAddress(ctx context.Context, currency string) (Wallet
if response.Data.WalletAddress == "" {
return response,
fmt.Errorf("deposit address needs to be created via the Bithumb website before retrieval for currency %s",
currency)
curr.String())
}
var address, tag string
switch curr {
case currency.XRP:
splitStr := "&dt="
if !strings.Contains(response.Data.WalletAddress, splitStr) {
return response, errors.New("unable to parse XRP deposit address")
}
splitter := strings.Split(response.Data.WalletAddress, splitStr)
address, tag = splitter[0], splitter[1]
case currency.XLM, currency.BNB:
splitStr := "&memo="
if !strings.Contains(response.Data.WalletAddress, splitStr) {
return response, fmt.Errorf("unable to parse %s deposit address", curr.String())
}
splitter := strings.Split(response.Data.WalletAddress, splitStr)
address, tag = splitter[0], splitter[1]
}
if tag != "" {
response.Data.WalletAddress = address
response.Data.Tag = tag
}
return response, nil