-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from tokenbound/bj/debug-large-package
Eliminate non-deployed chains from build
- Loading branch information
Showing
13 changed files
with
116 additions
and
212 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@tokenbound/sdk': patch | ||
--- | ||
|
||
Eliminate non-deployed chains from build |
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
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,17 +1,40 @@ | ||
import * as allChains from "viem/chains" | ||
import { Chain } from "viem" | ||
import { Chain } from 'viem' | ||
import { | ||
mainnet, | ||
goerli, | ||
polygon, | ||
polygonMumbai, | ||
sepolia, | ||
optimism, | ||
arbitrum, | ||
base, | ||
gnosis, | ||
} from 'viem/chains' | ||
|
||
const allChains = { | ||
mainnet, | ||
goerli, | ||
polygon, | ||
polygonMumbai, | ||
sepolia, | ||
optimism, | ||
arbitrum, | ||
base, | ||
gnosis, | ||
} | ||
|
||
/** | ||
* Gets the chain object for the given chain id. | ||
* @param chainId - Chain id of the target EVM chain. | ||
* @returns Viem's chain object. | ||
*/ | ||
|
||
export function chainIdToChain(chainId: number): Chain { | ||
for (const chain of Object.values(allChains)) { | ||
if (chain.id === chainId) { | ||
return chain | ||
} | ||
} | ||
|
||
throw new Error(`Chain with id ${chainId} not found`) | ||
} | ||
} |
Oops, something went wrong.