@aztec/protocol-contracts 0.0.0-test.0
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 +7 -0
- package/artifacts/AuthRegistry.d.json.ts +5 -0
- package/artifacts/AuthRegistry.json +2725 -0
- package/artifacts/ContractClassRegisterer.d.json.ts +5 -0
- package/artifacts/ContractClassRegisterer.json +7219 -0
- package/artifacts/ContractInstanceDeployer.d.json.ts +5 -0
- package/artifacts/ContractInstanceDeployer.json +2984 -0
- package/artifacts/FeeJuice.d.json.ts +5 -0
- package/artifacts/FeeJuice.json +4281 -0
- package/artifacts/MultiCallEntrypoint.d.json.ts +5 -0
- package/artifacts/MultiCallEntrypoint.json +2005 -0
- package/artifacts/Router.d.json.ts +5 -0
- package/artifacts/Router.json +3798 -0
- package/dest/auth-registry/index.d.ts +5 -0
- package/dest/auth-registry/index.d.ts.map +1 -0
- package/dest/auth-registry/index.js +13 -0
- package/dest/auth-registry/lazy.d.ts +6 -0
- package/dest/auth-registry/lazy.d.ts.map +1 -0
- package/dest/auth-registry/lazy.js +23 -0
- package/dest/build_protocol_contract_tree.d.ts +10 -0
- package/dest/build_protocol_contract_tree.d.ts.map +1 -0
- package/dest/build_protocol_contract_tree.js +20 -0
- package/dest/class-registerer/contract_class_registered_event.d.ts +18 -0
- package/dest/class-registerer/contract_class_registered_event.d.ts.map +1 -0
- package/dest/class-registerer/contract_class_registered_event.js +63 -0
- package/dest/class-registerer/index.d.ts +8 -0
- package/dest/class-registerer/index.d.ts.map +1 -0
- package/dest/class-registerer/index.js +17 -0
- package/dest/class-registerer/lazy.d.ts +9 -0
- package/dest/class-registerer/lazy.d.ts.map +1 -0
- package/dest/class-registerer/lazy.js +26 -0
- package/dest/class-registerer/private_function_broadcasted_event.d.ts +46 -0
- package/dest/class-registerer/private_function_broadcasted_event.d.ts.map +1 -0
- package/dest/class-registerer/private_function_broadcasted_event.js +85 -0
- package/dest/class-registerer/unconstrained_function_broadcasted_event.d.ts +40 -0
- package/dest/class-registerer/unconstrained_function_broadcasted_event.d.ts.map +1 -0
- package/dest/class-registerer/unconstrained_function_broadcasted_event.js +81 -0
- package/dest/fee-juice/index.d.ts +15 -0
- package/dest/fee-juice/index.d.ts.map +1 -0
- package/dest/fee-juice/index.js +26 -0
- package/dest/fee-juice/lazy.d.ts +6 -0
- package/dest/fee-juice/lazy.d.ts.map +1 -0
- package/dest/fee-juice/lazy.js +23 -0
- package/dest/index.d.ts +4 -0
- package/dest/index.d.ts.map +1 -0
- package/dest/index.js +3 -0
- package/dest/instance-deployer/contract_instance_deployed_event.d.ts +20 -0
- package/dest/instance-deployer/contract_instance_deployed_event.d.ts.map +1 -0
- package/dest/instance-deployer/contract_instance_deployed_event.js +53 -0
- package/dest/instance-deployer/contract_instance_updated_event.d.ts +16 -0
- package/dest/instance-deployer/contract_instance_updated_event.d.ts.map +1 -0
- package/dest/instance-deployer/contract_instance_updated_event.js +36 -0
- package/dest/instance-deployer/index.d.ts +7 -0
- package/dest/instance-deployer/index.d.ts.map +1 -0
- package/dest/instance-deployer/index.js +15 -0
- package/dest/instance-deployer/lazy.d.ts +8 -0
- package/dest/instance-deployer/lazy.d.ts.map +1 -0
- package/dest/instance-deployer/lazy.js +25 -0
- package/dest/make_protocol_contract.d.ts +9 -0
- package/dest/make_protocol_contract.d.ts.map +1 -0
- package/dest/make_protocol_contract.js +23 -0
- package/dest/multi-call-entrypoint/index.d.ts +5 -0
- package/dest/multi-call-entrypoint/index.d.ts.map +1 -0
- package/dest/multi-call-entrypoint/index.js +13 -0
- package/dest/multi-call-entrypoint/lazy.d.ts +6 -0
- package/dest/multi-call-entrypoint/lazy.d.ts.map +1 -0
- package/dest/multi-call-entrypoint/lazy.js +23 -0
- package/dest/protocol_contract.d.ts +17 -0
- package/dest/protocol_contract.d.ts.map +1 -0
- package/dest/protocol_contract.js +4 -0
- package/dest/protocol_contract_data.d.ts +21 -0
- package/dest/protocol_contract_data.d.ts.map +1 -0
- package/dest/protocol_contract_data.js +41 -0
- package/dest/protocol_contract_tree.d.ts +7 -0
- package/dest/protocol_contract_tree.d.ts.map +1 -0
- package/dest/protocol_contract_tree.js +34 -0
- package/dest/provider/bundle.d.ts +9 -0
- package/dest/provider/bundle.d.ts.map +1 -0
- package/dest/provider/bundle.js +20 -0
- package/dest/provider/lazy.d.ts +7 -0
- package/dest/provider/lazy.d.ts.map +1 -0
- package/dest/provider/lazy.js +26 -0
- package/dest/provider/protocol_contracts_provider.d.ts +7 -0
- package/dest/provider/protocol_contracts_provider.d.ts.map +1 -0
- package/dest/provider/protocol_contracts_provider.js +1 -0
- package/dest/router/index.d.ts +5 -0
- package/dest/router/index.d.ts.map +1 -0
- package/dest/router/index.js +13 -0
- package/dest/router/lazy.d.ts +6 -0
- package/dest/router/lazy.d.ts.map +1 -0
- package/dest/router/lazy.js +23 -0
- package/dest/scripts/cleanup_artifacts.js +16 -0
- package/dest/scripts/generate_data.js +173 -0
- package/dest/tests/fixtures.d.ts +8 -0
- package/dest/tests/fixtures.d.ts.map +1 -0
- package/dest/tests/fixtures.js +26 -0
- package/package.json +103 -0
- package/src/auth-registry/index.ts +18 -0
- package/src/auth-registry/lazy.ts +29 -0
- package/src/build_protocol_contract_tree.ts +29 -0
- package/src/class-registerer/contract_class_registered_event.ts +83 -0
- package/src/class-registerer/index.ts +25 -0
- package/src/class-registerer/lazy.ts +33 -0
- package/src/class-registerer/private_function_broadcasted_event.ts +105 -0
- package/src/class-registerer/unconstrained_function_broadcasted_event.ts +99 -0
- package/src/fee-juice/index.ts +37 -0
- package/src/fee-juice/lazy.ts +29 -0
- package/src/index.ts +3 -0
- package/src/instance-deployer/contract_instance_deployed_event.ts +64 -0
- package/src/instance-deployer/contract_instance_updated_event.ts +44 -0
- package/src/instance-deployer/index.ts +23 -0
- package/src/instance-deployer/lazy.ts +32 -0
- package/src/make_protocol_contract.ts +26 -0
- package/src/multi-call-entrypoint/index.ts +18 -0
- package/src/multi-call-entrypoint/lazy.ts +29 -0
- package/src/protocol_contract.ts +23 -0
- package/src/protocol_contract_data.ts +63 -0
- package/src/protocol_contract_tree.ts +44 -0
- package/src/provider/bundle.ts +27 -0
- package/src/provider/lazy.ts +30 -0
- package/src/provider/protocol_contracts_provider.ts +7 -0
- package/src/router/index.ts +18 -0
- package/src/router/lazy.ts +29 -0
- package/src/tests/fixtures.ts +31 -0
package/dest/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
4
|
+
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
5
|
+
import type { PrivateLog } from '@aztec/stdlib/logs';
|
|
6
|
+
/** Event emitted from the ContractInstanceDeployer. */
|
|
7
|
+
export declare class ContractInstanceDeployedEvent {
|
|
8
|
+
readonly address: AztecAddress;
|
|
9
|
+
readonly version: number;
|
|
10
|
+
readonly salt: Fr;
|
|
11
|
+
readonly contractClassId: Fr;
|
|
12
|
+
readonly initializationHash: Fr;
|
|
13
|
+
readonly publicKeys: PublicKeys;
|
|
14
|
+
readonly deployer: AztecAddress;
|
|
15
|
+
constructor(address: AztecAddress, version: number, salt: Fr, contractClassId: Fr, initializationHash: Fr, publicKeys: PublicKeys, deployer: AztecAddress);
|
|
16
|
+
static isContractInstanceDeployedEvent(log: PrivateLog): boolean;
|
|
17
|
+
static fromLog(log: PrivateLog): ContractInstanceDeployedEvent;
|
|
18
|
+
toContractInstance(): ContractInstanceWithAddress;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=contract_instance_deployed_event.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import { BufferReader } from '@aztec/foundation/serialize';
|
|
3
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
+
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
5
|
+
import { DEPLOYER_CONTRACT_INSTANCE_DEPLOYED_TAG } from '../protocol_contract_data.js';
|
|
6
|
+
/** Event emitted from the ContractInstanceDeployer. */ export class ContractInstanceDeployedEvent {
|
|
7
|
+
address;
|
|
8
|
+
version;
|
|
9
|
+
salt;
|
|
10
|
+
contractClassId;
|
|
11
|
+
initializationHash;
|
|
12
|
+
publicKeys;
|
|
13
|
+
deployer;
|
|
14
|
+
constructor(address, version, salt, contractClassId, initializationHash, publicKeys, deployer){
|
|
15
|
+
this.address = address;
|
|
16
|
+
this.version = version;
|
|
17
|
+
this.salt = salt;
|
|
18
|
+
this.contractClassId = contractClassId;
|
|
19
|
+
this.initializationHash = initializationHash;
|
|
20
|
+
this.publicKeys = publicKeys;
|
|
21
|
+
this.deployer = deployer;
|
|
22
|
+
}
|
|
23
|
+
static isContractInstanceDeployedEvent(log) {
|
|
24
|
+
return log.fields[0].equals(DEPLOYER_CONTRACT_INSTANCE_DEPLOYED_TAG);
|
|
25
|
+
}
|
|
26
|
+
static fromLog(log) {
|
|
27
|
+
const bufferWithoutTag = log.toBuffer().subarray(32);
|
|
28
|
+
const reader = new BufferReader(bufferWithoutTag);
|
|
29
|
+
const address = reader.readObject(AztecAddress);
|
|
30
|
+
const version = reader.readObject(Fr).toNumber();
|
|
31
|
+
const salt = reader.readObject(Fr);
|
|
32
|
+
const contractClassId = reader.readObject(Fr);
|
|
33
|
+
const initializationHash = reader.readObject(Fr);
|
|
34
|
+
const publicKeys = reader.readObject(PublicKeys);
|
|
35
|
+
const deployer = reader.readObject(AztecAddress);
|
|
36
|
+
return new ContractInstanceDeployedEvent(address, version, salt, contractClassId, initializationHash, publicKeys, deployer);
|
|
37
|
+
}
|
|
38
|
+
toContractInstance() {
|
|
39
|
+
if (this.version !== 1) {
|
|
40
|
+
throw new Error(`Unexpected contract instance version ${this.version}`);
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
address: this.address,
|
|
44
|
+
version: this.version,
|
|
45
|
+
currentContractClassId: this.contractClassId,
|
|
46
|
+
originalContractClassId: this.contractClassId,
|
|
47
|
+
initializationHash: this.initializationHash,
|
|
48
|
+
publicKeys: this.publicKeys,
|
|
49
|
+
salt: this.salt,
|
|
50
|
+
deployer: this.deployer
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
import type { ContractInstanceUpdateWithAddress } from '@aztec/stdlib/contract';
|
|
4
|
+
import type { PublicLog } from '@aztec/stdlib/logs';
|
|
5
|
+
/** Event emitted from the ContractInstanceDeployer. */
|
|
6
|
+
export declare class ContractInstanceUpdatedEvent {
|
|
7
|
+
readonly address: AztecAddress;
|
|
8
|
+
readonly prevContractClassId: Fr;
|
|
9
|
+
readonly newContractClassId: Fr;
|
|
10
|
+
readonly blockOfChange: number;
|
|
11
|
+
constructor(address: AztecAddress, prevContractClassId: Fr, newContractClassId: Fr, blockOfChange: number);
|
|
12
|
+
static isContractInstanceUpdatedEvent(log: PublicLog): boolean;
|
|
13
|
+
static fromLog(log: PublicLog): ContractInstanceUpdatedEvent;
|
|
14
|
+
toContractInstanceUpdate(): ContractInstanceUpdateWithAddress;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=contract_instance_updated_event.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ProtocolContract } from '../protocol_contract.js';
|
|
2
|
+
export * from './contract_instance_deployed_event.js';
|
|
3
|
+
export * from './contract_instance_updated_event.js';
|
|
4
|
+
export declare const ContractInstanceDeployerArtifact: import("@aztec/stdlib/abi").ContractArtifact;
|
|
5
|
+
/** Returns the canonical deployment of the contract. */
|
|
6
|
+
export declare function getCanonicalInstanceDeployer(): Promise<ProtocolContract>;
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
+
import ContractInstanceDeployerJson from '../../artifacts/ContractInstanceDeployer.json' assert {
|
|
3
|
+
type: 'json'
|
|
4
|
+
};
|
|
5
|
+
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
6
|
+
export * from './contract_instance_deployed_event.js';
|
|
7
|
+
export * from './contract_instance_updated_event.js';
|
|
8
|
+
export const ContractInstanceDeployerArtifact = loadContractArtifact(ContractInstanceDeployerJson);
|
|
9
|
+
let protocolContract;
|
|
10
|
+
/** Returns the canonical deployment of the contract. */ export async function getCanonicalInstanceDeployer() {
|
|
11
|
+
if (!protocolContract) {
|
|
12
|
+
protocolContract = await makeProtocolContract('ContractInstanceDeployer', ContractInstanceDeployerArtifact);
|
|
13
|
+
}
|
|
14
|
+
return protocolContract;
|
|
15
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
+
import type { ProtocolContract } from '../protocol_contract.js';
|
|
3
|
+
export * from './contract_instance_deployed_event.js';
|
|
4
|
+
export * from './contract_instance_updated_event.js';
|
|
5
|
+
export declare function getContractInstanceDeployerArtifact(): Promise<ContractArtifact>;
|
|
6
|
+
/** Returns the canonical deployment of the auth registry. */
|
|
7
|
+
export declare function getCanonicalInstanceDeployer(): Promise<ProtocolContract>;
|
|
8
|
+
//# sourceMappingURL=lazy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/instance-deployer/lazy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAwB,MAAM,mBAAmB,CAAC;AAGhF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,cAAc,uCAAuC,CAAC;AACtD,cAAc,sCAAsC,CAAC;AAKrD,wBAAsB,mCAAmC,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAWrF;AAED,6DAA6D;AAC7D,wBAAsB,4BAA4B,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAM9E"}
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
+
import type { ProtocolContract } from './protocol_contract.js';
|
|
3
|
+
import { type ProtocolContractName } from './protocol_contract_data.js';
|
|
4
|
+
/**
|
|
5
|
+
* Returns the canonical deployment given its name and artifact.
|
|
6
|
+
* To be used internally within the protocol-contracts package.
|
|
7
|
+
*/
|
|
8
|
+
export declare function makeProtocolContract(name: ProtocolContractName, artifact: ContractArtifact): Promise<ProtocolContract>;
|
|
9
|
+
//# sourceMappingURL=make_protocol_contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"make_protocol_contract.d.ts","sourceRoot":"","sources":["../src/make_protocol_contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAA2B,KAAK,oBAAoB,EAAwB,MAAM,6BAA6B,CAAC;AAEvH;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,oBAAoB,EAC1B,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,gBAAgB,CAAC,CAY3B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { getContractClassFromArtifact, getContractInstanceFromDeployParams } from '@aztec/stdlib/contract';
|
|
2
|
+
import { ProtocolContractAddress, ProtocolContractSalt } from './protocol_contract_data.js';
|
|
3
|
+
/**
|
|
4
|
+
* Returns the canonical deployment given its name and artifact.
|
|
5
|
+
* To be used internally within the protocol-contracts package.
|
|
6
|
+
*/ export async function makeProtocolContract(name, artifact) {
|
|
7
|
+
const address = ProtocolContractAddress[name];
|
|
8
|
+
const salt = ProtocolContractSalt[name];
|
|
9
|
+
// TODO(@spalladino): This computes the contract class from the artifact twice.
|
|
10
|
+
const contractClass = await getContractClassFromArtifact(artifact);
|
|
11
|
+
const instance = await getContractInstanceFromDeployParams(artifact, {
|
|
12
|
+
salt
|
|
13
|
+
});
|
|
14
|
+
return {
|
|
15
|
+
instance: {
|
|
16
|
+
...instance,
|
|
17
|
+
address
|
|
18
|
+
},
|
|
19
|
+
contractClass,
|
|
20
|
+
artifact,
|
|
21
|
+
address
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ProtocolContract } from '../protocol_contract.js';
|
|
2
|
+
export declare const MultiCallEntrypointArtifact: import("@aztec/stdlib/abi").ContractArtifact;
|
|
3
|
+
/** Returns the canonical deployment of the contract. */
|
|
4
|
+
export declare function getCanonicalMultiCallEntrypoint(): Promise<ProtocolContract>;
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/multi-call-entrypoint/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,eAAO,MAAM,2BAA2B,8CAAwE,CAAC;AAIjH,wDAAwD;AACxD,wBAAsB,+BAA+B,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAKjF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
+
import MultiCallEntrypointJson from '../../artifacts/MultiCallEntrypoint.json' assert {
|
|
3
|
+
type: 'json'
|
|
4
|
+
};
|
|
5
|
+
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
6
|
+
export const MultiCallEntrypointArtifact = loadContractArtifact(MultiCallEntrypointJson);
|
|
7
|
+
let protocolContract;
|
|
8
|
+
/** Returns the canonical deployment of the contract. */ export async function getCanonicalMultiCallEntrypoint() {
|
|
9
|
+
if (!protocolContract) {
|
|
10
|
+
protocolContract = await makeProtocolContract('MultiCallEntrypoint', MultiCallEntrypointArtifact);
|
|
11
|
+
}
|
|
12
|
+
return protocolContract;
|
|
13
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
+
import type { ProtocolContract } from '../protocol_contract.js';
|
|
3
|
+
export declare function getMultiCallEntrypointArtifact(): Promise<ContractArtifact>;
|
|
4
|
+
/** Returns the canonical deployment of the auth registry. */
|
|
5
|
+
export declare function getCanonicalMultiCallEntrypoint(): Promise<ProtocolContract>;
|
|
6
|
+
//# sourceMappingURL=lazy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/multi-call-entrypoint/lazy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAwB,MAAM,mBAAmB,CAAC;AAGhF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAKhE,wBAAsB,8BAA8B,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAWhF;AAED,6DAA6D;AAC7D,wBAAsB,+BAA+B,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAMjF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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 getMultiCallEntrypointArtifact() {
|
|
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: multiCallEntrypointJson } = await import('../../artifacts/MultiCallEntrypoint.json');
|
|
13
|
+
protocolContractArtifact = loadContractArtifact(multiCallEntrypointJson);
|
|
14
|
+
}
|
|
15
|
+
return protocolContractArtifact;
|
|
16
|
+
}
|
|
17
|
+
/** Returns the canonical deployment of the auth registry. */ export async function getCanonicalMultiCallEntrypoint() {
|
|
18
|
+
if (!protocolContract) {
|
|
19
|
+
const multiCallEntrypointArtifact = await getMultiCallEntrypointArtifact();
|
|
20
|
+
protocolContract = await makeProtocolContract('MultiCallEntrypoint', multiCallEntrypointArtifact);
|
|
21
|
+
}
|
|
22
|
+
return protocolContract;
|
|
23
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
import type { ContractClassIdPreimage, ContractClassWithId, ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
4
|
+
/** Represents a canonical contract in the protocol. */
|
|
5
|
+
export interface ProtocolContract {
|
|
6
|
+
/** Canonical deployed instance. */
|
|
7
|
+
instance: ContractInstanceWithAddress;
|
|
8
|
+
/** Contract class of this contract. */
|
|
9
|
+
contractClass: ContractClassWithId & ContractClassIdPreimage;
|
|
10
|
+
/** Complete contract artifact. */
|
|
11
|
+
artifact: ContractArtifact;
|
|
12
|
+
/** Deployment address for the canonical instance. */
|
|
13
|
+
address: AztecAddress;
|
|
14
|
+
}
|
|
15
|
+
export declare function isProtocolContract(address: AztecAddress): boolean;
|
|
16
|
+
export { type ProtocolContractsProvider } from './provider/protocol_contracts_provider.js';
|
|
17
|
+
//# sourceMappingURL=protocol_contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol_contract.d.ts","sourceRoot":"","sources":["../src/protocol_contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAIxH,uDAAuD;AACvD,MAAM,WAAW,gBAAgB;IAC/B,mCAAmC;IACnC,QAAQ,EAAE,2BAA2B,CAAC;IACtC,uCAAuC;IACvC,aAAa,EAAE,mBAAmB,GAAG,uBAAuB,CAAC;IAC7D,kCAAkC;IAClC,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,sDAAsD;IACtD,OAAO,EAAE,YAAY,CAAC;CACvB;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,YAAY,WAEvD;AAED,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,2CAA2C,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
export declare const protocolContractNames: readonly ["AuthRegistry", "ContractInstanceDeployer", "ContractClassRegisterer", "MultiCallEntrypoint", "FeeJuice", "Router"];
|
|
4
|
+
export type ProtocolContractName = typeof protocolContractNames[number];
|
|
5
|
+
export declare const ProtocolContractSalt: Record<ProtocolContractName, Fr>;
|
|
6
|
+
export declare const ProtocolContractAddress: Record<ProtocolContractName, AztecAddress>;
|
|
7
|
+
export declare const ProtocolContractLeaves: {
|
|
8
|
+
AuthRegistry: Fr;
|
|
9
|
+
ContractInstanceDeployer: Fr;
|
|
10
|
+
ContractClassRegisterer: Fr;
|
|
11
|
+
MultiCallEntrypoint: Fr;
|
|
12
|
+
FeeJuice: Fr;
|
|
13
|
+
Router: Fr;
|
|
14
|
+
};
|
|
15
|
+
export declare const protocolContractTreeRoot: Fr;
|
|
16
|
+
export declare const REGISTERER_CONTRACT_CLASS_REGISTERED_TAG: Fr;
|
|
17
|
+
export declare const REGISTERER_PRIVATE_FUNCTION_BROADCASTED_TAG: Fr;
|
|
18
|
+
export declare const REGISTERER_UNCONSTRAINED_FUNCTION_BROADCASTED_TAG: Fr;
|
|
19
|
+
export declare const DEPLOYER_CONTRACT_INSTANCE_DEPLOYED_TAG: Fr;
|
|
20
|
+
export declare const DEPLOYER_CONTRACT_INSTANCE_UPDATED_TAG: Fr;
|
|
21
|
+
//# sourceMappingURL=protocol_contract_data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol_contract_data.d.ts","sourceRoot":"","sources":["../src/protocol_contract_data.ts"],"names":[],"mappings":"AAEI,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAG3D,eAAO,MAAM,qBAAqB,+HAOxB,CAAC;AAEX,MAAM,MAAM,oBAAoB,GAAG,OAAO,qBAAqB,CAAC,MAAM,CAAC,CAAC;AAIxE,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,oBAAoB,EAAE,EAAE,CAOjE,CAAC;AAIF,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,oBAAoB,EAAE,YAAY,CAO9E,CAAC;AAIF,eAAO,MAAM,sBAAsB;;;;;;;CAOlC,CAAC;AAIF,eAAO,MAAM,wBAAwB,IAAyF,CAAC;AAIjI,eAAO,MAAM,wCAAwC,IAAyF,CAAC;AAC/I,eAAO,MAAM,2CAA2C,IAAyF,CAAC;AAClJ,eAAO,MAAM,iDAAiD,IAAyF,CAAC;AACxJ,eAAO,MAAM,uCAAuC,IAAyF,CAAC;AAC7I,eAAO,MAAM,sCAAsC,IAA+E,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// GENERATED FILE - DO NOT EDIT. RUN `yarn generate` or `yarn generate:data`
|
|
2
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
+
export const protocolContractNames = [
|
|
5
|
+
'AuthRegistry',
|
|
6
|
+
'ContractInstanceDeployer',
|
|
7
|
+
'ContractClassRegisterer',
|
|
8
|
+
'MultiCallEntrypoint',
|
|
9
|
+
'FeeJuice',
|
|
10
|
+
'Router'
|
|
11
|
+
];
|
|
12
|
+
export const ProtocolContractSalt = {
|
|
13
|
+
AuthRegistry: new Fr(1),
|
|
14
|
+
ContractInstanceDeployer: new Fr(1),
|
|
15
|
+
ContractClassRegisterer: new Fr(1),
|
|
16
|
+
MultiCallEntrypoint: new Fr(1),
|
|
17
|
+
FeeJuice: new Fr(1),
|
|
18
|
+
Router: new Fr(1)
|
|
19
|
+
};
|
|
20
|
+
export const ProtocolContractAddress = {
|
|
21
|
+
AuthRegistry: AztecAddress.fromBigInt(1n),
|
|
22
|
+
ContractInstanceDeployer: AztecAddress.fromBigInt(2n),
|
|
23
|
+
ContractClassRegisterer: AztecAddress.fromBigInt(3n),
|
|
24
|
+
MultiCallEntrypoint: AztecAddress.fromBigInt(4n),
|
|
25
|
+
FeeJuice: AztecAddress.fromBigInt(5n),
|
|
26
|
+
Router: AztecAddress.fromBigInt(6n)
|
|
27
|
+
};
|
|
28
|
+
export const ProtocolContractLeaves = {
|
|
29
|
+
AuthRegistry: Fr.fromHexString('0x1dc70bdab08ce08aef9f6ddcc8fd54fb91fdb72a6433c2dd6b69b33cf1fb87a2'),
|
|
30
|
+
ContractInstanceDeployer: Fr.fromHexString('0x005d6d6addbbda03dcad6fc9a3c3b7de457c30990ec2acaaf74f139a3a506e06'),
|
|
31
|
+
ContractClassRegisterer: Fr.fromHexString('0x110ef3d93e27fd61a5a56e479a9f9cbdb099d2d968cdcc16c01d2bdfd6cb0ddd'),
|
|
32
|
+
MultiCallEntrypoint: Fr.fromHexString('0x121f834b03a64d38463ae18ddebceeb4dce8192cc289052e175ad754a883a7fe'),
|
|
33
|
+
FeeJuice: Fr.fromHexString('0x141a566ade0bef915526762c2c2fb19b2a756ad7c82e83fde6dbf86848ecc131'),
|
|
34
|
+
Router: Fr.fromHexString('0x2c20bd328fbd33c01fbcda9e6299c31da5d5b29ea30e9c7b9d631618b839bca9')
|
|
35
|
+
};
|
|
36
|
+
export const protocolContractTreeRoot = Fr.fromHexString('0x093cc9324e5a7b44883f515ac490e7294ef8cb1e6d2d8c503255b1b3a9409262');
|
|
37
|
+
export const REGISTERER_CONTRACT_CLASS_REGISTERED_TAG = Fr.fromHexString('0x20cd27645f65c15a38720ca984aef936592f3938a705db706d068ad13fc58ae9');
|
|
38
|
+
export const REGISTERER_PRIVATE_FUNCTION_BROADCASTED_TAG = Fr.fromHexString('0x0abf338154e355442d9916d630da0491036d5a7b23c42b477c1395ba3bf9b42d');
|
|
39
|
+
export const REGISTERER_UNCONSTRAINED_FUNCTION_BROADCASTED_TAG = Fr.fromHexString('0x27774539896271d6dbe0c1de45ddc44709d1e8d9a9fb686ca3c105d87c417bb8');
|
|
40
|
+
export const DEPLOYER_CONTRACT_INSTANCE_DEPLOYED_TAG = Fr.fromHexString('0x2ec28b91a5f838506d6042915005ff55cf7a0a5f889a83b11faed33a31b486f2');
|
|
41
|
+
export const DEPLOYER_CONTRACT_INSTANCE_UPDATED_TAG = new Fr(1534834688047131268740281708431107902615560100979874281215533519862n);
|
|
@@ -0,0 +1,7 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
+
import type { ProtocolContract } from '../protocol_contract.js';
|
|
3
|
+
import type { ProtocolContractName } from '../protocol_contract_data.js';
|
|
4
|
+
import type { ProtocolContractsProvider } from './protocol_contracts_provider.js';
|
|
5
|
+
export declare const ProtocolContractArtifact: Record<ProtocolContractName, ContractArtifact>;
|
|
6
|
+
export declare class BundledProtocolContractsProvider implements ProtocolContractsProvider {
|
|
7
|
+
getProtocolContractArtifact(name: ProtocolContractName): Promise<ProtocolContract>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=bundle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../src/provider/bundle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAQ1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEzE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAElF,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,oBAAoB,EAAE,gBAAgB,CAOnF,CAAC;AAEF,qBAAa,gCAAiC,YAAW,yBAAyB;IAChF,2BAA2B,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAGnF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AuthRegistryArtifact } from '../auth-registry/index.js';
|
|
2
|
+
import { ContractClassRegistererArtifact } from '../class-registerer/index.js';
|
|
3
|
+
import { FeeJuiceArtifact } from '../fee-juice/index.js';
|
|
4
|
+
import { ContractInstanceDeployerArtifact } from '../instance-deployer/index.js';
|
|
5
|
+
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
6
|
+
import { MultiCallEntrypointArtifact } from '../multi-call-entrypoint/index.js';
|
|
7
|
+
import { RouterArtifact } from '../router/index.js';
|
|
8
|
+
export const ProtocolContractArtifact = {
|
|
9
|
+
AuthRegistry: AuthRegistryArtifact,
|
|
10
|
+
ContractInstanceDeployer: ContractInstanceDeployerArtifact,
|
|
11
|
+
ContractClassRegisterer: ContractClassRegistererArtifact,
|
|
12
|
+
MultiCallEntrypoint: MultiCallEntrypointArtifact,
|
|
13
|
+
FeeJuice: FeeJuiceArtifact,
|
|
14
|
+
Router: RouterArtifact
|
|
15
|
+
};
|
|
16
|
+
export class BundledProtocolContractsProvider {
|
|
17
|
+
getProtocolContractArtifact(name) {
|
|
18
|
+
return makeProtocolContract(name, ProtocolContractArtifact[name]);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ProtocolContract } from '../protocol_contract.js';
|
|
2
|
+
import type { ProtocolContractName } from '../protocol_contract_data.js';
|
|
3
|
+
import type { ProtocolContractsProvider } from './protocol_contracts_provider.js';
|
|
4
|
+
export declare class LazyProtocolContractsProvider implements ProtocolContractsProvider {
|
|
5
|
+
getProtocolContractArtifact(name: ProtocolContractName): Promise<ProtocolContract>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=lazy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/provider/lazy.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEzE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAElF,qBAAa,6BAA8B,YAAW,yBAAyB;IAC7E,2BAA2B,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAkBnF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { getCanonicalAuthRegistry } from '../auth-registry/lazy.js';
|
|
2
|
+
import { getCanonicalClassRegisterer } from '../class-registerer/lazy.js';
|
|
3
|
+
import { getCanonicalFeeJuice } from '../fee-juice/lazy.js';
|
|
4
|
+
import { getCanonicalInstanceDeployer } from '../instance-deployer/lazy.js';
|
|
5
|
+
import { getCanonicalMultiCallEntrypoint } from '../multi-call-entrypoint/lazy.js';
|
|
6
|
+
import { getCanonicalRouter } from '../router/lazy.js';
|
|
7
|
+
export class LazyProtocolContractsProvider {
|
|
8
|
+
getProtocolContractArtifact(name) {
|
|
9
|
+
switch(name){
|
|
10
|
+
case 'AuthRegistry':
|
|
11
|
+
return getCanonicalAuthRegistry();
|
|
12
|
+
case 'ContractInstanceDeployer':
|
|
13
|
+
return getCanonicalInstanceDeployer();
|
|
14
|
+
case 'ContractClassRegisterer':
|
|
15
|
+
return getCanonicalClassRegisterer();
|
|
16
|
+
case 'MultiCallEntrypoint':
|
|
17
|
+
return getCanonicalMultiCallEntrypoint();
|
|
18
|
+
case 'FeeJuice':
|
|
19
|
+
return getCanonicalFeeJuice();
|
|
20
|
+
case 'Router':
|
|
21
|
+
return getCanonicalRouter();
|
|
22
|
+
default:
|
|
23
|
+
throw new Error(`Unknown protocol contract name: ${name}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ProtocolContract } from '../protocol_contract.js';
|
|
2
|
+
import type { ProtocolContractName } from '../protocol_contract_data.js';
|
|
3
|
+
/** Returns the canonical deployment of a given artifact. */
|
|
4
|
+
export interface ProtocolContractsProvider {
|
|
5
|
+
getProtocolContractArtifact(name: ProtocolContractName): Promise<ProtocolContract>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=protocol_contracts_provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol_contracts_provider.d.ts","sourceRoot":"","sources":["../../src/provider/protocol_contracts_provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEzE,4DAA4D;AAC5D,MAAM,WAAW,yBAAyB;IACxC,2BAA2B,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACpF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/** Returns the canonical deployment of a given artifact. */ export { };
|
|
@@ -0,0 +1,5 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
+
import RouterJson from '../../artifacts/Router.json' assert {
|
|
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
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
}
|