@interest-protocol/vortex-sdk 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/dist/utils/decrypt.d.ts +2 -2
- package/dist/utils/decrypt.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/utils/decrypt.ts +4 -4
package/dist/index.js
CHANGED
|
@@ -39575,19 +39575,19 @@ const verify = (proof) => {
|
|
|
39575
39575
|
throw new Error('Unsupported environment');
|
|
39576
39576
|
};
|
|
39577
39577
|
|
|
39578
|
-
const getUnspentUtxos = async ({ commitmentEvents,
|
|
39578
|
+
const getUnspentUtxos = async ({ commitmentEvents, vortexKeypair, vortex, }) => {
|
|
39579
39579
|
const commitments = parseNewCommitmentEvent(commitmentEvents);
|
|
39580
39580
|
const allUtxos = [];
|
|
39581
39581
|
commitments.forEach((commitment) => {
|
|
39582
39582
|
try {
|
|
39583
|
-
const utxo =
|
|
39583
|
+
const utxo = vortexKeypair.decryptUtxo(commitment.encryptedOutput);
|
|
39584
39584
|
allUtxos.push(utxo);
|
|
39585
39585
|
}
|
|
39586
39586
|
catch {
|
|
39587
39587
|
// Do nothing
|
|
39588
39588
|
}
|
|
39589
39589
|
});
|
|
39590
|
-
const utxos = allUtxos.map((utxo) => new Utxo({ ...utxo, keypair:
|
|
39590
|
+
const utxos = allUtxos.map((utxo) => new Utxo({ ...utxo, keypair: vortexKeypair }));
|
|
39591
39591
|
const nullifiers = utxos.map((utxo) => utxo.nullifier());
|
|
39592
39592
|
const isNullifierSpentArray = await vortex.areNullifiersSpent(nullifiers);
|
|
39593
39593
|
const unspentUtxos = utxos.filter((_, index) => !isNullifierSpentArray[index]);
|