@aztec/builder 4.0.0-nightly.20250907 → 4.0.0-nightly.20260108
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/bin/cli.d.ts +1 -1
- package/dest/contract-interface-gen/codegen.d.ts +1 -1
- package/dest/contract-interface-gen/typescript.d.ts +1 -1
- package/dest/contract-interface-gen/typescript.d.ts.map +1 -1
- package/dest/contract-interface-gen/typescript.js +18 -42
- package/dest/index.d.ts +1 -1
- package/package.json +7 -6
- package/src/contract-interface-gen/typescript.ts +18 -42
package/dest/bin/cli.d.ts
CHANGED
|
@@ -6,4 +6,4 @@ export type GenerateCodeOptions = {
|
|
|
6
6
|
* Generates Noir interface or Typescript interface for a folder or single file from a Noir compilation artifact.
|
|
7
7
|
*/
|
|
8
8
|
export declare function generateCode(outputPath: string, fileOrDirPath: string, opts?: GenerateCodeOptions): Promise<string[]>;
|
|
9
|
-
//# sourceMappingURL=
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29kZWdlbi5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbnRyYWN0LWludGVyZmFjZS1nZW4vY29kZWdlbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFZQSw0QkFBNEI7QUFDNUIsTUFBTSxNQUFNLG1CQUFtQixHQUFHO0lBQUUsS0FBSyxDQUFDLEVBQUUsT0FBTyxDQUFBO0NBQUUsQ0FBQztBQUV0RDs7R0FFRztBQUNILHdCQUFzQixZQUFZLENBQUMsVUFBVSxFQUFFLE1BQU0sRUFBRSxhQUFhLEVBQUUsTUFBTSxFQUFFLElBQUksR0FBRSxtQkFBd0IscUJBa0IzRyJ9
|
|
@@ -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=
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXNjcmlwdC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbnRyYWN0LWludGVyZmFjZS1nZW4vdHlwZXNjcmlwdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBR0wsS0FBSyxnQkFBZ0IsRUFXdEIsTUFBTSxtQkFBbUIsQ0FBQztBQXVRM0I7Ozs7O0dBS0c7QUFDSCx3QkFBc0IsbUNBQW1DLENBQUMsS0FBSyxFQUFFLGdCQUFnQixFQUFFLGtCQUFrQixDQUFDLEVBQUUsTUFBTSxtQkFrRDdHIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../src/contract-interface-gen/typescript.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,gBAAgB,EAWtB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../src/contract-interface-gen/typescript.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,gBAAgB,EAWtB,MAAM,mBAAmB,CAAC;AAuQ3B;;;;;GAKG;AACH,wBAAsB,mCAAmC,CAAC,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,CAAC,EAAE,MAAM,mBAkD7G"}
|
|
@@ -69,14 +69,14 @@ import { EventSelector, decodeFunctionSignature, getAllFunctionAbis, getDefaultI
|
|
|
69
69
|
* Creates a tx to deploy a new instance of this contract.
|
|
70
70
|
*/
|
|
71
71
|
public static deploy(wallet: Wallet, ${args}) {
|
|
72
|
-
return new DeployMethod<${contractName}>(PublicKeys.default(), wallet, ${artifactName}, ${contractName}.at, Array.from(arguments).slice(1));
|
|
72
|
+
return new DeployMethod<${contractName}>(PublicKeys.default(), wallet, ${artifactName}, (instance, wallet) => ${contractName}.at(instance.address, wallet), Array.from(arguments).slice(1));
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* Creates a tx to deploy a new instance of this contract using the specified public keys hash to derive the address.
|
|
77
77
|
*/
|
|
78
78
|
public static deployWithPublicKeys(publicKeys: PublicKeys, wallet: Wallet, ${args}) {
|
|
79
|
-
return new DeployMethod<${contractName}>(publicKeys, wallet, ${artifactName}, ${contractName}.at, Array.from(arguments).slice(2));
|
|
79
|
+
return new DeployMethod<${contractName}>(publicKeys, wallet, ${artifactName}, (instance, wallet) => ${contractName}.at(instance.address, wallet), Array.from(arguments).slice(2));
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
/**
|
|
@@ -90,7 +90,7 @@ import { EventSelector, decodeFunctionSignature, getAllFunctionAbis, getDefaultI
|
|
|
90
90
|
opts.publicKeys ?? PublicKeys.default(),
|
|
91
91
|
opts.wallet,
|
|
92
92
|
${artifactName},
|
|
93
|
-
${contractName}.at,
|
|
93
|
+
(instance, wallet) => ${contractName}.at(instance.address, wallet),
|
|
94
94
|
Array.from(arguments).slice(1),
|
|
95
95
|
opts.method ?? 'constructor',
|
|
96
96
|
);
|
|
@@ -101,14 +101,14 @@ import { EventSelector, decodeFunctionSignature, getAllFunctionAbis, getDefaultI
|
|
|
101
101
|
* Generates the constructor by supplying the ABI to the parent class so the user doesn't have to.
|
|
102
102
|
* @param name - Name of the contract to derive the ABI name from.
|
|
103
103
|
* @returns A constructor method.
|
|
104
|
-
* @remarks The constructor is private because we want to force the user to use the
|
|
104
|
+
* @remarks The constructor is private because we want to force the user to use the at method.
|
|
105
105
|
*/ function generateConstructor(name) {
|
|
106
106
|
return `
|
|
107
107
|
private constructor(
|
|
108
|
-
|
|
108
|
+
address: AztecAddress,
|
|
109
109
|
wallet: Wallet,
|
|
110
110
|
) {
|
|
111
|
-
super(
|
|
111
|
+
super(address, ${name}ContractArtifact, wallet);
|
|
112
112
|
}
|
|
113
113
|
`;
|
|
114
114
|
}
|
|
@@ -116,20 +116,19 @@ import { EventSelector, decodeFunctionSignature, getAllFunctionAbis, getDefaultI
|
|
|
116
116
|
* Generates the at method for this contract.
|
|
117
117
|
* @param name - Name of the contract to derive the ABI name from.
|
|
118
118
|
* @returns An at method.
|
|
119
|
-
* @remarks We don't use constructor directly because of the async `wallet.getContractData` call.
|
|
120
119
|
*/ function generateAt(name) {
|
|
121
120
|
return `
|
|
122
121
|
/**
|
|
123
122
|
* Creates a contract instance.
|
|
124
123
|
* @param address - The deployed contract's address.
|
|
125
124
|
* @param wallet - The wallet to use when interacting with the contract.
|
|
126
|
-
* @returns A
|
|
125
|
+
* @returns A new Contract instance.
|
|
127
126
|
*/
|
|
128
|
-
public static
|
|
127
|
+
public static at(
|
|
129
128
|
address: AztecAddress,
|
|
130
129
|
wallet: Wallet,
|
|
131
|
-
) {
|
|
132
|
-
return Contract.at(address, ${name}Contract.artifact, wallet) as
|
|
130
|
+
): ${name}Contract {
|
|
131
|
+
return Contract.at(address, ${name}Contract.artifact, wallet) as ${name}Contract;
|
|
133
132
|
}`;
|
|
134
133
|
}
|
|
135
134
|
/**
|
|
@@ -233,7 +232,7 @@ async function generateEvents(events) {
|
|
|
233
232
|
* @param artifactImportPath - Optional path to import the artifact (if not set, will be required in the constructor).
|
|
234
233
|
* @returns The corresponding ts code.
|
|
235
234
|
*/ export async function generateTypescriptContractInterface(input, artifactImportPath) {
|
|
236
|
-
const methods = getAllFunctionAbis(input).filter((f)=>!f.
|
|
235
|
+
const methods = getAllFunctionAbis(input).filter((f)=>!f.isOnlySelf).sort((a, b)=>a.name.localeCompare(b.name)).map(generateMethod);
|
|
237
236
|
const deploy = artifactImportPath && generateDeploy(input);
|
|
238
237
|
const ctor = artifactImportPath && generateConstructor(input.name);
|
|
239
238
|
const at = artifactImportPath && generateAt(input.name);
|
|
@@ -245,36 +244,13 @@ async function generateEvents(events) {
|
|
|
245
244
|
/* Autogenerated file, do not edit! */
|
|
246
245
|
|
|
247
246
|
/* eslint-disable */
|
|
248
|
-
import {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
ContractBase,
|
|
256
|
-
ContractFunctionInteraction,
|
|
257
|
-
type ContractInstanceWithAddress,
|
|
258
|
-
type ContractMethod,
|
|
259
|
-
type ContractStorageLayout,
|
|
260
|
-
decodeFromAbi,
|
|
261
|
-
DeployMethod,
|
|
262
|
-
EthAddress,
|
|
263
|
-
type EthAddressLike,
|
|
264
|
-
EventSelector,
|
|
265
|
-
type FieldLike,
|
|
266
|
-
Fr,
|
|
267
|
-
type FunctionSelectorLike,
|
|
268
|
-
loadContractArtifact,
|
|
269
|
-
loadContractArtifactForPublic,
|
|
270
|
-
type NoirCompiledContract,
|
|
271
|
-
Point,
|
|
272
|
-
type PublicKey,
|
|
273
|
-
PublicKeys,
|
|
274
|
-
type Wallet,
|
|
275
|
-
type U128Like,
|
|
276
|
-
type WrappedFieldLike,
|
|
277
|
-
} from '@aztec/aztec.js';
|
|
247
|
+
import { AztecAddress, CompleteAddress } from '@aztec/aztec.js/addresses';
|
|
248
|
+
import { type AbiType, type AztecAddressLike, type ContractArtifact, EventSelector, decodeFromAbi, type EthAddressLike, type FieldLike, type FunctionSelectorLike, loadContractArtifact, loadContractArtifactForPublic, type NoirCompiledContract, type U128Like, type WrappedFieldLike } from '@aztec/aztec.js/abi';
|
|
249
|
+
import { Contract, ContractBase, ContractFunctionInteraction, type ContractMethod, type ContractStorageLayout, DeployMethod } from '@aztec/aztec.js/contracts';
|
|
250
|
+
import { EthAddress } from '@aztec/aztec.js/addresses';
|
|
251
|
+
import { Fr, Point } from '@aztec/aztec.js/fields';
|
|
252
|
+
import { type PublicKey, PublicKeys } from '@aztec/aztec.js/keys';
|
|
253
|
+
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
278
254
|
${artifactStatement}
|
|
279
255
|
|
|
280
256
|
${eventDefs}
|
package/dest/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Command } from 'commander';
|
|
2
2
|
export declare function injectCommands(program: Command): Command;
|
|
3
|
-
//# sourceMappingURL=
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxPQUFPLEVBQUUsTUFBTSxXQUFXLENBQUM7QUFHekMsd0JBQWdCLGNBQWMsQ0FBQyxPQUFPLEVBQUUsT0FBTyxXQVk5QyJ9
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/builder",
|
|
3
|
-
"version": "4.0.0-nightly.
|
|
3
|
+
"version": "4.0.0-nightly.20260108",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"aztec-builder": "dest/bin/cli.js"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
|
-
"build": "yarn clean && tsc
|
|
21
|
-
"build:dev": "tsc
|
|
22
|
-
"generate": "
|
|
20
|
+
"build": "yarn clean && ../scripts/tsc.sh",
|
|
21
|
+
"build:dev": "../scripts/tsc.sh --watch",
|
|
22
|
+
"generate": "tsgo -b",
|
|
23
23
|
"clean": "rm -rf ./dest .tsbuildinfo",
|
|
24
24
|
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
|
|
25
25
|
},
|
|
@@ -69,14 +69,15 @@
|
|
|
69
69
|
]
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@aztec/foundation": "4.0.0-nightly.
|
|
73
|
-
"@aztec/stdlib": "4.0.0-nightly.
|
|
72
|
+
"@aztec/foundation": "4.0.0-nightly.20260108",
|
|
73
|
+
"@aztec/stdlib": "4.0.0-nightly.20260108",
|
|
74
74
|
"commander": "^12.1.0"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@jest/globals": "^30.0.0",
|
|
78
78
|
"@types/jest": "^30.0.0",
|
|
79
79
|
"@types/node": "^22.15.17",
|
|
80
|
+
"@typescript/native-preview": "7.0.0-dev.20251126.1",
|
|
80
81
|
"jest": "^30.0.0",
|
|
81
82
|
"ts-node": "^10.9.1",
|
|
82
83
|
"typescript": "^5.3.3"
|
|
@@ -92,14 +92,14 @@ function generateDeploy(input: ContractArtifact) {
|
|
|
92
92
|
* Creates a tx to deploy a new instance of this contract.
|
|
93
93
|
*/
|
|
94
94
|
public static deploy(wallet: Wallet, ${args}) {
|
|
95
|
-
return new DeployMethod<${contractName}>(PublicKeys.default(), wallet, ${artifactName}, ${contractName}.at, Array.from(arguments).slice(1));
|
|
95
|
+
return new DeployMethod<${contractName}>(PublicKeys.default(), wallet, ${artifactName}, (instance, wallet) => ${contractName}.at(instance.address, wallet), Array.from(arguments).slice(1));
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
99
|
* Creates a tx to deploy a new instance of this contract using the specified public keys hash to derive the address.
|
|
100
100
|
*/
|
|
101
101
|
public static deployWithPublicKeys(publicKeys: PublicKeys, wallet: Wallet, ${args}) {
|
|
102
|
-
return new DeployMethod<${contractName}>(publicKeys, wallet, ${artifactName}, ${contractName}.at, Array.from(arguments).slice(2));
|
|
102
|
+
return new DeployMethod<${contractName}>(publicKeys, wallet, ${artifactName}, (instance, wallet) => ${contractName}.at(instance.address, wallet), Array.from(arguments).slice(2));
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
/**
|
|
@@ -113,7 +113,7 @@ function generateDeploy(input: ContractArtifact) {
|
|
|
113
113
|
opts.publicKeys ?? PublicKeys.default(),
|
|
114
114
|
opts.wallet,
|
|
115
115
|
${artifactName},
|
|
116
|
-
${contractName}.at,
|
|
116
|
+
(instance, wallet) => ${contractName}.at(instance.address, wallet),
|
|
117
117
|
Array.from(arguments).slice(1),
|
|
118
118
|
opts.method ?? 'constructor',
|
|
119
119
|
);
|
|
@@ -125,15 +125,15 @@ function generateDeploy(input: ContractArtifact) {
|
|
|
125
125
|
* Generates the constructor by supplying the ABI to the parent class so the user doesn't have to.
|
|
126
126
|
* @param name - Name of the contract to derive the ABI name from.
|
|
127
127
|
* @returns A constructor method.
|
|
128
|
-
* @remarks The constructor is private because we want to force the user to use the
|
|
128
|
+
* @remarks The constructor is private because we want to force the user to use the at method.
|
|
129
129
|
*/
|
|
130
130
|
function generateConstructor(name: string) {
|
|
131
131
|
return `
|
|
132
132
|
private constructor(
|
|
133
|
-
|
|
133
|
+
address: AztecAddress,
|
|
134
134
|
wallet: Wallet,
|
|
135
135
|
) {
|
|
136
|
-
super(
|
|
136
|
+
super(address, ${name}ContractArtifact, wallet);
|
|
137
137
|
}
|
|
138
138
|
`;
|
|
139
139
|
}
|
|
@@ -142,7 +142,6 @@ function generateConstructor(name: string) {
|
|
|
142
142
|
* Generates the at method for this contract.
|
|
143
143
|
* @param name - Name of the contract to derive the ABI name from.
|
|
144
144
|
* @returns An at method.
|
|
145
|
-
* @remarks We don't use constructor directly because of the async `wallet.getContractData` call.
|
|
146
145
|
*/
|
|
147
146
|
function generateAt(name: string) {
|
|
148
147
|
return `
|
|
@@ -150,13 +149,13 @@ function generateAt(name: string) {
|
|
|
150
149
|
* Creates a contract instance.
|
|
151
150
|
* @param address - The deployed contract's address.
|
|
152
151
|
* @param wallet - The wallet to use when interacting with the contract.
|
|
153
|
-
* @returns A
|
|
152
|
+
* @returns A new Contract instance.
|
|
154
153
|
*/
|
|
155
|
-
public static
|
|
154
|
+
public static at(
|
|
156
155
|
address: AztecAddress,
|
|
157
156
|
wallet: Wallet,
|
|
158
|
-
) {
|
|
159
|
-
return Contract.at(address, ${name}Contract.artifact, wallet) as
|
|
157
|
+
): ${name}Contract {
|
|
158
|
+
return Contract.at(address, ${name}Contract.artifact, wallet) as ${name}Contract;
|
|
160
159
|
}`;
|
|
161
160
|
}
|
|
162
161
|
|
|
@@ -284,7 +283,7 @@ async function generateEvents(events: any[] | undefined) {
|
|
|
284
283
|
*/
|
|
285
284
|
export async function generateTypescriptContractInterface(input: ContractArtifact, artifactImportPath?: string) {
|
|
286
285
|
const methods = getAllFunctionAbis(input)
|
|
287
|
-
.filter(f => !f.
|
|
286
|
+
.filter(f => !f.isOnlySelf)
|
|
288
287
|
.sort((a, b) => a.name.localeCompare(b.name))
|
|
289
288
|
.map(generateMethod);
|
|
290
289
|
const deploy = artifactImportPath && generateDeploy(input);
|
|
@@ -299,36 +298,13 @@ export async function generateTypescriptContractInterface(input: ContractArtifac
|
|
|
299
298
|
/* Autogenerated file, do not edit! */
|
|
300
299
|
|
|
301
300
|
/* eslint-disable */
|
|
302
|
-
import {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
ContractBase,
|
|
310
|
-
ContractFunctionInteraction,
|
|
311
|
-
type ContractInstanceWithAddress,
|
|
312
|
-
type ContractMethod,
|
|
313
|
-
type ContractStorageLayout,
|
|
314
|
-
decodeFromAbi,
|
|
315
|
-
DeployMethod,
|
|
316
|
-
EthAddress,
|
|
317
|
-
type EthAddressLike,
|
|
318
|
-
EventSelector,
|
|
319
|
-
type FieldLike,
|
|
320
|
-
Fr,
|
|
321
|
-
type FunctionSelectorLike,
|
|
322
|
-
loadContractArtifact,
|
|
323
|
-
loadContractArtifactForPublic,
|
|
324
|
-
type NoirCompiledContract,
|
|
325
|
-
Point,
|
|
326
|
-
type PublicKey,
|
|
327
|
-
PublicKeys,
|
|
328
|
-
type Wallet,
|
|
329
|
-
type U128Like,
|
|
330
|
-
type WrappedFieldLike,
|
|
331
|
-
} from '@aztec/aztec.js';
|
|
301
|
+
import { AztecAddress, CompleteAddress } from '@aztec/aztec.js/addresses';
|
|
302
|
+
import { type AbiType, type AztecAddressLike, type ContractArtifact, EventSelector, decodeFromAbi, type EthAddressLike, type FieldLike, type FunctionSelectorLike, loadContractArtifact, loadContractArtifactForPublic, type NoirCompiledContract, type U128Like, type WrappedFieldLike } from '@aztec/aztec.js/abi';
|
|
303
|
+
import { Contract, ContractBase, ContractFunctionInteraction, type ContractMethod, type ContractStorageLayout, DeployMethod } from '@aztec/aztec.js/contracts';
|
|
304
|
+
import { EthAddress } from '@aztec/aztec.js/addresses';
|
|
305
|
+
import { Fr, Point } from '@aztec/aztec.js/fields';
|
|
306
|
+
import { type PublicKey, PublicKeys } from '@aztec/aztec.js/keys';
|
|
307
|
+
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
332
308
|
${artifactStatement}
|
|
333
309
|
|
|
334
310
|
${eventDefs}
|