@aztec/protocol-contracts 0.0.0-test.0 → 0.0.1-commit.001888fc
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/README.md +2 -2
- package/artifacts/AuthRegistry.json +2602 -1590
- package/artifacts/ContractClassRegistry.json +2022 -0
- package/artifacts/ContractInstanceRegistry.json +2949 -0
- package/artifacts/FeeJuice.json +3040 -2987
- package/artifacts/MultiCallEntrypoint.json +2153 -1169
- package/artifacts/PublicChecks.json +1200 -0
- package/dest/auth-registry/index.d.ts +3 -2
- package/dest/auth-registry/index.d.ts.map +1 -1
- package/dest/auth-registry/index.js +4 -4
- package/dest/auth-registry/lazy.d.ts +1 -1
- package/dest/auth-registry/lazy.js +5 -5
- package/dest/class-registry/contract_class_published_event.d.ts +17 -0
- package/dest/class-registry/contract_class_published_event.d.ts.map +1 -0
- package/dest/{class-registerer/contract_class_registered_event.js → class-registry/contract_class_published_event.js} +15 -20
- package/dest/class-registry/index.d.ts +8 -0
- package/dest/class-registry/index.d.ts.map +1 -0
- package/dest/class-registry/index.js +17 -0
- package/dest/class-registry/lazy.d.ts +9 -0
- package/dest/class-registry/lazy.d.ts.map +1 -0
- package/dest/class-registry/lazy.js +26 -0
- package/dest/class-registry/private_function_broadcasted_event.d.ts +44 -0
- package/dest/class-registry/private_function_broadcasted_event.d.ts.map +1 -0
- package/dest/{class-registerer → class-registry}/private_function_broadcasted_event.js +11 -11
- package/dest/class-registry/utility_function_broadcasted_event.d.ts +38 -0
- package/dest/class-registry/utility_function_broadcasted_event.d.ts.map +1 -0
- package/dest/{class-registerer/unconstrained_function_broadcasted_event.js → class-registry/utility_function_broadcasted_event.js} +20 -20
- package/dest/fee-juice/index.d.ts +2 -2
- package/dest/fee-juice/index.d.ts.map +1 -1
- package/dest/fee-juice/index.js +4 -4
- package/dest/fee-juice/lazy.d.ts +1 -1
- package/dest/fee-juice/lazy.js +5 -5
- package/dest/index.d.ts +1 -2
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +0 -1
- package/dest/instance-registry/contract_instance_published_event.d.ts +21 -0
- package/dest/instance-registry/contract_instance_published_event.d.ts.map +1 -0
- package/dest/{instance-deployer/contract_instance_deployed_event.js → instance-registry/contract_instance_published_event.js} +9 -6
- package/dest/instance-registry/contract_instance_updated_event.d.ts +17 -0
- package/dest/instance-registry/contract_instance_updated_event.d.ts.map +1 -0
- package/dest/instance-registry/contract_instance_updated_event.js +35 -0
- package/dest/instance-registry/index.d.ts +7 -0
- package/dest/instance-registry/index.d.ts.map +1 -0
- package/dest/instance-registry/index.js +15 -0
- package/dest/instance-registry/lazy.d.ts +8 -0
- package/dest/{instance-deployer → instance-registry}/lazy.d.ts.map +1 -1
- package/dest/instance-registry/lazy.js +25 -0
- package/dest/make_protocol_contract.d.ts +4 -4
- package/dest/make_protocol_contract.d.ts.map +1 -1
- package/dest/make_protocol_contract.js +28 -14
- package/dest/multi-call-entrypoint/index.d.ts +1 -1
- package/dest/multi-call-entrypoint/index.d.ts.map +1 -1
- package/dest/multi-call-entrypoint/index.js +4 -4
- package/dest/multi-call-entrypoint/lazy.d.ts +1 -1
- package/dest/multi-call-entrypoint/lazy.js +5 -5
- package/dest/protocol_contract.d.ts +1 -1
- package/dest/protocol_contract_data.d.ts +26 -16
- package/dest/protocol_contract_data.d.ts.map +1 -1
- package/dest/protocol_contract_data.js +119 -23
- package/dest/provider/bundle.d.ts +1 -1
- package/dest/provider/bundle.d.ts.map +1 -1
- package/dest/provider/bundle.js +7 -7
- package/dest/provider/lazy.d.ts +1 -1
- package/dest/provider/lazy.d.ts.map +1 -1
- package/dest/provider/lazy.js +9 -9
- package/dest/provider/protocol_contracts_provider.d.ts +1 -1
- package/dest/public-checks/index.d.ts +5 -0
- package/dest/public-checks/index.d.ts.map +1 -0
- package/dest/public-checks/index.js +13 -0
- package/dest/public-checks/lazy.d.ts +6 -0
- package/dest/public-checks/lazy.d.ts.map +1 -0
- package/dest/public-checks/lazy.js +23 -0
- package/dest/scripts/cleanup_artifacts.js +2 -2
- package/dest/scripts/generate_data.js +95 -53
- package/dest/tests/fixtures.d.ts +4 -6
- package/dest/tests/fixtures.d.ts.map +1 -1
- package/dest/tests/fixtures.js +6 -6
- package/package.json +23 -20
- package/src/auth-registry/index.ts +6 -6
- package/src/auth-registry/lazy.ts +5 -5
- package/src/class-registry/__snapshots__/README.md +9 -0
- package/src/{class-registerer/contract_class_registered_event.ts → class-registry/contract_class_published_event.ts} +23 -23
- package/src/class-registry/index.ts +23 -0
- package/src/class-registry/lazy.ts +33 -0
- package/src/{class-registerer → class-registry}/private_function_broadcasted_event.ts +13 -9
- package/src/{class-registerer/unconstrained_function_broadcasted_event.ts → class-registry/utility_function_broadcasted_event.ts} +26 -22
- package/src/fee-juice/index.ts +5 -5
- package/src/fee-juice/lazy.ts +5 -5
- package/src/index.ts +0 -1
- package/src/instance-registry/__snapshots__/README.md +9 -0
- package/src/{instance-deployer/contract_instance_deployed_event.ts → instance-registry/contract_instance_published_event.ts} +13 -7
- package/src/{instance-deployer → instance-registry}/contract_instance_updated_event.ts +15 -15
- package/src/instance-registry/index.ts +23 -0
- package/src/instance-registry/lazy.ts +32 -0
- package/src/make_protocol_contract.ts +37 -15
- package/src/multi-call-entrypoint/index.ts +4 -4
- package/src/multi-call-entrypoint/lazy.ts +5 -5
- package/src/protocol_contract_data.ts +97 -23
- package/src/provider/bundle.ts +7 -7
- package/src/provider/lazy.ts +9 -9
- package/src/{router → public-checks}/index.ts +5 -5
- package/src/public-checks/lazy.ts +29 -0
- package/src/tests/fixtures.ts +6 -6
- package/artifacts/ContractClassRegisterer.json +0 -7219
- package/artifacts/ContractInstanceDeployer.json +0 -2984
- package/artifacts/Router.json +0 -3798
- package/dest/build_protocol_contract_tree.d.ts +0 -10
- package/dest/build_protocol_contract_tree.d.ts.map +0 -1
- package/dest/build_protocol_contract_tree.js +0 -20
- package/dest/class-registerer/contract_class_registered_event.d.ts +0 -18
- package/dest/class-registerer/contract_class_registered_event.d.ts.map +0 -1
- package/dest/class-registerer/index.d.ts +0 -8
- package/dest/class-registerer/index.d.ts.map +0 -1
- package/dest/class-registerer/index.js +0 -17
- package/dest/class-registerer/lazy.d.ts +0 -9
- package/dest/class-registerer/lazy.d.ts.map +0 -1
- package/dest/class-registerer/lazy.js +0 -26
- package/dest/class-registerer/private_function_broadcasted_event.d.ts +0 -46
- package/dest/class-registerer/private_function_broadcasted_event.d.ts.map +0 -1
- package/dest/class-registerer/unconstrained_function_broadcasted_event.d.ts +0 -40
- package/dest/class-registerer/unconstrained_function_broadcasted_event.d.ts.map +0 -1
- package/dest/instance-deployer/contract_instance_deployed_event.d.ts +0 -20
- package/dest/instance-deployer/contract_instance_deployed_event.d.ts.map +0 -1
- package/dest/instance-deployer/contract_instance_updated_event.d.ts +0 -16
- package/dest/instance-deployer/contract_instance_updated_event.d.ts.map +0 -1
- package/dest/instance-deployer/contract_instance_updated_event.js +0 -36
- package/dest/instance-deployer/index.d.ts +0 -7
- package/dest/instance-deployer/index.d.ts.map +0 -1
- package/dest/instance-deployer/index.js +0 -15
- package/dest/instance-deployer/lazy.d.ts +0 -8
- package/dest/instance-deployer/lazy.js +0 -25
- package/dest/protocol_contract_tree.d.ts +0 -7
- package/dest/protocol_contract_tree.d.ts.map +0 -1
- package/dest/protocol_contract_tree.js +0 -34
- package/dest/router/index.d.ts +0 -5
- package/dest/router/index.d.ts.map +0 -1
- package/dest/router/index.js +0 -13
- package/dest/router/lazy.d.ts +0 -6
- package/dest/router/lazy.d.ts.map +0 -1
- package/dest/router/lazy.js +0 -23
- package/src/build_protocol_contract_tree.ts +0 -29
- package/src/class-registerer/index.ts +0 -25
- package/src/class-registerer/lazy.ts +0 -33
- package/src/instance-deployer/index.ts +0 -23
- package/src/instance-deployer/lazy.ts +0 -32
- package/src/protocol_contract_tree.ts +0 -44
- package/src/router/lazy.ts +0 -29
- /package/artifacts/{ContractClassRegisterer.d.json.ts → ContractClassRegistry.d.json.ts} +0 -0
- /package/artifacts/{ContractInstanceDeployer.d.json.ts → ContractInstanceRegistry.d.json.ts} +0 -0
- /package/artifacts/{Router.d.json.ts → PublicChecks.d.json.ts} +0 -0
|
@@ -1,32 +0,0 @@
|
|
|
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
|
-
export * from './contract_instance_deployed_event.js';
|
|
7
|
-
export * from './contract_instance_updated_event.js';
|
|
8
|
-
|
|
9
|
-
let protocolContract: ProtocolContract;
|
|
10
|
-
let protocolContractArtifact: ContractArtifact;
|
|
11
|
-
|
|
12
|
-
export async function getContractInstanceDeployerArtifact(): Promise<ContractArtifact> {
|
|
13
|
-
if (!protocolContractArtifact) {
|
|
14
|
-
// Cannot assert this import as it's incompatible with browsers
|
|
15
|
-
// https://caniuse.com/mdn-javascript_statements_import_import_assertions_type_json
|
|
16
|
-
// Use the new "with" syntax once supported by firefox
|
|
17
|
-
// https://caniuse.com/mdn-javascript_statements_import_import_attributes_type_json
|
|
18
|
-
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
19
|
-
const { default: contractInstanceDeployerJson } = await import('../../artifacts/ContractInstanceDeployer.json');
|
|
20
|
-
protocolContractArtifact = loadContractArtifact(contractInstanceDeployerJson);
|
|
21
|
-
}
|
|
22
|
-
return protocolContractArtifact;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/** Returns the canonical deployment of the auth registry. */
|
|
26
|
-
export async function getCanonicalInstanceDeployer(): Promise<ProtocolContract> {
|
|
27
|
-
if (!protocolContract) {
|
|
28
|
-
const contractInstanceDeployerArtifact = await getContractInstanceDeployerArtifact();
|
|
29
|
-
protocolContract = await makeProtocolContract('ContractInstanceDeployer', contractInstanceDeployerArtifact);
|
|
30
|
-
}
|
|
31
|
-
return protocolContract;
|
|
32
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { PROTOCOL_CONTRACT_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
-
import { poseidon2Hash } from '@aztec/foundation/crypto';
|
|
3
|
-
import type { IndexedMerkleTree } from '@aztec/foundation/trees';
|
|
4
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
-
import type { ProtocolContractLeafPreimage } from '@aztec/stdlib/trees';
|
|
6
|
-
|
|
7
|
-
import { buildProtocolContractTree } from './build_protocol_contract_tree.js';
|
|
8
|
-
import { isProtocolContract } from './protocol_contract.js';
|
|
9
|
-
import { ProtocolContractAddress, ProtocolContractLeaves, protocolContractNames } from './protocol_contract_data.js';
|
|
10
|
-
|
|
11
|
-
let protocolContractTree:
|
|
12
|
-
| IndexedMerkleTree<ProtocolContractLeafPreimage, typeof PROTOCOL_CONTRACT_TREE_HEIGHT>
|
|
13
|
-
| undefined;
|
|
14
|
-
|
|
15
|
-
async function getTree() {
|
|
16
|
-
if (!protocolContractTree) {
|
|
17
|
-
const leaves = protocolContractNames.map(name => ({
|
|
18
|
-
address: ProtocolContractAddress[name],
|
|
19
|
-
leaf: ProtocolContractLeaves[name],
|
|
20
|
-
}));
|
|
21
|
-
protocolContractTree = await buildProtocolContractTree(leaves);
|
|
22
|
-
}
|
|
23
|
-
return protocolContractTree;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// Computed address can be different from contract address due to upgrades
|
|
27
|
-
export async function getProtocolContractLeafAndMembershipWitness(
|
|
28
|
-
contractAddress: AztecAddress,
|
|
29
|
-
computedAddress: AztecAddress,
|
|
30
|
-
) {
|
|
31
|
-
const tree = await getTree();
|
|
32
|
-
let lowLeaf;
|
|
33
|
-
let witness;
|
|
34
|
-
if (isProtocolContract(contractAddress)) {
|
|
35
|
-
const index = contractAddress.toField().toNumber();
|
|
36
|
-
lowLeaf = tree.leafPreimages[index];
|
|
37
|
-
witness = tree.getMembershipWitness(index);
|
|
38
|
-
} else {
|
|
39
|
-
lowLeaf = tree.getLowLeaf(computedAddress.toBigInt());
|
|
40
|
-
const hashed = (await poseidon2Hash(lowLeaf.toHashInputs())).toBuffer();
|
|
41
|
-
witness = tree.getMembershipWitness(hashed);
|
|
42
|
-
}
|
|
43
|
-
return { lowLeaf, witness };
|
|
44
|
-
}
|
package/src/router/lazy.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
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 getRouterArtifact(): 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: routerJson } = await import('../../artifacts/Router.json');
|
|
17
|
-
protocolContractArtifact = loadContractArtifact(routerJson);
|
|
18
|
-
}
|
|
19
|
-
return protocolContractArtifact;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/** Returns the canonical deployment of the auth registry. */
|
|
23
|
-
export async function getCanonicalRouter(): Promise<ProtocolContract> {
|
|
24
|
-
if (!protocolContract) {
|
|
25
|
-
const routerArtifact = await getRouterArtifact();
|
|
26
|
-
protocolContract = await makeProtocolContract('Router', routerArtifact);
|
|
27
|
-
}
|
|
28
|
-
return protocolContract;
|
|
29
|
-
}
|
|
File without changes
|
/package/artifacts/{ContractInstanceDeployer.d.json.ts → ContractInstanceRegistry.d.json.ts}
RENAMED
|
File without changes
|
|
File without changes
|