@aztec/aztec.js 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.
- package/dest/api/contract.d.ts +1 -1
- package/dest/api/contract.js +1 -1
- package/dest/api/tx.d.ts +1 -1
- package/dest/api/tx.d.ts.map +1 -1
- package/dest/api/tx.js +1 -1
- package/dest/api/wallet.d.ts +1 -1
- package/dest/api/wallet.d.ts.map +1 -1
- package/dest/api/wallet.js +1 -1
- package/dest/contract/batch_call.js +1 -2
- package/dest/contract/contract.d.ts +1 -1
- package/dest/contract/contract.d.ts.map +1 -1
- package/dest/contract/contract.js +4 -5
- package/dest/contract/contract_base.d.ts +5 -9
- package/dest/contract/contract_base.d.ts.map +1 -1
- package/dest/contract/contract_base.js +5 -12
- package/dest/contract/deploy_method.d.ts +5 -4
- package/dest/contract/deploy_method.d.ts.map +1 -1
- package/dest/contract/deploy_method.js +4 -2
- package/dest/contract/deploy_sent_tx.d.ts +11 -6
- package/dest/contract/deploy_sent_tx.d.ts.map +1 -1
- package/dest/contract/deploy_sent_tx.js +10 -4
- package/dest/contract/unsafe_contract.js +1 -1
- package/dest/deployment/contract_deployer.d.ts.map +1 -1
- package/dest/deployment/contract_deployer.js +1 -1
- package/dest/wallet/account_manager.js +1 -1
- package/dest/wallet/base_wallet.d.ts +4 -4
- package/dest/wallet/base_wallet.d.ts.map +1 -1
- package/dest/wallet/base_wallet.js +24 -41
- package/dest/wallet/deploy_account_method.d.ts +2 -2
- package/dest/wallet/deploy_account_method.d.ts.map +1 -1
- package/dest/wallet/wallet.d.ts +57 -860
- package/dest/wallet/wallet.d.ts.map +1 -1
- package/dest/wallet/wallet.js +7 -28
- package/package.json +8 -8
- package/src/api/contract.ts +1 -1
- package/src/api/tx.ts +1 -0
- package/src/api/wallet.ts +0 -3
- package/src/contract/batch_call.ts +1 -1
- package/src/contract/contract.ts +7 -5
- package/src/contract/contract_base.ts +5 -15
- package/src/contract/deploy_method.ts +8 -7
- package/src/contract/deploy_sent_tx.ts +17 -10
- package/src/contract/unsafe_contract.ts +1 -1
- package/src/deployment/contract_deployer.ts +3 -2
- package/src/wallet/account_manager.ts +1 -1
- package/src/wallet/base_wallet.ts +26 -49
- package/src/wallet/deploy_account_method.ts +2 -1
- package/src/wallet/wallet.ts +9 -45
package/dest/api/contract.d.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* ```
|
|
16
16
|
*
|
|
17
17
|
* ```ts
|
|
18
|
-
* const contract =
|
|
18
|
+
* const contract = Contract.at(address, MyContractArtifact, wallet);
|
|
19
19
|
* await contract.methods.mint(1000, owner).send().wait();
|
|
20
20
|
* console.log(`Total supply is now ${await contract.methods.totalSupply().simulate()}`);
|
|
21
21
|
* ```
|
package/dest/api/contract.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* ```
|
|
16
16
|
*
|
|
17
17
|
* ```ts
|
|
18
|
-
* const contract =
|
|
18
|
+
* const contract = Contract.at(address, MyContractArtifact, wallet);
|
|
19
19
|
* await contract.methods.mint(1000, owner).send().wait();
|
|
20
20
|
* console.log(`Total supply is now ${await contract.methods.totalSupply().simulate()}`);
|
|
21
21
|
* ```
|
package/dest/api/tx.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Tx, TxExecutionRequest, TxHash, TxReceipt, TxStatus, Capsule, HashedValues, GlobalVariables, TxProfileResult, ExecutionPayload, } from '@aztec/stdlib/tx';
|
|
1
|
+
export { Tx, TxExecutionRequest, TxHash, TxReceipt, TxStatus, Capsule, HashedValues, GlobalVariables, TxProfileResult, ExecutionPayload, mergeExecutionPayloads, } from '@aztec/stdlib/tx';
|
|
2
2
|
//# sourceMappingURL=tx.d.ts.map
|
package/dest/api/tx.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tx.d.ts","sourceRoot":"","sources":["../../src/api/tx.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,EAAE,EACF,kBAAkB,EAClB,MAAM,EACN,SAAS,EACT,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,eAAe,EACf,eAAe,EACf,gBAAgB,
|
|
1
|
+
{"version":3,"file":"tx.d.ts","sourceRoot":"","sources":["../../src/api/tx.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,EAAE,EACF,kBAAkB,EAClB,MAAM,EACN,SAAS,EACT,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,kBAAkB,CAAC"}
|
package/dest/api/tx.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Tx, TxExecutionRequest, TxHash, TxReceipt, TxStatus, Capsule, HashedValues, GlobalVariables, TxProfileResult, ExecutionPayload } from '@aztec/stdlib/tx';
|
|
1
|
+
export { Tx, TxExecutionRequest, TxHash, TxReceipt, TxStatus, Capsule, HashedValues, GlobalVariables, TxProfileResult, ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx';
|
package/dest/api/wallet.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { type Aliased, type
|
|
1
|
+
export { type Aliased, type SimulateOptions, type ProfileOptions, type SendOptions, type BatchableMethods, type BatchedMethod, type BatchedMethodResult, type BatchedMethodResultWrapper, type BatchResults, type Wallet, FunctionCallSchema, ExecutionPayloadSchema, GasSettingsOptionSchema, WalletSimulationFeeOptionSchema, SendOptionsSchema, SimulateOptionsSchema, ProfileOptionsSchema, MessageHashOrIntentSchema, BatchedMethodSchema, ContractMetadataSchema, ContractClassMetadataSchema, EventMetadataDefinitionSchema, WalletSchema, } from '../wallet/wallet.js';
|
|
2
2
|
export { type FeeOptions, BaseWallet } from '../wallet/base_wallet.js';
|
|
3
3
|
export { AccountManager } from '../wallet/account_manager.js';
|
|
4
4
|
export { type DeployAccountOptions, DeployAccountMethod } from '../wallet/deploy_account_method.js';
|
package/dest/api/wallet.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/api/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,
|
|
1
|
+
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/api/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,YAAY,EACjB,KAAK,MAAM,EACX,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACvB,+BAA+B,EAC/B,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,yBAAyB,EACzB,mBAAmB,EACnB,sBAAsB,EACtB,2BAA2B,EAC3B,6BAA6B,EAC7B,YAAY,GACb,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,UAAU,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEvE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,EAAE,KAAK,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC"}
|
package/dest/api/wallet.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { FunctionCallSchema, ExecutionPayloadSchema, GasSettingsOptionSchema, WalletSimulationFeeOptionSchema, SendOptionsSchema, SimulateOptionsSchema, ProfileOptionsSchema, MessageHashOrIntentSchema, BatchedMethodSchema, ContractMetadataSchema, ContractClassMetadataSchema, EventMetadataDefinitionSchema, WalletSchema } from '../wallet/wallet.js';
|
|
2
2
|
export { BaseWallet } from '../wallet/base_wallet.js';
|
|
3
3
|
export { AccountManager } from '../wallet/account_manager.js';
|
|
4
4
|
export { DeployAccountMethod } from '../wallet/deploy_account_method.js';
|
|
@@ -19,7 +19,7 @@ export declare class Contract extends ContractBase {
|
|
|
19
19
|
* @param wallet - The wallet to use when interacting with the contract.
|
|
20
20
|
* @returns A promise that resolves to a new Contract instance.
|
|
21
21
|
*/
|
|
22
|
-
static at(address: AztecAddress, artifact: ContractArtifact, wallet: Wallet):
|
|
22
|
+
static at(address: AztecAddress, artifact: ContractArtifact, wallet: Wallet): Contract;
|
|
23
23
|
/**
|
|
24
24
|
* Creates a tx to deploy (initialize and/or publish) a new instance of a contract.
|
|
25
25
|
* @param wallet - The wallet for executing the deployment.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/contract/contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/contract/contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;;;;;GAMG;AACH,qBAAa,QAAS,SAAQ,YAAY;IACxC;;;;;;OAMG;WACW,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,GAAG,QAAQ;IAI7F;;;;;;OAMG;WACW,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,eAAe,CAAC,EAAE,MAAM;IAMtG;;;;;;;;OAQG;WACW,oBAAoB,CAChC,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,gBAAgB,EAC1B,IAAI,EAAE,GAAG,EAAE,EACX,eAAe,CAAC,EAAE,MAAM;CAM3B"}
|
|
@@ -14,9 +14,8 @@ import { DeployMethod } from './deploy_method.js';
|
|
|
14
14
|
* @param artifact - Build artifact of the contract.
|
|
15
15
|
* @param wallet - The wallet to use when interacting with the contract.
|
|
16
16
|
* @returns A promise that resolves to a new Contract instance.
|
|
17
|
-
*/ static
|
|
18
|
-
|
|
19
|
-
return new Contract(instance, artifact, wallet);
|
|
17
|
+
*/ static at(address, artifact, wallet) {
|
|
18
|
+
return new Contract(address, artifact, wallet);
|
|
20
19
|
}
|
|
21
20
|
/**
|
|
22
21
|
* Creates a tx to deploy (initialize and/or publish) a new instance of a contract.
|
|
@@ -25,7 +24,7 @@ import { DeployMethod } from './deploy_method.js';
|
|
|
25
24
|
* @param args - Arguments for the constructor.
|
|
26
25
|
* @param constructorName - The name of the constructor function to call.
|
|
27
26
|
*/ static deploy(wallet, artifact, args, constructorName) {
|
|
28
|
-
const postDeployCtor = (
|
|
27
|
+
const postDeployCtor = (instance, wallet)=>Contract.at(instance.address, artifact, wallet);
|
|
29
28
|
return new DeployMethod(PublicKeys.default(), wallet, artifact, postDeployCtor, args, constructorName);
|
|
30
29
|
}
|
|
31
30
|
/**
|
|
@@ -37,7 +36,7 @@ import { DeployMethod } from './deploy_method.js';
|
|
|
37
36
|
* @param args - Arguments for the constructor.
|
|
38
37
|
* @param constructorName - The name of the constructor function to call.
|
|
39
38
|
*/ static deployWithPublicKeys(publicKeys, wallet, artifact, args, constructorName) {
|
|
40
|
-
const postDeployCtor = (
|
|
39
|
+
const postDeployCtor = (instance, wallet)=>Contract.at(instance.address, artifact, wallet);
|
|
41
40
|
return new DeployMethod(publicKeys, wallet, artifact, postDeployCtor, args, constructorName);
|
|
42
41
|
}
|
|
43
42
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ContractArtifact, type FieldLayout, FunctionSelector } from '@aztec/stdlib/abi';
|
|
2
|
-
import {
|
|
2
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
3
|
import type { Wallet } from '../wallet/wallet.js';
|
|
4
4
|
import { ContractFunctionInteraction } from './contract_function_interaction.js';
|
|
5
5
|
/**
|
|
@@ -22,8 +22,8 @@ export type ContractStorageLayout<T extends string> = {
|
|
|
22
22
|
* Abstract implementation of a contract extended by the Contract class and generated contract types.
|
|
23
23
|
*/
|
|
24
24
|
export declare class ContractBase {
|
|
25
|
-
/** The
|
|
26
|
-
readonly
|
|
25
|
+
/** The contract's address. */
|
|
26
|
+
readonly address: AztecAddress;
|
|
27
27
|
/** The Application Binary Interface for the contract. */
|
|
28
28
|
readonly artifact: ContractArtifact;
|
|
29
29
|
/** The wallet used for interacting with this contract. */
|
|
@@ -35,16 +35,12 @@ export declare class ContractBase {
|
|
|
35
35
|
[name: string]: ContractMethod;
|
|
36
36
|
};
|
|
37
37
|
protected constructor(
|
|
38
|
-
/** The
|
|
39
|
-
|
|
38
|
+
/** The contract's address. */
|
|
39
|
+
address: AztecAddress,
|
|
40
40
|
/** The Application Binary Interface for the contract. */
|
|
41
41
|
artifact: ContractArtifact,
|
|
42
42
|
/** The wallet used for interacting with this contract. */
|
|
43
43
|
wallet: Wallet);
|
|
44
|
-
/** Address of the contract. */
|
|
45
|
-
get address(): import("../api/addresses.js").AztecAddress;
|
|
46
|
-
/** Partial address of the contract. */
|
|
47
|
-
get partialAddress(): Promise<import("@aztec/foundation/schemas").Fr>;
|
|
48
44
|
/**
|
|
49
45
|
* Creates a new instance of the contract wrapper attached to a different wallet.
|
|
50
46
|
* @param wallet - Wallet to use for sending txs.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract_base.d.ts","sourceRoot":"","sources":["../../src/contract/contract_base.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAEhB,gBAAgB,EAEjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"contract_base.d.ts","sourceRoot":"","sources":["../../src/contract/contract_base.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAEhB,gBAAgB,EAEjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AAEjF;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,2BAA2B,CAAC,GAAG;IAC/E;;OAEG;IACH,QAAQ,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAC3C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,MAAM,IAAI;KACnD,CAAC,IAAI,CAAC,GAAG,WAAW;CACtB,CAAC;AAEF;;GAEG;AACH,qBAAa,YAAY;IAOrB,8BAA8B;aACd,OAAO,EAAE,YAAY;IACrC,yDAAyD;aACzC,QAAQ,EAAE,gBAAgB;IAC1C,0DAA0D;IACnD,MAAM,EAAE,MAAM;IAXvB;;OAEG;IACI,OAAO,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAAA;KAAE,CAAM;IAExD,SAAS;IACP,8BAA8B;IACd,OAAO,EAAE,YAAY;IACrC,yDAAyD;IACzC,QAAQ,EAAE,gBAAgB;IAC1C,0DAA0D;IACnD,MAAM,EAAE,MAAM;IAmBvB;;;;OAIG;IACI,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;CAGxC"}
|
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
import { FunctionSelector, getAllFunctionAbis } from '@aztec/stdlib/abi';
|
|
2
|
-
import { computePartialAddress } from '@aztec/stdlib/contract';
|
|
3
2
|
import { ContractFunctionInteraction } from './contract_function_interaction.js';
|
|
4
3
|
/**
|
|
5
4
|
* Abstract implementation of a contract extended by the Contract class and generated contract types.
|
|
6
5
|
*/ export class ContractBase {
|
|
7
|
-
|
|
6
|
+
address;
|
|
8
7
|
artifact;
|
|
9
8
|
wallet;
|
|
10
9
|
/**
|
|
11
10
|
* An object containing contract methods mapped to their respective names.
|
|
12
11
|
*/ methods;
|
|
13
|
-
constructor(/** The
|
|
14
|
-
this.
|
|
12
|
+
constructor(/** The contract's address. */ address, /** The Application Binary Interface for the contract. */ artifact, /** The wallet used for interacting with this contract. */ wallet){
|
|
13
|
+
this.address = address;
|
|
15
14
|
this.artifact = artifact;
|
|
16
15
|
this.wallet = wallet;
|
|
17
16
|
this.methods = {};
|
|
18
17
|
getAllFunctionAbis(artifact).forEach((f)=>{
|
|
19
18
|
const interactionFunction = (...args)=>{
|
|
20
|
-
return new ContractFunctionInteraction(this.wallet, this.
|
|
19
|
+
return new ContractFunctionInteraction(this.wallet, this.address, f, args);
|
|
21
20
|
};
|
|
22
21
|
this.methods[f.name] = Object.assign(interactionFunction, {
|
|
23
22
|
/**
|
|
@@ -29,17 +28,11 @@ import { ContractFunctionInteraction } from './contract_function_interaction.js'
|
|
|
29
28
|
});
|
|
30
29
|
});
|
|
31
30
|
}
|
|
32
|
-
/** Address of the contract. */ get address() {
|
|
33
|
-
return this.instance.address;
|
|
34
|
-
}
|
|
35
|
-
/** Partial address of the contract. */ get partialAddress() {
|
|
36
|
-
return computePartialAddress(this.instance);
|
|
37
|
-
}
|
|
38
31
|
/**
|
|
39
32
|
* Creates a new instance of the contract wrapper attached to a different wallet.
|
|
40
33
|
* @param wallet - Wallet to use for sending txs.
|
|
41
34
|
* @returns A new contract instance.
|
|
42
35
|
*/ withWallet(wallet) {
|
|
43
|
-
return new ContractBase(this.
|
|
36
|
+
return new ContractBase(this.address, this.artifact, wallet);
|
|
44
37
|
}
|
|
45
38
|
}
|
|
@@ -8,7 +8,6 @@ import { type Capsule, type TxProfileResult } from '@aztec/stdlib/tx';
|
|
|
8
8
|
import { ExecutionPayload } from '@aztec/stdlib/tx';
|
|
9
9
|
import type { Wallet } from '../wallet/wallet.js';
|
|
10
10
|
import { BaseContractInteraction } from './base_contract_interaction.js';
|
|
11
|
-
import type { Contract } from './contract.js';
|
|
12
11
|
import type { ContractBase } from './contract_base.js';
|
|
13
12
|
import { DeploySentTx } from './deploy_sent_tx.js';
|
|
14
13
|
import { type ProfileInteractionOptions, type RequestInteractionOptions, type SendInteractionOptions, type SimulationInteractionFeeOptions, type SimulationReturn } from './interaction_options.js';
|
|
@@ -31,6 +30,8 @@ export type RequestDeployOptions = RequestInteractionOptions & {
|
|
|
31
30
|
skipInstancePublication?: boolean;
|
|
32
31
|
/** Skip contract initialization. */
|
|
33
32
|
skipInitialization?: boolean;
|
|
33
|
+
/** Skip contract registration in the wallet */
|
|
34
|
+
skipRegistration?: boolean;
|
|
34
35
|
};
|
|
35
36
|
/**
|
|
36
37
|
* Extends the deployment options with the required parameters to send the transaction
|
|
@@ -71,16 +72,16 @@ export type SimulateDeployOptions = Omit<DeployOptions, 'fee'> & {
|
|
|
71
72
|
*
|
|
72
73
|
* Extends the BaseContractInteraction class.
|
|
73
74
|
*/
|
|
74
|
-
export declare class DeployMethod<TContract extends ContractBase =
|
|
75
|
+
export declare class DeployMethod<TContract extends ContractBase = ContractBase> extends BaseContractInteraction {
|
|
75
76
|
private publicKeys;
|
|
76
77
|
protected artifact: ContractArtifact;
|
|
77
|
-
protected postDeployCtor: (
|
|
78
|
+
protected postDeployCtor: (instance: ContractInstanceWithAddress, wallet: Wallet) => TContract;
|
|
78
79
|
private args;
|
|
79
80
|
/** The contract instance to be deployed. */
|
|
80
81
|
private instance?;
|
|
81
82
|
/** Constructor function to call. */
|
|
82
83
|
private constructorArtifact;
|
|
83
|
-
constructor(publicKeys: PublicKeys, wallet: Wallet, artifact: ContractArtifact, postDeployCtor: (
|
|
84
|
+
constructor(publicKeys: PublicKeys, wallet: Wallet, artifact: ContractArtifact, postDeployCtor: (instance: ContractInstanceWithAddress, wallet: Wallet) => TContract, args?: any[], constructorNameOrArtifact?: string | FunctionArtifact, authWitnesses?: AuthWitness[], capsules?: Capsule[]);
|
|
84
85
|
/**
|
|
85
86
|
* Returns the execution payload that allows this operation to happen on chain.
|
|
86
87
|
* @param options - Configuration options.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy_method.d.ts","sourceRoot":"","sources":["../../src/contract/deploy_method.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,KAAK,gBAAgB,EAAoB,KAAK,gBAAgB,EAAkB,MAAM,mBAAmB,CAAC;AACnH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EACL,KAAK,2BAA2B,EAIjC,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,eAAe,EAA0B,MAAM,kBAAkB,CAAC;AAC9F,OAAO,EAAE,gBAAgB,EAA0B,MAAM,kBAAkB,CAAC;AAI5E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"deploy_method.d.ts","sourceRoot":"","sources":["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ACjC,QAAQ,GAAE,OAAO,EAAO;IAM1B;;;;OAIG;IACU,OAAO,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAqB/E,oCAAoC,CAAC,OAAO,EAAE,aAAa,GAAG,oBAAoB;IAOlF;;;OAGG;IACU,QAAQ,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,SAAS,CAAC;IAMzE;;;;;;;OAOG;cACa,8BAA8B,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA0CzG;;;;OAIG;cACa,iCAAiC,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAe5G;;;;;;;OAOG;IACa,IAAI,CAAC,OAAO,EAAE,aAAa,GAAG,YAAY,CAAC,SAAS,CAAC;IAUrE;;;;;OAKG;IACU,WAAW,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAa9F;;;;;;OAMG;IACU,QAAQ,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAgBtF;;;;;OAKG;IACU,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,yBAAyB,GAAG,OAAO,CAAC,eAAe,CAAC;IASlG,sCAAsC;IACtC,IAAW,OAAO,6BAEjB;IAED,uDAAuD;IACvD,IAAW,cAAc,4BAExB;IAED;;;;OAIG;IACI,IAAI,CAAC,EACV,aAAkB,EAClB,QAAa,GACd,EAAE;QACD,iDAAiD;QACjD,aAAa,CAAC,EAAE,WAAW,EAAE,CAAC;QAC9B,4CAA4C;QAC5C,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;KACtB,GAAG,YAAY;CAYjB"}
|
|
@@ -39,7 +39,9 @@ import { toProfileOptions, toSendOptions, toSimulateOptions } from './interactio
|
|
|
39
39
|
* @returns The execution payload for this operation
|
|
40
40
|
*/ async request(options) {
|
|
41
41
|
const publication = await this.getPublicationExecutionPayload(options);
|
|
42
|
-
|
|
42
|
+
if (!options?.skipRegistration) {
|
|
43
|
+
await this.wallet.registerContract(await this.getInstance(options), this.artifact);
|
|
44
|
+
}
|
|
43
45
|
const initialization = await this.getInitializationExecutionPayload(options);
|
|
44
46
|
const feeExecutionPayload = options?.fee?.paymentMethod ? await options.fee.paymentMethod.getExecutionPayload() : undefined;
|
|
45
47
|
const finalExecutionPayload = feeExecutionPayload ? mergeExecutionPayloads([
|
|
@@ -67,7 +69,7 @@ import { toProfileOptions, toSendOptions, toSimulateOptions } from './interactio
|
|
|
67
69
|
*/ async register(options) {
|
|
68
70
|
const instance = await this.getInstance(options);
|
|
69
71
|
await this.wallet.registerContract(instance, this.artifact);
|
|
70
|
-
return this.postDeployCtor(instance
|
|
72
|
+
return this.postDeployCtor(instance, this.wallet);
|
|
71
73
|
}
|
|
72
74
|
/**
|
|
73
75
|
* Returns an execution payload for:
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { FieldsOf } from '@aztec/foundation/types';
|
|
2
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
2
|
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
4
3
|
import type { TxHash, TxReceipt } from '@aztec/stdlib/tx';
|
|
5
4
|
import type { Wallet } from '../wallet/wallet.js';
|
|
6
|
-
import type { Contract } from './contract.js';
|
|
7
5
|
import type { ContractBase } from './contract_base.js';
|
|
8
6
|
import { SentTx, type WaitOpts } from './sent_tx.js';
|
|
9
7
|
/** Options related to waiting for a deployment tx. */
|
|
@@ -12,21 +10,28 @@ export type DeployedWaitOpts = WaitOpts & {
|
|
|
12
10
|
wallet?: Wallet;
|
|
13
11
|
};
|
|
14
12
|
/** Extends a transaction receipt with a contract instance that represents the newly deployed contract. */
|
|
15
|
-
export type DeployTxReceipt<TContract extends ContractBase =
|
|
13
|
+
export type DeployTxReceipt<TContract extends ContractBase = ContractBase> = FieldsOf<TxReceipt> & {
|
|
16
14
|
/** Instance of the newly deployed contract. */
|
|
17
15
|
contract: TContract;
|
|
16
|
+
/** The deployed contract instance with address and metadata. */
|
|
17
|
+
instance: ContractInstanceWithAddress;
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
20
|
* A contract deployment transaction sent to the network, extending SentTx with methods to publish a contract instance.
|
|
21
21
|
*/
|
|
22
|
-
export declare class DeploySentTx<TContract extends
|
|
22
|
+
export declare class DeploySentTx<TContract extends ContractBase = ContractBase> extends SentTx {
|
|
23
23
|
private postDeployCtor;
|
|
24
24
|
/** A getter for the deployed contract instance */
|
|
25
|
-
instanceGetter
|
|
25
|
+
private instanceGetter;
|
|
26
26
|
private log;
|
|
27
|
-
constructor(wallet: Wallet, sendTx: () => Promise<TxHash>, postDeployCtor: (
|
|
27
|
+
constructor(wallet: Wallet, sendTx: () => Promise<TxHash>, postDeployCtor: (instance: ContractInstanceWithAddress, wallet: Wallet) => TContract,
|
|
28
28
|
/** A getter for the deployed contract instance */
|
|
29
29
|
instanceGetter: () => Promise<ContractInstanceWithAddress>);
|
|
30
|
+
/**
|
|
31
|
+
* Returns the contract instance for this deployment.
|
|
32
|
+
* @returns The deployed contract instance with address and metadata.
|
|
33
|
+
*/
|
|
34
|
+
getInstance(): Promise<ContractInstanceWithAddress>;
|
|
30
35
|
/**
|
|
31
36
|
* Awaits for the tx to be mined and returns the contract instance. Throws if tx is not mined.
|
|
32
37
|
* @param opts - Options for configuring the waiting for the tx to be mined.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy_sent_tx.d.ts","sourceRoot":"","sources":["../../src/contract/deploy_sent_tx.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"deploy_sent_tx.d.ts","sourceRoot":"","sources":["../../src/contract/deploy_sent_tx.ts"],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AC,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC;IAMlE;;;;OAIG;IACmB,IAAI,CAAC,IAAI,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;CAWzF"}
|
|
@@ -10,13 +10,18 @@ import { SentTx } from './sent_tx.js';
|
|
|
10
10
|
super(wallet, sendTx), this.postDeployCtor = postDeployCtor, this.instanceGetter = instanceGetter, this.log = createLogger('aztecjs:deploy_sent_tx');
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
+
* Returns the contract instance for this deployment.
|
|
14
|
+
* @returns The deployed contract instance with address and metadata.
|
|
15
|
+
*/ async getInstance() {
|
|
16
|
+
return await this.instanceGetter();
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
13
19
|
* Awaits for the tx to be mined and returns the contract instance. Throws if tx is not mined.
|
|
14
20
|
* @param opts - Options for configuring the waiting for the tx to be mined.
|
|
15
21
|
* @returns The deployed contract instance.
|
|
16
22
|
*/ async deployed(opts) {
|
|
17
23
|
const receipt = await this.wait(opts);
|
|
18
|
-
|
|
19
|
-
this.log.info(`Contract ${instance.address.toString()} successfully deployed.`);
|
|
24
|
+
this.log.info(`Contract ${receipt.instance.address.toString()} successfully deployed.`);
|
|
20
25
|
return receipt.contract;
|
|
21
26
|
}
|
|
22
27
|
/**
|
|
@@ -31,10 +36,11 @@ import { SentTx } from './sent_tx.js';
|
|
|
31
36
|
throw new Error(`A wallet is required for creating a contract instance`);
|
|
32
37
|
}
|
|
33
38
|
const instance = await this.instanceGetter();
|
|
34
|
-
const contract =
|
|
39
|
+
const contract = this.postDeployCtor(instance, contractWallet);
|
|
35
40
|
return {
|
|
36
41
|
...receipt,
|
|
37
|
-
contract
|
|
42
|
+
contract,
|
|
43
|
+
instance
|
|
38
44
|
};
|
|
39
45
|
}
|
|
40
46
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ContractBase } from './contract_base.js';
|
|
2
2
|
/** Unsafe constructor for ContractBase that bypasses the check that the instance is registered in the wallet. */ export class UnsafeContract extends ContractBase {
|
|
3
3
|
constructor(/** The deployed contract instance definition. */ instance, /** The Application Binary Interface for the contract. */ artifact, /** The wallet used for interacting with this contract. */ wallet){
|
|
4
|
-
super(instance, artifact, wallet);
|
|
4
|
+
super(instance.address, artifact, wallet);
|
|
5
5
|
}
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract_deployer.d.ts","sourceRoot":"","sources":["../../src/deployment/contract_deployer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD;;;GAGG;AACH,qBAAa,gBAAgB;IAEzB,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,UAAU,CAAC;IACnB,OAAO,CAAC,eAAe,CAAC;gBAHhB,QAAQ,EAAE,gBAAgB,EAC1B,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,UAAU,YAAA,EACvB,eAAe,CAAC,EAAE,MAAM,YAAA;IAGlC;;;;;;;;OAQG;IACI,MAAM,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;
|
|
1
|
+
{"version":3,"file":"contract_deployer.d.ts","sourceRoot":"","sources":["../../src/deployment/contract_deployer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD;;;GAGG;AACH,qBAAa,gBAAgB;IAEzB,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,UAAU,CAAC;IACnB,OAAO,CAAC,eAAe,CAAC;gBAHhB,QAAQ,EAAE,gBAAgB,EAC1B,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,UAAU,YAAA,EACvB,eAAe,CAAC,EAAE,MAAM,YAAA;IAGlC;;;;;;;;OAQG;IACI,MAAM,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;CAY7B"}
|
|
@@ -24,7 +24,7 @@ import { DeployMethod } from '../contract/deploy_method.js';
|
|
|
24
24
|
* @param args - The constructor arguments for the contract being deployed.
|
|
25
25
|
* @returns A DeployMethod instance configured with the ABI, PXE, and constructor arguments.
|
|
26
26
|
*/ deploy(...args) {
|
|
27
|
-
const postDeployCtor = (
|
|
27
|
+
const postDeployCtor = (instance, wallet)=>Contract.at(instance.address, this.artifact, wallet);
|
|
28
28
|
return new DeployMethod(this.publicKeys ?? PublicKeys.default(), this.wallet, this.artifact, postDeployCtor, args, this.constructorName);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -103,7 +103,7 @@ import { DeployAccountMethod } from './deploy_account_method.js';
|
|
|
103
103
|
constructorName: undefined,
|
|
104
104
|
constructorArgs: undefined
|
|
105
105
|
};
|
|
106
|
-
return new DeployAccountMethod(this.getPublicKeys(), this.wallet, artifact, (
|
|
106
|
+
return new DeployAccountMethod(this.getPublicKeys(), this.wallet, artifact, (instance)=>Contract.at(instance.address, artifact, this.wallet), new Fr(this.salt), constructorArgs, constructorName);
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
109
109
|
* Returns whether this account contract has an initializer function.
|
|
@@ -5,7 +5,7 @@ import type { FieldsOf } from '@aztec/foundation/types';
|
|
|
5
5
|
import { type ContractArtifact, type EventMetadataDefinition, type FunctionCall } from '@aztec/stdlib/abi';
|
|
6
6
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
7
7
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
8
|
-
import { type ContractClassMetadata, type ContractInstanceWithAddress, type
|
|
8
|
+
import { type ContractClassMetadata, type ContractInstanceWithAddress, type ContractMetadata } from '@aztec/stdlib/contract';
|
|
9
9
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
10
10
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
11
11
|
import type { TxExecutionRequest, TxHash, TxProfileResult, TxReceipt, TxSimulationResult, UtilitySimulationResult } from '@aztec/stdlib/tx';
|
|
@@ -13,7 +13,7 @@ import { ExecutionPayload } from '@aztec/stdlib/tx';
|
|
|
13
13
|
import type { Account } from '../account/account.js';
|
|
14
14
|
import type { FeePaymentMethod } from '../fee/fee_payment_method.js';
|
|
15
15
|
import type { CallIntent, IntentInnerHash } from '../utils/authwit.js';
|
|
16
|
-
import type { Aliased, BatchResults, BatchableMethods, BatchedMethod,
|
|
16
|
+
import type { Aliased, BatchResults, BatchableMethods, BatchedMethod, ProfileOptions, SendOptions, SimulateOptions, Wallet } from './wallet.js';
|
|
17
17
|
/**
|
|
18
18
|
* Options to configure fee payment for a transaction
|
|
19
19
|
*/
|
|
@@ -79,12 +79,12 @@ export declare abstract class BaseWallet implements Wallet {
|
|
|
79
79
|
accountFeePaymentMethodOptions: AccountFeePaymentMethodOptions;
|
|
80
80
|
}>;
|
|
81
81
|
registerSender(address: AztecAddress, _alias?: string): Promise<AztecAddress>;
|
|
82
|
-
registerContract(
|
|
82
|
+
registerContract(instance: ContractInstanceWithAddress, artifact?: ContractArtifact, secretKey?: Fr): Promise<ContractInstanceWithAddress>;
|
|
83
83
|
simulateTx(executionPayload: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
|
|
84
84
|
profileTx(executionPayload: ExecutionPayload, opts: ProfileOptions): Promise<TxProfileResult>;
|
|
85
85
|
sendTx(executionPayload: ExecutionPayload, opts: SendOptions): Promise<TxHash>;
|
|
86
86
|
protected contextualizeError(err: Error, ...context: string[]): Error;
|
|
87
|
-
simulateUtility(call: FunctionCall, authwits?: AuthWitness[]
|
|
87
|
+
simulateUtility(call: FunctionCall, authwits?: AuthWitness[]): Promise<UtilitySimulationResult>;
|
|
88
88
|
getContractClassMetadata(id: Fr, includeArtifact?: boolean): Promise<ContractClassMetadata>;
|
|
89
89
|
getContractMetadata(address: AztecAddress): Promise<ContractMetadata>;
|
|
90
90
|
getTxReceipt(txHash: TxHash): Promise<TxReceipt>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base_wallet.d.ts","sourceRoot":"","sources":["../../src/wallet/base_wallet.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,8BAA8B,EAAwC,MAAM,4BAA4B,CAAC;AAClH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,YAAY,EAElB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,KAAK,
|
|
1
|
+
{"version":3,"file":"base_wallet.d.ts","sourceRoot":"","sources":["../../src/wallet/base_wallet.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,8BAA8B,EAAwC,MAAM,4BAA4B,CAAC;AAClH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;A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B,EACjC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,UAAU,GAAE,YAAY,EAAO,GAC9B,OAAO,CAAC,CAAC,EAAE,CAAC;CAShB"}
|
|
@@ -3,7 +3,7 @@ import { AccountFeePaymentMethodOptions } from '@aztec/entrypoints/account';
|
|
|
3
3
|
import { Fr } from '@aztec/foundation/fields';
|
|
4
4
|
import { createLogger } from '@aztec/foundation/log';
|
|
5
5
|
import { decodeFromAbi } from '@aztec/stdlib/abi';
|
|
6
|
-
import { computePartialAddress, getContractClassFromArtifact
|
|
6
|
+
import { computePartialAddress, getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
7
7
|
import { SimulationError } from '@aztec/stdlib/errors';
|
|
8
8
|
import { Gas, GasSettings } from '@aztec/stdlib/gas';
|
|
9
9
|
import { mergeExecutionPayloads } from '@aztec/stdlib/tx';
|
|
@@ -133,50 +133,33 @@ import { inspect } from 'util';
|
|
|
133
133
|
registerSender(address, _alias = '') {
|
|
134
134
|
return this.pxe.registerSender(address);
|
|
135
135
|
}
|
|
136
|
-
async registerContract(
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
instance = instanceData;
|
|
152
|
-
await this.pxe.registerContract({
|
|
153
|
-
artifact,
|
|
154
|
-
instance
|
|
155
|
-
});
|
|
156
|
-
} else if (isContractInstantiationData(instanceData)) {
|
|
136
|
+
async registerContract(instance, artifact, secretKey) {
|
|
137
|
+
const { contractInstance: existingInstance } = await this.pxe.getContractMetadata(instance.address);
|
|
138
|
+
if (existingInstance) {
|
|
139
|
+
// Instance already registered in the wallet
|
|
140
|
+
if (artifact) {
|
|
141
|
+
const thisContractClass = await getContractClassFromArtifact(artifact);
|
|
142
|
+
if (!thisContractClass.id.equals(existingInstance.currentContractClassId)) {
|
|
143
|
+
// wallet holds an outdated version of this contract
|
|
144
|
+
await this.pxe.updateContract(instance.address, artifact);
|
|
145
|
+
instance.currentContractClassId = thisContractClass.id;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
// If no artifact provided, we just use the existing registration
|
|
149
|
+
} else {
|
|
150
|
+
// Instance not registered yet
|
|
157
151
|
if (!artifact) {
|
|
158
|
-
|
|
152
|
+
// Try to get the artifact from the wallet's contract class storage
|
|
153
|
+
const classMetadata = await this.pxe.getContractClassMetadata(instance.currentContractClassId, true);
|
|
154
|
+
if (!classMetadata.artifact) {
|
|
155
|
+
throw new Error(`Cannot register contract at ${instance.address.toString()}: artifact is required but not provided, and wallet does not have the artifact for contract class ${instance.currentContractClassId.toString()}`);
|
|
156
|
+
}
|
|
157
|
+
artifact = classMetadata.artifact;
|
|
159
158
|
}
|
|
160
|
-
instance = await getContractInstanceFromInstantiationParams(artifact, instanceData);
|
|
161
159
|
await this.pxe.registerContract({
|
|
162
160
|
artifact,
|
|
163
161
|
instance
|
|
164
162
|
});
|
|
165
|
-
} else {
|
|
166
|
-
if (!artifact) {
|
|
167
|
-
throw new Error(`Contract artifact must be provided when registering a contract using an address`);
|
|
168
|
-
}
|
|
169
|
-
const { contractInstance: maybeContractInstance } = await this.pxe.getContractMetadata(instanceData);
|
|
170
|
-
if (!maybeContractInstance) {
|
|
171
|
-
throw new Error(`Contract instance at ${instanceData.toString()} has not been registered in the wallet's PXE`);
|
|
172
|
-
}
|
|
173
|
-
instance = maybeContractInstance;
|
|
174
|
-
const thisContractClass = await getContractClassFromArtifact(artifact);
|
|
175
|
-
if (!thisContractClass.id.equals(instance.currentContractClassId)) {
|
|
176
|
-
// wallet holds an outdated version of this contract
|
|
177
|
-
await this.pxe.updateContract(instance.address, artifact);
|
|
178
|
-
instance.currentContractClassId = thisContractClass.id;
|
|
179
|
-
}
|
|
180
163
|
}
|
|
181
164
|
if (secretKey) {
|
|
182
165
|
await this.pxe.registerAccount(secretKey, await computePartialAddress(instance));
|
|
@@ -222,8 +205,8 @@ import { inspect } from 'util';
|
|
|
222
205
|
}
|
|
223
206
|
return err;
|
|
224
207
|
}
|
|
225
|
-
simulateUtility(call, authwits
|
|
226
|
-
return this.pxe.simulateUtility(call, authwits
|
|
208
|
+
simulateUtility(call, authwits) {
|
|
209
|
+
return this.pxe.simulateUtility(call, authwits);
|
|
227
210
|
}
|
|
228
211
|
getContractClassMetadata(id, includeArtifact = false) {
|
|
229
212
|
return this.pxe.getContractClassMetadata(id, includeArtifact);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/fields';
|
|
2
2
|
import type { ContractArtifact, FunctionArtifact } from '@aztec/stdlib/abi';
|
|
3
|
-
import {
|
|
3
|
+
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
4
4
|
import type { PublicKeys } from '@aztec/stdlib/keys';
|
|
5
5
|
import { ExecutionPayload } from '@aztec/stdlib/tx';
|
|
6
6
|
import type { Contract } from '../contract/contract.js';
|
|
@@ -29,7 +29,7 @@ export type SimulateDeployAccountOptions = Omit<SimulateDeployOptions, 'contract
|
|
|
29
29
|
*/
|
|
30
30
|
export declare class DeployAccountMethod<TContract extends ContractBase = Contract> extends DeployMethod<TContract> {
|
|
31
31
|
private salt;
|
|
32
|
-
constructor(publicKeys: PublicKeys, wallet: Wallet, artifact: ContractArtifact, postDeployCtor: (
|
|
32
|
+
constructor(publicKeys: PublicKeys, wallet: Wallet, artifact: ContractArtifact, postDeployCtor: (instance: ContractInstanceWithAddress, wallet: Wallet) => TContract, salt: Fr, args?: any[], constructorNameOrArtifact?: string | FunctionArtifact);
|
|
33
33
|
/**
|
|
34
34
|
* Returns a FeePaymentMethod that routes the original one provided as an argument
|
|
35
35
|
* through the account's entrypoint. This allows an account contract to pay
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy_account_method.d.ts","sourceRoot":"","sources":["../../src/wallet/deploy_account_method.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