@permissionless-technologies/upp-sdk 0.3.4 → 0.3.5

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.
@@ -638,6 +638,8 @@ interface SplitNoteParams {
638
638
  targetAmount: bigint;
639
639
  /** ASP ID to use for the proof (defaults to DEMO_ASP_ID if not provided) */
640
640
  aspId?: bigint;
641
+ /** Pre-fetched ASP proof from the service */
642
+ aspProof?: ASPProofParam;
641
643
  }
642
644
  interface SplitNoteBuildData {
643
645
  /** Transfer proof for contract call */
@@ -689,6 +691,12 @@ interface UseSwapReturn {
689
691
  /** Reset state */
690
692
  reset: () => void;
691
693
  }
694
+ /** Pre-fetched ASP proof from the platform's ASP service */
695
+ interface ASPProofParam {
696
+ root: bigint;
697
+ pathElements: bigint[];
698
+ pathIndices: number[];
699
+ }
692
700
  interface PlaceOrderParams {
693
701
  /** Token to sell */
694
702
  sellToken: Address;
@@ -702,8 +710,10 @@ interface PlaceOrderParams {
702
710
  requiredFillerAspId?: bigint;
703
711
  /** Number of blocks until expiry */
704
712
  expiryBlocks: bigint;
705
- /** ASP ID — must be a registered personal ASP */
713
+ /** ASP ID */
706
714
  aspId: bigint;
715
+ /** Pre-fetched ASP proof from the service. If omitted, falls back to local computation. */
716
+ aspProof?: ASPProofParam;
707
717
  /** Explicit note to spend (skips note selection). Used after auto-split. */
708
718
  noteOverride?: ShieldedNote;
709
719
  }
@@ -718,8 +728,10 @@ interface FillOrderParams {
718
728
  sellToken: Address;
719
729
  /** The order's buyToken (filler pays this) */
720
730
  buyToken: Address;
721
- /** ASP ID — must be a registered personal ASP */
731
+ /** ASP ID */
722
732
  aspId: bigint;
733
+ /** Pre-fetched ASP proof from the service. If omitted, falls back to local computation. */
734
+ aspProof?: ASPProofParam;
723
735
  /** Explicit note to spend (skips note selection). Used after auto-split. */
724
736
  noteOverride?: ShieldedNote;
725
737
  }
@@ -638,6 +638,8 @@ interface SplitNoteParams {
638
638
  targetAmount: bigint;
639
639
  /** ASP ID to use for the proof (defaults to DEMO_ASP_ID if not provided) */
640
640
  aspId?: bigint;
641
+ /** Pre-fetched ASP proof from the service */
642
+ aspProof?: ASPProofParam;
641
643
  }
642
644
  interface SplitNoteBuildData {
643
645
  /** Transfer proof for contract call */
@@ -689,6 +691,12 @@ interface UseSwapReturn {
689
691
  /** Reset state */
690
692
  reset: () => void;
691
693
  }
694
+ /** Pre-fetched ASP proof from the platform's ASP service */
695
+ interface ASPProofParam {
696
+ root: bigint;
697
+ pathElements: bigint[];
698
+ pathIndices: number[];
699
+ }
692
700
  interface PlaceOrderParams {
693
701
  /** Token to sell */
694
702
  sellToken: Address;
@@ -702,8 +710,10 @@ interface PlaceOrderParams {
702
710
  requiredFillerAspId?: bigint;
703
711
  /** Number of blocks until expiry */
704
712
  expiryBlocks: bigint;
705
- /** ASP ID — must be a registered personal ASP */
713
+ /** ASP ID */
706
714
  aspId: bigint;
715
+ /** Pre-fetched ASP proof from the service. If omitted, falls back to local computation. */
716
+ aspProof?: ASPProofParam;
707
717
  /** Explicit note to spend (skips note selection). Used after auto-split. */
708
718
  noteOverride?: ShieldedNote;
709
719
  }
@@ -718,8 +728,10 @@ interface FillOrderParams {
718
728
  sellToken: Address;
719
729
  /** The order's buyToken (filler pays this) */
720
730
  buyToken: Address;
721
- /** ASP ID — must be a registered personal ASP */
731
+ /** ASP ID */
722
732
  aspId: bigint;
733
+ /** Pre-fetched ASP proof from the service. If omitted, falls back to local computation. */
734
+ aspProof?: ASPProofParam;
723
735
  /** Explicit note to spend (skips note selection). Used after auto-split. */
724
736
  noteOverride?: ShieldedNote;
725
737
  }
@@ -1601,7 +1601,7 @@ function usePoolTransfer(config) {
1601
1601
  const recipientNote = await createNoteForSelf(amount, origin, token);
1602
1602
  const changeNote = await createNoteForSelf(changeAmount, origin, token);
1603
1603
  const [transferModule, proofModule, aspModule] = await Promise.all([
1604
- import('../transfer-QK3QUIA3.js'),
1604
+ import('../transfer-P4D57KJ5.js'),
1605
1605
  import('../proof-C4YBP6RY.js'),
1606
1606
  import('../asp-ZA3RGN7G.js')
1607
1607
  ]);
@@ -1760,7 +1760,7 @@ function useWithdraw(config) {
1760
1760
  const token = BigInt(selectedNote.token);
1761
1761
  setStage("creating_outputs");
1762
1762
  const [transferModule, proofModule, sdk] = await Promise.all([
1763
- import('../transfer-QK3QUIA3.js'),
1763
+ import('../transfer-P4D57KJ5.js'),
1764
1764
  import('../proof-C4YBP6RY.js'),
1765
1765
  import('../index.js')
1766
1766
  ]);
@@ -2139,7 +2139,7 @@ function useSwap(config) {
2139
2139
  }
2140
2140
  setStage("creating_outputs");
2141
2141
  const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
2142
- import('../transfer-QK3QUIA3.js'),
2142
+ import('../transfer-P4D57KJ5.js'),
2143
2143
  import('../proof-C4YBP6RY.js'),
2144
2144
  import('../index.js'),
2145
2145
  import('../asp-ZA3RGN7G.js')
@@ -2186,7 +2186,7 @@ function useSwap(config) {
2186
2186
  BigInt(actualLeafIndex),
2187
2187
  storedCommitment
2188
2188
  ]);
2189
- const aspProofData = await generateASPProof2(aspId, origin, cfg.aspApprovedOrigins);
2189
+ const aspProofData = params.aspProof ? { aspId, aspRoot: params.aspProof.root, aspPathElements: params.aspProof.pathElements, aspPathIndices: params.aspProof.pathIndices } : await generateASPProof2(aspId, origin, cfg.aspApprovedOrigins);
2190
2190
  const circuitInputs = {
2191
2191
  stateRoot: stateRootBI.toString(),
2192
2192
  aspRoot: aspProofData.aspRoot.toString(),
@@ -2291,7 +2291,7 @@ function useSwap(config) {
2291
2291
  }
2292
2292
  setStage("creating_outputs");
2293
2293
  const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
2294
- import('../transfer-QK3QUIA3.js'),
2294
+ import('../transfer-P4D57KJ5.js'),
2295
2295
  import('../proof-C4YBP6RY.js'),
2296
2296
  import('../index.js'),
2297
2297
  import('../asp-ZA3RGN7G.js')
@@ -2344,7 +2344,7 @@ function useSwap(config) {
2344
2344
  BigInt(actualLeafIndex),
2345
2345
  storedCommitmentF
2346
2346
  ]);
2347
- const aspProofData = await generateASPProof2(aspId, origin, cfg.aspApprovedOrigins);
2347
+ const aspProofData = params.aspProof ? { aspId, aspRoot: params.aspProof.root, aspPathElements: params.aspProof.pathElements, aspPathIndices: params.aspProof.pathIndices } : await generateASPProof2(aspId, origin, cfg.aspApprovedOrigins);
2348
2348
  const circuitInputs = {
2349
2349
  stateRoot: stateRootBI.toString(),
2350
2350
  aspRoot: aspProofData.aspRoot.toString(),
@@ -2521,7 +2521,7 @@ function useSwap(config) {
2521
2521
  createNoteForSelf(changeAmount, origin, token)
2522
2522
  ]);
2523
2523
  const [transferModule, proofModule, aspModule] = await Promise.all([
2524
- import('../transfer-QK3QUIA3.js'),
2524
+ import('../transfer-P4D57KJ5.js'),
2525
2525
  import('../proof-C4YBP6RY.js'),
2526
2526
  import('../asp-ZA3RGN7G.js')
2527
2527
  ]);
@@ -2541,7 +2541,7 @@ function useSwap(config) {
2541
2541
  token
2542
2542
  };
2543
2543
  const [noteProof] = await getMerkleProofsForNotes([spendableNote], leaves, tree);
2544
- const aspProof = await generateASPProof2(splitAspId ?? DEMO_ASP_ID, origin, cfg.aspApprovedOrigins);
2544
+ const aspProof = params.aspProof ? { aspId: splitAspId ?? DEMO_ASP_ID, aspRoot: params.aspProof.root, aspPathElements: params.aspProof.pathElements, aspPathIndices: params.aspProof.pathIndices } : await generateASPProof2(splitAspId ?? DEMO_ASP_ID, origin, cfg.aspApprovedOrigins);
2545
2545
  setStage("generating_proof");
2546
2546
  const exactNoteWithAmount = { ...exactNoteData, amount: targetAmount };
2547
2547
  const changeNoteWithAmount = { ...changeNoteData, amount: changeAmount };