This component no longer exists. It was in Wednesday UI’s manifest when we first indexed it and is not there now — the registry served its inventory on 2026-08-13 and this item was not on it. The install command below will fail. It is kept here because a tutorial somewhere still tells people to run it.
wallet-address
wednesday-ui/wallet-addressRemovedUtility
Wednesday UI publishes no description for this item.
Install it
npx shadcn@latest add https://ui.ednesdayw.com/r/wallet-address.jsonSource
1import { createHash } from "crypto";2import { Point } from "@noble/ed25519";3import bs58 from "bs58";4import { keccak256 } from "js-sha3";56type Network = "evm" | "tron" | "solana";78export const isAddress = (address: string, network: Network = "evm") => {9 switch (network) {10 case "evm":11 return isEVMAddress(address);12 case "tron":13 return isTronAddress(address);14 case "solana":15 return isSolanaAddress(address);16 }17};1819// ============ EVM ============2021const EVM_ADDRESS_REGEX = /^0x[a-fA-F0-9]{40}$/;2223export const isEVMAddress = (address: string, strict = true) => {24 if (!EVM_ADDRESS_REGEX.test(address)) return false;25 if (address.toLowerCase() === address) return true;26 if (strict) return checksumAddress(address) === address;27 return true;28};2930export const checksumAddress = (address: string, chainId?: number) => {31 const hexAddress = chainId32 ? `${chainId}${address.toLowerCase()}`33 : address.substring(2).toLowerCase();34 const hash = keccak256.array(stringToBytes(hexAddress));35 const addr = (36 chainId ? hexAddress.substring(`${chainId}0x`.length) : hexAddress37 ).split("");38 for (let i = 0; i < 40; i += 2) {39 if (hash[i >> 1] >> 4 >= 8 && addr[i]) {40 addr[i] = addr[i].toUpperCase();41 }42 if ((hash[i >> 1] & 0x0f) >= 8 && addr[i + 1]) {43 addr[i + 1] = addr[i + 1].toUpperCase();44 }45 }46 return `0x${addr.join("")}`;47};4849const stringToBytes = (str: string) => {50 const bytes = new Uint8Array(str.length);51 for (let i = 0; i < str.length; i++) {52 bytes[i] = str.charCodeAt(i);53 }54 return bytes;55};5657// ============ Tron ============5859const TRON_ADDRESS_SIZE = 34;60const TRON_ADDRESS_PREFIX_BYTE = 0x41;6162export const isTronAddress = (address: string) => {63 if (address.length !== TRON_ADDRESS_SIZE) return false;6465 let decodeAddr = bs58.decode(address);66 if (decodeAddr.length !== 25) return false;6768 if (decodeAddr[0] !== TRON_ADDRESS_PREFIX_BYTE) return false;6970 const checkSum = decodeAddr.slice(21);71 decodeAddr = decodeAddr.slice(0, 21);7273 const hash0 = hexToBytes(sha256(decodeAddr));74 const hash1 = hexToBytes(sha256(hash0));75 const checkSum1 = hash1.slice(0, 4);7677 if (78 checkSum[0] === checkSum1[0] &&79 checkSum[1] === checkSum1[1] &&80 checkSum[2] === checkSum1[2] &&81 checkSum[3] === checkSum1[3]82 )83 return true;8485 return false;86};8788/**89 * SHA256 hash function90 */91function sha256(data: Uint8Array): string {92 return createHash("sha256").update(data).digest("hex");93}9495// … truncated
What it pulls in
npm packages
