@permissionless-technologies/upp-sdk 0.2.1 → 0.3.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-3YZSIYJC.cjs +154 -0
- package/dist/chunk-3YZSIYJC.cjs.map +1 -0
- package/dist/{chunk-64RTC5ML.js → chunk-4EDTZQ44.js} +2 -2
- package/dist/{chunk-64RTC5ML.js.map → chunk-4EDTZQ44.js.map} +1 -1
- package/dist/{chunk-43U5RGYE.cjs → chunk-4EMXHMJ5.cjs} +2 -2
- package/dist/{chunk-43U5RGYE.cjs.map → chunk-4EMXHMJ5.cjs.map} +1 -1
- package/dist/{chunk-46GGZ3TC.cjs → chunk-4MOXKZSE.cjs} +17 -17
- package/dist/{chunk-46GGZ3TC.cjs.map → chunk-4MOXKZSE.cjs.map} +1 -1
- package/dist/{chunk-C7QQOJ7T.cjs → chunk-52PPS4AT.cjs} +4 -22
- package/dist/chunk-52PPS4AT.cjs.map +1 -0
- package/dist/{chunk-CZ23JMAQ.js → chunk-56LZ2RV6.js} +17 -17
- package/dist/{chunk-CZ23JMAQ.js.map → chunk-56LZ2RV6.js.map} +1 -1
- package/dist/{chunk-NUIQHTSA.js → chunk-7F75NGNB.js} +76 -3
- package/dist/chunk-7F75NGNB.js.map +1 -0
- package/dist/{chunk-SGZZL5AC.js → chunk-GS4UCMW4.js} +4 -20
- package/dist/chunk-GS4UCMW4.js.map +1 -0
- package/dist/{chunk-GXZ3MTCQ.cjs → chunk-IYOR5TCO.cjs} +77 -2
- package/dist/chunk-IYOR5TCO.cjs.map +1 -0
- package/dist/{chunk-GQV47S3N.cjs → chunk-PTDVGWHU.cjs} +2 -2
- package/dist/{chunk-GQV47S3N.cjs.map → chunk-PTDVGWHU.cjs.map} +1 -1
- package/dist/{chunk-NCW4AE7L.js → chunk-UAVWYXDN.js} +2 -2
- package/dist/chunk-UAVWYXDN.js.map +1 -0
- package/dist/chunk-XBNYAAMU.js +140 -0
- package/dist/chunk-XBNYAAMU.js.map +1 -0
- package/dist/core/index.cjs +68 -62
- package/dist/core/index.d.cts +3 -2
- package/dist/core/index.d.ts +3 -2
- package/dist/core/index.js +6 -4
- package/dist/{index-BGvapsJy.d.cts → index-B45-okum.d.cts} +19 -3
- package/dist/{index-ChGaGPzP.d.ts → index-BIcvNMPt.d.ts} +19 -3
- package/dist/{index-BBzvvrhG.d.ts → index-DwAJBoU7.d.ts} +122 -96
- package/dist/{index-C-jSNw6j.d.cts → index-o-Ds3YAq.d.cts} +122 -96
- package/dist/index.cjs +229 -176
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +8 -7
- package/dist/index.js.map +1 -1
- package/dist/indexer/index.cjs +6 -6
- package/dist/indexer/index.d.cts +6 -5
- package/dist/indexer/index.d.ts +6 -5
- package/dist/indexer/index.js +1 -1
- package/dist/react/index.cjs +107 -102
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +2 -2
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +100 -95
- package/dist/react/index.js.map +1 -1
- package/dist/stark-BcTD1OaJ.d.cts +185 -0
- package/dist/stark-BcTD1OaJ.d.ts +185 -0
- package/dist/{transfer-4OF2JWXX.js → transfer-4GJJTWMH.js} +4 -4
- package/dist/{transfer-4OF2JWXX.js.map → transfer-4GJJTWMH.js.map} +1 -1
- package/dist/{transfer-DKZuJnRM.d.cts → transfer-BzyernBd.d.cts} +1 -3
- package/dist/{transfer-SA4NHNJ7.cjs → transfer-CLBDOA63.cjs} +10 -10
- package/dist/{transfer-SA4NHNJ7.cjs.map → transfer-CLBDOA63.cjs.map} +1 -1
- package/dist/{transfer-BlmbO-Rd.d.ts → transfer-sqS6mJko.d.ts} +1 -3
- package/dist/utils/index.cjs +54 -1
- package/dist/utils/index.d.cts +2 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +2 -1
- package/package.json +2 -2
- package/src/deployments/11155111.json +13 -13
- package/src/deployments/31337.json +1 -1
- package/dist/chunk-C7QQOJ7T.cjs.map +0 -1
- package/dist/chunk-GXZ3MTCQ.cjs.map +0 -1
- package/dist/chunk-NCW4AE7L.js.map +0 -1
- package/dist/chunk-NUIQHTSA.js.map +0 -1
- 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,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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"]}
|
package/dist/core/index.cjs
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var chunkNDM5EJEV_cjs = require('../chunk-NDM5EJEV.cjs');
|
|
3
|
+
var chunk52PPS4AT_cjs = require('../chunk-52PPS4AT.cjs');
|
|
4
|
+
var chunk4MOXKZSE_cjs = require('../chunk-4MOXKZSE.cjs');
|
|
5
|
+
var chunk3YZSIYJC_cjs = require('../chunk-3YZSIYJC.cjs');
|
|
7
6
|
require('../chunk-EUP7MBAH.cjs');
|
|
7
|
+
require('../chunk-BH24DZ5S.cjs');
|
|
8
|
+
var chunkIYOR5TCO_cjs = require('../chunk-IYOR5TCO.cjs');
|
|
9
|
+
var chunkNDM5EJEV_cjs = require('../chunk-NDM5EJEV.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,217 @@ 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
|
|
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
|
|
23
|
+
get: function () { return chunk52PPS4AT_cjs.createNote; }
|
|
30
24
|
});
|
|
31
25
|
Object.defineProperty(exports, "createUPPClient", {
|
|
32
26
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
27
|
+
get: function () { return chunk52PPS4AT_cjs.createUPPClient; }
|
|
34
28
|
});
|
|
35
29
|
Object.defineProperty(exports, "decryptNote", {
|
|
36
30
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
31
|
+
get: function () { return chunk52PPS4AT_cjs.decryptNote; }
|
|
38
32
|
});
|
|
39
33
|
Object.defineProperty(exports, "encryptNote", {
|
|
40
34
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
35
|
+
get: function () { return chunk52PPS4AT_cjs.encryptNote; }
|
|
42
36
|
});
|
|
43
37
|
Object.defineProperty(exports, "buildTransfer", {
|
|
44
38
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
39
|
+
get: function () { return chunk4MOXKZSE_cjs.buildTransfer; }
|
|
46
40
|
});
|
|
47
41
|
Object.defineProperty(exports, "buildUPPTransferCircuitInputs", {
|
|
48
42
|
enumerable: true,
|
|
49
|
-
get: function () { return
|
|
43
|
+
get: function () { return chunk4MOXKZSE_cjs.buildUPPTransferCircuitInputs; }
|
|
50
44
|
});
|
|
51
45
|
Object.defineProperty(exports, "computeNullifier", {
|
|
52
46
|
enumerable: true,
|
|
53
|
-
get: function () { return
|
|
47
|
+
get: function () { return chunk4MOXKZSE_cjs.computeNullifier; }
|
|
54
48
|
});
|
|
55
49
|
Object.defineProperty(exports, "formatOutputForContract", {
|
|
56
50
|
enumerable: true,
|
|
57
|
-
get: function () { return
|
|
51
|
+
get: function () { return chunk4MOXKZSE_cjs.formatOutputForContract; }
|
|
58
52
|
});
|
|
59
53
|
Object.defineProperty(exports, "getMerkleProofsForNotes", {
|
|
60
54
|
enumerable: true,
|
|
61
|
-
get: function () { return
|
|
55
|
+
get: function () { return chunk4MOXKZSE_cjs.getMerkleProofsForNotes; }
|
|
62
56
|
});
|
|
63
57
|
Object.defineProperty(exports, "syncMerkleTree", {
|
|
64
58
|
enumerable: true,
|
|
65
|
-
get: function () { return
|
|
59
|
+
get: function () { return chunk4MOXKZSE_cjs.syncMerkleTree; }
|
|
60
|
+
});
|
|
61
|
+
Object.defineProperty(exports, "STARK_AMOUNT_SCALE", {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
get: function () { return chunk3YZSIYJC_cjs.STARK_AMOUNT_SCALE; }
|
|
66
64
|
});
|
|
67
65
|
Object.defineProperty(exports, "ADDRESS_VERSION", {
|
|
68
66
|
enumerable: true,
|
|
69
|
-
get: function () { return
|
|
67
|
+
get: function () { return chunkIYOR5TCO_cjs.ADDRESS_VERSION; }
|
|
68
|
+
});
|
|
69
|
+
Object.defineProperty(exports, "DirectAccountAdapter", {
|
|
70
|
+
enumerable: true,
|
|
71
|
+
get: function () { return chunkIYOR5TCO_cjs.DirectAccountAdapter; }
|
|
70
72
|
});
|
|
71
73
|
Object.defineProperty(exports, "NoteStore", {
|
|
72
74
|
enumerable: true,
|
|
73
|
-
get: function () { return
|
|
75
|
+
get: function () { return chunkIYOR5TCO_cjs.NoteStore; }
|
|
74
76
|
});
|
|
75
77
|
Object.defineProperty(exports, "RATE_PRECISION", {
|
|
76
78
|
enumerable: true,
|
|
77
|
-
get: function () { return
|
|
79
|
+
get: function () { return chunkIYOR5TCO_cjs.RATE_PRECISION; }
|
|
78
80
|
});
|
|
79
81
|
Object.defineProperty(exports, "STARK_ADDRESS_VERSION", {
|
|
80
82
|
enumerable: true,
|
|
81
|
-
get: function () { return
|
|
83
|
+
get: function () { return chunkIYOR5TCO_cjs.STARK_ADDRESS_VERSION; }
|
|
82
84
|
});
|
|
83
85
|
Object.defineProperty(exports, "STARK_STEALTH_ADDRESS_PREFIX", {
|
|
84
86
|
enumerable: true,
|
|
85
|
-
get: function () { return
|
|
87
|
+
get: function () { return chunkIYOR5TCO_cjs.STARK_STEALTH_ADDRESS_PREFIX; }
|
|
86
88
|
});
|
|
87
89
|
Object.defineProperty(exports, "STEALTH_ADDRESS_PREFIX", {
|
|
88
90
|
enumerable: true,
|
|
89
|
-
get: function () { return
|
|
91
|
+
get: function () { return chunkIYOR5TCO_cjs.STEALTH_ADDRESS_PREFIX; }
|
|
90
92
|
});
|
|
91
93
|
Object.defineProperty(exports, "SWAP_EVENTS_ABI", {
|
|
92
94
|
enumerable: true,
|
|
93
|
-
get: function () { return
|
|
95
|
+
get: function () { return chunkIYOR5TCO_cjs.SWAP_EVENTS_ABI; }
|
|
94
96
|
});
|
|
95
97
|
Object.defineProperty(exports, "SWAP_ORDER_CANCELLED_EVENT", {
|
|
96
98
|
enumerable: true,
|
|
97
|
-
get: function () { return
|
|
99
|
+
get: function () { return chunkIYOR5TCO_cjs.SWAP_ORDER_CANCELLED_EVENT; }
|
|
98
100
|
});
|
|
99
101
|
Object.defineProperty(exports, "SWAP_ORDER_CLAIMED_EVENT", {
|
|
100
102
|
enumerable: true,
|
|
101
|
-
get: function () { return
|
|
103
|
+
get: function () { return chunkIYOR5TCO_cjs.SWAP_ORDER_CLAIMED_EVENT; }
|
|
102
104
|
});
|
|
103
105
|
Object.defineProperty(exports, "SWAP_ORDER_FILLED_EVENT", {
|
|
104
106
|
enumerable: true,
|
|
105
|
-
get: function () { return
|
|
107
|
+
get: function () { return chunkIYOR5TCO_cjs.SWAP_ORDER_FILLED_EVENT; }
|
|
106
108
|
});
|
|
107
109
|
Object.defineProperty(exports, "SWAP_ORDER_PLACED_EVENT", {
|
|
108
110
|
enumerable: true,
|
|
109
|
-
get: function () { return
|
|
111
|
+
get: function () { return chunkIYOR5TCO_cjs.SWAP_ORDER_PLACED_EVENT; }
|
|
112
|
+
});
|
|
113
|
+
Object.defineProperty(exports, "StorableAccountAdapter", {
|
|
114
|
+
enumerable: true,
|
|
115
|
+
get: function () { return chunkIYOR5TCO_cjs.StorableAccountAdapter; }
|
|
110
116
|
});
|
|
111
117
|
Object.defineProperty(exports, "computeCancelKeyHash", {
|
|
112
118
|
enumerable: true,
|
|
113
|
-
get: function () { return
|
|
119
|
+
get: function () { return chunkIYOR5TCO_cjs.computeCancelKeyHash; }
|
|
114
120
|
});
|
|
115
121
|
Object.defineProperty(exports, "computeFillPercentage", {
|
|
116
122
|
enumerable: true,
|
|
117
|
-
get: function () { return
|
|
123
|
+
get: function () { return chunkIYOR5TCO_cjs.computeFillPercentage; }
|
|
118
124
|
});
|
|
119
125
|
Object.defineProperty(exports, "computeGiveAmount", {
|
|
120
126
|
enumerable: true,
|
|
121
|
-
get: function () { return
|
|
127
|
+
get: function () { return chunkIYOR5TCO_cjs.computeGiveAmount; }
|
|
122
128
|
});
|
|
123
129
|
Object.defineProperty(exports, "computeNoteEncryptionKey", {
|
|
124
130
|
enumerable: true,
|
|
125
|
-
get: function () { return
|
|
131
|
+
get: function () { return chunkIYOR5TCO_cjs.computeNoteEncryptionKey; }
|
|
126
132
|
});
|
|
127
133
|
Object.defineProperty(exports, "computeRate", {
|
|
128
134
|
enumerable: true,
|
|
129
|
-
get: function () { return
|
|
135
|
+
get: function () { return chunkIYOR5TCO_cjs.computeRate; }
|
|
130
136
|
});
|
|
131
137
|
Object.defineProperty(exports, "computeTakeAmount", {
|
|
132
138
|
enumerable: true,
|
|
133
|
-
get: function () { return
|
|
139
|
+
get: function () { return chunkIYOR5TCO_cjs.computeTakeAmount; }
|
|
134
140
|
});
|
|
135
141
|
Object.defineProperty(exports, "computeTotalBuyAmount", {
|
|
136
142
|
enumerable: true,
|
|
137
|
-
get: function () { return
|
|
143
|
+
get: function () { return chunkIYOR5TCO_cjs.computeTotalBuyAmount; }
|
|
138
144
|
});
|
|
139
145
|
Object.defineProperty(exports, "createOneTimeKeys", {
|
|
140
146
|
enumerable: true,
|
|
141
|
-
get: function () { return
|
|
147
|
+
get: function () { return chunkIYOR5TCO_cjs.createOneTimeKeys; }
|
|
142
148
|
});
|
|
143
149
|
Object.defineProperty(exports, "decodeStarkStealthAddress", {
|
|
144
150
|
enumerable: true,
|
|
145
|
-
get: function () { return
|
|
151
|
+
get: function () { return chunkIYOR5TCO_cjs.decodeStarkStealthAddress; }
|
|
146
152
|
});
|
|
147
153
|
Object.defineProperty(exports, "decodeStealthAddress", {
|
|
148
154
|
enumerable: true,
|
|
149
|
-
get: function () { return
|
|
155
|
+
get: function () { return chunkIYOR5TCO_cjs.decodeStealthAddress; }
|
|
150
156
|
});
|
|
151
157
|
Object.defineProperty(exports, "detectAddressType", {
|
|
152
158
|
enumerable: true,
|
|
153
|
-
get: function () { return
|
|
159
|
+
get: function () { return chunkIYOR5TCO_cjs.detectAddressType; }
|
|
154
160
|
});
|
|
155
161
|
Object.defineProperty(exports, "encodeStarkStealthAddress", {
|
|
156
162
|
enumerable: true,
|
|
157
|
-
get: function () { return
|
|
163
|
+
get: function () { return chunkIYOR5TCO_cjs.encodeStarkStealthAddress; }
|
|
158
164
|
});
|
|
159
165
|
Object.defineProperty(exports, "encodeStealthAddress", {
|
|
160
166
|
enumerable: true,
|
|
161
|
-
get: function () { return
|
|
167
|
+
get: function () { return chunkIYOR5TCO_cjs.encodeStealthAddress; }
|
|
162
168
|
});
|
|
163
169
|
Object.defineProperty(exports, "filterOrdersByASP", {
|
|
164
170
|
enumerable: true,
|
|
165
|
-
get: function () { return
|
|
171
|
+
get: function () { return chunkIYOR5TCO_cjs.filterOrdersByASP; }
|
|
166
172
|
});
|
|
167
173
|
Object.defineProperty(exports, "filterOrdersByTokenPair", {
|
|
168
174
|
enumerable: true,
|
|
169
|
-
get: function () { return
|
|
175
|
+
get: function () { return chunkIYOR5TCO_cjs.filterOrdersByTokenPair; }
|
|
170
176
|
});
|
|
171
177
|
Object.defineProperty(exports, "formatRate", {
|
|
172
178
|
enumerable: true,
|
|
173
|
-
get: function () { return
|
|
179
|
+
get: function () { return chunkIYOR5TCO_cjs.formatRate; }
|
|
174
180
|
});
|
|
175
181
|
Object.defineProperty(exports, "generateCancelSecret", {
|
|
176
182
|
enumerable: true,
|
|
177
|
-
get: function () { return
|
|
183
|
+
get: function () { return chunkIYOR5TCO_cjs.generateCancelSecret; }
|
|
178
184
|
});
|
|
179
185
|
Object.defineProperty(exports, "generateStarkStealthAddress", {
|
|
180
186
|
enumerable: true,
|
|
181
|
-
get: function () { return
|
|
187
|
+
get: function () { return chunkIYOR5TCO_cjs.generateStarkStealthAddress; }
|
|
182
188
|
});
|
|
183
189
|
Object.defineProperty(exports, "generateStealthAddress", {
|
|
184
190
|
enumerable: true,
|
|
185
|
-
get: function () { return
|
|
191
|
+
get: function () { return chunkIYOR5TCO_cjs.generateStealthAddress; }
|
|
186
192
|
});
|
|
187
193
|
Object.defineProperty(exports, "getCancelSecret", {
|
|
188
194
|
enumerable: true,
|
|
189
|
-
get: function () { return
|
|
195
|
+
get: function () { return chunkIYOR5TCO_cjs.getCancelSecret; }
|
|
190
196
|
});
|
|
191
197
|
Object.defineProperty(exports, "getOwnOrderIds", {
|
|
192
198
|
enumerable: true,
|
|
193
|
-
get: function () { return
|
|
199
|
+
get: function () { return chunkIYOR5TCO_cjs.getOwnOrderIds; }
|
|
194
200
|
});
|
|
195
201
|
Object.defineProperty(exports, "isFillerASPAccepted", {
|
|
196
202
|
enumerable: true,
|
|
197
|
-
get: function () { return
|
|
203
|
+
get: function () { return chunkIYOR5TCO_cjs.isFillerASPAccepted; }
|
|
198
204
|
});
|
|
199
205
|
Object.defineProperty(exports, "isOrderActive", {
|
|
200
206
|
enumerable: true,
|
|
201
|
-
get: function () { return
|
|
207
|
+
get: function () { return chunkIYOR5TCO_cjs.isOrderActive; }
|
|
202
208
|
});
|
|
203
209
|
Object.defineProperty(exports, "isValidStarkStealthAddress", {
|
|
204
210
|
enumerable: true,
|
|
205
|
-
get: function () { return
|
|
211
|
+
get: function () { return chunkIYOR5TCO_cjs.isValidStarkStealthAddress; }
|
|
206
212
|
});
|
|
207
213
|
Object.defineProperty(exports, "isValidStealthAddress", {
|
|
208
214
|
enumerable: true,
|
|
209
|
-
get: function () { return
|
|
215
|
+
get: function () { return chunkIYOR5TCO_cjs.isValidStealthAddress; }
|
|
210
216
|
});
|
|
211
217
|
Object.defineProperty(exports, "removeCancelSecret", {
|
|
212
218
|
enumerable: true,
|
|
213
|
-
get: function () { return
|
|
219
|
+
get: function () { return chunkIYOR5TCO_cjs.removeCancelSecret; }
|
|
214
220
|
});
|
|
215
221
|
Object.defineProperty(exports, "storeCancelSecret", {
|
|
216
222
|
enumerable: true,
|
|
217
|
-
get: function () { return
|
|
223
|
+
get: function () { return chunkIYOR5TCO_cjs.storeCancelSecret; }
|
|
218
224
|
});
|
|
219
225
|
Object.defineProperty(exports, "verifyOwnership", {
|
|
220
226
|
enumerable: true,
|
|
221
|
-
get: function () { return
|
|
227
|
+
get: function () { return chunkIYOR5TCO_cjs.verifyOwnership; }
|
|
222
228
|
});
|
|
223
229
|
Object.defineProperty(exports, "DEMO_ASP_ID", {
|
|
224
230
|
enumerable: true,
|
package/dist/core/index.d.cts
CHANGED
|
@@ -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,
|
|
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
|
|
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';
|
package/dist/core/index.d.ts
CHANGED
|
@@ -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,
|
|
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
|
|
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';
|
package/dist/core/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { buildTransfer, buildUPPTransferCircuitInputs, computeNullifier, formatOutputForContract, getMerkleProofsForNotes, syncMerkleTree } from '../chunk-
|
|
3
|
-
export {
|
|
4
|
-
export { DEMO_ASP_ID, DEMO_ASP_NAME, buildASPTree, computeMultiOriginASPRoot, computeSingleOriginASPRoot, createDemoASPRoot, generateASPProof, generateMultiOriginASPProof, generateSingleOriginASPProof, verifyASPProof } from '../chunk-P37MRZ73.js';
|
|
1
|
+
export { NOTE_VERSION, createNote, createUPPClient, decryptNote, encryptNote } from '../chunk-GS4UCMW4.js';
|
|
2
|
+
export { buildTransfer, buildUPPTransferCircuitInputs, computeNullifier, formatOutputForContract, getMerkleProofsForNotes, syncMerkleTree } from '../chunk-56LZ2RV6.js';
|
|
3
|
+
export { STARK_AMOUNT_SCALE } from '../chunk-XBNYAAMU.js';
|
|
5
4
|
import '../chunk-ZU6J7KMY.js';
|
|
5
|
+
import '../chunk-5V5HSN6Y.js';
|
|
6
|
+
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';
|
|
7
|
+
export { DEMO_ASP_ID, DEMO_ASP_NAME, buildASPTree, computeMultiOriginASPRoot, computeSingleOriginASPRoot, createDemoASPRoot, generateASPProof, generateMultiOriginASPProof, generateSingleOriginASPProof, verifyASPProof } from '../chunk-P37MRZ73.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';
|