Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
sklppy88 committed Aug 5, 2024
1 parent f481967 commit 84c3c3b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions yarn-project/aztec.js/src/wallet/base_wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -53,6 +53,10 @@ export abstract class BaseWallet implements Wallet {

abstract rotateNullifierKeys(newNskM: Fq): Promise<void>;

setScopes(scopes: AztecAddress[]) {
this.scopes = scopes;
}

getAddress() {
return this.getCompleteAddress().address;
}
Expand Down Expand Up @@ -102,10 +106,10 @@ export abstract class BaseWallet implements Wallet {
return this.pxe.getContracts();
}
proveTx(txRequest: TxExecutionRequest, simulatePublic: boolean): Promise<Tx> {
return this.pxe.proveTx(txRequest, simulatePublic);
return this.pxe.proveTx(txRequest, simulatePublic, this.scopes);
}
simulateTx(txRequest: TxExecutionRequest, simulatePublic: boolean, msgSender?: AztecAddress): Promise<SimulatedTx> {
return this.pxe.simulateTx(txRequest, simulatePublic, msgSender);
return this.pxe.simulateTx(txRequest, simulatePublic, msgSender, this.scopes);
}
sendTx(tx: Tx): Promise<TxHash> {
return this.pxe.sendTx(tx);
Expand All @@ -130,7 +134,7 @@ export abstract class BaseWallet implements Wallet {
return this.pxe.getPublicStorageAt(contract, storageSlot);
}
addNote(note: ExtendedNote): Promise<void> {
return this.pxe.addNote(note);
return this.pxe.addNote(note, this.getAddress());
}
addNullifiedNote(note: ExtendedNote): Promise<void> {
return this.pxe.addNullifiedNote(note);
Expand Down

0 comments on commit 84c3c3b

Please sign in to comment.