diff --git a/lefthook.yml b/lefthook.yml index 7b5e743687d..1f17bb93795 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -2,6 +2,9 @@ pre-commit: parallel: true commands: + bridge-ui: + glob: "packages/bridge-ui/**.{js,ts,css,svelte}" + run: pnpm -F bridge-ui svelte:check && pnpm -F bridge-ui lint:fix && git add {staged_files} guardian-ui: glob: "packages/guardian-prover-health-check-ui/**.{js,ts,css,svelte}" run: pnpm -F guardian-prover-health-check-ui svelte:check && pnpm -F guardian-prover-health-check-ui lint:fix && git add {staged_files} diff --git a/packages/bridge-ui/src/components/Dialogs/ReleaseDialog/ReleaseStepNavigation.svelte b/packages/bridge-ui/src/components/Dialogs/ReleaseDialog/ReleaseStepNavigation.svelte index 04e4d979ca5..49658df2f4b 100644 --- a/packages/bridge-ui/src/components/Dialogs/ReleaseDialog/ReleaseStepNavigation.svelte +++ b/packages/bridge-ui/src/components/Dialogs/ReleaseDialog/ReleaseStepNavigation.svelte @@ -5,7 +5,7 @@ import { ActionButton } from '$components/Button'; import { StepBack } from '$components/Stepper'; - import { ReleaseSteps } from './types'; + import { INITIAL_STEP, ReleaseSteps } from './types'; const dispatch = createEventDispatcher(); @@ -16,8 +16,6 @@ export let releasing = false; export let hideContinueButton: boolean; - const INITIAL_STEP = ReleaseSteps.CHECK; - const getNextStepText = (step: ReleaseSteps) => { if (step === ReleaseSteps.REVIEW) { return $t('common.confirm'); diff --git a/packages/bridge-ui/src/components/Dialogs/RetryDialog/RetryStepNavigation.svelte b/packages/bridge-ui/src/components/Dialogs/RetryDialog/RetryStepNavigation.svelte index 0ed446225e9..17e5bf23e4c 100644 --- a/packages/bridge-ui/src/components/Dialogs/RetryDialog/RetryStepNavigation.svelte +++ b/packages/bridge-ui/src/components/Dialogs/RetryDialog/RetryStepNavigation.svelte @@ -35,6 +35,8 @@ const handleNextStep = () => { if (activeStep === INITIAL_STEP) { + activeStep = RetrySteps.SELECT; + } else if (activeStep === RetrySteps.SELECT) { activeStep = RetrySteps.REVIEW; } else if (activeStep === RetrySteps.REVIEW) { activeStep = RetrySteps.CONFIRM; @@ -49,6 +51,8 @@ } if (activeStep === RetrySteps.REVIEW) { activeStep = RetrySteps.SELECT; + } else if (activeStep === RetrySteps.SELECT) { + activeStep = RetrySteps.CHECK; } else if (activeStep === RetrySteps.CONFIRM) { activeStep = RetrySteps.REVIEW; } diff --git a/packages/bridge-ui/src/libs/bridge/checkBridgeQuota.ts b/packages/bridge-ui/src/libs/bridge/checkBridgeQuota.ts index 5224d0957cd..a2ded67f69b 100644 --- a/packages/bridge-ui/src/libs/bridge/checkBridgeQuota.ts +++ b/packages/bridge-ui/src/libs/bridge/checkBridgeQuota.ts @@ -39,25 +39,30 @@ export const checkBridgeQuota = async ({ log('Skipping quota check for L2 chain'); return true; } + try { + const quotaManagerAddress = getContractAddressByType({ + srcChainId: Number(transaction.destChainId), + destChainId: Number(transaction.srcChainId), + contractType: ContractType.QUOTAMANAGER, + }); - const quotaManagerAddress = getContractAddressByType({ - srcChainId: Number(transaction.destChainId), - destChainId: Number(transaction.srcChainId), - contractType: ContractType.QUOTAMANAGER, - }); - - const quota = await readContract(config, { - address: quotaManagerAddress, - abi: quotaManagerAbi, - chainId: Number(transaction.destChainId), - functionName: 'availableQuota', - args: [tokenAddress, 0n], - }); - - if (amount > quota) { - log('Not enough quota', quota, amount); - return false; + const quota = await readContract(config, { + address: quotaManagerAddress, + abi: quotaManagerAbi, + chainId: Number(transaction.destChainId), + functionName: 'availableQuota', + args: [tokenAddress, 0n], + }); + + if (amount > quota) { + log('Not enough quota', quota, amount); + return false; + } + log('Quota:', quota, 'Amount:', amount, 'Has enough quota:', amount <= quota); + return true; + } catch (e) { + // If there is an error checking the quota, there is probably no quota configured + log('Error checking quota', e); + return true; } - log('Quota:', quota, 'Amount:', amount, 'Has enough quota:', amount <= quota); - return true; };