@aztec/wallet-sdk 0.0.1-commit.cd76b27 → 0.0.1-commit.d0fcfb7f
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 +9 -3
- package/dest/base-wallet/base_wallet.d.ts.map +1 -1
- package/dest/base-wallet/base_wallet.js +42 -7
- 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 +41 -8
- package/src/base-wallet/utils.ts +8 -0
|
@@ -7,11 +7,11 @@ 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';
|
|
@@ -42,6 +42,7 @@ export declare abstract class BaseWallet implements Wallet {
|
|
|
42
42
|
protected cancellableTransactions: boolean;
|
|
43
43
|
protected constructor(pxe: PXE, aztecNode: AztecNode, log?: import("@aztec/foundation/log").Logger);
|
|
44
44
|
protected scopesFor(from: AztecAddress): AztecAddress[];
|
|
45
|
+
protected scopesFrom(from: AztecAddress, additionalScopes?: AztecAddress[]): AztecAddress[];
|
|
45
46
|
protected abstract getAccountFromAddress(address: AztecAddress): Promise<Account>;
|
|
46
47
|
abstract getAccounts(): Promise<Aliased<AztecAddress>[]>;
|
|
47
48
|
/**
|
|
@@ -119,6 +120,11 @@ export declare abstract class BaseWallet implements Wallet {
|
|
|
119
120
|
simulateTx(executionPayload: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
|
|
120
121
|
profileTx(executionPayload: ExecutionPayload, opts: ProfileOptions): Promise<TxProfileResult>;
|
|
121
122
|
sendTx<W extends InteractionWaitOptions = undefined>(executionPayload: ExecutionPayload, opts: SendOptions<W>): Promise<SendReturn<W>>;
|
|
123
|
+
/**
|
|
124
|
+
* Resolves a contract address to a human-readable name via PXE, if available.
|
|
125
|
+
* @param address - The contract address to resolve.
|
|
126
|
+
*/
|
|
127
|
+
protected getContractName(address: AztecAddress): Promise<string | undefined>;
|
|
122
128
|
protected contextualizeError(err: Error, ...context: string[]): Error;
|
|
123
129
|
executeUtility(call: FunctionCall, opts: ExecuteUtilityOptions): Promise<UtilityExecutionResult>;
|
|
124
130
|
getPrivateEvents<T>(eventDef: EventMetadataDefinition, eventFilter: PrivateEventFilter): Promise<PrivateEvent<T>[]>;
|
|
@@ -134,4 +140,4 @@ export declare abstract class BaseWallet implements Wallet {
|
|
|
134
140
|
isContractClassPubliclyRegistered: boolean;
|
|
135
141
|
}>;
|
|
136
142
|
}
|
|
137
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
143
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmFzZV93YWxsZXQuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9iYXNlLXdhbGxldC9iYXNlX3dhbGxldC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxPQUFPLEVBQUUsTUFBTSx5Qk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Ussd0JBQXdCLENBQUMsRUFBRSxFQUFFLEVBQUU7OztPQU1wQztDQUNGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base_wallet.d.ts","sourceRoot":"","sources":["../../src/base-wallet/base_wallet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,
|
|
1
|
+
{"version":3,"file":"base_wallet.d.ts","sourceRoot":"","sources":["../../src/base-wallet/base_wallet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,EACL,KAAK,sBAAsB,EAE3B,KAAK,UAAU,EAEhB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,KAAK,EACV,OAAO,EACP,eAAe,EACf,YAAY,EACZ,aAAa,EACb,qBAAqB,EACrB,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,eAAe,EACf,MAAM,EACN,kBAAkB,EACnB,MAAM,wBAAwB,CAAC;AAOhC,OAAO,EAAE,8BAA8B,EAAwC,MAAM,4BAA4B,CAAC;AAClH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAEpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,KAAK,YAAY,EAAoB,MAAM,wBAAwB,CAAC;AAC7E,OAAO,KAAK,EAAE,GAAG,EAAsB,MAAM,mBAAmB,CAAC;AACjE,OAAO,EACL,KAAK,gBAAgB,EACr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,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAe5B;IAEK,mBAAmB,CAAC,OAAO,EAAE,YAAY;;;;;;OAe9C;IAEK,wBAAwB,CAAC,EAAE,EAAE,EAAE;;;OAMpC;CACF"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { NO_WAIT } from '@aztec/aztec.js/contracts';
|
|
1
|
+
import { NO_WAIT, extractOffchainOutput } from '@aztec/aztec.js/contracts';
|
|
2
2
|
import { waitForTx } from '@aztec/aztec.js/node';
|
|
3
3
|
import { GAS_ESTIMATION_DA_GAS_LIMIT, GAS_ESTIMATION_L2_GAS_LIMIT, GAS_ESTIMATION_TEARDOWN_DA_GAS_LIMIT, GAS_ESTIMATION_TEARDOWN_L2_GAS_LIMIT } from '@aztec/constants';
|
|
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';
|
|
@@ -35,6 +37,16 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
|
|
|
35
37
|
from
|
|
36
38
|
];
|
|
37
39
|
}
|
|
40
|
+
scopesFrom(from, additionalScopes = []) {
|
|
41
|
+
const allScopes = from.isZero() ? additionalScopes : [
|
|
42
|
+
from,
|
|
43
|
+
...additionalScopes
|
|
44
|
+
];
|
|
45
|
+
const scopeSet = new Set(allScopes.map((address)=>address.toString()));
|
|
46
|
+
return [
|
|
47
|
+
...scopeSet
|
|
48
|
+
].map(AztecAddress.fromString);
|
|
49
|
+
}
|
|
38
50
|
/**
|
|
39
51
|
* Returns the list of aliased contacts associated with the wallet.
|
|
40
52
|
* This base implementation directly returns PXE's senders, but note that in general contacts are a superset of senders.
|
|
@@ -232,8 +244,8 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
|
|
|
232
244
|
blockHeader = await this.aztecNode.getBlockHeader();
|
|
233
245
|
}
|
|
234
246
|
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.
|
|
247
|
+
optimizableCalls.length > 0 ? simulateViaNode(this.aztecNode, optimizableCalls, opts.from, chainInfo, feeOptions.gasSettings, blockHeader, opts.skipFeeEnforcement ?? true, this.getContractName.bind(this)) : Promise.resolve([]),
|
|
248
|
+
remainingCalls.length > 0 ? this.simulateViaEntrypoint(remainingPayload, opts.from, feeOptions, this.scopesFrom(opts.from, opts.additionalScopes), opts.skipTxValidation, opts.skipFeeEnforcement ?? true) : Promise.resolve(null)
|
|
237
249
|
]);
|
|
238
250
|
return buildMergedSimulationResult(optimizedResults, normalResult);
|
|
239
251
|
}
|
|
@@ -243,13 +255,14 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
|
|
|
243
255
|
return this.pxe.profileTx(txRequest, {
|
|
244
256
|
profileMode: opts.profileMode,
|
|
245
257
|
skipProofGeneration: opts.skipProofGeneration ?? true,
|
|
246
|
-
scopes: this.
|
|
258
|
+
scopes: this.scopesFrom(opts.from, opts.additionalScopes)
|
|
247
259
|
});
|
|
248
260
|
}
|
|
249
261
|
async sendTx(executionPayload, opts) {
|
|
250
262
|
const feeOptions = await this.completeFeeOptions(opts.from, executionPayload.feePayer, opts.fee?.gasSettings);
|
|
251
263
|
const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(executionPayload, opts.from, feeOptions);
|
|
252
|
-
const provenTx = await this.pxe.proveTx(txRequest, this.
|
|
264
|
+
const provenTx = await this.pxe.proveTx(txRequest, this.scopesFrom(opts.from, opts.additionalScopes));
|
|
265
|
+
const offchainOutput = extractOffchainOutput(provenTx.getOffchainEffects());
|
|
253
266
|
const tx = await provenTx.toTx();
|
|
254
267
|
const txHash = tx.getTxHash();
|
|
255
268
|
if (await this.aztecNode.getTxEffect(txHash)) {
|
|
@@ -262,11 +275,33 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
|
|
|
262
275
|
this.log.info(`Sent transaction ${txHash}`);
|
|
263
276
|
// If wait is NO_WAIT, return txHash immediately
|
|
264
277
|
if (opts.wait === NO_WAIT) {
|
|
265
|
-
return
|
|
278
|
+
return {
|
|
279
|
+
txHash,
|
|
280
|
+
...offchainOutput
|
|
281
|
+
};
|
|
266
282
|
}
|
|
267
283
|
// Otherwise, wait for the full receipt (default behavior on wait: undefined)
|
|
268
284
|
const waitOpts = typeof opts.wait === 'object' ? opts.wait : undefined;
|
|
269
|
-
|
|
285
|
+
const receipt = await waitForTx(this.aztecNode, txHash, waitOpts);
|
|
286
|
+
// Display debug logs from public execution if present (served in test mode only)
|
|
287
|
+
if (receipt.debugLogs?.length) {
|
|
288
|
+
await displayDebugLogs(receipt.debugLogs, this.getContractName.bind(this));
|
|
289
|
+
}
|
|
290
|
+
return {
|
|
291
|
+
receipt,
|
|
292
|
+
...offchainOutput
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Resolves a contract address to a human-readable name via PXE, if available.
|
|
297
|
+
* @param address - The contract address to resolve.
|
|
298
|
+
*/ async getContractName(address) {
|
|
299
|
+
const instance = await this.pxe.getContractInstance(address);
|
|
300
|
+
if (!instance) {
|
|
301
|
+
return undefined;
|
|
302
|
+
}
|
|
303
|
+
const artifact = await this.pxe.getContractArtifact(instance.currentContractClassId);
|
|
304
|
+
return artifact?.name;
|
|
270
305
|
}
|
|
271
306
|
contextualizeError(err, ...context) {
|
|
272
307
|
let contextStr = '';
|
|
@@ -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/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LEVBQUUsWUFBWSxFQUNsQixTQUFTLEVBQUUsU0FBUyxFQUNwQixXQUFXLEVBQUUsV0FBVyxFQUN4QixXQUFXLEVBQUUsV0FBVyxFQUN4QixrQkFBa0IscUJBQWdCLEVBQ2xDLGVBQWUsRUFBRSxvQkFBb0IsR0FDcEMsT0FBTyxDQUFDLGtCQUFrQixFQUFFLENBQUMsQ0F3Qi9CO0FBRUQ7Ozs7Ozs7OztHQVNHO0FBQ0gsd0JBQWdCLDJCQUEyQixDQUN6QyxnQkFBZ0IsRUFBRSxrQkFBa0IsRUFBRSxFQUN0QyxZQUFZLEVBQUUsa0JBQWtCLEdBQUcsSUFBSSxHQUN0QyxrQkFBa0IsQ0FvQnBCIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/base-wallet/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/base-wallet/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAI/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAGnE,OAAO,EAAE,KAAK,YAAY,EAAoB,MAAM,mBAAmB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAQrD,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,gBAAgB,EAOrB,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAE1B;;;;;;;;;GASG;AACH,wBAAgB,mCAAmC,CAAC,OAAO,EAAE,gBAAgB,GAAG;IAC9E,uEAAuE;IACvE,gBAAgB,EAAE,YAAY,EAAE,CAAC;IACjC,2BAA2B;IAC3B,cAAc,EAAE,YAAY,EAAE,CAAC;CAChC,CAOA;AAuGD;;;;;;;;;;;;GAYG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,SAAS,EACf,iBAAiB,EAAE,YAAY,EAAE,EACjC,IAAI,EAAE,YAAY,EAClB,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,kBAAkB,qBAAgB,EAClC,eAAe,EAAE,oBAAoB,GACpC,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAwB/B;AAED;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CACzC,gBAAgB,EAAE,kBAAkB,EAAE,EACtC,YAAY,EAAE,kBAAkB,GAAG,IAAI,GACtC,kBAAkB,CAoBpB"}
|
|
@@ -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.d0fcfb7f",
|
|
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.d0fcfb7f",
|
|
75
|
+
"@aztec/constants": "0.0.1-commit.d0fcfb7f",
|
|
76
|
+
"@aztec/entrypoints": "0.0.1-commit.d0fcfb7f",
|
|
77
|
+
"@aztec/foundation": "0.0.1-commit.d0fcfb7f",
|
|
78
|
+
"@aztec/pxe": "0.0.1-commit.d0fcfb7f",
|
|
79
|
+
"@aztec/stdlib": "0.0.1-commit.d0fcfb7f"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
|
-
"@aztec/noir-contracts.js": "0.0.1-commit.
|
|
82
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.d0fcfb7f",
|
|
83
83
|
"@jest/globals": "^30.0.0",
|
|
84
84
|
"@types/jest": "^30.0.0",
|
|
85
85
|
"@types/node": "^22.15.17",
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { Account } from '@aztec/aztec.js/account';
|
|
2
2
|
import type { CallIntent, IntentInnerHash } from '@aztec/aztec.js/authorization';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
type InteractionWaitOptions,
|
|
5
|
+
NO_WAIT,
|
|
6
|
+
type SendReturn,
|
|
7
|
+
extractOffchainOutput,
|
|
8
|
+
} from '@aztec/aztec.js/contracts';
|
|
4
9
|
import type { FeePaymentMethod } from '@aztec/aztec.js/fee';
|
|
5
10
|
import { waitForTx } from '@aztec/aztec.js/node';
|
|
6
11
|
import type {
|
|
@@ -28,7 +33,7 @@ import type { ChainInfo } from '@aztec/entrypoints/interfaces';
|
|
|
28
33
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
29
34
|
import { createLogger } from '@aztec/foundation/log';
|
|
30
35
|
import type { FieldsOf } from '@aztec/foundation/types';
|
|
31
|
-
import type
|
|
36
|
+
import { type AccessScopes, displayDebugLogs } from '@aztec/pxe/client/lazy';
|
|
32
37
|
import type { PXE, PackedPrivateEvent } from '@aztec/pxe/server';
|
|
33
38
|
import {
|
|
34
39
|
type ContractArtifact,
|
|
@@ -37,7 +42,7 @@ import {
|
|
|
37
42
|
decodeFromAbi,
|
|
38
43
|
} from '@aztec/stdlib/abi';
|
|
39
44
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
40
|
-
import
|
|
45
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
41
46
|
import {
|
|
42
47
|
type ContractInstanceWithAddress,
|
|
43
48
|
computePartialAddress,
|
|
@@ -95,6 +100,12 @@ export abstract class BaseWallet implements Wallet {
|
|
|
95
100
|
return from.isZero() ? [] : [from];
|
|
96
101
|
}
|
|
97
102
|
|
|
103
|
+
protected scopesFrom(from: AztecAddress, additionalScopes: AztecAddress[] = []): AztecAddress[] {
|
|
104
|
+
const allScopes = from.isZero() ? additionalScopes : [from, ...additionalScopes];
|
|
105
|
+
const scopeSet = new Set(allScopes.map(address => address.toString()));
|
|
106
|
+
return [...scopeSet].map(AztecAddress.fromString);
|
|
107
|
+
}
|
|
108
|
+
|
|
98
109
|
protected abstract getAccountFromAddress(address: AztecAddress): Promise<Account>;
|
|
99
110
|
|
|
100
111
|
abstract getAccounts(): Promise<Aliased<AztecAddress>[]>;
|
|
@@ -348,6 +359,7 @@ export abstract class BaseWallet implements Wallet {
|
|
|
348
359
|
feeOptions.gasSettings,
|
|
349
360
|
blockHeader,
|
|
350
361
|
opts.skipFeeEnforcement ?? true,
|
|
362
|
+
this.getContractName.bind(this),
|
|
351
363
|
)
|
|
352
364
|
: Promise.resolve([]),
|
|
353
365
|
remainingCalls.length > 0
|
|
@@ -355,7 +367,7 @@ export abstract class BaseWallet implements Wallet {
|
|
|
355
367
|
remainingPayload,
|
|
356
368
|
opts.from,
|
|
357
369
|
feeOptions,
|
|
358
|
-
this.
|
|
370
|
+
this.scopesFrom(opts.from, opts.additionalScopes),
|
|
359
371
|
opts.skipTxValidation,
|
|
360
372
|
opts.skipFeeEnforcement ?? true,
|
|
361
373
|
)
|
|
@@ -371,7 +383,7 @@ export abstract class BaseWallet implements Wallet {
|
|
|
371
383
|
return this.pxe.profileTx(txRequest, {
|
|
372
384
|
profileMode: opts.profileMode,
|
|
373
385
|
skipProofGeneration: opts.skipProofGeneration ?? true,
|
|
374
|
-
scopes: this.
|
|
386
|
+
scopes: this.scopesFrom(opts.from, opts.additionalScopes),
|
|
375
387
|
});
|
|
376
388
|
}
|
|
377
389
|
|
|
@@ -381,7 +393,8 @@ export abstract class BaseWallet implements Wallet {
|
|
|
381
393
|
): Promise<SendReturn<W>> {
|
|
382
394
|
const feeOptions = await this.completeFeeOptions(opts.from, executionPayload.feePayer, opts.fee?.gasSettings);
|
|
383
395
|
const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(executionPayload, opts.from, feeOptions);
|
|
384
|
-
const provenTx = await this.pxe.proveTx(txRequest, this.
|
|
396
|
+
const provenTx = await this.pxe.proveTx(txRequest, this.scopesFrom(opts.from, opts.additionalScopes));
|
|
397
|
+
const offchainOutput = extractOffchainOutput(provenTx.getOffchainEffects());
|
|
385
398
|
const tx = await provenTx.toTx();
|
|
386
399
|
const txHash = tx.getTxHash();
|
|
387
400
|
if (await this.aztecNode.getTxEffect(txHash)) {
|
|
@@ -395,12 +408,32 @@ export abstract class BaseWallet implements Wallet {
|
|
|
395
408
|
|
|
396
409
|
// If wait is NO_WAIT, return txHash immediately
|
|
397
410
|
if (opts.wait === NO_WAIT) {
|
|
398
|
-
return txHash as SendReturn<W>;
|
|
411
|
+
return { txHash, ...offchainOutput } as SendReturn<W>;
|
|
399
412
|
}
|
|
400
413
|
|
|
401
414
|
// Otherwise, wait for the full receipt (default behavior on wait: undefined)
|
|
402
415
|
const waitOpts = typeof opts.wait === 'object' ? opts.wait : undefined;
|
|
403
|
-
|
|
416
|
+
const receipt = await waitForTx(this.aztecNode, txHash, waitOpts);
|
|
417
|
+
|
|
418
|
+
// Display debug logs from public execution if present (served in test mode only)
|
|
419
|
+
if (receipt.debugLogs?.length) {
|
|
420
|
+
await displayDebugLogs(receipt.debugLogs, this.getContractName.bind(this));
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
return { receipt, ...offchainOutput } as SendReturn<W>;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* Resolves a contract address to a human-readable name via PXE, if available.
|
|
428
|
+
* @param address - The contract address to resolve.
|
|
429
|
+
*/
|
|
430
|
+
protected async getContractName(address: AztecAddress): Promise<string | undefined> {
|
|
431
|
+
const instance = await this.pxe.getContractInstance(address);
|
|
432
|
+
if (!instance) {
|
|
433
|
+
return undefined;
|
|
434
|
+
}
|
|
435
|
+
const artifact = await this.pxe.getContractArtifact(instance.currentContractClassId);
|
|
436
|
+
return artifact?.name;
|
|
404
437
|
}
|
|
405
438
|
|
|
406
439
|
protected contextualizeError(err: Error, ...context: string[]): Error {
|
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
|
}
|