|
1 | 1 | import { DefaultMultiCallEntrypoint } from '@aztec/entrypoints/multicall'; |
2 | 2 | import { Fr } from '@aztec/foundation/curves/bn254'; |
3 | 3 | import type { ContractArtifact, FunctionArtifact } from '@aztec/stdlib/abi'; |
| 4 | +import type { AuthWitness } from '@aztec/stdlib/auth-witness'; |
4 | 5 | import { AztecAddress } from '@aztec/stdlib/aztec-address'; |
5 | 6 | import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract'; |
6 | 7 | import type { PublicKeys } from '@aztec/stdlib/keys'; |
7 | | -import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx'; |
| 8 | +import { type Capsule, ExecutionPayload, type HashedValues, mergeExecutionPayloads } from '@aztec/stdlib/tx'; |
8 | 9 |
|
9 | 10 | import type { Account } from '../account/account.js'; |
10 | 11 | import type { Contract } from '../contract/contract.js'; |
@@ -86,8 +87,21 @@ export class DeployAccountMethod<TContract extends ContractBase = Contract> exte |
86 | 87 | private account: Account, |
87 | 88 | args: any[] = [], |
88 | 89 | constructorNameOrArtifact?: string | FunctionArtifact, |
| 90 | + authWitnesses: AuthWitness[] = [], |
| 91 | + capsules: Capsule[] = [], |
| 92 | + extraHashedArgs: HashedValues[] = [], |
89 | 93 | ) { |
90 | | - super(publicKeys, wallet, artifact, postDeployCtor, args, constructorNameOrArtifact); |
| 94 | + super( |
| 95 | + publicKeys, |
| 96 | + wallet, |
| 97 | + artifact, |
| 98 | + postDeployCtor, |
| 99 | + args, |
| 100 | + constructorNameOrArtifact, |
| 101 | + authWitnesses, |
| 102 | + capsules, |
| 103 | + extraHashedArgs, |
| 104 | + ); |
91 | 105 | } |
92 | 106 |
|
93 | 107 | /** |
@@ -195,4 +209,36 @@ export class DeployAccountMethod<TContract extends ContractBase = Contract> exte |
195 | 209 | const existing = options.additionalScopes ?? []; |
196 | 210 | return { ...options, additionalScopes: [...existing, this.address] }; |
197 | 211 | } |
| 212 | + |
| 213 | + /** |
| 214 | + * Augments this DeployAccountMethod with additional metadata, such as authWitnesses and capsules. |
| 215 | + * @param options - An object containing the metadata to add to the interaction |
| 216 | + * @returns A new DeployAccountMethod with the added metadata |
| 217 | + */ |
| 218 | + public override with({ |
| 219 | + authWitnesses = [], |
| 220 | + capsules = [], |
| 221 | + extraHashedArgs = [], |
| 222 | + }: { |
| 223 | + /** The authWitnesses to add to the deployment */ |
| 224 | + authWitnesses?: AuthWitness[]; |
| 225 | + /** The capsules to add to the deployment */ |
| 226 | + capsules?: Capsule[]; |
| 227 | + /** The extra hashed args to add to the deployment */ |
| 228 | + extraHashedArgs?: HashedValues[]; |
| 229 | + }): DeployAccountMethod<TContract> { |
| 230 | + return new DeployAccountMethod( |
| 231 | + this.publicKeys, |
| 232 | + this.wallet, |
| 233 | + this.artifact, |
| 234 | + this.postDeployCtor, |
| 235 | + this.salt, |
| 236 | + this.account, |
| 237 | + this.args, |
| 238 | + this.constructorArtifact?.name, |
| 239 | + this.authWitnesses.concat(authWitnesses), |
| 240 | + this.capsules.concat(capsules), |
| 241 | + this.extraHashedArgs.concat(extraHashedArgs), |
| 242 | + ); |
| 243 | + } |
198 | 244 | } |
0 commit comments