@aztec/cli-wallet 0.0.1-commit.b655e406 → 0.0.1-commit.b9865e97
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 +21 -11
- 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 +5 -3
- 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.d.ts.map +1 -1
- package/dest/cmds/check_tx.js +50 -21
- package/dest/cmds/create_account.d.ts +7 -5
- package/dest/cmds/create_account.d.ts.map +1 -1
- package/dest/cmds/create_account.js +43 -26
- package/dest/cmds/create_authwit.d.ts +1 -1
- package/dest/cmds/create_authwit.js +1 -1
- package/dest/cmds/deploy.d.ts +5 -4
- package/dest/cmds/deploy.d.ts.map +1 -1
- package/dest/cmds/deploy.js +64 -32
- package/dest/cmds/deploy_account.d.ts +4 -3
- package/dest/cmds/deploy_account.d.ts.map +1 -1
- package/dest/cmds/deploy_account.js +37 -20
- package/dest/cmds/get_fee_juice_balance.d.ts +5 -0
- package/dest/cmds/get_fee_juice_balance.d.ts.map +1 -0
- package/dest/cmds/get_fee_juice_balance.js +27 -0
- package/dest/cmds/import_test_accounts.d.ts +1 -1
- package/dest/cmds/index.d.ts +1 -1
- package/dest/cmds/index.d.ts.map +1 -1
- package/dest/cmds/index.js +33 -17
- 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 +5 -4
- package/dest/cmds/send.d.ts.map +1 -1
- package/dest/cmds/send.js +33 -17
- 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 +10 -5
- package/dest/storage/wallet_db.d.ts.map +1 -1
- package/dest/storage/wallet_db.js +61 -32
- 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 +5 -3
- package/dest/utils/options/fees.d.ts.map +1 -1
- package/dest/utils/options/fees.js +34 -11
- 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 +21 -12
- package/dest/utils/wallet.d.ts.map +1 -1
- package/dest/utils/wallet.js +135 -65
- package/package.json +19 -15
- package/src/bin/index.ts +19 -13
- package/src/cmds/authorize_action.ts +2 -2
- package/src/cmds/bridge_fee_juice.ts +3 -2
- package/src/cmds/check_tx.ts +55 -25
- package/src/cmds/create_account.ts +47 -26
- package/src/cmds/create_authwit.ts +1 -1
- package/src/cmds/deploy.ts +63 -36
- package/src/cmds/deploy_account.ts +38 -19
- package/src/cmds/get_fee_juice_balance.ts +37 -0
- package/src/cmds/index.ts +63 -9
- package/src/cmds/profile.ts +1 -1
- package/src/cmds/send.ts +33 -13
- package/src/cmds/simulate.ts +5 -8
- package/src/storage/wallet_db.ts +65 -38
- package/src/utils/cli_wallet_and_node_wrapper.ts +1 -1
- package/src/utils/constants.ts +4 -0
- package/src/utils/options/fees.ts +43 -12
- package/src/utils/options/options.ts +1 -1
- package/src/utils/profiling.ts +15 -1
- package/src/utils/wallet.ts +147 -81
|
@@ -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
|
|
package/src/utils/profiling.ts
CHANGED
|
@@ -95,7 +95,7 @@ export function printProfileResult(
|
|
|
95
95
|
|
|
96
96
|
if (stats.nodeRPCCalls) {
|
|
97
97
|
log(format('\nRPC calls:\n'));
|
|
98
|
-
for (const [method, { times }] of Object.entries(stats.nodeRPCCalls)) {
|
|
98
|
+
for (const [method, { times }] of Object.entries(stats.nodeRPCCalls.perMethod)) {
|
|
99
99
|
const calls = times.length;
|
|
100
100
|
const total = times.reduce((acc, time) => acc + time, 0);
|
|
101
101
|
const avg = total / calls;
|
|
@@ -112,6 +112,20 @@ export function printProfileResult(
|
|
|
112
112
|
),
|
|
113
113
|
);
|
|
114
114
|
}
|
|
115
|
+
|
|
116
|
+
const { roundTrips } = stats.nodeRPCCalls;
|
|
117
|
+
log(format('\nRound trips (actual blocking waits):\n'));
|
|
118
|
+
log(format('Round trips:'.padEnd(25), `${roundTrips.roundTrips}`.padStart(COLUMN_MAX_WIDTH)));
|
|
119
|
+
log(
|
|
120
|
+
format(
|
|
121
|
+
'Total blocking time:'.padEnd(25),
|
|
122
|
+
`${roundTrips.totalBlockingTime.toFixed(2)}ms`.padStart(COLUMN_MAX_WIDTH),
|
|
123
|
+
),
|
|
124
|
+
);
|
|
125
|
+
if (roundTrips.roundTrips > 0) {
|
|
126
|
+
const avgRoundTrip = roundTrips.totalBlockingTime / roundTrips.roundTrips;
|
|
127
|
+
log(format('Avg round trip:'.padEnd(25), `${avgRoundTrip.toFixed(2)}ms`.padStart(COLUMN_MAX_WIDTH)));
|
|
128
|
+
}
|
|
115
129
|
}
|
|
116
130
|
|
|
117
131
|
log(format('\nSync time:'.padEnd(25), `${timings.sync?.toFixed(2)}ms`.padStart(16)));
|
package/src/utils/wallet.ts
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
import { EcdsaRAccountContract, EcdsaRSSHAccountContract } from '@aztec/accounts/ecdsa';
|
|
2
2
|
import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
|
|
3
|
-
import {
|
|
3
|
+
import { StubEcdsaAccountContractArtifact, createStubEcdsaAccount } from '@aztec/accounts/stub/ecdsa';
|
|
4
|
+
import { StubSchnorrAccountContractArtifact, createStubSchnorrAccount } from '@aztec/accounts/stub/schnorr';
|
|
4
5
|
import { getIdentities } from '@aztec/accounts/utils';
|
|
5
|
-
import { type Account, type AccountContract,
|
|
6
|
-
import {
|
|
7
|
-
type InteractionFeeOptions,
|
|
8
|
-
getContractInstanceFromInstantiationParams,
|
|
9
|
-
getGasLimits,
|
|
10
|
-
} from '@aztec/aztec.js/contracts';
|
|
6
|
+
import { type Account, type AccountContract, NO_FROM } from '@aztec/aztec.js/account';
|
|
7
|
+
import { type InteractionFeeOptions, getContractClassFromArtifact, getGasLimits } from '@aztec/aztec.js/contracts';
|
|
11
8
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
9
|
+
import { AccountManager, type Aliased, type SimulateOptions } from '@aztec/aztec.js/wallet';
|
|
10
|
+
import { TxSimulationResultWithAppOffset } from '@aztec/aztec.js/wallet';
|
|
14
11
|
import type { DefaultAccountEntrypointOptions } from '@aztec/entrypoints/account';
|
|
15
|
-
import {
|
|
16
|
-
import { Fr } from '@aztec/foundation/
|
|
12
|
+
import { DefaultEntrypoint } from '@aztec/entrypoints/default';
|
|
13
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
17
14
|
import type { LogFn } from '@aztec/foundation/log';
|
|
15
|
+
import type { NotesFilter } from '@aztec/pxe/client/lazy';
|
|
18
16
|
import type { PXEConfig } from '@aztec/pxe/config';
|
|
19
17
|
import type { PXE } from '@aztec/pxe/server';
|
|
20
18
|
import { createPXE, getPXEConfig } from '@aztec/pxe/server';
|
|
19
|
+
import { getStandardAuthRegistry } from '@aztec/standard-contracts/auth-registry';
|
|
21
20
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
22
21
|
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
23
|
-
import
|
|
24
|
-
import type {
|
|
22
|
+
import { NoteDao } from '@aztec/stdlib/note';
|
|
23
|
+
import type { SimulationOverrides, TxExecutionRequest, TxProvingResult } from '@aztec/stdlib/tx';
|
|
24
|
+
import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx';
|
|
25
|
+
import { BaseWallet, type SimulateViaEntrypointOptions } from '@aztec/wallet-sdk/base-wallet';
|
|
25
26
|
|
|
26
27
|
import type { WalletDB } from '../storage/wallet_db.js';
|
|
28
|
+
import type { AccountType } from './constants.js';
|
|
27
29
|
import { extractECDSAPublicKeyFromBase64String } from './ecdsa.js';
|
|
28
30
|
import { printGasEstimates } from './options/fees.js';
|
|
29
31
|
|
|
30
|
-
export const AccountTypes = ['schnorr', 'ecdsasecp256r1', 'ecdsasecp256r1ssh', 'ecdsasecp256k1'] as const;
|
|
31
|
-
export type AccountType = (typeof AccountTypes)[number];
|
|
32
|
-
|
|
33
|
-
export const BASE_FEE_PADDING = 0.5;
|
|
34
|
-
|
|
35
32
|
export class CLIWallet extends BaseWallet {
|
|
36
33
|
private accountCache = new Map<string, Account>();
|
|
34
|
+
// Stub class ids, populated on wallet startup
|
|
35
|
+
// to avoid redundant work per simulation
|
|
36
|
+
private stubClassIds = new Map<AccountType, Fr>();
|
|
37
37
|
|
|
38
38
|
constructor(
|
|
39
39
|
pxe: PXE,
|
|
@@ -53,12 +53,43 @@ export class CLIWallet extends BaseWallet {
|
|
|
53
53
|
): Promise<CLIWallet> {
|
|
54
54
|
const pxeConfig = Object.assign(getPXEConfig(), overridePXEConfig);
|
|
55
55
|
const pxe = await createPXE(node, pxeConfig);
|
|
56
|
-
|
|
56
|
+
const wallet = new CLIWallet(pxe, node, log, db);
|
|
57
|
+
await wallet.initStubClasses();
|
|
58
|
+
await wallet.registerAuthRegistry();
|
|
59
|
+
return wallet;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private async registerAuthRegistry(): Promise<void> {
|
|
63
|
+
const { instance, artifact } = await getStandardAuthRegistry();
|
|
64
|
+
await this.pxe.registerContract({ instance, artifact });
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Hashes and registers the stub class for every supported account type with PXE, populating
|
|
69
|
+
* stubClassIds. Called on wallet initialization.
|
|
70
|
+
*/
|
|
71
|
+
private async initStubClasses(): Promise<void> {
|
|
72
|
+
const { id: schnorrClassId } = await getContractClassFromArtifact(StubSchnorrAccountContractArtifact);
|
|
73
|
+
await this.pxe.registerContractClass(StubSchnorrAccountContractArtifact);
|
|
74
|
+
|
|
75
|
+
// ecdsa stubs share the same class id
|
|
76
|
+
const { id: ecdsaClassId } = await getContractClassFromArtifact(StubEcdsaAccountContractArtifact);
|
|
77
|
+
await this.pxe.registerContractClass(StubEcdsaAccountContractArtifact);
|
|
78
|
+
|
|
79
|
+
this.stubClassIds.set('schnorr', schnorrClassId);
|
|
80
|
+
this.stubClassIds.set('ecdsasecp256k1', ecdsaClassId);
|
|
81
|
+
this.stubClassIds.set('ecdsasecp256r1', ecdsaClassId);
|
|
82
|
+
this.stubClassIds.set('ecdsasecp256r1ssh', ecdsaClassId);
|
|
57
83
|
}
|
|
58
84
|
|
|
59
85
|
override async getAccounts(): Promise<Aliased<AztecAddress>[]> {
|
|
60
86
|
const accounts = (await this.db?.listAliases('accounts')) ?? [];
|
|
61
|
-
return Promise.resolve(
|
|
87
|
+
return Promise.resolve(
|
|
88
|
+
accounts.map(({ key, value }) => {
|
|
89
|
+
const alias = key.includes(':') ? key.slice(key.indexOf(':') + 1) : key;
|
|
90
|
+
return { alias, item: AztecAddress.fromString(value) };
|
|
91
|
+
}),
|
|
92
|
+
);
|
|
62
93
|
}
|
|
63
94
|
|
|
64
95
|
private async createCancellationTxExecutionRequest(
|
|
@@ -66,17 +97,25 @@ export class CLIWallet extends BaseWallet {
|
|
|
66
97
|
txNonce: Fr,
|
|
67
98
|
increasedFee: InteractionFeeOptions,
|
|
68
99
|
) {
|
|
69
|
-
const
|
|
100
|
+
const executionPayload = ExecutionPayload.empty();
|
|
101
|
+
const feeOptions = await this.completeFeeOptions({
|
|
102
|
+
from,
|
|
103
|
+
feePayer: executionPayload.feePayer,
|
|
104
|
+
gasSettings: increasedFee.gasSettings,
|
|
105
|
+
});
|
|
70
106
|
const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
|
|
71
107
|
const fromAccount = await this.getAccountFromAddress(from);
|
|
108
|
+
const chainInfo = await this.getChainInfo();
|
|
72
109
|
const executionOptions: DefaultAccountEntrypointOptions = {
|
|
73
110
|
txNonce,
|
|
74
111
|
cancellable: this.cancellableTransactions,
|
|
75
|
-
|
|
112
|
+
// If from is an address, feeOptions include the way the account contract should handle the fee payment
|
|
113
|
+
feePaymentMethodOptions: feeOptions.accountFeePaymentMethodOptions!,
|
|
76
114
|
};
|
|
77
115
|
return await fromAccount.createTxExecutionRequest(
|
|
78
|
-
feeExecutionPayload ??
|
|
116
|
+
feeExecutionPayload ?? executionPayload,
|
|
79
117
|
feeOptions.gasSettings,
|
|
118
|
+
chainInfo,
|
|
80
119
|
executionOptions,
|
|
81
120
|
);
|
|
82
121
|
}
|
|
@@ -87,15 +126,12 @@ export class CLIWallet extends BaseWallet {
|
|
|
87
126
|
increasedFee: InteractionFeeOptions,
|
|
88
127
|
): Promise<TxProvingResult> {
|
|
89
128
|
const cancellationTxRequest = await this.createCancellationTxExecutionRequest(from, txNonce, increasedFee);
|
|
90
|
-
return await this.pxe.proveTx(cancellationTxRequest);
|
|
129
|
+
return await this.pxe.proveTx(cancellationTxRequest, { scopes: this.scopesFrom(from), senderForTags: from });
|
|
91
130
|
}
|
|
92
131
|
|
|
93
132
|
override async getAccountFromAddress(address: AztecAddress) {
|
|
94
133
|
let account: Account | undefined;
|
|
95
|
-
if (address.
|
|
96
|
-
const chainInfo = await this.getChainInfo();
|
|
97
|
-
account = new SignerlessAccount(chainInfo);
|
|
98
|
-
} else if (this.accountCache.has(address.toString())) {
|
|
134
|
+
if (this.accountCache.has(address.toString())) {
|
|
99
135
|
return this.accountCache.get(address.toString())!;
|
|
100
136
|
} else {
|
|
101
137
|
const accountManager = await this.createOrRetrieveAccount(address);
|
|
@@ -109,7 +145,7 @@ export class CLIWallet extends BaseWallet {
|
|
|
109
145
|
}
|
|
110
146
|
|
|
111
147
|
private async createAccount(secret: Fr, salt: Fr, contract: AccountContract): Promise<AccountManager> {
|
|
112
|
-
const accountManager = await AccountManager.create(this, secret, contract, salt);
|
|
148
|
+
const accountManager = await AccountManager.create(this, secret, contract, { salt });
|
|
113
149
|
|
|
114
150
|
const instance = accountManager.getInstance();
|
|
115
151
|
const artifact = await contract.getContractArtifact();
|
|
@@ -178,76 +214,100 @@ export class CLIWallet extends BaseWallet {
|
|
|
178
214
|
return account;
|
|
179
215
|
}
|
|
180
216
|
|
|
217
|
+
/**
|
|
218
|
+
* Creates a stub account that impersonates the given address, allowing kernelless simulations
|
|
219
|
+
* to bypass the account's authorization mechanisms via contract overrides.
|
|
220
|
+
* @param address - The address of the account to impersonate
|
|
221
|
+
* @returns The stub account, contract instance, and artifact for simulation
|
|
222
|
+
*/
|
|
181
223
|
private async getFakeAccountDataFor(address: AztecAddress) {
|
|
182
|
-
const chainInfo = await this.getChainInfo();
|
|
183
224
|
const originalAccount = await this.getAccountFromAddress(address);
|
|
184
225
|
const originalAddress = originalAccount.getCompleteAddress();
|
|
185
|
-
const
|
|
226
|
+
const contractInstance = await this.pxe.getContractInstance(originalAddress.address);
|
|
186
227
|
if (!contractInstance) {
|
|
187
228
|
throw new Error(`No contract instance found for address: ${originalAddress.address}`);
|
|
188
229
|
}
|
|
189
|
-
const
|
|
190
|
-
const
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
230
|
+
const { type } = await this.db!.retrieveAccount(address);
|
|
231
|
+
const stubAccount =
|
|
232
|
+
type === 'schnorr' ? createStubSchnorrAccount(originalAddress) : createStubEcdsaAccount(originalAddress);
|
|
233
|
+
const stubClassId = this.stubClassIds.get(type);
|
|
234
|
+
if (!stubClassId) {
|
|
235
|
+
throw new Error(
|
|
236
|
+
`Stub class for account type '${type}' was not registered at wallet init. This is a bug — initStubClasses should cover every supported AccountType.`,
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
const instance = { ...contractInstance, currentContractClassId: stubClassId };
|
|
240
|
+
return { account: stubAccount, instance };
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
override async simulateTx(
|
|
244
|
+
executionPayload: ExecutionPayload,
|
|
245
|
+
opts: SimulateOptions,
|
|
246
|
+
): Promise<TxSimulationResultWithAppOffset> {
|
|
247
|
+
const simulationResults = await super.simulateTx(executionPayload, opts);
|
|
248
|
+
|
|
249
|
+
if (opts.fee?.estimateGas) {
|
|
250
|
+
const feeOptions = await this.completeFeeOptions({
|
|
251
|
+
from: opts.from,
|
|
252
|
+
feePayer: executionPayload.feePayer,
|
|
253
|
+
gasSettings: opts.fee?.gasSettings,
|
|
254
|
+
});
|
|
255
|
+
const limits = getGasLimits(simulationResults, opts.fee?.estimatedGasPadding);
|
|
256
|
+
printGasEstimates(feeOptions, limits, this.userLog);
|
|
257
|
+
}
|
|
258
|
+
return simulationResults;
|
|
198
259
|
}
|
|
199
260
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
261
|
+
/**
|
|
262
|
+
* Uses a stub account for kernelless simulation, bypassing real account authorization.
|
|
263
|
+
* Uses DefaultEntrypoint directly for NO_FROM transactions.
|
|
264
|
+
*/
|
|
265
|
+
protected override async simulateViaEntrypoint(
|
|
266
|
+
executionPayload: ExecutionPayload,
|
|
267
|
+
opts: SimulateViaEntrypointOptions,
|
|
268
|
+
): Promise<TxSimulationResultWithAppOffset> {
|
|
269
|
+
const { from, feeOptions, additionalScopes, sendMessagesAs } = opts;
|
|
270
|
+
const scopes = this.scopesFrom(from, additionalScopes);
|
|
205
271
|
const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
|
|
206
|
-
const executionOptions: DefaultAccountEntrypointOptions = {
|
|
207
|
-
txNonce: Fr.random(),
|
|
208
|
-
cancellable: this.cancellableTransactions,
|
|
209
|
-
feePaymentMethodOptions: feeOptions.accountFeePaymentMethodOptions,
|
|
210
|
-
};
|
|
211
272
|
const finalExecutionPayload = feeExecutionPayload
|
|
212
273
|
? mergeExecutionPayloads([feeExecutionPayload, executionPayload])
|
|
213
274
|
: executionPayload;
|
|
275
|
+
const chainInfo = await this.getChainInfo();
|
|
214
276
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
const txRequest = await fromAccount.createTxExecutionRequest(
|
|
221
|
-
finalExecutionPayload,
|
|
222
|
-
feeOptions.gasSettings,
|
|
223
|
-
executionOptions,
|
|
224
|
-
);
|
|
225
|
-
simulationResults = await this.pxe.simulateTx(
|
|
226
|
-
txRequest,
|
|
227
|
-
true /* simulatePublic */,
|
|
228
|
-
opts?.skipTxValidation,
|
|
229
|
-
opts?.skipFeeEnforcement ?? true,
|
|
230
|
-
);
|
|
277
|
+
let overrides: SimulationOverrides | undefined;
|
|
278
|
+
let txRequest: TxExecutionRequest;
|
|
279
|
+
if (from === NO_FROM) {
|
|
280
|
+
const entrypoint = new DefaultEntrypoint();
|
|
281
|
+
txRequest = await entrypoint.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, chainInfo);
|
|
231
282
|
} else {
|
|
232
|
-
const { account
|
|
233
|
-
|
|
283
|
+
const { account, instance } = await this.getFakeAccountDataFor(from);
|
|
284
|
+
overrides = {
|
|
285
|
+
contracts: { [from.toString()]: { instance } },
|
|
286
|
+
};
|
|
287
|
+
const executionOptions: DefaultAccountEntrypointOptions = {
|
|
288
|
+
txNonce: Fr.random(),
|
|
289
|
+
cancellable: this.cancellableTransactions,
|
|
290
|
+
// If from is an address, feeOptions include the way the account contract should handle the fee payment
|
|
291
|
+
feePaymentMethodOptions: feeOptions.accountFeePaymentMethodOptions!,
|
|
292
|
+
};
|
|
293
|
+
txRequest = await account.createTxExecutionRequest(
|
|
234
294
|
finalExecutionPayload,
|
|
235
295
|
feeOptions.gasSettings,
|
|
296
|
+
chainInfo,
|
|
236
297
|
executionOptions,
|
|
237
298
|
);
|
|
238
|
-
const contractOverrides = {
|
|
239
|
-
[opts.from.toString()]: { instance, artifact },
|
|
240
|
-
};
|
|
241
|
-
simulationResults = await this.pxe.simulateTx(txRequest, true /* simulatePublic */, true, true, {
|
|
242
|
-
contracts: contractOverrides,
|
|
243
|
-
});
|
|
244
299
|
}
|
|
245
300
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
301
|
+
const result = await this.pxe.simulateTx(txRequest, {
|
|
302
|
+
simulatePublic: true,
|
|
303
|
+
skipFeeEnforcement: true,
|
|
304
|
+
skipTxValidation: true,
|
|
305
|
+
overrides,
|
|
306
|
+
scopes,
|
|
307
|
+
senderForTags: this.senderForTagsFrom(from, sendMessagesAs),
|
|
308
|
+
});
|
|
309
|
+
const appCallOffset = await this.computeAppCallOffset(from, feeOptions);
|
|
310
|
+
return TxSimulationResultWithAppOffset.fromResultAndOffset(result, appCallOffset);
|
|
251
311
|
}
|
|
252
312
|
|
|
253
313
|
// Exposed because of the `aztec-wallet get-tx` command. It has been decided that it's fine to keep around because
|
|
@@ -258,7 +318,13 @@ export class CLIWallet extends BaseWallet {
|
|
|
258
318
|
|
|
259
319
|
// Exposed because of the `aztec-wallet get-tx` command. It has been decided that it's fine to keep around because
|
|
260
320
|
// this is just a CLI wallet.
|
|
261
|
-
getNotes(filter: NotesFilter): Promise<
|
|
262
|
-
return this.pxe.getNotes(filter);
|
|
321
|
+
getNotes(filter: NotesFilter): Promise<NoteDao[]> {
|
|
322
|
+
return this.pxe.debug.getNotes(filter);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
// Exposed because of the `aztec-wallet get-tx` command. It has been decided that it's fine to keep around because
|
|
326
|
+
// this is just a CLI wallet.
|
|
327
|
+
getContractArtifact(id: Fr) {
|
|
328
|
+
return this.pxe.getContractArtifact(id);
|
|
263
329
|
}
|
|
264
330
|
}
|