@aztec/aztec.js 0.41.0 → 0.42.0
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/account/index.d.ts +2 -2
- package/dest/account/index.d.ts.map +1 -1
- package/dest/account_manager/deploy_account_method.d.ts.map +1 -1
- package/dest/account_manager/deploy_account_method.js +7 -5
- package/dest/account_manager/index.d.ts +1 -1
- package/dest/account_manager/index.d.ts.map +1 -1
- package/dest/account_manager/index.js +2 -1
- package/dest/api/abi.d.ts +2 -2
- package/dest/api/abi.d.ts.map +1 -1
- package/dest/api/abi.js +1 -1
- package/dest/api/fee.d.ts +2 -0
- package/dest/api/fee.d.ts.map +1 -1
- package/dest/api/fee.js +3 -1
- package/dest/contract/base_contract_interaction.d.ts +7 -6
- package/dest/contract/base_contract_interaction.d.ts.map +1 -1
- package/dest/contract/base_contract_interaction.js +20 -9
- package/dest/contract/batch_call.d.ts +11 -0
- package/dest/contract/batch_call.d.ts.map +1 -1
- package/dest/contract/batch_call.js +50 -2
- package/dest/contract/contract_function_interaction.d.ts.map +1 -1
- package/dest/contract/contract_function_interaction.js +14 -10
- package/dest/contract/deploy_method.d.ts +5 -1
- package/dest/contract/deploy_method.d.ts.map +1 -1
- package/dest/contract/deploy_method.js +22 -6
- package/dest/contract/get_gas_limits.d.ts +1 -1
- package/dest/contract/get_gas_limits.d.ts.map +1 -1
- package/dest/contract/get_gas_limits.js +5 -3
- package/dest/contract/sent_tx.js +2 -2
- package/dest/entrypoint/default_entrypoint.d.ts.map +1 -1
- package/dest/entrypoint/default_entrypoint.js +6 -2
- package/dest/entrypoint/default_multi_call_entrypoint.d.ts.map +1 -1
- package/dest/entrypoint/default_multi_call_entrypoint.js +4 -4
- package/dest/entrypoint/payload.d.ts +24 -9
- package/dest/entrypoint/payload.d.ts.map +1 -1
- package/dest/entrypoint/payload.js +50 -29
- package/dest/fee/fee_payment_method.d.ts +6 -7
- package/dest/fee/fee_payment_method.d.ts.map +1 -1
- package/dest/fee/native_fee_payment_method.d.ts +5 -25
- package/dest/fee/native_fee_payment_method.d.ts.map +1 -1
- package/dest/fee/native_fee_payment_method.js +9 -46
- package/dest/fee/native_fee_payment_method_with_claim.d.ts +17 -0
- package/dest/fee/native_fee_payment_method_with_claim.d.ts.map +1 -0
- package/dest/fee/native_fee_payment_method_with_claim.js +32 -0
- package/dest/fee/no_fee_payment_method.d.ts +13 -0
- package/dest/fee/no_fee_payment_method.d.ts.map +1 -0
- package/dest/fee/no_fee_payment_method.js +17 -0
- package/dest/fee/private_fee_payment_method.d.ts +1 -5
- package/dest/fee/private_fee_payment_method.d.ts.map +1 -1
- package/dest/fee/private_fee_payment_method.js +13 -14
- package/dest/fee/public_fee_payment_method.d.ts +1 -5
- package/dest/fee/public_fee_payment_method.d.ts.map +1 -1
- package/dest/fee/public_fee_payment_method.js +13 -14
- package/dest/index.d.ts +11 -12
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +10 -11
- package/dest/rpc_clients/pxe_client.js +3 -3
- package/dest/utils/authwit.d.ts.map +1 -1
- package/dest/utils/authwit.js +2 -6
- package/dest/utils/cheat_codes.js +3 -3
- package/dest/wallet/base_wallet.d.ts +6 -1
- package/dest/wallet/base_wallet.d.ts.map +1 -1
- package/dest/wallet/base_wallet.js +7 -1
- package/dest/wallet/signerless_wallet.js +7 -7
- package/package.json +7 -7
- package/src/account/index.ts +2 -2
- package/src/account_manager/deploy_account_method.ts +10 -3
- package/src/account_manager/index.ts +5 -1
- package/src/api/abi.ts +2 -2
- package/src/api/fee.ts +2 -0
- package/src/contract/base_contract_interaction.ts +32 -8
- package/src/contract/batch_call.ts +77 -1
- package/src/contract/contract_function_interaction.ts +20 -10
- package/src/contract/deploy_method.ts +23 -6
- package/src/contract/get_gas_limits.ts +4 -3
- package/src/contract/sent_tx.ts +1 -1
- package/src/entrypoint/default_entrypoint.ts +7 -1
- package/src/entrypoint/default_multi_call_entrypoint.ts +3 -3
- package/src/entrypoint/payload.ts +58 -26
- package/src/fee/fee_payment_method.ts +6 -8
- package/src/fee/native_fee_payment_method.ts +8 -47
- package/src/fee/native_fee_payment_method_with_claim.ts +33 -0
- package/src/fee/no_fee_payment_method.ts +23 -0
- package/src/fee/private_fee_payment_method.ts +13 -17
- package/src/fee/public_fee_payment_method.ts +13 -18
- package/src/index.ts +34 -33
- package/src/rpc_clients/pxe_client.ts +2 -2
- package/src/utils/authwit.ts +1 -5
- package/src/utils/cheat_codes.ts +3 -3
- package/src/wallet/base_wallet.ts +8 -0
- package/src/wallet/signerless_wallet.ts +6 -6
|
@@ -99,6 +99,9 @@ export class BaseWallet {
|
|
|
99
99
|
getSyncStatus() {
|
|
100
100
|
return this.pxe.getSyncStatus();
|
|
101
101
|
}
|
|
102
|
+
getSyncStats() {
|
|
103
|
+
return this.pxe.getSyncStats();
|
|
104
|
+
}
|
|
102
105
|
addAuthWitness(authWitness) {
|
|
103
106
|
return this.pxe.addAuthWitness(authWitness);
|
|
104
107
|
}
|
|
@@ -111,5 +114,8 @@ export class BaseWallet {
|
|
|
111
114
|
isContractPubliclyDeployed(address) {
|
|
112
115
|
return this.pxe.isContractPubliclyDeployed(address);
|
|
113
116
|
}
|
|
117
|
+
getPXEInfo() {
|
|
118
|
+
return this.pxe.getPXEInfo();
|
|
119
|
+
}
|
|
114
120
|
}
|
|
115
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
121
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmFzZV93YWxsZXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvd2FsbGV0L2Jhc2Vfd2FsbGV0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQTRCQTs7R0FFRztBQUNILE1BQU0sT0FBZ0IsVUFBVTtJQUM5QixZQUErQixHQUFRO1FBQVIsUUFBRyxHQUFILEdBQUcsQ0FBSztJQUFHLENBQUM7SUE0QjNDLFVBQVU7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wQixDQUFDLE9BQXFCO1FBQzlDLE9BQU8sSUFBSSxDQUFDLEdBQUcsQ0FBQywwQkFBMEIsQ0FBQyxPQUFPLENBQUMsQ0FBQztJQUN0RCxDQUFDO0lBQ0QsVUFBVTtRQUNSLE9BQU8sSUFBSSxDQUFDLEdBQUcsQ0FBQyxVQUFVLEVBQUUsQ0FBQztJQUMvQixDQUFDO0NBQ0YifQ==
|
|
@@ -17,22 +17,22 @@ export class SignerlessWallet extends BaseWallet {
|
|
|
17
17
|
return entrypoint.createTxExecutionRequest(execution);
|
|
18
18
|
}
|
|
19
19
|
getChainId() {
|
|
20
|
-
throw new Error('Method not implemented.');
|
|
20
|
+
throw new Error('SignerlessWallet: Method getChainId not implemented.');
|
|
21
21
|
}
|
|
22
22
|
getVersion() {
|
|
23
|
-
throw new Error('Method not implemented.');
|
|
23
|
+
throw new Error('SignerlessWallet: Method getVersion not implemented.');
|
|
24
24
|
}
|
|
25
25
|
getPublicKeysHash() {
|
|
26
|
-
throw new Error('Method not implemented.');
|
|
26
|
+
throw new Error('SignerlessWallet: Method getPublicKeysHash not implemented.');
|
|
27
27
|
}
|
|
28
28
|
getCompleteAddress() {
|
|
29
|
-
throw new Error('Method not implemented.');
|
|
29
|
+
throw new Error('SignerlessWallet: Method getCompleteAddress not implemented.');
|
|
30
30
|
}
|
|
31
31
|
createAuthWit(_messageHash) {
|
|
32
|
-
throw new Error('Method not implemented.');
|
|
32
|
+
throw new Error('SignerlessWallet: Method createAuthWit not implemented.');
|
|
33
33
|
}
|
|
34
34
|
rotateNullifierKeys(_newNskM) {
|
|
35
|
-
throw new Error('Method not implemented.');
|
|
35
|
+
throw new Error('SignerlessWallet: Method rotateNullifierKeys not implemented.');
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
38
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2lnbmVybGVzc193YWxsZXQuanMiLCJzb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QTZELENBQUMsQ0FBQztJQUNqRixDQUFDO0lBRUQsa0JBQWtCO1FBQ2hCLE1BQU0sSUFBSSxLQUFLLENBQUMsOERBQThELENBQUMsQ0FBQztJQUNsRixDQUFDO0lBRUQsYUFBYSxDQUFDLFlBQWdCO1FBQzVCLE1BQU0sSUFBSSxLQUFLLENBQUMseURBQXlELENBQUMsQ0FBQztJQUM3RSxDQUFDO0lBRUQsbUJBQW1CLENBQUMsUUFBWTtRQUM5QixNQUFNLElBQUksS0FBSyxDQUFDLCtEQUErRCxDQUFDLENBQUM7SUFDbkYsQ0FBQztDQUNGIn0=
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/aztec.js",
|
|
3
3
|
"homepage": "https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/aztec.js",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.42.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": "./dest/index.js",
|
|
@@ -65,12 +65,12 @@
|
|
|
65
65
|
]
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@aztec/circuit-types": "0.
|
|
69
|
-
"@aztec/circuits.js": "0.
|
|
70
|
-
"@aztec/ethereum": "0.
|
|
71
|
-
"@aztec/foundation": "0.
|
|
72
|
-
"@aztec/protocol-contracts": "0.
|
|
73
|
-
"@aztec/types": "0.
|
|
68
|
+
"@aztec/circuit-types": "0.42.0",
|
|
69
|
+
"@aztec/circuits.js": "0.42.0",
|
|
70
|
+
"@aztec/ethereum": "0.42.0",
|
|
71
|
+
"@aztec/foundation": "0.42.0",
|
|
72
|
+
"@aztec/protocol-contracts": "0.42.0",
|
|
73
|
+
"@aztec/types": "0.42.0",
|
|
74
74
|
"tslib": "^2.4.0"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
package/src/account/index.ts
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { type Fr } from '@aztec/circuits.js';
|
|
10
10
|
|
|
11
|
-
export { AccountContract } from './contract.js';
|
|
12
|
-
export { AccountInterface, AuthWitnessProvider } from './interface.js';
|
|
11
|
+
export { type AccountContract } from './contract.js';
|
|
12
|
+
export { type AccountInterface, type AuthWitnessProvider } from './interface.js';
|
|
13
13
|
export * from './wallet.js';
|
|
14
14
|
|
|
15
15
|
/** A contract deployment salt. */
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { type Fr
|
|
1
|
+
import { type Fr } from '@aztec/circuits.js';
|
|
2
2
|
import {
|
|
3
3
|
type ContractArtifact,
|
|
4
4
|
type FunctionArtifact,
|
|
5
|
+
FunctionSelector,
|
|
5
6
|
encodeArguments,
|
|
6
7
|
getFunctionArtifact,
|
|
7
8
|
} from '@aztec/foundation/abi';
|
|
@@ -51,13 +52,19 @@ export class DeployAccountMethod extends DeployMethod {
|
|
|
51
52
|
if (options.fee && this.#feePaymentArtifact) {
|
|
52
53
|
const { address } = this.getInstance();
|
|
53
54
|
const emptyAppPayload = EntrypointPayload.fromAppExecution([]);
|
|
54
|
-
const feePayload = await EntrypointPayload.fromFeeOptions(options?.fee);
|
|
55
|
+
const feePayload = await EntrypointPayload.fromFeeOptions(address, options?.fee);
|
|
55
56
|
|
|
56
57
|
exec.calls.push({
|
|
58
|
+
name: this.#feePaymentArtifact.name,
|
|
57
59
|
to: address,
|
|
58
60
|
args: encodeArguments(this.#feePaymentArtifact, [emptyAppPayload, feePayload]),
|
|
59
|
-
|
|
61
|
+
selector: FunctionSelector.fromNameAndParameters(
|
|
62
|
+
this.#feePaymentArtifact.name,
|
|
63
|
+
this.#feePaymentArtifact.parameters,
|
|
64
|
+
),
|
|
65
|
+
type: this.#feePaymentArtifact.functionType,
|
|
60
66
|
isStatic: this.#feePaymentArtifact.isStatic,
|
|
67
|
+
returnTypes: this.#feePaymentArtifact.returnTypes,
|
|
61
68
|
});
|
|
62
69
|
|
|
63
70
|
exec.authWitnesses ??= [];
|
|
@@ -17,7 +17,10 @@ import { DeployAccountSentTx } from './deploy_account_sent_tx.js';
|
|
|
17
17
|
/**
|
|
18
18
|
* Options to deploy an account contract.
|
|
19
19
|
*/
|
|
20
|
-
export type DeployAccountOptions = Pick<
|
|
20
|
+
export type DeployAccountOptions = Pick<
|
|
21
|
+
DeployOptions,
|
|
22
|
+
'fee' | 'skipClassRegistration' | 'skipPublicDeployment' | 'estimateGas'
|
|
23
|
+
>;
|
|
21
24
|
|
|
22
25
|
/**
|
|
23
26
|
* Manages a user account. Provides methods for calculating the account's address, deploying the account contract,
|
|
@@ -163,6 +166,7 @@ export class AccountManager {
|
|
|
163
166
|
skipInitialization: false,
|
|
164
167
|
universalDeploy: true,
|
|
165
168
|
fee: opts?.fee,
|
|
169
|
+
estimateGas: opts?.estimateGas,
|
|
166
170
|
}),
|
|
167
171
|
)
|
|
168
172
|
.then(tx => tx.getTxHash());
|
package/src/api/abi.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { ContractArtifact, FunctionArtifact, FunctionSelector } from '@aztec/foundation/abi';
|
|
1
|
+
export { type ContractArtifact, type FunctionArtifact, FunctionSelector } from '@aztec/foundation/abi';
|
|
2
2
|
export { loadContractArtifact, contractArtifactToBuffer, contractArtifactFromBuffer } from '@aztec/types/abi';
|
|
3
|
-
export { NoirCompiledContract } from '@aztec/types/noir';
|
|
3
|
+
export { type NoirCompiledContract } from '@aztec/types/noir';
|
package/src/api/fee.ts
CHANGED
|
@@ -2,3 +2,5 @@ export type { FeePaymentMethod } from '../fee/fee_payment_method.js';
|
|
|
2
2
|
export { NativeFeePaymentMethod } from '../fee/native_fee_payment_method.js';
|
|
3
3
|
export { PrivateFeePaymentMethod } from '../fee/private_fee_payment_method.js';
|
|
4
4
|
export { PublicFeePaymentMethod } from '../fee/public_fee_payment_method.js';
|
|
5
|
+
export { NativeFeePaymentMethodWithClaim } from '../fee/native_fee_payment_method_with_claim.js';
|
|
6
|
+
export { NoFeePaymentMethod } from '../fee/no_fee_payment_method.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Tx, type TxExecutionRequest } from '@aztec/circuit-types';
|
|
2
2
|
import { GasSettings } from '@aztec/circuits.js';
|
|
3
|
+
import { createDebugLogger } from '@aztec/foundation/log';
|
|
3
4
|
|
|
4
5
|
import { type Wallet } from '../account/wallet.js';
|
|
5
6
|
import { type ExecutionRequestInit, type FeeOptions } from '../entrypoint/entrypoint.js';
|
|
@@ -27,6 +28,8 @@ export abstract class BaseContractInteraction {
|
|
|
27
28
|
protected tx?: Tx;
|
|
28
29
|
protected txRequest?: TxExecutionRequest;
|
|
29
30
|
|
|
31
|
+
protected log = createDebugLogger('aztec:js:contract_interaction');
|
|
32
|
+
|
|
30
33
|
constructor(protected wallet: Wallet) {}
|
|
31
34
|
|
|
32
35
|
/**
|
|
@@ -66,14 +69,28 @@ export abstract class BaseContractInteraction {
|
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
/**
|
|
69
|
-
* Estimates gas for a given tx request and returns
|
|
70
|
-
* @param
|
|
71
|
-
* @returns Gas
|
|
72
|
+
* Estimates gas for a given tx request and returns gas limits for it.
|
|
73
|
+
* @param opts - Options.
|
|
74
|
+
* @returns Gas limits.
|
|
72
75
|
*/
|
|
73
|
-
|
|
76
|
+
public async estimateGas(
|
|
77
|
+
opts?: Omit<SendMethodOptions, 'estimateGas' | 'skipPublicSimulation'>,
|
|
78
|
+
): Promise<Pick<GasSettings, 'gasLimits' | 'teardownGasLimits'>> {
|
|
79
|
+
// REFACTOR: both `this.txRequest = undefined` below are horrible, we should not be caching stuff that doesn't need to be.
|
|
80
|
+
// This also hints at a weird interface for create/request/estimate/send etc.
|
|
81
|
+
|
|
82
|
+
// Ensure we don't accidentally use a version of tx request that has estimateGas set to true, leading to an infinite loop.
|
|
83
|
+
this.txRequest = undefined;
|
|
84
|
+
const txRequest = await this.create({ ...opts, estimateGas: false });
|
|
85
|
+
// Ensure we don't accidentally cache a version of tx request that has estimateGas forcefully set to false.
|
|
86
|
+
this.txRequest = undefined;
|
|
87
|
+
|
|
74
88
|
const simulationResult = await this.wallet.simulateTx(txRequest, true);
|
|
75
|
-
const { totalGas: gasLimits, teardownGas: teardownGasLimits } = getGasLimits(
|
|
76
|
-
|
|
89
|
+
const { totalGas: gasLimits, teardownGas: teardownGasLimits } = getGasLimits(
|
|
90
|
+
simulationResult,
|
|
91
|
+
(opts?.fee?.gasSettings ?? GasSettings.default()).teardownGasLimits,
|
|
92
|
+
);
|
|
93
|
+
return { gasLimits, teardownGasLimits };
|
|
77
94
|
}
|
|
78
95
|
|
|
79
96
|
/**
|
|
@@ -81,11 +98,18 @@ export abstract class BaseContractInteraction {
|
|
|
81
98
|
* @param request - Request to execute for this interaction.
|
|
82
99
|
* @returns Fee options for the actual transaction.
|
|
83
100
|
*/
|
|
84
|
-
protected async
|
|
101
|
+
protected async getFeeOptionsFromEstimatedGas(request: ExecutionRequestInit) {
|
|
85
102
|
const fee = request.fee;
|
|
86
103
|
if (fee) {
|
|
87
104
|
const txRequest = await this.wallet.createTxExecutionRequest(request);
|
|
88
|
-
const
|
|
105
|
+
const simulationResult = await this.wallet.simulateTx(txRequest, true);
|
|
106
|
+
const { totalGas: gasLimits, teardownGas: teardownGasLimits } = getGasLimits(
|
|
107
|
+
simulationResult,
|
|
108
|
+
fee.gasSettings.teardownGasLimits,
|
|
109
|
+
);
|
|
110
|
+
this.log.debug(
|
|
111
|
+
`Estimated gas limits for tx: DA=${gasLimits.daGas} L2=${gasLimits.l2Gas} teardownDA=${teardownGasLimits.daGas} teardownL2=${teardownGasLimits.l2Gas}`,
|
|
112
|
+
);
|
|
89
113
|
const gasSettings = GasSettings.default({ ...fee.gasSettings, gasLimits, teardownGasLimits });
|
|
90
114
|
return { ...fee, gasSettings };
|
|
91
115
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type FunctionCall, type TxExecutionRequest } from '@aztec/circuit-types';
|
|
2
|
+
import { FunctionType, decodeReturnValues } from '@aztec/foundation/abi';
|
|
2
3
|
|
|
3
4
|
import { type Wallet } from '../account/index.js';
|
|
4
5
|
import { BaseContractInteraction, type SendMethodOptions } from './base_contract_interaction.js';
|
|
6
|
+
import type { SimulateMethodOptions } from './contract_function_interaction.js';
|
|
5
7
|
|
|
6
8
|
/** A batch of function calls to be sent as a single transaction through a wallet. */
|
|
7
9
|
export class BatchCall extends BaseContractInteraction {
|
|
@@ -18,9 +20,83 @@ export class BatchCall extends BaseContractInteraction {
|
|
|
18
20
|
public async create(opts?: SendMethodOptions): Promise<TxExecutionRequest> {
|
|
19
21
|
if (!this.txRequest) {
|
|
20
22
|
const calls = this.calls;
|
|
21
|
-
const fee = opts?.estimateGas ? await this.
|
|
23
|
+
const fee = opts?.estimateGas ? await this.getFeeOptionsFromEstimatedGas({ calls, fee: opts?.fee }) : opts?.fee;
|
|
22
24
|
this.txRequest = await this.wallet.createTxExecutionRequest({ calls, fee });
|
|
23
25
|
}
|
|
24
26
|
return this.txRequest;
|
|
25
27
|
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Simulate a transaction and get its return values
|
|
31
|
+
* Differs from prove in a few important ways:
|
|
32
|
+
* 1. It returns the values of the function execution
|
|
33
|
+
* 2. It supports `unconstrained`, `private` and `public` functions
|
|
34
|
+
*
|
|
35
|
+
* @param options - An optional object containing additional configuration for the transaction.
|
|
36
|
+
* @returns The result of the transaction as returned by the contract function.
|
|
37
|
+
*/
|
|
38
|
+
public async simulate(options: SimulateMethodOptions = {}): Promise<any> {
|
|
39
|
+
const { calls, unconstrained } = this.calls.reduce<{
|
|
40
|
+
/**
|
|
41
|
+
* Keep track of the number of private calls to retrieve the return values
|
|
42
|
+
*/
|
|
43
|
+
privateIndex: 0;
|
|
44
|
+
/**
|
|
45
|
+
* Keep track of the number of private calls to retrieve the return values
|
|
46
|
+
*/
|
|
47
|
+
publicIndex: 0;
|
|
48
|
+
/**
|
|
49
|
+
* The public and private function calls in the batch
|
|
50
|
+
*/
|
|
51
|
+
calls: [FunctionCall, number, number][];
|
|
52
|
+
/**
|
|
53
|
+
* The unconstrained function calls in the batch.
|
|
54
|
+
*/
|
|
55
|
+
unconstrained: [FunctionCall, number][];
|
|
56
|
+
}>(
|
|
57
|
+
(acc, current, index) => {
|
|
58
|
+
if (current.type === FunctionType.UNCONSTRAINED) {
|
|
59
|
+
acc.unconstrained.push([current, index]);
|
|
60
|
+
} else {
|
|
61
|
+
acc.calls.push([
|
|
62
|
+
current,
|
|
63
|
+
index,
|
|
64
|
+
current.type === FunctionType.PRIVATE ? acc.privateIndex++ : acc.publicIndex++,
|
|
65
|
+
]);
|
|
66
|
+
}
|
|
67
|
+
return acc;
|
|
68
|
+
},
|
|
69
|
+
{ calls: [], unconstrained: [], publicIndex: 0, privateIndex: 0 },
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
const txRequest = await this.wallet.createTxExecutionRequest({ calls: calls.map(indexedCall => indexedCall[0]) });
|
|
73
|
+
|
|
74
|
+
const unconstrainedCalls = unconstrained.map(async indexedCall => {
|
|
75
|
+
const call = indexedCall[0];
|
|
76
|
+
return [await this.wallet.simulateUnconstrained(call.name, call.args, call.to, options?.from), indexedCall[1]];
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
const [unconstrainedResults, simulatedTx] = await Promise.all([
|
|
80
|
+
Promise.all(unconstrainedCalls),
|
|
81
|
+
this.wallet.simulateTx(txRequest, true, options?.from),
|
|
82
|
+
]);
|
|
83
|
+
|
|
84
|
+
const results: any[] = [];
|
|
85
|
+
|
|
86
|
+
unconstrainedResults.forEach(([result, index]) => {
|
|
87
|
+
results[index] = result;
|
|
88
|
+
});
|
|
89
|
+
calls.forEach(([call, callIndex, resultIndex]) => {
|
|
90
|
+
// As account entrypoints are private, for private functions we retrieve the return values from the first nested call
|
|
91
|
+
// since we're interested in the first set of values AFTER the account entrypoint
|
|
92
|
+
// For public functions we retrieve the first values directly from the public output.
|
|
93
|
+
const rawReturnValues =
|
|
94
|
+
call.type == FunctionType.PRIVATE
|
|
95
|
+
? simulatedTx.privateReturnValues?.nested?.[resultIndex].values
|
|
96
|
+
: simulatedTx.publicOutput?.publicReturnValues?.[resultIndex].values;
|
|
97
|
+
|
|
98
|
+
results[callIndex] = rawReturnValues ? decodeReturnValues(call.returnTypes, rawReturnValues) : [];
|
|
99
|
+
});
|
|
100
|
+
return results;
|
|
101
|
+
}
|
|
26
102
|
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { FunctionCall, TxExecutionRequest } from '@aztec/circuit-types';
|
|
2
|
-
import { type AztecAddress,
|
|
3
|
-
import {
|
|
2
|
+
import { type AztecAddress, type GasSettings } from '@aztec/circuits.js';
|
|
3
|
+
import {
|
|
4
|
+
type FunctionAbi,
|
|
5
|
+
FunctionSelector,
|
|
6
|
+
FunctionType,
|
|
7
|
+
decodeReturnValues,
|
|
8
|
+
encodeArguments,
|
|
9
|
+
} from '@aztec/foundation/abi';
|
|
4
10
|
|
|
5
11
|
import { type Wallet } from '../account/wallet.js';
|
|
6
12
|
import { BaseContractInteraction, type SendMethodOptions } from './base_contract_interaction.js';
|
|
@@ -48,7 +54,7 @@ export class ContractFunctionInteraction extends BaseContractInteraction {
|
|
|
48
54
|
}
|
|
49
55
|
if (!this.txRequest) {
|
|
50
56
|
const calls = [this.request()];
|
|
51
|
-
const fee = opts?.estimateGas ? await this.
|
|
57
|
+
const fee = opts?.estimateGas ? await this.getFeeOptionsFromEstimatedGas({ calls, fee: opts?.fee }) : opts?.fee;
|
|
52
58
|
this.txRequest = await this.wallet.createTxExecutionRequest({ calls, fee });
|
|
53
59
|
}
|
|
54
60
|
return this.txRequest;
|
|
@@ -61,8 +67,15 @@ export class ContractFunctionInteraction extends BaseContractInteraction {
|
|
|
61
67
|
*/
|
|
62
68
|
public request(): FunctionCall {
|
|
63
69
|
const args = encodeArguments(this.functionDao, this.args);
|
|
64
|
-
|
|
65
|
-
|
|
70
|
+
return {
|
|
71
|
+
name: this.functionDao.name,
|
|
72
|
+
args,
|
|
73
|
+
selector: FunctionSelector.fromNameAndParameters(this.functionDao.name, this.functionDao.parameters),
|
|
74
|
+
type: this.functionDao.functionType,
|
|
75
|
+
to: this.contractAddress,
|
|
76
|
+
isStatic: this.functionDao.isStatic,
|
|
77
|
+
returnTypes: this.functionDao.returnTypes,
|
|
78
|
+
};
|
|
66
79
|
}
|
|
67
80
|
|
|
68
81
|
/**
|
|
@@ -80,9 +93,6 @@ export class ContractFunctionInteraction extends BaseContractInteraction {
|
|
|
80
93
|
}
|
|
81
94
|
|
|
82
95
|
const txRequest = await this.create();
|
|
83
|
-
// const from =
|
|
84
|
-
// this.functionDao.functionType == FunctionType.PRIVATE ? options.from ?? this.wallet.getAddress() : undefined;
|
|
85
|
-
|
|
86
96
|
const simulatedTx = await this.wallet.simulateTx(txRequest, true, options?.from);
|
|
87
97
|
|
|
88
98
|
// As account entrypoints are private, for private functions we retrieve the return values from the first nested call
|
|
@@ -91,8 +101,8 @@ export class ContractFunctionInteraction extends BaseContractInteraction {
|
|
|
91
101
|
const rawReturnValues =
|
|
92
102
|
this.functionDao.functionType == FunctionType.PRIVATE
|
|
93
103
|
? simulatedTx.privateReturnValues?.nested?.[0].values
|
|
94
|
-
: simulatedTx.publicOutput?.publicReturnValues?.values;
|
|
104
|
+
: simulatedTx.publicOutput?.publicReturnValues?.[0].values;
|
|
95
105
|
|
|
96
|
-
return rawReturnValues ? decodeReturnValues(this.functionDao, rawReturnValues) : [];
|
|
106
|
+
return rawReturnValues ? decodeReturnValues(this.functionDao.returnTypes, rawReturnValues) : [];
|
|
97
107
|
}
|
|
98
108
|
}
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
} from '@aztec/circuits.js';
|
|
8
8
|
import { type ContractArtifact, type FunctionArtifact, getInitializer } from '@aztec/foundation/abi';
|
|
9
9
|
import { type Fr } from '@aztec/foundation/fields';
|
|
10
|
-
import { createDebugLogger } from '@aztec/foundation/log';
|
|
11
10
|
import { type ContractInstanceWithAddress } from '@aztec/types/contracts';
|
|
12
11
|
|
|
13
12
|
import { type Wallet } from '../account/index.js';
|
|
@@ -53,8 +52,6 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
|
|
|
53
52
|
/** Cached call to request() */
|
|
54
53
|
private functionCalls?: ExecutionRequestInit;
|
|
55
54
|
|
|
56
|
-
private log = createDebugLogger('aztec:js:deploy_method');
|
|
57
|
-
|
|
58
55
|
constructor(
|
|
59
56
|
private publicKeysHash: Fr,
|
|
60
57
|
wallet: Wallet,
|
|
@@ -79,8 +76,6 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
|
|
|
79
76
|
public async create(options: DeployOptions = {}): Promise<TxExecutionRequest> {
|
|
80
77
|
if (!this.txRequest) {
|
|
81
78
|
this.txRequest = await this.wallet.createTxExecutionRequest(await this.request(options));
|
|
82
|
-
// TODO: Should we add the contracts to the DB here, or once the tx has been sent or mined?
|
|
83
|
-
await this.wallet.registerContract({ artifact: this.artifact, instance: this.instance! });
|
|
84
79
|
}
|
|
85
80
|
return this.txRequest;
|
|
86
81
|
}
|
|
@@ -98,6 +93,14 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
|
|
|
98
93
|
*/
|
|
99
94
|
public async request(options: DeployOptions = {}): Promise<ExecutionRequestInit> {
|
|
100
95
|
if (!this.functionCalls) {
|
|
96
|
+
// TODO: Should we add the contracts to the DB here, or once the tx has been sent or mined?
|
|
97
|
+
// Note that we need to run this registerContract here so it's available when computeFeeOptionsFromEstimatedGas
|
|
98
|
+
// runs, since it needs the contract to have been registered in order to estimate gas for its initialization,
|
|
99
|
+
// in case the initializer is public. This hints at the need of having "transient" contracts scoped to a
|
|
100
|
+
// simulation, so we can run the simulation with a set of contracts, but only "commit" them to the wallet
|
|
101
|
+
// once this tx has gone through.
|
|
102
|
+
await this.wallet.registerContract({ artifact: this.artifact, instance: this.getInstance(options) });
|
|
103
|
+
|
|
101
104
|
const deployment = await this.getDeploymentFunctionCalls(options);
|
|
102
105
|
const bootstrap = await this.getInitializeFunctionCalls(options);
|
|
103
106
|
|
|
@@ -113,7 +116,13 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
|
|
|
113
116
|
};
|
|
114
117
|
|
|
115
118
|
if (options.estimateGas) {
|
|
116
|
-
|
|
119
|
+
// Why do we call this seemingly idempotent getter method here, without using its return value?
|
|
120
|
+
// This call pushes a capsule required for contract class registration under the hood. And since
|
|
121
|
+
// capsules are a stack, when we run the simulation for estimating gas, we consume the capsule
|
|
122
|
+
// that was meant for the actual call. So we need to push it again here. Hopefully this design
|
|
123
|
+
// will go away soon.
|
|
124
|
+
await this.getDeploymentFunctionCalls(options);
|
|
125
|
+
request.fee = await this.getFeeOptionsFromEstimatedGas(request);
|
|
117
126
|
}
|
|
118
127
|
|
|
119
128
|
this.functionCalls = request;
|
|
@@ -233,6 +242,14 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
|
|
|
233
242
|
return super.prove(options);
|
|
234
243
|
}
|
|
235
244
|
|
|
245
|
+
/**
|
|
246
|
+
* Estimates gas cost for this deployment operation.
|
|
247
|
+
* @param options - Options.
|
|
248
|
+
*/
|
|
249
|
+
public override estimateGas(options?: Omit<DeployOptions, 'estimateGas' | 'skipPublicSimulation'>) {
|
|
250
|
+
return super.estimateGas(options);
|
|
251
|
+
}
|
|
252
|
+
|
|
236
253
|
/** Return this deployment address. */
|
|
237
254
|
public get address() {
|
|
238
255
|
return this.instance?.address;
|
|
@@ -6,8 +6,10 @@ import { Gas } from '@aztec/circuits.js';
|
|
|
6
6
|
* Note that public gas usage is only accounted for if the publicOutput is present.
|
|
7
7
|
* @param pad - Percentage to pad the suggested gas limits by, defaults to 10%.
|
|
8
8
|
*/
|
|
9
|
-
export function getGasLimits(simulatedTx: SimulatedTx, pad = 0.1) {
|
|
10
|
-
const privateGasUsed = simulatedTx.tx.data.publicInputs.end.gasUsed
|
|
9
|
+
export function getGasLimits(simulatedTx: SimulatedTx, simulationTeardownGasLimits: Gas, pad = 0.1) {
|
|
10
|
+
const privateGasUsed = simulatedTx.tx.data.publicInputs.end.gasUsed
|
|
11
|
+
.sub(simulationTeardownGasLimits)
|
|
12
|
+
.add(simulatedTx.tx.data.forPublic?.endNonRevertibleData.gasUsed ?? Gas.empty());
|
|
11
13
|
if (simulatedTx.publicOutput) {
|
|
12
14
|
const publicGasUsed = Object.values(simulatedTx.publicOutput.gasUsed)
|
|
13
15
|
.filter(Boolean)
|
|
@@ -19,6 +21,5 @@ export function getGasLimits(simulatedTx: SimulatedTx, pad = 0.1) {
|
|
|
19
21
|
teardownGas: teardownGas.mul(1 + pad),
|
|
20
22
|
};
|
|
21
23
|
}
|
|
22
|
-
|
|
23
24
|
return { totalGas: privateGasUsed.mul(1 + pad), teardownGas: Gas.empty() };
|
|
24
25
|
}
|
package/src/contract/sent_tx.ts
CHANGED
|
@@ -72,7 +72,7 @@ export class SentTx {
|
|
|
72
72
|
throw new Error('Cannot set debug to true if waitForNotesSync is false');
|
|
73
73
|
}
|
|
74
74
|
const receipt = await this.waitForReceipt(opts);
|
|
75
|
-
if (
|
|
75
|
+
if (receipt.status !== TxStatus.SUCCESS && !opts?.dontThrowOnRevert) {
|
|
76
76
|
throw new Error(
|
|
77
77
|
`Transaction ${await this.getTxHash()} was ${receipt.status}. Reason: ${receipt.error ?? 'unknown'}`,
|
|
78
78
|
);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PackedValues, TxExecutionRequest } from '@aztec/circuit-types';
|
|
2
2
|
import { GasSettings, TxContext } from '@aztec/circuits.js';
|
|
3
|
+
import { FunctionType } from '@aztec/foundation/abi';
|
|
3
4
|
|
|
4
5
|
import { type EntrypointInterface, type ExecutionRequestInit } from './entrypoint.js';
|
|
5
6
|
|
|
@@ -17,13 +18,18 @@ export class DefaultEntrypoint implements EntrypointInterface {
|
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
const call = calls[0];
|
|
21
|
+
|
|
22
|
+
if (call.type !== FunctionType.PRIVATE) {
|
|
23
|
+
throw new Error('Public entrypoints are not allowed');
|
|
24
|
+
}
|
|
25
|
+
|
|
20
26
|
const entrypointPackedValues = PackedValues.fromValues(call.args);
|
|
21
27
|
const gasSettings = exec.fee?.gasSettings ?? GasSettings.default();
|
|
22
28
|
const txContext = new TxContext(this.chainId, this.protocolVersion, gasSettings);
|
|
23
29
|
return Promise.resolve(
|
|
24
30
|
new TxExecutionRequest(
|
|
25
31
|
call.to,
|
|
26
|
-
call.
|
|
32
|
+
call.selector,
|
|
27
33
|
entrypointPackedValues.hash,
|
|
28
34
|
txContext,
|
|
29
35
|
[...packedArguments, entrypointPackedValues],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type EntrypointInterface, EntrypointPayload, type ExecutionRequestInit } from '@aztec/aztec.js/entrypoint';
|
|
2
2
|
import { PackedValues, TxExecutionRequest } from '@aztec/circuit-types';
|
|
3
|
-
import { type AztecAddress,
|
|
4
|
-
import { type FunctionAbi, encodeArguments } from '@aztec/foundation/abi';
|
|
3
|
+
import { type AztecAddress, GasSettings, TxContext } from '@aztec/circuits.js';
|
|
4
|
+
import { type FunctionAbi, FunctionSelector, encodeArguments } from '@aztec/foundation/abi';
|
|
5
5
|
import { getCanonicalMultiCallEntrypointAddress } from '@aztec/protocol-contracts/multi-call-entrypoint';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -24,7 +24,7 @@ export class DefaultMultiCallEntrypoint implements EntrypointInterface {
|
|
|
24
24
|
const txRequest = TxExecutionRequest.from({
|
|
25
25
|
firstCallArgsHash: entrypointPackedArgs.hash,
|
|
26
26
|
origin: this.address,
|
|
27
|
-
|
|
27
|
+
functionSelector: FunctionSelector.fromNameAndParameters(abi.name, abi.parameters),
|
|
28
28
|
txContext: new TxContext(this.chainId, this.version, gasSettings),
|
|
29
29
|
argsOfCalls: [...payload.packedArguments, ...packedArguments, entrypointPackedArgs],
|
|
30
30
|
authWitnesses,
|