Skip to content

Commit 838feb3

Browse files
committed
refactor: move solidity NoteInput fn to note class
1 parent 6b9b4b9 commit 838feb3

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

packages/contracts/sdk/RollupService.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,11 +306,11 @@ export class PoolErc20Service {
306306
};
307307
}
308308

309+
/**
310+
* @deprecated use {@link Erc20Note.toSolidityNoteInput} instead
311+
*/
309312
async toNoteInput(note: Erc20Note) {
310-
return {
311-
noteHash: await note.hash(),
312-
encryptedNote: await note.encrypt(),
313-
};
313+
return await note.toSolidityNoteInput();
314314
}
315315

316316
private async getEmittedNotes(secretKey: string) {
@@ -381,6 +381,13 @@ export class Erc20Note {
381381
};
382382
}
383383

384+
async toSolidityNoteInput() {
385+
return {
386+
noteHash: await this.hash(),
387+
encryptedNote: await this.encrypt(),
388+
};
389+
}
390+
384391
async serialize(): Promise<bigint[]> {
385392
const amount = await this.amount.toNoir();
386393
return [
@@ -409,7 +416,7 @@ export class Erc20Note {
409416
});
410417
}
411418

412-
async hash() {
419+
async hash(): Promise<string> {
413420
return (await poseidon2Hash(await this.serialize())).toString();
414421
}
415422

0 commit comments

Comments
 (0)