Skip to content

Commit

Permalink
Fix normal mode issue
Browse files Browse the repository at this point in the history
  • Loading branch information
zzq0826 committed Aug 13, 2024
1 parent ae65b24 commit c76b25c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/contexts/BridgeContextProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { useRainbowContext } from "@/contexts/RainbowProvider"
import useBlockNumbers from "@/hooks/useBlockNumbers"
import useClaimHistory from "@/hooks/useClaimHistory"
import useTxHistory, { TxHistory } from "@/hooks/useTxHistory"
import { isAlternativeGasTokenEnabled } from "@/utils/common"
import { loadState } from "@/utils/localStorage"

type BridgeContextProps = {
Expand Down Expand Up @@ -88,8 +89,10 @@ const BridgeContextProvider = ({ children }: any) => {
l1ScrollMessenger = new ethers.Contract(SCROLL_MESSENGER_ADDR[CHAIN_ID.L1], L1_SCROLL_MESSENGER_ABI, l1signer)
l2ScrollMessenger = new ethers.Contract(SCROLL_MESSENGER_ADDR[CHAIN_ID.L2], L2_SCROLL_MESSENGER_ABI, l2signer)

l1WrappedTokenGateway = new ethers.Contract(WRAPPED_TOKEN_GATEWAY_ADDR[CHAIN_ID.L1], L1_WRAPPED_TOKEN_GATEWAY_ABI, l1signer)
l1GasTokenGateway = new ethers.Contract(GAS_TOKEN_GATEWAY[CHAIN_ID.L1], L1_GAS_TOKEN_GATEWAY_ABI, l1signer)
if (isAlternativeGasTokenEnabled) {
l1WrappedTokenGateway = new ethers.Contract(WRAPPED_TOKEN_GATEWAY_ADDR[CHAIN_ID.L1], L1_WRAPPED_TOKEN_GATEWAY_ABI, l1signer)
l1GasTokenGateway = new ethers.Contract(GAS_TOKEN_GATEWAY[CHAIN_ID.L1], L1_GAS_TOKEN_GATEWAY_ABI, l1signer)
}

setNetworksAndSigners({
[CHAIN_ID.L1]: {
Expand Down
1 change: 1 addition & 0 deletions src/hooks/useGasFee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const useGasFee = (selectedToken, needApproval) => {
priorityFee = null
}
const gasLimit = await estimateSend()

if (gasLimit === null) {
return {
gasLimit: null,
Expand Down
5 changes: 4 additions & 1 deletion src/utils/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ export const generateExploreLink = (explorer, hash, type = "tx") => {
return `${explorer}/${type}/${hash}`
}

export const isAlternativeGasTokenEnabled = Boolean(requireEnv("REACT_APP_L1_GAS_TOKEN_ADDR"))
export const isAlternativeGasTokenEnabled = (() => {
const gasTokenAddr = requireEnv("REACT_APP_L1_GAS_TOKEN_ADDR")
return Boolean(gasTokenAddr) && gasTokenAddr !== "0x0000000000000000000000000000000000000000"
})()

export const isValidEmail = (email: string): boolean => {
const emailRegex: RegExp = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/
Expand Down

0 comments on commit c76b25c

Please sign in to comment.