@aztec/protocol-contracts 0.0.1-fake-ceab37513c → 0.0.6-commit.a2d1860fe9

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 (110) hide show
  1. package/artifacts/AuthRegistry.json +1625 -1630
  2. package/artifacts/ContractClassRegistry.json +897 -7230
  3. package/artifacts/ContractInstanceRegistry.json +1105 -1772
  4. package/artifacts/FeeJuice.json +2884 -1598
  5. package/artifacts/MultiCallEntrypoint.json +1190 -1129
  6. package/artifacts/PublicChecks.json +988 -0
  7. package/dest/auth-registry/index.d.ts +1 -1
  8. package/dest/auth-registry/index.d.ts.map +1 -1
  9. package/dest/auth-registry/index.js +3 -3
  10. package/dest/auth-registry/lazy.d.ts +1 -1
  11. package/dest/auth-registry/lazy.js +5 -5
  12. package/dest/class-registry/contract_class_published_event.d.ts +3 -2
  13. package/dest/class-registry/contract_class_published_event.d.ts.map +1 -1
  14. package/dest/class-registry/contract_class_published_event.js +4 -0
  15. package/dest/class-registry/index.d.ts +1 -1
  16. package/dest/class-registry/index.d.ts.map +1 -1
  17. package/dest/class-registry/index.js +3 -3
  18. package/dest/class-registry/lazy.d.ts +1 -1
  19. package/dest/class-registry/lazy.js +5 -5
  20. package/dest/class-registry/private_function_broadcasted_event.d.ts +2 -2
  21. package/dest/class-registry/private_function_broadcasted_event.d.ts.map +1 -1
  22. package/dest/class-registry/utility_function_broadcasted_event.d.ts +2 -2
  23. package/dest/class-registry/utility_function_broadcasted_event.d.ts.map +1 -1
  24. package/dest/class-registry/utility_function_broadcasted_event.js +1 -1
  25. package/dest/fee-juice/index.d.ts +2 -2
  26. package/dest/fee-juice/index.d.ts.map +1 -1
  27. package/dest/fee-juice/index.js +3 -3
  28. package/dest/fee-juice/lazy.d.ts +1 -1
  29. package/dest/fee-juice/lazy.js +5 -5
  30. package/dest/index.d.ts +1 -2
  31. package/dest/index.d.ts.map +1 -1
  32. package/dest/index.js +0 -1
  33. package/dest/instance-registry/contract_instance_published_event.d.ts +3 -2
  34. package/dest/instance-registry/contract_instance_published_event.d.ts.map +1 -1
  35. package/dest/instance-registry/contract_instance_published_event.js +4 -1
  36. package/dest/instance-registry/contract_instance_updated_event.d.ts +2 -2
  37. package/dest/instance-registry/contract_instance_updated_event.d.ts.map +1 -1
  38. package/dest/instance-registry/contract_instance_updated_event.js +5 -7
  39. package/dest/instance-registry/index.d.ts +1 -1
  40. package/dest/instance-registry/index.d.ts.map +1 -1
  41. package/dest/instance-registry/index.js +3 -3
  42. package/dest/instance-registry/lazy.d.ts +1 -1
  43. package/dest/instance-registry/lazy.js +5 -5
  44. package/dest/make_protocol_contract.d.ts +4 -4
  45. package/dest/make_protocol_contract.d.ts.map +1 -1
  46. package/dest/make_protocol_contract.js +28 -14
  47. package/dest/multi-call-entrypoint/index.d.ts +1 -1
  48. package/dest/multi-call-entrypoint/index.d.ts.map +1 -1
  49. package/dest/multi-call-entrypoint/index.js +3 -3
  50. package/dest/multi-call-entrypoint/lazy.d.ts +1 -1
  51. package/dest/multi-call-entrypoint/lazy.js +5 -5
  52. package/dest/protocol_contract.d.ts +1 -1
  53. package/dest/protocol_contract_data.d.ts +25 -11
  54. package/dest/protocol_contract_data.d.ts.map +1 -1
  55. package/dest/protocol_contract_data.js +113 -13
  56. package/dest/provider/bundle.d.ts +1 -1
  57. package/dest/provider/bundle.d.ts.map +1 -1
  58. package/dest/provider/bundle.js +3 -3
  59. package/dest/provider/lazy.d.ts +1 -1
  60. package/dest/provider/lazy.d.ts.map +1 -1
  61. package/dest/provider/lazy.js +3 -3
  62. package/dest/provider/protocol_contracts_provider.d.ts +1 -1
  63. package/dest/public-checks/index.d.ts +5 -0
  64. package/dest/public-checks/index.d.ts.map +1 -0
  65. package/dest/public-checks/index.js +13 -0
  66. package/dest/public-checks/lazy.d.ts +6 -0
  67. package/dest/public-checks/lazy.d.ts.map +1 -0
  68. package/dest/public-checks/lazy.js +23 -0
  69. package/dest/scripts/generate_data.js +88 -37
  70. package/dest/tests/fixtures.d.ts +1 -1
  71. package/package.json +9 -8
  72. package/src/auth-registry/index.ts +3 -3
  73. package/src/auth-registry/lazy.ts +5 -5
  74. package/src/class-registry/contract_class_published_event.ts +8 -1
  75. package/src/class-registry/index.ts +3 -3
  76. package/src/class-registry/lazy.ts +5 -5
  77. package/src/class-registry/private_function_broadcasted_event.ts +1 -1
  78. package/src/class-registry/utility_function_broadcasted_event.ts +1 -1
  79. package/src/fee-juice/index.ts +4 -4
  80. package/src/fee-juice/lazy.ts +5 -5
  81. package/src/index.ts +0 -1
  82. package/src/instance-registry/contract_instance_published_event.ts +7 -1
  83. package/src/instance-registry/contract_instance_updated_event.ts +6 -8
  84. package/src/instance-registry/index.ts +3 -3
  85. package/src/instance-registry/lazy.ts +5 -5
  86. package/src/make_protocol_contract.ts +37 -15
  87. package/src/multi-call-entrypoint/index.ts +3 -3
  88. package/src/multi-call-entrypoint/lazy.ts +5 -5
  89. package/src/protocol_contract_data.ts +91 -13
  90. package/src/provider/bundle.ts +3 -3
  91. package/src/provider/lazy.ts +3 -3
  92. package/src/{router → public-checks}/index.ts +5 -5
  93. package/src/public-checks/lazy.ts +29 -0
  94. package/artifacts/Router.json +0 -4629
  95. package/dest/build_protocol_contract_tree.d.ts +0 -10
  96. package/dest/build_protocol_contract_tree.d.ts.map +0 -1
  97. package/dest/build_protocol_contract_tree.js +0 -20
  98. package/dest/protocol_contract_tree.d.ts +0 -7
  99. package/dest/protocol_contract_tree.d.ts.map +0 -1
  100. package/dest/protocol_contract_tree.js +0 -34
  101. package/dest/router/index.d.ts +0 -5
  102. package/dest/router/index.d.ts.map +0 -1
  103. package/dest/router/index.js +0 -13
  104. package/dest/router/lazy.d.ts +0 -6
  105. package/dest/router/lazy.d.ts.map +0 -1
  106. package/dest/router/lazy.js +0 -23
  107. package/src/build_protocol_contract_tree.ts +0 -29
  108. package/src/protocol_contract_tree.ts +0 -44
  109. package/src/router/lazy.ts +0 -29
  110. /package/artifacts/{Router.d.json.ts → PublicChecks.d.json.ts} +0 -0
@@ -1,10 +0,0 @@
1
- import { PROTOCOL_CONTRACT_TREE_HEIGHT } from '@aztec/constants';
2
- import type { Fr } from '@aztec/foundation/fields';
3
- import { type IndexedMerkleTree } from '@aztec/foundation/trees';
4
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
5
- import { ProtocolContractLeafPreimage } from '@aztec/stdlib/trees';
6
- export declare function buildProtocolContractTree(contracts: {
7
- address: AztecAddress;
8
- leaf: Fr;
9
- }[]): Promise<IndexedMerkleTree<ProtocolContractLeafPreimage, typeof PROTOCOL_CONTRACT_TREE_HEIGHT>>;
10
- //# sourceMappingURL=build_protocol_contract_tree.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"build_protocol_contract_tree.d.ts","sourceRoot":"","sources":["../src/build_protocol_contract_tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AAEzF,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,KAAK,iBAAiB,EAA+B,MAAM,yBAAyB,CAAC;AAC9F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAEnE,wBAAsB,yBAAyB,CAC7C,SAAS,EAAE;IAAE,OAAO,EAAE,YAAY,CAAC;IAAC,IAAI,EAAE,EAAE,CAAA;CAAE,EAAE,GAC/C,OAAO,CAAC,iBAAiB,CAAC,4BAA4B,EAAE,OAAO,6BAA6B,CAAC,CAAC,CAmBhG"}
@@ -1,20 +0,0 @@
1
- import { MAX_PROTOCOL_CONTRACTS, PROTOCOL_CONTRACT_TREE_HEIGHT } from '@aztec/constants';
2
- import { poseidon2Hash } from '@aztec/foundation/crypto';
3
- import { IndexedMerkleTreeCalculator } from '@aztec/foundation/trees';
4
- import { ProtocolContractLeafPreimage } from '@aztec/stdlib/trees';
5
- export async function buildProtocolContractTree(contracts) {
6
- const hasher = {
7
- hash: async (l, r)=>(await poseidon2Hash([
8
- l,
9
- r
10
- ])).toBuffer(),
11
- hashInputs: async (i)=>(await poseidon2Hash(i)).toBuffer()
12
- };
13
- const calculator = await IndexedMerkleTreeCalculator.create(PROTOCOL_CONTRACT_TREE_HEIGHT, hasher, ProtocolContractLeafPreimage);
14
- const leaves = new Array(MAX_PROTOCOL_CONTRACTS).fill(Buffer.alloc(32));
15
- for (const contract of contracts){
16
- const index = contract.address.toField().toNumber();
17
- leaves[index] = contract.leaf.toBuffer();
18
- }
19
- return calculator.computeTree(leaves);
20
- }
@@ -1,7 +0,0 @@
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<{
4
- lowLeaf: ProtocolContractLeafPreimage;
5
- witness: import("@aztec/foundation/trees").MembershipWitness<3>;
6
- }>;
7
- //# sourceMappingURL=protocol_contract_tree.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,34 +0,0 @@
1
- import { poseidon2Hash } from '@aztec/foundation/crypto';
2
- import { buildProtocolContractTree } from './build_protocol_contract_tree.js';
3
- import { isProtocolContract } from './protocol_contract.js';
4
- import { ProtocolContractAddress, ProtocolContractLeaves, protocolContractNames } from './protocol_contract_data.js';
5
- let protocolContractTree;
6
- async function getTree() {
7
- if (!protocolContractTree) {
8
- const leaves = protocolContractNames.map((name)=>({
9
- address: ProtocolContractAddress[name],
10
- leaf: ProtocolContractLeaves[name]
11
- }));
12
- protocolContractTree = await buildProtocolContractTree(leaves);
13
- }
14
- return protocolContractTree;
15
- }
16
- // Computed address can be different from contract address due to upgrades
17
- export async function getProtocolContractLeafAndMembershipWitness(contractAddress, computedAddress) {
18
- const tree = await getTree();
19
- let lowLeaf;
20
- let witness;
21
- if (isProtocolContract(contractAddress)) {
22
- const index = contractAddress.toField().toNumber();
23
- lowLeaf = tree.leafPreimages[index];
24
- witness = tree.getMembershipWitness(index);
25
- } else {
26
- lowLeaf = tree.getLowLeaf(computedAddress.toBigInt());
27
- const hashed = (await poseidon2Hash(lowLeaf.toHashInputs())).toBuffer();
28
- witness = tree.getMembershipWitness(hashed);
29
- }
30
- return {
31
- lowLeaf,
32
- witness
33
- };
34
- }
@@ -1,5 +0,0 @@
1
- import type { ProtocolContract } from '../protocol_contract.js';
2
- export declare const RouterArtifact: import("@aztec/stdlib/abi").ContractArtifact;
3
- /** Returns the canonical deployment of the contract. */
4
- export declare function getCanonicalRouter(): Promise<ProtocolContract>;
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,13 +0,0 @@
1
- import { loadContractArtifact } from '@aztec/stdlib/abi';
2
- import RouterJson from '../../artifacts/Router.json' with {
3
- type: 'json'
4
- };
5
- import { makeProtocolContract } from '../make_protocol_contract.js';
6
- export const RouterArtifact = loadContractArtifact(RouterJson);
7
- let protocolContract;
8
- /** Returns the canonical deployment of the contract. */ export async function getCanonicalRouter() {
9
- if (!protocolContract) {
10
- protocolContract = await makeProtocolContract('Router', RouterArtifact);
11
- }
12
- return protocolContract;
13
- }
@@ -1,6 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,23 +0,0 @@
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
- }
@@ -1,29 +0,0 @@
1
- import { MAX_PROTOCOL_CONTRACTS, PROTOCOL_CONTRACT_TREE_HEIGHT } from '@aztec/constants';
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';
7
-
8
- export async function buildProtocolContractTree(
9
- contracts: { address: AztecAddress; leaf: Fr }[],
10
- ): Promise<IndexedMerkleTree<ProtocolContractLeafPreimage, typeof PROTOCOL_CONTRACT_TREE_HEIGHT>> {
11
- const hasher = {
12
- hash: async (l: Buffer, r: Buffer) => (await poseidon2Hash([l, r])).toBuffer() as Buffer<ArrayBuffer>,
13
- hashInputs: async (i: Buffer[]) => (await poseidon2Hash(i)).toBuffer() as Buffer<ArrayBuffer>,
14
- };
15
- const calculator = await IndexedMerkleTreeCalculator.create(
16
- PROTOCOL_CONTRACT_TREE_HEIGHT,
17
- hasher,
18
- ProtocolContractLeafPreimage,
19
- );
20
-
21
- const leaves = new Array(MAX_PROTOCOL_CONTRACTS).fill(Buffer.alloc(32));
22
-
23
- for (const contract of contracts) {
24
- const index = contract.address.toField().toNumber();
25
- leaves[index] = contract.leaf.toBuffer();
26
- }
27
-
28
- return calculator.computeTree(leaves);
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,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
- }