@aztec/builder 3.0.0-nightly.20251118 → 3.0.0-nightly.20251120
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.
|
@@ -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
|
/**
|
|
@@ -247,7 +246,7 @@ async function generateEvents(events) {
|
|
|
247
246
|
/* eslint-disable */
|
|
248
247
|
import { AztecAddress, CompleteAddress } from '@aztec/aztec.js/addresses';
|
|
249
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';
|
|
250
|
-
import { Contract, ContractBase, ContractFunctionInteraction, type
|
|
249
|
+
import { Contract, ContractBase, ContractFunctionInteraction, type ContractMethod, type ContractStorageLayout, DeployMethod } from '@aztec/aztec.js/contracts';
|
|
251
250
|
import { EthAddress } from '@aztec/aztec.js/addresses';
|
|
252
251
|
import { Fr, Point } from '@aztec/aztec.js/fields';
|
|
253
252
|
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": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.20251120",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
]
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@aztec/foundation": "3.0.0-nightly.
|
|
73
|
-
"@aztec/stdlib": "3.0.0-nightly.
|
|
72
|
+
"@aztec/foundation": "3.0.0-nightly.20251120",
|
|
73
|
+
"@aztec/stdlib": "3.0.0-nightly.20251120",
|
|
74
74
|
"commander": "^12.1.0"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
@@ -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
|
|
|
@@ -301,7 +300,7 @@ export async function generateTypescriptContractInterface(input: ContractArtifac
|
|
|
301
300
|
/* eslint-disable */
|
|
302
301
|
import { AztecAddress, CompleteAddress } from '@aztec/aztec.js/addresses';
|
|
303
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';
|
|
304
|
-
import { Contract, ContractBase, ContractFunctionInteraction, type
|
|
303
|
+
import { Contract, ContractBase, ContractFunctionInteraction, type ContractMethod, type ContractStorageLayout, DeployMethod } from '@aztec/aztec.js/contracts';
|
|
305
304
|
import { EthAddress } from '@aztec/aztec.js/addresses';
|
|
306
305
|
import { Fr, Point } from '@aztec/aztec.js/fields';
|
|
307
306
|
import { type PublicKey, PublicKeys } from '@aztec/aztec.js/keys';
|