UNPKG

@metamask/design-system-react

Version:
57 lines 2.36 kB
import { KnownCaipNamespace } from "@metamask/utils"; /** * Generates a numeric seed for Ethereum (eip155) addresses. * * @param address The Ethereum address to generate a seed from * @returns A numeric seed derived from the address */ export declare function generateSeedEthereum(address: string): number; /** * Generates a byte-array seed for non-Ethereum addresses (Solana, Bitcoin, etc.). * * @param address The non-Ethereum address to generate a seed from * @returns An array of numbers representing the byte-array seed */ export declare function generateSeedNonEthereum(address: string): number[]; /** * Dynamically checks if the address is Bitcoin or Solana; otherwise defaults to Ethereum. * Returns a Promise that resolves to one of the known CAIP-2 namespaces. * * In this update, if the address starts with "0x", we'll assume it's Ethereum (Eip155) * and avoid the dynamic import that can cause the "Requiring unknown module '2021'" error. * * @param address The address to check and determine its namespace * @returns A promise that resolves to the detected CAIP-2 namespace */ export declare function getCaipNamespaceFromAddress(address: string): Promise<KnownCaipNamespace>; /** * SDBM hash function * * @param str The string to hash * @returns A numeric hash value */ export declare function sdbmHash(str: string): number; /** * Convert numeric/byte-array seed to a 6+ length string * * @param seed The seed value to convert (either a number or array of numbers) * @returns A string representation of the seed (minimum 6 characters) */ export declare function seedToString(seed: number | number[]): string; /** * Builds a full <svg> string containing the Maskicon shapes. * * @param seed The seed value used to generate the icon * @param size The size of the SVG icon in pixels * @returns An SVG string representing the Maskicon */ export declare function createMaskiconSVG(seed: number | number[], size?: number): string; /** * Returns a Promise that resolves to the final <svg> string for the given address. * * @param address The address to generate the Maskicon for * @param size The size of the icon in pixels * @returns A promise that resolves to an SVG string */ export declare function getMaskiconSVG(address: string, size: number): Promise<string>; //# sourceMappingURL=Maskicon.utilities.d.mts.map