13 lines
528 B
TypeScript
13 lines
528 B
TypeScript
// To be used in JSON.stringify when a field might be bigint
|
|
|
|
// https://wagmi.sh/react/faq#bigint-serialization
|
|
export const replacer = (_key: string, value: unknown) => (typeof value === "bigint" ? value.toString() : value);
|
|
|
|
export const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
|
|
export const isZeroAddress = (address: string) => address === ZERO_ADDRESS;
|
|
|
|
// Treat any dot-separated string as a potential ENS name
|
|
const ensRegex = /.+\..+/;
|
|
export const isENS = (address = "") => ensRegex.test(address);
|