{"version":3,"file":"utils-C2QdbtNI-aRYZeOB0.cjs","names":[],"sources":["../../adapter-evm-core/dist/artifacts-CdE4lY5E.mjs","../../adapter-evm-core/dist/utils-C2QdbtNI.mjs"],"sourcesContent":["//#region src/types/artifacts.ts\n/**\n* Type guard to check if an object matches EvmContractArtifacts structure\n*/\nfunction isEvmContractArtifacts(obj) {\n\treturn typeof obj === \"object\" && obj !== null && typeof obj.contractAddress === \"string\";\n}\n\n//#endregion\nexport { isEvmContractArtifacts as t };\n//# sourceMappingURL=artifacts-CdE4lY5E.mjs.map","import { t as isEvmContractArtifacts } from \"./artifacts-CdE4lY5E.mjs\";\nimport { formatGwei, parseGwei } from \"viem\";\n\n//#region src/utils/artifacts.ts\n/**\n* Validates and converts generic source input to EvmContractArtifacts\n*\n* @param source - Generic contract source (string address or artifacts object)\n* @returns Validated EvmContractArtifacts\n* @throws Error if the source is invalid\n*/\nfunction validateAndConvertEvmArtifacts(source) {\n\tif (typeof source === \"string\") return { contractAddress: source };\n\tif (!isEvmContractArtifacts(source)) throw new Error(\"Invalid contract artifacts provided. Expected an object with contractAddress property.\");\n\treturn source;\n}\n\n//#endregion\n//#region src/utils/json.ts\n/**\n* Custom JSON stringifier that handles BigInt values by converting them to strings.\n* @param value The value to stringify.\n* @param space Adds indentation, white space, and line break characters to the return-value JSON text for readability.\n* @returns A JSON string representing the given value.\n*/\nfunction stringifyWithBigInt(value, space) {\n\tconst replacer = (_key, val) => {\n\t\tif (typeof val === \"bigint\") return val.toString();\n\t\treturn val;\n\t};\n\treturn JSON.stringify(value, replacer, space);\n}\n\n//#endregion\n//#region src/utils/formatting.ts\n/**\n* Format a method name for display (e.g., from camelCase to Title Case).\n*/\nfunction formatMethodName(name) {\n\tif (!name) return \"\";\n\treturn name.replace(/([A-Z])/g, \" $1\").replace(/^./, (str) => str.toUpperCase()).trim();\n}\n/**\n* Format an input name for display (e.g., from camelCase or snake_case to Title Case).\n* Provides a default name based on type if the original name is empty.\n*/\nfunction formatInputName(name, type) {\n\tif (!name || name === \"\") return `Parameter (${type})`;\n\treturn name.replace(/([A-Z])/g, \" $1\").replace(/_/g, \" \").replace(/^./, (str) => str.toUpperCase()).trim();\n}\n\n//#endregion\n//#region src/utils/gas.ts\n/**\n* Convert wei values to gwei for display using viem\n*/\nconst weiToGwei = (wei) => {\n\tif (!wei) return void 0;\n\treturn parseFloat(formatGwei(BigInt(wei)));\n};\n/**\n* Convert gwei values to wei using viem\n*/\nconst gweiToWei = (gwei) => {\n\tif (!gwei) return void 0;\n\treturn Number(parseGwei(gwei.toString()));\n};\n\n//#endregion\nexport { stringifyWithBigInt as a, formatMethodName as i, weiToGwei as n, validateAndConvertEvmArtifacts as o, formatInputName as r, gweiToWei as t };\n//# sourceMappingURL=utils-C2QdbtNI.mjs.map"],"mappings":";;;;;;;AAIA,SAAS,uBAAuB,KAAK;AACpC,QAAO,OAAO,QAAQ,YAAY,QAAQ,QAAQ,OAAO,IAAI,oBAAoB;;;;;;;;;;;;ACMlF,SAAS,+BAA+B,QAAQ;AAC/C,KAAI,OAAO,WAAW,SAAU,QAAO,EAAE,iBAAiB,QAAQ;AAClE,KAAI,CAAC,uBAAuB,OAAO,CAAE,OAAM,IAAI,MAAM,yFAAyF;AAC9I,QAAO;;;;;;;;AAWR,SAAS,oBAAoB,OAAO,OAAO;CAC1C,MAAM,YAAY,MAAM,QAAQ;AAC/B,MAAI,OAAO,QAAQ,SAAU,QAAO,IAAI,UAAU;AAClD,SAAO;;AAER,QAAO,KAAK,UAAU,OAAO,UAAU,MAAM;;;;;AAQ9C,SAAS,iBAAiB,MAAM;AAC/B,KAAI,CAAC,KAAM,QAAO;AAClB,QAAO,KAAK,QAAQ,YAAY,MAAM,CAAC,QAAQ,OAAO,QAAQ,IAAI,aAAa,CAAC,CAAC,MAAM;;;;;;AAMxF,SAAS,gBAAgB,MAAM,MAAM;AACpC,KAAI,CAAC,QAAQ,SAAS,GAAI,QAAO,cAAc,KAAK;AACpD,QAAO,KAAK,QAAQ,YAAY,MAAM,CAAC,QAAQ,MAAM,IAAI,CAAC,QAAQ,OAAO,QAAQ,IAAI,aAAa,CAAC,CAAC,MAAM;;;;;AAQ3G,MAAM,aAAa,QAAQ;AAC1B,KAAI,CAAC,IAAK,QAAO,KAAK;AACtB,QAAO,gCAAsB,OAAO,IAAI,CAAC,CAAC;;;;;AAK3C,MAAM,aAAa,SAAS;AAC3B,KAAI,CAAC,KAAM,QAAO,KAAK;AACvB,QAAO,2BAAiB,KAAK,UAAU,CAAC,CAAC"}