From 84c3c3bb319c59269bb1299c13aee27edccd2eec Mon Sep 17 00:00:00 2001 From: sklppy88 Date: Fri, 2 Aug 2024 14:39:45 +0000 Subject: [PATCH] init --- yarn-project/aztec.js/src/wallet/base_wallet.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/yarn-project/aztec.js/src/wallet/base_wallet.ts b/yarn-project/aztec.js/src/wallet/base_wallet.ts index 64fdc0abc99d..7a6d4ec81de7 100644 --- a/yarn-project/aztec.js/src/wallet/base_wallet.ts +++ b/yarn-project/aztec.js/src/wallet/base_wallet.ts @@ -39,7 +39,7 @@ import { type IntentAction, type IntentInnerHash } from '../utils/authwit.js'; * A base class for Wallet implementations */ export abstract class BaseWallet implements Wallet { - constructor(protected readonly pxe: PXE) {} + constructor(protected readonly pxe: PXE, private scopes?: AztecAddress[]) {} abstract getCompleteAddress(): CompleteAddress; @@ -53,6 +53,10 @@ export abstract class BaseWallet implements Wallet { abstract rotateNullifierKeys(newNskM: Fq): Promise; + setScopes(scopes: AztecAddress[]) { + this.scopes = scopes; + } + getAddress() { return this.getCompleteAddress().address; } @@ -102,10 +106,10 @@ export abstract class BaseWallet implements Wallet { return this.pxe.getContracts(); } proveTx(txRequest: TxExecutionRequest, simulatePublic: boolean): Promise { - return this.pxe.proveTx(txRequest, simulatePublic); + return this.pxe.proveTx(txRequest, simulatePublic, this.scopes); } simulateTx(txRequest: TxExecutionRequest, simulatePublic: boolean, msgSender?: AztecAddress): Promise { - return this.pxe.simulateTx(txRequest, simulatePublic, msgSender); + return this.pxe.simulateTx(txRequest, simulatePublic, msgSender, this.scopes); } sendTx(tx: Tx): Promise { return this.pxe.sendTx(tx); @@ -130,7 +134,7 @@ export abstract class BaseWallet implements Wallet { return this.pxe.getPublicStorageAt(contract, storageSlot); } addNote(note: ExtendedNote): Promise { - return this.pxe.addNote(note); + return this.pxe.addNote(note, this.getAddress()); } addNullifiedNote(note: ExtendedNote): Promise { return this.pxe.addNullifiedNote(note);