Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
sklppy88 committed Dec 8, 2024
1 parent 5e6660f commit 98973ff
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 52 deletions.
3 changes: 0 additions & 3 deletions yarn-project/aztec.js/src/wallet/base_wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,6 @@ export abstract class BaseWallet implements Wallet {
getIncomingNotes(filter: IncomingNotesFilter): Promise<UniqueNote[]> {
return this.pxe.getIncomingNotes(filter);
}
getOutgoingNotes(filter: OutgoingNotesFilter): Promise<UniqueNote[]> {
return this.pxe.getOutgoingNotes(filter);
}
getPublicStorageAt(contract: AztecAddress, storageSlot: Fr): Promise<any> {
return this.pxe.getPublicStorageAt(contract, storageSlot);
}
Expand Down
9 changes: 0 additions & 9 deletions yarn-project/circuit-types/src/interfaces/pxe.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,6 @@ describe('PXESchema', () => {
expect(result).toEqual([expect.any(BigInt), expect.any(SiblingPath)]);
});

it('getOutgoingNotes', async () => {
const result = await context.client.getOutgoingNotes({ contractAddress: address });
expect(result).toEqual([expect.any(UniqueNote)]);
});

it('addNote', async () => {
await context.client.addNote(ExtendedNote.random(), address);
});
Expand Down Expand Up @@ -424,10 +419,6 @@ class MockPXE implements PXE {
expect(secret).toBeInstanceOf(Fr);
return Promise.resolve([1n, SiblingPath.random(L1_TO_L2_MSG_TREE_HEIGHT)]);
}
getOutgoingNotes(filter: OutgoingNotesFilter): Promise<UniqueNote[]> {
expect(filter.contractAddress).toEqual(this.address);
return Promise.resolve([UniqueNote.random()]);
}
addNote(note: ExtendedNote, scope?: AztecAddress | undefined): Promise<void> {
expect(note).toBeInstanceOf(ExtendedNote);
expect(scope).toEqual(this.address);
Expand Down
8 changes: 0 additions & 8 deletions yarn-project/circuit-types/src/interfaces/pxe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,6 @@ export interface PXE {
secret: Fr,
): Promise<[bigint, SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>]>;

/**
* Gets outgoing notes of accounts registered in this PXE based on the provided filter.
* @param filter - The filter to apply to the notes.
* @returns The requested notes.
*/
getOutgoingNotes(filter: OutgoingNotesFilter): Promise<UniqueNote[]>;

/**
* Adds a note to the database.
* @throws If the note hash of the note doesn't exist in the tree.
Expand Down Expand Up @@ -510,7 +503,6 @@ export const PXESchema: ApiSchemaFor<PXE> = {
.function()
.args(schemas.AztecAddress, schemas.Fr, schemas.Fr)
.returns(z.tuple([schemas.BigInt, SiblingPath.schemaFor(L1_TO_L2_MSG_TREE_HEIGHT)])),
getOutgoingNotes: z.function().args(OutgoingNotesFilterSchema).returns(z.array(UniqueNote.schema)),
addNote: z.function().args(ExtendedNote.schema, optional(schemas.AztecAddress)).returns(z.void()),
addNullifiedNote: z.function().args(ExtendedNote.schema).returns(z.void()),
getBlock: z
Expand Down
5 changes: 0 additions & 5 deletions yarn-project/end-to-end/src/e2e_2_pxes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,8 @@ describe('e2e_2_pxes', () => {
.wait();
await testContract.methods.sync_notes().simulate();
const incomingNotes = await walletA.getIncomingNotes({ txHash: receipt.txHash });
const outgoingNotes = await walletA.getOutgoingNotes({ txHash: receipt.txHash });
expect(incomingNotes).toHaveLength(1);
note = incomingNotes[0];

// Since owner is the same as outgoing viewer the incoming and outgoing notes should be the same
expect(outgoingNotes).toHaveLength(1);
expect(outgoingNotes[0]).toEqual(note);
}

// 3. Nullify the note
Expand Down
27 changes: 0 additions & 27 deletions yarn-project/pxe/src/pxe_service/pxe_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,33 +330,6 @@ export class PXEService implements PXE {
return Promise.all(extendedNotes);
}

public async getOutgoingNotes(filter: OutgoingNotesFilter): Promise<UniqueNote[]> {
const noteDaos = await this.db.getOutgoingNotes(filter);

const extendedNotes = noteDaos.map(async dao => {
let owner = filter.owner;
if (owner === undefined) {
const completeAddresses = (await this.db.getCompleteAddresses()).find(address =>
address.publicKeys.masterOutgoingViewingPublicKey.equals(dao.ovpkM),
);
if (completeAddresses === undefined) {
throw new Error(`Cannot find complete address for OvpkM ${dao.ovpkM.toString()}`);
}
owner = completeAddresses.address;
}
return new UniqueNote(
dao.note,
owner,
dao.contractAddress,
dao.storageSlot,
dao.noteTypeId,
dao.txHash,
dao.nonce,
);
});
return Promise.all(extendedNotes);
}

public async getL1ToL2MembershipWitness(
contractAddress: AztecAddress,
messageHash: Fr,
Expand Down

0 comments on commit 98973ff

Please sign in to comment.