Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

useAddresses

Fetch all registered chain addresses for a name.

Usage

import { useAddresses } from "@oniym/react";
 
function AddressList({ name }: { name: string }) {
  const { data: addresses = {} } = useAddresses(name);
 
  return (
    <ul>
      {Object.entries(addresses).map(([chain, addr]) => (
        <li key={chain}>{chain}: {addr}</li>
      ))}
    </ul>
  );
}

Parameters

ParameterTypeDescription
namestring | undefinedFull name with TLD. Query disabled when undefined.

Returns

UseQueryResult<Partial<Record<SupportedChain, string>>>

Only chains with a record set on-chain are present in the result.

Query key

["oniym", "addresses", name]


useAddress

Fetch the address for a single chain.

Usage

import { useAddress } from "@oniym/react";
 
function EthAddress({ name }: { name: string }) {
  const { data: address } = useAddress(name, "eth");
  return <span>{address ?? "not set"}</span>;
}

Parameters

ParameterTypeDescription
namestring | undefinedFull name with TLD.
chainSupportedChain"btc" | "eth" | "sol" | "sui" | "bnb"

Returns

UseQueryResult<string | null>

Query key

["oniym", "address", name, chain]