@aztec/aztec.js 0.65.0 → 0.65.2
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_manager/deploy_account_method.d.ts +1 -1
- package/dest/account_manager/deploy_account_method.d.ts.map +1 -1
- package/dest/account_manager/deploy_account_method.js +3 -2
- 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 +1 -2
- package/dest/contract/base_contract_interaction.d.ts +14 -9
- package/dest/contract/base_contract_interaction.d.ts.map +1 -1
- package/dest/contract/base_contract_interaction.js +29 -13
- package/dest/contract/batch_call.d.ts.map +1 -1
- package/dest/contract/batch_call.js +11 -15
- package/dest/contract/contract_function_interaction.d.ts.map +1 -1
- package/dest/contract/contract_function_interaction.js +5 -10
- package/dest/contract/deploy_method.d.ts +2 -2
- package/dest/contract/deploy_method.d.ts.map +1 -1
- package/dest/contract/deploy_method.js +10 -17
- package/dest/contract/get_gas_limits.d.ts +1 -1
- package/dest/contract/get_gas_limits.js +1 -1
- package/dest/entrypoint/default_entrypoint.d.ts.map +1 -1
- package/dest/entrypoint/default_entrypoint.js +4 -5
- package/dest/entrypoint/default_multi_call_entrypoint.d.ts.map +1 -1
- package/dest/entrypoint/default_multi_call_entrypoint.js +4 -5
- package/dest/entrypoint/entrypoint.d.ts +1 -1
- package/dest/entrypoint/entrypoint.d.ts.map +1 -1
- package/dest/entrypoint/payload.d.ts +12 -0
- package/dest/entrypoint/payload.d.ts.map +1 -1
- package/dest/entrypoint/payload.js +1 -1
- package/dest/main.js +1 -1
- package/dest/rpc_clients/node/index.d.ts.map +1 -1
- package/dest/rpc_clients/node/index.js +17 -27
- package/dest/utils/anvil_test_watcher.js +3 -3
- package/dest/wallet/base_wallet.d.ts +2 -1
- package/dest/wallet/base_wallet.d.ts.map +1 -1
- package/dest/wallet/base_wallet.js +4 -1
- package/package.json +8 -8
- package/src/account_manager/deploy_account_method.ts +5 -2
- package/src/account_manager/index.ts +1 -2
- package/src/contract/base_contract_interaction.ts +42 -16
- package/src/contract/batch_call.ts +18 -27
- package/src/contract/contract_function_interaction.ts +4 -9
- package/src/contract/deploy_method.ts +15 -18
- package/src/contract/get_gas_limits.ts +1 -1
- package/src/entrypoint/default_entrypoint.ts +3 -4
- package/src/entrypoint/default_multi_call_entrypoint.ts +3 -4
- package/src/entrypoint/entrypoint.ts +1 -1
- package/src/entrypoint/payload.ts +13 -0
- package/src/rpc_clients/node/index.ts +16 -29
- package/src/utils/anvil_test_watcher.ts +2 -2
- package/src/wallet/base_wallet.ts +4 -0
|
@@ -4,6 +4,7 @@ import { FunctionType } from '@aztec/foundation/abi';
|
|
|
4
4
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
5
5
|
import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto';
|
|
6
6
|
import { type Tuple } from '@aztec/foundation/serialize';
|
|
7
|
+
import { type FieldsOf } from '@aztec/foundation/types';
|
|
7
8
|
|
|
8
9
|
import { type FeePaymentMethod } from '../fee/fee_payment_method.js';
|
|
9
10
|
|
|
@@ -17,6 +18,18 @@ export type FeeOptions = {
|
|
|
17
18
|
gasSettings: GasSettings;
|
|
18
19
|
};
|
|
19
20
|
|
|
21
|
+
/** Fee options as set by a user. */
|
|
22
|
+
export type UserFeeOptions = {
|
|
23
|
+
/** The fee payment method to use */
|
|
24
|
+
paymentMethod?: FeePaymentMethod;
|
|
25
|
+
/** The gas settings */
|
|
26
|
+
gasSettings?: Partial<FieldsOf<GasSettings>>;
|
|
27
|
+
/** Whether to run an initial simulation of the tx with high gas limit to figure out actual gas settings. */
|
|
28
|
+
estimateGas?: boolean;
|
|
29
|
+
/** Percentage to pad the estimated gas limits by, if empty, defaults to 0.1. Only relevant if estimateGas is set. */
|
|
30
|
+
estimatedGasPadding?: number;
|
|
31
|
+
};
|
|
32
|
+
|
|
20
33
|
// These must match the values defined in:
|
|
21
34
|
// - noir-projects/aztec-nr/aztec/src/entrypoint/app.nr
|
|
22
35
|
const APP_MAX_CALLS = 4;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { type PXE } from '@aztec/circuit-types';
|
|
2
|
+
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
2
3
|
import { type DebugLogger } from '@aztec/foundation/log';
|
|
3
4
|
import { NoRetryError, makeBackoff, retry } from '@aztec/foundation/retry';
|
|
4
5
|
|
|
5
|
-
import
|
|
6
|
+
import { Axios, type AxiosError } from 'axios';
|
|
7
|
+
import { inspect } from 'util';
|
|
6
8
|
|
|
7
9
|
import { createPXEClient } from '../pxe_client.js';
|
|
8
10
|
|
|
@@ -15,34 +17,19 @@ import { createPXEClient } from '../pxe_client.js';
|
|
|
15
17
|
* @returns The response data.
|
|
16
18
|
*/
|
|
17
19
|
async function axiosFetch(host: string, rpcMethod: string, body: any, useApiEndpoints: boolean) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
resp = await axios
|
|
32
|
-
.post(
|
|
33
|
-
host,
|
|
34
|
-
{ ...body, method: rpcMethod },
|
|
35
|
-
{
|
|
36
|
-
headers: { 'content-type': 'application/json' },
|
|
37
|
-
},
|
|
38
|
-
)
|
|
39
|
-
.catch((error: AxiosError) => {
|
|
40
|
-
if (error.response) {
|
|
41
|
-
return error.response;
|
|
42
|
-
}
|
|
43
|
-
throw error;
|
|
44
|
-
});
|
|
45
|
-
}
|
|
20
|
+
const request = new Axios({
|
|
21
|
+
headers: { 'content-type': 'application/json' },
|
|
22
|
+
transformRequest: [(data: any) => jsonStringify(data)],
|
|
23
|
+
transformResponse: [(data: any) => JSON.parse(data)],
|
|
24
|
+
});
|
|
25
|
+
const [url, content] = useApiEndpoints ? [`${host}/${rpcMethod}`, body] : [host, { ...body, method: rpcMethod }];
|
|
26
|
+
const resp = await request.post(url, content).catch((error: AxiosError) => {
|
|
27
|
+
if (error.response) {
|
|
28
|
+
return error.response;
|
|
29
|
+
}
|
|
30
|
+
const errorMessage = `Error fetching from host ${host} with method ${rpcMethod}: ${inspect(error)}`;
|
|
31
|
+
throw new Error(errorMessage);
|
|
32
|
+
});
|
|
46
33
|
|
|
47
34
|
const isOK = resp.status >= 200 && resp.status < 300;
|
|
48
35
|
if (isOK) {
|
|
@@ -62,9 +62,9 @@ export class AnvilTestWatcher {
|
|
|
62
62
|
try {
|
|
63
63
|
const currentSlot = await this.rollup.read.getCurrentSlot();
|
|
64
64
|
const pendingBlockNumber = BigInt(await this.rollup.read.getPendingBlockNumber());
|
|
65
|
-
const
|
|
65
|
+
const blockLog = await this.rollup.read.getBlock([pendingBlockNumber]);
|
|
66
66
|
|
|
67
|
-
if (currentSlot ===
|
|
67
|
+
if (currentSlot === blockLog.slotNumber) {
|
|
68
68
|
// We should jump to the next slot
|
|
69
69
|
const timestamp = await this.rollup.read.getTimestampForSlot([currentSlot + 1n]);
|
|
70
70
|
try {
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
type ContractClassWithId,
|
|
27
27
|
type ContractInstanceWithAddress,
|
|
28
28
|
type Fr,
|
|
29
|
+
type GasFees,
|
|
29
30
|
type L1_TO_L2_MSG_TREE_HEIGHT,
|
|
30
31
|
type NodeInfo,
|
|
31
32
|
type PartialAddress,
|
|
@@ -145,6 +146,9 @@ export abstract class BaseWallet implements Wallet {
|
|
|
145
146
|
getBlock(number: number): Promise<L2Block | undefined> {
|
|
146
147
|
return this.pxe.getBlock(number);
|
|
147
148
|
}
|
|
149
|
+
getCurrentBaseFees(): Promise<GasFees> {
|
|
150
|
+
return this.pxe.getCurrentBaseFees();
|
|
151
|
+
}
|
|
148
152
|
simulateUnconstrained(
|
|
149
153
|
functionName: string,
|
|
150
154
|
args: any[],
|