• A type guard that returns true if the input string conforms to the Address type, and refines its type for use in your program.

    Parameters

    • putativeAddress: string

    Returns putativeAddress is Address<string>

    import { isAddress } from '@solana/addresses';

    if (isAddress(ownerAddress)) {
    // At this point, `ownerAddress` has been refined to a
    // `Address` that can be used with the RPC.
    const { value: lamports } = await rpc.getBalance(ownerAddress).send();
    setBalanceLamports(lamports);
    } else {
    setError(`${ownerAddress} is not an address`);
    }