Skip to content

Commit

Permalink
fix: clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
impelcrypto committed Feb 13, 2024
1 parent 644612e commit 8ce85cd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 25 deletions.
14 changes: 5 additions & 9 deletions src/components/bridge/ethereum/L1Bridge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -275,19 +275,15 @@ export default defineComponent({
isHandling.value = false;
};
// Watching the 'isApproved' prop
// When 'isApproved' changes and becomes true, stop loading animation
watch(
() => props.isApproved,
async (newVal, oldVal) => {
console.log('watch props.isApproved', props.isApproved);
console.log('newVal', newVal);
if (newVal === true) {
[props],
() => {
if (props.isApproved) {
props.setIsApproving(false);
store.commit('general/setLoading', false, { root: true });
console.log('done');
}
}
},
{ immediate: false }
);
return {
Expand Down
23 changes: 7 additions & 16 deletions src/hooks/bridge/useL1Bridge.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
import { ethers, constants as ethersConstants } from 'ethers';
import { debounce } from 'lodash-es'; // If using lodash
import { endpointKey } from 'src/config/chainEndpoints';
import { LOCAL_STORAGE } from 'src/config/localStorage';
import { checkAllowance, getTokenBal } from 'src/config/web3';
import { checkAllowance, getTokenBal, setupNetwork } from 'src/config/web3';
import { useAccount } from 'src/hooks';
import { Erc20Token } from 'src/modules/token';
import { astarNativeTokenErcAddr } from 'src/modules/xcm';
import {
EthBridgeChainId,
EthBridgeContract,
EthBridgeNetworkName,
ZkToken,
} from 'src/modules/zk-evm-bridge';
import { setupNetwork } from 'src/config/web3';
import { useAccount } from 'src/hooks';
import { useStore } from 'src/store';
import { container } from 'src/v2/common';
import { IZkBridgeService } from 'src/v2/services';
import { Symbols } from 'src/v2/symbols';
import { computed, ref, watch, watchEffect, onUnmounted } from 'vue';
import { computed, onUnmounted, ref, watch, watchEffect } from 'vue';
import { useI18n } from 'vue-i18n';
import { useEthProvider } from '../custom-signature/useEthProvider';
import { astarNativeTokenErcAddr } from 'src/modules/xcm';
import { ethers, constants as ethersConstants } from 'ethers';
import { Erc20Token } from 'src/modules/token';
import { debounce } from 'lodash-es'; // If using lodash

const eth = {
symbol: 'ETH',
Expand Down Expand Up @@ -118,10 +117,6 @@ export const useL1Bridge = () => {
const formattedAllowance = ethers.utils.formatUnits(amountAllowance, decimals).toString();
console.info('allowance: ', formattedAllowance, selectedToken.value.symbol);
isApproved.value = Number(formattedAllowance) >= Number(amount);
console.log(
'fn isApproved.value Number(formattedAllowance) >= Number(amount)',
Number(formattedAllowance) >= Number(amount)
);
} catch (error) {
console.error(error);
isApproved.value = false;
Expand Down Expand Up @@ -327,10 +322,6 @@ export const useL1Bridge = () => {
clearInterval(autoFetchAllowanceHandler);
});

watchEffect(() => {
console.log('isApproved.value', isApproved.value);
});

return {
bridgeAmt,
errMsg,
Expand Down

0 comments on commit 8ce85cd

Please sign in to comment.