@aztec/protocol-contracts 0.0.0-test.1 → 0.0.1-commit.017a351
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/ContractClassRegistry.json +3950 -0
- package/artifacts/ContractInstanceRegistry.json +5132 -0
- package/artifacts/FeeJuice.json +5171 -2507
- package/dest/class-registry/contract_class_published_event.d.ts +20 -0
- package/dest/class-registry/contract_class_published_event.d.ts.map +1 -0
- package/dest/class-registry/contract_class_published_event.js +52 -0
- package/dest/class-registry/index.d.ts +6 -0
- package/dest/class-registry/index.d.ts.map +1 -0
- package/dest/class-registry/index.js +15 -0
- package/dest/class-registry/lazy.d.ts +7 -0
- package/dest/class-registry/lazy.d.ts.map +1 -0
- package/dest/class-registry/lazy.js +24 -0
- 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 +22 -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} +15 -8
- 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 +30 -14
- package/dest/protocol_contract.d.ts +1 -1
- package/dest/protocol_contract_data.d.ts +23 -16
- package/dest/protocol_contract_data.d.ts.map +1 -1
- package/dest/protocol_contract_data.js +82 -32
- package/dest/provider/bundle.d.ts +1 -1
- package/dest/provider/bundle.d.ts.map +1 -1
- package/dest/provider/bundle.js +6 -12
- package/dest/provider/lazy.d.ts +1 -1
- package/dest/provider/lazy.d.ts.map +1 -1
- package/dest/provider/lazy.js +6 -15
- package/dest/provider/protocol_contracts_provider.d.ts +1 -1
- package/dest/scripts/cleanup_artifacts.js +2 -2
- package/dest/scripts/generate_data.js +96 -56
- package/dest/tests/fixtures.d.ts +3 -7
- package/dest/tests/fixtures.d.ts.map +1 -1
- package/dest/tests/fixtures.js +4 -14
- package/package.json +23 -20
- package/src/class-registry/__snapshots__/README.md +9 -0
- package/src/class-registry/contract_class_published_event.ts +72 -0
- package/src/class-registry/index.ts +21 -0
- package/src/class-registry/lazy.ts +31 -0
- 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} +18 -8
- 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 +39 -15
- package/src/protocol_contract_data.ts +70 -32
- package/src/provider/bundle.ts +5 -11
- package/src/provider/lazy.ts +6 -15
- package/src/tests/fixtures.ts +4 -16
- package/artifacts/AuthRegistry.json +0 -2725
- package/artifacts/ContractClassRegisterer.json +0 -7219
- package/artifacts/ContractInstanceDeployer.d.json.ts +0 -5
- package/artifacts/ContractInstanceDeployer.json +0 -2984
- package/artifacts/MultiCallEntrypoint.d.json.ts +0 -5
- package/artifacts/MultiCallEntrypoint.json +0 -2005
- package/artifacts/Router.d.json.ts +0 -5
- package/artifacts/Router.json +0 -3798
- package/dest/auth-registry/index.d.ts +0 -5
- package/dest/auth-registry/index.d.ts.map +0 -1
- package/dest/auth-registry/index.js +0 -13
- package/dest/auth-registry/lazy.d.ts +0 -6
- package/dest/auth-registry/lazy.d.ts.map +0 -1
- package/dest/auth-registry/lazy.js +0 -23
- 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/contract_class_registered_event.js +0 -63
- 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/private_function_broadcasted_event.js +0 -85
- 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/class-registerer/unconstrained_function_broadcasted_event.js +0 -81
- 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/multi-call-entrypoint/index.d.ts +0 -5
- package/dest/multi-call-entrypoint/index.d.ts.map +0 -1
- package/dest/multi-call-entrypoint/index.js +0 -13
- package/dest/multi-call-entrypoint/lazy.d.ts +0 -6
- package/dest/multi-call-entrypoint/lazy.d.ts.map +0 -1
- package/dest/multi-call-entrypoint/lazy.js +0 -23
- 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/auth-registry/index.ts +0 -18
- package/src/auth-registry/lazy.ts +0 -29
- package/src/build_protocol_contract_tree.ts +0 -29
- package/src/class-registerer/contract_class_registered_event.ts +0 -83
- package/src/class-registerer/index.ts +0 -25
- package/src/class-registerer/lazy.ts +0 -33
- package/src/class-registerer/private_function_broadcasted_event.ts +0 -105
- package/src/class-registerer/unconstrained_function_broadcasted_event.ts +0 -99
- package/src/instance-deployer/index.ts +0 -23
- package/src/instance-deployer/lazy.ts +0 -32
- package/src/multi-call-entrypoint/index.ts +0 -18
- package/src/multi-call-entrypoint/lazy.ts +0 -29
- package/src/protocol_contract_tree.ts +0 -44
- package/src/router/index.ts +0 -18
- package/src/router/lazy.ts +0 -29
- /package/artifacts/{AuthRegistry.d.json.ts → ContractClassRegistry.d.json.ts} +0 -0
- /package/artifacts/{ContractClassRegisterer.d.json.ts → ContractInstanceRegistry.d.json.ts} +0 -0
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
-
import type { NoirCompiledContract } from '@aztec/stdlib/noir';
|
|
3
|
-
|
|
4
|
-
import ContractInstanceDeployerJson from '../../artifacts/ContractInstanceDeployer.json' assert { type: 'json' };
|
|
5
|
-
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
6
|
-
import type { ProtocolContract } from '../protocol_contract.js';
|
|
7
|
-
|
|
8
|
-
export * from './contract_instance_deployed_event.js';
|
|
9
|
-
export * from './contract_instance_updated_event.js';
|
|
10
|
-
|
|
11
|
-
export const ContractInstanceDeployerArtifact = loadContractArtifact(
|
|
12
|
-
ContractInstanceDeployerJson as NoirCompiledContract,
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
let protocolContract: ProtocolContract;
|
|
16
|
-
|
|
17
|
-
/** Returns the canonical deployment of the contract. */
|
|
18
|
-
export async function getCanonicalInstanceDeployer(): Promise<ProtocolContract> {
|
|
19
|
-
if (!protocolContract) {
|
|
20
|
-
protocolContract = await makeProtocolContract('ContractInstanceDeployer', ContractInstanceDeployerArtifact);
|
|
21
|
-
}
|
|
22
|
-
return protocolContract;
|
|
23
|
-
}
|
|
@@ -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,18 +0,0 @@
|
|
|
1
|
-
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
-
import type { NoirCompiledContract } from '@aztec/stdlib/noir';
|
|
3
|
-
|
|
4
|
-
import MultiCallEntrypointJson from '../../artifacts/MultiCallEntrypoint.json' assert { type: 'json' };
|
|
5
|
-
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
6
|
-
import type { ProtocolContract } from '../protocol_contract.js';
|
|
7
|
-
|
|
8
|
-
export const MultiCallEntrypointArtifact = loadContractArtifact(MultiCallEntrypointJson as NoirCompiledContract);
|
|
9
|
-
|
|
10
|
-
let protocolContract: ProtocolContract;
|
|
11
|
-
|
|
12
|
-
/** Returns the canonical deployment of the contract. */
|
|
13
|
-
export async function getCanonicalMultiCallEntrypoint(): Promise<ProtocolContract> {
|
|
14
|
-
if (!protocolContract) {
|
|
15
|
-
protocolContract = await makeProtocolContract('MultiCallEntrypoint', MultiCallEntrypointArtifact);
|
|
16
|
-
}
|
|
17
|
-
return protocolContract;
|
|
18
|
-
}
|
|
@@ -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 getMultiCallEntrypointArtifact(): 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: multiCallEntrypointJson } = await import('../../artifacts/MultiCallEntrypoint.json');
|
|
17
|
-
protocolContractArtifact = loadContractArtifact(multiCallEntrypointJson);
|
|
18
|
-
}
|
|
19
|
-
return protocolContractArtifact;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/** Returns the canonical deployment of the auth registry. */
|
|
23
|
-
export async function getCanonicalMultiCallEntrypoint(): Promise<ProtocolContract> {
|
|
24
|
-
if (!protocolContract) {
|
|
25
|
-
const multiCallEntrypointArtifact = await getMultiCallEntrypointArtifact();
|
|
26
|
-
protocolContract = await makeProtocolContract('MultiCallEntrypoint', multiCallEntrypointArtifact);
|
|
27
|
-
}
|
|
28
|
-
return protocolContract;
|
|
29
|
-
}
|
|
@@ -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/index.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
-
import type { NoirCompiledContract } from '@aztec/stdlib/noir';
|
|
3
|
-
|
|
4
|
-
import RouterJson from '../../artifacts/Router.json' assert { type: 'json' };
|
|
5
|
-
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
6
|
-
import type { ProtocolContract } from '../protocol_contract.js';
|
|
7
|
-
|
|
8
|
-
export const RouterArtifact = loadContractArtifact(RouterJson as NoirCompiledContract);
|
|
9
|
-
|
|
10
|
-
let protocolContract: ProtocolContract;
|
|
11
|
-
|
|
12
|
-
/** Returns the canonical deployment of the contract. */
|
|
13
|
-
export async function getCanonicalRouter(): Promise<ProtocolContract> {
|
|
14
|
-
if (!protocolContract) {
|
|
15
|
-
protocolContract = await makeProtocolContract('Router', RouterArtifact);
|
|
16
|
-
}
|
|
17
|
-
return protocolContract;
|
|
18
|
-
}
|
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
|
|
File without changes
|