@permissionless-technologies/upp-sdk 0.4.0 → 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/{chunk-UYE2JASE.cjs → chunk-BZD5KJL3.cjs} +2 -2
- package/dist/{chunk-UYE2JASE.cjs.map → chunk-BZD5KJL3.cjs.map} +1 -1
- package/dist/{chunk-ZTVXII74.js → chunk-MDF37354.js} +2 -2
- package/dist/{chunk-ZTVXII74.js.map → chunk-MDF37354.js.map} +1 -1
- package/dist/index.cjs +59 -59
- package/dist/index.js +2 -2
- package/dist/indexer/index.cjs +6 -6
- package/dist/indexer/index.js +1 -1
- package/dist/react/index.cjs +15 -65
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +25 -10
- package/dist/react/index.d.ts +25 -10
- package/dist/react/index.js +15 -65
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
package/dist/react/index.d.cts
CHANGED
|
@@ -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
|
@@ -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
|
@@ -1606,7 +1606,7 @@ function usePoolTransfer(config) {
|
|
|
1606
1606
|
getMerkleProofsForNotes,
|
|
1607
1607
|
buildUPPTransferCircuitInputs
|
|
1608
1608
|
} = transferModule;
|
|
1609
|
-
const { generateUPPProof,
|
|
1609
|
+
const { generateUPPProof, formatPlonkProofForContract } = proofModule;
|
|
1610
1610
|
const { generateASPProof: generateASPProof2, DEMO_ASP_ID } = aspModule;
|
|
1611
1611
|
setStage("syncing_merkle");
|
|
1612
1612
|
const { tree, leaves } = await syncMerkleTree(cfg.publicClient, cfg.poolAddress);
|
|
@@ -1640,20 +1640,10 @@ function usePoolTransfer(config) {
|
|
|
1640
1640
|
circuitInputs,
|
|
1641
1641
|
cfg.circuitBaseUrl ?? "/circuits/"
|
|
1642
1642
|
);
|
|
1643
|
-
const formattedProof =
|
|
1644
|
-
const proofArray = [
|
|
1645
|
-
formattedProof.a[0],
|
|
1646
|
-
formattedProof.a[1],
|
|
1647
|
-
formattedProof.b[0][0],
|
|
1648
|
-
formattedProof.b[0][1],
|
|
1649
|
-
formattedProof.b[1][0],
|
|
1650
|
-
formattedProof.b[1][1],
|
|
1651
|
-
formattedProof.c[0],
|
|
1652
|
-
formattedProof.c[1]
|
|
1653
|
-
];
|
|
1643
|
+
const formattedProof = await formatPlonkProofForContract(proof);
|
|
1654
1644
|
return {
|
|
1655
1645
|
circuit: "transfer",
|
|
1656
|
-
proof:
|
|
1646
|
+
proof: formattedProof,
|
|
1657
1647
|
nullifier: toHex(BigInt(circuitInputs.nullifier), { size: 32 }),
|
|
1658
1648
|
stateRoot: BigInt(circuitInputs.stateRoot),
|
|
1659
1649
|
aspRoot: BigInt(circuitInputs.aspRoot),
|
|
@@ -1761,7 +1751,7 @@ function useWithdraw(config) {
|
|
|
1761
1751
|
import('../index.js')
|
|
1762
1752
|
]);
|
|
1763
1753
|
const { syncMerkleTree, getMerkleProofsForNotes } = transferModule;
|
|
1764
|
-
const { generateUPPProof,
|
|
1754
|
+
const { generateUPPProof, formatPlonkProofForContract } = proofModule;
|
|
1765
1755
|
setStage("syncing_merkle");
|
|
1766
1756
|
const { tree, leaves } = await syncMerkleTree(cfg.publicClient, cfg.poolAddress);
|
|
1767
1757
|
const spendableNote = {
|
|
@@ -1826,20 +1816,10 @@ function useWithdraw(config) {
|
|
|
1826
1816
|
circuitInputs,
|
|
1827
1817
|
cfg.circuitBaseUrl ?? "/circuits/"
|
|
1828
1818
|
);
|
|
1829
|
-
const formattedProof =
|
|
1819
|
+
const formattedProof = await formatPlonkProofForContract(proof);
|
|
1830
1820
|
const stateRoot = stateRootBI;
|
|
1831
|
-
const proofArray = [
|
|
1832
|
-
formattedProof.a[0],
|
|
1833
|
-
formattedProof.a[1],
|
|
1834
|
-
formattedProof.b[0][0],
|
|
1835
|
-
formattedProof.b[0][1],
|
|
1836
|
-
formattedProof.b[1][0],
|
|
1837
|
-
formattedProof.b[1][1],
|
|
1838
|
-
formattedProof.c[0],
|
|
1839
|
-
formattedProof.c[1]
|
|
1840
|
-
];
|
|
1841
1821
|
return {
|
|
1842
|
-
proof:
|
|
1822
|
+
proof: formattedProof,
|
|
1843
1823
|
nullifier: toHex(nullifier, { size: 32 }),
|
|
1844
1824
|
stateRoot,
|
|
1845
1825
|
aspRoot,
|
|
@@ -2142,7 +2122,7 @@ function useSwap(config) {
|
|
|
2142
2122
|
import('../asp-72WUGTQE.js')
|
|
2143
2123
|
]);
|
|
2144
2124
|
const { syncMerkleTree, getMerkleProofsForNotes } = transferModule;
|
|
2145
|
-
const { generateUPPProof,
|
|
2125
|
+
const { generateUPPProof, formatPlonkProofForContract } = proofModule;
|
|
2146
2126
|
const { generateASPProof: generateASPProof2 } = aspModule;
|
|
2147
2127
|
setStage("syncing_merkle");
|
|
2148
2128
|
const { tree, leaves } = await syncMerkleTree(cfg.publicClient, cfg.poolAddress);
|
|
@@ -2207,23 +2187,13 @@ function useSwap(config) {
|
|
|
2207
2187
|
circuitInputs,
|
|
2208
2188
|
cfg.circuitBaseUrl ?? "/circuits/"
|
|
2209
2189
|
);
|
|
2210
|
-
const formattedProof =
|
|
2211
|
-
const proofArray = [
|
|
2212
|
-
formattedProof.a[0],
|
|
2213
|
-
formattedProof.a[1],
|
|
2214
|
-
formattedProof.b[0][0],
|
|
2215
|
-
formattedProof.b[0][1],
|
|
2216
|
-
formattedProof.b[1][0],
|
|
2217
|
-
formattedProof.b[1][1],
|
|
2218
|
-
formattedProof.c[0],
|
|
2219
|
-
formattedProof.c[1]
|
|
2220
|
-
];
|
|
2190
|
+
const formattedProof = await formatPlonkProofForContract(proof);
|
|
2221
2191
|
const cancelSecret = generateCancelSecret();
|
|
2222
2192
|
const cancelKeyHash = computeCancelKeyHash(cancelSecret);
|
|
2223
2193
|
const currentBlock = await cfg.publicClient.getBlockNumber();
|
|
2224
2194
|
const expiry = currentBlock + expiryBlocks;
|
|
2225
2195
|
return {
|
|
2226
|
-
proof:
|
|
2196
|
+
proof: formattedProof,
|
|
2227
2197
|
nullifier: toHex(nullifier, { size: 32 }),
|
|
2228
2198
|
stateRoot: stateRootBI,
|
|
2229
2199
|
aspRoot: aspProofData.aspRoot,
|
|
@@ -2294,7 +2264,7 @@ function useSwap(config) {
|
|
|
2294
2264
|
import('../asp-72WUGTQE.js')
|
|
2295
2265
|
]);
|
|
2296
2266
|
const { syncMerkleTree, getMerkleProofsForNotes } = transferModule;
|
|
2297
|
-
const { generateUPPProof,
|
|
2267
|
+
const { generateUPPProof, formatPlonkProofForContract } = proofModule;
|
|
2298
2268
|
const { generateASPProof: generateASPProof2 } = aspModule;
|
|
2299
2269
|
const fillerOrigin = ethAddress ? BigInt(ethAddress) : BigInt(masterKeys.ownerHash);
|
|
2300
2270
|
const fillerNoteData = await createNoteForSelf(
|
|
@@ -2365,24 +2335,14 @@ function useSwap(config) {
|
|
|
2365
2335
|
circuitInputs,
|
|
2366
2336
|
cfg.circuitBaseUrl ?? "/circuits/"
|
|
2367
2337
|
);
|
|
2368
|
-
const formattedProof =
|
|
2369
|
-
const proofArray = [
|
|
2370
|
-
formattedProof.a[0],
|
|
2371
|
-
formattedProof.a[1],
|
|
2372
|
-
formattedProof.b[0][0],
|
|
2373
|
-
formattedProof.b[0][1],
|
|
2374
|
-
formattedProof.b[1][0],
|
|
2375
|
-
formattedProof.b[1][1],
|
|
2376
|
-
formattedProof.c[0],
|
|
2377
|
-
formattedProof.c[1]
|
|
2378
|
-
];
|
|
2338
|
+
const formattedProof = await formatPlonkProofForContract(proof);
|
|
2379
2339
|
const { encodePacked: encodePacked3 } = await import('viem');
|
|
2380
2340
|
const packedFillerNote = encodePacked3(
|
|
2381
2341
|
["uint64", "uint256", "bytes"],
|
|
2382
2342
|
[fillerNoteData.searchTag, fillerNoteData.ownerHash, fillerNoteData.encryptedNote]
|
|
2383
2343
|
);
|
|
2384
2344
|
return {
|
|
2385
|
-
proof:
|
|
2345
|
+
proof: formattedProof,
|
|
2386
2346
|
nullifier: toHex(nullifier, { size: 32 }),
|
|
2387
2347
|
stateRoot: stateRootBI,
|
|
2388
2348
|
aspRoot: aspProofData.aspRoot,
|
|
@@ -2523,7 +2483,7 @@ function useSwap(config) {
|
|
|
2523
2483
|
import('../asp-72WUGTQE.js')
|
|
2524
2484
|
]);
|
|
2525
2485
|
const { syncMerkleTree, getMerkleProofsForNotes, buildUPPTransferCircuitInputs } = transferModule;
|
|
2526
|
-
const { generateUPPProof,
|
|
2486
|
+
const { generateUPPProof, formatPlonkProofForContract } = proofModule;
|
|
2527
2487
|
const { generateASPProof: generateASPProof2, DEMO_ASP_ID } = aspModule;
|
|
2528
2488
|
setStage("syncing_merkle");
|
|
2529
2489
|
const { tree, leaves } = await syncMerkleTree(cfg.publicClient, cfg.poolAddress);
|
|
@@ -2553,17 +2513,7 @@ function useSwap(config) {
|
|
|
2553
2513
|
circuitInputs,
|
|
2554
2514
|
cfg.circuitBaseUrl ?? "/circuits/"
|
|
2555
2515
|
);
|
|
2556
|
-
const formattedProof =
|
|
2557
|
-
const proofArray = [
|
|
2558
|
-
formattedProof.a[0],
|
|
2559
|
-
formattedProof.a[1],
|
|
2560
|
-
formattedProof.b[0][0],
|
|
2561
|
-
formattedProof.b[0][1],
|
|
2562
|
-
formattedProof.b[1][0],
|
|
2563
|
-
formattedProof.b[1][1],
|
|
2564
|
-
formattedProof.c[0],
|
|
2565
|
-
formattedProof.c[1]
|
|
2566
|
-
];
|
|
2516
|
+
const formattedProof = await formatPlonkProofForContract(proof);
|
|
2567
2517
|
const { encodePacked: encodePacked3 } = await import('viem');
|
|
2568
2518
|
const packNote = (n) => encodePacked3(
|
|
2569
2519
|
["uint64", "uint256", "bytes"],
|
|
@@ -2597,7 +2547,7 @@ function useSwap(config) {
|
|
|
2597
2547
|
timestamp: Date.now()
|
|
2598
2548
|
};
|
|
2599
2549
|
return {
|
|
2600
|
-
proof:
|
|
2550
|
+
proof: formattedProof,
|
|
2601
2551
|
nullifier: toHex(BigInt(circuitInputs.nullifier), { size: 32 }),
|
|
2602
2552
|
stateRoot: BigInt(circuitInputs.stateRoot),
|
|
2603
2553
|
aspRoot: BigInt(circuitInputs.aspRoot),
|