Skip to content

Commit

Permalink
Merge pull request #217 from skip-mev/testnet-env-var
Browse files Browse the repository at this point in the history
Testnet env var
  • Loading branch information
codingki authored Mar 26, 2024
2 parents dd59988 + 04c7115 commit 75f140d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ declare namespace NodeJS {
readonly RESEND_API_KEY?: string;
readonly WALLETCONNECT_VERIFY_KEY?: string;
readonly WORD_PHRASE_KEY?: string;
readonly NEXT_PUBLIC_IS_TESTNET?: boolean;
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/hooks/useChains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export type UseChainsQueryArgs<T = Chain[]> = {

export function useChains<T = Chain[]>(args: UseChainsQueryArgs<T> = {}) {
const { select = (t) => t as T } = args;

const skipClient = useSkipClient();

return useQuery({
Expand All @@ -25,6 +24,7 @@ export function useChains<T = Chain[]>(args: UseChainsQueryArgs<T> = {}) {
const chains = await skipClient.chains({
includeEVM: true,
includeSVM: true,
includeTestnets: process.env.NEXT_PUBLIC_IS_TESTNET ? true : false,
});

return chains
Expand All @@ -36,6 +36,7 @@ export function useChains<T = Chain[]>(args: UseChainsQueryArgs<T> = {}) {
logoURI: chain.logoURI || "/logo-fallback.png",
};
})
.filter((chain) => (process.env.NEXT_PUBLIC_IS_TESTNET ? chain.isTestnet : true))
.sort((chainA, chainB) => {
return chainA.prettyName.localeCompare(chainB.prettyName);
});
Expand Down

0 comments on commit 75f140d

Please sign in to comment.