@aztec/protocol-contracts 0.41.0 → 0.43.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/dest/artifacts/AuthRegistry.json +1 -0
- package/dest/artifacts/ContractClassRegisterer.json +1 -1
- package/dest/artifacts/ContractInstanceDeployer.json +1 -1
- package/dest/artifacts/GasToken.json +1 -1
- package/dest/artifacts/KeyRegistry.json +1 -1
- package/dest/artifacts/MultiCallEntrypoint.json +1 -1
- package/dest/auth-registry/artifact.d.ts +2 -0
- package/dest/auth-registry/artifact.d.ts.map +1 -0
- package/dest/auth-registry/artifact.js +4 -0
- package/dest/auth-registry/index.d.ts +7 -0
- package/dest/auth-registry/index.d.ts.map +1 -0
- package/dest/auth-registry/index.js +16 -0
- package/dest/class-registerer/index.d.ts +2 -3
- package/dest/class-registerer/index.d.ts.map +1 -1
- package/dest/class-registerer/index.js +7 -9
- package/dest/gas-token/index.d.ts +5 -3
- package/dest/gas-token/index.d.ts.map +1 -1
- package/dest/gas-token/index.js +10 -6
- package/dest/instance-deployer/index.js +2 -2
- package/dest/protocol_contract.d.ts +2 -2
- package/dest/protocol_contract.d.ts.map +1 -1
- package/dest/protocol_contract.js +1 -1
- package/package.json +4 -4
- package/src/artifacts/AuthRegistry.json +1 -0
- package/src/artifacts/ContractClassRegisterer.json +1 -1
- package/src/artifacts/ContractInstanceDeployer.json +1 -1
- package/src/artifacts/GasToken.json +1 -1
- package/src/artifacts/KeyRegistry.json +1 -1
- package/src/artifacts/MultiCallEntrypoint.json +1 -1
- package/src/auth-registry/artifact.ts +6 -0
- package/src/auth-registry/index.ts +22 -0
- package/src/class-registerer/index.ts +9 -11
- package/src/gas-token/index.ts +12 -6
- package/src/instance-deployer/index.ts +1 -1
- package/src/protocol_contract.ts +2 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { loadContractArtifact } from '@aztec/types/abi';
|
|
2
|
+
import { type NoirCompiledContract } from '@aztec/types/noir';
|
|
3
|
+
|
|
4
|
+
import AuthRegistryJson from '../artifacts/AuthRegistry.json' assert { type: 'json' };
|
|
5
|
+
|
|
6
|
+
export const AuthRegistryArtifact = loadContractArtifact(AuthRegistryJson as NoirCompiledContract);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AztecAddress, CANONICAL_AUTH_REGISTRY_ADDRESS } from '@aztec/circuits.js';
|
|
2
|
+
|
|
3
|
+
import { type ProtocolContract, getCanonicalProtocolContract } from '../protocol_contract.js';
|
|
4
|
+
import { AuthRegistryArtifact } from './artifact.js';
|
|
5
|
+
|
|
6
|
+
/** Returns the canonical deployment of the auth registry. */
|
|
7
|
+
export function getCanonicalAuthRegistry(): ProtocolContract {
|
|
8
|
+
const contract = getCanonicalProtocolContract(AuthRegistryArtifact, 1);
|
|
9
|
+
|
|
10
|
+
if (!contract.address.equals(AuthRegistryAddress)) {
|
|
11
|
+
throw new Error(
|
|
12
|
+
`Incorrect address for auth registry (got ${contract.address.toString()} but expected ${AuthRegistryAddress.toString()}). Check CANONICAL_AUTH_REGISTRY_ADDRESS is set to the correct value in the constants files and run the protocol-contracts package tests.`,
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
return contract;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function getCanonicalAuthRegistryAddress(): AztecAddress {
|
|
19
|
+
return getCanonicalAuthRegistry().address;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const AuthRegistryAddress = AztecAddress.fromBigInt(CANONICAL_AUTH_REGISTRY_ADDRESS);
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AztecAddress, REGISTERER_CONTRACT_ADDRESS } from '@aztec/circuits.js';
|
|
2
2
|
|
|
3
3
|
import { type ProtocolContract, getCanonicalProtocolContract } from '../protocol_contract.js';
|
|
4
4
|
import { ContractClassRegistererArtifact } from './artifact.js';
|
|
5
5
|
|
|
6
6
|
/** Returns the canonical deployment of the class registerer contract. */
|
|
7
7
|
export function getCanonicalClassRegisterer(): ProtocolContract {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/** Returns the address for the canonical deployment of the class registerer */
|
|
14
|
-
export function getCanonicalClassRegistererAddress() {
|
|
15
|
-
if (!address) {
|
|
16
|
-
address = getCanonicalClassRegisterer().address;
|
|
8
|
+
const contract = getCanonicalProtocolContract(ContractClassRegistererArtifact, 1);
|
|
9
|
+
if (!contract.address.equals(ClassRegistererAddress)) {
|
|
10
|
+
throw new Error(
|
|
11
|
+
`Incorrect address for class registerer (got ${contract.address.toString()} but expected ${ClassRegistererAddress.toString()}).`,
|
|
12
|
+
);
|
|
17
13
|
}
|
|
18
|
-
return
|
|
14
|
+
return contract;
|
|
19
15
|
}
|
|
16
|
+
|
|
17
|
+
export const ClassRegistererAddress = AztecAddress.fromBigInt(REGISTERER_CONTRACT_ADDRESS);
|
package/src/gas-token/index.ts
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AztecAddress, GAS_TOKEN_ADDRESS } from '@aztec/circuits.js';
|
|
2
2
|
|
|
3
3
|
import { type ProtocolContract, getCanonicalProtocolContract } from '../protocol_contract.js';
|
|
4
4
|
import { GasTokenArtifact } from './artifact.js';
|
|
5
5
|
|
|
6
6
|
/** Returns the canonical deployment of the gas token. */
|
|
7
|
-
export function getCanonicalGasToken(
|
|
8
|
-
|
|
7
|
+
export function getCanonicalGasToken(): ProtocolContract {
|
|
8
|
+
const contract = getCanonicalProtocolContract(GasTokenArtifact, 1);
|
|
9
|
+
if (!contract.address.equals(GasTokenAddress)) {
|
|
10
|
+
throw new Error(
|
|
11
|
+
`Incorrect address for gas token (got ${contract.address.toString()} but expected ${GasTokenAddress.toString()}).`,
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
return contract;
|
|
9
15
|
}
|
|
10
16
|
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
}
|
|
17
|
+
export const GasTokenAddress = AztecAddress.fromBigInt(GAS_TOKEN_ADDRESS);
|
|
18
|
+
|
|
19
|
+
export { GasTokenArtifact };
|
|
@@ -8,7 +8,7 @@ export function getCanonicalInstanceDeployer(): ProtocolContract {
|
|
|
8
8
|
const contract = getCanonicalProtocolContract(ContractInstanceDeployerArtifact, 1);
|
|
9
9
|
if (!contract.address.equals(InstanceDeployerAddress)) {
|
|
10
10
|
throw new Error(
|
|
11
|
-
`Incorrect address for contract deployer (got ${contract.address.toString()} but expected ${InstanceDeployerAddress.toString()})
|
|
11
|
+
`Incorrect address for contract deployer (got ${contract.address.toString()} but expected ${InstanceDeployerAddress.toString()}).`,
|
|
12
12
|
);
|
|
13
13
|
}
|
|
14
14
|
return contract;
|
package/src/protocol_contract.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
type AztecAddress,
|
|
3
|
+
type ContractClassIdPreimage,
|
|
3
4
|
getContractClassFromArtifact,
|
|
4
5
|
getContractInstanceFromDeployParams,
|
|
5
6
|
} from '@aztec/circuits.js';
|
|
@@ -12,7 +13,7 @@ export interface ProtocolContract {
|
|
|
12
13
|
/** Canonical deployed instance. */
|
|
13
14
|
instance: ContractInstanceWithAddress;
|
|
14
15
|
/** Contract class of this contract. */
|
|
15
|
-
contractClass: ContractClassWithId;
|
|
16
|
+
contractClass: ContractClassWithId & ContractClassIdPreimage;
|
|
16
17
|
/** Complete contract artifact. */
|
|
17
18
|
artifact: ContractArtifact;
|
|
18
19
|
/** Deployment address for the canonical instance. */
|