-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
106 additions
and
105 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
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,41 +1,18 @@ | ||
import { getRequestScopeContextValue } from '../context/request-scoped-context'; | ||
import { Chain } from '@prisma/client'; | ||
|
||
const chainIdToChain: { [id: string]: Chain } = { | ||
'1': Chain.MAINNET, | ||
'10': Chain.OPTIMISM, | ||
'100': Chain.GNOSIS, | ||
'137': Chain.POLYGON, | ||
'250': Chain.FANTOM, | ||
'1101': Chain.ZKEVM, | ||
'8453': Chain.BASE, | ||
'42161': Chain.ARBITRUM, | ||
'43114': Chain.AVALANCHE, | ||
} | ||
|
||
export const chainToChainId: { [chain: string]: string } = { | ||
[Chain.MAINNET]: '1', | ||
[Chain.OPTIMISM]: '10', | ||
[Chain.GNOSIS]: '100', | ||
[Chain.POLYGON]: '137', | ||
[Chain.FANTOM]: '250', | ||
[Chain.ZKEVM]: '1101', | ||
[Chain.BASE]: '8453', | ||
[Chain.ARBITRUM]: '42161', | ||
[Chain.AVALANCHE]: '43114', | ||
}; | ||
import { chainIdToChain } from '../network/network-config'; | ||
|
||
/** | ||
* Setup to transition out from the old header-based chainIDs to the new required chain query filters. | ||
* | ||
* | ||
* @returns The chain of the current request, if any. | ||
*/ | ||
export const headerChain = (): Chain | undefined => { | ||
const chainId = getRequestScopeContextValue<string>('chainId'); | ||
|
||
if (chainId) { | ||
return chainIdToChain[chainId]; | ||
} | ||
|
||
return undefined; | ||
} | ||
}; |
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
Oops, something went wrong.