Initial commit with 🏗️ create-eth @ 2.0.4
This commit is contained in:
12
packages/nextjs/utils/scaffold-eth/common.ts
Normal file
12
packages/nextjs/utils/scaffold-eth/common.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
// 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);
|
||||
Reference in New Issue
Block a user