@permissionless-technologies/upp-sdk 0.2.1 → 0.3.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.
Files changed (67) hide show
  1. package/dist/chunk-3YZSIYJC.cjs +154 -0
  2. package/dist/chunk-3YZSIYJC.cjs.map +1 -0
  3. package/dist/{chunk-43U5RGYE.cjs → chunk-4N5BH43P.cjs} +2 -2
  4. package/dist/{chunk-43U5RGYE.cjs.map → chunk-4N5BH43P.cjs.map} +1 -1
  5. package/dist/{chunk-C7QQOJ7T.cjs → chunk-52PPS4AT.cjs} +4 -22
  6. package/dist/chunk-52PPS4AT.cjs.map +1 -0
  7. package/dist/{chunk-NUIQHTSA.js → chunk-7F75NGNB.js} +76 -3
  8. package/dist/chunk-7F75NGNB.js.map +1 -0
  9. package/dist/{chunk-SGZZL5AC.js → chunk-GS4UCMW4.js} +4 -20
  10. package/dist/chunk-GS4UCMW4.js.map +1 -0
  11. package/dist/{chunk-64RTC5ML.js → chunk-IU5P5VDV.js} +2 -2
  12. package/dist/{chunk-64RTC5ML.js.map → chunk-IU5P5VDV.js.map} +1 -1
  13. package/dist/{chunk-GXZ3MTCQ.cjs → chunk-IYOR5TCO.cjs} +77 -2
  14. package/dist/chunk-IYOR5TCO.cjs.map +1 -0
  15. package/dist/{chunk-GQV47S3N.cjs → chunk-PTDVGWHU.cjs} +2 -2
  16. package/dist/{chunk-GQV47S3N.cjs.map → chunk-PTDVGWHU.cjs.map} +1 -1
  17. package/dist/{chunk-CZ23JMAQ.js → chunk-QBCLFGMV.js} +3 -3
  18. package/dist/{chunk-CZ23JMAQ.js.map → chunk-QBCLFGMV.js.map} +1 -1
  19. package/dist/{chunk-NCW4AE7L.js → chunk-UAVWYXDN.js} +2 -2
  20. package/dist/chunk-UAVWYXDN.js.map +1 -0
  21. package/dist/{chunk-46GGZ3TC.cjs → chunk-X4DLTVOG.cjs} +3 -3
  22. package/dist/{chunk-46GGZ3TC.cjs.map → chunk-X4DLTVOG.cjs.map} +1 -1
  23. package/dist/chunk-XBNYAAMU.js +140 -0
  24. package/dist/chunk-XBNYAAMU.js.map +1 -0
  25. package/dist/core/index.cjs +67 -61
  26. package/dist/core/index.d.cts +3 -2
  27. package/dist/core/index.d.ts +3 -2
  28. package/dist/core/index.js +5 -3
  29. package/dist/{index-BGvapsJy.d.cts → index-B45-okum.d.cts} +19 -3
  30. package/dist/{index-ChGaGPzP.d.ts → index-BIcvNMPt.d.ts} +19 -3
  31. package/dist/{index-BBzvvrhG.d.ts → index-DwAJBoU7.d.ts} +122 -96
  32. package/dist/{index-C-jSNw6j.d.cts → index-o-Ds3YAq.d.cts} +122 -96
  33. package/dist/index.cjs +123 -70
  34. package/dist/index.cjs.map +1 -1
  35. package/dist/index.d.cts +4 -3
  36. package/dist/index.d.ts +4 -3
  37. package/dist/index.js +6 -5
  38. package/dist/index.js.map +1 -1
  39. package/dist/indexer/index.cjs +6 -6
  40. package/dist/indexer/index.d.cts +6 -5
  41. package/dist/indexer/index.d.ts +6 -5
  42. package/dist/indexer/index.js +1 -1
  43. package/dist/react/index.cjs +107 -102
  44. package/dist/react/index.cjs.map +1 -1
  45. package/dist/react/index.d.cts +2 -2
  46. package/dist/react/index.d.ts +2 -2
  47. package/dist/react/index.js +100 -95
  48. package/dist/react/index.js.map +1 -1
  49. package/dist/stark-BcTD1OaJ.d.cts +185 -0
  50. package/dist/stark-BcTD1OaJ.d.ts +185 -0
  51. package/dist/{transfer-SA4NHNJ7.cjs → transfer-6ZIVZ6JY.cjs} +9 -9
  52. package/dist/{transfer-SA4NHNJ7.cjs.map → transfer-6ZIVZ6JY.cjs.map} +1 -1
  53. package/dist/{transfer-DKZuJnRM.d.cts → transfer-BzyernBd.d.cts} +1 -3
  54. package/dist/{transfer-4OF2JWXX.js → transfer-CDXC3OQW.js} +3 -3
  55. package/dist/{transfer-4OF2JWXX.js.map → transfer-CDXC3OQW.js.map} +1 -1
  56. package/dist/{transfer-BlmbO-Rd.d.ts → transfer-sqS6mJko.d.ts} +1 -3
  57. package/dist/utils/index.cjs +54 -1
  58. package/dist/utils/index.d.cts +2 -0
  59. package/dist/utils/index.d.ts +2 -0
  60. package/dist/utils/index.js +2 -1
  61. package/package.json +1 -1
  62. package/src/deployments/31337.json +1 -1
  63. package/dist/chunk-C7QQOJ7T.cjs.map +0 -1
  64. package/dist/chunk-GXZ3MTCQ.cjs.map +0 -1
  65. package/dist/chunk-NCW4AE7L.js.map +0 -1
  66. package/dist/chunk-NUIQHTSA.js.map +0 -1
  67. package/dist/chunk-SGZZL5AC.js.map +0 -1
@@ -0,0 +1,140 @@
1
+ import { M31_P, SECRET_LIMBS } from './chunk-5V5HSN6Y.js';
2
+ import { keccak256, encodePacked, pad, numberToHex } from 'viem';
3
+
4
+ var STARK_AMOUNT_SCALE = 10n ** 15n;
5
+ var STARK_STATE_TREE_DEPTH = 32;
6
+ var STARK_ASP_TREE_DEPTH = 20;
7
+ function isStarkAligned(amount) {
8
+ if (amount <= 0n) return false;
9
+ const scaled = amount / STARK_AMOUNT_SCALE;
10
+ return scaled * STARK_AMOUNT_SCALE === amount && scaled < M31_P;
11
+ }
12
+ function scaleAmountForStark(weiAmount) {
13
+ const scaled = weiAmount / STARK_AMOUNT_SCALE;
14
+ if (scaled * STARK_AMOUNT_SCALE !== weiAmount) {
15
+ throw new Error(`Amount ${weiAmount} not aligned to STARK scale (${STARK_AMOUNT_SCALE})`);
16
+ }
17
+ if (scaled >= M31_P) {
18
+ throw new Error(`Scaled amount ${scaled} exceeds M31 max (${M31_P})`);
19
+ }
20
+ return Number(scaled);
21
+ }
22
+ function truncateToM31(value) {
23
+ return Number(value % M31_P);
24
+ }
25
+ function addressToM31(addr) {
26
+ return Number(BigInt(addr) % M31_P);
27
+ }
28
+ function splitSecretToM31Limbs(secret) {
29
+ const limbs = [];
30
+ let remaining = secret;
31
+ for (let i = 0; i < SECRET_LIMBS; i++) {
32
+ limbs.push(Number(remaining % M31_P));
33
+ remaining = remaining / M31_P;
34
+ }
35
+ return limbs;
36
+ }
37
+ function packM31Digest(digest) {
38
+ return BigInt(digest[0]) | BigInt(digest[1]) << 32n | BigInt(digest[2]) << 64n | BigInt(digest[3]) << 96n;
39
+ }
40
+ function computeWithdrawPublicInputsSeed(params) {
41
+ return keccak256(
42
+ encodePacked(
43
+ ["bytes32", "uint256", "uint256", "uint256", "address", "uint256", "address", "bool"],
44
+ [
45
+ params.nullifier,
46
+ params.stateRoot,
47
+ params.aspRoot,
48
+ params.aspId,
49
+ params.token,
50
+ params.amount,
51
+ params.recipient,
52
+ params.isRagequit
53
+ ]
54
+ )
55
+ );
56
+ }
57
+ function computeTransferPublicInputsSeed(params) {
58
+ return keccak256(
59
+ encodePacked(
60
+ ["bytes32", "uint256", "uint256", "address", "bytes32", "bytes32"],
61
+ [
62
+ params.nullifier,
63
+ params.stateRoot,
64
+ params.aspRoot,
65
+ params.token,
66
+ params.outputCommitment1,
67
+ params.outputCommitment2
68
+ ]
69
+ )
70
+ );
71
+ }
72
+ function toBytes32Hex(value) {
73
+ if (typeof value === "bigint") {
74
+ return pad(numberToHex(value), { size: 32 });
75
+ }
76
+ return value;
77
+ }
78
+ function toAddress20Hex(addr) {
79
+ return addr.toLowerCase();
80
+ }
81
+ function buildStarkWithdrawWitness(params) {
82
+ return {
83
+ owner_secret: params.ownerSecret,
84
+ input_amount: params.inputAmount,
85
+ input_blinding: params.inputBlinding,
86
+ input_origin: params.inputOrigin,
87
+ token: params.token,
88
+ leaf_index: params.leafIndex,
89
+ state_path_elements: new Array(STARK_STATE_TREE_DEPTH).fill(0),
90
+ state_path_indices: new Array(STARK_STATE_TREE_DEPTH).fill(0),
91
+ asp_path_elements: new Array(STARK_ASP_TREE_DEPTH).fill(0),
92
+ asp_path_indices: new Array(STARK_ASP_TREE_DEPTH).fill(0),
93
+ withdraw_amount: params.withdrawAmount,
94
+ change_amount: params.changeAmount,
95
+ change_blinding: params.changeBlinding,
96
+ recipient: params.recipient,
97
+ is_ragequit: params.isRagequit,
98
+ nullifier_hex: params.nullifierHex,
99
+ state_root_hex: toBytes32Hex(params.stateRootBigInt),
100
+ asp_root_hex: toBytes32Hex(params.aspRootBigInt),
101
+ asp_id_hex: toBytes32Hex(params.aspIdBigInt),
102
+ token_address_hex: toAddress20Hex(params.tokenAddress),
103
+ amount_hex: toBytes32Hex(params.amountWei),
104
+ recipient_address_hex: toAddress20Hex(params.recipientAddress),
105
+ is_ragequit_bool: params.isRagequitBool
106
+ };
107
+ }
108
+ function buildStarkTransferWitness(params) {
109
+ return {
110
+ owner_secret: params.ownerSecret,
111
+ input_amount: params.inputAmount,
112
+ input_blinding: params.inputBlinding,
113
+ input_origin: params.inputOrigin,
114
+ token: params.token,
115
+ leaf_index: params.leafIndex,
116
+ state_path_elements: new Array(STARK_STATE_TREE_DEPTH).fill(0),
117
+ state_path_indices: new Array(STARK_STATE_TREE_DEPTH).fill(0),
118
+ asp_path_elements: new Array(STARK_ASP_TREE_DEPTH).fill(0),
119
+ asp_path_indices: new Array(STARK_ASP_TREE_DEPTH).fill(0),
120
+ output1_amount: params.output1Amount,
121
+ output1_owner_hash: params.output1OwnerHash,
122
+ output1_blinding: params.output1Blinding,
123
+ output1_origin: params.output1Origin,
124
+ output2_amount: params.output2Amount,
125
+ output2_owner_hash: params.output2OwnerHash,
126
+ output2_blinding: params.output2Blinding,
127
+ output2_origin: params.output2Origin,
128
+ is_ragequit: params.isRagequit,
129
+ nullifier_hex: params.nullifierHex,
130
+ state_root_hex: toBytes32Hex(params.stateRootBigInt),
131
+ asp_root_hex: toBytes32Hex(params.aspRootBigInt),
132
+ token_address_hex: toAddress20Hex(params.tokenAddress),
133
+ output_commitment_1_hex: params.outputCommitment1Hex,
134
+ output_commitment_2_hex: params.outputCommitment2Hex
135
+ };
136
+ }
137
+
138
+ export { STARK_AMOUNT_SCALE, STARK_ASP_TREE_DEPTH, STARK_STATE_TREE_DEPTH, addressToM31, buildStarkTransferWitness, buildStarkWithdrawWitness, computeTransferPublicInputsSeed, computeWithdrawPublicInputsSeed, isStarkAligned, packM31Digest, scaleAmountForStark, splitSecretToM31Limbs, truncateToM31 };
139
+ //# sourceMappingURL=chunk-XBNYAAMU.js.map
140
+ //# sourceMappingURL=chunk-XBNYAAMU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/stark.ts"],"names":[],"mappings":";;;AAmBO,IAAM,qBAAqB,GAAA,IAAO;AAGlC,IAAM,sBAAA,GAAyB;AAG/B,IAAM,oBAAA,GAAuB;AAO7B,SAAS,eAAe,MAAA,EAAyB;AACtD,EAAA,IAAI,MAAA,IAAU,IAAI,OAAO,KAAA;AACzB,EAAA,MAAM,SAAS,MAAA,GAAS,kBAAA;AACxB,EAAA,OAAO,MAAA,GAAS,kBAAA,KAAuB,MAAA,IAAU,MAAA,GAAS,KAAA;AAC5D;AASO,SAAS,oBAAoB,SAAA,EAA2B;AAC7D,EAAA,MAAM,SAAS,SAAA,GAAY,kBAAA;AAC3B,EAAA,IAAI,MAAA,GAAS,uBAAuB,SAAA,EAAW;AAC7C,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,OAAA,EAAU,SAAS,CAAA,6BAAA,EAAgC,kBAAkB,CAAA,CAAA,CAAG,CAAA;AAAA,EAC1F;AACA,EAAA,IAAI,UAAU,KAAA,EAAO;AACnB,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,cAAA,EAAiB,MAAM,CAAA,kBAAA,EAAqB,KAAK,CAAA,CAAA,CAAG,CAAA;AAAA,EACtE;AACA,EAAA,OAAO,OAAO,MAAM,CAAA;AACtB;AAGO,SAAS,cAAc,KAAA,EAAuB;AACnD,EAAA,OAAO,MAAA,CAAO,QAAQ,KAAK,CAAA;AAC7B;AAOO,SAAS,aAAa,IAAA,EAAuB;AAClD,EAAA,OAAO,MAAA,CAAO,MAAA,CAAO,IAAI,CAAA,GAAI,KAAK,CAAA;AACpC;AAUO,SAAS,sBAAsB,MAAA,EAA0B;AAC9D,EAAA,MAAM,QAAk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AA,IACzB,gBAAgB,MAAA,CAAO,aAAA;AAAA,IACvB,aAAa,MAAA,CAAO,UAAA;AAAA,IACpB,eAAe,MAAA,CAAO,YAAA;AAAA,IACtB,cAAA,EAAgB,YAAA,CAAa,MAAA,CAAO,eAAe,CAAA;AAAA,IACnD,YAAA,EAAc,YAAA,CAAa,MAAA,CAAO,aAAa,CAAA;AAAA,IAC/C,iBAAA,EAAmB,cAAA,CAAe,MAAA,CAAO,YAAY,CAAA;AAAA,IACrD,yBAAyB,MAAA,CAAO,oBAAA;AAAA,IAChC,yBAAyB,MAAA,CAAO;AAAA,GAClC;AACF","file":"chunk-XBNYAAMU.js","sourcesContent":["/**\n * STARK Utilities — Amount scaling, witness building, Fiat-Shamir\n *\n * These functions must produce identical outputs to the Rust Stwo prover\n * (stwo-prover/src/) and the Solidity verifier.\n *\n * M31 field: p = 2^31 - 1 = 2,147,483,647\n * Amount precision: 0.001 tokens (1e15 wei scale factor)\n */\n\nimport type { Address, Hex } from 'viem'\nimport { keccak256, encodePacked, pad, numberToHex } from 'viem'\nimport { M31_P, SECRET_LIMBS } from './keccak-m31.js'\n\n// ============================================================================\n// Constants\n// ============================================================================\n\n/** Matches Solidity STARK_AMOUNT_SCALE = 1e15 */\nexport const STARK_AMOUNT_SCALE = 10n ** 15n\n\n/** State tree depth (Merkle tree for commitments) */\nexport const STARK_STATE_TREE_DEPTH = 32\n\n/** ASP tree depth */\nexport const STARK_ASP_TREE_DEPTH = 20\n\n// ============================================================================\n// Amount Scaling\n// ============================================================================\n\n/** Check if a wei amount is STARK-scale aligned and fits in M31. */\nexport function isStarkAligned(amount: bigint): boolean {\n if (amount <= 0n) return false\n const scaled = amount / STARK_AMOUNT_SCALE\n return scaled * STARK_AMOUNT_SCALE === amount && scaled < M31_P\n}\n\n/**\n * Scale a wei amount down for the STARK circuit.\n * Precision: 0.001 tokens (1e15 wei). Max: ~2.1M tokens.\n *\n * @returns The scaled amount as a number (fits in M31)\n * @throws If not aligned to STARK_AMOUNT_SCALE or exceeds M31\n */\nexport function scaleAmountForStark(weiAmount: bigint): number {\n const scaled = weiAmount / STARK_AMOUNT_SCALE\n if (scaled * STARK_AMOUNT_SCALE !== weiAmount) {\n throw new Error(`Amount ${weiAmount} not aligned to STARK scale (${STARK_AMOUNT_SCALE})`)\n }\n if (scaled >= M31_P) {\n throw new Error(`Scaled amount ${scaled} exceeds M31 max (${M31_P})`)\n }\n return Number(scaled)\n}\n\n/** Truncate a bigint to fit in M31 (modular reduction). */\nexport function truncateToM31(value: bigint): number {\n return Number(value % M31_P)\n}\n\n// ============================================================================\n// Field Conversions\n// ============================================================================\n\n/** Convert an Ethereum address to an M31 field element (truncated). */\nexport function addressToM31(addr: Address): number {\n return Number(BigInt(addr) % M31_P)\n}\n\n/**\n * Split a 254-bit spending secret into 8 M31 limbs (248 bits of entropy).\n *\n * Each limb holds 31 bits (reduced mod M31_P). The secret is split\n * little-endian: limb[0] = lowest 31 bits, limb[7] = highest bits.\n *\n * This matches the Rust prover's expectation of `[M31; 8]` for owner_secret.\n */\nexport function splitSecretToM31Limbs(secret: bigint): number[] {\n const limbs: number[] = []\n let remaining = secret\n for (let i = 0; i < SECRET_LIMBS; i++) {\n limbs.push(Number(remaining % M31_P))\n remaining = remaining / M31_P\n }\n return limbs\n}\n\n/**\n * Pack an M31 digest (4 M31 elements) into a uint128 for Solidity.\n * Each element occupies 32 bits (little-endian packing).\n */\nexport function packM31Digest(digest: [number, number, number, number]): bigint {\n return BigInt(digest[0])\n | (BigInt(digest[1]) << 32n)\n | (BigInt(digest[2]) << 64n)\n | (BigInt(digest[3]) << 96n)\n}\n\n// ============================================================================\n// Fiat-Shamir Public Input Seeds\n// ============================================================================\n\n/**\n * Compute the Fiat-Shamir public inputs seed for a STARK withdrawal.\n * Must produce the same hash as Solidity and Rust.\n */\nexport function computeWithdrawPublicInputsSeed(params: {\n nullifier: Hex\n stateRoot: bigint\n aspRoot: bigint\n aspId: bigint\n token: Address\n amount: bigint\n recipient: Address\n isRagequit: boolean\n}): Hex {\n return keccak256(\n encodePacked(\n ['bytes32', 'uint256', 'uint256', 'uint256', 'address', 'uint256', 'address', 'bool'],\n [\n params.nullifier,\n params.stateRoot,\n params.aspRoot,\n params.aspId,\n params.token,\n params.amount,\n params.recipient,\n params.isRagequit,\n ],\n ),\n )\n}\n\n/**\n * Compute the Fiat-Shamir public inputs seed for a STARK transfer.\n * Must produce the same hash as Solidity and Rust.\n */\nexport function computeTransferPublicInputsSeed(params: {\n nullifier: Hex\n stateRoot: bigint\n aspRoot: bigint\n token: Address\n outputCommitment1: Hex\n outputCommitment2: Hex\n}): Hex {\n return keccak256(\n encodePacked(\n ['bytes32', 'uint256', 'uint256', 'address', 'bytes32', 'bytes32'],\n [\n params.nullifier,\n params.stateRoot,\n params.aspRoot,\n params.token,\n params.outputCommitment1,\n params.outputCommitment2,\n ],\n ),\n )\n}\n\n// ============================================================================\n// Witness Types\n// ============================================================================\n\n/**\n * Witness inputs for the STARK withdrawal prover.\n * All numeric values are u32 (must fit in M31 field, i.e. < 2^31 - 1).\n * Hex string fields are for Fiat-Shamir seed binding.\n */\nexport interface StarkWithdrawWitness {\n owner_secret: number[]\n input_amount: number\n input_blinding: number\n input_origin: number\n token: number\n leaf_index: number\n state_path_elements: number[]\n state_path_indices: number[]\n asp_path_elements: number[]\n asp_path_indices: number[]\n withdraw_amount: number\n change_amount: number\n change_blinding: number\n recipient: number\n is_ragequit: number\n // Ethereum-native hex values for Fiat-Shamir seed binding\n nullifier_hex: string\n state_root_hex: string\n asp_root_hex: string\n asp_id_hex: string\n token_address_hex: string\n amount_hex: string\n recipient_address_hex: string\n is_ragequit_bool: boolean\n}\n\n/**\n * Witness inputs for the STARK transfer prover (1-in-2-out).\n * All numeric values are u32 (must fit in M31 field).\n */\nexport interface StarkTransferWitness {\n owner_secret: number[]\n input_amount: number\n input_blinding: number\n input_origin: number\n token: number\n leaf_index: number\n state_path_elements: number[]\n state_path_indices: number[]\n asp_path_elements: number[]\n asp_path_indices: number[]\n // Output 1\n output1_amount: number\n output1_owner_hash: [number, number, number, number]\n output1_blinding: number\n output1_origin: number\n // Output 2\n output2_amount: number\n output2_owner_hash: [number, number, number, number]\n output2_blinding: number\n output2_origin: number\n // Ragequit flag\n is_ragequit: number\n // Ethereum-native hex values for Fiat-Shamir seed binding\n nullifier_hex: string\n state_root_hex: string\n asp_root_hex: string\n token_address_hex: string\n output_commitment_1_hex: string\n output_commitment_2_hex: string\n}\n\n// ============================================================================\n// Witness Builders\n// ============================================================================\n\nfunction toBytes32Hex(value: bigint | Hex): string {\n if (typeof value === 'bigint') {\n return pad(numberToHex(value), { size: 32 })\n }\n return value as string\n}\n\nfunction toAddress20Hex(addr: Address): string {\n return addr.toLowerCase()\n}\n\n/**\n * Build a complete STARK withdrawal witness from note data.\n */\nexport function buildStarkWithdrawWitness(params: {\n ownerSecret: number[]\n inputAmount: number\n inputBlinding: number\n inputOrigin: number\n token: number\n leafIndex: number\n withdrawAmount: number\n changeAmount: number\n changeBlinding: number\n recipient: number\n isRagequit: number\n // Full Ethereum values for seed binding\n nullifierHex: Hex\n stateRootBigInt: bigint\n aspRootBigInt: bigint\n aspIdBigInt: bigint\n tokenAddress: Address\n amountWei: bigint\n recipientAddress: Address\n isRagequitBool: boolean\n}): StarkWithdrawWitness {\n return {\n owner_secret: params.ownerSecret,\n input_amount: params.inputAmount,\n input_blinding: params.inputBlinding,\n input_origin: params.inputOrigin,\n token: params.token,\n leaf_index: params.leafIndex,\n state_path_elements: new Array(STARK_STATE_TREE_DEPTH).fill(0),\n state_path_indices: new Array(STARK_STATE_TREE_DEPTH).fill(0),\n asp_path_elements: new Array(STARK_ASP_TREE_DEPTH).fill(0),\n asp_path_indices: new Array(STARK_ASP_TREE_DEPTH).fill(0),\n withdraw_amount: params.withdrawAmount,\n change_amount: params.changeAmount,\n change_blinding: params.changeBlinding,\n recipient: params.recipient,\n is_ragequit: params.isRagequit,\n nullifier_hex: params.nullifierHex,\n state_root_hex: toBytes32Hex(params.stateRootBigInt),\n asp_root_hex: toBytes32Hex(params.aspRootBigInt),\n asp_id_hex: toBytes32Hex(params.aspIdBigInt),\n token_address_hex: toAddress20Hex(params.tokenAddress),\n amount_hex: toBytes32Hex(params.amountWei),\n recipient_address_hex: toAddress20Hex(params.recipientAddress),\n is_ragequit_bool: params.isRagequitBool,\n }\n}\n\n/**\n * Build a complete STARK transfer witness (1-in-2-out).\n */\nexport function buildStarkTransferWitness(params: {\n ownerSecret: number[]\n inputAmount: number\n inputBlinding: number\n inputOrigin: number\n token: number\n leafIndex: number\n output1Amount: number\n output1OwnerHash: [number, number, number, number]\n output1Blinding: number\n output1Origin: number\n output2Amount: number\n output2OwnerHash: [number, number, number, number]\n output2Blinding: number\n output2Origin: number\n isRagequit: number\n // Full Ethereum values for seed binding\n nullifierHex: Hex\n stateRootBigInt: bigint\n aspRootBigInt: bigint\n tokenAddress: Address\n outputCommitment1Hex: Hex\n outputCommitment2Hex: Hex\n}): StarkTransferWitness {\n return {\n owner_secret: params.ownerSecret,\n input_amount: params.inputAmount,\n input_blinding: params.inputBlinding,\n input_origin: params.inputOrigin,\n token: params.token,\n leaf_index: params.leafIndex,\n state_path_elements: new Array(STARK_STATE_TREE_DEPTH).fill(0),\n state_path_indices: new Array(STARK_STATE_TREE_DEPTH).fill(0),\n asp_path_elements: new Array(STARK_ASP_TREE_DEPTH).fill(0),\n asp_path_indices: new Array(STARK_ASP_TREE_DEPTH).fill(0),\n output1_amount: params.output1Amount,\n output1_owner_hash: params.output1OwnerHash,\n output1_blinding: params.output1Blinding,\n output1_origin: params.output1Origin,\n output2_amount: params.output2Amount,\n output2_owner_hash: params.output2OwnerHash,\n output2_blinding: params.output2Blinding,\n output2_origin: params.output2Origin,\n is_ragequit: params.isRagequit,\n nullifier_hex: params.nullifierHex,\n state_root_hex: toBytes32Hex(params.stateRootBigInt),\n asp_root_hex: toBytes32Hex(params.aspRootBigInt),\n token_address_hex: toAddress20Hex(params.tokenAddress),\n output_commitment_1_hex: params.outputCommitment1Hex,\n output_commitment_2_hex: params.outputCommitment2Hex,\n }\n}\n"]}
@@ -1,10 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var chunkC7QQOJ7T_cjs = require('../chunk-C7QQOJ7T.cjs');
4
- var chunk46GGZ3TC_cjs = require('../chunk-46GGZ3TC.cjs');
5
- var chunkGXZ3MTCQ_cjs = require('../chunk-GXZ3MTCQ.cjs');
3
+ var chunk52PPS4AT_cjs = require('../chunk-52PPS4AT.cjs');
4
+ var chunkX4DLTVOG_cjs = require('../chunk-X4DLTVOG.cjs');
5
+ var chunkIYOR5TCO_cjs = require('../chunk-IYOR5TCO.cjs');
6
6
  var chunkNDM5EJEV_cjs = require('../chunk-NDM5EJEV.cjs');
7
+ var chunk3YZSIYJC_cjs = require('../chunk-3YZSIYJC.cjs');
7
8
  require('../chunk-EUP7MBAH.cjs');
9
+ require('../chunk-BH24DZ5S.cjs');
8
10
  require('../chunk-3HQ7A6ZM.cjs');
9
11
  require('../chunk-JWNXBALH.cjs');
10
12
  var chunkSQKBT2SH_cjs = require('../chunk-SQKBT2SH.cjs');
@@ -12,213 +14,213 @@ require('../chunk-G7VZBCD6.cjs');
12
14
 
13
15
 
14
16
 
15
- Object.defineProperty(exports, "DirectAccountAdapter", {
16
- enumerable: true,
17
- get: function () { return chunkC7QQOJ7T_cjs.DirectAccountAdapter; }
18
- });
19
17
  Object.defineProperty(exports, "NOTE_VERSION", {
20
18
  enumerable: true,
21
- get: function () { return chunkC7QQOJ7T_cjs.NOTE_VERSION; }
22
- });
23
- Object.defineProperty(exports, "STARK_AMOUNT_SCALE", {
24
- enumerable: true,
25
- get: function () { return chunkC7QQOJ7T_cjs.STARK_AMOUNT_SCALE; }
19
+ get: function () { return chunk52PPS4AT_cjs.NOTE_VERSION; }
26
20
  });
27
21
  Object.defineProperty(exports, "createNote", {
28
22
  enumerable: true,
29
- get: function () { return chunkC7QQOJ7T_cjs.createNote; }
23
+ get: function () { return chunk52PPS4AT_cjs.createNote; }
30
24
  });
31
25
  Object.defineProperty(exports, "createUPPClient", {
32
26
  enumerable: true,
33
- get: function () { return chunkC7QQOJ7T_cjs.createUPPClient; }
27
+ get: function () { return chunk52PPS4AT_cjs.createUPPClient; }
34
28
  });
35
29
  Object.defineProperty(exports, "decryptNote", {
36
30
  enumerable: true,
37
- get: function () { return chunkC7QQOJ7T_cjs.decryptNote; }
31
+ get: function () { return chunk52PPS4AT_cjs.decryptNote; }
38
32
  });
39
33
  Object.defineProperty(exports, "encryptNote", {
40
34
  enumerable: true,
41
- get: function () { return chunkC7QQOJ7T_cjs.encryptNote; }
35
+ get: function () { return chunk52PPS4AT_cjs.encryptNote; }
42
36
  });
43
37
  Object.defineProperty(exports, "buildTransfer", {
44
38
  enumerable: true,
45
- get: function () { return chunk46GGZ3TC_cjs.buildTransfer; }
39
+ get: function () { return chunkX4DLTVOG_cjs.buildTransfer; }
46
40
  });
47
41
  Object.defineProperty(exports, "buildUPPTransferCircuitInputs", {
48
42
  enumerable: true,
49
- get: function () { return chunk46GGZ3TC_cjs.buildUPPTransferCircuitInputs; }
43
+ get: function () { return chunkX4DLTVOG_cjs.buildUPPTransferCircuitInputs; }
50
44
  });
51
45
  Object.defineProperty(exports, "computeNullifier", {
52
46
  enumerable: true,
53
- get: function () { return chunk46GGZ3TC_cjs.computeNullifier; }
47
+ get: function () { return chunkX4DLTVOG_cjs.computeNullifier; }
54
48
  });
55
49
  Object.defineProperty(exports, "formatOutputForContract", {
56
50
  enumerable: true,
57
- get: function () { return chunk46GGZ3TC_cjs.formatOutputForContract; }
51
+ get: function () { return chunkX4DLTVOG_cjs.formatOutputForContract; }
58
52
  });
59
53
  Object.defineProperty(exports, "getMerkleProofsForNotes", {
60
54
  enumerable: true,
61
- get: function () { return chunk46GGZ3TC_cjs.getMerkleProofsForNotes; }
55
+ get: function () { return chunkX4DLTVOG_cjs.getMerkleProofsForNotes; }
62
56
  });
63
57
  Object.defineProperty(exports, "syncMerkleTree", {
64
58
  enumerable: true,
65
- get: function () { return chunk46GGZ3TC_cjs.syncMerkleTree; }
59
+ get: function () { return chunkX4DLTVOG_cjs.syncMerkleTree; }
66
60
  });
67
61
  Object.defineProperty(exports, "ADDRESS_VERSION", {
68
62
  enumerable: true,
69
- get: function () { return chunkGXZ3MTCQ_cjs.ADDRESS_VERSION; }
63
+ get: function () { return chunkIYOR5TCO_cjs.ADDRESS_VERSION; }
64
+ });
65
+ Object.defineProperty(exports, "DirectAccountAdapter", {
66
+ enumerable: true,
67
+ get: function () { return chunkIYOR5TCO_cjs.DirectAccountAdapter; }
70
68
  });
71
69
  Object.defineProperty(exports, "NoteStore", {
72
70
  enumerable: true,
73
- get: function () { return chunkGXZ3MTCQ_cjs.NoteStore; }
71
+ get: function () { return chunkIYOR5TCO_cjs.NoteStore; }
74
72
  });
75
73
  Object.defineProperty(exports, "RATE_PRECISION", {
76
74
  enumerable: true,
77
- get: function () { return chunkGXZ3MTCQ_cjs.RATE_PRECISION; }
75
+ get: function () { return chunkIYOR5TCO_cjs.RATE_PRECISION; }
78
76
  });
79
77
  Object.defineProperty(exports, "STARK_ADDRESS_VERSION", {
80
78
  enumerable: true,
81
- get: function () { return chunkGXZ3MTCQ_cjs.STARK_ADDRESS_VERSION; }
79
+ get: function () { return chunkIYOR5TCO_cjs.STARK_ADDRESS_VERSION; }
82
80
  });
83
81
  Object.defineProperty(exports, "STARK_STEALTH_ADDRESS_PREFIX", {
84
82
  enumerable: true,
85
- get: function () { return chunkGXZ3MTCQ_cjs.STARK_STEALTH_ADDRESS_PREFIX; }
83
+ get: function () { return chunkIYOR5TCO_cjs.STARK_STEALTH_ADDRESS_PREFIX; }
86
84
  });
87
85
  Object.defineProperty(exports, "STEALTH_ADDRESS_PREFIX", {
88
86
  enumerable: true,
89
- get: function () { return chunkGXZ3MTCQ_cjs.STEALTH_ADDRESS_PREFIX; }
87
+ get: function () { return chunkIYOR5TCO_cjs.STEALTH_ADDRESS_PREFIX; }
90
88
  });
91
89
  Object.defineProperty(exports, "SWAP_EVENTS_ABI", {
92
90
  enumerable: true,
93
- get: function () { return chunkGXZ3MTCQ_cjs.SWAP_EVENTS_ABI; }
91
+ get: function () { return chunkIYOR5TCO_cjs.SWAP_EVENTS_ABI; }
94
92
  });
95
93
  Object.defineProperty(exports, "SWAP_ORDER_CANCELLED_EVENT", {
96
94
  enumerable: true,
97
- get: function () { return chunkGXZ3MTCQ_cjs.SWAP_ORDER_CANCELLED_EVENT; }
95
+ get: function () { return chunkIYOR5TCO_cjs.SWAP_ORDER_CANCELLED_EVENT; }
98
96
  });
99
97
  Object.defineProperty(exports, "SWAP_ORDER_CLAIMED_EVENT", {
100
98
  enumerable: true,
101
- get: function () { return chunkGXZ3MTCQ_cjs.SWAP_ORDER_CLAIMED_EVENT; }
99
+ get: function () { return chunkIYOR5TCO_cjs.SWAP_ORDER_CLAIMED_EVENT; }
102
100
  });
103
101
  Object.defineProperty(exports, "SWAP_ORDER_FILLED_EVENT", {
104
102
  enumerable: true,
105
- get: function () { return chunkGXZ3MTCQ_cjs.SWAP_ORDER_FILLED_EVENT; }
103
+ get: function () { return chunkIYOR5TCO_cjs.SWAP_ORDER_FILLED_EVENT; }
106
104
  });
107
105
  Object.defineProperty(exports, "SWAP_ORDER_PLACED_EVENT", {
108
106
  enumerable: true,
109
- get: function () { return chunkGXZ3MTCQ_cjs.SWAP_ORDER_PLACED_EVENT; }
107
+ get: function () { return chunkIYOR5TCO_cjs.SWAP_ORDER_PLACED_EVENT; }
108
+ });
109
+ Object.defineProperty(exports, "StorableAccountAdapter", {
110
+ enumerable: true,
111
+ get: function () { return chunkIYOR5TCO_cjs.StorableAccountAdapter; }
110
112
  });
111
113
  Object.defineProperty(exports, "computeCancelKeyHash", {
112
114
  enumerable: true,
113
- get: function () { return chunkGXZ3MTCQ_cjs.computeCancelKeyHash; }
115
+ get: function () { return chunkIYOR5TCO_cjs.computeCancelKeyHash; }
114
116
  });
115
117
  Object.defineProperty(exports, "computeFillPercentage", {
116
118
  enumerable: true,
117
- get: function () { return chunkGXZ3MTCQ_cjs.computeFillPercentage; }
119
+ get: function () { return chunkIYOR5TCO_cjs.computeFillPercentage; }
118
120
  });
119
121
  Object.defineProperty(exports, "computeGiveAmount", {
120
122
  enumerable: true,
121
- get: function () { return chunkGXZ3MTCQ_cjs.computeGiveAmount; }
123
+ get: function () { return chunkIYOR5TCO_cjs.computeGiveAmount; }
122
124
  });
123
125
  Object.defineProperty(exports, "computeNoteEncryptionKey", {
124
126
  enumerable: true,
125
- get: function () { return chunkGXZ3MTCQ_cjs.computeNoteEncryptionKey; }
127
+ get: function () { return chunkIYOR5TCO_cjs.computeNoteEncryptionKey; }
126
128
  });
127
129
  Object.defineProperty(exports, "computeRate", {
128
130
  enumerable: true,
129
- get: function () { return chunkGXZ3MTCQ_cjs.computeRate; }
131
+ get: function () { return chunkIYOR5TCO_cjs.computeRate; }
130
132
  });
131
133
  Object.defineProperty(exports, "computeTakeAmount", {
132
134
  enumerable: true,
133
- get: function () { return chunkGXZ3MTCQ_cjs.computeTakeAmount; }
135
+ get: function () { return chunkIYOR5TCO_cjs.computeTakeAmount; }
134
136
  });
135
137
  Object.defineProperty(exports, "computeTotalBuyAmount", {
136
138
  enumerable: true,
137
- get: function () { return chunkGXZ3MTCQ_cjs.computeTotalBuyAmount; }
139
+ get: function () { return chunkIYOR5TCO_cjs.computeTotalBuyAmount; }
138
140
  });
139
141
  Object.defineProperty(exports, "createOneTimeKeys", {
140
142
  enumerable: true,
141
- get: function () { return chunkGXZ3MTCQ_cjs.createOneTimeKeys; }
143
+ get: function () { return chunkIYOR5TCO_cjs.createOneTimeKeys; }
142
144
  });
143
145
  Object.defineProperty(exports, "decodeStarkStealthAddress", {
144
146
  enumerable: true,
145
- get: function () { return chunkGXZ3MTCQ_cjs.decodeStarkStealthAddress; }
147
+ get: function () { return chunkIYOR5TCO_cjs.decodeStarkStealthAddress; }
146
148
  });
147
149
  Object.defineProperty(exports, "decodeStealthAddress", {
148
150
  enumerable: true,
149
- get: function () { return chunkGXZ3MTCQ_cjs.decodeStealthAddress; }
151
+ get: function () { return chunkIYOR5TCO_cjs.decodeStealthAddress; }
150
152
  });
151
153
  Object.defineProperty(exports, "detectAddressType", {
152
154
  enumerable: true,
153
- get: function () { return chunkGXZ3MTCQ_cjs.detectAddressType; }
155
+ get: function () { return chunkIYOR5TCO_cjs.detectAddressType; }
154
156
  });
155
157
  Object.defineProperty(exports, "encodeStarkStealthAddress", {
156
158
  enumerable: true,
157
- get: function () { return chunkGXZ3MTCQ_cjs.encodeStarkStealthAddress; }
159
+ get: function () { return chunkIYOR5TCO_cjs.encodeStarkStealthAddress; }
158
160
  });
159
161
  Object.defineProperty(exports, "encodeStealthAddress", {
160
162
  enumerable: true,
161
- get: function () { return chunkGXZ3MTCQ_cjs.encodeStealthAddress; }
163
+ get: function () { return chunkIYOR5TCO_cjs.encodeStealthAddress; }
162
164
  });
163
165
  Object.defineProperty(exports, "filterOrdersByASP", {
164
166
  enumerable: true,
165
- get: function () { return chunkGXZ3MTCQ_cjs.filterOrdersByASP; }
167
+ get: function () { return chunkIYOR5TCO_cjs.filterOrdersByASP; }
166
168
  });
167
169
  Object.defineProperty(exports, "filterOrdersByTokenPair", {
168
170
  enumerable: true,
169
- get: function () { return chunkGXZ3MTCQ_cjs.filterOrdersByTokenPair; }
171
+ get: function () { return chunkIYOR5TCO_cjs.filterOrdersByTokenPair; }
170
172
  });
171
173
  Object.defineProperty(exports, "formatRate", {
172
174
  enumerable: true,
173
- get: function () { return chunkGXZ3MTCQ_cjs.formatRate; }
175
+ get: function () { return chunkIYOR5TCO_cjs.formatRate; }
174
176
  });
175
177
  Object.defineProperty(exports, "generateCancelSecret", {
176
178
  enumerable: true,
177
- get: function () { return chunkGXZ3MTCQ_cjs.generateCancelSecret; }
179
+ get: function () { return chunkIYOR5TCO_cjs.generateCancelSecret; }
178
180
  });
179
181
  Object.defineProperty(exports, "generateStarkStealthAddress", {
180
182
  enumerable: true,
181
- get: function () { return chunkGXZ3MTCQ_cjs.generateStarkStealthAddress; }
183
+ get: function () { return chunkIYOR5TCO_cjs.generateStarkStealthAddress; }
182
184
  });
183
185
  Object.defineProperty(exports, "generateStealthAddress", {
184
186
  enumerable: true,
185
- get: function () { return chunkGXZ3MTCQ_cjs.generateStealthAddress; }
187
+ get: function () { return chunkIYOR5TCO_cjs.generateStealthAddress; }
186
188
  });
187
189
  Object.defineProperty(exports, "getCancelSecret", {
188
190
  enumerable: true,
189
- get: function () { return chunkGXZ3MTCQ_cjs.getCancelSecret; }
191
+ get: function () { return chunkIYOR5TCO_cjs.getCancelSecret; }
190
192
  });
191
193
  Object.defineProperty(exports, "getOwnOrderIds", {
192
194
  enumerable: true,
193
- get: function () { return chunkGXZ3MTCQ_cjs.getOwnOrderIds; }
195
+ get: function () { return chunkIYOR5TCO_cjs.getOwnOrderIds; }
194
196
  });
195
197
  Object.defineProperty(exports, "isFillerASPAccepted", {
196
198
  enumerable: true,
197
- get: function () { return chunkGXZ3MTCQ_cjs.isFillerASPAccepted; }
199
+ get: function () { return chunkIYOR5TCO_cjs.isFillerASPAccepted; }
198
200
  });
199
201
  Object.defineProperty(exports, "isOrderActive", {
200
202
  enumerable: true,
201
- get: function () { return chunkGXZ3MTCQ_cjs.isOrderActive; }
203
+ get: function () { return chunkIYOR5TCO_cjs.isOrderActive; }
202
204
  });
203
205
  Object.defineProperty(exports, "isValidStarkStealthAddress", {
204
206
  enumerable: true,
205
- get: function () { return chunkGXZ3MTCQ_cjs.isValidStarkStealthAddress; }
207
+ get: function () { return chunkIYOR5TCO_cjs.isValidStarkStealthAddress; }
206
208
  });
207
209
  Object.defineProperty(exports, "isValidStealthAddress", {
208
210
  enumerable: true,
209
- get: function () { return chunkGXZ3MTCQ_cjs.isValidStealthAddress; }
211
+ get: function () { return chunkIYOR5TCO_cjs.isValidStealthAddress; }
210
212
  });
211
213
  Object.defineProperty(exports, "removeCancelSecret", {
212
214
  enumerable: true,
213
- get: function () { return chunkGXZ3MTCQ_cjs.removeCancelSecret; }
215
+ get: function () { return chunkIYOR5TCO_cjs.removeCancelSecret; }
214
216
  });
215
217
  Object.defineProperty(exports, "storeCancelSecret", {
216
218
  enumerable: true,
217
- get: function () { return chunkGXZ3MTCQ_cjs.storeCancelSecret; }
219
+ get: function () { return chunkIYOR5TCO_cjs.storeCancelSecret; }
218
220
  });
219
221
  Object.defineProperty(exports, "verifyOwnership", {
220
222
  enumerable: true,
221
- get: function () { return chunkGXZ3MTCQ_cjs.verifyOwnership; }
223
+ get: function () { return chunkIYOR5TCO_cjs.verifyOwnership; }
222
224
  });
223
225
  Object.defineProperty(exports, "DEMO_ASP_ID", {
224
226
  enumerable: true,
@@ -260,6 +262,10 @@ Object.defineProperty(exports, "verifyASPProof", {
260
262
  enumerable: true,
261
263
  get: function () { return chunkNDM5EJEV_cjs.verifyASPProof; }
262
264
  });
265
+ Object.defineProperty(exports, "STARK_AMOUNT_SCALE", {
266
+ enumerable: true,
267
+ get: function () { return chunk3YZSIYJC_cjs.STARK_AMOUNT_SCALE; }
268
+ });
263
269
  Object.defineProperty(exports, "ASP_TREE_DEPTH", {
264
270
  enumerable: true,
265
271
  get: function () { return chunkSQKBT2SH_cjs.ASP_TREE_DEPTH; }
@@ -1,5 +1,6 @@
1
- export { A as ADDRESS_VERSION, k as ASPMembershipProof, D as DirectAccountAdapter, l as IASPProvider, m as IAccountAdapter, n as INoteStore, T as NoteStatus, o as NoteStore, P as ProofSystem, p as STARK_ADDRESS_VERSION, q as STARK_STEALTH_ADDRESS_PREFIX, r as STEALTH_ADDRESS_PREFIX, s as ShieldedNote, U as UPPClient, t as UPPClientConfig, u as computeNoteEncryptionKey, v as createNote, w as createOneTimeKeys, x as createUPPClient, y as decodeStarkStealthAddress, z as decodeStealthAddress, B as decryptNote, E as detectAddressType, F as encodeStarkStealthAddress, G as encodeStealthAddress, H as encryptNote, J as generateStarkStealthAddress, K as generateStealthAddress, M as isValidStarkStealthAddress, O as isValidStealthAddress, Q as verifyOwnership } from '../index-C-jSNw6j.cjs';
2
- export { A as ASPProof, a as ASPRoot, b as ASP_TREE_DEPTH, C as CircuitArtifacts, c as CircuitType, d as Commitment, D as DEMO_ASP_ID, e as DEMO_ASP_NAME, E as EncryptedNote, M as MergeParams, f as MergeRecord, g as MerkleProofWithNote, N as NOTE_VERSION, h as Note, i as NoteWithAmount, j as Nullifier, P as Proof, k as ProofResult, R as RATE_PRECISION, S as STARK_AMOUNT_SCALE, l as STATE_TREE_DEPTH, m as SWAP_EVENTS_ABI, n as SWAP_ORDER_CANCELLED_EVENT, o as SWAP_ORDER_CLAIMED_EVENT, p as SWAP_ORDER_FILLED_EVENT, q as SWAP_ORDER_PLACED_EVENT, r as ShieldParams, s as SpendableNote, t as StarkNote, u as StarkProof, v as StarkStealthMetaAddress, w as Stealth1x2CircuitInputs, x as Stealth2x2CircuitInputs, y as StealthAddress, z as StealthCircuitInputs, B as StealthCircuitType, F as StealthMetaAddress, G as SwapFillEvent, H as SwapFillParams, I as SwapOrder, J as SwapOrderEvent, K as SwapOrderParams, T as TransferBuildResult, L as TransferContext, O as TransferParams, Q as TransferStage, U as UPPCircuitInputs, V as UPPCircuitType, W as UPPTransferCircuitInputs, X as UPPWithdrawCircuitInputs, Y as WithdrawParams, Z as buildASPTree, _ as buildTransfer, $ as buildUPPTransferCircuitInputs, a0 as computeCancelKeyHash, a1 as computeFillPercentage, a2 as computeGiveAmount, a3 as computeMultiOriginASPRoot, a4 as computeNullifier, a5 as computeRate, a6 as computeSingleOriginASPRoot, a7 as computeTakeAmount, a8 as computeTotalBuyAmount, a9 as createDemoASPRoot, aa as filterOrdersByASP, ab as filterOrdersByTokenPair, ac as formatOutputForContract, ad as formatProofForContract, ae as formatRate, af as generateASPProof, ag as generateCancelSecret, ah as generateMultiOriginASPProof, ai as generateProof, aj as generateSingleOriginASPProof, ak as generateStealthProof, al as generateUPPProof, am as getCancelSecret, an as getMerkleProofsForNotes, ao as getOwnOrderIds, ap as getStealthCircuitArtifacts, aq as getUPPCircuitArtifacts, ar as isFillerASPAccepted, as as isOrderActive, at as removeCancelSecret, au as storeCancelSecret, av as syncMerkleTree, aw as verifyASPProof, ax as verifyProof } from '../transfer-DKZuJnRM.cjs';
1
+ export { A as ADDRESS_VERSION, k as ASPMembershipProof, D as DirectAccountAdapter, l as IASPProvider, m as IAccountAdapter, n as INoteStore, V as NoteStatus, o as NoteStore, P as ProofSystem, p as STARK_ADDRESS_VERSION, q as STARK_STEALTH_ADDRESS_PREFIX, r as STEALTH_ADDRESS_PREFIX, s as ShieldedNote, t as StorableAccountAdapter, U as UPPClient, u as UPPClientConfig, v as computeNoteEncryptionKey, w as createNote, x as createOneTimeKeys, y as createUPPClient, z as decodeStarkStealthAddress, B as decodeStealthAddress, E as decryptNote, F as detectAddressType, G as encodeStarkStealthAddress, H as encodeStealthAddress, J as encryptNote, K as generateStarkStealthAddress, M as generateStealthAddress, O as isValidStarkStealthAddress, Q as isValidStealthAddress, T as verifyOwnership } from '../index-o-Ds3YAq.cjs';
2
+ export { A as ASPProof, a as ASPRoot, b as ASP_TREE_DEPTH, C as CircuitArtifacts, c as CircuitType, d as Commitment, D as DEMO_ASP_ID, e as DEMO_ASP_NAME, E as EncryptedNote, M as MergeParams, f as MergeRecord, g as MerkleProofWithNote, N as NOTE_VERSION, h as Note, i as NoteWithAmount, j as Nullifier, P as Proof, k as ProofResult, R as RATE_PRECISION, S as STATE_TREE_DEPTH, l as SWAP_EVENTS_ABI, m as SWAP_ORDER_CANCELLED_EVENT, n as SWAP_ORDER_CLAIMED_EVENT, o as SWAP_ORDER_FILLED_EVENT, p as SWAP_ORDER_PLACED_EVENT, q as ShieldParams, r as SpendableNote, s as StarkNote, t as StarkProof, u as StarkStealthMetaAddress, v as Stealth1x2CircuitInputs, w as Stealth2x2CircuitInputs, x as StealthAddress, y as StealthCircuitInputs, z as StealthCircuitType, B as StealthMetaAddress, F as SwapFillEvent, G as SwapFillParams, H as SwapOrder, I as SwapOrderEvent, J as SwapOrderParams, T as TransferBuildResult, K as TransferContext, L as TransferParams, O as TransferStage, U as UPPCircuitInputs, Q as UPPCircuitType, V as UPPTransferCircuitInputs, W as UPPWithdrawCircuitInputs, X as WithdrawParams, Y as buildASPTree, Z as buildTransfer, _ as buildUPPTransferCircuitInputs, $ as computeCancelKeyHash, a0 as computeFillPercentage, a1 as computeGiveAmount, a2 as computeMultiOriginASPRoot, a3 as computeNullifier, a4 as computeRate, a5 as computeSingleOriginASPRoot, a6 as computeTakeAmount, a7 as computeTotalBuyAmount, a8 as createDemoASPRoot, a9 as filterOrdersByASP, aa as filterOrdersByTokenPair, ab as formatOutputForContract, ac as formatProofForContract, ad as formatRate, ae as generateASPProof, af as generateCancelSecret, ag as generateMultiOriginASPProof, ah as generateProof, ai as generateSingleOriginASPProof, aj as generateStealthProof, ak as generateUPPProof, al as getCancelSecret, am as getMerkleProofsForNotes, an as getOwnOrderIds, ao as getStealthCircuitArtifacts, ap as getUPPCircuitArtifacts, aq as isFillerASPAccepted, ar as isOrderActive, as as removeCancelSecret, at as storeCancelSecret, au as syncMerkleTree, av as verifyASPProof, aw as verifyProof } from '../transfer-BzyernBd.cjs';
3
+ export { S as STARK_AMOUNT_SCALE } from '../stark-BcTD1OaJ.cjs';
3
4
  import 'viem';
4
5
  import '../types-CJSbxv4q.cjs';
5
6
  import '../keccak-m31-B_AqBbRF.cjs';
@@ -1,5 +1,6 @@
1
- export { A as ADDRESS_VERSION, k as ASPMembershipProof, D as DirectAccountAdapter, l as IASPProvider, m as IAccountAdapter, n as INoteStore, T as NoteStatus, o as NoteStore, P as ProofSystem, p as STARK_ADDRESS_VERSION, q as STARK_STEALTH_ADDRESS_PREFIX, r as STEALTH_ADDRESS_PREFIX, s as ShieldedNote, U as UPPClient, t as UPPClientConfig, u as computeNoteEncryptionKey, v as createNote, w as createOneTimeKeys, x as createUPPClient, y as decodeStarkStealthAddress, z as decodeStealthAddress, B as decryptNote, E as detectAddressType, F as encodeStarkStealthAddress, G as encodeStealthAddress, H as encryptNote, J as generateStarkStealthAddress, K as generateStealthAddress, M as isValidStarkStealthAddress, O as isValidStealthAddress, Q as verifyOwnership } from '../index-BBzvvrhG.js';
2
- export { A as ASPProof, a as ASPRoot, b as ASP_TREE_DEPTH, C as CircuitArtifacts, c as CircuitType, d as Commitment, D as DEMO_ASP_ID, e as DEMO_ASP_NAME, E as EncryptedNote, M as MergeParams, f as MergeRecord, g as MerkleProofWithNote, N as NOTE_VERSION, h as Note, i as NoteWithAmount, j as Nullifier, P as Proof, k as ProofResult, R as RATE_PRECISION, S as STARK_AMOUNT_SCALE, l as STATE_TREE_DEPTH, m as SWAP_EVENTS_ABI, n as SWAP_ORDER_CANCELLED_EVENT, o as SWAP_ORDER_CLAIMED_EVENT, p as SWAP_ORDER_FILLED_EVENT, q as SWAP_ORDER_PLACED_EVENT, r as ShieldParams, s as SpendableNote, t as StarkNote, u as StarkProof, v as StarkStealthMetaAddress, w as Stealth1x2CircuitInputs, x as Stealth2x2CircuitInputs, y as StealthAddress, z as StealthCircuitInputs, B as StealthCircuitType, F as StealthMetaAddress, G as SwapFillEvent, H as SwapFillParams, I as SwapOrder, J as SwapOrderEvent, K as SwapOrderParams, T as TransferBuildResult, L as TransferContext, O as TransferParams, Q as TransferStage, U as UPPCircuitInputs, V as UPPCircuitType, W as UPPTransferCircuitInputs, X as UPPWithdrawCircuitInputs, Y as WithdrawParams, Z as buildASPTree, _ as buildTransfer, $ as buildUPPTransferCircuitInputs, a0 as computeCancelKeyHash, a1 as computeFillPercentage, a2 as computeGiveAmount, a3 as computeMultiOriginASPRoot, a4 as computeNullifier, a5 as computeRate, a6 as computeSingleOriginASPRoot, a7 as computeTakeAmount, a8 as computeTotalBuyAmount, a9 as createDemoASPRoot, aa as filterOrdersByASP, ab as filterOrdersByTokenPair, ac as formatOutputForContract, ad as formatProofForContract, ae as formatRate, af as generateASPProof, ag as generateCancelSecret, ah as generateMultiOriginASPProof, ai as generateProof, aj as generateSingleOriginASPProof, ak as generateStealthProof, al as generateUPPProof, am as getCancelSecret, an as getMerkleProofsForNotes, ao as getOwnOrderIds, ap as getStealthCircuitArtifacts, aq as getUPPCircuitArtifacts, ar as isFillerASPAccepted, as as isOrderActive, at as removeCancelSecret, au as storeCancelSecret, av as syncMerkleTree, aw as verifyASPProof, ax as verifyProof } from '../transfer-BlmbO-Rd.js';
1
+ export { A as ADDRESS_VERSION, k as ASPMembershipProof, D as DirectAccountAdapter, l as IASPProvider, m as IAccountAdapter, n as INoteStore, V as NoteStatus, o as NoteStore, P as ProofSystem, p as STARK_ADDRESS_VERSION, q as STARK_STEALTH_ADDRESS_PREFIX, r as STEALTH_ADDRESS_PREFIX, s as ShieldedNote, t as StorableAccountAdapter, U as UPPClient, u as UPPClientConfig, v as computeNoteEncryptionKey, w as createNote, x as createOneTimeKeys, y as createUPPClient, z as decodeStarkStealthAddress, B as decodeStealthAddress, E as decryptNote, F as detectAddressType, G as encodeStarkStealthAddress, H as encodeStealthAddress, J as encryptNote, K as generateStarkStealthAddress, M as generateStealthAddress, O as isValidStarkStealthAddress, Q as isValidStealthAddress, T as verifyOwnership } from '../index-DwAJBoU7.js';
2
+ export { A as ASPProof, a as ASPRoot, b as ASP_TREE_DEPTH, C as CircuitArtifacts, c as CircuitType, d as Commitment, D as DEMO_ASP_ID, e as DEMO_ASP_NAME, E as EncryptedNote, M as MergeParams, f as MergeRecord, g as MerkleProofWithNote, N as NOTE_VERSION, h as Note, i as NoteWithAmount, j as Nullifier, P as Proof, k as ProofResult, R as RATE_PRECISION, S as STATE_TREE_DEPTH, l as SWAP_EVENTS_ABI, m as SWAP_ORDER_CANCELLED_EVENT, n as SWAP_ORDER_CLAIMED_EVENT, o as SWAP_ORDER_FILLED_EVENT, p as SWAP_ORDER_PLACED_EVENT, q as ShieldParams, r as SpendableNote, s as StarkNote, t as StarkProof, u as StarkStealthMetaAddress, v as Stealth1x2CircuitInputs, w as Stealth2x2CircuitInputs, x as StealthAddress, y as StealthCircuitInputs, z as StealthCircuitType, B as StealthMetaAddress, F as SwapFillEvent, G as SwapFillParams, H as SwapOrder, I as SwapOrderEvent, J as SwapOrderParams, T as TransferBuildResult, K as TransferContext, L as TransferParams, O as TransferStage, U as UPPCircuitInputs, Q as UPPCircuitType, V as UPPTransferCircuitInputs, W as UPPWithdrawCircuitInputs, X as WithdrawParams, Y as buildASPTree, Z as buildTransfer, _ as buildUPPTransferCircuitInputs, $ as computeCancelKeyHash, a0 as computeFillPercentage, a1 as computeGiveAmount, a2 as computeMultiOriginASPRoot, a3 as computeNullifier, a4 as computeRate, a5 as computeSingleOriginASPRoot, a6 as computeTakeAmount, a7 as computeTotalBuyAmount, a8 as createDemoASPRoot, a9 as filterOrdersByASP, aa as filterOrdersByTokenPair, ab as formatOutputForContract, ac as formatProofForContract, ad as formatRate, ae as generateASPProof, af as generateCancelSecret, ag as generateMultiOriginASPProof, ah as generateProof, ai as generateSingleOriginASPProof, aj as generateStealthProof, ak as generateUPPProof, al as getCancelSecret, am as getMerkleProofsForNotes, an as getOwnOrderIds, ao as getStealthCircuitArtifacts, ap as getUPPCircuitArtifacts, aq as isFillerASPAccepted, ar as isOrderActive, as as removeCancelSecret, at as storeCancelSecret, au as syncMerkleTree, av as verifyASPProof, aw as verifyProof } from '../transfer-sqS6mJko.js';
3
+ export { S as STARK_AMOUNT_SCALE } from '../stark-BcTD1OaJ.js';
3
4
  import 'viem';
4
5
  import '../types-mLybMxNR.js';
5
6
  import '../keccak-m31-B_AqBbRF.js';
@@ -1,8 +1,10 @@
1
- export { DirectAccountAdapter, NOTE_VERSION, STARK_AMOUNT_SCALE, createNote, createUPPClient, decryptNote, encryptNote } from '../chunk-SGZZL5AC.js';
2
- export { buildTransfer, buildUPPTransferCircuitInputs, computeNullifier, formatOutputForContract, getMerkleProofsForNotes, syncMerkleTree } from '../chunk-CZ23JMAQ.js';
3
- export { ADDRESS_VERSION, NoteStore, RATE_PRECISION, STARK_ADDRESS_VERSION, STARK_STEALTH_ADDRESS_PREFIX, STEALTH_ADDRESS_PREFIX, SWAP_EVENTS_ABI, SWAP_ORDER_CANCELLED_EVENT, SWAP_ORDER_CLAIMED_EVENT, SWAP_ORDER_FILLED_EVENT, SWAP_ORDER_PLACED_EVENT, computeCancelKeyHash, computeFillPercentage, computeGiveAmount, computeNoteEncryptionKey, computeRate, computeTakeAmount, computeTotalBuyAmount, createOneTimeKeys, decodeStarkStealthAddress, decodeStealthAddress, detectAddressType, encodeStarkStealthAddress, encodeStealthAddress, filterOrdersByASP, filterOrdersByTokenPair, formatRate, generateCancelSecret, generateStarkStealthAddress, generateStealthAddress, getCancelSecret, getOwnOrderIds, isFillerASPAccepted, isOrderActive, isValidStarkStealthAddress, isValidStealthAddress, removeCancelSecret, storeCancelSecret, verifyOwnership } from '../chunk-NUIQHTSA.js';
1
+ export { NOTE_VERSION, createNote, createUPPClient, decryptNote, encryptNote } from '../chunk-GS4UCMW4.js';
2
+ export { buildTransfer, buildUPPTransferCircuitInputs, computeNullifier, formatOutputForContract, getMerkleProofsForNotes, syncMerkleTree } from '../chunk-QBCLFGMV.js';
3
+ export { ADDRESS_VERSION, DirectAccountAdapter, NoteStore, RATE_PRECISION, STARK_ADDRESS_VERSION, STARK_STEALTH_ADDRESS_PREFIX, STEALTH_ADDRESS_PREFIX, SWAP_EVENTS_ABI, SWAP_ORDER_CANCELLED_EVENT, SWAP_ORDER_CLAIMED_EVENT, SWAP_ORDER_FILLED_EVENT, SWAP_ORDER_PLACED_EVENT, StorableAccountAdapter, computeCancelKeyHash, computeFillPercentage, computeGiveAmount, computeNoteEncryptionKey, computeRate, computeTakeAmount, computeTotalBuyAmount, createOneTimeKeys, decodeStarkStealthAddress, decodeStealthAddress, detectAddressType, encodeStarkStealthAddress, encodeStealthAddress, filterOrdersByASP, filterOrdersByTokenPair, formatRate, generateCancelSecret, generateStarkStealthAddress, generateStealthAddress, getCancelSecret, getOwnOrderIds, isFillerASPAccepted, isOrderActive, isValidStarkStealthAddress, isValidStealthAddress, removeCancelSecret, storeCancelSecret, verifyOwnership } from '../chunk-7F75NGNB.js';
4
4
  export { DEMO_ASP_ID, DEMO_ASP_NAME, buildASPTree, computeMultiOriginASPRoot, computeSingleOriginASPRoot, createDemoASPRoot, generateASPProof, generateMultiOriginASPProof, generateSingleOriginASPProof, verifyASPProof } from '../chunk-P37MRZ73.js';
5
+ export { STARK_AMOUNT_SCALE } from '../chunk-XBNYAAMU.js';
5
6
  import '../chunk-ZU6J7KMY.js';
7
+ import '../chunk-5V5HSN6Y.js';
6
8
  import '../chunk-W77GRBO4.js';
7
9
  import '../chunk-V23OSL25.js';
8
10
  export { ASP_TREE_DEPTH, STATE_TREE_DEPTH, formatProofForContract, generateProof, generateStealthProof, generateUPPProof, getStealthCircuitArtifacts, getUPPCircuitArtifacts, verifyProof } from '../chunk-S4B7GYLN.js';