Skip to content

Commit

Permalink
fix: Ask for symbol and decimals if covalent fail (#4890)
Browse files Browse the repository at this point in the history
* fix: Ask for symbol and decimals if covalent fail

* Update src/components/SetupStrategyBasic.vue
  • Loading branch information
ChaituVR authored Sep 28, 2024
1 parent e121267 commit 75ea2b2
Showing 1 changed file with 47 additions and 4 deletions.
51 changes: 47 additions & 4 deletions src/components/SetupStrategyBasic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const DEFAULT_TOKEN = {
logo: '',
standard: 'ERC-20',
symbol: '',
decimals: null
decimals: '18'
};
const emit = defineEmits(['next']);
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
/>
</div>
<div>
<BaseInput
v-if="
!isTokenLoading &&
tokenError === $t('setup.strategy.tokenVoting.tokenNotFound')
"
v-model.trim="token.symbol"
title="Symbol"
placeholder="Enter Symbol"
:error="{
message: !token.symbol ? 'Symbol is required' : '',
push: true
}"
focus-on-mount
/>
</div>
<div>
<BaseInput
v-if="
!isTokenLoading &&
tokenError === $t('setup.strategy.tokenVoting.tokenNotFound')
"
v-model.trim="token.decimals"
title="Decimals"
placeholder="Enter Decimals"
:error="{
message: !token.decimals ? 'Decimals is required' : '',
push: true
}"
/>
</div>
</div>
</div>
</BaseBlock>
Expand Down

0 comments on commit 75ea2b2

Please sign in to comment.