From 96c3d8708022629e28f70084db545c4f21975a3d Mon Sep 17 00:00:00 2001 From: Denis <136321897+defisaur@users.noreply.github.com> Date: Thu, 29 Jun 2023 11:51:58 +0400 Subject: [PATCH] Fix cronos (#102) * fix cronos * fix cronos --- .gitignore | 4 +++- .idea/.gitignore | 8 -------- validation/info/fields_validators.go | 7 ++++++- 3 files changed, 9 insertions(+), 10 deletions(-) delete mode 100644 .idea/.gitignore diff --git a/.gitignore b/.gitignore index 311e6f2..c605da9 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,6 @@ vendor/ # Other dirs and files bin/ -coverage.txt \ No newline at end of file +coverage.txt + +.idea diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 13566b8..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/validation/info/fields_validators.go b/validation/info/fields_validators.go index 592ceee..99b350b 100644 --- a/validation/info/fields_validators.go +++ b/validation/info/fields_validators.go @@ -51,11 +51,16 @@ func ValidateAssetRequiredKeys(a AssetModel) error { } func ValidateAssetType(assetType string, chain coin.Coin) error { - chainFromType, err := types.GetChainFromAssetType(assetType) + chainFromTypeRaw, err := types.GetChainFromAssetType(assetType) if err != nil { return fmt.Errorf("failed to get chain from asset type: %w", err) } + chainFromType := chainFromTypeRaw + if chainFromTypeRaw.ID == coin.CRONOS { + chainFromType = coin.Cryptoorg() + } + if chainFromType != chain { return fmt.Errorf("%w: asset type field", validation.ErrInvalidField) }