@aztec/builder 5.0.0-private.20260319 → 5.0.0-rc.1

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.
@@ -6,4 +6,4 @@ import { type ContractArtifact } from '@aztec/stdlib/abi';
6
6
  * @returns The corresponding ts code.
7
7
  */
8
8
  export declare function generateTypescriptContractInterface(input: ContractArtifact, artifactImportPath?: string): Promise<string>;
9
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXNjcmlwdC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbnRyYWN0LWludGVyZmFjZS1nZW4vdHlwZXNjcmlwdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBR0wsS0FBSyxnQkFBZ0IsRUFhdEIsTUFBTSxtQkFBbUIsQ0FBQztBQStRM0I7Ozs7O0dBS0c7QUFDSCx3QkFBc0IsbUNBQW1DLENBQUMsS0FBSyxFQUFFLGdCQUFnQixFQUFFLGtCQUFrQixDQUFDLEVBQUUsTUFBTSxtQkFrRDdHIn0=
9
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXNjcmlwdC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbnRyYWN0LWludGVyZmFjZS1nZW4vdHlwZXNjcmlwdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBR0wsS0FBSyxnQkFBZ0IsRUFhdEIsTUFBTSxtQkFBbUIsQ0FBQztBQXVSM0I7Ozs7O0dBS0c7QUFDSCx3QkFBc0IsbUNBQW1DLENBQUMsS0FBSyxFQUFFLGdCQUFnQixFQUFFLGtCQUFrQixDQUFDLEVBQUUsTUFBTSxtQkFrRDdHIn0=
@@ -1 +1 @@
1
- {"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../src/contract-interface-gen/typescript.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,gBAAgB,EAatB,MAAM,mBAAmB,CAAC;AA+Q3B;;;;;GAKG;AACH,wBAAsB,mCAAmC,CAAC,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,CAAC,EAAE,MAAM,mBAkD7G"}
1
+ {"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../src/contract-interface-gen/typescript.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,gBAAgB,EAatB,MAAM,mBAAmB,CAAC;AAuR3B;;;;;GAKG;AACH,wBAAsB,mCAAmC,CAAC,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,CAAC,EAAE,MAAM,mBAkD7G"}
@@ -69,38 +69,46 @@ import { EventSelector, decodeFunctionSignature, getAllFunctionAbis, getDefaultI
69
69
  * @returns A type-safe deploy method in ts.
70
70
  */ function generateDeploy(input) {
71
71
  const ctor = getDefaultInitializer(input);
72
- const args = (ctor?.parameters ?? []).map(generateParameter).join(', ');
72
+ const ctorParams = ctor?.parameters ?? [];
73
+ const args = ctorParams.map(generateParameter).join(', ');
74
+ const argNames = ctorParams.map((p)=>p.name).join(', ');
75
+ const argsForwarding = argNames ? `[${argNames}]` : '[]';
73
76
  const contractName = `${input.name}Contract`;
74
77
  const artifactName = `${contractName}Artifact`;
75
78
  return `
76
79
  /**
77
80
  * Creates a tx to deploy a new instance of this contract.
81
+ * @param instantiation - Optional address-affecting parameters (salt, deployer / universalDeploy, publicKeys).
82
+ * Salt defaults to a random value; the deployer is locked lazily from the first send-time \`from\`.
78
83
  */
79
- public static deploy(wallet: Wallet, ${args}) {
80
- return new DeployMethod<${contractName}>(PublicKeys.default(), wallet, ${artifactName}, (instance, wallet) => ${contractName}.at(instance.address, wallet), Array.from(arguments).slice(1));
81
- }
82
-
83
- /**
84
- * Creates a tx to deploy a new instance of this contract using the specified public keys hash to derive the address.
85
- */
86
- public static deployWithPublicKeys(publicKeys: PublicKeys, wallet: Wallet, ${args}) {
87
- return new DeployMethod<${contractName}>(publicKeys, wallet, ${artifactName}, (instance, wallet) => ${contractName}.at(instance.address, wallet), Array.from(arguments).slice(2));
84
+ public static deploy(wallet: Wallet, ${args ? `${args}, ` : ''}instantiation?: DeployInstantiationOptions) {
85
+ return DeployMethod.create<${contractName}>(
86
+ wallet,
87
+ {
88
+ artifact: ${artifactName},
89
+ postDeployCtor: (instance, wallet) => ${contractName}.at(instance.address, wallet),
90
+ args: ${argsForwarding},
91
+ },
92
+ instantiation,
93
+ );
88
94
  }
89
95
 
90
96
  /**
91
97
  * Creates a tx to deploy a new instance of this contract using the specified constructor method.
92
98
  */
93
99
  public static deployWithOpts<M extends keyof ${contractName}['methods']>(
94
- opts: { publicKeys?: PublicKeys; method?: M; wallet: Wallet },
100
+ opts: { method?: M; wallet: Wallet; instantiation?: DeployInstantiationOptions },
95
101
  ...args: Parameters<${contractName}['methods'][M]>
96
102
  ) {
97
- return new DeployMethod<${contractName}>(
98
- opts.publicKeys ?? PublicKeys.default(),
103
+ return DeployMethod.create<${contractName}>(
99
104
  opts.wallet,
100
- ${artifactName},
101
- (instance, wallet) => ${contractName}.at(instance.address, wallet),
102
- Array.from(arguments).slice(1),
103
- opts.method ?? 'constructor',
105
+ {
106
+ artifact: ${artifactName},
107
+ postDeployCtor: (instance, wallet) => ${contractName}.at(instance.address, wallet),
108
+ args,
109
+ constructorNameOrArtifact: opts.method ?? 'constructor',
110
+ },
111
+ opts.instantiation,
104
112
  );
105
113
  }
106
114
  `;
@@ -254,7 +262,7 @@ async function generateEvents(events) {
254
262
  /* eslint-disable */
255
263
  import { AztecAddress, CompleteAddress } from '@aztec/aztec.js/addresses';
256
264
  import { type AbiType, type AztecAddressLike, type ContractArtifact, EventSelector, decodeFromAbi, type EthAddressLike, type FieldLike, type FunctionSelectorLike, loadContractArtifact, loadContractArtifactForPublic, type NoirCompiledContract, type OptionLike, type U128Like, type WrappedFieldLike } from '@aztec/aztec.js/abi';
257
- import { Contract, ContractBase, ContractFunctionInteraction, type ContractMethod, type ContractStorageLayout, DeployMethod } from '@aztec/aztec.js/contracts';
265
+ import { Contract, ContractBase, ContractFunctionInteraction, type ContractMethod, type ContractStorageLayout, type DeployInstantiationOptions, DeployMethod } from '@aztec/aztec.js/contracts';
258
266
  import { EthAddress } from '@aztec/aztec.js/addresses';
259
267
  import { Fr, Point } from '@aztec/aztec.js/fields';
260
268
  import { type PublicKey, PublicKeys } from '@aztec/aztec.js/keys';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/builder",
3
- "version": "5.0.0-private.20260319",
3
+ "version": "5.0.0-rc.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/index.js",
@@ -67,8 +67,8 @@
67
67
  ]
68
68
  },
69
69
  "dependencies": {
70
- "@aztec/foundation": "5.0.0-private.20260319",
71
- "@aztec/stdlib": "5.0.0-private.20260319",
70
+ "@aztec/foundation": "5.0.0-rc.1",
71
+ "@aztec/stdlib": "5.0.0-rc.1",
72
72
  "commander": "^12.1.0"
73
73
  },
74
74
  "devDependencies": {
@@ -93,39 +93,47 @@ function generateMethod(entry: FunctionAbi) {
93
93
  */
94
94
  function generateDeploy(input: ContractArtifact) {
95
95
  const ctor = getDefaultInitializer(input);
96
- const args = (ctor?.parameters ?? []).map(generateParameter).join(', ');
96
+ const ctorParams = ctor?.parameters ?? [];
97
+ const args = ctorParams.map(generateParameter).join(', ');
98
+ const argNames = ctorParams.map(p => p.name).join(', ');
99
+ const argsForwarding = argNames ? `[${argNames}]` : '[]';
97
100
  const contractName = `${input.name}Contract`;
98
101
  const artifactName = `${contractName}Artifact`;
99
102
 
100
103
  return `
101
104
  /**
102
105
  * Creates a tx to deploy a new instance of this contract.
106
+ * @param instantiation - Optional address-affecting parameters (salt, deployer / universalDeploy, publicKeys).
107
+ * Salt defaults to a random value; the deployer is locked lazily from the first send-time \`from\`.
103
108
  */
104
- public static deploy(wallet: Wallet, ${args}) {
105
- return new DeployMethod<${contractName}>(PublicKeys.default(), wallet, ${artifactName}, (instance, wallet) => ${contractName}.at(instance.address, wallet), Array.from(arguments).slice(1));
106
- }
107
-
108
- /**
109
- * Creates a tx to deploy a new instance of this contract using the specified public keys hash to derive the address.
110
- */
111
- public static deployWithPublicKeys(publicKeys: PublicKeys, wallet: Wallet, ${args}) {
112
- return new DeployMethod<${contractName}>(publicKeys, wallet, ${artifactName}, (instance, wallet) => ${contractName}.at(instance.address, wallet), Array.from(arguments).slice(2));
109
+ public static deploy(wallet: Wallet, ${args ? `${args}, ` : ''}instantiation?: DeployInstantiationOptions) {
110
+ return DeployMethod.create<${contractName}>(
111
+ wallet,
112
+ {
113
+ artifact: ${artifactName},
114
+ postDeployCtor: (instance, wallet) => ${contractName}.at(instance.address, wallet),
115
+ args: ${argsForwarding},
116
+ },
117
+ instantiation,
118
+ );
113
119
  }
114
120
 
115
121
  /**
116
122
  * Creates a tx to deploy a new instance of this contract using the specified constructor method.
117
123
  */
118
124
  public static deployWithOpts<M extends keyof ${contractName}['methods']>(
119
- opts: { publicKeys?: PublicKeys; method?: M; wallet: Wallet },
125
+ opts: { method?: M; wallet: Wallet; instantiation?: DeployInstantiationOptions },
120
126
  ...args: Parameters<${contractName}['methods'][M]>
121
127
  ) {
122
- return new DeployMethod<${contractName}>(
123
- opts.publicKeys ?? PublicKeys.default(),
128
+ return DeployMethod.create<${contractName}>(
124
129
  opts.wallet,
125
- ${artifactName},
126
- (instance, wallet) => ${contractName}.at(instance.address, wallet),
127
- Array.from(arguments).slice(1),
128
- opts.method ?? 'constructor',
130
+ {
131
+ artifact: ${artifactName},
132
+ postDeployCtor: (instance, wallet) => ${contractName}.at(instance.address, wallet),
133
+ args,
134
+ constructorNameOrArtifact: opts.method ?? 'constructor',
135
+ },
136
+ opts.instantiation,
129
137
  );
130
138
  }
131
139
  `;
@@ -310,7 +318,7 @@ export async function generateTypescriptContractInterface(input: ContractArtifac
310
318
  /* eslint-disable */
311
319
  import { AztecAddress, CompleteAddress } from '@aztec/aztec.js/addresses';
312
320
  import { type AbiType, type AztecAddressLike, type ContractArtifact, EventSelector, decodeFromAbi, type EthAddressLike, type FieldLike, type FunctionSelectorLike, loadContractArtifact, loadContractArtifactForPublic, type NoirCompiledContract, type OptionLike, type U128Like, type WrappedFieldLike } from '@aztec/aztec.js/abi';
313
- import { Contract, ContractBase, ContractFunctionInteraction, type ContractMethod, type ContractStorageLayout, DeployMethod } from '@aztec/aztec.js/contracts';
321
+ import { Contract, ContractBase, ContractFunctionInteraction, type ContractMethod, type ContractStorageLayout, type DeployInstantiationOptions, DeployMethod } from '@aztec/aztec.js/contracts';
314
322
  import { EthAddress } from '@aztec/aztec.js/addresses';
315
323
  import { Fr, Point } from '@aztec/aztec.js/fields';
316
324
  import { type PublicKey, PublicKeys } from '@aztec/aztec.js/keys';