From 78a46c95b6cfc2ece7d194ba823e50261fd7a39d Mon Sep 17 00:00:00 2001 From: Duddino Date: Mon, 28 Oct 2024 09:49:32 +0100 Subject: [PATCH] Concat new notes --- js/pivx_shield.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/js/pivx_shield.ts b/js/pivx_shield.ts index 0a974b4..50a33f9 100644 --- a/js/pivx_shield.ts +++ b/js/pivx_shield.ts @@ -22,7 +22,7 @@ interface Block { * Block that's deserialized in rust */ interface RustBlock { - txs: string[], + txs: string[]; } interface TransactionResult { @@ -342,17 +342,17 @@ export class PIVXShield { } = await this.callWorker( "handle_blocks", this.commitmentTree, - blocks.map(block=>{ - return { - txs: block.txs.map(({hex}) => hex) - } - }) satisfies RustBlock[], + blocks.map((block) => { + return { + txs: block.txs.map(({ hex }) => hex), + }; + }) satisfies RustBlock[], this.extfvk, this.isTestnet, this.unspentNotes, ); this.commitmentTree = commitment_tree; - this.unspentNotes = decrypted_notes; + this.unspentNotes = [...decrypted_notes, ...decrypted_new_notes]; for (const note of decrypted_new_notes) { const nullifier = await this.generateNullifierFromNote(note); const simplifiedNote = { @@ -410,11 +410,11 @@ export class PIVXShield { return simplifiedNotes; } - async decryptTransaction(hex: string) { + async decryptTransaction(hex: string) { const res = await this.callWorker( "handle_blocks", this.commitmentTree, - [{txs: [hex]}] satisfies RustBlock[], + [{ txs: [hex] }] satisfies RustBlock[], this.extfvk, this.isTestnet, [],