Skip to content

Commit 8d6b4f9

Browse files
Add networks centralized folder
1 parent 9e7ba9e commit 8d6b4f9

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { useIsActive } from "../../hooks/useIsActive"
2+
import { getDefaultProviderChainId } from "../../utils/getEnvVariable"
3+
4+
export const useDefaultOrConnectedChainId = () => {
5+
const { chainId } = useIsActive()
6+
const defaultOrConnectedChainId = chainId ?? getDefaultProviderChainId()
7+
8+
return defaultOrConnectedChainId
9+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { ALLOWED_L2_TRANSACTIONS } from "../constants/networks"
2+
import { AllowedL2TransactionTypes } from "../enums/networks"
3+
4+
export function isValidL2Transaction<T = AllowedL2TransactionTypes>(
5+
type?: T
6+
): boolean {
7+
if (!type) return false
8+
return ALLOWED_L2_TRANSACTIONS.includes(
9+
type as unknown as AllowedL2TransactionTypes
10+
)
11+
}

0 commit comments

Comments
 (0)