@permissionless-technologies/upp-sdk 0.3.6 → 0.4.1
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/{asp-ZA3RGN7G.js → asp-72WUGTQE.js} +3 -3
- package/dist/asp-72WUGTQE.js.map +1 -0
- package/dist/{asp-TXSAFFD3.cjs → asp-CUE3NMBN.cjs} +14 -14
- package/dist/asp-CUE3NMBN.cjs.map +1 -0
- package/dist/{chunk-KXPZUBPI.cjs → chunk-23B5XSS4.cjs} +12 -12
- package/dist/{chunk-KXPZUBPI.cjs.map → chunk-23B5XSS4.cjs.map} +1 -1
- package/dist/{chunk-SQKBT2SH.cjs → chunk-2G22R7AJ.cjs} +18 -7
- package/dist/chunk-2G22R7AJ.cjs.map +1 -0
- package/dist/chunk-5QSSX3KR.js +64 -0
- package/dist/chunk-5QSSX3KR.js.map +1 -0
- package/dist/{chunk-P37MRZ73.js → chunk-6IEYWJVS.js} +8 -8
- package/dist/chunk-6IEYWJVS.js.map +1 -0
- package/dist/{chunk-5V5HSN6Y.js → chunk-6TFDBBAQ.js} +3 -3
- package/dist/{chunk-5V5HSN6Y.js.map → chunk-6TFDBBAQ.js.map} +1 -1
- package/dist/{chunk-ZKZV6OI3.cjs → chunk-7BNJV2ZS.cjs} +21 -21
- package/dist/{chunk-ZKZV6OI3.cjs.map → chunk-7BNJV2ZS.cjs.map} +1 -1
- package/dist/{chunk-XBNYAAMU.js → chunk-7T4CUE6E.js} +3 -3
- package/dist/{chunk-XBNYAAMU.js.map → chunk-7T4CUE6E.js.map} +1 -1
- package/dist/{chunk-NI62M3W3.cjs → chunk-BZD5KJL3.cjs} +2 -2
- package/dist/{chunk-NI62M3W3.cjs.map → chunk-BZD5KJL3.cjs.map} +1 -1
- package/dist/{chunk-OD2SDC4L.js → chunk-CEJN5ZE5.js} +3 -3
- package/dist/{chunk-OD2SDC4L.js.map → chunk-CEJN5ZE5.js.map} +1 -1
- package/dist/{chunk-2JQISXBD.js → chunk-DTEAFJG7.js} +8 -8
- package/dist/{chunk-2JQISXBD.js.map → chunk-DTEAFJG7.js.map} +1 -1
- package/dist/chunk-EHGH6TAW.js +100 -0
- package/dist/chunk-EHGH6TAW.js.map +1 -0
- package/dist/{chunk-ZU6J7KMY.js → chunk-GPF72JFR.js} +3 -3
- package/dist/{chunk-ZU6J7KMY.js.map → chunk-GPF72JFR.js.map} +1 -1
- package/dist/chunk-HEHXSV47.cjs +77 -0
- package/dist/chunk-HEHXSV47.cjs.map +1 -0
- package/dist/chunk-I5EKGD4P.cjs +113 -0
- package/dist/chunk-I5EKGD4P.cjs.map +1 -0
- package/dist/{chunk-EUP7MBAH.cjs → chunk-IIUKM5VE.cjs} +7 -7
- package/dist/{chunk-EUP7MBAH.cjs.map → chunk-IIUKM5VE.cjs.map} +1 -1
- package/dist/{chunk-7Q4RSSHM.js → chunk-MDF37354.js} +2 -2
- package/dist/{chunk-7Q4RSSHM.js.map → chunk-MDF37354.js.map} +1 -1
- package/dist/{chunk-CWSUBAV3.js → chunk-OBBSIPEK.js} +30 -35
- package/dist/chunk-OBBSIPEK.js.map +1 -0
- package/dist/{chunk-FVT2XRRL.cjs → chunk-Q2E432UK.cjs} +41 -46
- package/dist/chunk-Q2E432UK.cjs.map +1 -0
- package/dist/{chunk-QKI4QWLT.js → chunk-RNUG3EFC.js} +6 -6
- package/dist/{chunk-QKI4QWLT.js.map → chunk-RNUG3EFC.js.map} +1 -1
- package/dist/{chunk-3YZSIYJC.cjs → chunk-SWTNJPK5.cjs} +11 -11
- package/dist/{chunk-3YZSIYJC.cjs.map → chunk-SWTNJPK5.cjs.map} +1 -1
- package/dist/{chunk-BH24DZ5S.cjs → chunk-U3YFYMWF.cjs} +5 -5
- package/dist/{chunk-BH24DZ5S.cjs.map → chunk-U3YFYMWF.cjs.map} +1 -1
- package/dist/{chunk-3HQ7A6ZM.cjs → chunk-UFEDJJSH.cjs} +5 -5
- package/dist/{chunk-3HQ7A6ZM.cjs.map → chunk-UFEDJJSH.cjs.map} +1 -1
- package/dist/{chunk-W77GRBO4.js → chunk-UQIM2KT3.js} +3 -3
- package/dist/{chunk-W77GRBO4.js.map → chunk-UQIM2KT3.js.map} +1 -1
- package/dist/{chunk-SJDPDHSD.cjs → chunk-UTAJSERA.cjs} +4 -4
- package/dist/{chunk-SJDPDHSD.cjs.map → chunk-UTAJSERA.cjs.map} +1 -1
- package/dist/{chunk-S4B7GYLN.js → chunk-W3HLIKC2.js} +18 -8
- package/dist/chunk-W3HLIKC2.js.map +1 -0
- package/dist/{chunk-NDM5EJEV.cjs → chunk-XVIICZKW.cjs} +7 -7
- package/dist/chunk-XVIICZKW.cjs.map +1 -0
- package/dist/core/index.cjs +85 -85
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +10 -10
- package/dist/{index-B45-okum.d.cts → index-BgPdYxFS.d.cts} +18 -18
- package/dist/{index-o-Ds3YAq.d.cts → index-CL4vb3ej.d.cts} +1 -1
- package/dist/{index-BIcvNMPt.d.ts → index-CtcXgof_.d.ts} +18 -18
- package/dist/{index-DwAJBoU7.d.ts → index-D6nvfm59.d.ts} +1 -1
- package/dist/index.cjs +279 -280
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +29 -30
- package/dist/index.js.map +1 -1
- package/dist/indexer/index.cjs +6 -6
- package/dist/indexer/index.d.cts +5 -5
- package/dist/indexer/index.d.ts +5 -5
- package/dist/indexer/index.js +1 -1
- package/dist/keys/index.cjs +18 -18
- package/dist/keys/index.js +4 -4
- package/dist/merkle-DZHEOPH3.cjs +30 -0
- package/dist/{merkle-HGDC6OB4.cjs.map → merkle-DZHEOPH3.cjs.map} +1 -1
- package/dist/merkle-IF2RMWCF.js +5 -0
- package/dist/{merkle-7KS2EHRF.js.map → merkle-IF2RMWCF.js.map} +1 -1
- package/dist/poseidon-ACM7E2OH.js +7 -0
- package/dist/{poseidon-UHTJLWQM.js.map → poseidon-ACM7E2OH.js.map} +1 -1
- package/dist/poseidon-PUSGUIVZ.cjs +61 -0
- package/dist/{poseidon-WHJSZSNP.cjs.map → poseidon-PUSGUIVZ.cjs.map} +1 -1
- package/dist/proof-JME3IZTX.js +4 -0
- package/dist/{proof-C4YBP6RY.js.map → proof-JME3IZTX.js.map} +1 -1
- package/dist/proof-XR6XE5PJ.cjs +49 -0
- package/dist/{proof-5OECB3RQ.cjs.map → proof-XR6XE5PJ.cjs.map} +1 -1
- package/dist/react/index.cjs +62 -116
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +27 -12
- package/dist/react/index.d.ts +27 -12
- package/dist/react/index.js +35 -89
- package/dist/react/index.js.map +1 -1
- package/dist/{transfer-BzyernBd.d.cts → transfer-D111ihqN.d.cts} +108 -56
- package/dist/{transfer-sqS6mJko.d.ts → transfer-DvIXqHCr.d.ts} +108 -56
- package/dist/transfer-MQMGSXTH.js +8 -0
- package/dist/{transfer-F6YOQTUL.js.map → transfer-MQMGSXTH.js.map} +1 -1
- package/dist/transfer-PB6D5VCW.cjs +37 -0
- package/dist/{transfer-42C4DXYA.cjs.map → transfer-PB6D5VCW.cjs.map} +1 -1
- package/dist/utils/index.cjs +60 -61
- package/dist/utils/index.d.cts +37 -14
- package/dist/utils/index.d.ts +37 -14
- package/dist/utils/index.js +6 -7
- package/package.json +4 -2
- package/src/contracts/interfaces/IUniversalPrivatePool.sol +10 -8
- package/src/contracts/interfaces/IVerifiers.sol +16 -52
- package/src/deployments/11155111.json +15 -12
- package/dist/asp-TXSAFFD3.cjs.map +0 -1
- package/dist/asp-ZA3RGN7G.js.map +0 -1
- package/dist/babyjubjub-2MGQVCKB.js +0 -5
- package/dist/babyjubjub-2MGQVCKB.js.map +0 -1
- package/dist/babyjubjub-MWZLJOVZ.cjs +0 -66
- package/dist/babyjubjub-MWZLJOVZ.cjs.map +0 -1
- package/dist/chunk-CWSUBAV3.js.map +0 -1
- package/dist/chunk-FVT2XRRL.cjs.map +0 -1
- package/dist/chunk-JWNXBALH.cjs +0 -57
- package/dist/chunk-JWNXBALH.cjs.map +0 -1
- package/dist/chunk-NDM5EJEV.cjs.map +0 -1
- package/dist/chunk-P37MRZ73.js.map +0 -1
- package/dist/chunk-PTDVGWHU.cjs +0 -10
- package/dist/chunk-PTDVGWHU.cjs.map +0 -1
- package/dist/chunk-S4B7GYLN.js.map +0 -1
- package/dist/chunk-SQKBT2SH.cjs.map +0 -1
- package/dist/chunk-TSF6HEVS.cjs +0 -201
- package/dist/chunk-TSF6HEVS.cjs.map +0 -1
- package/dist/chunk-UAVWYXDN.js +0 -8
- package/dist/chunk-UAVWYXDN.js.map +0 -1
- package/dist/chunk-V23OSL25.js +0 -48
- package/dist/chunk-V23OSL25.js.map +0 -1
- package/dist/chunk-YOWDERVC.js +0 -186
- package/dist/chunk-YOWDERVC.js.map +0 -1
- package/dist/merkle-7KS2EHRF.js +0 -5
- package/dist/merkle-HGDC6OB4.cjs +0 -30
- package/dist/poseidon-UHTJLWQM.js +0 -7
- package/dist/poseidon-WHJSZSNP.cjs +0 -45
- package/dist/proof-5OECB3RQ.cjs +0 -45
- package/dist/proof-C4YBP6RY.js +0 -4
- package/dist/transfer-42C4DXYA.cjs +0 -37
- package/dist/transfer-F6YOQTUL.js +0 -8
package/dist/react/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ax as NoteCreationResult, ay as ShieldedNote, O as TransferStage, I as SwapOrderEvent } from '../transfer-
|
|
2
|
-
export { A as ASPProof, aF as ASP_TREE_DEPTH, aD as IndexerConfig, aC as ProofSystemType, aE as SignTypedDataFn, aB as UPPAccountContextType, aA as UPPAccountProvider, Y as buildASPTree, a2 as computeMultiOriginASPRoot, a5 as computeSingleOriginASPRoot, ae as generateASPProof, ag as generateMultiOriginASPProof, ai as generateSingleOriginASPProof, az as useUPPAccount } from '../transfer-
|
|
1
|
+
import { ax as NoteCreationResult, ay as ShieldedNote, O as TransferStage, I as SwapOrderEvent } from '../transfer-D111ihqN.cjs';
|
|
2
|
+
export { A as ASPProof, aF as ASP_TREE_DEPTH, aD as IndexerConfig, aC as ProofSystemType, aE as SignTypedDataFn, aB as UPPAccountContextType, aA as UPPAccountProvider, Y as buildASPTree, a2 as computeMultiOriginASPRoot, a5 as computeSingleOriginASPRoot, ae as generateASPProof, ag as generateMultiOriginASPProof, ai as generateSingleOriginASPProof, az as useUPPAccount } from '../transfer-D111ihqN.cjs';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import { CSSProperties } from 'react';
|
|
@@ -253,8 +253,11 @@ interface PoolTransferParams {
|
|
|
253
253
|
interface PoolTransferBuildData {
|
|
254
254
|
/** Circuit used: 'transfer' for UPP 1-in-2-out */
|
|
255
255
|
circuit: 'transfer';
|
|
256
|
-
/**
|
|
257
|
-
proof:
|
|
256
|
+
/** PLONK proof bytes for contract call */
|
|
257
|
+
proof: {
|
|
258
|
+
proofBytes: `0x${string}`;
|
|
259
|
+
publicSignals: bigint[];
|
|
260
|
+
};
|
|
258
261
|
/** Nullifier */
|
|
259
262
|
nullifier: Hex;
|
|
260
263
|
/** Merkle state root */
|
|
@@ -333,8 +336,11 @@ interface WithdrawParams {
|
|
|
333
336
|
* Withdraw build data - everything needed to call the contract
|
|
334
337
|
*/
|
|
335
338
|
interface WithdrawBuildData {
|
|
336
|
-
/**
|
|
337
|
-
proof:
|
|
339
|
+
/** PLONK proof bytes for contract call */
|
|
340
|
+
proof: {
|
|
341
|
+
proofBytes: `0x${string}`;
|
|
342
|
+
publicSignals: bigint[];
|
|
343
|
+
};
|
|
338
344
|
/** Nullifier of the note being spent */
|
|
339
345
|
nullifier: Hex;
|
|
340
346
|
/** Merkle state root */
|
|
@@ -539,8 +545,11 @@ interface SwapConfig {
|
|
|
539
545
|
* Build data returned by buildPlaceOrder — everything needed for the contract call
|
|
540
546
|
*/
|
|
541
547
|
interface PlaceOrderBuildData {
|
|
542
|
-
/**
|
|
543
|
-
proof:
|
|
548
|
+
/** PLONK proof bytes for contract call */
|
|
549
|
+
proof: {
|
|
550
|
+
proofBytes: `0x${string}`;
|
|
551
|
+
publicSignals: bigint[];
|
|
552
|
+
};
|
|
544
553
|
/** Nullifier (= orderId) */
|
|
545
554
|
nullifier: Hex;
|
|
546
555
|
/** Merkle state root */
|
|
@@ -572,8 +581,11 @@ interface PlaceOrderBuildData {
|
|
|
572
581
|
* Build data returned by buildFillOrder
|
|
573
582
|
*/
|
|
574
583
|
interface FillOrderBuildData {
|
|
575
|
-
/**
|
|
576
|
-
proof:
|
|
584
|
+
/** PLONK proof bytes for contract call */
|
|
585
|
+
proof: {
|
|
586
|
+
proofBytes: `0x${string}`;
|
|
587
|
+
publicSignals: bigint[];
|
|
588
|
+
};
|
|
577
589
|
/** Filler's nullifier */
|
|
578
590
|
nullifier: Hex;
|
|
579
591
|
/** Merkle state root */
|
|
@@ -642,8 +654,11 @@ interface SplitNoteParams {
|
|
|
642
654
|
aspProof?: ASPProofParam;
|
|
643
655
|
}
|
|
644
656
|
interface SplitNoteBuildData {
|
|
645
|
-
/**
|
|
646
|
-
proof:
|
|
657
|
+
/** PLONK proof bytes for contract call */
|
|
658
|
+
proof: {
|
|
659
|
+
proofBytes: `0x${string}`;
|
|
660
|
+
publicSignals: bigint[];
|
|
661
|
+
};
|
|
647
662
|
/** Nullifier */
|
|
648
663
|
nullifier: Hex;
|
|
649
664
|
/** Merkle state root */
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ax as NoteCreationResult, ay as ShieldedNote, O as TransferStage, I as SwapOrderEvent } from '../transfer-
|
|
2
|
-
export { A as ASPProof, aF as ASP_TREE_DEPTH, aD as IndexerConfig, aC as ProofSystemType, aE as SignTypedDataFn, aB as UPPAccountContextType, aA as UPPAccountProvider, Y as buildASPTree, a2 as computeMultiOriginASPRoot, a5 as computeSingleOriginASPRoot, ae as generateASPProof, ag as generateMultiOriginASPProof, ai as generateSingleOriginASPProof, az as useUPPAccount } from '../transfer-
|
|
1
|
+
import { ax as NoteCreationResult, ay as ShieldedNote, O as TransferStage, I as SwapOrderEvent } from '../transfer-DvIXqHCr.js';
|
|
2
|
+
export { A as ASPProof, aF as ASP_TREE_DEPTH, aD as IndexerConfig, aC as ProofSystemType, aE as SignTypedDataFn, aB as UPPAccountContextType, aA as UPPAccountProvider, Y as buildASPTree, a2 as computeMultiOriginASPRoot, a5 as computeSingleOriginASPRoot, ae as generateASPProof, ag as generateMultiOriginASPProof, ai as generateSingleOriginASPProof, az as useUPPAccount } from '../transfer-DvIXqHCr.js';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import { CSSProperties } from 'react';
|
|
@@ -253,8 +253,11 @@ interface PoolTransferParams {
|
|
|
253
253
|
interface PoolTransferBuildData {
|
|
254
254
|
/** Circuit used: 'transfer' for UPP 1-in-2-out */
|
|
255
255
|
circuit: 'transfer';
|
|
256
|
-
/**
|
|
257
|
-
proof:
|
|
256
|
+
/** PLONK proof bytes for contract call */
|
|
257
|
+
proof: {
|
|
258
|
+
proofBytes: `0x${string}`;
|
|
259
|
+
publicSignals: bigint[];
|
|
260
|
+
};
|
|
258
261
|
/** Nullifier */
|
|
259
262
|
nullifier: Hex;
|
|
260
263
|
/** Merkle state root */
|
|
@@ -333,8 +336,11 @@ interface WithdrawParams {
|
|
|
333
336
|
* Withdraw build data - everything needed to call the contract
|
|
334
337
|
*/
|
|
335
338
|
interface WithdrawBuildData {
|
|
336
|
-
/**
|
|
337
|
-
proof:
|
|
339
|
+
/** PLONK proof bytes for contract call */
|
|
340
|
+
proof: {
|
|
341
|
+
proofBytes: `0x${string}`;
|
|
342
|
+
publicSignals: bigint[];
|
|
343
|
+
};
|
|
338
344
|
/** Nullifier of the note being spent */
|
|
339
345
|
nullifier: Hex;
|
|
340
346
|
/** Merkle state root */
|
|
@@ -539,8 +545,11 @@ interface SwapConfig {
|
|
|
539
545
|
* Build data returned by buildPlaceOrder — everything needed for the contract call
|
|
540
546
|
*/
|
|
541
547
|
interface PlaceOrderBuildData {
|
|
542
|
-
/**
|
|
543
|
-
proof:
|
|
548
|
+
/** PLONK proof bytes for contract call */
|
|
549
|
+
proof: {
|
|
550
|
+
proofBytes: `0x${string}`;
|
|
551
|
+
publicSignals: bigint[];
|
|
552
|
+
};
|
|
544
553
|
/** Nullifier (= orderId) */
|
|
545
554
|
nullifier: Hex;
|
|
546
555
|
/** Merkle state root */
|
|
@@ -572,8 +581,11 @@ interface PlaceOrderBuildData {
|
|
|
572
581
|
* Build data returned by buildFillOrder
|
|
573
582
|
*/
|
|
574
583
|
interface FillOrderBuildData {
|
|
575
|
-
/**
|
|
576
|
-
proof:
|
|
584
|
+
/** PLONK proof bytes for contract call */
|
|
585
|
+
proof: {
|
|
586
|
+
proofBytes: `0x${string}`;
|
|
587
|
+
publicSignals: bigint[];
|
|
588
|
+
};
|
|
577
589
|
/** Filler's nullifier */
|
|
578
590
|
nullifier: Hex;
|
|
579
591
|
/** Merkle state root */
|
|
@@ -642,8 +654,11 @@ interface SplitNoteParams {
|
|
|
642
654
|
aspProof?: ASPProofParam;
|
|
643
655
|
}
|
|
644
656
|
interface SplitNoteBuildData {
|
|
645
|
-
/**
|
|
646
|
-
proof:
|
|
657
|
+
/** PLONK proof bytes for contract call */
|
|
658
|
+
proof: {
|
|
659
|
+
proofBytes: `0x${string}`;
|
|
660
|
+
publicSignals: bigint[];
|
|
661
|
+
};
|
|
647
662
|
/** Nullifier */
|
|
648
663
|
nullifier: Hex;
|
|
649
664
|
/** Merkle state root */
|
package/dist/react/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { StorableAccountAdapter, init_stealth, stealth_exports, SWAP_ORDER_PLACED_EVENT, filterOrdersByTokenPair, filterOrdersByASP, generateCancelSecret, computeCancelKeyHash, computeGiveAmount, NoteStore } from '../chunk-
|
|
2
|
-
import { computeSingleOriginASPRoot } from '../chunk-
|
|
3
|
-
export { ASP_TREE_DEPTH, buildASPTree, computeMultiOriginASPRoot, computeSingleOriginASPRoot, generateASPProof, generateMultiOriginASPProof, generateSingleOriginASPProof } from '../chunk-
|
|
1
|
+
import { StorableAccountAdapter, init_stealth, stealth_exports, SWAP_ORDER_PLACED_EVENT, filterOrdersByTokenPair, filterOrdersByASP, generateCancelSecret, computeCancelKeyHash, computeGiveAmount, NoteStore } from '../chunk-RNUG3EFC.js';
|
|
2
|
+
import { computeSingleOriginASPRoot } from '../chunk-6IEYWJVS.js';
|
|
3
|
+
export { ASP_TREE_DEPTH, buildASPTree, computeMultiOriginASPRoot, computeSingleOriginASPRoot, generateASPProof, generateMultiOriginASPProof, generateSingleOriginASPProof } from '../chunk-6IEYWJVS.js';
|
|
4
4
|
import { createAutoAdapter } from '../chunk-XV72HNHN.js';
|
|
5
|
-
import '../chunk-
|
|
6
|
-
import { init_poseidon, BABYJUBJUB_SUBORDER } from '../chunk-
|
|
5
|
+
import '../chunk-UQIM2KT3.js';
|
|
6
|
+
import { init_poseidon, BABYJUBJUB_SUBORDER } from '../chunk-5QSSX3KR.js';
|
|
7
7
|
import { __toCommonJS } from '../chunk-Z6ZWNWWR.js';
|
|
8
8
|
import { createContext, useState, useRef, useEffect, useCallback, useMemo, useContext } from 'react';
|
|
9
9
|
import { keccak256, toBytes, toHex, getAddress, encodePacked } from 'viem';
|
|
@@ -802,11 +802,9 @@ function useUPPAccount() {
|
|
|
802
802
|
}
|
|
803
803
|
async function createHashBasedNote(sdk, amount, spendingSecret, ownerHash, viewingSecret, origin, token) {
|
|
804
804
|
const blinding = await sdk.randomFieldElement();
|
|
805
|
-
const pubkey = await sdk.privateToPublic(spendingSecret);
|
|
806
805
|
const commitment = await sdk.poseidon([
|
|
807
806
|
amount,
|
|
808
|
-
|
|
809
|
-
pubkey.y,
|
|
807
|
+
ownerHash,
|
|
810
808
|
blinding,
|
|
811
809
|
origin,
|
|
812
810
|
token
|
|
@@ -818,8 +816,6 @@ async function createHashBasedNote(sdk, amount, spendingSecret, ownerHash, viewi
|
|
|
818
816
|
commitment,
|
|
819
817
|
ownerSecret: spendingSecret,
|
|
820
818
|
ownerHash,
|
|
821
|
-
pubkeyX: pubkey.x,
|
|
822
|
-
pubkeyY: pubkey.y,
|
|
823
819
|
blinding,
|
|
824
820
|
encryptedNote,
|
|
825
821
|
searchTag,
|
|
@@ -1601,16 +1597,16 @@ function usePoolTransfer(config) {
|
|
|
1601
1597
|
const recipientNote = await createNoteForSelf(amount, origin, token);
|
|
1602
1598
|
const changeNote = await createNoteForSelf(changeAmount, origin, token);
|
|
1603
1599
|
const [transferModule, proofModule, aspModule] = await Promise.all([
|
|
1604
|
-
import('../transfer-
|
|
1605
|
-
import('../proof-
|
|
1606
|
-
import('../asp-
|
|
1600
|
+
import('../transfer-MQMGSXTH.js'),
|
|
1601
|
+
import('../proof-JME3IZTX.js'),
|
|
1602
|
+
import('../asp-72WUGTQE.js')
|
|
1607
1603
|
]);
|
|
1608
1604
|
const {
|
|
1609
1605
|
syncMerkleTree,
|
|
1610
1606
|
getMerkleProofsForNotes,
|
|
1611
1607
|
buildUPPTransferCircuitInputs
|
|
1612
1608
|
} = transferModule;
|
|
1613
|
-
const { generateUPPProof,
|
|
1609
|
+
const { generateUPPProof, formatPlonkProofForContract } = proofModule;
|
|
1614
1610
|
const { generateASPProof: generateASPProof2, DEMO_ASP_ID } = aspModule;
|
|
1615
1611
|
setStage("syncing_merkle");
|
|
1616
1612
|
const { tree, leaves } = await syncMerkleTree(cfg.publicClient, cfg.poolAddress);
|
|
@@ -1644,20 +1640,10 @@ function usePoolTransfer(config) {
|
|
|
1644
1640
|
circuitInputs,
|
|
1645
1641
|
cfg.circuitBaseUrl ?? "/circuits/"
|
|
1646
1642
|
);
|
|
1647
|
-
const formattedProof =
|
|
1648
|
-
const proofArray = [
|
|
1649
|
-
formattedProof.a[0],
|
|
1650
|
-
formattedProof.a[1],
|
|
1651
|
-
formattedProof.b[0][0],
|
|
1652
|
-
formattedProof.b[0][1],
|
|
1653
|
-
formattedProof.b[1][0],
|
|
1654
|
-
formattedProof.b[1][1],
|
|
1655
|
-
formattedProof.c[0],
|
|
1656
|
-
formattedProof.c[1]
|
|
1657
|
-
];
|
|
1643
|
+
const formattedProof = await formatPlonkProofForContract(proof);
|
|
1658
1644
|
return {
|
|
1659
1645
|
circuit: "transfer",
|
|
1660
|
-
proof:
|
|
1646
|
+
proof: formattedProof,
|
|
1661
1647
|
nullifier: toHex(BigInt(circuitInputs.nullifier), { size: 32 }),
|
|
1662
1648
|
stateRoot: BigInt(circuitInputs.stateRoot),
|
|
1663
1649
|
aspRoot: BigInt(circuitInputs.aspRoot),
|
|
@@ -1760,12 +1746,12 @@ function useWithdraw(config) {
|
|
|
1760
1746
|
const token = BigInt(selectedNote.token);
|
|
1761
1747
|
setStage("creating_outputs");
|
|
1762
1748
|
const [transferModule, proofModule, sdk] = await Promise.all([
|
|
1763
|
-
import('../transfer-
|
|
1764
|
-
import('../proof-
|
|
1749
|
+
import('../transfer-MQMGSXTH.js'),
|
|
1750
|
+
import('../proof-JME3IZTX.js'),
|
|
1765
1751
|
import('../index.js')
|
|
1766
1752
|
]);
|
|
1767
1753
|
const { syncMerkleTree, getMerkleProofsForNotes } = transferModule;
|
|
1768
|
-
const { generateUPPProof,
|
|
1754
|
+
const { generateUPPProof, formatPlonkProofForContract } = proofModule;
|
|
1769
1755
|
setStage("syncing_merkle");
|
|
1770
1756
|
const { tree, leaves } = await syncMerkleTree(cfg.publicClient, cfg.poolAddress);
|
|
1771
1757
|
const spendableNote = {
|
|
@@ -1830,20 +1816,10 @@ function useWithdraw(config) {
|
|
|
1830
1816
|
circuitInputs,
|
|
1831
1817
|
cfg.circuitBaseUrl ?? "/circuits/"
|
|
1832
1818
|
);
|
|
1833
|
-
const formattedProof =
|
|
1819
|
+
const formattedProof = await formatPlonkProofForContract(proof);
|
|
1834
1820
|
const stateRoot = stateRootBI;
|
|
1835
|
-
const proofArray = [
|
|
1836
|
-
formattedProof.a[0],
|
|
1837
|
-
formattedProof.a[1],
|
|
1838
|
-
formattedProof.b[0][0],
|
|
1839
|
-
formattedProof.b[0][1],
|
|
1840
|
-
formattedProof.b[1][0],
|
|
1841
|
-
formattedProof.b[1][1],
|
|
1842
|
-
formattedProof.c[0],
|
|
1843
|
-
formattedProof.c[1]
|
|
1844
|
-
];
|
|
1845
1821
|
return {
|
|
1846
|
-
proof:
|
|
1822
|
+
proof: formattedProof,
|
|
1847
1823
|
nullifier: toHex(nullifier, { size: 32 }),
|
|
1848
1824
|
stateRoot,
|
|
1849
1825
|
aspRoot,
|
|
@@ -2140,13 +2116,13 @@ function useSwap(config) {
|
|
|
2140
2116
|
}
|
|
2141
2117
|
setStage("creating_outputs");
|
|
2142
2118
|
const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
|
|
2143
|
-
import('../transfer-
|
|
2144
|
-
import('../proof-
|
|
2119
|
+
import('../transfer-MQMGSXTH.js'),
|
|
2120
|
+
import('../proof-JME3IZTX.js'),
|
|
2145
2121
|
import('../index.js'),
|
|
2146
|
-
import('../asp-
|
|
2122
|
+
import('../asp-72WUGTQE.js')
|
|
2147
2123
|
]);
|
|
2148
2124
|
const { syncMerkleTree, getMerkleProofsForNotes } = transferModule;
|
|
2149
|
-
const { generateUPPProof,
|
|
2125
|
+
const { generateUPPProof, formatPlonkProofForContract } = proofModule;
|
|
2150
2126
|
const { generateASPProof: generateASPProof2 } = aspModule;
|
|
2151
2127
|
setStage("syncing_merkle");
|
|
2152
2128
|
const { tree, leaves } = await syncMerkleTree(cfg.publicClient, cfg.poolAddress);
|
|
@@ -2211,23 +2187,13 @@ function useSwap(config) {
|
|
|
2211
2187
|
circuitInputs,
|
|
2212
2188
|
cfg.circuitBaseUrl ?? "/circuits/"
|
|
2213
2189
|
);
|
|
2214
|
-
const formattedProof =
|
|
2215
|
-
const proofArray = [
|
|
2216
|
-
formattedProof.a[0],
|
|
2217
|
-
formattedProof.a[1],
|
|
2218
|
-
formattedProof.b[0][0],
|
|
2219
|
-
formattedProof.b[0][1],
|
|
2220
|
-
formattedProof.b[1][0],
|
|
2221
|
-
formattedProof.b[1][1],
|
|
2222
|
-
formattedProof.c[0],
|
|
2223
|
-
formattedProof.c[1]
|
|
2224
|
-
];
|
|
2190
|
+
const formattedProof = await formatPlonkProofForContract(proof);
|
|
2225
2191
|
const cancelSecret = generateCancelSecret();
|
|
2226
2192
|
const cancelKeyHash = computeCancelKeyHash(cancelSecret);
|
|
2227
2193
|
const currentBlock = await cfg.publicClient.getBlockNumber();
|
|
2228
2194
|
const expiry = currentBlock + expiryBlocks;
|
|
2229
2195
|
return {
|
|
2230
|
-
proof:
|
|
2196
|
+
proof: formattedProof,
|
|
2231
2197
|
nullifier: toHex(nullifier, { size: 32 }),
|
|
2232
2198
|
stateRoot: stateRootBI,
|
|
2233
2199
|
aspRoot: aspProofData.aspRoot,
|
|
@@ -2292,13 +2258,13 @@ function useSwap(config) {
|
|
|
2292
2258
|
}
|
|
2293
2259
|
setStage("creating_outputs");
|
|
2294
2260
|
const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
|
|
2295
|
-
import('../transfer-
|
|
2296
|
-
import('../proof-
|
|
2261
|
+
import('../transfer-MQMGSXTH.js'),
|
|
2262
|
+
import('../proof-JME3IZTX.js'),
|
|
2297
2263
|
import('../index.js'),
|
|
2298
|
-
import('../asp-
|
|
2264
|
+
import('../asp-72WUGTQE.js')
|
|
2299
2265
|
]);
|
|
2300
2266
|
const { syncMerkleTree, getMerkleProofsForNotes } = transferModule;
|
|
2301
|
-
const { generateUPPProof,
|
|
2267
|
+
const { generateUPPProof, formatPlonkProofForContract } = proofModule;
|
|
2302
2268
|
const { generateASPProof: generateASPProof2 } = aspModule;
|
|
2303
2269
|
const fillerOrigin = ethAddress ? BigInt(ethAddress) : BigInt(masterKeys.ownerHash);
|
|
2304
2270
|
const fillerNoteData = await createNoteForSelf(
|
|
@@ -2369,24 +2335,14 @@ function useSwap(config) {
|
|
|
2369
2335
|
circuitInputs,
|
|
2370
2336
|
cfg.circuitBaseUrl ?? "/circuits/"
|
|
2371
2337
|
);
|
|
2372
|
-
const formattedProof =
|
|
2373
|
-
const proofArray = [
|
|
2374
|
-
formattedProof.a[0],
|
|
2375
|
-
formattedProof.a[1],
|
|
2376
|
-
formattedProof.b[0][0],
|
|
2377
|
-
formattedProof.b[0][1],
|
|
2378
|
-
formattedProof.b[1][0],
|
|
2379
|
-
formattedProof.b[1][1],
|
|
2380
|
-
formattedProof.c[0],
|
|
2381
|
-
formattedProof.c[1]
|
|
2382
|
-
];
|
|
2338
|
+
const formattedProof = await formatPlonkProofForContract(proof);
|
|
2383
2339
|
const { encodePacked: encodePacked3 } = await import('viem');
|
|
2384
2340
|
const packedFillerNote = encodePacked3(
|
|
2385
2341
|
["uint64", "uint256", "bytes"],
|
|
2386
2342
|
[fillerNoteData.searchTag, fillerNoteData.ownerHash, fillerNoteData.encryptedNote]
|
|
2387
2343
|
);
|
|
2388
2344
|
return {
|
|
2389
|
-
proof:
|
|
2345
|
+
proof: formattedProof,
|
|
2390
2346
|
nullifier: toHex(nullifier, { size: 32 }),
|
|
2391
2347
|
stateRoot: stateRootBI,
|
|
2392
2348
|
aspRoot: aspProofData.aspRoot,
|
|
@@ -2522,12 +2478,12 @@ function useSwap(config) {
|
|
|
2522
2478
|
createNoteForSelf(changeAmount, origin, token)
|
|
2523
2479
|
]);
|
|
2524
2480
|
const [transferModule, proofModule, aspModule] = await Promise.all([
|
|
2525
|
-
import('../transfer-
|
|
2526
|
-
import('../proof-
|
|
2527
|
-
import('../asp-
|
|
2481
|
+
import('../transfer-MQMGSXTH.js'),
|
|
2482
|
+
import('../proof-JME3IZTX.js'),
|
|
2483
|
+
import('../asp-72WUGTQE.js')
|
|
2528
2484
|
]);
|
|
2529
2485
|
const { syncMerkleTree, getMerkleProofsForNotes, buildUPPTransferCircuitInputs } = transferModule;
|
|
2530
|
-
const { generateUPPProof,
|
|
2486
|
+
const { generateUPPProof, formatPlonkProofForContract } = proofModule;
|
|
2531
2487
|
const { generateASPProof: generateASPProof2, DEMO_ASP_ID } = aspModule;
|
|
2532
2488
|
setStage("syncing_merkle");
|
|
2533
2489
|
const { tree, leaves } = await syncMerkleTree(cfg.publicClient, cfg.poolAddress);
|
|
@@ -2557,17 +2513,7 @@ function useSwap(config) {
|
|
|
2557
2513
|
circuitInputs,
|
|
2558
2514
|
cfg.circuitBaseUrl ?? "/circuits/"
|
|
2559
2515
|
);
|
|
2560
|
-
const formattedProof =
|
|
2561
|
-
const proofArray = [
|
|
2562
|
-
formattedProof.a[0],
|
|
2563
|
-
formattedProof.a[1],
|
|
2564
|
-
formattedProof.b[0][0],
|
|
2565
|
-
formattedProof.b[0][1],
|
|
2566
|
-
formattedProof.b[1][0],
|
|
2567
|
-
formattedProof.b[1][1],
|
|
2568
|
-
formattedProof.c[0],
|
|
2569
|
-
formattedProof.c[1]
|
|
2570
|
-
];
|
|
2516
|
+
const formattedProof = await formatPlonkProofForContract(proof);
|
|
2571
2517
|
const { encodePacked: encodePacked3 } = await import('viem');
|
|
2572
2518
|
const packNote = (n) => encodePacked3(
|
|
2573
2519
|
["uint64", "uint256", "bytes"],
|
|
@@ -2601,7 +2547,7 @@ function useSwap(config) {
|
|
|
2601
2547
|
timestamp: Date.now()
|
|
2602
2548
|
};
|
|
2603
2549
|
return {
|
|
2604
|
-
proof:
|
|
2550
|
+
proof: formattedProof,
|
|
2605
2551
|
nullifier: toHex(BigInt(circuitInputs.nullifier), { size: 32 }),
|
|
2606
2552
|
stateRoot: BigInt(circuitInputs.stateRoot),
|
|
2607
2553
|
aspRoot: BigInt(circuitInputs.aspRoot),
|