From 359e05c2794f42e32ff6a4d80f1e433a3dfa7213 Mon Sep 17 00:00:00 2001 From: vilenarios Date: Wed, 12 Aug 2026 13:36:39 -0400 Subject: [PATCH 1/4] fix(validation): accept full-length Solana addresses in ANT inputs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pasting a Solana ANT address into the "bring your own ANT" inputs was silently ignored. A 32-byte Solana pubkey base58-encodes to 43 or 44 characters, but these inputs still enforced Arweave's fixed 43-character transaction ID length, so most addresses were rejected. The failure was invisible because ValidationInput returns early — without calling setValue or surfacing an error — when input exceeds maxCharLength or fails customPattern. The field just appeared to ignore the paste. Name reassignment ("Use existing ANT"): maxCharLength was already 44, but customPattern={ARNS_TX_ID_ENTRY_REGEX} capped entry at 43 and won. Name registration (Advanced Options): the ANT selector capped entry at 43 via ARWEAVE_TX_LENGTH, validated input with validateArweaveId, and gated its "Import" button on isArweaveTransactionID — so bringing your own ANT could not be completed at all, not merely pasted. Both now validate as base58 Solana addresses over the full 32-44 range, via new SOLANA_ADDRESS_ENTRY_REGEX / SOLANA_ADDRESS_MAX_LENGTH constants. Arweave data pointers (target IDs, undername records, logos) keep the 43-character constants — those really are Arweave transactions. Co-Authored-By: Claude Opus 5 --- .../NameTokenSelector/NameTokenSelector.tsx | 23 +++++++++---- .../ReassignNameModal/ReassignNameModal.tsx | 32 +++++++++++-------- src/utils/constants.ts | 19 +++++++++++ 3 files changed, 53 insertions(+), 21 deletions(-) diff --git a/src/components/inputs/text/NameTokenSelector/NameTokenSelector.tsx b/src/components/inputs/text/NameTokenSelector/NameTokenSelector.tsx index 97b5d1f64..7b19863cf 100644 --- a/src/components/inputs/text/NameTokenSelector/NameTokenSelector.tsx +++ b/src/components/inputs/text/NameTokenSelector/NameTokenSelector.tsx @@ -10,8 +10,11 @@ import { SolanaAddress } from '../../../../services/solana/SolanaAddress'; import { useGlobalState } from '../../../../state/contexts/GlobalState'; import { useWalletState } from '../../../../state/contexts/WalletState'; import { AoAddress, VALIDATION_INPUT_TYPES } from '../../../../types'; -import { isArweaveTransactionID, wrapAntId } from '../../../../utils'; -import { ARWEAVE_TX_LENGTH } from '../../../../utils/constants'; +import { isValidSolanaAddress, wrapAntId } from '../../../../utils'; +import { + SOLANA_ADDRESS_ENTRY_REGEX, + SOLANA_ADDRESS_MAX_LENGTH, +} from '../../../../utils/constants'; import eventEmitter from '../../../../utils/events'; import { CloseIcon, HamburgerOutlineIcon } from '../../../icons'; import { Loader } from '../../../layout'; @@ -364,7 +367,11 @@ function NameTokenSelector({ showValidationIcon={true} setValue={(v) => handleTokenSearch(v)} value={searchText ?? ''} - maxCharLength={ARWEAVE_TX_LENGTH} + // An ANT id is a Solana mint pubkey (base58, 32–44 chars), not an + // Arweave TX ID. The previous 43-char cap silently swallowed the + // paste for most addresses. + maxCharLength={SOLANA_ADDRESS_MAX_LENGTH} + customPattern={SOLANA_ADDRESS_ENTRY_REGEX} placeholder={ selectedToken ? selectedToken.name?.length @@ -373,9 +380,11 @@ function NameTokenSelector({ : 'Add an Ar.io Name Token (ANT)' } validationPredicates={{ - [VALIDATION_INPUT_TYPES.ARWEAVE_ID]: { - fn: (id: string) => { - return arweaveDataProvider.validateArweaveId(id); + [VALIDATION_INPUT_TYPES.SOLANA_ADDRESS]: { + fn: async (id: string) => { + if (!isValidSolanaAddress(id)) { + throw new Error('Invalid Token Address'); + } }, }, }} @@ -407,7 +416,7 @@ function NameTokenSelector({ ) : searchText && validImport === false ? ( <> ) : searchText && - isArweaveTransactionID(searchText) && + isValidSolanaAddress(searchText) && !Object.keys(tokens ?? []).includes(searchText) ? (