Skip to content

Commit d41af7c

Browse files
committed
fix: program ids
1 parent 723f0b5 commit d41af7c

2 files changed

Lines changed: 34 additions & 22 deletions

File tree

typescript/aleo-sdk/scripts/generate-artifacts.js

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export function loadProgramsInDeployOrder(
8282
warpSalt?: string,
8383
): { id: string, program: string }[] {
8484
const visited = new Set<string>();
85-
const programs: Program[] = [];
85+
let programs: Program[] = [];
8686
8787
function visit(p: string) {
8888
if (visited.has(p)) return;
@@ -103,18 +103,24 @@ export function loadProgramsInDeployOrder(
103103
104104
visit(programName);
105105
106+
programs = programs.map((p) =>
107+
Program.fromString(
108+
p
109+
.toString()
110+
.replaceAll(
111+
/(mailbox|dispatch_proxy|validator_announce).aleo/g,
112+
(_, p1) => \`\${p1}_\${coreSalt}.aleo\`,
113+
)
114+
.replaceAll(
115+
/(hyp_native|hyp_collateral|hyp_synthetic).aleo/g,
116+
(_, p1) => \`\${p1}_\${warpSalt || coreSalt}.aleo\`,
117+
),
118+
),
119+
);
120+
106121
return programs.map((p) => ({
107122
id: p.id(),
108-
program: p
109-
.toString()
110-
.replaceAll(
111-
/(mailbox|dispatch_proxy|validator_announce).aleo/g,
112-
(_, p1) => \`\${p1}_\${coreSalt}.aleo\`,
113-
)
114-
.replaceAll(
115-
/(hyp_native|hyp_collateral|hyp_synthetic).aleo/g,
116-
(_, p1) => \`\${p1}_\${warpSalt || coreSalt}.aleo\`,
117-
),
123+
program: p.toString(),
118124
}));
119125
}
120126
`;

typescript/aleo-sdk/src/artifacts.ts

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function loadProgramsInDeployOrder(
3030
warpSalt?: string,
3131
): { id: string; program: string }[] {
3232
const visited = new Set<string>();
33-
const programs: Program[] = [];
33+
let programs: Program[] = [];
3434

3535
function visit(p: string) {
3636
if (visited.has(p)) return;
@@ -51,17 +51,23 @@ export function loadProgramsInDeployOrder(
5151

5252
visit(programName);
5353

54+
programs = programs.map((p) =>
55+
Program.fromString(
56+
p
57+
.toString()
58+
.replaceAll(
59+
/(mailbox|dispatch_proxy|validator_announce).aleo/g,
60+
(_, p1) => `${p1}_${coreSalt}.aleo`,
61+
)
62+
.replaceAll(
63+
/(hyp_native|hyp_collateral|hyp_synthetic).aleo/g,
64+
(_, p1) => `${p1}_${warpSalt || coreSalt}.aleo`,
65+
),
66+
),
67+
);
68+
5469
return programs.map((p) => ({
5570
id: p.id(),
56-
program: p
57-
.toString()
58-
.replaceAll(
59-
/(mailbox|dispatch_proxy|validator_announce).aleo/g,
60-
(_, p1) => `${p1}_${coreSalt}.aleo`,
61-
)
62-
.replaceAll(
63-
/(hyp_native|hyp_collateral|hyp_synthetic).aleo/g,
64-
(_, p1) => `${p1}_${warpSalt || coreSalt}.aleo`,
65-
),
71+
program: p.toString(),
6672
}));
6773
}

0 commit comments

Comments
 (0)