@aztec/cli-wallet 0.0.1-commit.f2ce05ee → 0.0.1-commit.f8ca9b2f3
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/utils/wallet.d.ts +7 -2
- package/dest/utils/wallet.d.ts.map +1 -1
- package/dest/utils/wallet.js +30 -27
- package/package.json +14 -14
- package/src/utils/wallet.ts +42 -44
package/dest/utils/wallet.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { NoteDao } from '@aztec/stdlib/note';
|
|
|
11
11
|
import type { NotesFilter } from '@aztec/stdlib/note';
|
|
12
12
|
import type { TxProvingResult, TxSimulationResult } from '@aztec/stdlib/tx';
|
|
13
13
|
import { ExecutionPayload } from '@aztec/stdlib/tx';
|
|
14
|
-
import { BaseWallet } from '@aztec/wallet-sdk/base-wallet';
|
|
14
|
+
import { BaseWallet, type FeeOptions } from '@aztec/wallet-sdk/base-wallet';
|
|
15
15
|
import type { WalletDB } from '../storage/wallet_db.js';
|
|
16
16
|
import type { AccountType } from './constants.js';
|
|
17
17
|
export declare class CLIWallet extends BaseWallet {
|
|
@@ -28,8 +28,13 @@ export declare class CLIWallet extends BaseWallet {
|
|
|
28
28
|
createOrRetrieveAccount(address?: AztecAddress, secretKey?: Fr, type?: AccountType, salt?: Fr, publicKey?: string): Promise<AccountManager>;
|
|
29
29
|
private getFakeAccountDataFor;
|
|
30
30
|
simulateTx(executionPayload: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
|
|
31
|
+
/**
|
|
32
|
+
* Uses a stub account for kernelless simulation, bypassing real account authorization.
|
|
33
|
+
* Falls through to the standard entrypoint path for SignerlessAccount (ZERO address).
|
|
34
|
+
*/
|
|
35
|
+
protected simulateViaEntrypoint(executionPayload: ExecutionPayload, from: AztecAddress, feeOptions: FeeOptions, skipTxValidation?: boolean, skipFeeEnforcement?: boolean): Promise<TxSimulationResult>;
|
|
31
36
|
getContracts(): Promise<AztecAddress[]>;
|
|
32
37
|
getNotes(filter: NotesFilter): Promise<NoteDao[]>;
|
|
33
38
|
getContractArtifact(id: Fr): Promise<import("@aztec/stdlib/abi").ContractArtifact | undefined>;
|
|
34
39
|
}
|
|
35
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
40
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2FsbGV0LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbHMvd2FsbGV0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUlBLE9BQU8sRUFBRSxLQUFLLE9BQU8sRUFBMkMsTUFBTSx5QkFBeUIsQ0FBQztBQUNoRyxPQUFPLEVBQ0wsS0FBSyxxQkFBcUIsRUFHM0IsTUFBTSwyQkFBMkIsQ0FBQztBQUNuQyxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUN0RCxPQUFPLEVBQUUsY0FBYyxFQUFFLEtBQUssT0FBTyxFQUFFLEtBQUssZUFBZSxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFFNUYsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3BELE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBQ25ELE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQ25ELE9BQU8sS0FBSyxFQUFFLEdBQUcsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBRTdDLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUUzRCxPQUFPLEVBQUUsT0FBTyxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFDN0MsT0FBTyxLQUFLLEVBQUUsV0FBVyxFQUFFLE1BQU0sb0JBQW9CLENBQU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,oBAezD;YAEa,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,CAShH;IAED;;;OAGG;IACH,UAAyB,qBAAqB,CAC5C,gBAAgB,EAAE,gBAAgB,EAClC,IAAI,EAAE,YAAY,EAClB,UAAU,EAAE,UAAU,EACtB,gBAAgB,CAAC,EAAE,OAAO,EAC1B,kBAAkB,CAAC,EAAE,OAAO,GAC3B,OAAO,CAAC,kBAAkB,CAAC,CA+B7B;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
|
@@ -147,10 +147,22 @@ export class CLIWallet extends BaseWallet {
|
|
|
147
147
|
};
|
|
148
148
|
}
|
|
149
149
|
async simulateTx(executionPayload, opts) {
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
const simulationResults = await super.simulateTx(executionPayload, opts);
|
|
151
|
+
if (opts.fee?.estimateGas) {
|
|
152
|
+
const feeOptions = await this.completeFeeOptions(opts.from, executionPayload.feePayer, opts.fee?.gasSettings);
|
|
153
|
+
const limits = getGasLimits(simulationResults, opts.fee?.estimatedGasPadding);
|
|
154
|
+
printGasEstimates(feeOptions, limits, this.userLog);
|
|
155
|
+
}
|
|
156
|
+
return simulationResults;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Uses a stub account for kernelless simulation, bypassing real account authorization.
|
|
160
|
+
* Falls through to the standard entrypoint path for SignerlessAccount (ZERO address).
|
|
161
|
+
*/ async simulateViaEntrypoint(executionPayload, from, feeOptions, skipTxValidation, skipFeeEnforcement) {
|
|
162
|
+
if (from.equals(AztecAddress.ZERO)) {
|
|
163
|
+
return super.simulateViaEntrypoint(executionPayload, from, feeOptions, skipTxValidation, skipFeeEnforcement);
|
|
164
|
+
}
|
|
152
165
|
const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
|
|
153
|
-
const chainInfo = await this.getChainInfo();
|
|
154
166
|
const executionOptions = {
|
|
155
167
|
txNonce: Fr.random(),
|
|
156
168
|
cancellable: this.cancellableTransactions,
|
|
@@ -160,31 +172,22 @@ export class CLIWallet extends BaseWallet {
|
|
|
160
172
|
feeExecutionPayload,
|
|
161
173
|
executionPayload
|
|
162
174
|
]) : executionPayload;
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
artifact
|
|
175
|
+
const { account: fromAccount, instance, artifact } = await this.getFakeAccountDataFor(from);
|
|
176
|
+
const chainInfo = await this.getChainInfo();
|
|
177
|
+
const txRequest = await fromAccount.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, chainInfo, executionOptions);
|
|
178
|
+
return this.pxe.simulateTx(txRequest, {
|
|
179
|
+
simulatePublic: true,
|
|
180
|
+
skipFeeEnforcement: true,
|
|
181
|
+
skipTxValidation: true,
|
|
182
|
+
overrides: {
|
|
183
|
+
contracts: {
|
|
184
|
+
[from.toString()]: {
|
|
185
|
+
instance,
|
|
186
|
+
artifact
|
|
187
|
+
}
|
|
177
188
|
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
contracts: contractOverrides
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
if (opts.fee?.estimateGas) {
|
|
184
|
-
const limits = getGasLimits(simulationResults, opts.fee?.estimatedGasPadding);
|
|
185
|
-
printGasEstimates(feeOptions, limits, this.userLog);
|
|
186
|
-
}
|
|
187
|
-
return simulationResults;
|
|
189
|
+
}
|
|
190
|
+
});
|
|
188
191
|
}
|
|
189
192
|
// Exposed because of the `aztec-wallet get-tx` command. It has been decided that it's fine to keep around because
|
|
190
193
|
// this is just a CLI wallet.
|
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.f8ca9b2f3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/cmds/index.js",
|
|
@@ -67,19 +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/bb.js": "0.0.1-commit.
|
|
73
|
-
"@aztec/cli": "0.0.1-commit.
|
|
74
|
-
"@aztec/entrypoints": "0.0.1-commit.
|
|
75
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
76
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
77
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
78
|
-
"@aztec/noir-contracts.js": "0.0.1-commit.
|
|
79
|
-
"@aztec/noir-noirc_abi": "0.0.1-commit.
|
|
80
|
-
"@aztec/pxe": "0.0.1-commit.
|
|
81
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
82
|
-
"@aztec/wallet-sdk": "0.0.1-commit.
|
|
70
|
+
"@aztec/accounts": "0.0.1-commit.f8ca9b2f3",
|
|
71
|
+
"@aztec/aztec.js": "0.0.1-commit.f8ca9b2f3",
|
|
72
|
+
"@aztec/bb.js": "0.0.1-commit.f8ca9b2f3",
|
|
73
|
+
"@aztec/cli": "0.0.1-commit.f8ca9b2f3",
|
|
74
|
+
"@aztec/entrypoints": "0.0.1-commit.f8ca9b2f3",
|
|
75
|
+
"@aztec/ethereum": "0.0.1-commit.f8ca9b2f3",
|
|
76
|
+
"@aztec/foundation": "0.0.1-commit.f8ca9b2f3",
|
|
77
|
+
"@aztec/kv-store": "0.0.1-commit.f8ca9b2f3",
|
|
78
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.f8ca9b2f3",
|
|
79
|
+
"@aztec/noir-noirc_abi": "0.0.1-commit.f8ca9b2f3",
|
|
80
|
+
"@aztec/pxe": "0.0.1-commit.f8ca9b2f3",
|
|
81
|
+
"@aztec/stdlib": "0.0.1-commit.f8ca9b2f3",
|
|
82
|
+
"@aztec/wallet-sdk": "0.0.1-commit.f8ca9b2f3",
|
|
83
83
|
"commander": "^12.1.0",
|
|
84
84
|
"inquirer": "^10.1.8",
|
|
85
85
|
"source-map-support": "^0.5.21",
|
package/src/utils/wallet.ts
CHANGED
|
@@ -22,7 +22,7 @@ import { NoteDao } from '@aztec/stdlib/note';
|
|
|
22
22
|
import type { NotesFilter } from '@aztec/stdlib/note';
|
|
23
23
|
import type { TxProvingResult, TxSimulationResult } from '@aztec/stdlib/tx';
|
|
24
24
|
import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx';
|
|
25
|
-
import { BaseWallet } from '@aztec/wallet-sdk/base-wallet';
|
|
25
|
+
import { BaseWallet, type FeeOptions } from '@aztec/wallet-sdk/base-wallet';
|
|
26
26
|
|
|
27
27
|
import type { WalletDB } from '../storage/wallet_db.js';
|
|
28
28
|
import type { AccountType } from './constants.js';
|
|
@@ -208,12 +208,32 @@ export class CLIWallet extends BaseWallet {
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
override async simulateTx(executionPayload: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult> {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
211
|
+
const simulationResults = await super.simulateTx(executionPayload, opts);
|
|
212
|
+
|
|
213
|
+
if (opts.fee?.estimateGas) {
|
|
214
|
+
const feeOptions = await this.completeFeeOptions(opts.from, executionPayload.feePayer, opts.fee?.gasSettings);
|
|
215
|
+
const limits = getGasLimits(simulationResults, opts.fee?.estimatedGasPadding);
|
|
216
|
+
printGasEstimates(feeOptions, limits, this.userLog);
|
|
217
|
+
}
|
|
218
|
+
return simulationResults;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Uses a stub account for kernelless simulation, bypassing real account authorization.
|
|
223
|
+
* Falls through to the standard entrypoint path for SignerlessAccount (ZERO address).
|
|
224
|
+
*/
|
|
225
|
+
protected override async simulateViaEntrypoint(
|
|
226
|
+
executionPayload: ExecutionPayload,
|
|
227
|
+
from: AztecAddress,
|
|
228
|
+
feeOptions: FeeOptions,
|
|
229
|
+
skipTxValidation?: boolean,
|
|
230
|
+
skipFeeEnforcement?: boolean,
|
|
231
|
+
): Promise<TxSimulationResult> {
|
|
232
|
+
if (from.equals(AztecAddress.ZERO)) {
|
|
233
|
+
return super.simulateViaEntrypoint(executionPayload, from, feeOptions, skipTxValidation, skipFeeEnforcement);
|
|
234
|
+
}
|
|
235
|
+
|
|
215
236
|
const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
|
|
216
|
-
const chainInfo = await this.getChainInfo();
|
|
217
237
|
const executionOptions: DefaultAccountEntrypointOptions = {
|
|
218
238
|
txNonce: Fr.random(),
|
|
219
239
|
cancellable: this.cancellableTransactions,
|
|
@@ -223,44 +243,22 @@ export class CLIWallet extends BaseWallet {
|
|
|
223
243
|
? mergeExecutionPayloads([feeExecutionPayload, executionPayload])
|
|
224
244
|
: executionPayload;
|
|
225
245
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
);
|
|
243
|
-
} else {
|
|
244
|
-
const { account: fromAccount, instance, artifact } = await this.getFakeAccountDataFor(opts.from);
|
|
245
|
-
const txRequest = await fromAccount.createTxExecutionRequest(
|
|
246
|
-
finalExecutionPayload,
|
|
247
|
-
feeOptions.gasSettings,
|
|
248
|
-
chainInfo,
|
|
249
|
-
executionOptions,
|
|
250
|
-
);
|
|
251
|
-
const contractOverrides = {
|
|
252
|
-
[opts.from.toString()]: { instance, artifact },
|
|
253
|
-
};
|
|
254
|
-
simulationResults = await this.pxe.simulateTx(txRequest, true /* simulatePublic */, true, true, {
|
|
255
|
-
contracts: contractOverrides,
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
if (opts.fee?.estimateGas) {
|
|
260
|
-
const limits = getGasLimits(simulationResults, opts.fee?.estimatedGasPadding);
|
|
261
|
-
printGasEstimates(feeOptions, limits, this.userLog);
|
|
262
|
-
}
|
|
263
|
-
return simulationResults;
|
|
246
|
+
const { account: fromAccount, instance, artifact } = await this.getFakeAccountDataFor(from);
|
|
247
|
+
const chainInfo = await this.getChainInfo();
|
|
248
|
+
const txRequest = await fromAccount.createTxExecutionRequest(
|
|
249
|
+
finalExecutionPayload,
|
|
250
|
+
feeOptions.gasSettings,
|
|
251
|
+
chainInfo,
|
|
252
|
+
executionOptions,
|
|
253
|
+
);
|
|
254
|
+
return this.pxe.simulateTx(txRequest, {
|
|
255
|
+
simulatePublic: true,
|
|
256
|
+
skipFeeEnforcement: true,
|
|
257
|
+
skipTxValidation: true,
|
|
258
|
+
overrides: {
|
|
259
|
+
contracts: { [from.toString()]: { instance, artifact } },
|
|
260
|
+
},
|
|
261
|
+
});
|
|
264
262
|
}
|
|
265
263
|
|
|
266
264
|
// Exposed because of the `aztec-wallet get-tx` command. It has been decided that it's fine to keep around because
|