Skip to content

Commit 9d87498

Browse files
committed
new utxo blobs
1 parent 2f1711a commit 9d87498

1 file changed

Lines changed: 14 additions & 29 deletions

File tree

src/model/utxo-state.ts

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,19 @@
1-
import { BorshSchema, borshDeserialize } from "borsher";
2-
3-
export interface HyliUtxoStateBlob {
4-
output_note_commit0: number[];
5-
output_note_commit1: number[];
6-
nullifier0: number[];
7-
nullifier1: number[];
8-
}
9-
101
export interface HyliUtxoBlob {
11-
input_note_commit0: number[];
12-
input_note_commit1: number[];
13-
nullifier0: number[];
14-
nullifier1: number[];
2+
output_note0: number[];
3+
output_note1: number[];
4+
input_nullifier0: number[];
5+
input_nullifier1: number[];
156
}
167

178
export interface HyliSmtInclusionProofBlob {
18-
input_note_commit0: number[];
19-
input_note_commit1: number[];
9+
input_nullifier0: number[];
10+
input_nullifier1: number[];
2011
notes_root: number[];
2112
}
2213

23-
export const deserializeUtxoStateAction = (data: number[]): HyliUtxoStateBlob => {
24-
if (data.length !== 128) {
25-
throw new Error(`Expected 128 bytes for utxo blob, got ${data.length}`);
26-
}
14+
export const deserializeUtxoStateAction = (_data: number[]) => {
2715
return {
28-
output_note_commit0: data.slice(0, 32),
29-
output_note_commit1: data.slice(32, 64),
30-
nullifier0: data.slice(64, 96),
31-
nullifier1: data.slice(96, 128),
16+
UtxoStateAction: "no blob data",
3217
};
3318
};
3419

@@ -37,10 +22,10 @@ export const deserializeUtxoBlob = (data: number[]): HyliUtxoBlob => {
3722
throw new Error(`Expected 128 bytes for utxo blob, got ${data.length}`);
3823
}
3924
return {
40-
input_note_commit0: data.slice(0, 32),
41-
input_note_commit1: data.slice(32, 64),
42-
nullifier0: data.slice(64, 96),
43-
nullifier1: data.slice(96, 128),
25+
output_note0: data.slice(0, 32),
26+
output_note1: data.slice(32, 64),
27+
input_nullifier0: data.slice(64, 96),
28+
input_nullifier1: data.slice(96, 128),
4429
};
4530
};
4631

@@ -49,8 +34,8 @@ export const deserializeSmtInclusionProof = (data: number[]): HyliSmtInclusionPr
4934
throw new Error(`Expected at least 96 bytes for SMT inclusion proof, got ${data.length}`);
5035
}
5136
return {
52-
input_note_commit0: data.slice(0, 32),
53-
input_note_commit1: data.slice(32, 64),
37+
input_nullifier0: data.slice(0, 32),
38+
input_nullifier1: data.slice(32, 64),
5439
notes_root: data.slice(64, 96),
5540
};
5641
};

0 commit comments

Comments
 (0)