@aztec/protocol-contracts 0.76.4-devnet-test-rc3 → 0.77.0-testnet-ignition.17
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 +1 -1
- package/artifacts/AuthRegistry.json +354 -422
- package/artifacts/ContractClassRegisterer.d.json.ts +1 -1
- package/artifacts/ContractClassRegisterer.json +395 -422
- package/artifacts/ContractInstanceDeployer.d.json.ts +1 -1
- package/artifacts/ContractInstanceDeployer.json +545 -138
- package/artifacts/FeeJuice.d.json.ts +1 -1
- package/artifacts/FeeJuice.json +360 -540
- package/artifacts/MultiCallEntrypoint.d.json.ts +1 -1
- package/artifacts/MultiCallEntrypoint.json +110 -190
- package/artifacts/Router.d.json.ts +1 -1
- package/artifacts/Router.json +217 -291
- package/dest/auth-registry/index.d.ts +2 -2
- package/dest/auth-registry/index.d.ts.map +1 -1
- package/dest/auth-registry/index.js +5 -5
- package/dest/auth-registry/lazy.d.ts +6 -0
- package/dest/auth-registry/lazy.d.ts.map +1 -0
- package/dest/auth-registry/lazy.js +23 -0
- package/dest/build_protocol_contract_tree.d.ts +5 -1
- package/dest/build_protocol_contract_tree.d.ts.map +1 -1
- package/dest/build_protocol_contract_tree.js +9 -5
- package/dest/class-registerer/contract_class_registered_event.d.ts +4 -3
- package/dest/class-registerer/contract_class_registered_event.d.ts.map +1 -1
- package/dest/class-registerer/contract_class_registered_event.js +21 -18
- package/dest/class-registerer/index.d.ts +2 -2
- package/dest/class-registerer/index.d.ts.map +1 -1
- package/dest/class-registerer/index.js +5 -5
- package/dest/class-registerer/lazy.d.ts +9 -0
- package/dest/class-registerer/lazy.d.ts.map +1 -0
- package/dest/class-registerer/lazy.js +26 -0
- package/dest/class-registerer/private_function_broadcasted_event.d.ts +10 -7
- package/dest/class-registerer/private_function_broadcasted_event.d.ts.map +1 -1
- package/dest/class-registerer/private_function_broadcasted_event.js +46 -48
- package/dest/class-registerer/unconstrained_function_broadcasted_event.d.ts +10 -7
- package/dest/class-registerer/unconstrained_function_broadcasted_event.d.ts.map +1 -1
- package/dest/class-registerer/unconstrained_function_broadcasted_event.js +39 -41
- package/dest/fee-juice/index.d.ts +12 -2
- package/dest/fee-juice/index.d.ts.map +1 -1
- package/dest/fee-juice/index.js +18 -5
- package/dest/fee-juice/lazy.d.ts +6 -0
- package/dest/fee-juice/lazy.d.ts.map +1 -0
- package/dest/fee-juice/lazy.js +23 -0
- package/dest/index.js +0 -1
- package/dest/instance-deployer/contract_instance_deployed_event.d.ts +4 -2
- package/dest/instance-deployer/contract_instance_deployed_event.d.ts.map +1 -1
- package/dest/instance-deployer/contract_instance_deployed_event.js +14 -8
- package/dest/instance-deployer/contract_instance_updated_event.d.ts +16 -0
- package/dest/instance-deployer/contract_instance_updated_event.d.ts.map +1 -0
- package/dest/instance-deployer/contract_instance_updated_event.js +36 -0
- package/dest/instance-deployer/index.d.ts +3 -2
- package/dest/instance-deployer/index.d.ts.map +1 -1
- package/dest/instance-deployer/index.js +6 -5
- package/dest/instance-deployer/lazy.d.ts +8 -0
- package/dest/instance-deployer/lazy.d.ts.map +1 -0
- package/dest/instance-deployer/lazy.js +25 -0
- package/dest/make_protocol_contract.d.ts +2 -2
- package/dest/make_protocol_contract.d.ts.map +1 -1
- package/dest/make_protocol_contract.js +10 -7
- package/dest/multi-call-entrypoint/index.d.ts +2 -2
- package/dest/multi-call-entrypoint/index.d.ts.map +1 -1
- package/dest/multi-call-entrypoint/index.js +5 -5
- package/dest/multi-call-entrypoint/lazy.d.ts +6 -0
- package/dest/multi-call-entrypoint/lazy.d.ts.map +1 -0
- package/dest/multi-call-entrypoint/lazy.js +23 -0
- package/dest/protocol_contract.d.ts +4 -2
- package/dest/protocol_contract.d.ts.map +1 -1
- package/dest/protocol_contract.js +1 -2
- package/dest/protocol_contract_data.d.ts +4 -2
- package/dest/protocol_contract_data.d.ts.map +1 -1
- package/dest/protocol_contract_data.js +16 -15
- package/dest/protocol_contract_tree.d.ts +4 -3
- package/dest/protocol_contract_tree.d.ts.map +1 -1
- package/dest/protocol_contract_tree.js +14 -12
- package/dest/provider/bundle.d.ts +9 -0
- package/dest/provider/bundle.d.ts.map +1 -0
- package/dest/provider/bundle.js +20 -0
- package/dest/provider/lazy.d.ts +7 -0
- package/dest/provider/lazy.d.ts.map +1 -0
- package/dest/provider/lazy.js +26 -0
- package/dest/provider/protocol_contracts_provider.d.ts +7 -0
- package/dest/provider/protocol_contracts_provider.d.ts.map +1 -0
- package/dest/provider/protocol_contracts_provider.js +1 -0
- package/dest/router/index.d.ts +2 -2
- package/dest/router/index.d.ts.map +1 -1
- package/dest/router/index.js +5 -5
- package/dest/router/lazy.d.ts +6 -0
- package/dest/router/lazy.d.ts.map +1 -0
- package/dest/router/lazy.js +23 -0
- package/dest/scripts/cleanup_artifacts.js +16 -0
- package/dest/scripts/generate_data.js +173 -0
- package/dest/tests/fixtures.js +0 -1
- package/package.json +12 -10
- package/src/auth-registry/index.ts +3 -3
- package/src/auth-registry/lazy.ts +29 -0
- package/src/build_protocol_contract_tree.ts +5 -9
- package/src/class-registerer/contract_class_registered_event.ts +15 -18
- package/src/class-registerer/index.ts +3 -3
- package/src/class-registerer/lazy.ts +33 -0
- package/src/class-registerer/private_function_broadcasted_event.ts +34 -44
- package/src/class-registerer/unconstrained_function_broadcasted_event.ts +31 -41
- package/src/fee-juice/index.ts +22 -3
- package/src/fee-juice/lazy.ts +29 -0
- package/src/instance-deployer/contract_instance_deployed_event.ts +6 -3
- package/src/instance-deployer/contract_instance_updated_event.ts +44 -0
- package/src/instance-deployer/index.ts +4 -3
- package/src/instance-deployer/lazy.ts +32 -0
- package/src/make_protocol_contract.ts +3 -3
- package/src/multi-call-entrypoint/index.ts +3 -3
- package/src/multi-call-entrypoint/lazy.ts +29 -0
- package/src/protocol_contract.ts +5 -7
- package/src/protocol_contract_data.ts +63 -57
- package/src/protocol_contract_tree.ts +12 -10
- package/src/provider/bundle.ts +27 -0
- package/src/provider/lazy.ts +30 -0
- package/src/provider/protocol_contracts_provider.ts +7 -0
- package/src/router/index.ts +3 -3
- package/src/router/lazy.ts +29 -0
- package/dest/bundle/index.d.ts +0 -7
- package/dest/bundle/index.d.ts.map +0 -1
- package/dest/bundle/index.js +0 -32
- package/src/bundle/index.ts +0 -36
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
// GENERATED FILE - DO NOT EDIT. RUN `yarn generate` or `yarn generate:data`
|
|
2
|
-
import {
|
|
2
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
4
|
export const protocolContractNames = [
|
|
4
5
|
'AuthRegistry',
|
|
5
6
|
'ContractInstanceDeployer',
|
|
6
7
|
'ContractClassRegisterer',
|
|
7
8
|
'MultiCallEntrypoint',
|
|
8
9
|
'FeeJuice',
|
|
9
|
-
'Router'
|
|
10
|
+
'Router'
|
|
10
11
|
];
|
|
11
12
|
export const ProtocolContractSalt = {
|
|
12
13
|
AuthRegistry: new Fr(1),
|
|
@@ -14,7 +15,7 @@ export const ProtocolContractSalt = {
|
|
|
14
15
|
ContractClassRegisterer: new Fr(1),
|
|
15
16
|
MultiCallEntrypoint: new Fr(1),
|
|
16
17
|
FeeJuice: new Fr(1),
|
|
17
|
-
Router: new Fr(1)
|
|
18
|
+
Router: new Fr(1)
|
|
18
19
|
};
|
|
19
20
|
export const ProtocolContractAddress = {
|
|
20
21
|
AuthRegistry: AztecAddress.fromBigInt(1n),
|
|
@@ -22,19 +23,19 @@ export const ProtocolContractAddress = {
|
|
|
22
23
|
ContractClassRegisterer: AztecAddress.fromBigInt(3n),
|
|
23
24
|
MultiCallEntrypoint: AztecAddress.fromBigInt(4n),
|
|
24
25
|
FeeJuice: AztecAddress.fromBigInt(5n),
|
|
25
|
-
Router: AztecAddress.fromBigInt(6n)
|
|
26
|
+
Router: AztecAddress.fromBigInt(6n)
|
|
26
27
|
};
|
|
27
28
|
export const ProtocolContractLeaves = {
|
|
28
|
-
AuthRegistry: Fr.fromHexString('
|
|
29
|
-
ContractInstanceDeployer: Fr.fromHexString('
|
|
30
|
-
ContractClassRegisterer: Fr.fromHexString('
|
|
31
|
-
MultiCallEntrypoint: Fr.fromHexString('
|
|
32
|
-
FeeJuice: Fr.fromHexString('
|
|
33
|
-
Router: Fr.fromHexString('
|
|
29
|
+
AuthRegistry: Fr.fromHexString('0x2e21b68d7ba0d9a47965a892c304e1906e9ff3309fd1a19f2d6d20764ad0904d'),
|
|
30
|
+
ContractInstanceDeployer: Fr.fromHexString('0x1cd18d02cf497df9523f3c8aed73075e93210f448a3d1a22aaf2787b2fcc3156'),
|
|
31
|
+
ContractClassRegisterer: Fr.fromHexString('0x1e50aba05fd759d9225eb756d17ba4f79a7b607ba8e0bb753e35456983b10d5a'),
|
|
32
|
+
MultiCallEntrypoint: Fr.fromHexString('0x121f834b03a64d38463ae18ddebceeb4dce8192cc289052e175ad754a883a7fe'),
|
|
33
|
+
FeeJuice: Fr.fromHexString('0x26824d7dd736eb4ed60e4f920de3183e071223a769a533a0b422a3da9bbe2e57'),
|
|
34
|
+
Router: Fr.fromHexString('0x26924a7b4fb3f63e61ed0bd53bca870f66660c18e032973ac063ba3f1d4a9b4d')
|
|
34
35
|
};
|
|
35
|
-
export const protocolContractTreeRoot = Fr.fromHexString('
|
|
36
|
-
export const REGISTERER_CONTRACT_CLASS_REGISTERED_TAG =
|
|
37
|
-
export const REGISTERER_PRIVATE_FUNCTION_BROADCASTED_TAG =
|
|
38
|
-
export const REGISTERER_UNCONSTRAINED_FUNCTION_BROADCASTED_TAG =
|
|
36
|
+
export const protocolContractTreeRoot = Fr.fromHexString('0x2c8fc46351bda26dff22c6f7d13f51ef1b7b7245475ed6f0857b8aeac417b36f');
|
|
37
|
+
export const REGISTERER_CONTRACT_CLASS_REGISTERED_TAG = Fr.fromHexString('0x20cd27645f65c15a38720ca984aef936592f3938a705db706d068ad13fc58ae9');
|
|
38
|
+
export const REGISTERER_PRIVATE_FUNCTION_BROADCASTED_TAG = Fr.fromHexString('0x0abf338154e355442d9916d630da0491036d5a7b23c42b477c1395ba3bf9b42d');
|
|
39
|
+
export const REGISTERER_UNCONSTRAINED_FUNCTION_BROADCASTED_TAG = Fr.fromHexString('0x27774539896271d6dbe0c1de45ddc44709d1e8d9a9fb686ca3c105d87c417bb8');
|
|
39
40
|
export const DEPLOYER_CONTRACT_INSTANCE_DEPLOYED_TAG = Fr.fromHexString('0x2ec28b91a5f838506d6042915005ff55cf7a0a5f889a83b11faed33a31b486f2');
|
|
40
|
-
|
|
41
|
+
export const DEPLOYER_CONTRACT_INSTANCE_UPDATED_TAG = new Fr(1534834688047131268740281708431107902615560100979874281215533519862n);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
2
|
+
import type { ProtocolContractLeafPreimage } from '@aztec/stdlib/trees';
|
|
3
|
+
export declare function getProtocolContractLeafAndMembershipWitness(contractAddress: AztecAddress, computedAddress: AztecAddress): Promise<{
|
|
3
4
|
lowLeaf: ProtocolContractLeafPreimage;
|
|
4
|
-
witness: import("@aztec/
|
|
5
|
+
witness: import("@aztec/foundation/trees").MembershipWitness<3>;
|
|
5
6
|
}>;
|
|
6
7
|
//# sourceMappingURL=protocol_contract_tree.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol_contract_tree.d.ts","sourceRoot":"","sources":["../src/protocol_contract_tree.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"protocol_contract_tree.d.ts","sourceRoot":"","sources":["../src/protocol_contract_tree.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAsBxE,wBAAsB,2CAA2C,CAC/D,eAAe,EAAE,YAAY,EAC7B,eAAe,EAAE,YAAY;;;GAe9B"}
|
|
@@ -5,28 +5,30 @@ import { ProtocolContractAddress, ProtocolContractLeaves, protocolContractNames
|
|
|
5
5
|
let protocolContractTree;
|
|
6
6
|
async function getTree() {
|
|
7
7
|
if (!protocolContractTree) {
|
|
8
|
-
const leaves = protocolContractNames.map(name
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const leaves = protocolContractNames.map((name)=>({
|
|
9
|
+
address: ProtocolContractAddress[name],
|
|
10
|
+
leaf: ProtocolContractLeaves[name]
|
|
11
|
+
}));
|
|
12
12
|
protocolContractTree = await buildProtocolContractTree(leaves);
|
|
13
13
|
}
|
|
14
14
|
return protocolContractTree;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
// Computed address can be different from contract address due to upgrades
|
|
17
|
+
export async function getProtocolContractLeafAndMembershipWitness(contractAddress, computedAddress) {
|
|
17
18
|
const tree = await getTree();
|
|
18
19
|
let lowLeaf;
|
|
19
20
|
let witness;
|
|
20
|
-
if (isProtocolContract(
|
|
21
|
-
const index =
|
|
21
|
+
if (isProtocolContract(contractAddress)) {
|
|
22
|
+
const index = contractAddress.toField().toNumber();
|
|
22
23
|
lowLeaf = tree.leafPreimages[index];
|
|
23
24
|
witness = tree.getMembershipWitness(index);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
lowLeaf = tree.getLowLeaf(address.toBigInt());
|
|
25
|
+
} else {
|
|
26
|
+
lowLeaf = tree.getLowLeaf(computedAddress.toBigInt());
|
|
27
27
|
const hashed = (await poseidon2Hash(lowLeaf.toHashInputs())).toBuffer();
|
|
28
28
|
witness = tree.getMembershipWitness(hashed);
|
|
29
29
|
}
|
|
30
|
-
return {
|
|
30
|
+
return {
|
|
31
|
+
lowLeaf,
|
|
32
|
+
witness
|
|
33
|
+
};
|
|
31
34
|
}
|
|
32
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvdG9jb2xfY29udHJhY3RfdHJlZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9wcm90b2NvbF9jb250cmFjdF90cmVlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU1BLE9BQU8sRUFBRSxhQUFhLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQztBQUV6RCxPQUFPLEVBQUUseUJBQXlCLEVBQUUsTUFBTSxtQ0FBbUMsQ0FBQztBQUM5RSxPQUFPLEVBQUUsa0JBQWtCLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUM1RCxPQUFPLEVBQUUsdUJBQXVCLEVBQUUsc0JBQXNCLEVBQUUscUJBQXFCLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUVySCxJQUFJLG9CQUVTLENBQUM7QUFFZCxLQUFLLFVBQVUsT0FBTztJQUNwQixJQUFJLENBQUMsb0JBQW9CLEVBQUUsQ0FBQztRQUMxQixNQUFNLE1BQU0sR0FBRyxxQkFBcUIsQ0FBQyxHQUFHLENBQUMsSUFBSSxDQUFDLEVBQUUsQ0FBQyxDQUFDO1lBQ2hELE9BQU8sRUFBRSx1QkFBdUIsQ0FBQyxJQUFJLENBQUM7WUFDdEMsSUFBSSxFQUFFLHNCQUFzQixDQUFDLElBQUksQ0FBQztTQUNuQyxDQUFDLENBQUMsQ0FBQztRQUNKLG9CQUFvQixHQUFHLE1BQU0seUJBQXlCLENBQUMsTUFBTSxDQUFDLENBQUM7SUFDakUsQ0FBQztJQUNELE9BQU8sb0JBQW9CLENBQUM7QUFDOUIsQ0FBQztBQUVELE1BQU0sQ0FBQyxLQUFLLFVBQVUsMkNBQTJDLENBQUMsT0FBcUI7SUFDckYsTUFBTSxJQUFJLEdBQUcsTUFBTSxPQUFPLEVBQUUsQ0FBQztJQUM3QixJQUFJLE9BQU8sQ0FBQztJQUNaLElBQUksT0FBTyxDQUFDO0lBQ1osSUFBSSxrQkFBa0IsQ0FBQyxPQUFPLENBQUMsRUFBRSxDQUFDO1FBQ2hDLE1BQU0sS0FBSyxHQUFHLE9BQU8sQ0FBQyxPQUFPLEVBQUUsQ0FBQyxRQUFRLEVBQUUsQ0FBQztRQUMzQyxPQUFPLEdBQUcsSUFBSSxDQUFDLGFBQWEsQ0FBQyxLQUFLLENBQUMsQ0FBQztRQUNwQyxPQUFPLEdBQUcsSUFBSSxDQUFDLG9CQUFvQixDQUFDLEtBQUssQ0FBQyxDQUFDO0lBQzdDLENBQUM7U0FBTSxDQUFDO1FBQ04sT0FBTyxHQUFHLElBQUksQ0FBQyxVQUFVLENBQUMsT0FBTyxDQUFDLFFBQVEsRUFBRSxDQUFDLENBQUM7UUFDOUMsTUFBTSxNQUFNLEdBQUcsQ0FBQyxNQUFNLGFBQWEsQ0FBQyxPQUFPLENBQUMsWUFBWSxFQUFFLENBQUMsQ0FBQyxDQUFDLFFBQVEsRUFBRSxDQUFDO1FBQ3hFLE9BQU8sR0FBRyxJQUFJLENBQUMsb0JBQW9CLENBQUMsTUFBTSxDQUFDLENBQUM7SUFDOUMsQ0FBQztJQUNELE9BQU8sRUFBRSxPQUFPLEVBQUUsT0FBTyxFQUFFLENBQUM7QUFDOUIsQ0FBQyJ9
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
+
import type { ProtocolContract } from '../protocol_contract.js';
|
|
3
|
+
import type { ProtocolContractName } from '../protocol_contract_data.js';
|
|
4
|
+
import type { ProtocolContractsProvider } from './protocol_contracts_provider.js';
|
|
5
|
+
export declare const ProtocolContractArtifact: Record<ProtocolContractName, ContractArtifact>;
|
|
6
|
+
export declare class BundledProtocolContractsProvider implements ProtocolContractsProvider {
|
|
7
|
+
getProtocolContractArtifact(name: ProtocolContractName): Promise<ProtocolContract>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=bundle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../src/provider/bundle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAQ1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEzE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAElF,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,oBAAoB,EAAE,gBAAgB,CAOnF,CAAC;AAEF,qBAAa,gCAAiC,YAAW,yBAAyB;IAChF,2BAA2B,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAGnF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AuthRegistryArtifact } from '../auth-registry/index.js';
|
|
2
|
+
import { ContractClassRegistererArtifact } from '../class-registerer/index.js';
|
|
3
|
+
import { FeeJuiceArtifact } from '../fee-juice/index.js';
|
|
4
|
+
import { ContractInstanceDeployerArtifact } from '../instance-deployer/index.js';
|
|
5
|
+
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
6
|
+
import { MultiCallEntrypointArtifact } from '../multi-call-entrypoint/index.js';
|
|
7
|
+
import { RouterArtifact } from '../router/index.js';
|
|
8
|
+
export const ProtocolContractArtifact = {
|
|
9
|
+
AuthRegistry: AuthRegistryArtifact,
|
|
10
|
+
ContractInstanceDeployer: ContractInstanceDeployerArtifact,
|
|
11
|
+
ContractClassRegisterer: ContractClassRegistererArtifact,
|
|
12
|
+
MultiCallEntrypoint: MultiCallEntrypointArtifact,
|
|
13
|
+
FeeJuice: FeeJuiceArtifact,
|
|
14
|
+
Router: RouterArtifact
|
|
15
|
+
};
|
|
16
|
+
export class BundledProtocolContractsProvider {
|
|
17
|
+
getProtocolContractArtifact(name) {
|
|
18
|
+
return makeProtocolContract(name, ProtocolContractArtifact[name]);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ProtocolContract } from '../protocol_contract.js';
|
|
2
|
+
import type { ProtocolContractName } from '../protocol_contract_data.js';
|
|
3
|
+
import type { ProtocolContractsProvider } from './protocol_contracts_provider.js';
|
|
4
|
+
export declare class LazyProtocolContractsProvider implements ProtocolContractsProvider {
|
|
5
|
+
getProtocolContractArtifact(name: ProtocolContractName): Promise<ProtocolContract>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=lazy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/provider/lazy.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEzE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAElF,qBAAa,6BAA8B,YAAW,yBAAyB;IAC7E,2BAA2B,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAkBnF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { getCanonicalAuthRegistry } from '../auth-registry/lazy.js';
|
|
2
|
+
import { getCanonicalClassRegisterer } from '../class-registerer/lazy.js';
|
|
3
|
+
import { getCanonicalFeeJuice } from '../fee-juice/lazy.js';
|
|
4
|
+
import { getCanonicalInstanceDeployer } from '../instance-deployer/lazy.js';
|
|
5
|
+
import { getCanonicalMultiCallEntrypoint } from '../multi-call-entrypoint/lazy.js';
|
|
6
|
+
import { getCanonicalRouter } from '../router/lazy.js';
|
|
7
|
+
export class LazyProtocolContractsProvider {
|
|
8
|
+
getProtocolContractArtifact(name) {
|
|
9
|
+
switch(name){
|
|
10
|
+
case 'AuthRegistry':
|
|
11
|
+
return getCanonicalAuthRegistry();
|
|
12
|
+
case 'ContractInstanceDeployer':
|
|
13
|
+
return getCanonicalInstanceDeployer();
|
|
14
|
+
case 'ContractClassRegisterer':
|
|
15
|
+
return getCanonicalClassRegisterer();
|
|
16
|
+
case 'MultiCallEntrypoint':
|
|
17
|
+
return getCanonicalMultiCallEntrypoint();
|
|
18
|
+
case 'FeeJuice':
|
|
19
|
+
return getCanonicalFeeJuice();
|
|
20
|
+
case 'Router':
|
|
21
|
+
return getCanonicalRouter();
|
|
22
|
+
default:
|
|
23
|
+
throw new Error(`Unknown protocol contract name: ${name}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ProtocolContract } from '../protocol_contract.js';
|
|
2
|
+
import type { ProtocolContractName } from '../protocol_contract_data.js';
|
|
3
|
+
/** Returns the canonical deployment of a given artifact. */
|
|
4
|
+
export interface ProtocolContractsProvider {
|
|
5
|
+
getProtocolContractArtifact(name: ProtocolContractName): Promise<ProtocolContract>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=protocol_contracts_provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol_contracts_provider.d.ts","sourceRoot":"","sources":["../../src/provider/protocol_contracts_provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEzE,4DAA4D;AAC5D,MAAM,WAAW,yBAAyB;IACxC,2BAA2B,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACpF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/** Returns the canonical deployment of a given artifact. */ export { };
|
package/dest/router/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const RouterArtifact: import("@aztec/
|
|
1
|
+
import type { ProtocolContract } from '../protocol_contract.js';
|
|
2
|
+
export declare const RouterArtifact: import("@aztec/stdlib/abi").ContractArtifact;
|
|
3
3
|
/** Returns the canonical deployment of the contract. */
|
|
4
4
|
export declare function getCanonicalRouter(): Promise<ProtocolContract>;
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/router/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/router/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,eAAO,MAAM,cAAc,8CAA2D,CAAC;AAIvF,wDAAwD;AACxD,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAKpE"}
|
package/dest/router/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { loadContractArtifact } from '@aztec/
|
|
2
|
-
import RouterJson from '../../artifacts/Router.json' assert {
|
|
1
|
+
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
+
import RouterJson from '../../artifacts/Router.json' assert {
|
|
3
|
+
type: 'json'
|
|
4
|
+
};
|
|
3
5
|
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
4
6
|
export const RouterArtifact = loadContractArtifact(RouterJson);
|
|
5
7
|
let protocolContract;
|
|
6
|
-
/** Returns the canonical deployment of the contract. */
|
|
7
|
-
export async function getCanonicalRouter() {
|
|
8
|
+
/** Returns the canonical deployment of the contract. */ export async function getCanonicalRouter() {
|
|
8
9
|
if (!protocolContract) {
|
|
9
10
|
protocolContract = await makeProtocolContract('Router', RouterArtifact);
|
|
10
11
|
}
|
|
11
12
|
return protocolContract;
|
|
12
13
|
}
|
|
13
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcm91dGVyL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxvQkFBb0IsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBR3hELE9BQU8sVUFBVSxNQUFNLDZCQUE2QixDQUFDLFNBQVMsSUFBSSxFQUFFLE1BQU0sRUFBRSxDQUFDO0FBQzdFLE9BQU8sRUFBRSxvQkFBb0IsRUFBRSxNQUFNLDhCQUE4QixDQUFDO0FBR3BFLE1BQU0sQ0FBQyxNQUFNLGNBQWMsR0FBRyxvQkFBb0IsQ0FBQyxVQUFrQyxDQUFDLENBQUM7QUFFdkYsSUFBSSxnQkFBa0MsQ0FBQztBQUV2Qyx3REFBd0Q7QUFDeEQsTUFBTSxDQUFDLEtBQUssVUFBVSxrQkFBa0I7SUFDdEMsSUFBSSxDQUFDLGdCQUFnQixFQUFFLENBQUM7UUFDdEIsZ0JBQWdCLEdBQUcsTUFBTSxvQkFBb0IsQ0FBQyxRQUFRLEVBQUUsY0FBYyxDQUFDLENBQUM7SUFDMUUsQ0FBQztJQUNELE9BQU8sZ0JBQWdCLENBQUM7QUFDMUIsQ0FBQyJ9
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
+
import type { ProtocolContract } from '../protocol_contract.js';
|
|
3
|
+
export declare function getRouterArtifact(): Promise<ContractArtifact>;
|
|
4
|
+
/** Returns the canonical deployment of the auth registry. */
|
|
5
|
+
export declare function getCanonicalRouter(): Promise<ProtocolContract>;
|
|
6
|
+
//# sourceMappingURL=lazy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/router/lazy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAwB,MAAM,mBAAmB,CAAC;AAGhF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAKhE,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAWnE;AAED,6DAA6D;AAC7D,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAMpE"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
+
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
3
|
+
let protocolContract;
|
|
4
|
+
let protocolContractArtifact;
|
|
5
|
+
export async function getRouterArtifact() {
|
|
6
|
+
if (!protocolContractArtifact) {
|
|
7
|
+
// Cannot assert this import as it's incompatible with browsers
|
|
8
|
+
// https://caniuse.com/mdn-javascript_statements_import_import_assertions_type_json
|
|
9
|
+
// Use the new "with" syntax once supported by firefox
|
|
10
|
+
// https://caniuse.com/mdn-javascript_statements_import_import_attributes_type_json
|
|
11
|
+
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
12
|
+
const { default: routerJson } = await import('../../artifacts/Router.json');
|
|
13
|
+
protocolContractArtifact = loadContractArtifact(routerJson);
|
|
14
|
+
}
|
|
15
|
+
return protocolContractArtifact;
|
|
16
|
+
}
|
|
17
|
+
/** Returns the canonical deployment of the auth registry. */ export async function getCanonicalRouter() {
|
|
18
|
+
if (!protocolContract) {
|
|
19
|
+
const routerArtifact = await getRouterArtifact();
|
|
20
|
+
protocolContract = await makeProtocolContract('Router', routerArtifact);
|
|
21
|
+
}
|
|
22
|
+
return protocolContract;
|
|
23
|
+
}
|
|
@@ -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
|
+
fileData.file_map = {};
|
|
12
|
+
fileData.debug_symbols = {};
|
|
13
|
+
await writeFile(join(target, file), JSON.stringify(fileData));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
await cleanupArtifacts(fileURLToPath(new URL('../../artifacts', import.meta.url).href));
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { CANONICAL_AUTH_REGISTRY_ADDRESS, DEPLOYER_CONTRACT_ADDRESS, DEPLOYER_CONTRACT_INSTANCE_DEPLOYED_MAGIC_VALUE, DEPLOYER_CONTRACT_INSTANCE_UPDATED_MAGIC_VALUE, FEE_JUICE_ADDRESS, MULTI_CALL_ENTRYPOINT_ADDRESS, REGISTERER_CONTRACT_ADDRESS, REGISTERER_CONTRACT_CLASS_REGISTERED_MAGIC_VALUE, REGISTERER_PRIVATE_FUNCTION_BROADCASTED_MAGIC_VALUE, REGISTERER_UNCONSTRAINED_FUNCTION_BROADCASTED_MAGIC_VALUE, ROUTER_ADDRESS } from '@aztec/constants';
|
|
2
|
+
import { poseidon2Hash } from '@aztec/foundation/crypto';
|
|
3
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
4
|
+
import { createConsoleLogger } from '@aztec/foundation/log';
|
|
5
|
+
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
6
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
7
|
+
import { getContractInstanceFromDeployParams } from '@aztec/stdlib/contract';
|
|
8
|
+
import { promises as fs } from 'fs';
|
|
9
|
+
import path from 'path';
|
|
10
|
+
import { buildProtocolContractTree } from '../build_protocol_contract_tree.js';
|
|
11
|
+
const log = createConsoleLogger('autogenerate');
|
|
12
|
+
const noirContractsRoot = '../../noir-projects/noir-contracts';
|
|
13
|
+
const srcPath = path.join(noirContractsRoot, './target');
|
|
14
|
+
const destArtifactsDir = './artifacts';
|
|
15
|
+
const outputFilePath = './src/protocol_contract_data.ts';
|
|
16
|
+
const salt = new Fr(1);
|
|
17
|
+
const contractAddressMapping = {
|
|
18
|
+
AuthRegistry: CANONICAL_AUTH_REGISTRY_ADDRESS,
|
|
19
|
+
ContractInstanceDeployer: DEPLOYER_CONTRACT_ADDRESS,
|
|
20
|
+
ContractClassRegisterer: REGISTERER_CONTRACT_ADDRESS,
|
|
21
|
+
MultiCallEntrypoint: MULTI_CALL_ENTRYPOINT_ADDRESS,
|
|
22
|
+
FeeJuice: FEE_JUICE_ADDRESS,
|
|
23
|
+
Router: ROUTER_ADDRESS
|
|
24
|
+
};
|
|
25
|
+
async function clearDestDir() {
|
|
26
|
+
try {
|
|
27
|
+
await fs.access(destArtifactsDir);
|
|
28
|
+
// If the directory exists, remove it recursively.
|
|
29
|
+
await fs.rm(destArtifactsDir, {
|
|
30
|
+
recursive: true,
|
|
31
|
+
force: true,
|
|
32
|
+
maxRetries: 3
|
|
33
|
+
});
|
|
34
|
+
} catch (err) {
|
|
35
|
+
if (err.code === 'ENOENT') {
|
|
36
|
+
// If the directory does not exist, do nothing.
|
|
37
|
+
} else {
|
|
38
|
+
log(`Error removing dest directory: ${err}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
await fs.mkdir(destArtifactsDir, {
|
|
42
|
+
recursive: true
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
async function copyArtifact(srcName, destName) {
|
|
46
|
+
const src = path.join(srcPath, `${srcName}.json`);
|
|
47
|
+
const artifact = JSON.parse(await fs.readFile(src, 'utf8'));
|
|
48
|
+
const dest = path.join(destArtifactsDir, `${destName}.json`);
|
|
49
|
+
await fs.copyFile(src, dest);
|
|
50
|
+
return artifact;
|
|
51
|
+
}
|
|
52
|
+
async function computeContractLeaf(artifact) {
|
|
53
|
+
const instance = await getContractInstanceFromDeployParams(loadContractArtifact(artifact), {
|
|
54
|
+
salt
|
|
55
|
+
});
|
|
56
|
+
return instance.address;
|
|
57
|
+
}
|
|
58
|
+
async function computeRoot(names, leaves) {
|
|
59
|
+
const data = names.map((name, i)=>({
|
|
60
|
+
address: new AztecAddress(new Fr(contractAddressMapping[name])),
|
|
61
|
+
leaf: leaves[i]
|
|
62
|
+
}));
|
|
63
|
+
const tree = await buildProtocolContractTree(data);
|
|
64
|
+
return Fr.fromBuffer(tree.root);
|
|
65
|
+
}
|
|
66
|
+
async function generateDeclarationFile(destName) {
|
|
67
|
+
const content = `
|
|
68
|
+
import type { NoirCompiledContract } from '@aztec/stdlib/noir';
|
|
69
|
+
const circuit: NoirCompiledContract;
|
|
70
|
+
export = circuit;
|
|
71
|
+
`;
|
|
72
|
+
await fs.writeFile(path.join(destArtifactsDir, `${destName}.d.json.ts`), content);
|
|
73
|
+
}
|
|
74
|
+
function generateNames(names) {
|
|
75
|
+
return `
|
|
76
|
+
export const protocolContractNames = [
|
|
77
|
+
${names.map((name)=>`'${name}'`).join(',\n')}
|
|
78
|
+
] as const;
|
|
79
|
+
|
|
80
|
+
export type ProtocolContractName = typeof protocolContractNames[number];
|
|
81
|
+
`;
|
|
82
|
+
}
|
|
83
|
+
function generateSalts(names) {
|
|
84
|
+
return `
|
|
85
|
+
export const ProtocolContractSalt: Record<ProtocolContractName, Fr> = {
|
|
86
|
+
${names.map((name)=>`${name}: new Fr(${salt.toNumber()})`).join(',\n')}
|
|
87
|
+
};
|
|
88
|
+
`;
|
|
89
|
+
}
|
|
90
|
+
function generateContractAddresses(names) {
|
|
91
|
+
const addresses = names.map((name)=>`${name}: AztecAddress.fromBigInt(${contractAddressMapping[name]}n)`).join(',\n');
|
|
92
|
+
return `
|
|
93
|
+
export const ProtocolContractAddress: Record<ProtocolContractName, AztecAddress> = {
|
|
94
|
+
${addresses}
|
|
95
|
+
};
|
|
96
|
+
`;
|
|
97
|
+
}
|
|
98
|
+
function generateContractLeaves(names, leaves) {
|
|
99
|
+
return `
|
|
100
|
+
export const ProtocolContractLeaves = {
|
|
101
|
+
${leaves.map((leaf, i)=>`${names[i]}: Fr.fromHexString('${leaf.toString()}')`).join(',\n')}
|
|
102
|
+
};
|
|
103
|
+
`;
|
|
104
|
+
}
|
|
105
|
+
async function generateRoot(names, leaves) {
|
|
106
|
+
const root = await computeRoot(names, leaves);
|
|
107
|
+
return `
|
|
108
|
+
export const protocolContractTreeRoot = Fr.fromHexString('${root.toString()}');
|
|
109
|
+
`;
|
|
110
|
+
}
|
|
111
|
+
async function generateLogTags() {
|
|
112
|
+
// See silo_contract_class_log for all registerer tags
|
|
113
|
+
return `
|
|
114
|
+
export const REGISTERER_CONTRACT_CLASS_REGISTERED_TAG = Fr.fromHexString('${await poseidon2Hash([
|
|
115
|
+
REGISTERER_CONTRACT_ADDRESS,
|
|
116
|
+
REGISTERER_CONTRACT_CLASS_REGISTERED_MAGIC_VALUE
|
|
117
|
+
])}');
|
|
118
|
+
export const REGISTERER_PRIVATE_FUNCTION_BROADCASTED_TAG = Fr.fromHexString('${await poseidon2Hash([
|
|
119
|
+
REGISTERER_CONTRACT_ADDRESS,
|
|
120
|
+
REGISTERER_PRIVATE_FUNCTION_BROADCASTED_MAGIC_VALUE
|
|
121
|
+
])}');
|
|
122
|
+
export const REGISTERER_UNCONSTRAINED_FUNCTION_BROADCASTED_TAG = Fr.fromHexString('${await poseidon2Hash([
|
|
123
|
+
REGISTERER_CONTRACT_ADDRESS,
|
|
124
|
+
REGISTERER_UNCONSTRAINED_FUNCTION_BROADCASTED_MAGIC_VALUE
|
|
125
|
+
])}');
|
|
126
|
+
export const DEPLOYER_CONTRACT_INSTANCE_DEPLOYED_TAG = Fr.fromHexString('${await poseidon2Hash([
|
|
127
|
+
DEPLOYER_CONTRACT_ADDRESS,
|
|
128
|
+
DEPLOYER_CONTRACT_INSTANCE_DEPLOYED_MAGIC_VALUE
|
|
129
|
+
])}');
|
|
130
|
+
export const DEPLOYER_CONTRACT_INSTANCE_UPDATED_TAG = new Fr(${DEPLOYER_CONTRACT_INSTANCE_UPDATED_MAGIC_VALUE}n);
|
|
131
|
+
`;
|
|
132
|
+
}
|
|
133
|
+
async function generateOutputFile(names, leaves) {
|
|
134
|
+
const content = `
|
|
135
|
+
// GENERATED FILE - DO NOT EDIT. RUN \`yarn generate\` or \`yarn generate:data\`
|
|
136
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
137
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
138
|
+
|
|
139
|
+
${generateNames(names)}
|
|
140
|
+
|
|
141
|
+
${generateSalts(names)}
|
|
142
|
+
|
|
143
|
+
${generateContractAddresses(names)}
|
|
144
|
+
|
|
145
|
+
${generateContractLeaves(names, leaves)}
|
|
146
|
+
|
|
147
|
+
${await generateRoot(names, leaves)}
|
|
148
|
+
|
|
149
|
+
${await generateLogTags()}
|
|
150
|
+
`;
|
|
151
|
+
await fs.writeFile(outputFilePath, content);
|
|
152
|
+
}
|
|
153
|
+
async function main() {
|
|
154
|
+
await clearDestDir();
|
|
155
|
+
const srcNames = JSON.parse(await fs.readFile(path.join(noirContractsRoot, 'protocol_contracts.json'), 'utf8'));
|
|
156
|
+
const leaves = [];
|
|
157
|
+
const destNames = srcNames.map((n)=>n.split('-')[1]);
|
|
158
|
+
for(let i = 0; i < srcNames.length; i++){
|
|
159
|
+
const srcName = srcNames[i];
|
|
160
|
+
const destName = destNames[i];
|
|
161
|
+
const artifact = await copyArtifact(srcName, destName);
|
|
162
|
+
await generateDeclarationFile(destName);
|
|
163
|
+
const contractLeaf = await computeContractLeaf(artifact);
|
|
164
|
+
leaves.push(contractLeaf.toField());
|
|
165
|
+
}
|
|
166
|
+
await generateOutputFile(destNames, leaves);
|
|
167
|
+
}
|
|
168
|
+
try {
|
|
169
|
+
await main();
|
|
170
|
+
} catch (err) {
|
|
171
|
+
log(`Error copying protocol contract artifacts: ${err}`);
|
|
172
|
+
process.exit(1);
|
|
173
|
+
}
|
package/dest/tests/fixtures.js
CHANGED
|
@@ -24,4 +24,3 @@ export function getSampleContractInstanceDeployedEventPayload() {
|
|
|
24
24
|
export function getPathToFixture(name) {
|
|
25
25
|
return resolve(dirname(fileURLToPath(import.meta.url)), `../../fixtures/${name}`);
|
|
26
26
|
}
|
|
27
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZml4dHVyZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdGVzdHMvZml4dHVyZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLElBQUksQ0FBQztBQUNsQyxPQUFPLEVBQUUsT0FBTyxFQUFFLE9BQU8sRUFBRSxNQUFNLE1BQU0sQ0FBQztBQUN4QyxPQUFPLEVBQUUsYUFBYSxFQUFFLE1BQU0sS0FBSyxDQUFDO0FBRXBDLHdIQUF3SDtBQUN4SCxNQUFNLFVBQVUsNENBQTRDO0lBQzFELE1BQU0sSUFBSSxHQUFHLGdCQUFnQixDQUFDLHNDQUFzQyxDQUFDLENBQUM7SUFDdEUsT0FBTyxNQUFNLENBQUMsSUFBSSxDQUFDLFlBQVksQ0FBQyxJQUFJLENBQUMsQ0FBQyxRQUFRLEVBQUUsRUFBRSxLQUFLLENBQUMsQ0FBQztBQUMzRCxDQUFDO0FBRUQsd0hBQXdIO0FBQ3hILE1BQU0sVUFBVSwrQ0FBK0M7SUFDN0QsTUFBTSxJQUFJLEdBQUcsZ0JBQWdCLENBQUMseUNBQXlDLENBQUMsQ0FBQztJQUN6RSxPQUFPLE1BQU0sQ0FBQyxJQUFJLENBQUMsWUFBWSxDQUFDLElBQUksQ0FBQyxDQUFDLFFBQVEsRUFBRSxFQUFFLEtBQUssQ0FBQyxDQUFDO0FBQzNELENBQUM7QUFFRCx3SEFBd0g7QUFDeEgsTUFBTSxVQUFVLHFEQUFxRDtJQUNuRSxNQUFNLElBQUksR0FBRyxnQkFBZ0IsQ0FBQywrQ0FBK0MsQ0FBQyxDQUFDO0lBQy9FLE9BQU8sTUFBTSxDQUFDLElBQUksQ0FBQyxZQUFZLENBQUMsSUFBSSxDQUFDLENBQUMsUUFBUSxFQUFFLEVBQUUsS0FBSyxDQUFDLENBQUM7QUFDM0QsQ0FBQztBQUVELHdIQUF3SDtBQUN4SCxNQUFNLFVBQVUsNkNBQTZDO0lBQzNELE1BQU0sSUFBSSxHQUFHLGdCQUFnQixDQUFDLHVDQUF1QyxDQUFDLENBQUM7SUFDdkUsT0FBTyxNQUFNLENBQUMsSUFBSSxDQUFDLFlBQVksQ0FBQyxJQUFJLENBQUMsQ0FBQyxRQUFRLEVBQUUsRUFBRSxLQUFLLENBQUMsQ0FBQztBQUMzRCxDQUFDO0FBRUQsTUFBTSxVQUFVLGdCQUFnQixDQUFDLElBQVk7SUFDM0MsT0FBTyxPQUFPLENBQUMsT0FBTyxDQUFDLGFBQWEsQ0FBQyxNQUFNLENBQUMsSUFBSSxDQUFDLEdBQUcsQ0FBQyxDQUFDLEVBQUUsa0JBQWtCLElBQUksRUFBRSxDQUFDLENBQUM7QUFDcEYsQ0FBQyJ9
|
package/package.json
CHANGED
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
"name": "@aztec/protocol-contracts",
|
|
3
3
|
"homepage": "https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/protocol-contracts",
|
|
4
4
|
"description": "Canonical Noir contracts for the Aztec Network",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.77.0-testnet-ignition.17",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./dest/index.js",
|
|
9
|
-
"./bundle": "./dest/bundle
|
|
10
|
-
"
|
|
9
|
+
"./providers/bundle": "./dest/provider/bundle.js",
|
|
10
|
+
"./providers/lazy": "./dest/provider/lazy.js",
|
|
11
|
+
"./*": "./dest/*/index.js",
|
|
12
|
+
"./*/lazy": "./dest/*/lazy.js"
|
|
11
13
|
},
|
|
12
14
|
"typedocOptions": {
|
|
13
15
|
"entryPoints": [
|
|
@@ -22,14 +24,14 @@
|
|
|
22
24
|
"build": "yarn clean && yarn generate && yarn generate:cleanup-artifacts && tsc -b",
|
|
23
25
|
"build:keep-debug-symbols": "yarn clean && yarn generate && tsc -b",
|
|
24
26
|
"generate": "yarn generate:data",
|
|
25
|
-
"generate:cleanup-artifacts": "node --no-warnings --loader
|
|
26
|
-
"generate:data": "node --no-warnings --loader
|
|
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",
|
|
27
29
|
"build:dev": "tsc -b --watch",
|
|
28
30
|
"build:ts": "tsc -b",
|
|
29
31
|
"clean": "rm -rf ./dest .tsbuildinfo ./artifacts",
|
|
30
32
|
"formatting": "run -T prettier --check ./src && run -T eslint ./src",
|
|
31
33
|
"formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src",
|
|
32
|
-
"test": "
|
|
34
|
+
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
|
|
33
35
|
},
|
|
34
36
|
"inherits": [
|
|
35
37
|
"../package.common.json",
|
|
@@ -63,15 +65,15 @@
|
|
|
63
65
|
"reporters": [
|
|
64
66
|
"default"
|
|
65
67
|
],
|
|
66
|
-
"testTimeout":
|
|
68
|
+
"testTimeout": 120000,
|
|
67
69
|
"setupFiles": [
|
|
68
70
|
"../../foundation/src/jest/setup.mjs"
|
|
69
71
|
]
|
|
70
72
|
},
|
|
71
73
|
"dependencies": {
|
|
72
|
-
"@aztec/
|
|
73
|
-
"@aztec/foundation": "0.
|
|
74
|
-
"@aztec/
|
|
74
|
+
"@aztec/constants": "0.77.0-testnet-ignition.17",
|
|
75
|
+
"@aztec/foundation": "0.77.0-testnet-ignition.17",
|
|
76
|
+
"@aztec/stdlib": "0.77.0-testnet-ignition.17",
|
|
75
77
|
"lodash.chunk": "^4.2.0",
|
|
76
78
|
"lodash.omit": "^4.5.0",
|
|
77
79
|
"tslib": "^2.4.0"
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { loadContractArtifact } from '@aztec/
|
|
2
|
-
import {
|
|
1
|
+
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
+
import type { NoirCompiledContract } from '@aztec/stdlib/noir';
|
|
3
3
|
|
|
4
4
|
import AuthRegistryJson from '../../artifacts/AuthRegistry.json' assert { type: 'json' };
|
|
5
5
|
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
6
|
-
import {
|
|
6
|
+
import type { ProtocolContract } from '../protocol_contract.js';
|
|
7
7
|
|
|
8
8
|
let protocolContract: ProtocolContract;
|
|
9
9
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type ContractArtifact, loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
+
|
|
3
|
+
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
4
|
+
import type { ProtocolContract } from '../protocol_contract.js';
|
|
5
|
+
|
|
6
|
+
let protocolContract: ProtocolContract;
|
|
7
|
+
let protocolContractArtifact: ContractArtifact;
|
|
8
|
+
|
|
9
|
+
export async function getAuthRegistryArtifact(): Promise<ContractArtifact> {
|
|
10
|
+
if (!protocolContractArtifact) {
|
|
11
|
+
// Cannot assert this import as it's incompatible with browsers
|
|
12
|
+
// https://caniuse.com/mdn-javascript_statements_import_import_assertions_type_json
|
|
13
|
+
// Use the new "with" syntax once supported by firefox
|
|
14
|
+
// https://caniuse.com/mdn-javascript_statements_import_import_attributes_type_json
|
|
15
|
+
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
16
|
+
const { default: authRegistryJson } = await import('../../artifacts/AuthRegistry.json');
|
|
17
|
+
protocolContractArtifact = loadContractArtifact(authRegistryJson);
|
|
18
|
+
}
|
|
19
|
+
return protocolContractArtifact;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Returns the canonical deployment of the auth registry. */
|
|
23
|
+
export async function getCanonicalAuthRegistry(): Promise<ProtocolContract> {
|
|
24
|
+
if (!protocolContract) {
|
|
25
|
+
const authRegistryArtifact = await getAuthRegistryArtifact();
|
|
26
|
+
protocolContract = await makeProtocolContract('AuthRegistry', authRegistryArtifact);
|
|
27
|
+
}
|
|
28
|
+
return protocolContract;
|
|
29
|
+
}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type AztecAddress,
|
|
3
|
-
type Fr,
|
|
4
|
-
type IndexedMerkleTree,
|
|
5
|
-
IndexedMerkleTreeCalculator,
|
|
6
|
-
MAX_PROTOCOL_CONTRACTS,
|
|
7
|
-
PROTOCOL_CONTRACT_TREE_HEIGHT,
|
|
8
|
-
ProtocolContractLeafPreimage,
|
|
9
|
-
} from '@aztec/circuits.js';
|
|
1
|
+
import { MAX_PROTOCOL_CONTRACTS, PROTOCOL_CONTRACT_TREE_HEIGHT } from '@aztec/constants';
|
|
10
2
|
import { poseidon2Hash } from '@aztec/foundation/crypto';
|
|
3
|
+
import type { Fr } from '@aztec/foundation/fields';
|
|
4
|
+
import { type IndexedMerkleTree, IndexedMerkleTreeCalculator } from '@aztec/foundation/trees';
|
|
5
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
|
+
import { ProtocolContractLeafPreimage } from '@aztec/stdlib/trees';
|
|
11
7
|
|
|
12
8
|
export async function buildProtocolContractTree(
|
|
13
9
|
contracts: { address: AztecAddress; leaf: Fr }[],
|