From 75ea2b222e8f8d42f07a1f259eceec72cc49dd57 Mon Sep 17 00:00:00 2001 From: Chaitanya Date: Sat, 28 Sep 2024 23:37:13 +0530 Subject: [PATCH] fix: Ask for symbol and decimals if covalent fail (#4890) * fix: Ask for symbol and decimals if covalent fail * Update src/components/SetupStrategyBasic.vue --- src/components/SetupStrategyBasic.vue | 51 ++++++++++++++++++++++++--- 1 file changed, 47 insertions(+), 4 deletions(-) diff --git a/src/components/SetupStrategyBasic.vue b/src/components/SetupStrategyBasic.vue index 38d25aa5ac6a..284156f186ae 100644 --- a/src/components/SetupStrategyBasic.vue +++ b/src/components/SetupStrategyBasic.vue @@ -11,7 +11,7 @@ const DEFAULT_TOKEN = { logo: '', standard: 'ERC-20', symbol: '', - decimals: null + decimals: '18' }; const emit = defineEmits(['next']); @@ -93,9 +93,15 @@ async function getTokenInfo() { token.value.name = tokenInfo[0]; token.value.symbol = tokenInfo[1]; token.value.decimals = tokenInfo[2]; - } catch { + } catch (e) { + console.log(e); tokenError.value = t('setup.strategy.tokenVoting.tokenNotFound'); - token.value = clone(DEFAULT_TOKEN); + if ( + token.value.standard === 'ERC-721' || + token.value.standard === 'ERC-1155' + ) { + token.value.decimals = '0'; + } } finally { isTokenLoading.value = false; } @@ -130,11 +136,48 @@ watch( v-model.trim="contract" title="Token contract" placeholder="Enter address" - :error="{ message: !token.name ? tokenError : '', push: true }" + :error="{ + message: + tokenError !== $t('setup.strategy.tokenVoting.tokenNotFound') + ? tokenError + : '', + push: true + }" :loading="isTokenLoading" focus-on-mount /> +
+ +
+
+ +