@aztec/standard-contracts 0.0.1-commit.04d373f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/AuthRegistry.d.json.ts +5 -0
- package/artifacts/AuthRegistry.json +7838 -0
- package/artifacts/MultiCallEntrypoint.d.json.ts +5 -0
- package/artifacts/MultiCallEntrypoint.json +5994 -0
- package/artifacts/PublicChecks.d.json.ts +5 -0
- package/artifacts/PublicChecks.json +4290 -0
- package/dest/auth-registry/constants.d.ts +4 -0
- package/dest/auth-registry/constants.d.ts.map +1 -0
- package/dest/auth-registry/constants.js +7 -0
- package/dest/auth-registry/index.d.ts +6 -0
- package/dest/auth-registry/index.d.ts.map +1 -0
- package/dest/auth-registry/index.js +14 -0
- package/dest/auth-registry/lazy.d.ts +7 -0
- package/dest/auth-registry/lazy.d.ts.map +1 -0
- package/dest/auth-registry/lazy.js +24 -0
- package/dest/contract_data.d.ts +63 -0
- package/dest/contract_data.d.ts.map +1 -0
- package/dest/contract_data.js +101 -0
- package/dest/drift.d.ts +54 -0
- package/dest/drift.d.ts.map +1 -0
- package/dest/drift.js +167 -0
- package/dest/index.d.ts +4 -0
- package/dest/index.d.ts.map +1 -0
- package/dest/index.js +3 -0
- package/dest/make_standard_contract.d.ts +9 -0
- package/dest/make_standard_contract.d.ts.map +1 -0
- package/dest/make_standard_contract.js +40 -0
- package/dest/multi-call-entrypoint/constants.d.ts +4 -0
- package/dest/multi-call-entrypoint/constants.d.ts.map +1 -0
- package/dest/multi-call-entrypoint/constants.js +7 -0
- package/dest/multi-call-entrypoint/index.d.ts +6 -0
- package/dest/multi-call-entrypoint/index.d.ts.map +1 -0
- package/dest/multi-call-entrypoint/index.js +14 -0
- package/dest/multi-call-entrypoint/lazy.d.ts +7 -0
- package/dest/multi-call-entrypoint/lazy.d.ts.map +1 -0
- package/dest/multi-call-entrypoint/lazy.js +24 -0
- package/dest/public-checks/constants.d.ts +4 -0
- package/dest/public-checks/constants.d.ts.map +1 -0
- package/dest/public-checks/constants.js +7 -0
- package/dest/public-checks/index.d.ts +6 -0
- package/dest/public-checks/index.d.ts.map +1 -0
- package/dest/public-checks/index.js +14 -0
- package/dest/public-checks/lazy.d.ts +7 -0
- package/dest/public-checks/lazy.d.ts.map +1 -0
- package/dest/public-checks/lazy.js +24 -0
- package/dest/scripts/cleanup_artifacts.js +16 -0
- package/dest/scripts/generate_data.js +136 -0
- package/dest/standard_contract.d.ts +15 -0
- package/dest/standard_contract.d.ts.map +1 -0
- package/dest/standard_contract.js +1 -0
- package/dest/standard_contract_data.d.ts +19 -0
- package/dest/standard_contract_data.d.ts.map +1 -0
- package/dest/standard_contract_data.js +61 -0
- package/package.json +102 -0
- package/src/auth-registry/constants.ts +8 -0
- package/src/auth-registry/index.ts +24 -0
- package/src/auth-registry/lazy.ts +35 -0
- package/src/contract_data.ts +124 -0
- package/src/drift.ts +201 -0
- package/src/index.ts +3 -0
- package/src/make_standard_contract.ts +51 -0
- package/src/multi-call-entrypoint/constants.ts +8 -0
- package/src/multi-call-entrypoint/index.ts +24 -0
- package/src/multi-call-entrypoint/lazy.ts +35 -0
- package/src/public-checks/constants.ts +8 -0
- package/src/public-checks/index.ts +24 -0
- package/src/public-checks/lazy.ts +35 -0
- package/src/standard_contract.ts +15 -0
- package/src/standard_contract_data.ts +76 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
+
import { makeStandardContract } from '../make_standard_contract.js';
|
|
3
|
+
export { STANDARD_MULTI_CALL_ENTRYPOINT_ADDRESS, STANDARD_MULTI_CALL_ENTRYPOINT_CLASS_ID, STANDARD_MULTI_CALL_ENTRYPOINT_SALT } from './constants.js';
|
|
4
|
+
let standardContract;
|
|
5
|
+
let standardContractArtifact;
|
|
6
|
+
export async function getMultiCallEntrypointArtifact() {
|
|
7
|
+
if (!standardContractArtifact) {
|
|
8
|
+
// Cannot assert this import as it's incompatible with bundlers like vite
|
|
9
|
+
// https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
|
|
10
|
+
// Even if now supported by all major browsers, the MIME type is replaced with
|
|
11
|
+
// "text/javascript"
|
|
12
|
+
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
13
|
+
const { default: multiCallEntrypointJson } = await import('../../artifacts/MultiCallEntrypoint.json');
|
|
14
|
+
standardContractArtifact = loadContractArtifact(multiCallEntrypointJson);
|
|
15
|
+
}
|
|
16
|
+
return standardContractArtifact;
|
|
17
|
+
}
|
|
18
|
+
/** Returns the standard deployment of the multi-call entrypoint. */ export async function getStandardMultiCallEntrypoint() {
|
|
19
|
+
if (!standardContract) {
|
|
20
|
+
const artifact = await getMultiCallEntrypointArtifact();
|
|
21
|
+
standardContract = makeStandardContract('MultiCallEntrypoint', artifact);
|
|
22
|
+
}
|
|
23
|
+
return standardContract;
|
|
24
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const STANDARD_PUBLIC_CHECKS_ADDRESS: import("@aztec/stdlib/aztec-address").AztecAddress;
|
|
2
|
+
export declare const STANDARD_PUBLIC_CHECKS_CLASS_ID: import("@aztec/foundation/schemas").Fr;
|
|
3
|
+
export declare const STANDARD_PUBLIC_CHECKS_SALT: import("@aztec/foundation/schemas").Fr;
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcHVibGljLWNoZWNrcy9jb25zdGFudHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBS0EsZUFBTyxNQUFNLDhCQUE4QixvREFBdUMsQ0FBQztBQUNuRixlQUFPLE1BQU0sK0JBQStCLHdDQUF1QyxDQUFDO0FBQ3BGLGVBQU8sTUFBTSwyQkFBMkIsd0NBQW9DLENBQUMifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/public-checks/constants.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,8BAA8B,oDAAuC,CAAC;AACnF,eAAO,MAAM,+BAA+B,wCAAuC,CAAC;AACpF,eAAO,MAAM,2BAA2B,wCAAoC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Lightweight metadata leaf export for browser bundles: importing from
|
|
2
|
+
// `@aztec/standard-contracts/public-checks/constants` avoids dragging in the
|
|
3
|
+
// `PublicChecks.json` static import.
|
|
4
|
+
import { StandardContractAddress, StandardContractClassId, StandardContractSalt } from '../standard_contract_data.js';
|
|
5
|
+
export const STANDARD_PUBLIC_CHECKS_ADDRESS = StandardContractAddress.PublicChecks;
|
|
6
|
+
export const STANDARD_PUBLIC_CHECKS_CLASS_ID = StandardContractClassId.PublicChecks;
|
|
7
|
+
export const STANDARD_PUBLIC_CHECKS_SALT = StandardContractSalt.PublicChecks;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { StandardContract } from '../standard_contract.js';
|
|
2
|
+
export { STANDARD_PUBLIC_CHECKS_ADDRESS, STANDARD_PUBLIC_CHECKS_CLASS_ID, STANDARD_PUBLIC_CHECKS_SALT, } from './constants.js';
|
|
3
|
+
export declare const PublicChecksArtifact: import("@aztec/stdlib/abi").ContractArtifact;
|
|
4
|
+
/** Returns the standard deployment of public_checks. */
|
|
5
|
+
export declare function getStandardPublicChecks(): Promise<StandardContract>;
|
|
6
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wdWJsaWMtY2hlY2tzL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUtBLE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFFaEUsT0FBTyxFQUNMLDhCQUE4QixFQUM5QiwrQkFBK0IsRUFDL0IsMkJBQTJCLEdBQzVCLE1BQU0sZ0JBQWdCLENBQUM7QUFFeEIsZUFBTyxNQUFNLG9CQUFvQiw4Q0FBaUUsQ0FBQztBQUluRyx3REFBd0Q7QUFDeEQsd0JBQWdCLHVCQUF1QixJQUFJLE9BQU8sQ0FBQyxnQkFBZ0IsQ0FBQyxDQUtuRSJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/public-checks/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EACL,8BAA8B,EAC9B,+BAA+B,EAC/B,2BAA2B,GAC5B,MAAM,gBAAgB,CAAC;AAExB,eAAO,MAAM,oBAAoB,8CAAiE,CAAC;AAInG,wDAAwD;AACxD,wBAAgB,uBAAuB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAKnE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
+
import PublicChecksJson from '../../artifacts/PublicChecks.json' with {
|
|
3
|
+
type: 'json'
|
|
4
|
+
};
|
|
5
|
+
import { makeStandardContract } from '../make_standard_contract.js';
|
|
6
|
+
export { STANDARD_PUBLIC_CHECKS_ADDRESS, STANDARD_PUBLIC_CHECKS_CLASS_ID, STANDARD_PUBLIC_CHECKS_SALT } from './constants.js';
|
|
7
|
+
export const PublicChecksArtifact = loadContractArtifact(PublicChecksJson);
|
|
8
|
+
let standardContract;
|
|
9
|
+
/** Returns the standard deployment of public_checks. */ export function getStandardPublicChecks() {
|
|
10
|
+
if (!standardContract) {
|
|
11
|
+
standardContract = makeStandardContract('PublicChecks', PublicChecksArtifact);
|
|
12
|
+
}
|
|
13
|
+
return Promise.resolve(standardContract);
|
|
14
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
+
import type { StandardContract } from '../standard_contract.js';
|
|
3
|
+
export { STANDARD_PUBLIC_CHECKS_ADDRESS, STANDARD_PUBLIC_CHECKS_CLASS_ID, STANDARD_PUBLIC_CHECKS_SALT, } from './constants.js';
|
|
4
|
+
export declare function getPublicChecksArtifact(): Promise<ContractArtifact>;
|
|
5
|
+
/** Returns the standard deployment of public_checks. */
|
|
6
|
+
export declare function getStandardPublicChecks(): Promise<StandardContract>;
|
|
7
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF6eS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3B1YmxpYy1jaGVja3MvbGF6eS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsS0FBSyxnQkFBZ0IsRUFBd0IsTUFBTSxtQkFBbUIsQ0FBQztBQUdoRixPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBRWhFLE9BQU8sRUFDTCw4QkFBOEIsRUFDOUIsK0JBQStCLEVBQy9CLDJCQUEyQixHQUM1QixNQUFNLGdCQUFnQixDQUFDO0FBS3hCLHdCQUFzQix1QkFBdUIsSUFBSSxPQUFPLENBQUMsZ0JBQWdCLENBQUMsQ0FXekU7QUFFRCx3REFBd0Q7QUFDeEQsd0JBQXNCLHVCQUF1QixJQUFJLE9BQU8sQ0FBQyxnQkFBZ0IsQ0FBQyxDQU16RSJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/public-checks/lazy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAwB,MAAM,mBAAmB,CAAC;AAGhF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EACL,8BAA8B,EAC9B,+BAA+B,EAC/B,2BAA2B,GAC5B,MAAM,gBAAgB,CAAC;AAKxB,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAWzE;AAED,wDAAwD;AACxD,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAMzE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
+
import { makeStandardContract } from '../make_standard_contract.js';
|
|
3
|
+
export { STANDARD_PUBLIC_CHECKS_ADDRESS, STANDARD_PUBLIC_CHECKS_CLASS_ID, STANDARD_PUBLIC_CHECKS_SALT } from './constants.js';
|
|
4
|
+
let standardContract;
|
|
5
|
+
let standardContractArtifact;
|
|
6
|
+
export async function getPublicChecksArtifact() {
|
|
7
|
+
if (!standardContractArtifact) {
|
|
8
|
+
// Cannot assert this import as it's incompatible with bundlers like vite
|
|
9
|
+
// https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
|
|
10
|
+
// Even if now supported by all major browsers, the MIME type is replaced with
|
|
11
|
+
// "text/javascript"
|
|
12
|
+
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
13
|
+
const { default: publicChecksJson } = await import('../../artifacts/PublicChecks.json');
|
|
14
|
+
standardContractArtifact = loadContractArtifact(publicChecksJson);
|
|
15
|
+
}
|
|
16
|
+
return standardContractArtifact;
|
|
17
|
+
}
|
|
18
|
+
/** Returns the standard deployment of public_checks. */ export async function getStandardPublicChecks() {
|
|
19
|
+
if (!standardContract) {
|
|
20
|
+
const artifact = await getPublicChecksArtifact();
|
|
21
|
+
standardContract = makeStandardContract('PublicChecks', artifact);
|
|
22
|
+
}
|
|
23
|
+
return standardContract;
|
|
24
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { fileURLToPath } from '@aztec/foundation/url';
|
|
2
|
+
import { readFile, readdir, writeFile } from 'fs/promises';
|
|
3
|
+
import { join } from 'path';
|
|
4
|
+
async function cleanupArtifacts(target) {
|
|
5
|
+
const files = await readdir(target);
|
|
6
|
+
for (const file of files){
|
|
7
|
+
if (!file.endsWith('.json')) {
|
|
8
|
+
continue;
|
|
9
|
+
}
|
|
10
|
+
const fileData = JSON.parse((await readFile(join(target, file), 'utf8')).toString());
|
|
11
|
+
/* eslint-disable camelcase */ fileData.file_map = {};
|
|
12
|
+
fileData.debug_symbols = {};
|
|
13
|
+
/* eslint-enable camelcase */ await writeFile(join(target, file), JSON.stringify(fileData));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
await cleanupArtifacts(fileURLToPath(new URL('../../artifacts', import.meta.url).href));
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
// Reads compiled Noir artifacts for each standard contract and derives their addresses, class IDs,
|
|
2
|
+
// bytecode commitments, and initialization hashes — emitting everything as precomputed constants
|
|
3
|
+
// into `standard_contract_data.ts` and as Noir address stamps into the `standard_addresses.nr`
|
|
4
|
+
// modules of `aztec-nr/aztec` and `noir-contracts/.../aztec_sublib`. This avoids clients repeating
|
|
5
|
+
// the expensive hashing at runtime and keeps the Noir-side address aligned with the TS-side.
|
|
6
|
+
//
|
|
7
|
+
// Drift detection: every invocation renders the expected output in memory and compares against the
|
|
8
|
+
// existing on-disk content. Files that match are left untouched (no mtime churn). Files that
|
|
9
|
+
// differ are overwritten with the fresh content and the generator exits non-zero with a clear
|
|
10
|
+
// error — so the developer gets the regeneration for free, and a second `./bootstrap.sh` pass
|
|
11
|
+
// recompiles dependent Noir contracts against the now-correct values.
|
|
12
|
+
import { createConsoleLogger } from '@aztec/foundation/log';
|
|
13
|
+
import { promises as fs } from 'fs';
|
|
14
|
+
import path from 'path';
|
|
15
|
+
import { NOIR_ARTIFACTS_SRC_PATH, STANDARD_ARTIFACTS_DEST_DIR, computeContractData, loadArtifact, standardContracts } from '../contract_data.js';
|
|
16
|
+
import { renderAllTargets, writeIfChanged } from '../drift.js';
|
|
17
|
+
const log = createConsoleLogger('autogenerate');
|
|
18
|
+
async function clearDestDir() {
|
|
19
|
+
try {
|
|
20
|
+
await fs.access(STANDARD_ARTIFACTS_DEST_DIR);
|
|
21
|
+
// If the directory exists, remove it recursively.
|
|
22
|
+
await fs.rm(STANDARD_ARTIFACTS_DEST_DIR, {
|
|
23
|
+
recursive: true,
|
|
24
|
+
force: true,
|
|
25
|
+
maxRetries: 3
|
|
26
|
+
});
|
|
27
|
+
} catch (err) {
|
|
28
|
+
if (err.code === 'ENOENT') {
|
|
29
|
+
// If the directory does not exist, do nothing.
|
|
30
|
+
} else {
|
|
31
|
+
log(`Error removing dest directory: ${err}`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
await fs.mkdir(STANDARD_ARTIFACTS_DEST_DIR, {
|
|
35
|
+
recursive: true
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
async function copyArtifact(srcName, destName) {
|
|
39
|
+
const artifact = await loadArtifact(srcName);
|
|
40
|
+
const src = path.join(NOIR_ARTIFACTS_SRC_PATH, `${srcName}.json`);
|
|
41
|
+
const dest = path.join(STANDARD_ARTIFACTS_DEST_DIR, `${destName}.json`);
|
|
42
|
+
await fs.copyFile(src, dest);
|
|
43
|
+
return artifact;
|
|
44
|
+
}
|
|
45
|
+
async function generateDeclarationFile(destName) {
|
|
46
|
+
const content = `
|
|
47
|
+
import type { NoirCompiledContract } from '@aztec/stdlib/noir';
|
|
48
|
+
const circuit: NoirCompiledContract;
|
|
49
|
+
export = circuit;
|
|
50
|
+
`;
|
|
51
|
+
await fs.writeFile(path.join(STANDARD_ARTIFACTS_DEST_DIR, `${destName}.d.json.ts`), content);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Reads the currently-committed derived values out of the generated `standard_contract_data.ts`
|
|
55
|
+
* module so the drift report can show old → new. Returns `undefined` if the module doesn't exist
|
|
56
|
+
* yet (first-ever generation).
|
|
57
|
+
*/ async function loadCommittedValues() {
|
|
58
|
+
let mod;
|
|
59
|
+
try {
|
|
60
|
+
mod = await import('../standard_contract_data.js');
|
|
61
|
+
} catch {
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
const out = {};
|
|
65
|
+
for (const name of Object.keys(mod.StandardContractAddress)){
|
|
66
|
+
const preimage = mod.StandardContractClassIdPreimage[name];
|
|
67
|
+
out[name] = {
|
|
68
|
+
address: mod.StandardContractAddress[name].toString(),
|
|
69
|
+
classId: mod.StandardContractClassId[name].toString(),
|
|
70
|
+
artifactHash: preimage.artifactHash.toString(),
|
|
71
|
+
privateFunctionsRoot: preimage.privateFunctionsRoot.toString(),
|
|
72
|
+
publicBytecodeCommitment: preimage.publicBytecodeCommitment.toString(),
|
|
73
|
+
initializationHash: mod.StandardContractInitializationHash[name].toString(),
|
|
74
|
+
privateFunctionsCount: mod.StandardContractPrivateFunctions[name].length
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
return out;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Lists which derived consts changed, comparing the freshly-derived values against the committed
|
|
81
|
+
* snapshot — one indented line per changed field.
|
|
82
|
+
*/ function describeChanges(names, derived, committed) {
|
|
83
|
+
const lines = [];
|
|
84
|
+
names.forEach((name, i)=>{
|
|
85
|
+
const d = derived[i];
|
|
86
|
+
const prev = committed?.[name];
|
|
87
|
+
if (!prev) {
|
|
88
|
+
lines.push(` ${name}: newly added (no prior committed values)`);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const cmp = (field, oldV, newV)=>{
|
|
92
|
+
if (oldV !== newV) {
|
|
93
|
+
lines.push(` ${name}.${field}: ${oldV} → ${newV}`);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
cmp('address', prev.address, d.address.toString());
|
|
97
|
+
cmp('classId', prev.classId, d.classId.toString());
|
|
98
|
+
cmp('artifactHash', prev.artifactHash, d.artifactHash.toString());
|
|
99
|
+
cmp('privateFunctionsRoot', prev.privateFunctionsRoot, d.privateFunctionsRoot.toString());
|
|
100
|
+
cmp('publicBytecodeCommitment', prev.publicBytecodeCommitment, d.publicBytecodeCommitment.toString());
|
|
101
|
+
cmp('initializationHash', prev.initializationHash, d.initializationHash.toString());
|
|
102
|
+
cmp('privateFunctions count', String(prev.privateFunctionsCount), String(d.privateFunctions.length));
|
|
103
|
+
});
|
|
104
|
+
// Possible if only the generated-file formatting changed (e.g. a codegen tweak) with no value delta.
|
|
105
|
+
return lines.length > 0 ? lines.join('\n') : ' (no derived value changed — only generated-file formatting)';
|
|
106
|
+
}
|
|
107
|
+
async function main() {
|
|
108
|
+
await clearDestDir();
|
|
109
|
+
const names = standardContracts.map((c)=>c.name);
|
|
110
|
+
const contractDataList = [];
|
|
111
|
+
for (const { name, src } of standardContracts){
|
|
112
|
+
const artifact = await copyArtifact(src, name);
|
|
113
|
+
await generateDeclarationFile(name);
|
|
114
|
+
contractDataList.push(await computeContractData(artifact));
|
|
115
|
+
}
|
|
116
|
+
// Snapshot the committed values before we overwrite the data file, so the drift report can show
|
|
117
|
+
// exactly which consts changed (old → new) rather than a raw text diff.
|
|
118
|
+
const committed = await loadCommittedValues();
|
|
119
|
+
const targets = await renderAllTargets(names, contractDataList);
|
|
120
|
+
const driftedFiles = [];
|
|
121
|
+
for (const { path: filePath, content } of targets){
|
|
122
|
+
if (await writeIfChanged(filePath, content)) {
|
|
123
|
+
driftedFiles.push(filePath);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (driftedFiles.length > 0) {
|
|
127
|
+
const list = driftedFiles.map((f)=>` - ${f}`).join('\n');
|
|
128
|
+
throw new Error(`Standard contract addresses have changed. The following generated files were out of date and have been rewritten in-place with the freshly-derived values:\n${list}\n\n` + `Changed values (old → new):\n${describeChanges(names, contractDataList, committed)}\n\n` + `Any noir-contract that imports the stale addresses (via aztec-nr or aztec_sublib) now has stale bytecode and must be rebuilt.\n\n` + `To recover, the simplest option is to re-run \`./bootstrap.sh\` from the repo root: the second pass picks up the now-correct values.\n\n` + `For a faster targeted recovery without rebuilding everything, run from the repo root:\n` + ` 1. \`./bootstrap.sh build noir-contracts\` (rebuilds contracts against the now-stamped addresses; equivalent to \`make noir-contracts\`)\n` + ` 2. \`./bootstrap.sh build yarn-project\` (the generator re-runs, sees no drift, and the build proceeds)\n\n` + `Commit the rewritten files alongside whatever source change triggered the drift.`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
try {
|
|
132
|
+
await main();
|
|
133
|
+
} catch (err) {
|
|
134
|
+
log(`Error generating standard contract data: ${err}`);
|
|
135
|
+
process.exit(1);
|
|
136
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
import type { ContractClassIdPreimage, ContractClassWithId, ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
4
|
+
/** A non-protocol contract deployed at a canonical artifact-derived address. */
|
|
5
|
+
export interface StandardContract {
|
|
6
|
+
/** Canonical deployed instance. */
|
|
7
|
+
instance: ContractInstanceWithAddress;
|
|
8
|
+
/** Contract class of this contract. */
|
|
9
|
+
contractClass: ContractClassWithId & ContractClassIdPreimage;
|
|
10
|
+
/** Complete contract artifact. */
|
|
11
|
+
artifact: ContractArtifact;
|
|
12
|
+
/** Deployment address for the canonical instance. */
|
|
13
|
+
address: AztecAddress;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhbmRhcmRfY29udHJhY3QuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9zdGFuZGFyZF9jb250cmFjdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQzFELE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBQ2hFLE9BQU8sS0FBSyxFQUFFLHVCQUF1QixFQUFFLG1CQUFtQixFQUFFLDJCQUEyQixFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFFeEgsZ0ZBQWdGO0FBQ2hGLE1BQU0sV0FBVyxnQkFBZ0I7SUFDL0IsbUNBQW1DO0lBQ25DLFFBQVEsRUFBRSwyQkFBMkIsQ0FBQztJQUN0Qyx1Q0FBdUM7SUFDdkMsYUFBYSxFQUFFLG1CQUFtQixHQUFHLHVCQUF1QixDQUFDO0lBQzdELGtDQUFrQztJQUNsQyxRQUFRLEVBQUUsZ0JBQWdCLENBQUM7SUFDM0IscURBQXFEO0lBQ3JELE9BQU8sRUFBRSxZQUFZLENBQUM7Q0FDdkIifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standard_contract.d.ts","sourceRoot":"","sources":["../src/standard_contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAExH,gFAAgF;AAChF,MAAM,WAAW,gBAAgB;IAC/B,mCAAmC;IACnC,QAAQ,EAAE,2BAA2B,CAAC;IACtC,uCAAuC;IACvC,aAAa,EAAE,mBAAmB,GAAG,uBAAuB,CAAC;IAC7D,kCAAkC;IAClC,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,qDAAqD;IACrD,OAAO,EAAE,YAAY,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/** A non-protocol contract deployed at a canonical artifact-derived address. */ export { };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
3
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
+
export declare const standardContractNames: readonly ["AuthRegistry", "MultiCallEntrypoint", "PublicChecks"];
|
|
5
|
+
export type StandardContractName = (typeof standardContractNames)[number];
|
|
6
|
+
export declare const StandardContractSalt: Record<StandardContractName, Fr>;
|
|
7
|
+
export declare const StandardContractAddress: Record<StandardContractName, AztecAddress>;
|
|
8
|
+
export declare const StandardContractClassId: Record<StandardContractName, Fr>;
|
|
9
|
+
export declare const StandardContractClassIdPreimage: Record<StandardContractName, {
|
|
10
|
+
artifactHash: Fr;
|
|
11
|
+
privateFunctionsRoot: Fr;
|
|
12
|
+
publicBytecodeCommitment: Fr;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const StandardContractInitializationHash: Record<StandardContractName, Fr>;
|
|
15
|
+
export declare const StandardContractPrivateFunctions: Record<StandardContractName, {
|
|
16
|
+
selector: FunctionSelector;
|
|
17
|
+
vkHash: Fr;
|
|
18
|
+
}[]>;
|
|
19
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhbmRhcmRfY29udHJhY3RfZGF0YS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL3N0YW5kYXJkX2NvbnRyYWN0X2RhdGEudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3BELE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQ3JELE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUUzRCxlQUFPLE1BQU0scUJBQXFCLGtFQUFtRSxDQUFDO0FBRXRHLE1BQU0sTUFBTSxvQkFBb0IsR0FBRyxDQUFDLE9BQU8scUJBQXFCLENBQUMsQ0FBQyxNQUFNLENBQUMsQ0FBQztBQUUxRSxlQUFPLE1BQU0sb0JBQW9CLEVBQUUsTUFBTSxDQUFDLG9CQUFvQixFQUFFLEVBQUUsQ0FJakUsQ0FBQztBQUVGLGVBQU8sTUFBTSx1QkFBdUIsRUFBRSxNQUFNLENBQUMsb0JBQW9CLEVBQUUsWUFBWSxDQUk5RSxDQUFDO0FBRUYsZUFBTyxNQUFNLHVCQUF1QixFQUFFLE1BQU0sQ0FBQyxvQkFBb0IsRUFBRSxFQUFFLENBSXBFLENBQUM7QUFFRixlQUFPLE1BQU0sK0JBQStCLEVBQUUsTUFBTSxDQUNsRCxvQkFBb0IsRUFDcEI7SUFBRSxZQUFZLEVBQUUsRUFBRSxDQUFDO0lBQUMsb0JBQW9CLEVBQUUsRUFBRSxDQUFDO0lBQUMsd0JBQXdCLEVBQUUsRUFBRSxDQUFBO0NBQUUsQ0FpQjdFLENBQUM7QUFFRixlQUFPLE1BQU0sa0NBQWtDLEVBQUUsTUFBTSxDQUFDLG9CQUFvQixFQUFFLEVBQUUsQ0FJL0UsQ0FBQztBQUVGLGVBQU8sTUFBTSxnQ0FBZ0MsRUFBRSxNQUFNLENBQ25ELG9CQUFvQixFQUNwQjtJQUFFLFFBQVEsRUFBRSxnQkFBZ0IsQ0FBQztJQUFDLE1BQU0sRUFBRSxFQUFFLENBQUE7Q0FBRSxFQUFFLENBbUI3QyxDQUFDIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standard_contract_data.d.ts","sourceRoot":"","sources":["../src/standard_contract_data.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,eAAO,MAAM,qBAAqB,kEAAmE,CAAC;AAEtG,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1E,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,oBAAoB,EAAE,EAAE,CAIjE,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,oBAAoB,EAAE,YAAY,CAI9E,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,oBAAoB,EAAE,EAAE,CAIpE,CAAC;AAEF,eAAO,MAAM,+BAA+B,EAAE,MAAM,CAClD,oBAAoB,EACpB;IAAE,YAAY,EAAE,EAAE,CAAC;IAAC,oBAAoB,EAAE,EAAE,CAAC;IAAC,wBAAwB,EAAE,EAAE,CAAA;CAAE,CAiB7E,CAAC;AAEF,eAAO,MAAM,kCAAkC,EAAE,MAAM,CAAC,oBAAoB,EAAE,EAAE,CAI/E,CAAC;AAEF,eAAO,MAAM,gCAAgC,EAAE,MAAM,CACnD,oBAAoB,EACpB;IAAE,QAAQ,EAAE,gBAAgB,CAAC;IAAC,MAAM,EAAE,EAAE,CAAA;CAAE,EAAE,CAmB7C,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// GENERATED FILE - DO NOT EDIT. RUN `yarn generate` or `yarn generate:data`
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
4
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
+
export const standardContractNames = [
|
|
6
|
+
'AuthRegistry',
|
|
7
|
+
'MultiCallEntrypoint',
|
|
8
|
+
'PublicChecks'
|
|
9
|
+
];
|
|
10
|
+
export const StandardContractSalt = {
|
|
11
|
+
AuthRegistry: new Fr(1),
|
|
12
|
+
MultiCallEntrypoint: new Fr(1),
|
|
13
|
+
PublicChecks: new Fr(1)
|
|
14
|
+
};
|
|
15
|
+
export const StandardContractAddress = {
|
|
16
|
+
AuthRegistry: AztecAddress.fromString('0x01de9d215d1845808cf388d3a88f9066af1e73ec280e979c3b1aec8ba6b149ea'),
|
|
17
|
+
MultiCallEntrypoint: AztecAddress.fromString('0x09a72c4cb473b087f59f28f913aa103c214b4f9bbf10d4157e06745169359210'),
|
|
18
|
+
PublicChecks: AztecAddress.fromString('0x05d900a6ed1b4ad3ff52cbe5f98d9b291b0f35c6dd5c41b1642659344d234bfe')
|
|
19
|
+
};
|
|
20
|
+
export const StandardContractClassId = {
|
|
21
|
+
AuthRegistry: Fr.fromString('0x2cfbdd0ce7cc31b5cc5f4eb8f680e0e245882b2208bd67828e41a8bd24a19292'),
|
|
22
|
+
MultiCallEntrypoint: Fr.fromString('0x188160c82cb3a9a24c6f156f270e962afa124cdd2dabce78aaa0bf04fdd799f6'),
|
|
23
|
+
PublicChecks: Fr.fromString('0x022bbd3c085d6a09ec500110852441419c7b1e6dc21a8d459233b72a84d03a1f')
|
|
24
|
+
};
|
|
25
|
+
export const StandardContractClassIdPreimage = {
|
|
26
|
+
AuthRegistry: {
|
|
27
|
+
artifactHash: Fr.fromString('0x0dd24a86cce5ff4ef33ca14f16359c5a154ce3f1ed91a9570dd5343569f5386f'),
|
|
28
|
+
privateFunctionsRoot: Fr.fromString('0x17b584350f4c3ccafd8f688729afb9feab8976114fb40012e9dee65022c072a4'),
|
|
29
|
+
publicBytecodeCommitment: Fr.fromString('0x2545f39893766508ce37bb5cea5e4dcab04c6f7f79f3089b1c076876e9d268b2')
|
|
30
|
+
},
|
|
31
|
+
MultiCallEntrypoint: {
|
|
32
|
+
artifactHash: Fr.fromString('0x1f8c5717b0e478e63f462f9792969865684f8403b4608980b1a83324c03dd498'),
|
|
33
|
+
privateFunctionsRoot: Fr.fromString('0x0e68dfbb256e80b08b3aef47aca1f2669e97a9c6259787893c1223ac083ad5d5'),
|
|
34
|
+
publicBytecodeCommitment: Fr.fromString('0x0ce4c618c3ed7f3a20410e618c06bb701e150af7fe28a3e92f68e7733809f33e')
|
|
35
|
+
},
|
|
36
|
+
PublicChecks: {
|
|
37
|
+
artifactHash: Fr.fromString('0x030776b58475bf6a0545eaa4f4002f5fe6701bd0d306b68065f4b40ef4fdbe60'),
|
|
38
|
+
privateFunctionsRoot: Fr.fromString('0x202860adb1b8975971eeaf571aaaa88a27f4035290d58532ae7d60b0dfaad54c'),
|
|
39
|
+
publicBytecodeCommitment: Fr.fromString('0x013c4f854a5c87c9daf86c5f9bc07a42c2a061f1d924a5b3564ec7edc8e18cb7')
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
export const StandardContractInitializationHash = {
|
|
43
|
+
AuthRegistry: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
44
|
+
MultiCallEntrypoint: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
45
|
+
PublicChecks: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000')
|
|
46
|
+
};
|
|
47
|
+
export const StandardContractPrivateFunctions = {
|
|
48
|
+
AuthRegistry: [
|
|
49
|
+
{
|
|
50
|
+
selector: FunctionSelector.fromField(Fr.fromString('0x0000000000000000000000000000000000000000000000000000000079a3d418')),
|
|
51
|
+
vkHash: Fr.fromString('0x06a5c1b3a636c954a90be43cb56a4bdd9dc8aec764151a012e0018753694ff54')
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
MultiCallEntrypoint: [
|
|
55
|
+
{
|
|
56
|
+
selector: FunctionSelector.fromField(Fr.fromString('0x00000000000000000000000000000000000000000000000000000000f04908a9')),
|
|
57
|
+
vkHash: Fr.fromString('0x0b19b2f937f2581922c2ead5411ad9ff4ed9710efe9849bde494d9a0f94812ec')
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
PublicChecks: []
|
|
61
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aztec/standard-contracts",
|
|
3
|
+
"homepage": "https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/standard-contracts",
|
|
4
|
+
"description": "Standard non-protocol contracts for the Aztec Network",
|
|
5
|
+
"version": "0.0.1-commit.04d373f",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./dest/index.js",
|
|
9
|
+
"./*": "./dest/*/index.js",
|
|
10
|
+
"./*/lazy": "./dest/*/lazy.js",
|
|
11
|
+
"./auth-registry/constants": "./dest/auth-registry/constants.js",
|
|
12
|
+
"./public-checks/constants": "./dest/public-checks/constants.js",
|
|
13
|
+
"./multi-call-entrypoint/constants": "./dest/multi-call-entrypoint/constants.js"
|
|
14
|
+
},
|
|
15
|
+
"typedocOptions": {
|
|
16
|
+
"entryPoints": [
|
|
17
|
+
"./src/index.ts",
|
|
18
|
+
"./src/auth-registry/index.ts"
|
|
19
|
+
],
|
|
20
|
+
"name": "Standard Contracts",
|
|
21
|
+
"tsconfig": "./tsconfig.json"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "yarn clean && yarn generate && yarn generate:cleanup-artifacts && ../scripts/tsc.sh",
|
|
25
|
+
"build:keep-debug-symbols": "yarn clean && yarn generate && ../scripts/tsc.sh",
|
|
26
|
+
"generate": "yarn generate:data",
|
|
27
|
+
"generate:cleanup-artifacts": "node --no-warnings --loader @swc-node/register/esm src/scripts/cleanup_artifacts.ts",
|
|
28
|
+
"generate:data": "node --no-warnings --loader @swc-node/register/esm src/scripts/generate_data.ts",
|
|
29
|
+
"build:dev": "../scripts/tsc.sh --watch",
|
|
30
|
+
"build:ts": "../scripts/tsc.sh",
|
|
31
|
+
"clean": "rm -rf ./dest .tsbuildinfo ./artifacts",
|
|
32
|
+
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
|
|
33
|
+
},
|
|
34
|
+
"inherits": [
|
|
35
|
+
"../package.common.json",
|
|
36
|
+
"./package.local.json"
|
|
37
|
+
],
|
|
38
|
+
"jest": {
|
|
39
|
+
"moduleNameMapper": {
|
|
40
|
+
"^(\\.{1,2}/.*)\\.[cm]?js$": "$1"
|
|
41
|
+
},
|
|
42
|
+
"testRegex": "./src/.*\\.test\\.(js|mjs|ts)$",
|
|
43
|
+
"rootDir": "./src",
|
|
44
|
+
"transform": {
|
|
45
|
+
"^.+\\.tsx?$": [
|
|
46
|
+
"@swc/jest",
|
|
47
|
+
{
|
|
48
|
+
"jsc": {
|
|
49
|
+
"parser": {
|
|
50
|
+
"syntax": "typescript",
|
|
51
|
+
"decorators": true
|
|
52
|
+
},
|
|
53
|
+
"transform": {
|
|
54
|
+
"decoratorVersion": "2022-03"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
"extensionsToTreatAsEsm": [
|
|
61
|
+
".ts"
|
|
62
|
+
],
|
|
63
|
+
"reporters": [
|
|
64
|
+
"default"
|
|
65
|
+
],
|
|
66
|
+
"testTimeout": 120000,
|
|
67
|
+
"setupFiles": [
|
|
68
|
+
"../../foundation/src/jest/setup.mjs"
|
|
69
|
+
],
|
|
70
|
+
"testEnvironment": "../../foundation/src/jest/env.mjs",
|
|
71
|
+
"setupFilesAfterEnv": [
|
|
72
|
+
"../../foundation/src/jest/setupAfterEnv.mjs"
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
"dependencies": {
|
|
76
|
+
"@aztec/foundation": "0.0.1-commit.04d373f",
|
|
77
|
+
"@aztec/stdlib": "0.0.1-commit.04d373f",
|
|
78
|
+
"tslib": "^2.4.0"
|
|
79
|
+
},
|
|
80
|
+
"devDependencies": {
|
|
81
|
+
"@jest/globals": "^30.0.0",
|
|
82
|
+
"@types/jest": "^30.0.0",
|
|
83
|
+
"@types/node": "^22.15.17",
|
|
84
|
+
"@typescript/native-preview": "7.0.0-dev.20260113.1",
|
|
85
|
+
"jest": "^30.0.0",
|
|
86
|
+
"jest-mock-extended": "^4.0.0",
|
|
87
|
+
"prettier": "^3.5.3",
|
|
88
|
+
"ts-loader": "^9.5.4",
|
|
89
|
+
"ts-node": "^10.9.1",
|
|
90
|
+
"typescript": "^5.3.3"
|
|
91
|
+
},
|
|
92
|
+
"files": [
|
|
93
|
+
"dest",
|
|
94
|
+
"src",
|
|
95
|
+
"!*.test.*",
|
|
96
|
+
"artifacts",
|
|
97
|
+
"!src/scripts/*"
|
|
98
|
+
],
|
|
99
|
+
"engines": {
|
|
100
|
+
"node": ">=20.10"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Address-only leaf export for browser bundles: importing from
|
|
2
|
+
// `@aztec/standard-contracts/auth-registry/constants` avoids dragging in the
|
|
3
|
+
// `AuthRegistry.json` static import.
|
|
4
|
+
import { StandardContractAddress, StandardContractClassId, StandardContractSalt } from '../standard_contract_data.js';
|
|
5
|
+
|
|
6
|
+
export const STANDARD_AUTH_REGISTRY_ADDRESS = StandardContractAddress.AuthRegistry;
|
|
7
|
+
export const STANDARD_AUTH_REGISTRY_CLASS_ID = StandardContractClassId.AuthRegistry;
|
|
8
|
+
export const STANDARD_AUTH_REGISTRY_SALT = StandardContractSalt.AuthRegistry;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
+
import type { NoirCompiledContract } from '@aztec/stdlib/noir';
|
|
3
|
+
|
|
4
|
+
import AuthRegistryJson from '../../artifacts/AuthRegistry.json' with { type: 'json' };
|
|
5
|
+
import { makeStandardContract } from '../make_standard_contract.js';
|
|
6
|
+
import type { StandardContract } from '../standard_contract.js';
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
STANDARD_AUTH_REGISTRY_ADDRESS,
|
|
10
|
+
STANDARD_AUTH_REGISTRY_CLASS_ID,
|
|
11
|
+
STANDARD_AUTH_REGISTRY_SALT,
|
|
12
|
+
} from './constants.js';
|
|
13
|
+
|
|
14
|
+
export const AuthRegistryArtifact = loadContractArtifact(AuthRegistryJson as NoirCompiledContract);
|
|
15
|
+
|
|
16
|
+
let standardContract: StandardContract;
|
|
17
|
+
|
|
18
|
+
/** Returns the standard deployment of the auth registry. */
|
|
19
|
+
export function getStandardAuthRegistry(): Promise<StandardContract> {
|
|
20
|
+
if (!standardContract) {
|
|
21
|
+
standardContract = makeStandardContract('AuthRegistry', AuthRegistryArtifact);
|
|
22
|
+
}
|
|
23
|
+
return Promise.resolve(standardContract);
|
|
24
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ContractArtifact, loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
+
|
|
3
|
+
import { makeStandardContract } from '../make_standard_contract.js';
|
|
4
|
+
import type { StandardContract } from '../standard_contract.js';
|
|
5
|
+
|
|
6
|
+
export {
|
|
7
|
+
STANDARD_AUTH_REGISTRY_ADDRESS,
|
|
8
|
+
STANDARD_AUTH_REGISTRY_CLASS_ID,
|
|
9
|
+
STANDARD_AUTH_REGISTRY_SALT,
|
|
10
|
+
} from './constants.js';
|
|
11
|
+
|
|
12
|
+
let standardContract: StandardContract;
|
|
13
|
+
let standardContractArtifact: ContractArtifact;
|
|
14
|
+
|
|
15
|
+
export async function getAuthRegistryArtifact(): Promise<ContractArtifact> {
|
|
16
|
+
if (!standardContractArtifact) {
|
|
17
|
+
// Cannot assert this import as it's incompatible with bundlers like vite
|
|
18
|
+
// https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
|
|
19
|
+
// Even if now supported by all major browsers, the MIME type is replaced with
|
|
20
|
+
// "text/javascript"
|
|
21
|
+
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
22
|
+
const { default: authRegistryJson } = await import('../../artifacts/AuthRegistry.json');
|
|
23
|
+
standardContractArtifact = loadContractArtifact(authRegistryJson);
|
|
24
|
+
}
|
|
25
|
+
return standardContractArtifact;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Returns the standard deployment of the auth registry. */
|
|
29
|
+
export async function getStandardAuthRegistry(): Promise<StandardContract> {
|
|
30
|
+
if (!standardContract) {
|
|
31
|
+
const artifact = await getAuthRegistryArtifact();
|
|
32
|
+
standardContract = makeStandardContract('AuthRegistry', artifact);
|
|
33
|
+
}
|
|
34
|
+
return standardContract;
|
|
35
|
+
}
|