@aztec/wallet-sdk 0.0.1-commit.8f9871590 → 0.0.1-commit.9117c5f5a
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/base-wallet/base_wallet.d.ts +12 -7
- package/dest/base-wallet/base_wallet.d.ts.map +1 -1
- package/dest/base-wallet/base_wallet.js +33 -12
- package/dest/base-wallet/utils.d.ts +3 -2
- package/dest/base-wallet/utils.d.ts.map +1 -1
- package/dest/base-wallet/utils.js +6 -3
- package/package.json +8 -8
- package/src/base-wallet/base_wallet.ts +35 -14
- package/src/base-wallet/utils.ts +8 -0
|
@@ -2,20 +2,20 @@ import type { Account } from '@aztec/aztec.js/account';
|
|
|
2
2
|
import type { CallIntent, IntentInnerHash } from '@aztec/aztec.js/authorization';
|
|
3
3
|
import { type InteractionWaitOptions, type SendReturn } from '@aztec/aztec.js/contracts';
|
|
4
4
|
import type { FeePaymentMethod } from '@aztec/aztec.js/fee';
|
|
5
|
-
import type { Aliased, AppCapabilities, BatchResults, BatchedMethod, PrivateEvent, PrivateEventFilter, ProfileOptions, SendOptions, SimulateOptions,
|
|
5
|
+
import type { Aliased, AppCapabilities, BatchResults, BatchedMethod, ExecuteUtilityOptions, PrivateEvent, PrivateEventFilter, ProfileOptions, SendOptions, SimulateOptions, Wallet, WalletCapabilities } from '@aztec/aztec.js/wallet';
|
|
6
6
|
import { AccountFeePaymentMethodOptions } from '@aztec/entrypoints/account';
|
|
7
7
|
import type { ChainInfo } from '@aztec/entrypoints/interfaces';
|
|
8
8
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
9
9
|
import type { FieldsOf } from '@aztec/foundation/types';
|
|
10
|
-
import type
|
|
10
|
+
import { type AccessScopes } from '@aztec/pxe/client/lazy';
|
|
11
11
|
import type { PXE } from '@aztec/pxe/server';
|
|
12
12
|
import { type ContractArtifact, type EventMetadataDefinition, type FunctionCall } from '@aztec/stdlib/abi';
|
|
13
13
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
14
|
-
import
|
|
14
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
15
15
|
import { type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
16
16
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
17
17
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
18
|
-
import { type TxExecutionRequest, type TxProfileResult, TxSimulationResult, type
|
|
18
|
+
import { type TxExecutionRequest, type TxProfileResult, TxSimulationResult, type UtilityExecutionResult } from '@aztec/stdlib/tx';
|
|
19
19
|
import { ExecutionPayload } from '@aztec/stdlib/tx';
|
|
20
20
|
/**
|
|
21
21
|
* Options to configure fee payment for a transaction
|
|
@@ -41,7 +41,7 @@ export declare abstract class BaseWallet implements Wallet {
|
|
|
41
41
|
protected minFeePadding: number;
|
|
42
42
|
protected cancellableTransactions: boolean;
|
|
43
43
|
protected constructor(pxe: PXE, aztecNode: AztecNode, log?: import("@aztec/foundation/log").Logger);
|
|
44
|
-
protected
|
|
44
|
+
protected scopesFrom(from: AztecAddress, additionalScopes?: AztecAddress[]): AztecAddress[];
|
|
45
45
|
protected abstract getAccountFromAddress(address: AztecAddress): Promise<Account>;
|
|
46
46
|
abstract getAccounts(): Promise<Aliased<AztecAddress>[]>;
|
|
47
47
|
/**
|
|
@@ -119,8 +119,13 @@ export declare abstract class BaseWallet implements Wallet {
|
|
|
119
119
|
simulateTx(executionPayload: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
|
|
120
120
|
profileTx(executionPayload: ExecutionPayload, opts: ProfileOptions): Promise<TxProfileResult>;
|
|
121
121
|
sendTx<W extends InteractionWaitOptions = undefined>(executionPayload: ExecutionPayload, opts: SendOptions<W>): Promise<SendReturn<W>>;
|
|
122
|
+
/**
|
|
123
|
+
* Resolves a contract address to a human-readable name via PXE, if available.
|
|
124
|
+
* @param address - The contract address to resolve.
|
|
125
|
+
*/
|
|
126
|
+
protected getContractName(address: AztecAddress): Promise<string | undefined>;
|
|
122
127
|
protected contextualizeError(err: Error, ...context: string[]): Error;
|
|
123
|
-
|
|
128
|
+
executeUtility(call: FunctionCall, opts: ExecuteUtilityOptions): Promise<UtilityExecutionResult>;
|
|
124
129
|
getPrivateEvents<T>(eventDef: EventMetadataDefinition, eventFilter: PrivateEventFilter): Promise<PrivateEvent<T>[]>;
|
|
125
130
|
getContractMetadata(address: AztecAddress): Promise<{
|
|
126
131
|
instance: ContractInstanceWithAddress | undefined;
|
|
@@ -134,4 +139,4 @@ export declare abstract class BaseWallet implements Wallet {
|
|
|
134
139
|
isContractClassPubliclyRegistered: boolean;
|
|
135
140
|
}>;
|
|
136
141
|
}
|
|
137
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
142
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmFzZV93YWxsZXQuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9iYXNlLXdhbGxldC9iYXNlX3dhbGxldC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxPQUFPLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUN2RCxPQUFPLEtBQUssRUFBRSxVQUFVLEVBQUUsZUFBZSxFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFDakYsT0FBTyxFQUFFLEtBQUssc0JBQXNCLEVBQVcsS0FBSyxVQUFVLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUNsRyxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBRTVELE9BQU8sS0FBSyxFQUNWLE9BQU8sRUFDUCxlQUFlLEVBQ2YsWUFBWSxFQUNaLGFBQWEsRUFDYixxQkFBcUIsRUFDckIsWUFBWSxFQUNaLGtCQUFrQixFQUNsQixjQUFjLEVBQ2QsV0FBVyxFQUNYLG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,OAAO,EAC1B,kBAAkB,CAAC,EAAE,OAAO,+BAI7B;IAED;;;;;;;OAOG;IACG,UAAU,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA2CvG;IAEK,SAAS,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAQlG;IAEY,MAAM,CAAC,CAAC,SAAS,sBAAsB,GAAG,SAAS,EAC9D,gBAAgB,EAAE,gBAAgB,EAClC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CA8BxB;IAED;;;OAGG;IACH,UAAgB,eAAe,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAOlF;IAED,SAAS,CAAC,kBAAkB,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,GAAG,KAAK,CAYpE;IAED,cAAc,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAE/F;IAEK,gBAAgB,CAAC,CAAC,EACtB,QAAQ,EAAE,uBAAuB,EACjC,WAAW,EAAE,kBAAkB,GAC9B,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAe5B;IAEK,mBAAmB,CAAC,OAAO,EAAE,YAAY;;;;;;OAe9C;IAEK,wBAAwB,CAAC,EAAE,EAAE,EAAE;;;OAMpC;CACF"}
|
|
@@ -4,7 +4,9 @@ import { GAS_ESTIMATION_DA_GAS_LIMIT, GAS_ESTIMATION_L2_GAS_LIMIT, GAS_ESTIMATIO
|
|
|
4
4
|
import { AccountFeePaymentMethodOptions } from '@aztec/entrypoints/account';
|
|
5
5
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
6
6
|
import { createLogger } from '@aztec/foundation/log';
|
|
7
|
+
import { displayDebugLogs } from '@aztec/pxe/client/lazy';
|
|
7
8
|
import { decodeFromAbi } from '@aztec/stdlib/abi';
|
|
9
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
8
10
|
import { computePartialAddress, getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
9
11
|
import { SimulationError } from '@aztec/stdlib/errors';
|
|
10
12
|
import { Gas, GasSettings } from '@aztec/stdlib/gas';
|
|
@@ -28,12 +30,15 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
|
|
|
28
30
|
this.minFeePadding = 0.5;
|
|
29
31
|
this.cancellableTransactions = false;
|
|
30
32
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
from
|
|
33
|
+
scopesFrom(from, additionalScopes = []) {
|
|
34
|
+
const allScopes = from.isZero() ? additionalScopes : [
|
|
35
|
+
from,
|
|
36
|
+
...additionalScopes
|
|
36
37
|
];
|
|
38
|
+
const scopeSet = new Set(allScopes.map((address)=>address.toString()));
|
|
39
|
+
return [
|
|
40
|
+
...scopeSet
|
|
41
|
+
].map(AztecAddress.fromString);
|
|
37
42
|
}
|
|
38
43
|
/**
|
|
39
44
|
* Returns the list of aliased contacts associated with the wallet.
|
|
@@ -232,8 +237,8 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
|
|
|
232
237
|
blockHeader = await this.aztecNode.getBlockHeader();
|
|
233
238
|
}
|
|
234
239
|
const [optimizedResults, normalResult] = await Promise.all([
|
|
235
|
-
optimizableCalls.length > 0 ? simulateViaNode(this.aztecNode, optimizableCalls, opts.from, chainInfo, feeOptions.gasSettings, blockHeader, opts.skipFeeEnforcement ?? true) : Promise.resolve([]),
|
|
236
|
-
remainingCalls.length > 0 ? this.simulateViaEntrypoint(remainingPayload, opts.from, feeOptions, this.
|
|
240
|
+
optimizableCalls.length > 0 ? simulateViaNode(this.aztecNode, optimizableCalls, opts.from, chainInfo, feeOptions.gasSettings, blockHeader, opts.skipFeeEnforcement ?? true, this.getContractName.bind(this)) : Promise.resolve([]),
|
|
241
|
+
remainingCalls.length > 0 ? this.simulateViaEntrypoint(remainingPayload, opts.from, feeOptions, this.scopesFrom(opts.from, opts.additionalScopes), opts.skipTxValidation, opts.skipFeeEnforcement ?? true) : Promise.resolve(null)
|
|
237
242
|
]);
|
|
238
243
|
return buildMergedSimulationResult(optimizedResults, normalResult);
|
|
239
244
|
}
|
|
@@ -243,13 +248,13 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
|
|
|
243
248
|
return this.pxe.profileTx(txRequest, {
|
|
244
249
|
profileMode: opts.profileMode,
|
|
245
250
|
skipProofGeneration: opts.skipProofGeneration ?? true,
|
|
246
|
-
scopes: this.
|
|
251
|
+
scopes: this.scopesFrom(opts.from, opts.additionalScopes)
|
|
247
252
|
});
|
|
248
253
|
}
|
|
249
254
|
async sendTx(executionPayload, opts) {
|
|
250
255
|
const feeOptions = await this.completeFeeOptions(opts.from, executionPayload.feePayer, opts.fee?.gasSettings);
|
|
251
256
|
const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(executionPayload, opts.from, feeOptions);
|
|
252
|
-
const provenTx = await this.pxe.proveTx(txRequest, this.
|
|
257
|
+
const provenTx = await this.pxe.proveTx(txRequest, this.scopesFrom(opts.from, opts.additionalScopes));
|
|
253
258
|
const tx = await provenTx.toTx();
|
|
254
259
|
const txHash = tx.getTxHash();
|
|
255
260
|
if (await this.aztecNode.getTxEffect(txHash)) {
|
|
@@ -266,7 +271,23 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
|
|
|
266
271
|
}
|
|
267
272
|
// Otherwise, wait for the full receipt (default behavior on wait: undefined)
|
|
268
273
|
const waitOpts = typeof opts.wait === 'object' ? opts.wait : undefined;
|
|
269
|
-
|
|
274
|
+
const receipt = await waitForTx(this.aztecNode, txHash, waitOpts);
|
|
275
|
+
// Display debug logs from public execution if present (served in test mode only)
|
|
276
|
+
if (receipt.debugLogs?.length) {
|
|
277
|
+
await displayDebugLogs(receipt.debugLogs, this.getContractName.bind(this));
|
|
278
|
+
}
|
|
279
|
+
return receipt;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Resolves a contract address to a human-readable name via PXE, if available.
|
|
283
|
+
* @param address - The contract address to resolve.
|
|
284
|
+
*/ async getContractName(address) {
|
|
285
|
+
const instance = await this.pxe.getContractInstance(address);
|
|
286
|
+
if (!instance) {
|
|
287
|
+
return undefined;
|
|
288
|
+
}
|
|
289
|
+
const artifact = await this.pxe.getContractArtifact(instance.currentContractClassId);
|
|
290
|
+
return artifact?.name;
|
|
270
291
|
}
|
|
271
292
|
contextualizeError(err, ...context) {
|
|
272
293
|
let contextStr = '';
|
|
@@ -281,8 +302,8 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
|
|
|
281
302
|
}
|
|
282
303
|
return err;
|
|
283
304
|
}
|
|
284
|
-
|
|
285
|
-
return this.pxe.
|
|
305
|
+
executeUtility(call, opts) {
|
|
306
|
+
return this.pxe.executeUtility(call, {
|
|
286
307
|
authwits: opts.authWitnesses,
|
|
287
308
|
scopes: [
|
|
288
309
|
opts.scope
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
2
2
|
import type { ChainInfo } from '@aztec/entrypoints/interfaces';
|
|
3
|
+
import type { ContractNameResolver } from '@aztec/pxe/client/lazy';
|
|
3
4
|
import { type FunctionCall } from '@aztec/stdlib/abi';
|
|
4
5
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
6
|
import type { GasSettings } from '@aztec/stdlib/gas';
|
|
@@ -33,7 +34,7 @@ export declare function extractOptimizablePublicStaticCalls(payload: ExecutionPa
|
|
|
33
34
|
* @param skipFeeEnforcement - Whether to skip fee enforcement during simulation.
|
|
34
35
|
* @returns Array of TxSimulationResult, one per batch.
|
|
35
36
|
*/
|
|
36
|
-
export declare function simulateViaNode(node: AztecNode, publicStaticCalls: FunctionCall[], from: AztecAddress, chainInfo: ChainInfo, gasSettings: GasSettings, blockHeader: BlockHeader, skipFeeEnforcement
|
|
37
|
+
export declare function simulateViaNode(node: AztecNode, publicStaticCalls: FunctionCall[], from: AztecAddress, chainInfo: ChainInfo, gasSettings: GasSettings, blockHeader: BlockHeader, skipFeeEnforcement: boolean | undefined, getContractName: ContractNameResolver): Promise<TxSimulationResult[]>;
|
|
37
38
|
/**
|
|
38
39
|
* Merges simulation results from the optimized (public static) and normal paths.
|
|
39
40
|
* Since optimized calls are always a leading prefix, return values are simply
|
|
@@ -45,4 +46,4 @@ export declare function simulateViaNode(node: AztecNode, publicStaticCalls: Func
|
|
|
45
46
|
* @returns A single TxSimulationResult with return values in original call order.
|
|
46
47
|
*/
|
|
47
48
|
export declare function buildMergedSimulationResult(optimizedResults: TxSimulationResult[], normalResult: TxSimulationResult | null): TxSimulationResult;
|
|
48
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
49
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9iYXNlLXdhbGxldC91dGlscy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUV0RCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUkvRCxPQUFPLEtBQUssRUFBRSxvQkFBb0IsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBR25FLE9BQU8sRUFBRSxLQUFLLFlBQVksRUFBb0IsTUFBTSxtQkFBbUIsQ0FBQztBQUN4RSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ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1,6 +1,7 @@
|
|
|
1
1
|
import { MAX_ENQUEUED_CALLS_PER_CALL } from '@aztec/constants';
|
|
2
2
|
import { makeTuple } from '@aztec/foundation/array';
|
|
3
3
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
+
import { displayDebugLogs } from '@aztec/pxe/client/lazy';
|
|
4
5
|
import { generateSimulatedProvingResult } from '@aztec/pxe/simulator';
|
|
5
6
|
import { ClaimedLengthArray, CountedPublicCallRequest, PrivateCircuitPublicInputs, PublicCallRequest } from '@aztec/stdlib/kernel';
|
|
6
7
|
import { ChonkProof } from '@aztec/stdlib/proofs';
|
|
@@ -34,7 +35,7 @@ import { HashedValues, PrivateCallExecutionResult, PrivateExecutionResult, Tx, T
|
|
|
34
35
|
* @param blockHeader - Block header to use as anchor.
|
|
35
36
|
* @param skipFeeEnforcement - Whether to skip fee enforcement during simulation.
|
|
36
37
|
* @returns TxSimulationResult with public return values.
|
|
37
|
-
*/ async function simulateBatchViaNode(node, publicStaticCalls, from, chainInfo, gasSettings, blockHeader, skipFeeEnforcement) {
|
|
38
|
+
*/ async function simulateBatchViaNode(node, publicStaticCalls, from, chainInfo, gasSettings, blockHeader, skipFeeEnforcement, getContractName) {
|
|
38
39
|
const txContext = new TxContext(chainInfo.chainId, chainInfo.version, gasSettings);
|
|
39
40
|
const publicFunctionCalldata = [];
|
|
40
41
|
for (const call of publicStaticCalls){
|
|
@@ -77,6 +78,8 @@ import { HashedValues, PrivateCallExecutionResult, PrivateExecutionResult, Tx, T
|
|
|
77
78
|
if (publicOutput.revertReason) {
|
|
78
79
|
throw publicOutput.revertReason;
|
|
79
80
|
}
|
|
81
|
+
// Display debug logs from the public simulation.
|
|
82
|
+
await displayDebugLogs(publicOutput.debugLogs, getContractName);
|
|
80
83
|
return new TxSimulationResult(privateResult, provingResult.publicInputs, publicOutput, undefined);
|
|
81
84
|
}
|
|
82
85
|
/**
|
|
@@ -91,14 +94,14 @@ import { HashedValues, PrivateCallExecutionResult, PrivateExecutionResult, Tx, T
|
|
|
91
94
|
* @param blockHeader - Block header to use as anchor.
|
|
92
95
|
* @param skipFeeEnforcement - Whether to skip fee enforcement during simulation.
|
|
93
96
|
* @returns Array of TxSimulationResult, one per batch.
|
|
94
|
-
*/ export async function simulateViaNode(node, publicStaticCalls, from, chainInfo, gasSettings, blockHeader, skipFeeEnforcement = true) {
|
|
97
|
+
*/ export async function simulateViaNode(node, publicStaticCalls, from, chainInfo, gasSettings, blockHeader, skipFeeEnforcement = true, getContractName) {
|
|
95
98
|
const batches = [];
|
|
96
99
|
for(let i = 0; i < publicStaticCalls.length; i += MAX_ENQUEUED_CALLS_PER_CALL){
|
|
97
100
|
batches.push(publicStaticCalls.slice(i, i + MAX_ENQUEUED_CALLS_PER_CALL));
|
|
98
101
|
}
|
|
99
102
|
const results = [];
|
|
100
103
|
for (const batch of batches){
|
|
101
|
-
const result = await simulateBatchViaNode(node, batch, from, chainInfo, gasSettings, blockHeader, skipFeeEnforcement);
|
|
104
|
+
const result = await simulateBatchViaNode(node, batch, from, chainInfo, gasSettings, blockHeader, skipFeeEnforcement, getContractName);
|
|
102
105
|
results.push(result);
|
|
103
106
|
}
|
|
104
107
|
return results;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/wallet-sdk",
|
|
3
3
|
"homepage": "https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/wallet-sdk",
|
|
4
|
-
"version": "0.0.1-commit.
|
|
4
|
+
"version": "0.0.1-commit.9117c5f5a",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
"./base-wallet": "./dest/base-wallet/index.js",
|
|
@@ -71,15 +71,15 @@
|
|
|
71
71
|
]
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"@aztec/aztec.js": "0.0.1-commit.
|
|
75
|
-
"@aztec/constants": "0.0.1-commit.
|
|
76
|
-
"@aztec/entrypoints": "0.0.1-commit.
|
|
77
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
78
|
-
"@aztec/pxe": "0.0.1-commit.
|
|
79
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
74
|
+
"@aztec/aztec.js": "0.0.1-commit.9117c5f5a",
|
|
75
|
+
"@aztec/constants": "0.0.1-commit.9117c5f5a",
|
|
76
|
+
"@aztec/entrypoints": "0.0.1-commit.9117c5f5a",
|
|
77
|
+
"@aztec/foundation": "0.0.1-commit.9117c5f5a",
|
|
78
|
+
"@aztec/pxe": "0.0.1-commit.9117c5f5a",
|
|
79
|
+
"@aztec/stdlib": "0.0.1-commit.9117c5f5a"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
|
-
"@aztec/noir-contracts.js": "0.0.1-commit.
|
|
82
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.9117c5f5a",
|
|
83
83
|
"@jest/globals": "^30.0.0",
|
|
84
84
|
"@types/jest": "^30.0.0",
|
|
85
85
|
"@types/node": "^22.15.17",
|
|
@@ -8,12 +8,12 @@ import type {
|
|
|
8
8
|
AppCapabilities,
|
|
9
9
|
BatchResults,
|
|
10
10
|
BatchedMethod,
|
|
11
|
+
ExecuteUtilityOptions,
|
|
11
12
|
PrivateEvent,
|
|
12
13
|
PrivateEventFilter,
|
|
13
14
|
ProfileOptions,
|
|
14
15
|
SendOptions,
|
|
15
16
|
SimulateOptions,
|
|
16
|
-
SimulateUtilityOptions,
|
|
17
17
|
Wallet,
|
|
18
18
|
WalletCapabilities,
|
|
19
19
|
} from '@aztec/aztec.js/wallet';
|
|
@@ -28,7 +28,7 @@ import type { ChainInfo } from '@aztec/entrypoints/interfaces';
|
|
|
28
28
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
29
29
|
import { createLogger } from '@aztec/foundation/log';
|
|
30
30
|
import type { FieldsOf } from '@aztec/foundation/types';
|
|
31
|
-
import type
|
|
31
|
+
import { type AccessScopes, displayDebugLogs } from '@aztec/pxe/client/lazy';
|
|
32
32
|
import type { PXE, PackedPrivateEvent } from '@aztec/pxe/server';
|
|
33
33
|
import {
|
|
34
34
|
type ContractArtifact,
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
decodeFromAbi,
|
|
38
38
|
} from '@aztec/stdlib/abi';
|
|
39
39
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
40
|
-
import
|
|
40
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
41
41
|
import {
|
|
42
42
|
type ContractInstanceWithAddress,
|
|
43
43
|
computePartialAddress,
|
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
type TxExecutionRequest,
|
|
53
53
|
type TxProfileResult,
|
|
54
54
|
TxSimulationResult,
|
|
55
|
-
type
|
|
55
|
+
type UtilityExecutionResult,
|
|
56
56
|
} from '@aztec/stdlib/tx';
|
|
57
57
|
import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx';
|
|
58
58
|
|
|
@@ -89,10 +89,10 @@ export abstract class BaseWallet implements Wallet {
|
|
|
89
89
|
protected log = createLogger('wallet-sdk:base_wallet'),
|
|
90
90
|
) {}
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
return
|
|
92
|
+
protected scopesFrom(from: AztecAddress, additionalScopes: AztecAddress[] = []): AztecAddress[] {
|
|
93
|
+
const allScopes = from.isZero() ? additionalScopes : [from, ...additionalScopes];
|
|
94
|
+
const scopeSet = new Set(allScopes.map(address => address.toString()));
|
|
95
|
+
return [...scopeSet].map(AztecAddress.fromString);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
protected abstract getAccountFromAddress(address: AztecAddress): Promise<Account>;
|
|
@@ -348,6 +348,7 @@ export abstract class BaseWallet implements Wallet {
|
|
|
348
348
|
feeOptions.gasSettings,
|
|
349
349
|
blockHeader,
|
|
350
350
|
opts.skipFeeEnforcement ?? true,
|
|
351
|
+
this.getContractName.bind(this),
|
|
351
352
|
)
|
|
352
353
|
: Promise.resolve([]),
|
|
353
354
|
remainingCalls.length > 0
|
|
@@ -355,7 +356,7 @@ export abstract class BaseWallet implements Wallet {
|
|
|
355
356
|
remainingPayload,
|
|
356
357
|
opts.from,
|
|
357
358
|
feeOptions,
|
|
358
|
-
this.
|
|
359
|
+
this.scopesFrom(opts.from, opts.additionalScopes),
|
|
359
360
|
opts.skipTxValidation,
|
|
360
361
|
opts.skipFeeEnforcement ?? true,
|
|
361
362
|
)
|
|
@@ -371,7 +372,7 @@ export abstract class BaseWallet implements Wallet {
|
|
|
371
372
|
return this.pxe.profileTx(txRequest, {
|
|
372
373
|
profileMode: opts.profileMode,
|
|
373
374
|
skipProofGeneration: opts.skipProofGeneration ?? true,
|
|
374
|
-
scopes: this.
|
|
375
|
+
scopes: this.scopesFrom(opts.from, opts.additionalScopes),
|
|
375
376
|
});
|
|
376
377
|
}
|
|
377
378
|
|
|
@@ -381,7 +382,7 @@ export abstract class BaseWallet implements Wallet {
|
|
|
381
382
|
): Promise<SendReturn<W>> {
|
|
382
383
|
const feeOptions = await this.completeFeeOptions(opts.from, executionPayload.feePayer, opts.fee?.gasSettings);
|
|
383
384
|
const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(executionPayload, opts.from, feeOptions);
|
|
384
|
-
const provenTx = await this.pxe.proveTx(txRequest, this.
|
|
385
|
+
const provenTx = await this.pxe.proveTx(txRequest, this.scopesFrom(opts.from, opts.additionalScopes));
|
|
385
386
|
const tx = await provenTx.toTx();
|
|
386
387
|
const txHash = tx.getTxHash();
|
|
387
388
|
if (await this.aztecNode.getTxEffect(txHash)) {
|
|
@@ -400,7 +401,27 @@ export abstract class BaseWallet implements Wallet {
|
|
|
400
401
|
|
|
401
402
|
// Otherwise, wait for the full receipt (default behavior on wait: undefined)
|
|
402
403
|
const waitOpts = typeof opts.wait === 'object' ? opts.wait : undefined;
|
|
403
|
-
|
|
404
|
+
const receipt = await waitForTx(this.aztecNode, txHash, waitOpts);
|
|
405
|
+
|
|
406
|
+
// Display debug logs from public execution if present (served in test mode only)
|
|
407
|
+
if (receipt.debugLogs?.length) {
|
|
408
|
+
await displayDebugLogs(receipt.debugLogs, this.getContractName.bind(this));
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
return receipt as SendReturn<W>;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Resolves a contract address to a human-readable name via PXE, if available.
|
|
416
|
+
* @param address - The contract address to resolve.
|
|
417
|
+
*/
|
|
418
|
+
protected async getContractName(address: AztecAddress): Promise<string | undefined> {
|
|
419
|
+
const instance = await this.pxe.getContractInstance(address);
|
|
420
|
+
if (!instance) {
|
|
421
|
+
return undefined;
|
|
422
|
+
}
|
|
423
|
+
const artifact = await this.pxe.getContractArtifact(instance.currentContractClassId);
|
|
424
|
+
return artifact?.name;
|
|
404
425
|
}
|
|
405
426
|
|
|
406
427
|
protected contextualizeError(err: Error, ...context: string[]): Error {
|
|
@@ -417,8 +438,8 @@ export abstract class BaseWallet implements Wallet {
|
|
|
417
438
|
return err;
|
|
418
439
|
}
|
|
419
440
|
|
|
420
|
-
|
|
421
|
-
return this.pxe.
|
|
441
|
+
executeUtility(call: FunctionCall, opts: ExecuteUtilityOptions): Promise<UtilityExecutionResult> {
|
|
442
|
+
return this.pxe.executeUtility(call, { authwits: opts.authWitnesses, scopes: [opts.scope] });
|
|
422
443
|
}
|
|
423
444
|
|
|
424
445
|
async getPrivateEvents<T>(
|
package/src/base-wallet/utils.ts
CHANGED
|
@@ -4,6 +4,8 @@ import type { ChainInfo } from '@aztec/entrypoints/interfaces';
|
|
|
4
4
|
import { makeTuple } from '@aztec/foundation/array';
|
|
5
5
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
6
6
|
import type { Tuple } from '@aztec/foundation/serialize';
|
|
7
|
+
import type { ContractNameResolver } from '@aztec/pxe/client/lazy';
|
|
8
|
+
import { displayDebugLogs } from '@aztec/pxe/client/lazy';
|
|
7
9
|
import { generateSimulatedProvingResult } from '@aztec/pxe/simulator';
|
|
8
10
|
import { type FunctionCall, FunctionSelector } from '@aztec/stdlib/abi';
|
|
9
11
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
@@ -72,6 +74,7 @@ async function simulateBatchViaNode(
|
|
|
72
74
|
gasSettings: GasSettings,
|
|
73
75
|
blockHeader: BlockHeader,
|
|
74
76
|
skipFeeEnforcement: boolean,
|
|
77
|
+
getContractName: ContractNameResolver,
|
|
75
78
|
): Promise<TxSimulationResult> {
|
|
76
79
|
const txContext = new TxContext(chainInfo.chainId, chainInfo.version, gasSettings);
|
|
77
80
|
|
|
@@ -145,6 +148,9 @@ async function simulateBatchViaNode(
|
|
|
145
148
|
throw publicOutput.revertReason;
|
|
146
149
|
}
|
|
147
150
|
|
|
151
|
+
// Display debug logs from the public simulation.
|
|
152
|
+
await displayDebugLogs(publicOutput.debugLogs, getContractName);
|
|
153
|
+
|
|
148
154
|
return new TxSimulationResult(privateResult, provingResult.publicInputs, publicOutput, undefined);
|
|
149
155
|
}
|
|
150
156
|
|
|
@@ -169,6 +175,7 @@ export async function simulateViaNode(
|
|
|
169
175
|
gasSettings: GasSettings,
|
|
170
176
|
blockHeader: BlockHeader,
|
|
171
177
|
skipFeeEnforcement: boolean = true,
|
|
178
|
+
getContractName: ContractNameResolver,
|
|
172
179
|
): Promise<TxSimulationResult[]> {
|
|
173
180
|
const batches: FunctionCall[][] = [];
|
|
174
181
|
|
|
@@ -187,6 +194,7 @@ export async function simulateViaNode(
|
|
|
187
194
|
gasSettings,
|
|
188
195
|
blockHeader,
|
|
189
196
|
skipFeeEnforcement,
|
|
197
|
+
getContractName,
|
|
190
198
|
);
|
|
191
199
|
results.push(result);
|
|
192
200
|
}
|