@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.
Files changed (144) hide show
  1. package/README.md +2 -2
  2. package/artifacts/ContractClassRegistry.json +3950 -0
  3. package/artifacts/ContractInstanceRegistry.json +5132 -0
  4. package/artifacts/FeeJuice.json +5171 -2507
  5. package/dest/class-registry/contract_class_published_event.d.ts +20 -0
  6. package/dest/class-registry/contract_class_published_event.d.ts.map +1 -0
  7. package/dest/class-registry/contract_class_published_event.js +52 -0
  8. package/dest/class-registry/index.d.ts +6 -0
  9. package/dest/class-registry/index.d.ts.map +1 -0
  10. package/dest/class-registry/index.js +15 -0
  11. package/dest/class-registry/lazy.d.ts +7 -0
  12. package/dest/class-registry/lazy.d.ts.map +1 -0
  13. package/dest/class-registry/lazy.js +24 -0
  14. package/dest/fee-juice/index.d.ts +2 -2
  15. package/dest/fee-juice/index.d.ts.map +1 -1
  16. package/dest/fee-juice/index.js +4 -4
  17. package/dest/fee-juice/lazy.d.ts +1 -1
  18. package/dest/fee-juice/lazy.js +5 -5
  19. package/dest/index.d.ts +1 -2
  20. package/dest/index.d.ts.map +1 -1
  21. package/dest/index.js +0 -1
  22. package/dest/instance-registry/contract_instance_published_event.d.ts +22 -0
  23. package/dest/instance-registry/contract_instance_published_event.d.ts.map +1 -0
  24. package/dest/{instance-deployer/contract_instance_deployed_event.js → instance-registry/contract_instance_published_event.js} +15 -8
  25. package/dest/instance-registry/contract_instance_updated_event.d.ts +17 -0
  26. package/dest/instance-registry/contract_instance_updated_event.d.ts.map +1 -0
  27. package/dest/instance-registry/contract_instance_updated_event.js +35 -0
  28. package/dest/instance-registry/index.d.ts +7 -0
  29. package/dest/instance-registry/index.d.ts.map +1 -0
  30. package/dest/instance-registry/index.js +15 -0
  31. package/dest/instance-registry/lazy.d.ts +8 -0
  32. package/dest/{instance-deployer → instance-registry}/lazy.d.ts.map +1 -1
  33. package/dest/instance-registry/lazy.js +25 -0
  34. package/dest/make_protocol_contract.d.ts +4 -4
  35. package/dest/make_protocol_contract.d.ts.map +1 -1
  36. package/dest/make_protocol_contract.js +30 -14
  37. package/dest/protocol_contract.d.ts +1 -1
  38. package/dest/protocol_contract_data.d.ts +23 -16
  39. package/dest/protocol_contract_data.d.ts.map +1 -1
  40. package/dest/protocol_contract_data.js +82 -32
  41. package/dest/provider/bundle.d.ts +1 -1
  42. package/dest/provider/bundle.d.ts.map +1 -1
  43. package/dest/provider/bundle.js +6 -12
  44. package/dest/provider/lazy.d.ts +1 -1
  45. package/dest/provider/lazy.d.ts.map +1 -1
  46. package/dest/provider/lazy.js +6 -15
  47. package/dest/provider/protocol_contracts_provider.d.ts +1 -1
  48. package/dest/scripts/cleanup_artifacts.js +2 -2
  49. package/dest/scripts/generate_data.js +96 -56
  50. package/dest/tests/fixtures.d.ts +3 -7
  51. package/dest/tests/fixtures.d.ts.map +1 -1
  52. package/dest/tests/fixtures.js +4 -14
  53. package/package.json +23 -20
  54. package/src/class-registry/__snapshots__/README.md +9 -0
  55. package/src/class-registry/contract_class_published_event.ts +72 -0
  56. package/src/class-registry/index.ts +21 -0
  57. package/src/class-registry/lazy.ts +31 -0
  58. package/src/fee-juice/index.ts +5 -5
  59. package/src/fee-juice/lazy.ts +5 -5
  60. package/src/index.ts +0 -1
  61. package/src/instance-registry/__snapshots__/README.md +9 -0
  62. package/src/{instance-deployer/contract_instance_deployed_event.ts → instance-registry/contract_instance_published_event.ts} +18 -8
  63. package/src/{instance-deployer → instance-registry}/contract_instance_updated_event.ts +15 -15
  64. package/src/instance-registry/index.ts +23 -0
  65. package/src/instance-registry/lazy.ts +32 -0
  66. package/src/make_protocol_contract.ts +39 -15
  67. package/src/protocol_contract_data.ts +70 -32
  68. package/src/provider/bundle.ts +5 -11
  69. package/src/provider/lazy.ts +6 -15
  70. package/src/tests/fixtures.ts +4 -16
  71. package/artifacts/AuthRegistry.json +0 -2725
  72. package/artifacts/ContractClassRegisterer.json +0 -7219
  73. package/artifacts/ContractInstanceDeployer.d.json.ts +0 -5
  74. package/artifacts/ContractInstanceDeployer.json +0 -2984
  75. package/artifacts/MultiCallEntrypoint.d.json.ts +0 -5
  76. package/artifacts/MultiCallEntrypoint.json +0 -2005
  77. package/artifacts/Router.d.json.ts +0 -5
  78. package/artifacts/Router.json +0 -3798
  79. package/dest/auth-registry/index.d.ts +0 -5
  80. package/dest/auth-registry/index.d.ts.map +0 -1
  81. package/dest/auth-registry/index.js +0 -13
  82. package/dest/auth-registry/lazy.d.ts +0 -6
  83. package/dest/auth-registry/lazy.d.ts.map +0 -1
  84. package/dest/auth-registry/lazy.js +0 -23
  85. package/dest/build_protocol_contract_tree.d.ts +0 -10
  86. package/dest/build_protocol_contract_tree.d.ts.map +0 -1
  87. package/dest/build_protocol_contract_tree.js +0 -20
  88. package/dest/class-registerer/contract_class_registered_event.d.ts +0 -18
  89. package/dest/class-registerer/contract_class_registered_event.d.ts.map +0 -1
  90. package/dest/class-registerer/contract_class_registered_event.js +0 -63
  91. package/dest/class-registerer/index.d.ts +0 -8
  92. package/dest/class-registerer/index.d.ts.map +0 -1
  93. package/dest/class-registerer/index.js +0 -17
  94. package/dest/class-registerer/lazy.d.ts +0 -9
  95. package/dest/class-registerer/lazy.d.ts.map +0 -1
  96. package/dest/class-registerer/lazy.js +0 -26
  97. package/dest/class-registerer/private_function_broadcasted_event.d.ts +0 -46
  98. package/dest/class-registerer/private_function_broadcasted_event.d.ts.map +0 -1
  99. package/dest/class-registerer/private_function_broadcasted_event.js +0 -85
  100. package/dest/class-registerer/unconstrained_function_broadcasted_event.d.ts +0 -40
  101. package/dest/class-registerer/unconstrained_function_broadcasted_event.d.ts.map +0 -1
  102. package/dest/class-registerer/unconstrained_function_broadcasted_event.js +0 -81
  103. package/dest/instance-deployer/contract_instance_deployed_event.d.ts +0 -20
  104. package/dest/instance-deployer/contract_instance_deployed_event.d.ts.map +0 -1
  105. package/dest/instance-deployer/contract_instance_updated_event.d.ts +0 -16
  106. package/dest/instance-deployer/contract_instance_updated_event.d.ts.map +0 -1
  107. package/dest/instance-deployer/contract_instance_updated_event.js +0 -36
  108. package/dest/instance-deployer/index.d.ts +0 -7
  109. package/dest/instance-deployer/index.d.ts.map +0 -1
  110. package/dest/instance-deployer/index.js +0 -15
  111. package/dest/instance-deployer/lazy.d.ts +0 -8
  112. package/dest/instance-deployer/lazy.js +0 -25
  113. package/dest/multi-call-entrypoint/index.d.ts +0 -5
  114. package/dest/multi-call-entrypoint/index.d.ts.map +0 -1
  115. package/dest/multi-call-entrypoint/index.js +0 -13
  116. package/dest/multi-call-entrypoint/lazy.d.ts +0 -6
  117. package/dest/multi-call-entrypoint/lazy.d.ts.map +0 -1
  118. package/dest/multi-call-entrypoint/lazy.js +0 -23
  119. package/dest/protocol_contract_tree.d.ts +0 -7
  120. package/dest/protocol_contract_tree.d.ts.map +0 -1
  121. package/dest/protocol_contract_tree.js +0 -34
  122. package/dest/router/index.d.ts +0 -5
  123. package/dest/router/index.d.ts.map +0 -1
  124. package/dest/router/index.js +0 -13
  125. package/dest/router/lazy.d.ts +0 -6
  126. package/dest/router/lazy.d.ts.map +0 -1
  127. package/dest/router/lazy.js +0 -23
  128. package/src/auth-registry/index.ts +0 -18
  129. package/src/auth-registry/lazy.ts +0 -29
  130. package/src/build_protocol_contract_tree.ts +0 -29
  131. package/src/class-registerer/contract_class_registered_event.ts +0 -83
  132. package/src/class-registerer/index.ts +0 -25
  133. package/src/class-registerer/lazy.ts +0 -33
  134. package/src/class-registerer/private_function_broadcasted_event.ts +0 -105
  135. package/src/class-registerer/unconstrained_function_broadcasted_event.ts +0 -99
  136. package/src/instance-deployer/index.ts +0 -23
  137. package/src/instance-deployer/lazy.ts +0 -32
  138. package/src/multi-call-entrypoint/index.ts +0 -18
  139. package/src/multi-call-entrypoint/lazy.ts +0 -29
  140. package/src/protocol_contract_tree.ts +0 -44
  141. package/src/router/index.ts +0 -18
  142. package/src/router/lazy.ts +0 -29
  143. /package/artifacts/{AuthRegistry.d.json.ts → ContractClassRegistry.d.json.ts} +0 -0
  144. /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
- }
@@ -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
- }
@@ -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
- }