Skip to content

Commit 799ab41

Browse files
chore: swen/refactor utxo (#451)
1 parent 924b7ee commit 799ab41

37 files changed

+1746
-1408
lines changed

cli/src/commands/balance/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ class BalanceCommand extends Command {
176176
const amountSol = iterator.amounts[0].toString();
177177

178178
const symbol = tokenBalance[1].tokenData.symbol;
179-
const commitmentHash = iterator.utxoHash;
179+
const commitmentHash = iterator.hash;
180180

181181
tableData.push(
182182
{ prop: "Utxo No", value: i },
@@ -208,7 +208,7 @@ class BalanceCommand extends Command {
208208

209209
const symbol = tokenBalance[1].tokenData.symbol;
210210
const mint = tokenBalance[1].tokenData.mint.toString();
211-
const commitmentHash = iterator.utxoHash;
211+
const commitmentHash = iterator.hash;
212212

213213
tableData.push(
214214
{ prop: "Utxo No", value: i },
@@ -290,7 +290,7 @@ class BalanceCommand extends Command {
290290
const amountSol = iterator.amounts[0].toString();
291291
const symbol = tokenBalance.tokenData.symbol;
292292
const mint = tokenBalance.tokenData.mint.toString();
293-
const commitmentHash = iterator.utxoHash;
293+
const commitmentHash = iterator.hash;
294294
tableData.push(
295295
{ prop: "Utxo No", value: i },
296296
{ prop: "Token", value: symbol },

pnpm-lock.yaml

-155
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

psp-examples/streaming-payments/tests/streaming-payments.ts

+13-14
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ import {
2323
createProgramOutUtxo,
2424
} from "@lightprotocol/zk.js";
2525
import { LightWasm, WasmFactory } from "@lightprotocol/account.rs";
26-
import { compareOutUtxos } from "../../../zk.js/tests/test-utils/compareUtxos";
26+
import { compareOutUtxos } from "../../../zk.js/tests/test-utils/compare-utxos";
2727
import {
2828
Keypair as SolanaKeypair,
2929
Keypair,
3030
PublicKey,
3131
SystemProgram,
3232
} from "@solana/web3.js";
3333
import { IDL } from "../target/types/streaming_payments";
34-
import { createUtxoDataHash } from "@lightprotocol/zk.js";
34+
import { createDataHashWithDefaultHashingSchema } from "@lightprotocol/zk.js";
3535

3636
const path = require("path");
3737

@@ -108,11 +108,11 @@ describe("Streaming Payments tests", () => {
108108
lightWasm: WASM,
109109
assets: [SystemProgram.programId],
110110
amounts: [new BN(1_000_000)],
111-
utxoData,
112-
pspIdl: IDL,
113-
pspId: verifierProgramId,
114-
utxoName: "utxo",
115-
utxoDataHash: createUtxoDataHash(utxoData, WASM),
111+
data: utxoData,
112+
ownerIdl: IDL,
113+
owner: verifierProgramId,
114+
type: "utxo",
115+
dataHash: createDataHashWithDefaultHashingSchema(utxoData, WASM),
116116
});
117117
const testInputsCompress = {
118118
utxo: outputUtxoSol,
@@ -127,14 +127,14 @@ describe("Streaming Payments tests", () => {
127127
console.log("storeProgramUtxoResult: ", storeProgramUtxoResult);
128128
const programUtxoBalance: Map<string, ProgramUtxoBalance> =
129129
await lightUser.syncStorage(IDL);
130-
const compressedUtxoCommitmentHash =
131-
testInputsCompress.utxo.outUtxo.utxoHash;
130+
const compressedUtxoCommitmentHash = testInputsCompress.utxo.hash;
131+
132132
const inputUtxo = programUtxoBalance
133133
.get(verifierProgramId.toBase58())
134-
.tokenBalances.get(testInputsCompress.utxo.outUtxo.assets[0].toBase58())
135-
.utxos.get(compressedUtxoCommitmentHash);
134+
.tokenBalances.get(testInputsCompress.utxo.assets[0].toBase58())
135+
.utxos.get(compressedUtxoCommitmentHash.toString());
136136

137-
compareOutUtxos(inputUtxo!, testInputsCompress.utxo.outUtxo);
137+
compareOutUtxos(inputUtxo!, testInputsCompress.utxo);
138138
const circuitPath = path.join(
139139
"build-circuit/streaming-payments/streamingPayments",
140140
);
@@ -148,8 +148,7 @@ describe("Streaming Payments tests", () => {
148148
path: circuitPath,
149149
verifierIdl: IDL,
150150
circuitName: "streamingPayments",
151-
// ts-ignore
152-
checkedInUtxos: [{ utxoName: "streamInUtxo", utxo: inputUtxo }],
151+
checkedInUtxos: [{ type: "streamInUtxo", utxo: inputUtxo }],
153152
};
154153

155154
const compressedTransaction = await createTransaction({

0 commit comments

Comments
 (0)