Skip to content

Commit

Permalink
feat(app): zksync support behind feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
hbriese committed Aug 19, 2024
1 parent 03b89d8 commit eb39993
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
6 changes: 5 additions & 1 deletion app/src/components/CreateAccount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { graphql } from 'relay-runtime';
import { useLazyQuery } from '~/api';
import { CreateAccountScreenQuery } from '~/api/__generated__/CreateAccountScreenQuery.graphql';
import { useCreateAccount } from '~/hooks/mutations/useCreateAccount';
import { experiment } from '~/lib/experiment';

const Query = graphql`
query CreateAccountScreenQuery {
Expand Down Expand Up @@ -49,7 +50,10 @@ export function CreateAccount({ onCreate }: CreateAccountScreenProps) {
const { user } = query;

const { control, handleSubmit, reset, watch } = useForm<Inputs>({
defaultValues: { name: '', chain: 'zksync-sepolia' },
defaultValues: {
name: '',
chain: experiment.variant('zksync-supported').value === 'on' ? 'zksync' : 'zksync-sepolia',
},
mode: 'onChange',
});

Expand Down
11 changes: 2 additions & 9 deletions app/src/components/fields/ChainSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { SUPPORTED_CHAIN_KEYS } from '@network/chains';
import { ICON_SIZE } from '@theme/paper';
import { createStyles, useStyles } from '@theme/styles';
import { ItemList, ItemListProps } from '#/layout/ItemList';
import { experiment } from '~/lib/experiment';

const descriptions: Record<Chain, string> = {
zksync: 'Fast & low-cost layer 2 secured by Ethereum',
Expand All @@ -22,14 +23,6 @@ export function ChainSelector({ value: selected, onChange, ...props }: ChainSele

return (
<ItemList {...props}>
<ListItem
leading={<ChainIcon chain="zksync" size={ICON_SIZE.medium} />}
headline={CHAINS['zksync'].name + ' - coming soon'}
supporting={descriptions['zksync']}
containerStyle={styles.item}
disabled
/>

{SUPPORTED_CHAIN_KEYS.map((c) => (
<ListItem
key={c}
Expand All @@ -41,7 +34,7 @@ export function ChainSelector({ value: selected, onChange, ...props }: ChainSele
onPress={() => {
onChange(c);
}}
disabled={selected !== c}
disabled={c === 'zksync' && experiment.variant('zksync-supported').value !== 'on'}
/>
))}
</ItemList>
Expand Down
2 changes: 1 addition & 1 deletion app/src/lib/network/chains.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { SelectEntry } from '#/fields/SelectChip';
import { CHAINS, Chain } from 'chains';
import _ from 'lodash';

export const SUPPORTED_CHAIN_KEYS = ['zksync-sepolia'] satisfies Chain[];
export const SUPPORTED_CHAIN_KEYS = ['zksync', 'zksync-sepolia'] satisfies Chain[];
export const SUPPORTED_CHAINS = _.pick(CHAINS, SUPPORTED_CHAIN_KEYS);

export const CHAIN_ENTRIES = Object.values(SUPPORTED_CHAINS).map(
Expand Down

0 comments on commit eb39993

Please sign in to comment.