Skip to content

Commit

Permalink
Concat new notes
Browse files Browse the repository at this point in the history
  • Loading branch information
Duddino committed Oct 28, 2024
1 parent 6e9cfee commit 78a46c9
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions js/pivx_shield.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ interface Block {
* Block that's deserialized in rust
*/
interface RustBlock {
txs: string[],
txs: string[];
}

interface TransactionResult {
Expand Down Expand Up @@ -342,17 +342,17 @@ export class PIVXShield {
} = await this.callWorker<TransactionResult>(
"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 = {
Expand Down Expand Up @@ -410,11 +410,11 @@ export class PIVXShield {
return simplifiedNotes;
}

async decryptTransaction(hex: string) {
async decryptTransaction(hex: string) {
const res = await this.callWorker<TransactionResult>(
"handle_blocks",
this.commitmentTree,
[{txs: [hex]}] satisfies RustBlock[],
[{ txs: [hex] }] satisfies RustBlock[],
this.extfvk,
this.isTestnet,
[],
Expand Down

0 comments on commit 78a46c9

Please sign in to comment.