@aztec/protocol-contracts 0.0.0-test.0 → 0.0.1-commit.24de95ac

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 (111) hide show
  1. package/README.md +2 -2
  2. package/artifacts/AuthRegistry.json +1979 -1183
  3. package/artifacts/ContractClassRegistry.json +8205 -0
  4. package/artifacts/ContractInstanceRegistry.json +3587 -0
  5. package/artifacts/FeeJuice.json +2499 -1930
  6. package/artifacts/MultiCallEntrypoint.json +1527 -841
  7. package/artifacts/Router.json +709 -3531
  8. package/dest/auth-registry/index.d.ts +2 -1
  9. package/dest/auth-registry/index.d.ts.map +1 -1
  10. package/dest/auth-registry/index.js +1 -1
  11. package/dest/auth-registry/lazy.js +4 -4
  12. package/dest/{class-registerer/contract_class_registered_event.d.ts → class-registry/contract_class_published_event.d.ts} +5 -7
  13. package/dest/class-registry/contract_class_published_event.d.ts.map +1 -0
  14. package/dest/{class-registerer/contract_class_registered_event.js → class-registry/contract_class_published_event.js} +12 -20
  15. package/dest/class-registry/index.d.ts +8 -0
  16. package/dest/class-registry/index.d.ts.map +1 -0
  17. package/dest/class-registry/index.js +17 -0
  18. package/dest/class-registry/lazy.d.ts +9 -0
  19. package/dest/class-registry/lazy.d.ts.map +1 -0
  20. package/dest/class-registry/lazy.js +26 -0
  21. package/dest/{class-registerer → class-registry}/private_function_broadcasted_event.d.ts +3 -5
  22. package/dest/class-registry/private_function_broadcasted_event.d.ts.map +1 -0
  23. package/dest/{class-registerer → class-registry}/private_function_broadcasted_event.js +11 -11
  24. package/dest/{class-registerer/unconstrained_function_broadcasted_event.d.ts → class-registry/utility_function_broadcasted_event.d.ts} +12 -14
  25. package/dest/class-registry/utility_function_broadcasted_event.d.ts.map +1 -0
  26. package/dest/{class-registerer/unconstrained_function_broadcasted_event.js → class-registry/utility_function_broadcasted_event.js} +19 -19
  27. package/dest/fee-juice/index.js +1 -1
  28. package/dest/fee-juice/lazy.js +4 -4
  29. package/dest/index.d.ts +0 -1
  30. package/dest/index.d.ts.map +1 -1
  31. package/dest/index.js +0 -1
  32. package/dest/{instance-deployer/contract_instance_deployed_event.d.ts → instance-registry/contract_instance_published_event.d.ts} +5 -5
  33. package/dest/instance-registry/contract_instance_published_event.d.ts.map +1 -0
  34. package/dest/{instance-deployer/contract_instance_deployed_event.js → instance-registry/contract_instance_published_event.js} +5 -5
  35. package/dest/{instance-deployer → instance-registry}/contract_instance_updated_event.d.ts +4 -3
  36. package/dest/instance-registry/contract_instance_updated_event.d.ts.map +1 -0
  37. package/dest/instance-registry/contract_instance_updated_event.js +35 -0
  38. package/dest/{instance-deployer → instance-registry}/index.d.ts +3 -3
  39. package/dest/instance-registry/index.d.ts.map +1 -0
  40. package/dest/{instance-deployer → instance-registry}/index.js +5 -5
  41. package/dest/{instance-deployer → instance-registry}/lazy.d.ts +3 -3
  42. package/dest/{instance-deployer → instance-registry}/lazy.d.ts.map +1 -1
  43. package/dest/instance-registry/lazy.js +25 -0
  44. package/dest/make_protocol_contract.js +2 -2
  45. package/dest/multi-call-entrypoint/index.js +1 -1
  46. package/dest/multi-call-entrypoint/lazy.js +4 -4
  47. package/dest/protocol_contract_data.d.ts +12 -14
  48. package/dest/protocol_contract_data.d.ts.map +1 -1
  49. package/dest/protocol_contract_data.js +29 -19
  50. package/dest/provider/bundle.js +4 -4
  51. package/dest/provider/lazy.js +6 -6
  52. package/dest/router/index.js +1 -1
  53. package/dest/router/lazy.js +4 -4
  54. package/dest/scripts/cleanup_artifacts.js +2 -2
  55. package/dest/scripts/generate_data.js +38 -45
  56. package/dest/tests/fixtures.d.ts +3 -5
  57. package/dest/tests/fixtures.d.ts.map +1 -1
  58. package/dest/tests/fixtures.js +6 -6
  59. package/package.json +18 -16
  60. package/src/auth-registry/index.ts +3 -3
  61. package/src/auth-registry/lazy.ts +4 -4
  62. package/src/class-registry/__snapshots__/README.md +9 -0
  63. package/src/{class-registerer/contract_class_registered_event.ts → class-registry/contract_class_published_event.ts} +16 -22
  64. package/src/{class-registerer → class-registry}/index.ts +7 -9
  65. package/src/class-registry/lazy.ts +33 -0
  66. package/src/{class-registerer → class-registry}/private_function_broadcasted_event.ts +12 -8
  67. package/src/{class-registerer/unconstrained_function_broadcasted_event.ts → class-registry/utility_function_broadcasted_event.ts} +25 -21
  68. package/src/fee-juice/index.ts +1 -1
  69. package/src/fee-juice/lazy.ts +4 -4
  70. package/src/index.ts +0 -1
  71. package/src/instance-registry/__snapshots__/README.md +9 -0
  72. package/src/{instance-deployer/contract_instance_deployed_event.ts → instance-registry/contract_instance_published_event.ts} +6 -6
  73. package/src/{instance-deployer → instance-registry}/contract_instance_updated_event.ts +14 -14
  74. package/src/{instance-deployer → instance-registry}/index.ts +6 -6
  75. package/src/{instance-deployer → instance-registry}/lazy.ts +11 -11
  76. package/src/make_protocol_contract.ts +2 -2
  77. package/src/multi-call-entrypoint/index.ts +1 -1
  78. package/src/multi-call-entrypoint/lazy.ts +4 -4
  79. package/src/protocol_contract_data.ts +30 -19
  80. package/src/provider/bundle.ts +4 -4
  81. package/src/provider/lazy.ts +6 -6
  82. package/src/router/index.ts +1 -1
  83. package/src/router/lazy.ts +4 -4
  84. package/src/tests/fixtures.ts +6 -6
  85. package/artifacts/ContractClassRegisterer.json +0 -7219
  86. package/artifacts/ContractInstanceDeployer.json +0 -2984
  87. package/dest/build_protocol_contract_tree.d.ts +0 -10
  88. package/dest/build_protocol_contract_tree.d.ts.map +0 -1
  89. package/dest/build_protocol_contract_tree.js +0 -20
  90. package/dest/class-registerer/contract_class_registered_event.d.ts.map +0 -1
  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.map +0 -1
  98. package/dest/class-registerer/unconstrained_function_broadcasted_event.d.ts.map +0 -1
  99. package/dest/instance-deployer/contract_instance_deployed_event.d.ts.map +0 -1
  100. package/dest/instance-deployer/contract_instance_updated_event.d.ts.map +0 -1
  101. package/dest/instance-deployer/contract_instance_updated_event.js +0 -36
  102. package/dest/instance-deployer/index.d.ts.map +0 -1
  103. package/dest/instance-deployer/lazy.js +0 -25
  104. package/dest/protocol_contract_tree.d.ts +0 -7
  105. package/dest/protocol_contract_tree.d.ts.map +0 -1
  106. package/dest/protocol_contract_tree.js +0 -34
  107. package/src/build_protocol_contract_tree.ts +0 -29
  108. package/src/class-registerer/lazy.ts +0 -33
  109. package/src/protocol_contract_tree.ts +0 -44
  110. /package/artifacts/{ContractClassRegisterer.d.json.ts → ContractClassRegistry.d.json.ts} +0 -0
  111. /package/artifacts/{ContractInstanceDeployer.d.json.ts → ContractInstanceRegistry.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 +0,0 @@
1
- {"version":3,"file":"contract_class_registered_event.d.ts","sourceRoot":"","sources":["../../src/class-registerer/contract_class_registered_event.ts"],"names":[],"mappings":";;AACA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,EACL,KAAK,mBAAmB,EAIzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAI3D,sDAAsD;AACtD,qBAAa,4BAA4B;aAErB,eAAe,EAAE,EAAE;aACnB,OAAO,EAAE,MAAM;aACf,YAAY,EAAE,EAAE;aAChB,oBAAoB,EAAE,EAAE;aACxB,oBAAoB,EAAE,MAAM;gBAJ5B,eAAe,EAAE,EAAE,EACnB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,EAAE,EAChB,oBAAoB,EAAE,EAAE,EACxB,oBAAoB,EAAE,MAAM;IAG9C,MAAM,CAAC,8BAA8B,CAAC,GAAG,EAAE,gBAAgB;IAI3D,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,gBAAgB;IAiB9B,qBAAqB,IAAI,OAAO,CAAC,mBAAmB,CAAC;CAqC5D"}
@@ -1,8 +0,0 @@
1
- import type { ProtocolContract } from '../protocol_contract.js';
2
- export * from './contract_class_registered_event.js';
3
- export * from './private_function_broadcasted_event.js';
4
- export * from './unconstrained_function_broadcasted_event.js';
5
- export declare const ContractClassRegistererArtifact: import("@aztec/stdlib/abi").ContractArtifact;
6
- /** Returns the canonical deployment of the contract. */
7
- export declare function getCanonicalClassRegisterer(): Promise<ProtocolContract>;
8
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/class-registerer/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,cAAc,sCAAsC,CAAC;AACrD,cAAc,yCAAyC,CAAC;AACxD,cAAc,+CAA+C,CAAC;AAE9D,eAAO,MAAM,+BAA+B,8CAE3C,CAAC;AAIF,wDAAwD;AACxD,wBAAsB,2BAA2B,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAM7E"}
@@ -1,17 +0,0 @@
1
- import { loadContractArtifact } from '@aztec/stdlib/abi';
2
- import ContractClassRegistererJson from '../../artifacts/ContractClassRegisterer.json' assert {
3
- type: 'json'
4
- };
5
- import { makeProtocolContract } from '../make_protocol_contract.js';
6
- export * from './contract_class_registered_event.js';
7
- export * from './private_function_broadcasted_event.js';
8
- export * from './unconstrained_function_broadcasted_event.js';
9
- export const ContractClassRegistererArtifact = loadContractArtifact(ContractClassRegistererJson);
10
- let protocolContract;
11
- /** Returns the canonical deployment of the contract. */ export async function getCanonicalClassRegisterer() {
12
- if (!protocolContract) {
13
- const artifact = ContractClassRegistererArtifact;
14
- protocolContract = await makeProtocolContract('ContractClassRegisterer', artifact);
15
- }
16
- return protocolContract;
17
- }
@@ -1,9 +0,0 @@
1
- import { type ContractArtifact } from '@aztec/stdlib/abi';
2
- import type { ProtocolContract } from '../protocol_contract.js';
3
- export * from './contract_class_registered_event.js';
4
- export * from './private_function_broadcasted_event.js';
5
- export * from './unconstrained_function_broadcasted_event.js';
6
- export declare function getContractClassRegistererArtifact(): Promise<ContractArtifact>;
7
- /** Returns the canonical deployment of the auth registry. */
8
- export declare function getCanonicalClassRegisterer(): Promise<ProtocolContract>;
9
- //# sourceMappingURL=lazy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/class-registerer/lazy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAwB,MAAM,mBAAmB,CAAC;AAGhF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,cAAc,sCAAsC,CAAC;AACrD,cAAc,yCAAyC,CAAC;AACxD,cAAc,+CAA+C,CAAC;AAK9D,wBAAsB,kCAAkC,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAWpF;AAED,6DAA6D;AAC7D,wBAAsB,2BAA2B,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAM7E"}
@@ -1,26 +0,0 @@
1
- import { loadContractArtifact } from '@aztec/stdlib/abi';
2
- import { makeProtocolContract } from '../make_protocol_contract.js';
3
- export * from './contract_class_registered_event.js';
4
- export * from './private_function_broadcasted_event.js';
5
- export * from './unconstrained_function_broadcasted_event.js';
6
- let protocolContract;
7
- let protocolContractArtifact;
8
- export async function getContractClassRegistererArtifact() {
9
- if (!protocolContractArtifact) {
10
- // Cannot assert this import as it's incompatible with browsers
11
- // https://caniuse.com/mdn-javascript_statements_import_import_assertions_type_json
12
- // Use the new "with" syntax once supported by firefox
13
- // https://caniuse.com/mdn-javascript_statements_import_import_attributes_type_json
14
- // In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
15
- const { default: contractClassRegistererJson } = await import('../../artifacts/ContractClassRegisterer.json');
16
- protocolContractArtifact = loadContractArtifact(contractClassRegistererJson);
17
- }
18
- return protocolContractArtifact;
19
- }
20
- /** Returns the canonical deployment of the auth registry. */ export async function getCanonicalClassRegisterer() {
21
- if (!protocolContract) {
22
- const contractClassRegistererArtifact = await getContractClassRegistererArtifact();
23
- protocolContract = await makeProtocolContract('ContractClassRegisterer', contractClassRegistererArtifact);
24
- }
25
- return protocolContract;
26
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"private_function_broadcasted_event.d.ts","sourceRoot":"","sources":["../../src/class-registerer/private_function_broadcasted_event.ts"],"names":[],"mappings":";;AAAA,OAAO,EACL,iCAAiC,EACjC,oBAAoB,EAErB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAoB,MAAM,mBAAmB,CAAC;AACvE,OAAO,KAAK,EAAE,4CAA4C,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC5G,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAI3D,sDAAsD;AACtD,qBAAa,+BAA+B;aAExB,eAAe,EAAE,EAAE;aACnB,oBAAoB,EAAE,EAAE;aACxB,sCAAsC,EAAE,EAAE;aAC1C,8BAA8B,EAAE,KAAK,CAAC,EAAE,EAAE,OAAO,oBAAoB,CAAC;aACtE,4BAA4B,EAAE,MAAM;aACpC,+BAA+B,EAAE,KAAK,CAAC,EAAE,EAAE,OAAO,iCAAiC,CAAC;aACpF,6BAA6B,EAAE,MAAM;aACrC,eAAe,EAAE,0BAA0B;gBAP3C,eAAe,EAAE,EAAE,EACnB,oBAAoB,EAAE,EAAE,EACxB,sCAAsC,EAAE,EAAE,EAC1C,8BAA8B,EAAE,KAAK,CAAC,EAAE,EAAE,OAAO,oBAAoB,CAAC,EACtE,4BAA4B,EAAE,MAAM,EACpC,+BAA+B,EAAE,KAAK,CAAC,EAAE,EAAE,OAAO,iCAAiC,CAAC,EACpF,6BAA6B,EAAE,MAAM,EACrC,eAAe,EAAE,0BAA0B;IAG7D,MAAM,CAAC,iCAAiC,CAAC,GAAG,EAAE,gBAAgB;IAI9D,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,gBAAgB;IAapC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE,GAAG,WAAW;IAuB5C,6BAA6B,IAAI,4CAA4C;CAa9E;AAED,qBAAa,0BAA2B,YAAW,eAAe;IAE9D,qJAAqJ;aACrI,QAAQ,EAAE,gBAAgB;IAC1C,6BAA6B;aACb,YAAY,EAAE,EAAE;IAChC,wEAAwE;aACxD,MAAM,EAAE,EAAE;IAC1B,gCAAgC;aAChB,QAAQ,EAAE,MAAM;;IAPhC,qJAAqJ;IACrI,QAAQ,EAAE,gBAAgB;IAC1C,6BAA6B;IACb,YAAY,EAAE,EAAE;IAChC,wEAAwE;IACxD,MAAM,EAAE,EAAE;IAC1B,gCAAgC;IAChB,QAAQ,EAAE,MAAM;IAGlC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE,GAAG,WAAW;CAU7C"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"unconstrained_function_broadcasted_event.d.ts","sourceRoot":"","sources":["../../src/class-registerer/unconstrained_function_broadcasted_event.ts"],"names":[],"mappings":";;AAAA,OAAO,EACL,iCAAiC,EAElC,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAoB,MAAM,mBAAmB,CAAC;AACvE,OAAO,KAAK,EAAE,qBAAqB,EAAE,wCAAwC,EAAE,MAAM,wBAAwB,CAAC;AAC9G,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAI3D,sDAAsD;AACtD,qBAAa,qCAAqC;aAE9B,eAAe,EAAE,EAAE;aACnB,oBAAoB,EAAE,EAAE;aACxB,gCAAgC,EAAE,EAAE;aACpC,+BAA+B,EAAE,KAAK,CAAC,EAAE,EAAE,OAAO,iCAAiC,CAAC;aACpF,6BAA6B,EAAE,MAAM;aACrC,qBAAqB,EAAE,gCAAgC;gBALvD,eAAe,EAAE,EAAE,EACnB,oBAAoB,EAAE,EAAE,EACxB,gCAAgC,EAAE,EAAE,EACpC,+BAA+B,EAAE,KAAK,CAAC,EAAE,EAAE,OAAO,iCAAiC,CAAC,EACpF,6BAA6B,EAAE,MAAM,EACrC,qBAAqB,EAAE,gCAAgC;IAGzE,MAAM,CAAC,uCAAuC,CAAC,GAAG,EAAE,gBAAgB;IAIpE,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,gBAAgB;IAapC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE,GAAG,WAAW;IAmB5C,6BAA6B,IAAI,wCAAwC;CAgB1E;AAED,qBAAa,gCAAiC,YAAW,qBAAqB;IAE1E,qJAAqJ;aACrI,QAAQ,EAAE,gBAAgB;IAC1C,6BAA6B;aACb,YAAY,EAAE,EAAE;IAChC,uBAAuB;aACP,QAAQ,EAAE,MAAM;;IALhC,qJAAqJ;IACrI,QAAQ,EAAE,gBAAgB;IAC1C,6BAA6B;IACb,YAAY,EAAE,EAAE;IAChC,uBAAuB;IACP,QAAQ,EAAE,MAAM;IAGlC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE,GAAG,WAAW;CAS7C"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"contract_instance_deployed_event.d.ts","sourceRoot":"","sources":["../../src/instance-deployer/contract_instance_deployed_event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIrD,uDAAuD;AACvD,qBAAa,6BAA6B;aAEtB,OAAO,EAAE,YAAY;aACrB,OAAO,EAAE,MAAM;aACf,IAAI,EAAE,EAAE;aACR,eAAe,EAAE,EAAE;aACnB,kBAAkB,EAAE,EAAE;aACtB,UAAU,EAAE,UAAU;aACtB,QAAQ,EAAE,YAAY;gBANtB,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,EAAE,EACR,eAAe,EAAE,EAAE,EACnB,kBAAkB,EAAE,EAAE,EACtB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,YAAY;IAGxC,MAAM,CAAC,+BAA+B,CAAC,GAAG,EAAE,UAAU;IAItD,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU;IAsB9B,kBAAkB,IAAI,2BAA2B;CAgBlD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"contract_instance_updated_event.d.ts","sourceRoot":"","sources":["../../src/instance-deployer/contract_instance_updated_event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAIpD,uDAAuD;AACvD,qBAAa,4BAA4B;aAErB,OAAO,EAAE,YAAY;aACrB,mBAAmB,EAAE,EAAE;aACvB,kBAAkB,EAAE,EAAE;aACtB,aAAa,EAAE,MAAM;gBAHrB,OAAO,EAAE,YAAY,EACrB,mBAAmB,EAAE,EAAE,EACvB,kBAAkB,EAAE,EAAE,EACtB,aAAa,EAAE,MAAM;IAGvC,MAAM,CAAC,8BAA8B,CAAC,GAAG,EAAE,SAAS;IAOpD,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,SAAS;IAW7B,wBAAwB,IAAI,iCAAiC;CAQ9D"}
@@ -1,36 +0,0 @@
1
- import { Fr } from '@aztec/foundation/fields';
2
- import { BufferReader } from '@aztec/foundation/serialize';
3
- import { AztecAddress } from '@aztec/stdlib/aztec-address';
4
- import { DEPLOYER_CONTRACT_INSTANCE_UPDATED_TAG, ProtocolContractAddress } from '../protocol_contract_data.js';
5
- /** Event emitted from the ContractInstanceDeployer. */ export class ContractInstanceUpdatedEvent {
6
- address;
7
- prevContractClassId;
8
- newContractClassId;
9
- blockOfChange;
10
- constructor(address, prevContractClassId, newContractClassId, blockOfChange){
11
- this.address = address;
12
- this.prevContractClassId = prevContractClassId;
13
- this.newContractClassId = newContractClassId;
14
- this.blockOfChange = blockOfChange;
15
- }
16
- static isContractInstanceUpdatedEvent(log) {
17
- return log.contractAddress.equals(ProtocolContractAddress.ContractInstanceDeployer) && log.log[0].equals(DEPLOYER_CONTRACT_INSTANCE_UPDATED_TAG);
18
- }
19
- static fromLog(log) {
20
- const bufferWithoutAddressAndTag = log.toBuffer().subarray(64);
21
- const reader = new BufferReader(bufferWithoutAddressAndTag);
22
- const address = reader.readObject(AztecAddress);
23
- const prevContractClassId = reader.readObject(Fr);
24
- const newContractClassId = reader.readObject(Fr);
25
- const blockOfChange = reader.readObject(Fr).toNumber();
26
- return new ContractInstanceUpdatedEvent(address, prevContractClassId, newContractClassId, blockOfChange);
27
- }
28
- toContractInstanceUpdate() {
29
- return {
30
- address: this.address,
31
- prevContractClassId: this.prevContractClassId,
32
- newContractClassId: this.newContractClassId,
33
- blockOfChange: this.blockOfChange
34
- };
35
- }
36
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/instance-deployer/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,cAAc,uCAAuC,CAAC;AACtD,cAAc,sCAAsC,CAAC;AAErD,eAAO,MAAM,gCAAgC,8CAE5C,CAAC;AAIF,wDAAwD;AACxD,wBAAsB,4BAA4B,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAK9E"}
@@ -1,25 +0,0 @@
1
- import { loadContractArtifact } from '@aztec/stdlib/abi';
2
- import { makeProtocolContract } from '../make_protocol_contract.js';
3
- export * from './contract_instance_deployed_event.js';
4
- export * from './contract_instance_updated_event.js';
5
- let protocolContract;
6
- let protocolContractArtifact;
7
- export async function getContractInstanceDeployerArtifact() {
8
- if (!protocolContractArtifact) {
9
- // Cannot assert this import as it's incompatible with browsers
10
- // https://caniuse.com/mdn-javascript_statements_import_import_assertions_type_json
11
- // Use the new "with" syntax once supported by firefox
12
- // https://caniuse.com/mdn-javascript_statements_import_import_attributes_type_json
13
- // In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
14
- const { default: contractInstanceDeployerJson } = await import('../../artifacts/ContractInstanceDeployer.json');
15
- protocolContractArtifact = loadContractArtifact(contractInstanceDeployerJson);
16
- }
17
- return protocolContractArtifact;
18
- }
19
- /** Returns the canonical deployment of the auth registry. */ export async function getCanonicalInstanceDeployer() {
20
- if (!protocolContract) {
21
- const contractInstanceDeployerArtifact = await getContractInstanceDeployerArtifact();
22
- protocolContract = await makeProtocolContract('ContractInstanceDeployer', contractInstanceDeployerArtifact);
23
- }
24
- return protocolContract;
25
- }
@@ -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,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(),
13
- hashInputs: async (i: Buffer[]) => (await poseidon2Hash(i)).toBuffer(),
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,33 +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_class_registered_event.js';
7
- export * from './private_function_broadcasted_event.js';
8
- export * from './unconstrained_function_broadcasted_event.js';
9
-
10
- let protocolContract: ProtocolContract;
11
- let protocolContractArtifact: ContractArtifact;
12
-
13
- export async function getContractClassRegistererArtifact(): Promise<ContractArtifact> {
14
- if (!protocolContractArtifact) {
15
- // Cannot assert this import as it's incompatible with browsers
16
- // https://caniuse.com/mdn-javascript_statements_import_import_assertions_type_json
17
- // Use the new "with" syntax once supported by firefox
18
- // https://caniuse.com/mdn-javascript_statements_import_import_attributes_type_json
19
- // In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
20
- const { default: contractClassRegistererJson } = await import('../../artifacts/ContractClassRegisterer.json');
21
- protocolContractArtifact = loadContractArtifact(contractClassRegistererJson);
22
- }
23
- return protocolContractArtifact;
24
- }
25
-
26
- /** Returns the canonical deployment of the auth registry. */
27
- export async function getCanonicalClassRegisterer(): Promise<ProtocolContract> {
28
- if (!protocolContract) {
29
- const contractClassRegistererArtifact = await getContractClassRegistererArtifact();
30
- protocolContract = await makeProtocolContract('ContractClassRegisterer', contractClassRegistererArtifact);
31
- }
32
- return protocolContract;
33
- }
@@ -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
- }