-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ (chore): extract chain-related code to
./utils/chains
- Loading branch information
1 parent
b4e3466
commit dfca83d
Showing
11 changed files
with
60 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
export { Asset, type ERC20Token } from './asset'; | ||
export { type ERC20Token, Asset } from './asset'; | ||
export { OptionAssetPair } from './asset-pair'; | ||
export { SupportedAsset, SUPPORTED_ASSETS } from './supported-asset'; | ||
export { | ||
type SupportedAssetSymbol, | ||
SupportedAsset, | ||
SUPPORTED_ASSETS, | ||
} from './supported-asset'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { | ||
arbitrum, | ||
arbitrumSepolia, | ||
arbitrumGoerli, | ||
foundry, | ||
} from 'viem/chains'; | ||
|
||
export type SupportedChain = | ||
(typeof SUPPORTED_CHAINS)[keyof typeof SUPPORTED_CHAINS]; | ||
export type SupportedChainId = SupportedChain['id']; | ||
|
||
export const SUPPORTED_CHAINS = { | ||
arbitrum, | ||
arbitrumSepolia, | ||
arbitrumGoerli, | ||
foundry, | ||
}; | ||
|
||
/** | ||
* Determines whether a given chain ID corresponds to a supported chain. | ||
* | ||
* @param chainId - The chain ID to check. | ||
* @returns True if the chainId is supported, otherwise false. | ||
*/ | ||
export function isSupportedChainId( | ||
chainId: number, | ||
): chainId is SupportedChainId { | ||
return Object.values(SUPPORTED_CHAINS) | ||
.map((chain) => chain.id) | ||
.includes(chainId as SupportedChainId); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters