@aztec/cli-wallet 4.2.0-nightly.20260409 → 4.2.0-nightly.20260411
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 +5 -4
- package/dest/utils/wallet.d.ts.map +1 -1
- package/dest/utils/wallet.js +14 -6
- package/package.json +14 -14
- package/src/utils/wallet.ts +20 -15
package/dest/utils/wallet.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ 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
4
|
import { AccountManager, type Aliased, type SimulateOptions } from '@aztec/aztec.js/wallet';
|
|
5
|
+
import { TxSimulationResultWithAppOffset } from '@aztec/aztec.js/wallet';
|
|
5
6
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
6
7
|
import type { LogFn } from '@aztec/foundation/log';
|
|
7
8
|
import type { NotesFilter } from '@aztec/pxe/client/lazy';
|
|
@@ -9,7 +10,7 @@ import type { PXEConfig } from '@aztec/pxe/config';
|
|
|
9
10
|
import type { PXE } from '@aztec/pxe/server';
|
|
10
11
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
11
12
|
import { NoteDao } from '@aztec/stdlib/note';
|
|
12
|
-
import type { TxProvingResult
|
|
13
|
+
import type { TxProvingResult } from '@aztec/stdlib/tx';
|
|
13
14
|
import { ExecutionPayload } from '@aztec/stdlib/tx';
|
|
14
15
|
import { BaseWallet, type SimulateViaEntrypointOptions } from '@aztec/wallet-sdk/base-wallet';
|
|
15
16
|
import type { WalletDB } from '../storage/wallet_db.js';
|
|
@@ -27,14 +28,14 @@ export declare class CLIWallet extends BaseWallet {
|
|
|
27
28
|
private createAccount;
|
|
28
29
|
createOrRetrieveAccount(address?: AztecAddress, secretKey?: Fr, type?: AccountType, salt?: Fr, publicKey?: string): Promise<AccountManager>;
|
|
29
30
|
private getFakeAccountDataFor;
|
|
30
|
-
simulateTx(executionPayload: ExecutionPayload, opts: SimulateOptions): Promise<
|
|
31
|
+
simulateTx(executionPayload: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResultWithAppOffset>;
|
|
31
32
|
/**
|
|
32
33
|
* Uses a stub account for kernelless simulation, bypassing real account authorization.
|
|
33
34
|
* Uses DefaultEntrypoint directly for NO_FROM transactions.
|
|
34
35
|
*/
|
|
35
|
-
protected simulateViaEntrypoint(executionPayload: ExecutionPayload, opts: SimulateViaEntrypointOptions): Promise<
|
|
36
|
+
protected simulateViaEntrypoint(executionPayload: ExecutionPayload, opts: SimulateViaEntrypointOptions): Promise<TxSimulationResultWithAppOffset>;
|
|
36
37
|
getContracts(): Promise<AztecAddress[]>;
|
|
37
38
|
getNotes(filter: NotesFilter): Promise<NoteDao[]>;
|
|
38
39
|
getContractArtifact(id: Fr): Promise<import("@aztec/stdlib/abi").ContractArtifact | undefined>;
|
|
39
40
|
}
|
|
40
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
41
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2FsbGV0LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbHMvd2FsbGV0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUtBLE9BQU8sRUFBRSxLQUFLLE9BQU8sRUFBaUMsTUFBTSx5QkFBeUIsQ0FBQztBQUN0RixPQUFPLEVBQ0wsS0FBSyxxQkFBcUIsRUFHM0IsTUFBTSwyQkFBMkIsQ0FBQztBQUNuQyxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUN0RCxPQUFPLEVBQUUsY0FBYyxFQUFFLEtBQUssT0FBTyxFQUFFLEtBQUssZUFBZSxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFDNUYsT0F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0JBQStCLENBQUMsQ0EwQzFDO0lBSUQsWUFBWSxJQUFJLE9BQU8sQ0FBQyxZQUFZLEVBQUUsQ0FBQyxDQUV0QztJQUlELFFBQVEsQ0FBQyxNQUFNLEVBQUUsV0FBVyxHQUFHLE9BQU8sQ0FBQyxPQUFPLEVBQUUsQ0FBQyxDQUVoRDtJQUlELG1CQUFtQixDQUFDLEVBQUUsRUFBRSxFQUFFLHFFQUV6QjtDQUNGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/utils/wallet.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/utils/wallet.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,OAAO,EAAiC,MAAM,yBAAyB,CAAC;AACtF,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;AAC5F,OAAO,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC;AAGzE,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,KAAK,EAA2C,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACjG,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IAED;;;OAGG;IACH,UAAyB,qBAAqB,CAC5C,gBAAgB,EAAE,gBAAgB,EAClC,IAAI,EAAE,4BAA4B,GACjC,OAAO,CAAC,+BAA+B,CAAC,CA0C1C;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
|
@@ -1,10 +1,12 @@
|
|
|
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
6
|
import { NO_FROM } from '@aztec/aztec.js/account';
|
|
6
7
|
import { getContractInstanceFromInstantiationParams, getGasLimits } from '@aztec/aztec.js/contracts';
|
|
7
8
|
import { AccountManager } from '@aztec/aztec.js/wallet';
|
|
9
|
+
import { TxSimulationResultWithAppOffset } from '@aztec/aztec.js/wallet';
|
|
8
10
|
import { DefaultEntrypoint } from '@aztec/entrypoints/default';
|
|
9
11
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
10
12
|
import { createPXE, getPXEConfig } from '@aztec/pxe/server';
|
|
@@ -137,14 +139,17 @@ export class CLIWallet extends BaseWallet {
|
|
|
137
139
|
if (!contractInstance) {
|
|
138
140
|
throw new Error(`No contract instance found for address: ${originalAddress.address}`);
|
|
139
141
|
}
|
|
140
|
-
const
|
|
141
|
-
const
|
|
142
|
+
const { type } = await this.db.retrieveAccount(address);
|
|
143
|
+
const isSchnorr = type === 'schnorr';
|
|
144
|
+
const artifact = isSchnorr ? StubSchnorrAccountContractArtifact : StubEcdsaAccountContractArtifact;
|
|
145
|
+
const stubAccount = isSchnorr ? createStubSchnorrAccount(originalAddress) : createStubEcdsaAccount(originalAddress);
|
|
146
|
+
const instance = await getContractInstanceFromInstantiationParams(artifact, {
|
|
142
147
|
salt: Fr.random()
|
|
143
148
|
});
|
|
144
149
|
return {
|
|
145
150
|
account: stubAccount,
|
|
146
151
|
instance,
|
|
147
|
-
artifact
|
|
152
|
+
artifact
|
|
148
153
|
};
|
|
149
154
|
}
|
|
150
155
|
async simulateTx(executionPayload, opts) {
|
|
@@ -164,7 +169,8 @@ export class CLIWallet extends BaseWallet {
|
|
|
164
169
|
* Uses a stub account for kernelless simulation, bypassing real account authorization.
|
|
165
170
|
* Uses DefaultEntrypoint directly for NO_FROM transactions.
|
|
166
171
|
*/ async simulateViaEntrypoint(executionPayload, opts) {
|
|
167
|
-
const { from, feeOptions,
|
|
172
|
+
const { from, feeOptions, additionalScopes } = opts;
|
|
173
|
+
const scopes = this.scopesFrom(from, additionalScopes);
|
|
168
174
|
const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
|
|
169
175
|
const finalExecutionPayload = feeExecutionPayload ? mergeExecutionPayloads([
|
|
170
176
|
feeExecutionPayload,
|
|
@@ -194,13 +200,15 @@ export class CLIWallet extends BaseWallet {
|
|
|
194
200
|
};
|
|
195
201
|
txRequest = await account.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, chainInfo, executionOptions);
|
|
196
202
|
}
|
|
197
|
-
|
|
203
|
+
const result = await this.pxe.simulateTx(txRequest, {
|
|
198
204
|
simulatePublic: true,
|
|
199
205
|
skipFeeEnforcement: true,
|
|
200
206
|
skipTxValidation: true,
|
|
201
207
|
overrides,
|
|
202
208
|
scopes
|
|
203
209
|
});
|
|
210
|
+
const appCallOffset = await this.computeAppCallOffset(from, feeOptions);
|
|
211
|
+
return TxSimulationResultWithAppOffset.fromResultAndOffset(result, appCallOffset);
|
|
204
212
|
}
|
|
205
213
|
// Exposed because of the `aztec-wallet get-tx` command. It has been decided that it's fine to keep around because
|
|
206
214
|
// this is just a CLI wallet.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/cli-wallet",
|
|
3
|
-
"version": "4.2.0-nightly.
|
|
3
|
+
"version": "4.2.0-nightly.20260411",
|
|
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": "4.2.0-nightly.
|
|
71
|
-
"@aztec/aztec.js": "4.2.0-nightly.
|
|
72
|
-
"@aztec/bb.js": "4.2.0-nightly.
|
|
73
|
-
"@aztec/cli": "4.2.0-nightly.
|
|
74
|
-
"@aztec/entrypoints": "4.2.0-nightly.
|
|
75
|
-
"@aztec/ethereum": "4.2.0-nightly.
|
|
76
|
-
"@aztec/foundation": "4.2.0-nightly.
|
|
77
|
-
"@aztec/kv-store": "4.2.0-nightly.
|
|
78
|
-
"@aztec/noir-contracts.js": "4.2.0-nightly.
|
|
79
|
-
"@aztec/noir-noirc_abi": "4.2.0-nightly.
|
|
80
|
-
"@aztec/pxe": "4.2.0-nightly.
|
|
81
|
-
"@aztec/stdlib": "4.2.0-nightly.
|
|
82
|
-
"@aztec/wallet-sdk": "4.2.0-nightly.
|
|
70
|
+
"@aztec/accounts": "4.2.0-nightly.20260411",
|
|
71
|
+
"@aztec/aztec.js": "4.2.0-nightly.20260411",
|
|
72
|
+
"@aztec/bb.js": "4.2.0-nightly.20260411",
|
|
73
|
+
"@aztec/cli": "4.2.0-nightly.20260411",
|
|
74
|
+
"@aztec/entrypoints": "4.2.0-nightly.20260411",
|
|
75
|
+
"@aztec/ethereum": "4.2.0-nightly.20260411",
|
|
76
|
+
"@aztec/foundation": "4.2.0-nightly.20260411",
|
|
77
|
+
"@aztec/kv-store": "4.2.0-nightly.20260411",
|
|
78
|
+
"@aztec/noir-contracts.js": "4.2.0-nightly.20260411",
|
|
79
|
+
"@aztec/noir-noirc_abi": "4.2.0-nightly.20260411",
|
|
80
|
+
"@aztec/pxe": "4.2.0-nightly.20260411",
|
|
81
|
+
"@aztec/stdlib": "4.2.0-nightly.20260411",
|
|
82
|
+
"@aztec/wallet-sdk": "4.2.0-nightly.20260411",
|
|
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
|
@@ -1,6 +1,7 @@
|
|
|
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
6
|
import { type Account, type AccountContract, NO_FROM } from '@aztec/aztec.js/account';
|
|
6
7
|
import {
|
|
@@ -10,6 +11,7 @@ import {
|
|
|
10
11
|
} from '@aztec/aztec.js/contracts';
|
|
11
12
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
12
13
|
import { AccountManager, type Aliased, type SimulateOptions } from '@aztec/aztec.js/wallet';
|
|
14
|
+
import { TxSimulationResultWithAppOffset } from '@aztec/aztec.js/wallet';
|
|
13
15
|
import type { DefaultAccountEntrypointOptions } from '@aztec/entrypoints/account';
|
|
14
16
|
import { DefaultEntrypoint } from '@aztec/entrypoints/default';
|
|
15
17
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
@@ -21,7 +23,7 @@ import { createPXE, getPXEConfig } from '@aztec/pxe/server';
|
|
|
21
23
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
22
24
|
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
23
25
|
import { NoteDao } from '@aztec/stdlib/note';
|
|
24
|
-
import type { SimulationOverrides, TxExecutionRequest, TxProvingResult
|
|
26
|
+
import type { SimulationOverrides, TxExecutionRequest, TxProvingResult } from '@aztec/stdlib/tx';
|
|
25
27
|
import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx';
|
|
26
28
|
import { BaseWallet, type SimulateViaEntrypointOptions } from '@aztec/wallet-sdk/base-wallet';
|
|
27
29
|
|
|
@@ -199,18 +201,18 @@ export class CLIWallet extends BaseWallet {
|
|
|
199
201
|
if (!contractInstance) {
|
|
200
202
|
throw new Error(`No contract instance found for address: ${originalAddress.address}`);
|
|
201
203
|
}
|
|
202
|
-
const
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
instance,
|
|
209
|
-
artifact: StubAccountContractArtifact,
|
|
210
|
-
};
|
|
204
|
+
const { type } = await this.db!.retrieveAccount(address);
|
|
205
|
+
const isSchnorr = type === 'schnorr';
|
|
206
|
+
const artifact = isSchnorr ? StubSchnorrAccountContractArtifact : StubEcdsaAccountContractArtifact;
|
|
207
|
+
const stubAccount = isSchnorr ? createStubSchnorrAccount(originalAddress) : createStubEcdsaAccount(originalAddress);
|
|
208
|
+
const instance = await getContractInstanceFromInstantiationParams(artifact, { salt: Fr.random() });
|
|
209
|
+
return { account: stubAccount, instance, artifact };
|
|
211
210
|
}
|
|
212
211
|
|
|
213
|
-
override async simulateTx(
|
|
212
|
+
override async simulateTx(
|
|
213
|
+
executionPayload: ExecutionPayload,
|
|
214
|
+
opts: SimulateOptions,
|
|
215
|
+
): Promise<TxSimulationResultWithAppOffset> {
|
|
214
216
|
const simulationResults = await super.simulateTx(executionPayload, opts);
|
|
215
217
|
|
|
216
218
|
if (opts.fee?.estimateGas) {
|
|
@@ -232,8 +234,9 @@ export class CLIWallet extends BaseWallet {
|
|
|
232
234
|
protected override async simulateViaEntrypoint(
|
|
233
235
|
executionPayload: ExecutionPayload,
|
|
234
236
|
opts: SimulateViaEntrypointOptions,
|
|
235
|
-
): Promise<
|
|
236
|
-
const { from, feeOptions,
|
|
237
|
+
): Promise<TxSimulationResultWithAppOffset> {
|
|
238
|
+
const { from, feeOptions, additionalScopes } = opts;
|
|
239
|
+
const scopes = this.scopesFrom(from, additionalScopes);
|
|
237
240
|
const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
|
|
238
241
|
const finalExecutionPayload = feeExecutionPayload
|
|
239
242
|
? mergeExecutionPayloads([feeExecutionPayload, executionPayload])
|
|
@@ -264,13 +267,15 @@ export class CLIWallet extends BaseWallet {
|
|
|
264
267
|
);
|
|
265
268
|
}
|
|
266
269
|
|
|
267
|
-
|
|
270
|
+
const result = await this.pxe.simulateTx(txRequest, {
|
|
268
271
|
simulatePublic: true,
|
|
269
272
|
skipFeeEnforcement: true,
|
|
270
273
|
skipTxValidation: true,
|
|
271
274
|
overrides,
|
|
272
275
|
scopes,
|
|
273
276
|
});
|
|
277
|
+
const appCallOffset = await this.computeAppCallOffset(from, feeOptions);
|
|
278
|
+
return TxSimulationResultWithAppOffset.fromResultAndOffset(result, appCallOffset);
|
|
274
279
|
}
|
|
275
280
|
|
|
276
281
|
// Exposed because of the `aztec-wallet get-tx` command. It has been decided that it's fine to keep around because
|