gctcli: remove all exchange name client-side validation (#758)

* gctcli: remove all exchange name client-side validation

Since now exchange names can be user-assigned we can no longer have
client-side validation, all exchange name validation must now occur
on the server (it was already doing that).

* engine: add server side exchange name check on some RPCs
This commit is contained in:
Luis Rascão
2021-08-24 00:45:26 +01:00
committed by GitHub
parent a15cbf6651
commit 9bb4348613
7 changed files with 17 additions and 206 deletions

View File

@@ -4,24 +4,18 @@ import (
"errors"
"strings"
exchange "github.com/thrasher-corp/gocryptotrader/exchanges"
"github.com/thrasher-corp/gocryptotrader/exchanges/asset"
)
var (
errInvalidPair = errors.New("invalid currency pair supplied")
errInvalidExchange = errors.New("invalid exchange supplied")
errInvalidAsset = errors.New("invalid asset supplied")
errInvalidPair = errors.New("invalid currency pair supplied")
errInvalidAsset = errors.New("invalid asset supplied")
)
func validPair(pair string) bool {
return strings.Contains(pair, pairDelimiter)
}
func validExchange(exch string) bool {
return exchange.IsSupported(exch)
}
func validAsset(i string) bool {
_, err := asset.New(i)
return err == nil