diff --git a/apps/web/src/components/connection/connectionForm.tsx b/apps/web/src/components/connection/connectionForm.tsx index f6fab02f..d8ed727d 100644 --- a/apps/web/src/components/connection/connectionForm.tsx +++ b/apps/web/src/components/connection/connectionForm.tsx @@ -1,7 +1,7 @@ "use client"; +import { ApplicationAutocomplete } from "@cartesi/rollups-explorer-ui"; import { Alert, - Autocomplete, Button, Flex, List, @@ -145,8 +145,6 @@ const AppConnectionForm: FC = ({ chainId, }); - const applicationAddressList = applications.map((a) => a.address); - const showLoader = !isEmpty(debouncedAddress) && fetching; const { validURL } = React.useMemo( @@ -215,15 +213,18 @@ const AppConnectionForm: FC = ({ })} > - : ""} placeholder="0x" - data={applicationAddressList} + applications={applications} data-testid="connection-address" {...form.getInputProps("address")} + onApplicationSelected={(app) => { + form.setFieldValue("address", app.address); + }} /> {isAddress(address) && !applications.length && !fetching && ( diff --git a/packages/ui/src/index.tsx b/packages/ui/src/index.tsx index 6e75caf4..8f47d4a8 100644 --- a/packages/ui/src/index.tsx +++ b/packages/ui/src/index.tsx @@ -1,4 +1,5 @@ export { AddressRelayForm } from "./AddressRelayForm"; +export { default as ApplicationAutocomplete } from "./ApplicationAutocomplete"; export { type TransactionFormSuccessData } from "./DepositFormTypes"; export { ERC1155DepositForm } from "./ERC1155DepositForm"; export { ERC20DepositForm } from "./ERC20DepositForm";