Skip to content

Commit cb2a128

Browse files
committed
some cleanup
1 parent f385cf0 commit cb2a128

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

scripts/interaction_existing_contract.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,14 @@ async function main() {
5252
// Parse constructor args
5353
let constructorArgs;
5454
try {
55-
// Remove any surrounding quotes, whitespace, and control characters
56-
let cleanedJson = constructorArgsJson.trim();
57-
// Remove surrounding quotes (single or double)
58-
cleanedJson = cleanedJson.replace(/^['"]|['"]$/g, '');
59-
// Remove any trailing whitespace or control characters
60-
cleanedJson = cleanedJson.replace(/[\s\r\n]+$/, '');
61-
62-
logger.info(`Parsing constructor args: ${cleanedJson}`);
63-
logger.info(`Constructor args length: ${cleanedJson.length}`);
55+
// Clean the JSON string (handles both workflow and local usage)
56+
const cleanedJson = constructorArgsJson
57+
.trim() // Remove leading/trailing whitespace
58+
.replace(/^['"]|['"]$/g, ''); // Remove surrounding quotes from .env parsing
6459

6560
constructorArgs = JSON.parse(cleanedJson).map((arg: string) => AztecAddress.fromString(arg));
6661
} catch (error) {
67-
logger.error(`Failed to parse constructor args`);
68-
logger.error(`Raw value: ${JSON.stringify(constructorArgsJson)}`);
69-
logger.error(`Raw value length: ${constructorArgsJson.length}`);
62+
logger.error(`Failed to parse constructor args: ${constructorArgsJson}`);
7063
logger.error(`Error: ${error}`);
7164
throw error;
7265
}

0 commit comments

Comments
 (0)