@arcanetech/privacy-sdk-stellar 0.2.3 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,4 @@
1
1
  import { OperationKind, DepositIntent, TransferIntent, WithdrawIntent } from '@arcanetech/privacy-sdk-core';
2
- import { OnboardingPayload } from 'contract';
3
2
  export { createInMemoryStateAdapter } from '@arcanetech/privacy-sdk-state-memory';
4
3
 
5
4
  type StellarPrivateRecordStatus = 'pending' | 'finalized' | 'spent';
@@ -12,25 +11,6 @@ interface StellarPrivateCoinNote {
12
11
  asset_lo: string;
13
12
  application_id?: string;
14
13
  }
15
- interface StellarPendingClaim {
16
- id: string;
17
- owner: StellarAddress;
18
- asset: StellarAssetId;
19
- amount: bigint;
20
- createdAt: string;
21
- poolTxId?: string;
22
- commitmentHex?: string;
23
- nullifierHex?: string;
24
- futureNullifierHashHex?: string;
25
- assetHiHex?: string;
26
- assetLoHex?: string;
27
- nullifierFieldHex?: string;
28
- secretHex?: string;
29
- tempPublicKeyXHex?: string;
30
- tempPublicKeyYHex?: string;
31
- encryptedRecoveryBase64?: string;
32
- createdAtLedger?: number;
33
- }
34
14
  interface StellarPrivateRecord {
35
15
  id: string;
36
16
  owner: StellarAddress;
@@ -50,16 +30,9 @@ interface StellarPrivateRecord {
50
30
  precommitementHex?: string;
51
31
  }
52
32
 
53
- type KytApplicationIdHints = [string, string, string, string];
33
+ type KytApplicationIdHints = string[];
54
34
 
55
- type StellarPendingClaimSource = {
56
- kind: 'pendingClaim';
57
- claimId: string;
58
- } | {
59
- kind: 'pendingClaim';
60
- claim: StellarPendingClaim;
61
- };
62
- type StellarTransferFromAddress = StellarAddress | StellarPendingClaimSource;
35
+ type StellarTransferFromAddress = StellarAddress;
63
36
 
64
37
  type StellarAddress = string;
65
38
  type StellarAssetId = string;
@@ -82,16 +55,25 @@ interface StellarSubmissionPayload {
82
55
  interface StellarTransactArtifacts {
83
56
  proofHex?: string;
84
57
  publicHex?: string;
58
+ ciphertextHex?: string;
59
+ outputNoteEphemeralScalars?: string[];
85
60
  applicationIdsPlaintext?: KytApplicationIdHints;
86
61
  tokenAddress?: string;
87
62
  depositScalarHex?: string;
88
63
  precommitementHex?: string;
89
64
  commitmentHex?: string;
90
65
  walletPublicKey?: string;
91
- onboarding?: OnboardingPayload;
66
+ escrowRecipient?: string;
67
+ escrowAuthorization?: string;
68
+ escrowSend?: boolean;
69
+ escrowSpendScalarHex?: string;
70
+ escrowClaimantLimbs?: {
71
+ recipientHi: string;
72
+ recipientLo: string;
73
+ nonceDecimal?: string;
74
+ };
92
75
  executeFinalizeRequired?: boolean;
93
- pendingClaim?: StellarPendingClaim;
94
- spendSource?: 'privateAddress' | 'pendingClaim';
76
+ spendSource?: 'privateAddress' | 'escrow';
95
77
  }
96
78
  interface StellarOperationReceipt {
97
79
  operationId: string;
@@ -1,10 +1,34 @@
1
- import { DepositObject, CoinData, AuditPublicKey, PrivacyPoolSDK, StateFile, TransactionAuditParams, InspectKytPassageApproved } from '@auditable/privacy-pool-zk-sdk';
2
- export { DEFAULT_STEALTH_SIGN_NONCE as DEFAULT_PRIVATE_ADDRESS_SIGN_NONCE } from '@auditable/privacy-pool-zk-sdk';
1
+ import { SpendScalarDomain, PrivacyPoolSDK, DepositObject, CoinData, ZkCircuitLayoutFields, BundledZkCircuit, AuditPublicKey, StateFile, TransactionAuditParams, InspectKytPassageApproved } from '@arcanetech/stellar-privacy-pool-zk-sdk';
2
+ export { BundledZkCircuit, DEFAULT_STEALTH_SIGN_NONCE as DEFAULT_PRIVATE_ADDRESS_SIGN_NONCE, OWNER_BOUND_NOTE_SCHEMA_VERSION, SpendScalarDomain, spendScalarHexFromStellarSignature } from '@arcanetech/stellar-privacy-pool-zk-sdk';
3
3
  import { Buffer as Buffer$1 } from 'buffer';
4
- import { OnboardingPayload } from 'contract';
5
- export { OnboardingPayload, PrivateAddressRegistration } from 'contract';
4
+ import { OperationKind, DepositIntent, TransferIntent, WithdrawIntent } from '@arcanetech/privacy-sdk-core';
6
5
  import { StateBridgeAdapter } from '@arcanetech/privacy-sdk-core/state';
7
6
 
7
+ type DecodedPrivateAddress = {
8
+ x: string;
9
+ y: string;
10
+ };
11
+ type PrivateAddressGenerator = (signature: string, domain: SpendScalarDomain) => string | Promise<string>;
12
+ type PrivateAddressSdk = {
13
+ generatePrivateAddressFromStellarSignature: PrivateAddressGenerator;
14
+ };
15
+ declare function buildPrivateAddressSignMessage(publicKey: string, domain: SpendScalarDomain, nonce?: string): string;
16
+ declare function decodePrivateAddress(value: string): DecodedPrivateAddress;
17
+ declare function encodePrivateAddress(decoded: DecodedPrivateAddress): string;
18
+ declare function encodePrivateAddressFromHexCoordinates(publicKeyXHex: string, publicKeyYHex: string): string;
19
+ declare function recipientPublicKeysDecimalFromPrivateAddress(value: string): unknown;
20
+ declare function privateAddressSdk(sdk: PrivacyPoolSDK): PrivateAddressSdk;
21
+
22
+ type StellarPrivateRecordStatus = 'pending' | 'finalized' | 'spent';
23
+ interface StellarPrivateCoinNote {
24
+ value: string;
25
+ nullifier: string;
26
+ secret: string;
27
+ commitment: string;
28
+ asset_hi: string;
29
+ asset_lo: string;
30
+ application_id?: string;
31
+ }
8
32
  interface StellarPoolMerkleState {
9
33
  poolContract: string;
10
34
  commitments: string[];
@@ -20,6 +44,24 @@ interface StellarLeafEphemeral {
20
44
  yHex: string;
21
45
  cachedAt?: string;
22
46
  }
47
+ interface StellarPrivateRecord {
48
+ id: string;
49
+ owner: StellarAddress;
50
+ asset: StellarAssetId;
51
+ amount: bigint;
52
+ consumed: boolean;
53
+ status?: StellarPrivateRecordStatus;
54
+ poolContract?: string;
55
+ commitmentHex?: string;
56
+ nullifierHex?: string;
57
+ amountDisplay?: number;
58
+ deliveryId?: number;
59
+ privateAddress?: string;
60
+ txHash?: string;
61
+ coinNote?: StellarPrivateCoinNote;
62
+ depositScalarHex?: string;
63
+ precommitementHex?: string;
64
+ }
23
65
 
24
66
  type AlignedDepositSlot = {
25
67
  deposit: DepositObject;
@@ -28,11 +70,13 @@ type AlignedDepositSlot = {
28
70
  depositScalarHex: string;
29
71
  precommitementHex: string;
30
72
  };
31
- type KytApplicationIdHints = [string, string, string, string];
73
+ type KytApplicationIdHints = string[];
32
74
  type ProofResult = {
33
75
  proof_hex: string;
34
76
  public_hex: string;
35
77
  applicationIdsPlaintext: KytApplicationIdHints;
78
+ ciphertext_hex?: string;
79
+ output_note_ephemeral_scalars?: string[];
36
80
  };
37
81
  type ProofWithChange = ProofResult & {
38
82
  changeCoin?: {
@@ -43,6 +87,8 @@ type ProofWithChange = ProofResult & {
43
87
  };
44
88
  };
45
89
 
90
+ type StellarTransferFromAddress = StellarAddress;
91
+
46
92
  interface PoolMerkleStatePort {
47
93
  get(poolContract: string): Promise<StellarPoolMerkleState | undefined>;
48
94
  set(state: StellarPoolMerkleState): Promise<void>;
@@ -63,33 +109,68 @@ type StellarSignTransaction = (input: {
63
109
  signedTxXdr: string;
64
110
  }>;
65
111
 
112
+ type StellarBundledZkCircuitDefinition = ZkCircuitLayoutFields & {
113
+ circuit: BundledZkCircuit;
114
+ };
115
+ type StellarCustomZkCircuitDefinition = ZkCircuitLayoutFields & {
116
+ zkeyUrl: string;
117
+ circuitGraphUrl: string;
118
+ r1csUrl: string;
119
+ provingKeyUrl: string;
120
+ };
121
+ type StellarZkCircuitDefinition = StellarBundledZkCircuitDefinition | StellarCustomZkCircuitDefinition;
122
+ declare const DEFAULT_STELLAR_ZK_CIRCUITS: Record<string, StellarBundledZkCircuitDefinition>;
123
+ declare function optionalZkArtifactBaseUrl(value: string | undefined): {
124
+ zkArtifactBaseUrl?: string;
125
+ };
126
+
66
127
  interface TransferTemporaryRecipientKey {
67
128
  temporaryScalarHex: string;
68
129
  temporaryPrivateAddressStpl1: string;
69
130
  }
70
- interface TransferOnboardingRecipientNoteInput$1 {
71
- tokenAddress: string;
72
- nullifier: string;
73
- secret: string;
74
- value: string;
131
+ interface TransferEscrowSend {
132
+ nonceDecimal: string;
133
+ recipientHi: string;
134
+ recipientLo: string;
135
+ recipientStellarAddress: string;
136
+ }
137
+ interface TransferEscrowClaimantLimbs {
138
+ recipientHi: string;
139
+ recipientLo: string;
140
+ nonceDecimal?: string;
75
141
  }
76
142
  interface TransferRecipientExecutionContext {
77
143
  recipientPrivateAddressStpl1: string;
78
144
  recipientStellarAddress?: string;
145
+ escrowSend?: TransferEscrowSend;
79
146
  temporaryRecipientKey?: TransferTemporaryRecipientKey;
80
147
  }
81
- interface BuildTransferOnboardingAtExecuteInput {
82
- ownerStellarAddress: string;
83
- temporaryRecipientKey: TransferTemporaryRecipientKey;
84
- recipientNote: TransferOnboardingRecipientNoteInput$1;
85
- }
86
148
  interface StellarKytEnvironment {
87
149
  apiBaseUrl: string;
88
150
  kytPassageRegistryContract: string;
89
151
  registerPassageOnChain?: boolean;
152
+ inspectAuthorization?: string;
90
153
  }
91
154
  interface StellarTransactEnvironment {
92
155
  network: StellarNetworkConfig;
156
+ /**
157
+ * Nonce (persistent storage key) of the pool's `ZkConfig` entry this
158
+ * environment's proofs/circuit shape target. Defaults to `2n` (Commitment
159
+ * V2, 95 public signals) when omitted. Nonce `0` is the retired 93-signal
160
+ * layout and must be passed explicitly.
161
+ */
162
+ zkConfigNonce?: bigint;
163
+ /**
164
+ * Optional nonce-keyed circuit map. Defaults to the SDK bundled 2×2 (nonce 2)
165
+ * and 6×6 (nonce 6) schemes. URL fields are only for a custom/dev circuit.
166
+ */
167
+ zkCircuits?: Record<string, StellarZkCircuitDefinition>;
168
+ /**
169
+ * Directory or HTTP prefix for graph / r1cs / proving-key files.
170
+ * Defaults to the GitHub release for `@arcanetech/stellar-privacy-pool-zk-sdk`.
171
+ * Staging and local stands override this to serve files from disk.
172
+ */
173
+ zkArtifactBaseUrl?: string;
93
174
  auditPublicKey?: AuditPublicKey;
94
175
  kyt: StellarKytEnvironment;
95
176
  signTransaction?: StellarSignTransaction;
@@ -105,14 +186,52 @@ interface StellarTransactEnvironment {
105
186
  recipientStellarAddress: string;
106
187
  walletPublicKey: string;
107
188
  }) => Promise<TransferRecipientExecutionContext>;
108
- buildTransferOnboardingAtExecute?: (input: BuildTransferOnboardingAtExecuteInput) => Promise<OnboardingPayload>;
109
189
  resolveWalletPublicKey?: () => Promise<string>;
110
190
  poolMerkleState?: PoolMerkleStatePort;
111
191
  leafEphemeral?: LeafEphemeralStatePort;
112
192
  }
113
193
 
194
+ type StellarAddress = string;
114
195
  type StellarAssetId = string;
115
196
 
197
+ type StellarTransferIntent = TransferIntent<StellarTransferFromAddress, StellarAssetId, bigint, StellarAddress>;
198
+
199
+ interface StellarPreparedOperation {
200
+ kind: OperationKind;
201
+ intent: DepositIntent<StellarAddress, StellarAssetId, bigint> | StellarTransferIntent | WithdrawIntent<StellarAddress, StellarAssetId, bigint>;
202
+ consumedRecords: StellarPrivateRecord[];
203
+ outputRecords: StellarPrivateRecord[];
204
+ submissionPayload: StellarSubmissionPayload;
205
+ transactArtifacts?: StellarTransactArtifacts;
206
+ }
207
+ interface StellarSubmissionPayload {
208
+ operationId: string;
209
+ signed: boolean;
210
+ txHash?: string;
211
+ }
212
+ interface StellarTransactArtifacts {
213
+ proofHex?: string;
214
+ publicHex?: string;
215
+ ciphertextHex?: string;
216
+ outputNoteEphemeralScalars?: string[];
217
+ applicationIdsPlaintext?: KytApplicationIdHints;
218
+ tokenAddress?: string;
219
+ depositScalarHex?: string;
220
+ precommitementHex?: string;
221
+ commitmentHex?: string;
222
+ walletPublicKey?: string;
223
+ escrowRecipient?: string;
224
+ escrowAuthorization?: string;
225
+ escrowSend?: boolean;
226
+ escrowSpendScalarHex?: string;
227
+ escrowClaimantLimbs?: {
228
+ recipientHi: string;
229
+ recipientLo: string;
230
+ nonceDecimal?: string;
231
+ };
232
+ executeFinalizeRequired?: boolean;
233
+ spendSource?: 'privateAddress' | 'escrow';
234
+ }
116
235
  interface StellarNetworkConfig {
117
236
  id: string;
118
237
  rpcUrl: string;
@@ -123,27 +242,31 @@ interface StellarNetworkConfig {
123
242
  }
124
243
  interface StellarBrowserAssets {
125
244
  sdkWasm: ArrayBuffer;
126
- circuitWasm: ArrayBuffer;
127
- provingKey: ArrayBuffer;
128
245
  }
129
246
 
130
247
  declare class PrivacyPoolService {
131
248
  private readonly assets?;
132
249
  private readonly applicationId?;
133
250
  private readonly auditPublicKey?;
251
+ private readonly zkCircuits?;
252
+ private readonly zkConfigNonce?;
253
+ private readonly zkArtifactBaseUrl?;
134
254
  private sdk;
135
255
  private initPromise;
136
- constructor(assets?: StellarBrowserAssets | undefined, applicationId?: string | undefined, auditPublicKey?: [string, string] | undefined);
256
+ constructor(assets?: StellarBrowserAssets | undefined, applicationId?: string | undefined, auditPublicKey?: [string, string] | undefined, zkCircuits?: Record<string, StellarZkCircuitDefinition> | undefined, zkConfigNonce?: bigint | undefined, zkArtifactBaseUrl?: string | undefined);
137
257
  private ensureInit;
138
258
  getInitializedSdk(): Promise<PrivacyPoolSDK>;
139
259
  getAuditPublicKey(): [string, string] | undefined;
140
260
  getApplicationId(): string;
141
- generatePrivateAddressFromStellarSignature(signature: string): Promise<string>;
261
+ generatePrivateAddressFromStellarSignature(signature: string, domain: SpendScalarDomain): Promise<string>;
142
262
  sharedSecretX(recipientScalarHex: string, ephemeralKeyEncoded: string): Promise<string>;
143
263
  buildAlignedDepositSlot(parameters: {
144
264
  privateAddressStpl1: string;
145
265
  amountStroops: bigint;
146
266
  tokenAddress: string;
267
+ escrowNonce?: string;
268
+ recipientHi?: string;
269
+ recipientLo?: string;
147
270
  }): Promise<AlignedDepositSlot>;
148
271
  createAlignedShieldCoinData(parameters: {
149
272
  privateAddressStpl1: string;
@@ -157,7 +280,7 @@ declare class PrivacyPoolService {
157
280
  merkleRootBytes: Buffer$1;
158
281
  tokenAddress: string;
159
282
  }): Promise<ProofResult>;
160
- calculateNullifierHash(nullifier: string): Promise<string>;
283
+ calculateNullifierHash(nullifier: string, privKeyScalar: string): Promise<string>;
161
284
  prepareWithdrawTransactProof(parameters: {
162
285
  coin: CoinData;
163
286
  state: StateFile;
@@ -186,6 +309,9 @@ declare function createPrivacyPoolService(input?: {
186
309
  assets?: StellarBrowserAssets;
187
310
  applicationId?: string;
188
311
  auditPublicKey?: [string, string];
312
+ zkCircuits?: Record<string, StellarZkCircuitDefinition>;
313
+ zkConfigNonce?: bigint;
314
+ zkArtifactBaseUrl?: string;
189
315
  }): PrivacyPoolService;
190
316
  declare function configurePrivacyPoolService(service: PrivacyPoolService): void;
191
317
  declare function getPrivacyPoolService(): PrivacyPoolService;
@@ -194,28 +320,111 @@ declare function parseAuditPublicKeyFromEnvHex(raw: string): AuditPublicKey;
194
320
  declare function buildPoolTransactionAuditParameters(input: {
195
321
  applicationId: string;
196
322
  auditPublicKey?: AuditPublicKey;
323
+ nAuditSlots?: number;
197
324
  }): TransactionAuditParams;
198
325
  declare function resolvePoolApplicationId(applicationId: string | undefined): string;
199
326
 
200
- type DecodedPrivateAddress = {
201
- x: string;
202
- y: string;
327
+ type BlindedRecipientTagChallengeFields = {
328
+ stellarAddress: string;
329
+ networkPassphrase: string;
330
+ issuedAt: string;
331
+ expiresAt: string;
332
+ nonce: string;
203
333
  };
204
- type PrivateAddressGenerator = (signature: string) => string | Promise<string>;
205
- type PrivateAddressSdk = {
206
- generatePrivateAddressFromStellarSignature: PrivateAddressGenerator;
334
+ declare function buildBlindedRecipientTagChallengeMessage(fields: BlindedRecipientTagChallengeFields): string;
335
+
336
+ type DerivedEscrowRecipient = {
337
+ nonceDecimal: string;
338
+ recipientHi: string;
339
+ recipientLo: string;
340
+ recipientStellarAddress: string;
341
+ privateAddressStpl1: string;
342
+ scalarHex: string;
207
343
  };
208
- declare function buildPrivateAddressSignMessage(publicKey: string, nonce: string): string;
209
- declare function decodePrivateAddress(value: string): DecodedPrivateAddress;
210
- declare function encodePrivateAddress(decoded: DecodedPrivateAddress): string;
211
- declare function encodePrivateAddressFromHexCoordinates(publicKeyXHex: string, publicKeyYHex: string): string;
212
- declare function recipientPublicKeysDecimalFromPrivateAddress(value: string): unknown;
213
- declare function privateAddressSdk(sdk: PrivacyPoolSDK): PrivateAddressSdk;
344
+ type DerivedEscrowKeyFn = (nonce: bigint, recipientHi: bigint, recipientLo: bigint) => Promise<{
345
+ scalarHex: string;
346
+ pointXHex: string;
347
+ pointYHex: string;
348
+ }>;
349
+ declare function deriveEscrowRecipientFromStellarAddress(input: {
350
+ recipientStellarAddress: string;
351
+ nonceDecimal?: string;
352
+ deriveKey?: DerivedEscrowKeyFn;
353
+ }): Promise<DerivedEscrowRecipient>;
354
+
355
+ declare function assertEscrowSweepClaimant(input: {
356
+ walletPublicKey: string;
357
+ claimantAddress: string;
358
+ }): void;
359
+
360
+ type EscrowOutputNoteCiphertextEvent = {
361
+ outputIndex: number;
362
+ commitmentHashHex: string;
363
+ createdEphemeralKey: readonly [string, string];
364
+ ciphertext: readonly string[];
365
+ tag: string;
366
+ };
367
+ type ReconstructedEscrowNote = {
368
+ coin: CoinData;
369
+ scalarHex: string;
370
+ privateAddressStpl1: string;
371
+ recipientHi: string;
372
+ recipientLo: string;
373
+ nonceDecimal: string;
374
+ tokenAddress: string;
375
+ commitmentHex: string;
376
+ };
377
+ type DecryptEscrowOutputNote = (input: {
378
+ recipientScalarHex: string;
379
+ commitmentHashHex: string;
380
+ createdEphemeralKey: readonly [string, string];
381
+ ciphertext: readonly string[];
382
+ tag: string;
383
+ ownerMode?: bigint;
384
+ }) => Promise<{
385
+ value: string;
386
+ assetHi: string;
387
+ assetLo: string;
388
+ nullifier: string;
389
+ secret: string;
390
+ applicationId: string;
391
+ commitmentHex: string;
392
+ commitmentMatches: boolean;
393
+ }>;
394
+ declare function reconstructEscrowNote(input: {
395
+ claimantAddress: string;
396
+ nonceDecimal: string;
397
+ seq: number;
398
+ events: readonly EscrowOutputNoteCiphertextEvent[];
399
+ decrypt?: DecryptEscrowOutputNote;
400
+ deriveKey?: DerivedEscrowKeyFn;
401
+ }): Promise<ReconstructedEscrowNote>;
402
+
403
+ type PrepareEscrowSweepInput = {
404
+ walletPublicKey: string;
405
+ claimantAddress: string;
406
+ registeredPrivateAddress: string;
407
+ reconstructed: ReconstructedEscrowNote;
408
+ poolContract: string;
409
+ asset: string;
410
+ };
411
+ declare function attachEscrowAuthorization(prepared: StellarPreparedOperation, escrowAuthorization: string): StellarPreparedOperation;
412
+ declare function prepareEscrowSweepOperation(input: PrepareEscrowSweepInput): StellarPreparedOperation;
413
+
414
+ declare function fetchEscrowOutputNoteEvents(input: {
415
+ transactEnvironment: StellarTransactEnvironment;
416
+ txId: string;
417
+ poolAddress: string;
418
+ }): Promise<EscrowOutputNoteCiphertextEvent[]>;
419
+
420
+ declare function unsignedEscrowAuthorizationForSweep(input: {
421
+ prepared: StellarPreparedOperation;
422
+ transactEnvironment: StellarTransactEnvironment;
423
+ relayerPublicKey: string;
424
+ }): Promise<string>;
214
425
 
215
426
  interface LoadBrowserAssetsInput {
216
427
  sdkWasmUrl: string;
217
- circuitWasmUrl: string;
218
- provingKeyUrl: string;
219
428
  cacheBust?: boolean;
220
429
  }
221
430
  declare function loadStellarBrowserAssets(input: LoadBrowserAssetsInput): Promise<StellarBrowserAssets>;
@@ -223,30 +432,18 @@ declare function loadDefaultStellarBrowserAssets(options?: {
223
432
  cacheBust?: boolean;
224
433
  }): Promise<StellarBrowserAssets>;
225
434
 
435
+ declare const STANDARD_ZK_CONFIG_NONCE = 0n;
436
+ declare const COMMITMENT_V2_ZK_NONCE = 2n;
437
+ declare const SIX_BY_SIX_ZK_NONCE = 6n;
438
+ declare const DEFAULT_ZK_CONFIG_NONCE = 3n;
439
+ declare function resolveZkConfigNonce(transactEnvironment: StellarTransactEnvironment): bigint;
440
+
441
+ declare function generateRandomDepositScalarHex(): Promise<string>;
226
442
  declare function generateTemporaryRecipientPrivateAddress(): Promise<{
227
443
  temporaryScalarHex: string;
228
444
  temporaryPrivateAddressStpl1: string;
229
445
  }>;
230
446
 
231
- type TransferOnboardingRecipientNoteInput = {
232
- tokenAddress: string;
233
- nullifier: string;
234
- secret: string;
235
- value: string;
236
- };
237
- type TemporaryRecipientKeyMaterial = {
238
- temporaryScalarHex: string;
239
- temporaryPrivateAddressStpl1: string;
240
- };
241
- declare function generateRandomDepositScalarHex(): Promise<string>;
242
- declare function buildOnboardingPayload(parameters: {
243
- ownerStellarAddress: string;
244
- temporaryKey: TemporaryRecipientKeyMaterial;
245
- recipientNotes: TransferOnboardingRecipientNoteInput[];
246
- permanentPrivateAddressStpl1?: string;
247
- }): OnboardingPayload;
248
- declare function buildTransferOnboardingAtExecute(input: BuildTransferOnboardingAtExecuteInput): Promise<OnboardingPayload>;
249
-
250
447
  declare class KytInspectError extends Error {
251
448
  readonly reasonCode: string;
252
449
  readonly decisionId?: string;
@@ -282,7 +479,8 @@ interface SubmitSorobanConfidentialTransferInput {
282
479
  walletPublicKey: string;
283
480
  proofHex: string;
284
481
  publicHex: string;
285
- onboarding?: OnboardingPayload;
482
+ ciphertextHex?: string;
483
+ outputNoteEphemeralScalars?: string[];
286
484
  applicationIdsPlaintext?: KytApplicationIdHints;
287
485
  networkPassphrase: string;
288
486
  sorobanRpcUrl: string;
@@ -304,7 +502,6 @@ type PrepareConfidentialTransferProofDualParameters = {
304
502
  coinA: CoinData;
305
503
  coinB: CoinData;
306
504
  state: StateFile;
307
- senderGAddress: string;
308
505
  senderPrivKeyScalarHex: string;
309
506
  ephemeralAKey: string;
310
507
  ephemeralBKey: string;
@@ -312,10 +509,14 @@ type PrepareConfidentialTransferProofDualParameters = {
312
509
  recipientPrivateAddressStpl1: string;
313
510
  selfPrivateAddressStpl1ForChange: string | undefined;
314
511
  tokenAddress: string;
512
+ escrowSend?: TransferEscrowSend;
513
+ escrowClaimantLimbs?: TransferEscrowClaimantLimbs;
315
514
  };
316
515
  type PrepareConfidentialTransferProofDualResult = {
317
516
  proof_hex: string;
318
517
  public_hex: string;
518
+ ciphertext_hex?: string;
519
+ output_note_ephemeral_scalars?: string[];
319
520
  applicationIdsPlaintext: KytApplicationIdHints;
320
521
  recipientCoin: GeneratedOutputCoin;
321
522
  changeCoin?: GeneratedOutputCoin;
@@ -325,17 +526,20 @@ declare function prepareConfidentialTransferProofDual(parameters: PrepareConfide
325
526
  type PrepareConfidentialTransferProofParameters = {
326
527
  coin: CoinData;
327
528
  state: StateFile;
328
- senderGAddress: string;
329
529
  senderPrivKeyScalarHex: string;
330
530
  depositorEphemeralKey: string;
331
531
  transferStroops: bigint;
332
532
  recipientPrivateAddressStpl1: string;
333
533
  selfPrivateAddressStpl1ForChange: string | undefined;
334
534
  tokenAddress: string;
535
+ escrowSend?: TransferEscrowSend;
536
+ escrowClaimantLimbs?: TransferEscrowClaimantLimbs;
335
537
  };
336
538
  type PrepareConfidentialTransferProofResult = {
337
539
  proof_hex: string;
338
540
  public_hex: string;
541
+ ciphertext_hex?: string;
542
+ output_note_ephemeral_scalars?: string[];
339
543
  applicationIdsPlaintext: KytApplicationIdHints;
340
544
  recipientCoin: GeneratedOutputCoin;
341
545
  changeCoin?: GeneratedOutputCoin;
@@ -378,7 +582,8 @@ interface RequestKytPassageForPoolInteractionInput {
378
582
  poolContract: string;
379
583
  proofHex: string;
380
584
  publicHex: string;
381
- onboarding?: OnboardingPayload;
585
+ ciphertextHex?: string;
586
+ outputNoteEphemeralScalars?: string[];
382
587
  decryptedAuditSlots?: DecryptedKytAuditSlot[];
383
588
  applicationIdsPlaintext?: KytApplicationIdHints;
384
589
  networkPassphrase: string;
@@ -396,4 +601,106 @@ declare function runTtlPreflight(assembledTransaction: unknown): Promise<void>;
396
601
 
397
602
  declare function attachPoolStatePorts(transactEnvironment: StellarTransactEnvironment | undefined, state: StateBridgeAdapter): StellarTransactEnvironment | undefined;
398
603
 
399
- export { type AlignedDepositSlot, type BuildTransferOnboardingAtExecuteInput, type KytApplicationIdHints, KytInspectError, type LoadBrowserAssetsInput, MIN_CONFIDENTIAL_TRANSFER_STROOPS, PrivacyPoolService, type ProofResult, type ProofWithChange, type RequestKytPassageForPoolInteractionInput, type StellarKytEnvironment, type StellarTransactEnvironment, type TemporaryRecipientKeyMaterial, type TransferOnboardingRecipientNoteInput$1 as TransferOnboardingRecipientNoteInput, type TransferRecipientExecutionContext, type TransferTemporaryRecipientKey, ZERO_STROOPS, assetLegToTokenAddress, attachPoolStatePorts, buildOnboardingPayload, buildPoolTransactionAuditParameters, buildPrivateAddressSignMessage, buildTransferOnboardingAtExecute, configurePrivacyPoolService, createPrivacyPoolService, decodePrivateAddress, encodePrivateAddress, encodePrivateAddressFromHexCoordinates, fetchAndMergeMerkleState, frDecimalToPaddedBytes32, generateRandomDepositScalarHex, generateTemporaryRecipientPrivateAddress, getPrivacyPoolService, loadDefaultStellarBrowserAssets, loadStellarBrowserAssets, parseAuditPublicKeyFromEnvHex, parseKytReasonCode, prepareConfidentialTransferProof, prepareConfidentialTransferProofDual, privateAddressSdk, readLeafEphemeralHex, recipientPublicKeysDecimalFromPrivateAddress, requestKytPassageForPoolInteraction, resolvePoolApplicationId, runTtlPreflight, submitSorobanConfidentialTransfer, submitSorobanDeposit, tokenAddressToAssetLeg };
604
+ declare function finalizeSpendOperationAtExecute(prepared: StellarPreparedOperation, environment: StellarTransactEnvironment, poolService: PrivacyPoolService): Promise<StellarPreparedOperation>;
605
+
606
+ declare const RELAY_TRANSACT_PACKAGE_VERSION_V1 = 1;
607
+ declare const RELAY_TRANSACT_SUPPORTED_SIGNAL_COUNT = 93;
608
+ declare const RELAY_TRANSACT_FIELD_BYTES = 32;
609
+ declare const RELAY_TRANSACT_SIGNAL_PREFIX_BYTES = 4;
610
+ declare const RELAY_SIGNAL_INDEX_NULLIFIER_0 = 0;
611
+ declare const RELAY_SIGNAL_INDEX_NULLIFIER_1 = 1;
612
+ declare const RELAY_SIGNAL_INDEX_STATE_ROOT = 82;
613
+ declare const RELAY_SIGNAL_INDEX_WITHDRAW_ADDRESS_HI = 83;
614
+ declare const RELAY_SIGNAL_INDEX_WITHDRAW_ADDRESS_LO = 84;
615
+ declare const RELAY_SIGNAL_INDEX_ESCROW_RECIPIENT_HI = 85;
616
+ declare const RELAY_SIGNAL_INDEX_ESCROW_RECIPIENT_LO = 86;
617
+ declare const RELAY_SIGNAL_INDEX_PUBLIC_WITHDRAWAL_ASSET_HI = 87;
618
+ declare const RELAY_SIGNAL_INDEX_PUBLIC_WITHDRAWAL_ASSET_LO = 88;
619
+ declare const RELAY_SIGNAL_INDEX_PUBLIC_DEPOSIT_ASSET_HI = 89;
620
+ declare const RELAY_SIGNAL_INDEX_PUBLIC_DEPOSIT_ASSET_LO = 90;
621
+ declare const RELAY_SIGNAL_INDEX_PUBLIC_DEPOSIT = 91;
622
+ declare const RELAY_SIGNAL_INDEX_PUBLIC_WITHDRAWAL = 92;
623
+
624
+ type RelayTransactPackageVersion = typeof RELAY_TRANSACT_PACKAGE_VERSION_V1;
625
+ type RelayKeyVersionHints = [
626
+ number | undefined,
627
+ number | undefined,
628
+ number | undefined,
629
+ number | undefined
630
+ ];
631
+ type RelayTransactPackageV1 = {
632
+ version: RelayTransactPackageVersion;
633
+ poolSelector: string;
634
+ zkConfigNonce: bigint;
635
+ proofBytes: string;
636
+ publicSignals: string;
637
+ ciphertextBytes?: string;
638
+ outputNoteEphemeralScalars?: string[];
639
+ applicationIdHints: KytApplicationIdHints;
640
+ escrowAuthorization?: string;
641
+ keyVersionHints?: RelayKeyVersionHints;
642
+ };
643
+ type PrepareRelayTransactPackageInput = {
644
+ poolSelector: string;
645
+ proofBytes: string;
646
+ publicSignals: string;
647
+ ciphertextBytes?: string;
648
+ outputNoteEphemeralScalars?: string[];
649
+ applicationIdHints: KytApplicationIdHints;
650
+ zkConfigNonce?: bigint;
651
+ escrowAuthorization?: string;
652
+ keyVersionHints?: RelayKeyVersionHints;
653
+ };
654
+
655
+ declare function prepareRelayTransactPackage(input: PrepareRelayTransactPackageInput): RelayTransactPackageV1;
656
+
657
+ type PrepareRelayTransactPackageFromPreparedInput = {
658
+ prepared: StellarPreparedOperation;
659
+ poolSelector: string;
660
+ zkConfigNonce?: bigint;
661
+ keyVersionHints?: RelayKeyVersionHints;
662
+ };
663
+ declare function prepareRelayTransactPackageFromPrepared(input: PrepareRelayTransactPackageFromPreparedInput): RelayTransactPackageV1;
664
+
665
+ type RelayTransactPublicLegContext = {
666
+ stateRoot: string;
667
+ withdrawAddressHi: string;
668
+ withdrawAddressLo: string;
669
+ escrowRecipientHi: string;
670
+ escrowRecipientLo: string;
671
+ publicWithdrawalAssetHi: string;
672
+ publicWithdrawalAssetLo: string;
673
+ publicDepositAssetHi: string;
674
+ publicDepositAssetLo: string;
675
+ publicDepositAmount: string;
676
+ publicWithdrawalAmount: string;
677
+ };
678
+ type RelayTransactSupportedProfile = {
679
+ orderedNullifiers: [string, string];
680
+ publicLegContext: RelayTransactPublicLegContext;
681
+ };
682
+ declare function readRelayTransactSupportedProfile(prepared: RelayTransactPackageV1): RelayTransactSupportedProfile;
683
+
684
+ declare const SUBMISSION_METHOD: {
685
+ readonly direct: "direct";
686
+ readonly relay: "relay";
687
+ };
688
+ type SubmissionMethod = (typeof SUBMISSION_METHOD)[keyof typeof SUBMISSION_METHOD];
689
+ declare const ESCROW_SUBMISSION_REFUSAL: {
690
+ readonly positivePublicDeposit: "escrow_positive_public_deposit";
691
+ };
692
+ type EscrowSubmissionRefusal = (typeof ESCROW_SUBMISSION_REFUSAL)[keyof typeof ESCROW_SUBMISSION_REFUSAL];
693
+ type RequiredSubmissionMethodResult = {
694
+ method: SubmissionMethod;
695
+ } | {
696
+ refused: EscrowSubmissionRefusal;
697
+ };
698
+ declare class EscrowSubmissionRefusedError extends Error {
699
+ readonly reason: EscrowSubmissionRefusal;
700
+ constructor(reason: EscrowSubmissionRefusal);
701
+ }
702
+ declare function isEscrowPreparedOperation(prepared: StellarPreparedOperation): boolean;
703
+ declare function evaluateRequiredSubmissionMethod(prepared: StellarPreparedOperation, zkConfigNonce?: bigint): RequiredSubmissionMethodResult;
704
+ declare function requiredSubmissionMethod(prepared: StellarPreparedOperation, zkConfigNonce?: bigint): SubmissionMethod;
705
+
706
+ export { type AlignedDepositSlot, type BlindedRecipientTagChallengeFields, COMMITMENT_V2_ZK_NONCE, DEFAULT_STELLAR_ZK_CIRCUITS, DEFAULT_ZK_CONFIG_NONCE, ESCROW_SUBMISSION_REFUSAL, type EscrowOutputNoteCiphertextEvent, type EscrowSubmissionRefusal, EscrowSubmissionRefusedError, type KytApplicationIdHints, KytInspectError, type LoadBrowserAssetsInput, MIN_CONFIDENTIAL_TRANSFER_STROOPS, type PrepareRelayTransactPackageFromPreparedInput, type PrepareRelayTransactPackageInput, PrivacyPoolService, type ProofResult, type ProofWithChange, RELAY_SIGNAL_INDEX_ESCROW_RECIPIENT_HI, RELAY_SIGNAL_INDEX_ESCROW_RECIPIENT_LO, RELAY_SIGNAL_INDEX_NULLIFIER_0, RELAY_SIGNAL_INDEX_NULLIFIER_1, RELAY_SIGNAL_INDEX_PUBLIC_DEPOSIT, RELAY_SIGNAL_INDEX_PUBLIC_DEPOSIT_ASSET_HI, RELAY_SIGNAL_INDEX_PUBLIC_DEPOSIT_ASSET_LO, RELAY_SIGNAL_INDEX_PUBLIC_WITHDRAWAL, RELAY_SIGNAL_INDEX_PUBLIC_WITHDRAWAL_ASSET_HI, RELAY_SIGNAL_INDEX_PUBLIC_WITHDRAWAL_ASSET_LO, RELAY_SIGNAL_INDEX_STATE_ROOT, RELAY_SIGNAL_INDEX_WITHDRAW_ADDRESS_HI, RELAY_SIGNAL_INDEX_WITHDRAW_ADDRESS_LO, RELAY_TRANSACT_FIELD_BYTES, RELAY_TRANSACT_PACKAGE_VERSION_V1, RELAY_TRANSACT_SIGNAL_PREFIX_BYTES, RELAY_TRANSACT_SUPPORTED_SIGNAL_COUNT, type ReconstructedEscrowNote, type RelayKeyVersionHints, type RelayTransactPackageV1, type RelayTransactPackageVersion, type RelayTransactPublicLegContext, type RelayTransactSupportedProfile, type RequestKytPassageForPoolInteractionInput, type RequiredSubmissionMethodResult, SIX_BY_SIX_ZK_NONCE, STANDARD_ZK_CONFIG_NONCE, SUBMISSION_METHOD, type StellarBundledZkCircuitDefinition, type StellarCustomZkCircuitDefinition, type StellarKytEnvironment, type StellarTransactEnvironment, type StellarZkCircuitDefinition, type SubmissionMethod, type TransferEscrowClaimantLimbs, type TransferEscrowSend, type TransferRecipientExecutionContext, type TransferTemporaryRecipientKey, ZERO_STROOPS, assertEscrowSweepClaimant, assetLegToTokenAddress, attachEscrowAuthorization, attachPoolStatePorts, buildBlindedRecipientTagChallengeMessage, buildPoolTransactionAuditParameters, buildPrivateAddressSignMessage, configurePrivacyPoolService, createPrivacyPoolService, decodePrivateAddress, deriveEscrowRecipientFromStellarAddress, encodePrivateAddress, encodePrivateAddressFromHexCoordinates, evaluateRequiredSubmissionMethod, fetchAndMergeMerkleState, fetchEscrowOutputNoteEvents, finalizeSpendOperationAtExecute, frDecimalToPaddedBytes32, generateRandomDepositScalarHex, generateTemporaryRecipientPrivateAddress, getPrivacyPoolService, isEscrowPreparedOperation, loadDefaultStellarBrowserAssets, loadStellarBrowserAssets, optionalZkArtifactBaseUrl, parseAuditPublicKeyFromEnvHex, parseKytReasonCode, prepareConfidentialTransferProof, prepareConfidentialTransferProofDual, prepareEscrowSweepOperation, prepareRelayTransactPackage, prepareRelayTransactPackageFromPrepared, privateAddressSdk, readLeafEphemeralHex, readRelayTransactSupportedProfile, recipientPublicKeysDecimalFromPrivateAddress, reconstructEscrowNote, requestKytPassageForPoolInteraction, requiredSubmissionMethod, resolvePoolApplicationId, resolveZkConfigNonce, runTtlPreflight, submitSorobanConfidentialTransfer, submitSorobanDeposit, tokenAddressToAssetLeg, unsignedEscrowAuthorizationForSweep };