@aztec/cli-wallet 0.0.1-commit.24de95ac → 0.0.1-commit.3469e52
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/README.md +2 -2
- package/dest/bin/index.d.ts +2 -1
- package/dest/bin/index.js +20 -10
- package/dest/cmds/authorize_action.d.ts +2 -2
- package/dest/cmds/authorize_action.d.ts.map +1 -1
- package/dest/cmds/authorize_action.js +1 -1
- package/dest/cmds/bridge_fee_juice.d.ts +2 -2
- package/dest/cmds/bridge_fee_juice.d.ts.map +1 -1
- package/dest/cmds/bridge_fee_juice.js +3 -2
- package/dest/cmds/check_tx.d.ts +1 -1
- package/dest/cmds/check_tx.js +4 -5
- package/dest/cmds/create_account.d.ts +4 -3
- package/dest/cmds/create_account.d.ts.map +1 -1
- package/dest/cmds/create_account.js +1 -1
- package/dest/cmds/create_authwit.d.ts +1 -1
- package/dest/cmds/create_authwit.js +1 -1
- package/dest/cmds/deploy.d.ts +1 -1
- package/dest/cmds/deploy.d.ts.map +1 -1
- package/dest/cmds/deploy_account.d.ts +1 -1
- package/dest/cmds/import_test_accounts.d.ts +1 -1
- package/dest/cmds/index.d.ts +1 -1
- package/dest/cmds/index.js +2 -2
- package/dest/cmds/profile.d.ts +1 -1
- package/dest/cmds/profile.js +1 -1
- package/dest/cmds/register_contract.d.ts +1 -1
- package/dest/cmds/register_sender.d.ts +1 -1
- package/dest/cmds/send.d.ts +2 -2
- package/dest/cmds/send.js +1 -1
- package/dest/cmds/simulate.d.ts +1 -1
- package/dest/cmds/simulate.d.ts.map +1 -1
- package/dest/cmds/simulate.js +4 -4
- package/dest/storage/wallet_db.d.ts +5 -5
- package/dest/storage/wallet_db.d.ts.map +1 -1
- package/dest/storage/wallet_db.js +1 -1
- package/dest/utils/authorizations.d.ts +1 -1
- package/dest/utils/cli_wallet_and_node_wrapper.d.ts +1 -1
- package/dest/utils/cli_wallet_and_node_wrapper.d.ts.map +1 -1
- package/dest/utils/constants.d.ts +4 -0
- package/dest/utils/constants.d.ts.map +1 -0
- package/dest/utils/constants.js +7 -0
- package/dest/utils/ecdsa.d.ts +1 -1
- package/dest/utils/options/fees.d.ts +3 -2
- package/dest/utils/options/fees.d.ts.map +1 -1
- package/dest/utils/options/fees.js +3 -3
- package/dest/utils/options/index.d.ts +1 -1
- package/dest/utils/options/options.d.ts +1 -1
- package/dest/utils/options/options.js +1 -1
- package/dest/utils/profiling.d.ts +1 -1
- package/dest/utils/profiling.d.ts.map +1 -1
- package/dest/utils/profiling.js +9 -1
- package/dest/utils/wallet.d.ts +9 -9
- package/dest/utils/wallet.d.ts.map +1 -1
- package/dest/utils/wallet.js +33 -22
- package/package.json +17 -14
- package/src/bin/index.ts +18 -12
- package/src/cmds/authorize_action.ts +1 -1
- package/src/cmds/bridge_fee_juice.ts +3 -2
- package/src/cmds/check_tx.ts +5 -10
- package/src/cmds/create_account.ts +3 -2
- package/src/cmds/create_authwit.ts +1 -1
- package/src/cmds/index.ts +3 -3
- package/src/cmds/profile.ts +1 -1
- package/src/cmds/send.ts +1 -1
- package/src/cmds/simulate.ts +4 -7
- package/src/storage/wallet_db.ts +2 -2
- package/src/utils/cli_wallet_and_node_wrapper.ts +1 -1
- package/src/utils/constants.ts +4 -0
- package/src/utils/options/fees.ts +5 -4
- package/src/utils/options/options.ts +1 -1
- package/src/utils/profiling.ts +15 -1
- package/src/utils/wallet.ts +40 -21
|
@@ -2,7 +2,7 @@ import { parseAztecAddress, parseSecretKey, parseTxHash } from '@aztec/cli/utils
|
|
|
2
2
|
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
3
3
|
import { Option } from 'commander';
|
|
4
4
|
import { readdir, stat } from 'fs/promises';
|
|
5
|
-
import { AccountTypes } from '../
|
|
5
|
+
import { AccountTypes } from '../constants.js';
|
|
6
6
|
const TARGET_DIR = 'target';
|
|
7
7
|
export const ARTIFACT_DESCRIPTION = "Path to a compiled Aztec contract's artifact in JSON format. If executed inside a nargo workspace, a package and contract name can be specified as package@contract";
|
|
8
8
|
export function integerArgParser(value, argName, min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER) {
|
|
@@ -2,4 +2,4 @@ import type { LogFn } from '@aztec/foundation/log';
|
|
|
2
2
|
import type { PrivateExecutionStep } from '@aztec/stdlib/kernel';
|
|
3
3
|
import type { ProvingStats, SimulationStats } from '@aztec/stdlib/tx';
|
|
4
4
|
export declare function printProfileResult(stats: ProvingStats | SimulationStats, log: LogFn, printOracles?: boolean, executionSteps?: PrivateExecutionStep[]): void;
|
|
5
|
-
//# sourceMappingURL=
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZmlsaW5nLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbHMvcHJvZmlsaW5nLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBQ25ELE9BQU8sS0FBSyxFQUFFLG9CQUFvQixFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFDakUsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFrQixlQUFlLEVBQXFCLE1BQU0sa0JBQWtCLENBQUM7QUFVekcsd0JBQWdCLGtCQUFrQixDQUNoQyxLQUFLLEVBQUUsWUFBWSxHQUFHLGVBQWUsRUFDckMsR0FBRyxFQUFFLEtBQUssRUFDVixZQUFZLEdBQUUsT0FBZSxFQUM3QixjQUFjLENBQUMsRUFBRSxvQkFBb0IsRUFBRSxRQTJKeEMifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profiling.d.ts","sourceRoot":"","sources":["../../src/utils/profiling.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAkB,eAAe,EAAqB,MAAM,kBAAkB,CAAC;AAUzG,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,YAAY,GAAG,eAAe,EACrC,GAAG,EAAE,KAAK,EACV,YAAY,GAAE,OAAe,EAC7B,cAAc,CAAC,EAAE,oBAAoB,EAAE,
|
|
1
|
+
{"version":3,"file":"profiling.d.ts","sourceRoot":"","sources":["../../src/utils/profiling.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAkB,eAAe,EAAqB,MAAM,kBAAkB,CAAC;AAUzG,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,YAAY,GAAG,eAAe,EACrC,GAAG,EAAE,KAAK,EACV,YAAY,GAAE,OAAe,EAC7B,cAAc,CAAC,EAAE,oBAAoB,EAAE,QA2JxC"}
|
package/dest/utils/profiling.js
CHANGED
|
@@ -35,7 +35,7 @@ export function printProfileResult(stats, log, printOracles = false, executionSt
|
|
|
35
35
|
}
|
|
36
36
|
if (stats.nodeRPCCalls) {
|
|
37
37
|
log(format('\nRPC calls:\n'));
|
|
38
|
-
for (const [method, { times }] of Object.entries(stats.nodeRPCCalls)){
|
|
38
|
+
for (const [method, { times }] of Object.entries(stats.nodeRPCCalls.perMethod)){
|
|
39
39
|
const calls = times.length;
|
|
40
40
|
const total = times.reduce((acc, time)=>acc + time, 0);
|
|
41
41
|
const avg = total / calls;
|
|
@@ -43,6 +43,14 @@ export function printProfileResult(stats, log, printOracles = false, executionSt
|
|
|
43
43
|
const max = Math.max(...times);
|
|
44
44
|
log(format(method.padEnd(ORACLE_NAME_PADDING), `${calls} calls`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH), `${total.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH), `min: ${min.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH), `avg: ${avg.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH), `max: ${max.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH)));
|
|
45
45
|
}
|
|
46
|
+
const { roundTrips } = stats.nodeRPCCalls;
|
|
47
|
+
log(format('\nRound trips (actual blocking waits):\n'));
|
|
48
|
+
log(format('Round trips:'.padEnd(25), `${roundTrips.roundTrips}`.padStart(COLUMN_MAX_WIDTH)));
|
|
49
|
+
log(format('Total blocking time:'.padEnd(25), `${roundTrips.totalBlockingTime.toFixed(2)}ms`.padStart(COLUMN_MAX_WIDTH)));
|
|
50
|
+
if (roundTrips.roundTrips > 0) {
|
|
51
|
+
const avgRoundTrip = roundTrips.totalBlockingTime / roundTrips.roundTrips;
|
|
52
|
+
log(format('Avg round trip:'.padEnd(25), `${avgRoundTrip.toFixed(2)}ms`.padStart(COLUMN_MAX_WIDTH)));
|
|
53
|
+
}
|
|
46
54
|
}
|
|
47
55
|
log(format('\nSync time:'.padEnd(25), `${timings.sync?.toFixed(2)}ms`.padStart(16)));
|
|
48
56
|
log(format('Private simulation time:'.padEnd(25), `${timings.perFunction.reduce((acc, { time })=>acc + time, 0).toFixed(2)}ms`.padStart(COLUMN_MAX_WIDTH)));
|
package/dest/utils/wallet.d.ts
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import { type Account } from '@aztec/aztec.js/account';
|
|
2
2
|
import { type InteractionFeeOptions } from '@aztec/aztec.js/contracts';
|
|
3
3
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
7
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
4
|
+
import { AccountManager, type Aliased, type SimulateOptions } from '@aztec/aztec.js/wallet';
|
|
5
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
8
6
|
import type { LogFn } from '@aztec/foundation/log';
|
|
9
7
|
import type { PXEConfig } from '@aztec/pxe/config';
|
|
10
8
|
import type { PXE } from '@aztec/pxe/server';
|
|
11
9
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
10
|
+
import { NoteDao } from '@aztec/stdlib/note';
|
|
12
11
|
import type { NotesFilter } from '@aztec/stdlib/note';
|
|
13
12
|
import type { TxProvingResult, TxSimulationResult } from '@aztec/stdlib/tx';
|
|
13
|
+
import { ExecutionPayload } from '@aztec/stdlib/tx';
|
|
14
|
+
import { BaseWallet } from '@aztec/wallet-sdk/base-wallet';
|
|
14
15
|
import type { WalletDB } from '../storage/wallet_db.js';
|
|
15
|
-
|
|
16
|
-
export type AccountType = (typeof AccountTypes)[number];
|
|
17
|
-
export declare const BASE_FEE_PADDING = 0.5;
|
|
16
|
+
import type { AccountType } from './constants.js';
|
|
18
17
|
export declare class CLIWallet extends BaseWallet {
|
|
19
18
|
private userLog;
|
|
20
19
|
private db?;
|
|
@@ -30,6 +29,7 @@ export declare class CLIWallet extends BaseWallet {
|
|
|
30
29
|
private getFakeAccountDataFor;
|
|
31
30
|
simulateTx(executionPayload: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
|
|
32
31
|
getContracts(): Promise<AztecAddress[]>;
|
|
33
|
-
getNotes(filter: NotesFilter): Promise<
|
|
32
|
+
getNotes(filter: NotesFilter): Promise<NoteDao[]>;
|
|
33
|
+
getContractArtifact(id: Fr): Promise<import("@aztec/stdlib/abi").ContractArtifact | undefined>;
|
|
34
34
|
}
|
|
35
|
-
//# sourceMappingURL=
|
|
35
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2FsbGV0LmQudHMiLCJzb3VyY2VSb290Ijoi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RSxNQUFNLEdBQ2pCLE9BQU8sQ0FBQyxjQUFjLENBQUMsQ0FtRHpCO1lBUWEscUJBQXFCO0lBd0JwQixVQUFVLENBQUMsZ0JBQWdCLEVBQUUsZ0JBQWdCLEVBQUUsSUFBSSxFQUFFLGVBQWUsR0FBRyxPQUFPLENBQUMsa0JBQWtCLENBQUMsQ0FzRGhIO0lBSUQsWUFBWSxJQUFJLE9BQU8sQ0FBQyxZQUFZLEVBQUUsQ0FBQyxDQUV0QztJQUlELFFBQVEsQ0FBQyxNQUFNLEVBQUUsV0FBVyxHQUFHLE9BQU8sQ0FBQyxPQUFPLEVBQUUsQ0FBQyxDQUVoRDtJQUlELG1CQUFtQixDQUFDLEVBQUUsRUFBRSxFQUFFLHFFQUV6QjtDQUNGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/utils/wallet.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,OAAO,EAA2C,MAAM,yBAAyB,CAAC;AAChG,OAAO,EACL,KAAK,qBAAqB,EAG3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/utils/wallet.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,OAAO,EAA2C,MAAM,yBAAyB,CAAC;AAChG,OAAO,EACL,KAAK,qBAAqB,EAG3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,KAAK,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE5F,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC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Ea,aAAa;IAWrB,uBAAuB,CAC3B,OAAO,CAAC,EAAE,YAAY,EACtB,SAAS,CAAC,EAAE,EAAE,EACd,IAAI,GAAE,WAAuB,EAC7B,IAAI,CAAC,EAAE,EAAE,EACT,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,cAAc,CAAC,CAmDzB;YAQa,qBAAqB;IAwBpB,UAAU,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAsDhH;IAID,YAAY,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAEtC;IAID,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAEhD;IAID,mBAAmB,CAAC,EAAE,EAAE,EAAE,qEAEzB;CACF"}
|
package/dest/utils/wallet.js
CHANGED
|
@@ -4,21 +4,15 @@ import { StubAccountContractArtifact, createStubAccount } from '@aztec/accounts/
|
|
|
4
4
|
import { getIdentities } from '@aztec/accounts/utils';
|
|
5
5
|
import { SignerlessAccount } from '@aztec/aztec.js/account';
|
|
6
6
|
import { getContractInstanceFromInstantiationParams, getGasLimits } from '@aztec/aztec.js/contracts';
|
|
7
|
-
import { AccountManager
|
|
8
|
-
import {
|
|
9
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
7
|
+
import { AccountManager } from '@aztec/aztec.js/wallet';
|
|
8
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
10
9
|
import { createPXE, getPXEConfig } from '@aztec/pxe/server';
|
|
11
10
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
12
11
|
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
12
|
+
import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx';
|
|
13
|
+
import { BaseWallet } from '@aztec/wallet-sdk/base-wallet';
|
|
13
14
|
import { extractECDSAPublicKeyFromBase64String } from './ecdsa.js';
|
|
14
15
|
import { printGasEstimates } from './options/fees.js';
|
|
15
|
-
export const AccountTypes = [
|
|
16
|
-
'schnorr',
|
|
17
|
-
'ecdsasecp256r1',
|
|
18
|
-
'ecdsasecp256r1ssh',
|
|
19
|
-
'ecdsasecp256k1'
|
|
20
|
-
];
|
|
21
|
-
export const BASE_FEE_PADDING = 0.5;
|
|
22
16
|
export class CLIWallet extends BaseWallet {
|
|
23
17
|
userLog;
|
|
24
18
|
db;
|
|
@@ -40,15 +34,17 @@ export class CLIWallet extends BaseWallet {
|
|
|
40
34
|
})));
|
|
41
35
|
}
|
|
42
36
|
async createCancellationTxExecutionRequest(from, txNonce, increasedFee) {
|
|
43
|
-
const
|
|
37
|
+
const executionPayload = ExecutionPayload.empty();
|
|
38
|
+
const feeOptions = await this.completeFeeOptions(from, executionPayload.feePayer, increasedFee.gasSettings);
|
|
44
39
|
const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
|
|
45
40
|
const fromAccount = await this.getAccountFromAddress(from);
|
|
41
|
+
const chainInfo = await this.getChainInfo();
|
|
46
42
|
const executionOptions = {
|
|
47
43
|
txNonce,
|
|
48
44
|
cancellable: this.cancellableTransactions,
|
|
49
45
|
feePaymentMethodOptions: feeOptions.accountFeePaymentMethodOptions
|
|
50
46
|
};
|
|
51
|
-
return await fromAccount.createTxExecutionRequest(feeExecutionPayload ??
|
|
47
|
+
return await fromAccount.createTxExecutionRequest(feeExecutionPayload ?? executionPayload, feeOptions.gasSettings, chainInfo, executionOptions);
|
|
52
48
|
}
|
|
53
49
|
async proveCancellationTx(from, txNonce, increasedFee) {
|
|
54
50
|
const cancellationTxRequest = await this.createCancellationTxExecutionRequest(from, txNonce, increasedFee);
|
|
@@ -57,8 +53,7 @@ export class CLIWallet extends BaseWallet {
|
|
|
57
53
|
async getAccountFromAddress(address) {
|
|
58
54
|
let account;
|
|
59
55
|
if (address.equals(AztecAddress.ZERO)) {
|
|
60
|
-
|
|
61
|
-
account = new SignerlessAccount(chainInfo);
|
|
56
|
+
account = new SignerlessAccount();
|
|
62
57
|
} else if (this.accountCache.has(address.toString())) {
|
|
63
58
|
return this.accountCache.get(address.toString());
|
|
64
59
|
} else {
|
|
@@ -123,15 +118,25 @@ export class CLIWallet extends BaseWallet {
|
|
|
123
118
|
}
|
|
124
119
|
return account;
|
|
125
120
|
}
|
|
126
|
-
|
|
127
|
-
|
|
121
|
+
/**
|
|
122
|
+
* Creates a stub account that impersonates the given address, allowing kernelless simulations
|
|
123
|
+
* to bypass the account's authorization mechanisms via contract overrides.
|
|
124
|
+
* @param address - The address of the account to impersonate
|
|
125
|
+
* @returns The stub account, contract instance, and artifact for simulation
|
|
126
|
+
*/ async getFakeAccountDataFor(address) {
|
|
128
127
|
const originalAccount = await this.getAccountFromAddress(address);
|
|
128
|
+
// Account contracts can only be overridden if they have an associated address
|
|
129
|
+
// Overwriting SignerlessAccount is not supported, and does not really make sense
|
|
130
|
+
// since it has no authorization mechanism.
|
|
131
|
+
if (originalAccount instanceof SignerlessAccount) {
|
|
132
|
+
throw new Error(`Cannot create fake account data for SignerlessAccount at address: ${address}`);
|
|
133
|
+
}
|
|
129
134
|
const originalAddress = originalAccount.getCompleteAddress();
|
|
130
|
-
const
|
|
135
|
+
const contractInstance = await this.pxe.getContractInstance(originalAddress.address);
|
|
131
136
|
if (!contractInstance) {
|
|
132
137
|
throw new Error(`No contract instance found for address: ${originalAddress.address}`);
|
|
133
138
|
}
|
|
134
|
-
const stubAccount = createStubAccount(originalAddress
|
|
139
|
+
const stubAccount = createStubAccount(originalAddress);
|
|
135
140
|
const instance = await getContractInstanceFromInstantiationParams(StubAccountContractArtifact, {
|
|
136
141
|
salt: Fr.random()
|
|
137
142
|
});
|
|
@@ -143,8 +148,9 @@ export class CLIWallet extends BaseWallet {
|
|
|
143
148
|
}
|
|
144
149
|
async simulateTx(executionPayload, opts) {
|
|
145
150
|
let simulationResults;
|
|
146
|
-
const feeOptions = opts.fee?.estimateGas ? await this.
|
|
151
|
+
const feeOptions = opts.fee?.estimateGas ? await this.completeFeeOptionsForEstimation(opts.from, executionPayload.feePayer, opts.fee?.gasSettings) : await this.completeFeeOptions(opts.from, executionPayload.feePayer, opts.fee?.gasSettings);
|
|
147
152
|
const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
|
|
153
|
+
const chainInfo = await this.getChainInfo();
|
|
148
154
|
const executionOptions = {
|
|
149
155
|
txNonce: Fr.random(),
|
|
150
156
|
cancellable: this.cancellableTransactions,
|
|
@@ -159,11 +165,11 @@ export class CLIWallet extends BaseWallet {
|
|
|
159
165
|
// TODO: allow disabling kernels even when no overrides are necessary
|
|
160
166
|
if (opts.from.equals(AztecAddress.ZERO)) {
|
|
161
167
|
const fromAccount = await this.getAccountFromAddress(opts.from);
|
|
162
|
-
const txRequest = await fromAccount.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, executionOptions);
|
|
168
|
+
const txRequest = await fromAccount.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, chainInfo, executionOptions);
|
|
163
169
|
simulationResults = await this.pxe.simulateTx(txRequest, true, opts?.skipTxValidation, opts?.skipFeeEnforcement ?? true);
|
|
164
170
|
} else {
|
|
165
171
|
const { account: fromAccount, instance, artifact } = await this.getFakeAccountDataFor(opts.from);
|
|
166
|
-
const txRequest = await fromAccount.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, executionOptions);
|
|
172
|
+
const txRequest = await fromAccount.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, chainInfo, executionOptions);
|
|
167
173
|
const contractOverrides = {
|
|
168
174
|
[opts.from.toString()]: {
|
|
169
175
|
instance,
|
|
@@ -188,6 +194,11 @@ export class CLIWallet extends BaseWallet {
|
|
|
188
194
|
// Exposed because of the `aztec-wallet get-tx` command. It has been decided that it's fine to keep around because
|
|
189
195
|
// this is just a CLI wallet.
|
|
190
196
|
getNotes(filter) {
|
|
191
|
-
return this.pxe.getNotes(filter);
|
|
197
|
+
return this.pxe.debug.getNotes(filter);
|
|
198
|
+
}
|
|
199
|
+
// Exposed because of the `aztec-wallet get-tx` command. It has been decided that it's fine to keep around because
|
|
200
|
+
// this is just a CLI wallet.
|
|
201
|
+
getContractArtifact(id) {
|
|
202
|
+
return this.pxe.getContractArtifact(id);
|
|
192
203
|
}
|
|
193
204
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/cli-wallet",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.3469e52",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/cmds/index.js",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"start": "node --no-warnings ./dest/bin",
|
|
21
21
|
"start:debug": "node --inspect=0.0.0.0:9221 --no-warnings ./dest/bin",
|
|
22
22
|
"dev": "LOG_LEVEL=debug && node ./dest/bin",
|
|
23
|
-
"build": "yarn clean && tsc
|
|
24
|
-
"build:dev": "tsc
|
|
23
|
+
"build": "yarn clean && ../scripts/tsc.sh",
|
|
24
|
+
"build:dev": "../scripts/tsc.sh --watch",
|
|
25
25
|
"clean": "rm -rf ./dest .tsbuildinfo",
|
|
26
26
|
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
|
|
27
27
|
},
|
|
@@ -67,17 +67,19 @@
|
|
|
67
67
|
]
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@aztec/accounts": "0.0.1-commit.
|
|
71
|
-
"@aztec/aztec.js": "0.0.1-commit.
|
|
72
|
-
"@aztec/
|
|
73
|
-
"@aztec/
|
|
74
|
-
"@aztec/
|
|
75
|
-
"@aztec/
|
|
76
|
-
"@aztec/
|
|
77
|
-
"@aztec/
|
|
78
|
-
"@aztec/noir-
|
|
79
|
-
"@aztec/
|
|
80
|
-
"@aztec/
|
|
70
|
+
"@aztec/accounts": "0.0.1-commit.3469e52",
|
|
71
|
+
"@aztec/aztec.js": "0.0.1-commit.3469e52",
|
|
72
|
+
"@aztec/bb.js": "0.0.1-commit.3469e52",
|
|
73
|
+
"@aztec/cli": "0.0.1-commit.3469e52",
|
|
74
|
+
"@aztec/entrypoints": "0.0.1-commit.3469e52",
|
|
75
|
+
"@aztec/ethereum": "0.0.1-commit.3469e52",
|
|
76
|
+
"@aztec/foundation": "0.0.1-commit.3469e52",
|
|
77
|
+
"@aztec/kv-store": "0.0.1-commit.3469e52",
|
|
78
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.3469e52",
|
|
79
|
+
"@aztec/noir-noirc_abi": "0.0.1-commit.3469e52",
|
|
80
|
+
"@aztec/pxe": "0.0.1-commit.3469e52",
|
|
81
|
+
"@aztec/stdlib": "0.0.1-commit.3469e52",
|
|
82
|
+
"@aztec/wallet-sdk": "0.0.1-commit.3469e52",
|
|
81
83
|
"commander": "^12.1.0",
|
|
82
84
|
"inquirer": "^10.1.8",
|
|
83
85
|
"source-map-support": "^0.5.21",
|
|
@@ -88,6 +90,7 @@
|
|
|
88
90
|
"@types/jest": "^30.0.0",
|
|
89
91
|
"@types/node": "^22.15.17",
|
|
90
92
|
"@types/source-map-support": "^0.5.10",
|
|
93
|
+
"@typescript/native-preview": "7.0.0-dev.20260113.1",
|
|
91
94
|
"jest": "^30.0.0",
|
|
92
95
|
"jest-mock-extended": "^4.0.0",
|
|
93
96
|
"ts-jest": "^29.4.0",
|
package/src/bin/index.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
1
2
|
import { computeSecretHash } from '@aztec/aztec.js/crypto';
|
|
2
3
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
3
4
|
import { createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
4
5
|
import { ProtocolContractAddress } from '@aztec/aztec.js/protocol';
|
|
6
|
+
import { BackendType, Barretenberg } from '@aztec/bb.js';
|
|
5
7
|
import { LOCALHOST } from '@aztec/cli/cli-utils';
|
|
6
8
|
import { type LogFn, createConsoleLogger, createLogger } from '@aztec/foundation/log';
|
|
7
9
|
import { openStoreAt } from '@aztec/kv-store/lmdb-v2';
|
|
@@ -9,10 +11,8 @@ import type { PXEConfig } from '@aztec/pxe/config';
|
|
|
9
11
|
import { getPackageVersion } from '@aztec/stdlib/update-checker';
|
|
10
12
|
|
|
11
13
|
import { Argument, Command, Option } from 'commander';
|
|
12
|
-
import { mkdirSync } from 'fs';
|
|
13
14
|
import { homedir } from 'os';
|
|
14
|
-
import {
|
|
15
|
-
import { fileURLToPath } from 'url';
|
|
15
|
+
import { join } from 'path';
|
|
16
16
|
|
|
17
17
|
import { injectCommands } from '../cmds/index.js';
|
|
18
18
|
import { Aliases, WalletDB } from '../storage/wallet_db.js';
|
|
@@ -95,22 +95,26 @@ async function main() {
|
|
|
95
95
|
.default(`http://${LOCALHOST}:8080`),
|
|
96
96
|
)
|
|
97
97
|
.hook('preSubcommand', async command => {
|
|
98
|
+
// Skip initialization if user is just requesting help
|
|
99
|
+
if (command.args.includes('--help') || command.args.includes('-h')) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
|
|
98
103
|
const { dataDir, nodeUrl, prover } = command.optsWithGlobals();
|
|
99
104
|
|
|
100
105
|
const proverEnabled = prover !== 'none';
|
|
101
106
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
switch (prover) {
|
|
108
|
+
case 'native':
|
|
109
|
+
await Barretenberg.initSingleton({ backend: BackendType.NativeUnixSocket });
|
|
110
|
+
break;
|
|
111
|
+
case 'wasm':
|
|
112
|
+
await Barretenberg.initSingleton({ backend: BackendType.Wasm });
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
109
115
|
|
|
110
116
|
const overridePXEConfig: Partial<PXEConfig> = {
|
|
111
117
|
proverEnabled,
|
|
112
|
-
bbBinaryPath: prover === 'native' ? bbBinaryPath : undefined,
|
|
113
|
-
bbWorkingDirectory: prover === 'native' ? bbWorkingDirectory : undefined,
|
|
114
118
|
dataDirectory: join(dataDir, 'pxe'),
|
|
115
119
|
};
|
|
116
120
|
|
|
@@ -142,6 +146,8 @@ async function main() {
|
|
|
142
146
|
injectCommands(program, userLog, debugLogger, walletAndNodeWrapper, db);
|
|
143
147
|
injectInternalCommands(program, userLog, db);
|
|
144
148
|
await program.parseAsync(process.argv);
|
|
149
|
+
|
|
150
|
+
await Barretenberg.destroySingleton();
|
|
145
151
|
}
|
|
146
152
|
|
|
147
153
|
main().catch(err => {
|
|
@@ -30,7 +30,7 @@ export async function authorizeAction(
|
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
const contract =
|
|
33
|
+
const contract = Contract.at(contractAddress, contractArtifact, wallet);
|
|
34
34
|
const action = contract.methods[functionName](...functionArgs);
|
|
35
35
|
|
|
36
36
|
const setAuthwitnessInteraction = await SetPublicAuthwitContractInteraction.create(
|
|
@@ -2,8 +2,9 @@ import { L1FeeJuicePortalManager } from '@aztec/aztec.js/ethereum';
|
|
|
2
2
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
3
3
|
import { ProtocolContractAddress } from '@aztec/aztec.js/protocol';
|
|
4
4
|
import { prettyPrintJSON } from '@aztec/cli/utils';
|
|
5
|
-
import { createEthereumChain
|
|
6
|
-
import {
|
|
5
|
+
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
6
|
+
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
7
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
7
8
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
8
9
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
9
10
|
import { getNonNullifiedL1ToL2MessageWitness } from '@aztec/stdlib/messaging';
|
package/src/cmds/check_tx.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { ProtocolContractAddress } from '@aztec/aztec.js/protocol';
|
|
|
6
6
|
import type { TxHash } from '@aztec/aztec.js/tx';
|
|
7
7
|
import type { LogFn } from '@aztec/foundation/log';
|
|
8
8
|
import { siloNullifier } from '@aztec/stdlib/hash';
|
|
9
|
-
import {
|
|
9
|
+
import { NoteDao } from '@aztec/stdlib/note';
|
|
10
10
|
|
|
11
11
|
import type { CLIWallet } from '../utils/wallet.js';
|
|
12
12
|
|
|
@@ -121,11 +121,10 @@ async function inspectTx(wallet: CLIWallet, aztecNode: AztecNode, txHash: TxHash
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
function inspectNote(note:
|
|
124
|
+
function inspectNote(note: NoteDao, artifactMap: ArtifactMap, log: LogFn, text = 'Note') {
|
|
125
125
|
const artifact = artifactMap[note.contractAddress.toString()];
|
|
126
126
|
const contract = artifact?.name ?? note.contractAddress.toString();
|
|
127
127
|
log(` ${text} at ${contract}`);
|
|
128
|
-
log(` Recipient: ${toFriendlyAddress(note.recipient, artifactMap)}`);
|
|
129
128
|
for (const field of note.note.items) {
|
|
130
129
|
log(` ${field.toString()}`);
|
|
131
130
|
}
|
|
@@ -165,15 +164,11 @@ async function getKnownArtifacts(wallet: CLIWallet): Promise<ArtifactMap> {
|
|
|
165
164
|
const knownContractAddresses = await wallet.getContracts();
|
|
166
165
|
const knownContracts = (
|
|
167
166
|
await Promise.all(knownContractAddresses.map(contractAddress => wallet.getContractMetadata(contractAddress)))
|
|
168
|
-
).map(contractMetadata => contractMetadata.
|
|
167
|
+
).map(contractMetadata => contractMetadata.instance);
|
|
169
168
|
const classIds = [...new Set(knownContracts.map(contract => contract?.currentContractClassId))];
|
|
170
169
|
const knownArtifacts = (
|
|
171
|
-
await Promise.all(classIds.map(classId => (classId ? wallet.
|
|
172
|
-
).map(
|
|
173
|
-
contractClassMetadata
|
|
174
|
-
? { ...contractClassMetadata.artifact, classId: contractClassMetadata.contractClass?.id }
|
|
175
|
-
: undefined,
|
|
176
|
-
);
|
|
170
|
+
await Promise.all(classIds.map(classId => (classId ? wallet.getContractArtifact(classId) : undefined)))
|
|
171
|
+
).map((artifact, index) => (artifact ? { ...artifact, classId: classIds[index] } : undefined));
|
|
177
172
|
const map: Record<string, ContractArtifactWithClassId> = {};
|
|
178
173
|
for (const instance of knownContracts) {
|
|
179
174
|
if (instance) {
|
|
@@ -2,13 +2,14 @@ import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
|
2
2
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
3
3
|
import type { DeployAccountOptions } from '@aztec/aztec.js/wallet';
|
|
4
4
|
import { prettyPrintJSON } from '@aztec/cli/cli-utils';
|
|
5
|
-
import { Fr } from '@aztec/foundation/
|
|
5
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
6
6
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
7
7
|
|
|
8
8
|
import { DEFAULT_TX_TIMEOUT_S } from '../utils/cli_wallet_and_node_wrapper.js';
|
|
9
|
+
import type { AccountType } from '../utils/constants.js';
|
|
9
10
|
import { CLIFeeArgs } from '../utils/options/fees.js';
|
|
10
11
|
import { printProfileResult } from '../utils/profiling.js';
|
|
11
|
-
import {
|
|
12
|
+
import { CLIWallet } from '../utils/wallet.js';
|
|
12
13
|
|
|
13
14
|
export async function createAccount(
|
|
14
15
|
wallet: CLIWallet,
|
|
@@ -28,7 +28,7 @@ export async function createAuthwit(
|
|
|
28
28
|
);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
const contract =
|
|
31
|
+
const contract = Contract.at(contractAddress, contractArtifact, wallet);
|
|
32
32
|
const call = await contract.methods[functionName](...functionArgs).getFunctionCall();
|
|
33
33
|
|
|
34
34
|
const witness = await wallet.createAuthWit(from, { caller, call });
|
package/src/cmds/index.ts
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
parseFieldFromHexString,
|
|
11
11
|
parsePublicKey,
|
|
12
12
|
} from '@aztec/cli/utils';
|
|
13
|
-
import { randomBytes } from '@aztec/foundation/crypto';
|
|
13
|
+
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
14
14
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
15
15
|
|
|
16
16
|
import { type Command, Option } from 'commander';
|
|
@@ -18,6 +18,7 @@ import inquirer from 'inquirer';
|
|
|
18
18
|
|
|
19
19
|
import type { WalletDB } from '../storage/wallet_db.js';
|
|
20
20
|
import type { CliWalletAndNodeWrapper } from '../utils/cli_wallet_and_node_wrapper.js';
|
|
21
|
+
import type { AccountType } from '../utils/constants.js';
|
|
21
22
|
import {
|
|
22
23
|
ARTIFACT_DESCRIPTION,
|
|
23
24
|
CLIFeeArgs,
|
|
@@ -38,7 +39,6 @@ import {
|
|
|
38
39
|
createVerboseOption,
|
|
39
40
|
integerArgParser,
|
|
40
41
|
} from '../utils/options/index.js';
|
|
41
|
-
import type { AccountType } from '../utils/wallet.js';
|
|
42
42
|
|
|
43
43
|
// TODO: This function is only used in 1 place so we could just inline this
|
|
44
44
|
export function injectCommands(
|
|
@@ -346,7 +346,7 @@ export function injectCommands(
|
|
|
346
346
|
log,
|
|
347
347
|
);
|
|
348
348
|
if (db && sentTx) {
|
|
349
|
-
const txAlias = alias ? alias : `${functionName}-${randomBytes(16).toString()}`;
|
|
349
|
+
const txAlias = alias ? alias : `${functionName}-${randomBytes(16).toString('hex')}`;
|
|
350
350
|
await db.storeTx(sentTx, log, txAlias);
|
|
351
351
|
}
|
|
352
352
|
});
|
package/src/cmds/profile.ts
CHANGED
|
@@ -28,7 +28,7 @@ export async function profile(
|
|
|
28
28
|
) {
|
|
29
29
|
const { functionArgs, contractArtifact } = await prepTx(contractArtifactPath, functionName, functionArgsIn, log);
|
|
30
30
|
|
|
31
|
-
const contract =
|
|
31
|
+
const contract = Contract.at(contractAddress, contractArtifact, wallet);
|
|
32
32
|
const call = contract.methods[functionName](...functionArgs);
|
|
33
33
|
|
|
34
34
|
const { paymentMethod, gasSettings } = await feeOpts.toUserFeeOptions(node, wallet, from);
|
package/src/cmds/send.ts
CHANGED
|
@@ -27,7 +27,7 @@ export async function send(
|
|
|
27
27
|
) {
|
|
28
28
|
const { functionArgs, contractArtifact } = await prepTx(contractArtifactPath, functionName, functionArgsIn, log);
|
|
29
29
|
|
|
30
|
-
const contract =
|
|
30
|
+
const contract = Contract.at(contractAddress, contractArtifact, wallet);
|
|
31
31
|
const call = contract.methods[functionName](...functionArgs);
|
|
32
32
|
|
|
33
33
|
const { paymentMethod, gasSettings } = await feeOpts.toUserFeeOptions(node, wallet, from);
|
package/src/cmds/simulate.ts
CHANGED
|
@@ -27,7 +27,7 @@ export async function simulate(
|
|
|
27
27
|
) {
|
|
28
28
|
const { functionArgs, contractArtifact } = await prepTx(contractArtifactPath, functionName, functionArgsIn, log);
|
|
29
29
|
|
|
30
|
-
const contract =
|
|
30
|
+
const contract = Contract.at(contractAddress, contractArtifact, wallet);
|
|
31
31
|
const call = contract.methods[functionName](...functionArgs);
|
|
32
32
|
const { paymentMethod, gasSettings } = await feeOpts.toUserFeeOptions(node, wallet, from);
|
|
33
33
|
const simulationResult = await call.simulate({
|
|
@@ -41,14 +41,11 @@ export async function simulate(
|
|
|
41
41
|
simulationResult.offchainEffects!,
|
|
42
42
|
async (address: AztecAddress) => {
|
|
43
43
|
const metadata = await wallet.getContractMetadata(address);
|
|
44
|
-
if (!metadata.
|
|
44
|
+
if (!metadata.instance) {
|
|
45
45
|
return undefined;
|
|
46
46
|
}
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
true,
|
|
50
|
-
);
|
|
51
|
-
return classMetadata.artifact;
|
|
47
|
+
const artifact = await wallet.getContractArtifact(metadata.instance.currentContractClassId);
|
|
48
|
+
return artifact;
|
|
52
49
|
},
|
|
53
50
|
log,
|
|
54
51
|
);
|
package/src/storage/wallet_db.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import type { LogFn } from '@aztec/foundation/log';
|
|
3
3
|
import type { AztecAsyncKVStore, AztecAsyncMap } from '@aztec/kv-store';
|
|
4
4
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
5
5
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
6
|
import type { TxHash } from '@aztec/stdlib/tx';
|
|
7
7
|
|
|
8
|
+
import type { AccountType } from '../utils/constants.js';
|
|
8
9
|
import { extractECDSAPublicKeyFromBase64String } from '../utils/ecdsa.js';
|
|
9
|
-
import type { AccountType } from '../utils/wallet.js';
|
|
10
10
|
|
|
11
11
|
export const Aliases = ['accounts', 'contracts', 'artifacts', 'secrets', 'transactions', 'authwits'] as const;
|
|
12
12
|
export type AliasType = (typeof Aliases)[number];
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import type { FeePaymentMethod } from '@aztec/aztec.js/fee';
|
|
2
2
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
3
|
-
import type {
|
|
4
|
-
import { Fr } from '@aztec/foundation/
|
|
3
|
+
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
4
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
5
|
import type { LogFn } from '@aztec/foundation/log';
|
|
6
6
|
import type { FieldsOf } from '@aztec/foundation/types';
|
|
7
7
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
8
8
|
import { Gas, GasFees, GasSettings } from '@aztec/stdlib/gas';
|
|
9
|
+
import type { FeeOptions } from '@aztec/wallet-sdk/base-wallet';
|
|
9
10
|
|
|
10
11
|
import { Option } from 'commander';
|
|
11
12
|
|
|
12
13
|
import type { WalletDB } from '../../storage/wallet_db.js';
|
|
13
|
-
import {
|
|
14
|
+
import { MIN_FEE_PADDING } from '../constants.js';
|
|
14
15
|
import { aliasedAddressParser } from './options.js';
|
|
15
16
|
|
|
16
17
|
export type RawCliFeeArgs = {
|
|
@@ -249,7 +250,7 @@ export class CLIFeeArgs {
|
|
|
249
250
|
) {}
|
|
250
251
|
|
|
251
252
|
async toUserFeeOptions(node: AztecNode, wallet: Wallet, from: AztecAddress): Promise<ParsedFeeOptions> {
|
|
252
|
-
const maxFeesPerGas = (await node.
|
|
253
|
+
const maxFeesPerGas = (await node.getCurrentMinFees()).mul(1 + MIN_FEE_PADDING);
|
|
253
254
|
const gasSettings = GasSettings.default({ ...this.gasSettings, maxFeesPerGas });
|
|
254
255
|
const paymentMethod = await this.paymentMethod(wallet, from, gasSettings);
|
|
255
256
|
return {
|
|
@@ -7,7 +7,7 @@ import { Option } from 'commander';
|
|
|
7
7
|
import { readdir, stat } from 'fs/promises';
|
|
8
8
|
|
|
9
9
|
import type { AliasType, WalletDB } from '../../storage/wallet_db.js';
|
|
10
|
-
import { AccountTypes } from '../
|
|
10
|
+
import { AccountTypes } from '../constants.js';
|
|
11
11
|
|
|
12
12
|
const TARGET_DIR = 'target';
|
|
13
13
|
|