@umbra-privacy/sdk 1.0.0 → 2.0.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.
- package/README.md +104 -25
- package/dist/{addresses-Brzgurv_.d.ts → addresses-B7HybtbJ.d.ts} +2 -1
- package/dist/{addresses-D_0YAS6B.d.cts → addresses-CTVY1oi7.d.cts} +2 -1
- package/dist/arcium-BXXlryfe.d.cts +20 -0
- package/dist/arcium-BXXlryfe.d.ts +20 -0
- package/dist/chunk-4RHXVBNI.js +203 -0
- package/dist/chunk-4RHXVBNI.js.map +1 -0
- package/dist/chunk-4TZVXB5G.js +324 -0
- package/dist/chunk-4TZVXB5G.js.map +1 -0
- package/dist/chunk-5GUSMQ74.cjs +549 -0
- package/dist/chunk-5GUSMQ74.cjs.map +1 -0
- package/dist/chunk-5KPQXPQM.js +36 -0
- package/dist/chunk-5KPQXPQM.js.map +1 -0
- package/dist/chunk-AXD7LXYY.cjs +405 -0
- package/dist/chunk-AXD7LXYY.cjs.map +1 -0
- package/dist/{chunk-HOEXDXRC.cjs → chunk-BL6WXLPV.cjs} +32 -360
- package/dist/chunk-BL6WXLPV.cjs.map +1 -0
- package/dist/chunk-CFFLOE7D.cjs +598 -0
- package/dist/chunk-CFFLOE7D.cjs.map +1 -0
- package/dist/{chunk-BM7N6N7E.js → chunk-CFTW5WNG.js} +3 -325
- package/dist/chunk-CFTW5WNG.js.map +1 -0
- package/dist/chunk-DD2WCK4C.js +327 -0
- package/dist/chunk-DD2WCK4C.js.map +1 -0
- package/dist/chunk-DMPMQ74B.cjs +246 -0
- package/dist/chunk-DMPMQ74B.cjs.map +1 -0
- package/dist/{chunk-2Q75CQQJ.js → chunk-EEKF4553.js} +2 -2
- package/dist/chunk-EEKF4553.js.map +1 -0
- package/dist/chunk-ENVYYEM4.cjs +113 -0
- package/dist/chunk-ENVYYEM4.cjs.map +1 -0
- package/dist/chunk-FQX6ZYGJ.js +500 -0
- package/dist/chunk-FQX6ZYGJ.js.map +1 -0
- package/dist/chunk-FSK2ICMB.cjs +39 -0
- package/dist/chunk-FSK2ICMB.cjs.map +1 -0
- package/dist/chunk-FZYWLQAF.cjs +355 -0
- package/dist/chunk-FZYWLQAF.cjs.map +1 -0
- package/dist/chunk-GP26R377.js +436 -0
- package/dist/chunk-GP26R377.js.map +1 -0
- package/dist/chunk-HA5FLM63.js +393 -0
- package/dist/chunk-HA5FLM63.js.map +1 -0
- package/dist/chunk-INJ73LXQ.js +1107 -0
- package/dist/chunk-INJ73LXQ.js.map +1 -0
- package/dist/chunk-JPDF7BIT.cjs +10892 -0
- package/dist/chunk-JPDF7BIT.cjs.map +1 -0
- package/dist/{chunk-MDFSBU5W.cjs → chunk-LTCKPTZC.cjs} +2 -351
- package/dist/chunk-LTCKPTZC.cjs.map +1 -0
- package/dist/chunk-MKNCBUFA.js +564 -0
- package/dist/chunk-MKNCBUFA.js.map +1 -0
- package/dist/chunk-NKVMSABR.cjs +207 -0
- package/dist/chunk-NKVMSABR.cjs.map +1 -0
- package/dist/chunk-OFDWNWCL.js +70 -0
- package/dist/chunk-OFDWNWCL.js.map +1 -0
- package/dist/chunk-QJAUUYZU.cjs +331 -0
- package/dist/chunk-QJAUUYZU.cjs.map +1 -0
- package/dist/chunk-RVUYPKKD.js +10750 -0
- package/dist/chunk-RVUYPKKD.js.map +1 -0
- package/dist/chunk-TLR7A64G.js +103 -0
- package/dist/chunk-TLR7A64G.js.map +1 -0
- package/dist/{chunk-MVKTV3FT.cjs → chunk-TQQZGNOI.cjs} +2 -2
- package/dist/chunk-TQQZGNOI.cjs.map +1 -0
- package/dist/chunk-UOFYS6M3.js +219 -0
- package/dist/chunk-UOFYS6M3.js.map +1 -0
- package/dist/chunk-UXMQI6B7.js +2406 -0
- package/dist/chunk-UXMQI6B7.js.map +1 -0
- package/dist/chunk-WN75ORDT.js +571 -0
- package/dist/chunk-WN75ORDT.js.map +1 -0
- package/dist/chunk-Y55PYKXH.cjs +595 -0
- package/dist/chunk-Y55PYKXH.cjs.map +1 -0
- package/dist/chunk-YEZBTYCP.cjs +77 -0
- package/dist/chunk-YEZBTYCP.cjs.map +1 -0
- package/dist/chunk-ZQOIYCGA.cjs +1126 -0
- package/dist/chunk-ZQOIYCGA.cjs.map +1 -0
- package/dist/chunk-ZY3TSHMJ.cjs +2665 -0
- package/dist/chunk-ZY3TSHMJ.cjs.map +1 -0
- package/dist/client-DkVBHMWb.d.cts +2613 -0
- package/dist/client-V4AF6Bz9.d.ts +2613 -0
- package/dist/common/pda/index.cjs +145 -0
- package/dist/common/pda/index.cjs.map +1 -0
- package/dist/common/pda/index.d.cts +1250 -0
- package/dist/common/pda/index.d.ts +1250 -0
- package/dist/common/pda/index.js +8 -0
- package/dist/common/pda/index.js.map +1 -0
- package/dist/constants/index.cjs +38 -164
- package/dist/constants/index.cjs.map +1 -1
- package/dist/constants/index.d.cts +8 -425
- package/dist/constants/index.d.ts +8 -425
- package/dist/constants/index.js +15 -124
- package/dist/constants/index.js.map +1 -1
- package/dist/crypto/index.cjs +583 -0
- package/dist/crypto/index.cjs.map +1 -0
- package/dist/crypto/index.d.cts +6731 -0
- package/dist/crypto/index.d.ts +6731 -0
- package/dist/crypto/index.js +14 -0
- package/dist/crypto/index.js.map +1 -0
- package/dist/{cryptography-BTGC72u-.d.ts → cryptography-BFSJcvi6.d.ts} +3 -2465
- package/dist/{cryptography-BTGC72u-.d.cts → cryptography-D6tPDh-Y.d.cts} +3 -2465
- package/dist/errors/index.cjs +64 -54
- package/dist/errors/index.d.cts +7 -797
- package/dist/errors/index.d.ts +7 -797
- package/dist/errors/index.js +3 -1
- package/dist/errors-B9EoPeWV.d.cts +593 -0
- package/dist/errors-B9EoPeWV.d.ts +593 -0
- package/dist/errors-DAIrstEL.d.cts +300 -0
- package/dist/errors-DPNMfyh0.d.ts +300 -0
- package/dist/index-BG0yjL7C.d.cts +6006 -0
- package/dist/index-ByynoyBO.d.ts +6006 -0
- package/dist/index.cjs +5126 -16118
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1031 -7685
- package/dist/index.d.ts +1031 -7685
- package/dist/index.js +3219 -14905
- package/dist/index.js.map +1 -1
- package/dist/interfaces/index.d.cts +14 -6
- package/dist/interfaces/index.d.ts +14 -6
- package/dist/interfaces-43cReBcS.d.cts +3346 -0
- package/dist/interfaces-B8xKNl_6.d.ts +997 -0
- package/dist/interfaces-D2NO6kDD.d.cts +997 -0
- package/dist/interfaces-z_xYJlgV.d.ts +3346 -0
- package/dist/math/index.cjs +115 -0
- package/dist/math/index.cjs.map +1 -0
- package/dist/math/index.d.cts +1327 -0
- package/dist/math/index.d.ts +1327 -0
- package/dist/math/index.js +10 -0
- package/dist/math/index.js.map +1 -0
- package/dist/networks-RMd3abPE.d.ts +44 -0
- package/dist/networks-yAoO8peQ.d.cts +44 -0
- package/dist/relayer-NRRMSMNB.js +4 -0
- package/dist/relayer-NRRMSMNB.js.map +1 -0
- package/dist/relayer-RJHEIXJG.cjs +21 -0
- package/dist/relayer-RJHEIXJG.cjs.map +1 -0
- package/dist/solana/index.cjs +56 -0
- package/dist/solana/index.cjs.map +1 -0
- package/dist/solana/index.d.cts +105 -0
- package/dist/solana/index.d.ts +105 -0
- package/dist/solana/index.js +7 -0
- package/dist/solana/index.js.map +1 -0
- package/dist/{index-CLj_zWSD.d.ts → temporal-BbRaEPoO.d.ts} +1 -1
- package/dist/{index-CX6_pIRS.d.cts → temporal-oUj7iCaq.d.cts} +1 -1
- package/dist/transaction-forwarder-5mAMTjw6.d.ts +1155 -0
- package/dist/transaction-forwarder-C6gMUG7a.d.cts +1155 -0
- package/dist/types/index.cjs +232 -231
- package/dist/types/index.d.cts +15 -1485
- package/dist/types/index.d.ts +15 -1485
- package/dist/types/index.js +2 -1
- package/dist/types-BohhvPth.d.cts +87 -0
- package/dist/types-CW0oTT0j.d.ts +87 -0
- package/dist/types-C_V_CaKK.d.cts +2468 -0
- package/dist/types-C_V_CaKK.d.ts +2468 -0
- package/dist/types-Ca7frykr.d.ts +793 -0
- package/dist/types-CuKeoI19.d.cts +1296 -0
- package/dist/types-CxfTIpN9.d.ts +1052 -0
- package/dist/{types-n-sHFcgr.d.ts → types-D1jDUjfN.d.ts} +2 -2
- package/dist/types-DKEDUlH9.d.ts +1296 -0
- package/dist/types-EKuIfxTz.d.cts +1052 -0
- package/dist/{types-BBuELtY8.d.cts → types-IMGYmlv-.d.cts} +2 -2
- package/dist/types-PwNLi_2k.d.cts +793 -0
- package/dist/utils/index.cjs +823 -525
- package/dist/utils/index.d.cts +1711 -4021
- package/dist/utils/index.d.ts +1711 -4021
- package/dist/utils/index.js +9 -3
- package/dist/{versions-D9PqsEvj.d.cts → versions-BRlR36EA.d.cts} +1 -0
- package/dist/{versions-D9PqsEvj.d.ts → versions-BRlR36EA.d.ts} +1 -0
- package/package.json +79 -18
- package/dist/chunk-2Q75CQQJ.js.map +0 -1
- package/dist/chunk-BM7N6N7E.js.map +0 -1
- package/dist/chunk-GXKSUB2U.cjs +0 -4416
- package/dist/chunk-GXKSUB2U.cjs.map +0 -1
- package/dist/chunk-HOEXDXRC.cjs.map +0 -1
- package/dist/chunk-MDFSBU5W.cjs.map +0 -1
- package/dist/chunk-MQY7HDIA.js +0 -600
- package/dist/chunk-MQY7HDIA.js.map +0 -1
- package/dist/chunk-MVKTV3FT.cjs.map +0 -1
- package/dist/chunk-PG2J6V6Y.js +0 -4094
- package/dist/chunk-PG2J6V6Y.js.map +0 -1
- package/dist/chunk-VEGLTTYQ.cjs +0 -621
- package/dist/chunk-VEGLTTYQ.cjs.map +0 -1
- package/dist/chunk-WVHQ46DD.js +0 -758
- package/dist/chunk-WVHQ46DD.js.map +0 -1
- package/dist/index-B9pDY73x.d.ts +0 -12933
- package/dist/index-D33yo0qB.d.cts +0 -12933
- package/dist/networks-C-orpSFW.d.ts +0 -65
- package/dist/networks-FxYERGD1.d.cts +0 -65
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { TOKEN_POOL_SEED, computeCompDefOffset, computeStructSeed, findActiveStealthPoolPda, findArciumClusterPda, findArciumCompDefPda, findArciumComputationPda, findArciumExecutingPoolPda, findArciumInfrastructurePdas, findArciumMempoolPda, findArciumMxePda, findClaimInputBufferPda, findConfidentialNullifierBufferPda, findEncryptedTokenAccountPda, findEncryptedUserAccountPda, findFeeSchedulePda, findNetworkComplianceGrantPda, findNullifierSetPdas, findProtocolConfigPda, findProtocolFeeVaultPda, findPublicClaimComputationDataPda, findPublicClaimInputBufferPda, findPublicNullifierBufferPda, findPublicUtxoInputBufferPda, findRelayerFeeSchedulePda, findRelayerFeeVaultPda, findRelayerPda, findSharedComplianceGrantPda, findStealthPoolPda, findTokenPoolPda, findUserComplianceGrantPda, findUtxoInputBufferPda, findVerifyingKeyPda } from '../../chunk-MKNCBUFA.js';
|
|
2
|
+
import '../../chunk-EEKF4553.js';
|
|
3
|
+
import '../../chunk-FQX6ZYGJ.js';
|
|
4
|
+
import '../../chunk-DD2WCK4C.js';
|
|
5
|
+
import '../../chunk-CFTW5WNG.js';
|
|
6
|
+
import '../../chunk-7QVYU63E.js';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
package/dist/constants/index.cjs
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
|
|
3
|
+
var chunkZQOIYCGA_cjs = require('../chunk-ZQOIYCGA.cjs');
|
|
4
|
+
require('../chunk-BL6WXLPV.cjs');
|
|
5
|
+
require('../chunk-FSK2ICMB.cjs');
|
|
6
|
+
var chunkTQQZGNOI_cjs = require('../chunk-TQQZGNOI.cjs');
|
|
7
|
+
require('../chunk-QJAUUYZU.cjs');
|
|
6
8
|
var chunkPK6SKIKE_cjs = require('../chunk-PK6SKIKE.cjs');
|
|
7
9
|
|
|
8
10
|
// src/constants/domain-separators.ts
|
|
@@ -15,11 +17,17 @@ function createClaimDomainSeparators(claimType) {
|
|
|
15
17
|
chunkPK6SKIKE_cjs.__name(createClaimDomainSeparators, "createClaimDomainSeparators");
|
|
16
18
|
var CLAIM_DOMAINS = {
|
|
17
19
|
/** Domain separators for self-claimable UTXO claims into public balance */
|
|
18
|
-
SELF_CLAIMABLE_INTO_PUBLIC_BALANCE: createClaimDomainSeparators(
|
|
20
|
+
SELF_CLAIMABLE_INTO_PUBLIC_BALANCE: createClaimDomainSeparators(
|
|
21
|
+
"SelfClaimableUtxoIntoPublicBalance"
|
|
22
|
+
),
|
|
19
23
|
/** Domain separators for self-claimable UTXO claims into encrypted balance */
|
|
20
|
-
SELF_CLAIMABLE_INTO_ENCRYPTED_BALANCE: createClaimDomainSeparators(
|
|
24
|
+
SELF_CLAIMABLE_INTO_ENCRYPTED_BALANCE: createClaimDomainSeparators(
|
|
25
|
+
"SelfClaimableUtxoIntoEncryptedBalance"
|
|
26
|
+
),
|
|
21
27
|
/** Domain separators for receiver-claimable UTXO claims into encrypted balance */
|
|
22
|
-
RECEIVER_CLAIMABLE_INTO_ENCRYPTED_BALANCE: createClaimDomainSeparators(
|
|
28
|
+
RECEIVER_CLAIMABLE_INTO_ENCRYPTED_BALANCE: createClaimDomainSeparators(
|
|
29
|
+
"ReceiverClaimableUtxoIntoEncryptedBalance"
|
|
30
|
+
)
|
|
23
31
|
};
|
|
24
32
|
var LINKER_KEYSTREAM_DOMAINS = {
|
|
25
33
|
/** Self-claimable UTXO claim into public balance */
|
|
@@ -73,244 +81,110 @@ var AGGREGATED_HASH_INPUT_COUNT = {
|
|
|
73
81
|
ETA: 70
|
|
74
82
|
};
|
|
75
83
|
|
|
76
|
-
// src/umbra/constants.ts
|
|
77
|
-
var UMBRA_MESSAGE_TO_SIGN = `
|
|
78
|
-
Signing this message is a sensitive cryptographic operation that generates the master key used to derive your private spending keys and decrypt your account balances. This signature acts as the root of your privacy and financial security within the Umbra ecosystem.
|
|
79
|
-
|
|
80
|
-
You must ensure that you are interacting with the official Umbra Privacy application or a verified integration. Signing this message on an unverified or malicious site could allow an attacker to gain full control over your funds and expose your entire transaction history.
|
|
81
|
-
`;
|
|
82
|
-
var PROTOCOL_FEE = {
|
|
83
|
-
/**
|
|
84
|
-
* Fixed base fee charged per operation, denominated in the SPL token's smallest unit.
|
|
85
|
-
*
|
|
86
|
-
* @remarks
|
|
87
|
-
* Added to the proportional BPS fee before clamping. A value of `10n` means 10
|
|
88
|
-
* token micro-units (e.g. 0.00001 USDC for a 6-decimal token).
|
|
89
|
-
*
|
|
90
|
-
* @readonly
|
|
91
|
-
*/
|
|
92
|
-
BASE_FEE: 10n,
|
|
93
|
-
/**
|
|
94
|
-
* Proportional fee rate expressed in basis points (1 BPS = 0.01%).
|
|
95
|
-
*
|
|
96
|
-
* @remarks
|
|
97
|
-
* `35n` corresponds to 0.35%. Applied to the claimed or transferred amount before
|
|
98
|
-
* adding `BASE_FEE` and clamping to `[LOWER_BOUND, UPPER_BOUND]`.
|
|
99
|
-
*
|
|
100
|
-
* @readonly
|
|
101
|
-
*/
|
|
102
|
-
BPS: 35n,
|
|
103
|
-
/**
|
|
104
|
-
* Minimum fee amount. The total fee is never less than this value.
|
|
105
|
-
*
|
|
106
|
-
* @remarks
|
|
107
|
-
* Currently `0n`, meaning there is no enforced minimum beyond the `BASE_FEE`.
|
|
108
|
-
*
|
|
109
|
-
* @readonly
|
|
110
|
-
*/
|
|
111
|
-
LOWER_BOUND: 0n,
|
|
112
|
-
/**
|
|
113
|
-
* Maximum fee amount (cap). The total fee is never greater than this value.
|
|
114
|
-
*
|
|
115
|
-
* @remarks
|
|
116
|
-
* Set to `1_000_000n` (one million token micro-units), which equals 1 USDC for a
|
|
117
|
-
* 6-decimal token. This cap prevents runaway fees on very large claims.
|
|
118
|
-
*
|
|
119
|
-
* @readonly
|
|
120
|
-
*/
|
|
121
|
-
UPPER_BOUND: BigInt("1000000")
|
|
122
|
-
};
|
|
123
|
-
var RELAYER_FEE = {
|
|
124
|
-
/**
|
|
125
|
-
* Fixed base fee for relayer operations, denominated in the SPL token's smallest unit.
|
|
126
|
-
*
|
|
127
|
-
* @remarks
|
|
128
|
-
* `0n` — relayers do not charge a fixed base fee; they earn purely through BPS.
|
|
129
|
-
*
|
|
130
|
-
* @readonly
|
|
131
|
-
*/
|
|
132
|
-
BASE_FEE: 0n,
|
|
133
|
-
/**
|
|
134
|
-
* Proportional fee rate for the relayer, expressed in basis points (1 BPS = 0.01%).
|
|
135
|
-
*
|
|
136
|
-
* @remarks
|
|
137
|
-
* `35n` corresponds to 0.35%. The relayer earns this percentage of the claimed amount
|
|
138
|
-
* as compensation for submitting and funding the MPC callback transaction.
|
|
139
|
-
*
|
|
140
|
-
* @readonly
|
|
141
|
-
*/
|
|
142
|
-
BPS: 35n,
|
|
143
|
-
/**
|
|
144
|
-
* Minimum relayer fee. Currently `0n`.
|
|
145
|
-
*
|
|
146
|
-
* @readonly
|
|
147
|
-
*/
|
|
148
|
-
LOWER_BOUND: 0n,
|
|
149
|
-
/**
|
|
150
|
-
* Maximum relayer fee (cap). `1_000_000n` token micro-units.
|
|
151
|
-
*
|
|
152
|
-
* @remarks
|
|
153
|
-
* Mirrors the protocol fee cap to ensure the combined fee never exceeds a predictable
|
|
154
|
-
* maximum, protecting users from paying unexpectedly large fees on large claims.
|
|
155
|
-
*
|
|
156
|
-
* @readonly
|
|
157
|
-
*/
|
|
158
|
-
UPPER_BOUND: BigInt("1000000")
|
|
159
|
-
};
|
|
160
|
-
var FEE_OFFSETS = {
|
|
161
|
-
/**
|
|
162
|
-
* Offset used in `UnifiedFeesPool` PDA derivation for the unified protocol fees pool.
|
|
163
|
-
*
|
|
164
|
-
* @remarks
|
|
165
|
-
* Passed as the final seed to `getProtocolOnlyUnifiedFeesPoolPda` and
|
|
166
|
-
* `getRelayerUnifiedFeesPoolPda`. Currently `0n`.
|
|
167
|
-
*
|
|
168
|
-
* @readonly
|
|
169
|
-
*/
|
|
170
|
-
PROTOCOL_FEES_POOL: 0n,
|
|
171
|
-
/**
|
|
172
|
-
* Offset used in `ProtocolFeesConfiguration` PDA derivation.
|
|
173
|
-
*
|
|
174
|
-
* @remarks
|
|
175
|
-
* Passed as the final seed to `getProtocolFeesConfigurationPda`. Currently `0n`.
|
|
176
|
-
*
|
|
177
|
-
* @readonly
|
|
178
|
-
*/
|
|
179
|
-
PROTOCOL_FEES_CONFIG: 0n,
|
|
180
|
-
/**
|
|
181
|
-
* Offset used in relayer fee configuration PDA derivation.
|
|
182
|
-
*
|
|
183
|
-
* @remarks
|
|
184
|
-
* Passed as the offset seed when looking up the relayer's fee configuration account.
|
|
185
|
-
* Currently `0n`.
|
|
186
|
-
*
|
|
187
|
-
* @readonly
|
|
188
|
-
*/
|
|
189
|
-
RELAYER_FEES_CONFIG: 0n
|
|
190
|
-
};
|
|
191
|
-
var BPS_DIVISOR = 10000n;
|
|
192
|
-
|
|
193
84
|
Object.defineProperty(exports, "ASSOCIATED_TOKEN_PROGRAM_ID", {
|
|
194
85
|
enumerable: true,
|
|
195
|
-
get: function () { return
|
|
196
|
-
});
|
|
197
|
-
Object.defineProperty(exports, "COMPUTE_BUDGET_PROGRAM_ADDRESS", {
|
|
198
|
-
enumerable: true,
|
|
199
|
-
get: function () { return chunkVEGLTTYQ_cjs.COMPUTE_BUDGET_PROGRAM_ADDRESS; }
|
|
86
|
+
get: function () { return chunkZQOIYCGA_cjs.ASSOCIATED_TOKEN_PROGRAM_ID; }
|
|
200
87
|
});
|
|
201
88
|
Object.defineProperty(exports, "DEFAULT_ALGORITHM_VERSION", {
|
|
202
89
|
enumerable: true,
|
|
203
|
-
get: function () { return
|
|
90
|
+
get: function () { return chunkZQOIYCGA_cjs.DEFAULT_ALGORITHM_VERSION; }
|
|
204
91
|
});
|
|
205
92
|
Object.defineProperty(exports, "DEFAULT_NETWORK", {
|
|
206
93
|
enumerable: true,
|
|
207
|
-
get: function () { return
|
|
94
|
+
get: function () { return chunkZQOIYCGA_cjs.DEFAULT_NETWORK; }
|
|
208
95
|
});
|
|
209
96
|
Object.defineProperty(exports, "DEFAULT_PROTOCOL_VERSION", {
|
|
210
97
|
enumerable: true,
|
|
211
|
-
get: function () { return
|
|
98
|
+
get: function () { return chunkZQOIYCGA_cjs.DEFAULT_PROTOCOL_VERSION; }
|
|
212
99
|
});
|
|
213
100
|
Object.defineProperty(exports, "DEFAULT_SCHEME_VERSION", {
|
|
214
101
|
enumerable: true,
|
|
215
|
-
get: function () { return
|
|
102
|
+
get: function () { return chunkZQOIYCGA_cjs.DEFAULT_SCHEME_VERSION; }
|
|
216
103
|
});
|
|
217
104
|
Object.defineProperty(exports, "SPL_TOKEN_PROGRAM_ID", {
|
|
218
105
|
enumerable: true,
|
|
219
|
-
get: function () { return
|
|
220
|
-
});
|
|
221
|
-
Object.defineProperty(exports, "SYSTEM_PROGRAM_ID", {
|
|
222
|
-
enumerable: true,
|
|
223
|
-
get: function () { return chunkVEGLTTYQ_cjs.SYSTEM_PROGRAM_ID; }
|
|
106
|
+
get: function () { return chunkZQOIYCGA_cjs.SPL_TOKEN_PROGRAM_ID; }
|
|
224
107
|
});
|
|
225
108
|
Object.defineProperty(exports, "TOKEN_2022_PROGRAM_ID", {
|
|
226
109
|
enumerable: true,
|
|
227
|
-
get: function () { return
|
|
110
|
+
get: function () { return chunkZQOIYCGA_cjs.TOKEN_2022_PROGRAM_ID; }
|
|
228
111
|
});
|
|
229
112
|
Object.defineProperty(exports, "assertNetwork", {
|
|
230
113
|
enumerable: true,
|
|
231
|
-
get: function () { return
|
|
114
|
+
get: function () { return chunkZQOIYCGA_cjs.assertNetwork; }
|
|
232
115
|
});
|
|
233
116
|
Object.defineProperty(exports, "assertValidAlgorithmVersion", {
|
|
234
117
|
enumerable: true,
|
|
235
|
-
get: function () { return
|
|
118
|
+
get: function () { return chunkZQOIYCGA_cjs.assertValidAlgorithmVersion; }
|
|
236
119
|
});
|
|
237
120
|
Object.defineProperty(exports, "assertValidProtocolVersion", {
|
|
238
121
|
enumerable: true,
|
|
239
|
-
get: function () { return
|
|
122
|
+
get: function () { return chunkZQOIYCGA_cjs.assertValidProtocolVersion; }
|
|
240
123
|
});
|
|
241
124
|
Object.defineProperty(exports, "assertValidSchemeVersion", {
|
|
242
125
|
enumerable: true,
|
|
243
|
-
get: function () { return
|
|
126
|
+
get: function () { return chunkZQOIYCGA_cjs.assertValidSchemeVersion; }
|
|
244
127
|
});
|
|
245
128
|
Object.defineProperty(exports, "assertValidVersion", {
|
|
246
129
|
enumerable: true,
|
|
247
|
-
get: function () { return
|
|
248
|
-
});
|
|
249
|
-
Object.defineProperty(exports, "createSetComputeUnitLimitInstruction", {
|
|
250
|
-
enumerable: true,
|
|
251
|
-
get: function () { return chunkVEGLTTYQ_cjs.createSetComputeUnitLimitInstruction; }
|
|
130
|
+
get: function () { return chunkZQOIYCGA_cjs.assertValidVersion; }
|
|
252
131
|
});
|
|
253
132
|
Object.defineProperty(exports, "getDefaultAlgorithmVersion", {
|
|
254
133
|
enumerable: true,
|
|
255
|
-
get: function () { return
|
|
134
|
+
get: function () { return chunkZQOIYCGA_cjs.getDefaultAlgorithmVersion; }
|
|
256
135
|
});
|
|
257
136
|
Object.defineProperty(exports, "getDefaultProtocolVersion", {
|
|
258
137
|
enumerable: true,
|
|
259
|
-
get: function () { return
|
|
138
|
+
get: function () { return chunkZQOIYCGA_cjs.getDefaultProtocolVersion; }
|
|
260
139
|
});
|
|
261
140
|
Object.defineProperty(exports, "getDefaultSchemeVersion", {
|
|
262
141
|
enumerable: true,
|
|
263
|
-
get: function () { return
|
|
142
|
+
get: function () { return chunkZQOIYCGA_cjs.getDefaultSchemeVersion; }
|
|
264
143
|
});
|
|
265
144
|
Object.defineProperty(exports, "getNetworkConfig", {
|
|
266
145
|
enumerable: true,
|
|
267
|
-
get: function () { return
|
|
146
|
+
get: function () { return chunkZQOIYCGA_cjs.getNetworkConfig; }
|
|
268
147
|
});
|
|
269
148
|
Object.defineProperty(exports, "getNetworkSpecifier", {
|
|
270
149
|
enumerable: true,
|
|
271
|
-
get: function () { return
|
|
150
|
+
get: function () { return chunkZQOIYCGA_cjs.getNetworkSpecifier; }
|
|
272
151
|
});
|
|
273
152
|
Object.defineProperty(exports, "ARCIUM_CLUSTER_SEED", {
|
|
274
153
|
enumerable: true,
|
|
275
|
-
get: function () { return
|
|
154
|
+
get: function () { return chunkTQQZGNOI_cjs.ARCIUM_CLUSTER_SEED; }
|
|
276
155
|
});
|
|
277
156
|
Object.defineProperty(exports, "ARCIUM_COMPUTATION_SEED", {
|
|
278
157
|
enumerable: true,
|
|
279
|
-
get: function () { return
|
|
158
|
+
get: function () { return chunkTQQZGNOI_cjs.ARCIUM_COMPUTATION_SEED; }
|
|
280
159
|
});
|
|
281
160
|
Object.defineProperty(exports, "ARCIUM_COMP_DEF_SEED", {
|
|
282
161
|
enumerable: true,
|
|
283
|
-
get: function () { return
|
|
162
|
+
get: function () { return chunkTQQZGNOI_cjs.ARCIUM_COMP_DEF_SEED; }
|
|
284
163
|
});
|
|
285
164
|
Object.defineProperty(exports, "ARCIUM_EXEC_POOL_SEED", {
|
|
286
165
|
enumerable: true,
|
|
287
|
-
get: function () { return
|
|
166
|
+
get: function () { return chunkTQQZGNOI_cjs.ARCIUM_EXEC_POOL_SEED; }
|
|
288
167
|
});
|
|
289
168
|
Object.defineProperty(exports, "ARCIUM_MEMPOOL_SEED", {
|
|
290
169
|
enumerable: true,
|
|
291
|
-
get: function () { return
|
|
170
|
+
get: function () { return chunkTQQZGNOI_cjs.ARCIUM_MEMPOOL_SEED; }
|
|
292
171
|
});
|
|
293
172
|
Object.defineProperty(exports, "ARCIUM_MXE_ACCOUNT_SEED", {
|
|
294
173
|
enumerable: true,
|
|
295
|
-
get: function () { return
|
|
174
|
+
get: function () { return chunkTQQZGNOI_cjs.ARCIUM_MXE_ACCOUNT_SEED; }
|
|
296
175
|
});
|
|
297
176
|
Object.defineProperty(exports, "ARCIUM_OFFSET_BUFFER_SIZE", {
|
|
298
177
|
enumerable: true,
|
|
299
|
-
get: function () { return
|
|
178
|
+
get: function () { return chunkTQQZGNOI_cjs.ARCIUM_OFFSET_BUFFER_SIZE; }
|
|
300
179
|
});
|
|
301
180
|
exports.AGGREGATED_HASH_INPUT_COUNT = AGGREGATED_HASH_INPUT_COUNT;
|
|
302
|
-
exports.BPS_DIVISOR = BPS_DIVISOR;
|
|
303
181
|
exports.CLAIM_DOMAINS = CLAIM_DOMAINS;
|
|
304
|
-
exports.FEE_OFFSETS = FEE_OFFSETS;
|
|
305
182
|
exports.KMAC_512_OUTPUT_LENGTH = KMAC_512_OUTPUT_LENGTH;
|
|
306
183
|
exports.LINKER_ENCRYPTIONS_PER_LEAF = LINKER_ENCRYPTIONS_PER_LEAF;
|
|
307
184
|
exports.LINKER_KEYSTREAM_DOMAINS = LINKER_KEYSTREAM_DOMAINS;
|
|
308
|
-
exports.PROTOCOL_FEE = PROTOCOL_FEE;
|
|
309
185
|
exports.RANDOM_FACTOR_DOMAINS = RANDOM_FACTOR_DOMAINS;
|
|
310
|
-
exports.RELAYER_FEE = RELAYER_FEE;
|
|
311
186
|
exports.RESCUE_COMMITMENT_DOMAINS = RESCUE_COMMITMENT_DOMAINS;
|
|
312
187
|
exports.RESCUE_ENCRYPTIONS_COUNT = RESCUE_ENCRYPTIONS_COUNT;
|
|
313
|
-
exports.UMBRA_MESSAGE_TO_SIGN = UMBRA_MESSAGE_TO_SIGN;
|
|
314
188
|
exports.createClaimDomainSeparators = createClaimDomainSeparators;
|
|
315
189
|
//# sourceMappingURL=index.cjs.map
|
|
316
190
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/constants/domain-separators.ts","../../src/constants/encryption-counts.ts","../../src/umbra/constants.ts"],"names":["__name"],"mappings":";;;;;;;;AAyCO,SAAS,4BAA4B,SAAA,EAA6C;AACvF,EAAA,OAAO;AAAA,IACL,kBAAA,EAAoB,QAAQ,SAAS,CAAA,0BAAA,CAAA;AAAA,IACrC,kBAAA,EAAoB,QAAQ,SAAS,CAAA,0BAAA;AAAA,GACvC;AACF;AALgBA,wBAAA,CAAA,2BAAA,EAAA,6BAAA,CAAA;AAcT,IAAM,aAAA,GAAgB;AAAA;AAAA,EAE3B,kCAAA,EAAoC,4BAA4B,oCAAoC,CAAA;AAAA;AAAA,EAEpG,qCAAA,EAAuC,4BAA4B,uCAAuC,CAAA;AAAA;AAAA,EAE1G,yCAAA,EAA2C,4BAA4B,2CAA2C;AACpH;AASO,IAAM,wBAAA,GAA2B;AAAA;AAAA,EAEtC,kCAAA,EAAoC,oEAAA;AAAA;AAAA,EAEpC,yCAAA,EAA2C;AAC7C;AASO,IAAM,qBAAA,GAAwB;AAAA;AAAA,EAEnC,kCAAA,EAAoC,0EAAA;AAAA;AAAA,EAEpC,yCAAA,EAA2C;AAC7C;AASO,IAAM,yBAAA,GAA4B;AAAA;AAAA,EAEvC,kCAAA,EAAoC,+EAAA;AAAA;AAAA,EAEpC,yCAAA,EAA2C;AAC7C;;;ACzFO,IAAM,2BAAA,GAA8B;AAAA;AAAA;AAAA;AAAA;AAAA,EAKzC,QAAA,EAAU,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKV,QAAA,EAAU;AACZ;AASO,IAAM,wBAAA,GAA2B;AAAA;AAAA;AAAA;AAAA;AAAA,EAKtC,YAAA,EAAc,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKd,SAAA,EAAW;AACb;AASO,IAAM,sBAAA,GAAyB;AAK/B,IAAM,2BAAA,GAA8B;AAAA;AAAA,EAEzC,GAAA,EAAK,EAAA;AAAA;AAAA,EAEL,GAAA,EAAK;AACP;;;ACHO,IAAM,qBAAA,GAAwB;AAAA;;AAAA;AAAA;AAwD9B,IAAM,YAAA,GAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAU1B,QAAA,EAAU,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUV,GAAA,EAAK,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASL,WAAA,EAAa,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUb,WAAA,EAAa,OAAO,SAAS;AAC/B;AAwCO,IAAM,WAAA,GAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASzB,QAAA,EAAU,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUV,GAAA,EAAK,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAML,WAAA,EAAa,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUb,WAAA,EAAa,OAAO,SAAS;AAC/B;AAyCO,IAAM,WAAA,GAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUzB,kBAAA,EAAoB,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASpB,oBAAA,EAAsB,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUtB,mBAAA,EAAqB;AACvB;AAgCO,IAAM,WAAA,GAAc","file":"index.cjs","sourcesContent":["/**\n * Domain Separator Constants\n *\n * Domain separators for cryptographic operations in claim functions.\n * These are used as keys in KMAC256 for domain separation.\n *\n * @module constants/domain-separators\n */\n\n/* =============================================================================\n * CLAIM DOMAIN SEPARATOR TYPES\n * ============================================================================= */\n\n/**\n * Types of claim operations that require domain separators.\n */\nexport type ClaimType =\n | \"SelfClaimableUtxoIntoPublicBalance\"\n | \"SelfClaimableUtxoIntoEncryptedBalance\"\n | \"ReceiverClaimableUtxoIntoEncryptedBalance\";\n\n/**\n * Domain separator pair for claim operations.\n */\nexport interface ClaimDomainSeparators {\n /** Domain separator for modified generation index derivation */\n readonly MODIFIED_GEN_INDEX: string;\n /** Domain separator for expanded generation index derivation */\n readonly EXPANDED_GEN_INDEX: string;\n}\n\n/* =============================================================================\n * DOMAIN SEPARATOR FACTORY\n * ============================================================================= */\n\n/**\n * Creates domain separators for a specific claim type.\n *\n * @param claimType - The type of claim operation\n * @returns Domain separator pair for the claim type\n */\nexport function createClaimDomainSeparators(claimType: ClaimType): ClaimDomainSeparators {\n return {\n MODIFIED_GEN_INDEX: `Claim${claimType} / modifiedGenerationIndex`,\n EXPANDED_GEN_INDEX: `Claim${claimType} / expandedGenerationIndex`,\n } as const;\n}\n\n/* =============================================================================\n * PRE-BUILT DOMAIN SEPARATORS\n * ============================================================================= */\n\n/**\n * Pre-built domain separators for all claim types.\n */\nexport const CLAIM_DOMAINS = {\n /** Domain separators for self-claimable UTXO claims into public balance */\n SELF_CLAIMABLE_INTO_PUBLIC_BALANCE: createClaimDomainSeparators(\"SelfClaimableUtxoIntoPublicBalance\"),\n /** Domain separators for self-claimable UTXO claims into encrypted balance */\n SELF_CLAIMABLE_INTO_ENCRYPTED_BALANCE: createClaimDomainSeparators(\"SelfClaimableUtxoIntoEncryptedBalance\"),\n /** Domain separators for receiver-claimable UTXO claims into encrypted balance */\n RECEIVER_CLAIMABLE_INTO_ENCRYPTED_BALANCE: createClaimDomainSeparators(\"ReceiverClaimableUtxoIntoEncryptedBalance\"),\n} as const;\n\n/* =============================================================================\n * LINKER KEYSTREAM DOMAIN SEPARATORS\n * ============================================================================= */\n\n/**\n * Domain separators for linker keystream blinding factor derivation.\n */\nexport const LINKER_KEYSTREAM_DOMAINS = {\n /** Self-claimable UTXO claim into public balance */\n SELF_CLAIMABLE_INTO_PUBLIC_BALANCE: \"selfClaimableUtxoIntoPublicBalance / linkerKeystreamBlindingFactor\",\n /** Receiver-claimable UTXO claim into encrypted balance (also used for self-claimable into encrypted balance) */\n RECEIVER_CLAIMABLE_INTO_ENCRYPTED_BALANCE: \"receiverClaimableUtxoIntoEncryptedBalance / linkerKeystreamBlindingFactor\",\n} as const;\n\n/* =============================================================================\n * RANDOM FACTOR DOMAIN SEPARATORS\n * ============================================================================= */\n\n/**\n * Domain separators for random factor generation in polynomial commitment.\n */\nexport const RANDOM_FACTOR_DOMAINS = {\n /** Self-claimable UTXO claim into public balance */\n SELF_CLAIMABLE_INTO_PUBLIC_BALANCE: \"selfClaimableUtxoIntoPublicBalance / randomFactorForPolynomialCommitment\",\n /** Receiver-claimable UTXO claim into encrypted balance (also used for self-claimable into encrypted balance) */\n RECEIVER_CLAIMABLE_INTO_ENCRYPTED_BALANCE: \"receiverClaimableUtxoIntoEncryptedBalance / randomFactorForPolynomialCommitment\",\n} as const;\n\n/* =============================================================================\n * RESCUE ENCRYPTION COMMITMENT DOMAIN SEPARATORS\n * ============================================================================= */\n\n/**\n * Domain separators for rescue encryption commitment blinding factor derivation.\n */\nexport const RESCUE_COMMITMENT_DOMAINS = {\n /** Self-claimable UTXO claim into public balance */\n SELF_CLAIMABLE_INTO_PUBLIC_BALANCE: \"selfClaimableUtxoIntoPublicBalance / rescueEncryptionCommitmentBlindingFactor\",\n /** Receiver-claimable UTXO claim into encrypted balance (also used for self-claimable into encrypted balance) */\n RECEIVER_CLAIMABLE_INTO_ENCRYPTED_BALANCE: \"receiverClaimableUtxoIntoEncryptedBalance / rescueEncryptionCommitmentBlindingFactor\",\n} as const;\n","/**\n * Encryption Count Constants\n *\n * Constants for encryption operations in claim circuits.\n *\n * @module constants/encryption-counts\n */\n\n/* =============================================================================\n * LINKER ENCRYPTION CONSTANTS\n * ============================================================================= */\n\n/**\n * Number of linker encryptions per leaf for different claim types.\n */\nexport const LINKER_ENCRYPTIONS_PER_LEAF = {\n /**\n * ATA claims - excludes amount encryption (amounts are public).\n * Encrypts: senderAddressLow, senderAddressHigh, mintAddressLow, mintAddressHigh, leafCommitment\n */\n INTO_ATA: 5,\n /**\n * ETA claims - includes amount encryption.\n * Encrypts: senderAddressLow, senderAddressHigh, amount, mintAddressLow, mintAddressHigh, leafCommitment\n */\n INTO_ETA: 6,\n} as const;\n\n/* =============================================================================\n * RESCUE CIPHER ENCRYPTION CONSTANTS\n * ============================================================================= */\n\n/**\n * Number of rescue cipher encryptions for different claim types.\n */\nexport const RESCUE_ENCRYPTIONS_COUNT = {\n /**\n * ATA claims - no fee encryption (amounts are public).\n * Encrypts: mvkLow, mvkHigh, randomFactorLow, randomFactorHigh\n */\n WITHOUT_FEES: 4,\n /**\n * ETA claims - includes fee encryption.\n * Encrypts: finalAmount, protocolFees, relayerFees, mvkLow, mvkHigh, randomFactorLow, randomFactorHigh\n */\n WITH_FEES: 7,\n} as const;\n\n/* =============================================================================\n * CRYPTOGRAPHIC OUTPUT CONSTANTS\n * ============================================================================= */\n\n/**\n * KMAC256 output length for 512-bit (64 bytes) output.\n */\nexport const KMAC_512_OUTPUT_LENGTH = 64;\n\n/**\n * Number of elements in the public aggregated hash input array.\n */\nexport const AGGREGATED_HASH_INPUT_COUNT = {\n /** ATA claims use 45 elements */\n ATA: 45,\n /** ETA claims use 70 elements */\n ETA: 70,\n} as const;\n","/**\n * Umbra Protocol Constants\n *\n * Defines the configuration constants used when building and validating Umbra protocol\n * instructions on the client side. These constants mirror on-chain values defined in the\n * Anchor program (`programs/umbra/src/`) and must be kept in sync with that source of\n * truth.\n *\n * ## Sections\n *\n * - **Message signing** — the canonical warning text presented to users before their\n * wallet signature is used to derive the master private key.\n * - **Protocol fee configuration** — the fee schedule applied to the protocol's share\n * of each claim or transfer. Set by program admin, enforced on-chain.\n * - **Relayer fee configuration** — the fee schedule applied to the relayer's commission\n * on claim and transfer instructions. Set per-relayer.\n * - **Fee offset configuration** — the `offset` discriminators used when deriving PDAs\n * for fee-related accounts.\n * - **BPS divisor** — the basis-point denominator used in fee arithmetic.\n *\n * @packageDocumentation\n * @module umbra/constants\n */\n\n/* =============================================================================\n * UMBRA PROTOCOL CONSTANTS\n * ============================================================================= */\n\n/**\n * Canonical message shown to the user before their wallet signature is requested for\n * master key derivation.\n *\n * @remarks\n * Signing this message is the root of the user's key hierarchy. The resulting signature\n * is fed into the SDK's key derivation pipeline to produce the `MasterSeed`, from which\n * all spending keys, viewing keys, and Poseidon private keys are derived.\n *\n * The message is deliberately verbose and alarming to ensure that:\n * 1. Users understand the cryptographic weight of their signature.\n * 2. Phishing sites that silently request this signature cannot hide the operation from\n * an attentive user.\n *\n * The exact string (including surrounding newlines) must not be modified without a\n * corresponding protocol upgrade, because changing the message changes all derived keys\n * for every existing user.\n *\n * @example\n * ```typescript\n * import { UMBRA_MESSAGE_TO_SIGN } from \"@umbra-privacy/sdk\";\n * import { signMessage } from \"@solana/kit\";\n *\n * // Present to the user before requesting their signature:\n * console.log(UMBRA_MESSAGE_TO_SIGN);\n *\n * // Obtain the signature and pass it to the key derivation pipeline:\n * const signature = await signer.signMessage(\n * new TextEncoder().encode(UMBRA_MESSAGE_TO_SIGN)\n * );\n * ```\n *\n * @public\n */\nexport const UMBRA_MESSAGE_TO_SIGN = `\nSigning this message is a sensitive cryptographic operation that generates the master key used to derive your private spending keys and decrypt your account balances. This signature acts as the root of your privacy and financial security within the Umbra ecosystem.\n\nYou must ensure that you are interacting with the official Umbra Privacy application or a verified integration. Signing this message on an unverified or malicious site could allow an attacker to gain full control over your funds and expose your entire transaction history.\n`;\n\n/* =============================================================================\n * PROTOCOL FEE CONFIGURATION\n * ============================================================================= */\n\n/**\n * Default fee schedule applied to the protocol's share of each claim or transfer\n * instruction.\n *\n * @remarks\n * These values mirror the `ProtocolFeesConfiguration` account that is written by the\n * program admin during pool setup. The SDK uses them client-side to:\n *\n * 1. Pre-calculate expected fee amounts before building a transaction, so callers can\n * display accurate fee estimates in the UI.\n * 2. Compute the amount of tokens the user actually receives after fees are deducted\n * from the claimed UTXO.\n *\n * The on-chain program independently validates the actual fee config account, so these\n * client-side defaults act as a best-effort estimate rather than an authoritative source.\n * If the admin updates fee parameters on-chain, callers should fetch the live\n * `ProtocolFeesConfiguration` PDA and override these defaults.\n *\n * ## Fee formula\n *\n * ```\n * fee = clamp(BASE_FEE + floor(amount * BPS / BPS_DIVISOR), LOWER_BOUND, UPPER_BOUND)\n * ```\n *\n * Where `BPS_DIVISOR = 10_000n` (see {@link BPS_DIVISOR}).\n *\n * @example\n * ```typescript\n * import { PROTOCOL_FEE, BPS_DIVISOR } from \"@umbra-privacy/sdk\";\n *\n * function estimateProtocolFee(amount: bigint): bigint {\n * const bpsFee = (amount * PROTOCOL_FEE.BPS) / BPS_DIVISOR;\n * const rawFee = PROTOCOL_FEE.BASE_FEE + bpsFee;\n * const clamped = rawFee < PROTOCOL_FEE.LOWER_BOUND\n * ? PROTOCOL_FEE.LOWER_BOUND\n * : rawFee > PROTOCOL_FEE.UPPER_BOUND\n * ? PROTOCOL_FEE.UPPER_BOUND\n * : rawFee;\n * return clamped;\n * }\n * ```\n *\n * @see {@link RELAYER_FEE} for the relayer's fee schedule.\n * @see {@link BPS_DIVISOR} for the basis-point denominator.\n * @public\n */\nexport const PROTOCOL_FEE = {\n /**\n * Fixed base fee charged per operation, denominated in the SPL token's smallest unit.\n *\n * @remarks\n * Added to the proportional BPS fee before clamping. A value of `10n` means 10\n * token micro-units (e.g. 0.00001 USDC for a 6-decimal token).\n *\n * @readonly\n */\n BASE_FEE: 10n,\n /**\n * Proportional fee rate expressed in basis points (1 BPS = 0.01%).\n *\n * @remarks\n * `35n` corresponds to 0.35%. Applied to the claimed or transferred amount before\n * adding `BASE_FEE` and clamping to `[LOWER_BOUND, UPPER_BOUND]`.\n *\n * @readonly\n */\n BPS: 35n,\n /**\n * Minimum fee amount. The total fee is never less than this value.\n *\n * @remarks\n * Currently `0n`, meaning there is no enforced minimum beyond the `BASE_FEE`.\n *\n * @readonly\n */\n LOWER_BOUND: 0n,\n /**\n * Maximum fee amount (cap). The total fee is never greater than this value.\n *\n * @remarks\n * Set to `1_000_000n` (one million token micro-units), which equals 1 USDC for a\n * 6-decimal token. This cap prevents runaway fees on very large claims.\n *\n * @readonly\n */\n UPPER_BOUND: BigInt(\"1000000\"),\n} as const;\n\n/* =============================================================================\n * RELAYER FEE CONFIGURATION\n * ============================================================================= */\n\n/**\n * Default fee schedule applied to the relayer's commission on each claim or transfer\n * instruction that involves a relayer.\n *\n * @remarks\n * These values mirror the `RelayerFeesConfiguration` account associated with a specific\n * relayer. The SDK uses them client-side for fee estimation and for constructing the\n * `expected_fee` field that is verified on-chain during MPC computation.\n *\n * Note that `BASE_FEE` is `0n` for relayers by default — relayers are compensated\n * entirely through the proportional BPS component, unlike the protocol which charges a\n * fixed base fee on top of BPS.\n *\n * ## Fee formula\n *\n * ```\n * relayerFee = clamp(BASE_FEE + floor(amount * BPS / BPS_DIVISOR), LOWER_BOUND, UPPER_BOUND)\n * ```\n *\n * @example\n * ```typescript\n * import { RELAYER_FEE, BPS_DIVISOR } from \"@umbra-privacy/sdk\";\n *\n * function estimateRelayerFee(amount: bigint): bigint {\n * const bpsFee = (amount * RELAYER_FEE.BPS) / BPS_DIVISOR;\n * const rawFee = RELAYER_FEE.BASE_FEE + bpsFee;\n * return rawFee > RELAYER_FEE.UPPER_BOUND ? RELAYER_FEE.UPPER_BOUND : rawFee;\n * }\n * ```\n *\n * @see {@link PROTOCOL_FEE} for the protocol's fee schedule.\n * @see {@link BPS_DIVISOR} for the basis-point denominator.\n * @public\n */\nexport const RELAYER_FEE = {\n /**\n * Fixed base fee for relayer operations, denominated in the SPL token's smallest unit.\n *\n * @remarks\n * `0n` — relayers do not charge a fixed base fee; they earn purely through BPS.\n *\n * @readonly\n */\n BASE_FEE: 0n,\n /**\n * Proportional fee rate for the relayer, expressed in basis points (1 BPS = 0.01%).\n *\n * @remarks\n * `35n` corresponds to 0.35%. The relayer earns this percentage of the claimed amount\n * as compensation for submitting and funding the MPC callback transaction.\n *\n * @readonly\n */\n BPS: 35n,\n /**\n * Minimum relayer fee. Currently `0n`.\n *\n * @readonly\n */\n LOWER_BOUND: 0n,\n /**\n * Maximum relayer fee (cap). `1_000_000n` token micro-units.\n *\n * @remarks\n * Mirrors the protocol fee cap to ensure the combined fee never exceeds a predictable\n * maximum, protecting users from paying unexpectedly large fees on large claims.\n *\n * @readonly\n */\n UPPER_BOUND: BigInt(\"1000000\"),\n} as const;\n\n/* =============================================================================\n * FEE OFFSET CONFIGURATION\n * ============================================================================= */\n\n/**\n * Offset discriminators used when deriving PDAs for fee-related on-chain accounts.\n *\n * @remarks\n * The Umbra program uses an `offset` field in PDA seeds to allow multiple independent\n * instances of the same account type to coexist (e.g. multiple fee pools for future\n * protocol versions). The offset is encoded as a `U128` little-endian byte array and\n * appended as the final seed when calling `getProgramDerivedAddress`.\n *\n * All offsets are currently `0n` because the protocol uses a single canonical instance\n * of each fee account type. Future upgrades may introduce non-zero offsets for versioned\n * account sets.\n *\n * These values are passed directly to PDA derivation helpers such as\n * `getProtocolOnlyUnifiedFeesPoolPda`, `getRelayerUnifiedFeesPoolPda`, and\n * `getProtocolFeesConfigurationPda`.\n *\n * @example\n * ```typescript\n * import { FEE_OFFSETS } from \"@umbra-privacy/sdk\";\n * import { getProtocolFeesConfigurationPda } from \"@umbra-privacy/sdk/pda\";\n *\n * const [feeConfigPda] = await getProtocolFeesConfigurationPda(\n * instructionSeed as U128,\n * mintAddress,\n * FEE_OFFSETS.PROTOCOL_FEES_CONFIG as U128,\n * programId,\n * );\n * ```\n *\n * @see {@link getProtocolOnlyUnifiedFeesPoolPda} for protocol-only pool PDA derivation.\n * @see {@link getRelayerUnifiedFeesPoolPda} for relayer pool PDA derivation.\n * @see {@link getProtocolFeesConfigurationPda} for fee config PDA derivation.\n * @public\n */\nexport const FEE_OFFSETS = {\n /**\n * Offset used in `UnifiedFeesPool` PDA derivation for the unified protocol fees pool.\n *\n * @remarks\n * Passed as the final seed to `getProtocolOnlyUnifiedFeesPoolPda` and\n * `getRelayerUnifiedFeesPoolPda`. Currently `0n`.\n *\n * @readonly\n */\n PROTOCOL_FEES_POOL: 0n,\n /**\n * Offset used in `ProtocolFeesConfiguration` PDA derivation.\n *\n * @remarks\n * Passed as the final seed to `getProtocolFeesConfigurationPda`. Currently `0n`.\n *\n * @readonly\n */\n PROTOCOL_FEES_CONFIG: 0n,\n /**\n * Offset used in relayer fee configuration PDA derivation.\n *\n * @remarks\n * Passed as the offset seed when looking up the relayer's fee configuration account.\n * Currently `0n`.\n *\n * @readonly\n */\n RELAYER_FEES_CONFIG: 0n,\n} as const;\n\n/* =============================================================================\n * FEE CALCULATION CONSTANTS\n * ============================================================================= */\n\n/**\n * Denominator for basis-point fee calculations.\n *\n * @remarks\n * Basis points (BPS) express a fee rate as an integer fraction of 10,000.\n * For example, 35 BPS = 35 / 10,000 = 0.35%.\n *\n * To convert a BPS fee rate to a proportional fee amount:\n * ```\n * proportionalFee = floor(amount * bps / BPS_DIVISOR)\n * ```\n *\n * Using integer division (`/` on `bigint`) automatically floors the result, which is\n * the correct behaviour for fee deductions (always round down in favour of the user).\n *\n * @example\n * ```typescript\n * import { BPS_DIVISOR, PROTOCOL_FEE } from \"@umbra-privacy/sdk\";\n *\n * const amount = 1_000_000n; // 1 USDC in micro-units\n * const proportionalFee = (amount * PROTOCOL_FEE.BPS) / BPS_DIVISOR;\n * // proportionalFee = 1_000_000n * 35n / 10_000n = 3_500n (0.0035 USDC)\n * ```\n *\n * @public\n */\nexport const BPS_DIVISOR = 10_000n;\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/constants/domain-separators.ts","../../src/constants/encryption-counts.ts"],"names":["__name"],"mappings":";;;;;;;;;;AA0CO,SAAS,4BAA4B,SAAA,EAA6C;AACvF,EAAA,OAAO;AAAA,IACL,kBAAA,EAAoB,QAAQ,SAAS,CAAA,0BAAA,CAAA;AAAA,IACrC,kBAAA,EAAoB,QAAQ,SAAS,CAAA,0BAAA;AAAA,GACvC;AACF;AALgBA,wBAAA,CAAA,2BAAA,EAAA,6BAAA,CAAA;AAcT,IAAM,aAAA,GAAgB;AAAA;AAAA,EAE3B,kCAAA,EAAoC,2BAAA;AAAA,IAClC;AAAA,GACF;AAAA;AAAA,EAEA,qCAAA,EAAuC,2BAAA;AAAA,IACrC;AAAA,GACF;AAAA;AAAA,EAEA,yCAAA,EAA2C,2BAAA;AAAA,IACzC;AAAA;AAEJ;AASO,IAAM,wBAAA,GAA2B;AAAA;AAAA,EAEtC,kCAAA,EACE,oEAAA;AAAA;AAAA,EAEF,yCAAA,EACE;AACJ;AASO,IAAM,qBAAA,GAAwB;AAAA;AAAA,EAEnC,kCAAA,EACE,0EAAA;AAAA;AAAA,EAEF,yCAAA,EACE;AACJ;AASO,IAAM,yBAAA,GAA4B;AAAA;AAAA,EAEvC,kCAAA,EACE,+EAAA;AAAA;AAAA,EAEF,yCAAA,EACE;AACJ;;;ACrGO,IAAM,2BAAA,GAA8B;AAAA;AAAA;AAAA;AAAA;AAAA,EAKzC,QAAA,EAAU,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKV,QAAA,EAAU;AACZ;AASO,IAAM,wBAAA,GAA2B;AAAA;AAAA;AAAA;AAAA;AAAA,EAKtC,YAAA,EAAc,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKd,SAAA,EAAW;AACb;AASO,IAAM,sBAAA,GAAyB;AAK/B,IAAM,2BAAA,GAA8B;AAAA;AAAA,EAEzC,GAAA,EAAK,EAAA;AAAA;AAAA,EAEL,GAAA,EAAK;AACP","file":"index.cjs","sourcesContent":["/**\n * Domain Separator Constants\n *\n * Domain separators for cryptographic operations in claim functions.\n * These are used as keys in KMAC256 for domain separation.\n *\n * @since 2.0.0\n * @module constants/domain-separators\n */\n\n/* =============================================================================\n * CLAIM DOMAIN SEPARATOR TYPES\n * ============================================================================= */\n\n/**\n * Types of claim operations that require domain separators.\n */\nexport type ClaimType =\n | \"SelfClaimableUtxoIntoPublicBalance\"\n | \"SelfClaimableUtxoIntoEncryptedBalance\"\n | \"ReceiverClaimableUtxoIntoEncryptedBalance\";\n\n/**\n * Domain separator pair for claim operations.\n */\nexport interface ClaimDomainSeparators {\n /** Domain separator for modified generation index derivation */\n readonly MODIFIED_GEN_INDEX: string;\n /** Domain separator for expanded generation index derivation */\n readonly EXPANDED_GEN_INDEX: string;\n}\n\n/* =============================================================================\n * DOMAIN SEPARATOR FACTORY\n * ============================================================================= */\n\n/**\n * Creates domain separators for a specific claim type.\n *\n * @param claimType - The type of claim operation\n * @returns Domain separator pair for the claim type\n */\nexport function createClaimDomainSeparators(claimType: ClaimType): ClaimDomainSeparators {\n return {\n MODIFIED_GEN_INDEX: `Claim${claimType} / modifiedGenerationIndex`,\n EXPANDED_GEN_INDEX: `Claim${claimType} / expandedGenerationIndex`,\n } as const;\n}\n\n/* =============================================================================\n * PRE-BUILT DOMAIN SEPARATORS\n * ============================================================================= */\n\n/**\n * Pre-built domain separators for all claim types.\n */\nexport const CLAIM_DOMAINS = {\n /** Domain separators for self-claimable UTXO claims into public balance */\n SELF_CLAIMABLE_INTO_PUBLIC_BALANCE: createClaimDomainSeparators(\n \"SelfClaimableUtxoIntoPublicBalance\",\n ),\n /** Domain separators for self-claimable UTXO claims into encrypted balance */\n SELF_CLAIMABLE_INTO_ENCRYPTED_BALANCE: createClaimDomainSeparators(\n \"SelfClaimableUtxoIntoEncryptedBalance\",\n ),\n /** Domain separators for receiver-claimable UTXO claims into encrypted balance */\n RECEIVER_CLAIMABLE_INTO_ENCRYPTED_BALANCE: createClaimDomainSeparators(\n \"ReceiverClaimableUtxoIntoEncryptedBalance\",\n ),\n} as const;\n\n/* =============================================================================\n * LINKER KEYSTREAM DOMAIN SEPARATORS\n * ============================================================================= */\n\n/**\n * Domain separators for linker keystream blinding factor derivation.\n */\nexport const LINKER_KEYSTREAM_DOMAINS = {\n /** Self-claimable UTXO claim into public balance */\n SELF_CLAIMABLE_INTO_PUBLIC_BALANCE:\n \"selfClaimableUtxoIntoPublicBalance / linkerKeystreamBlindingFactor\",\n /** Receiver-claimable UTXO claim into encrypted balance (also used for self-claimable into encrypted balance) */\n RECEIVER_CLAIMABLE_INTO_ENCRYPTED_BALANCE:\n \"receiverClaimableUtxoIntoEncryptedBalance / linkerKeystreamBlindingFactor\",\n} as const;\n\n/* =============================================================================\n * RANDOM FACTOR DOMAIN SEPARATORS\n * ============================================================================= */\n\n/**\n * Domain separators for random factor generation in polynomial commitment.\n */\nexport const RANDOM_FACTOR_DOMAINS = {\n /** Self-claimable UTXO claim into public balance */\n SELF_CLAIMABLE_INTO_PUBLIC_BALANCE:\n \"selfClaimableUtxoIntoPublicBalance / randomFactorForPolynomialCommitment\",\n /** Receiver-claimable UTXO claim into encrypted balance (also used for self-claimable into encrypted balance) */\n RECEIVER_CLAIMABLE_INTO_ENCRYPTED_BALANCE:\n \"receiverClaimableUtxoIntoEncryptedBalance / randomFactorForPolynomialCommitment\",\n} as const;\n\n/* =============================================================================\n * RESCUE ENCRYPTION COMMITMENT DOMAIN SEPARATORS\n * ============================================================================= */\n\n/**\n * Domain separators for rescue encryption commitment blinding factor derivation.\n */\nexport const RESCUE_COMMITMENT_DOMAINS = {\n /** Self-claimable UTXO claim into public balance */\n SELF_CLAIMABLE_INTO_PUBLIC_BALANCE:\n \"selfClaimableUtxoIntoPublicBalance / rescueEncryptionCommitmentBlindingFactor\",\n /** Receiver-claimable UTXO claim into encrypted balance (also used for self-claimable into encrypted balance) */\n RECEIVER_CLAIMABLE_INTO_ENCRYPTED_BALANCE:\n \"receiverClaimableUtxoIntoEncryptedBalance / rescueEncryptionCommitmentBlindingFactor\",\n} as const;\n","/**\n * Encryption Count Constants\n *\n * Constants for encryption operations in claim circuits.\n *\n * @since 2.0.0\n * @module constants/encryption-counts\n */\n\n/* =============================================================================\n * LINKER ENCRYPTION CONSTANTS\n * ============================================================================= */\n\n/**\n * Number of linker encryptions per leaf for different claim types.\n */\nexport const LINKER_ENCRYPTIONS_PER_LEAF = {\n /**\n * ATA claims - excludes amount encryption (amounts are public).\n * Encrypts: senderAddressLow, senderAddressHigh, mintAddressLow, mintAddressHigh, leafCommitment\n */\n INTO_ATA: 5,\n /**\n * ETA claims - includes amount encryption.\n * Encrypts: senderAddressLow, senderAddressHigh, amount, mintAddressLow, mintAddressHigh, leafCommitment\n */\n INTO_ETA: 6,\n} as const;\n\n/* =============================================================================\n * RESCUE CIPHER ENCRYPTION CONSTANTS\n * ============================================================================= */\n\n/**\n * Number of rescue cipher encryptions for different claim types.\n */\nexport const RESCUE_ENCRYPTIONS_COUNT = {\n /**\n * ATA claims - no fee encryption (amounts are public).\n * Encrypts: mvkLow, mvkHigh, randomFactorLow, randomFactorHigh\n */\n WITHOUT_FEES: 4,\n /**\n * ETA claims - includes fee encryption.\n * Encrypts: finalAmount, protocolFees, relayerFees, mvkLow, mvkHigh, randomFactorLow, randomFactorHigh\n */\n WITH_FEES: 7,\n} as const;\n\n/* =============================================================================\n * CRYPTOGRAPHIC OUTPUT CONSTANTS\n * ============================================================================= */\n\n/**\n * KMAC256 output length for 512-bit (64 bytes) output.\n */\nexport const KMAC_512_OUTPUT_LENGTH = 64;\n\n/**\n * Number of elements in the public aggregated hash input array.\n */\nexport const AGGREGATED_HASH_INPUT_COUNT = {\n /** ATA claims use 45 elements */\n ATA: 45,\n /** ETA claims use 70 elements */\n ETA: 70,\n} as const;\n"]}
|