diff --git a/app/src/app/(nav)/[account]/tokens/[address].tsx b/app/src/app/(nav)/[account]/tokens/[address].tsx index b499f3806..9dbbb943c 100644 --- a/app/src/app/(nav)/[account]/tokens/[address].tsx +++ b/app/src/app/(nav)/[account]/tokens/[address].tsx @@ -87,8 +87,7 @@ function TokenScreen_() { priceId: t?.pythUsdPriceId ?? undefined, }, }); - const [icon, priceId] = watch(['name', 'symbol', 'icon', 'priceId']); - const iconValid = !!tryOrIgnore(() => icon && new URL(icon)); + const priceId = watch('priceId'); return ( @@ -136,14 +135,6 @@ function TokenScreen_() { placeholder="0x..." control={control} /> - - {!priceId && ( - - - - )} @@ -165,6 +156,14 @@ function TokenScreen_() { > {query.token ? 'Update' : 'Add'} + + {!priceId && ( + + + + )} diff --git a/app/src/app/(nav)/token/add.tsx b/app/src/app/(nav)/[account]/tokens/add.tsx similarity index 67% rename from app/src/app/(nav)/token/add.tsx rename to app/src/app/(nav)/[account]/tokens/add.tsx index bdfcc7738..919dac957 100644 --- a/app/src/app/(nav)/token/add.tsx +++ b/app/src/app/(nav)/[account]/tokens/add.tsx @@ -1,39 +1,43 @@ import { Appbar } from '#/Appbar/Appbar'; -import { FormSelectChip } from '#/fields/FormSelectChip'; import { FormSubmitButton } from '#/fields/FormSubmitButton'; import { FormTextField } from '#/fields/FormTextField'; import { Actions } from '#/layout/Actions'; -import { ScrollableScreenSurface } from '#/layout/ScrollableScreenSurface'; import { zodResolver } from '@hookform/resolvers/zod'; -import { CHAIN_ENTRIES } from '@network/chains'; import { createStyles } from '@theme/styles'; import { useRouter } from 'expo-router'; -import { asUAddress } from 'lib'; +import { asChain, asUAddress } from 'lib'; import { useForm } from 'react-hook-form'; import { View } from 'react-native'; import { z } from 'zod'; -import { useSelectedChain } from '~/hooks/useSelectedAccount'; import { zAddress, zChain } from '~/lib/zod'; import { ADDRESS_FIELD_RULES } from '~/util/form.rules'; +import { AccountParams } from '../_layout'; +import { useLocalParams } from '~/hooks/useLocalParams'; +import { Pane } from '#/layout/Pane'; +import { Scrollable } from '#/Scrollable'; +import { FormChainSelector } from '#/fields/FormChainSelector'; const scheme = z.object({ address: zAddress(), chain: zChain(), }); +const Params = AccountParams; + export default function AddTokenScreen() { + const { account } = useLocalParams(Params); const router = useRouter(); const { control, handleSubmit } = useForm>({ resolver: zodResolver(scheme), - defaultValues: { chain: useSelectedChain() }, + defaultValues: { chain: asChain(account) }, }); return ( - <> - + + - + - + - + router.replace({ - pathname: '/(nav)/token/[address]', - params: { address: asUAddress(address, chain) }, + pathname: '/(nav)/[account]/tokens/[address]', + params: { account, address: asUAddress(address, chain) }, }), )} > Continue - - + + ); } const styles = createStyles({ container: { - marginVertical: 16, marginHorizontal: 16, gap: 16, },