@arcanetech/privacy-sdk-stellar 0.3.0 → 0.5.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.
@@ -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,39 +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;
93
156
  /**
94
157
  * Nonce (persistent storage key) of the pool's `ZkConfig` entry this
95
- * environment's proofs/circuit shape target. Defaults to `0n` (the
96
- * standard circuit) when omitted.
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.
97
161
  */
98
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;
99
174
  auditPublicKey?: AuditPublicKey;
100
175
  kyt: StellarKytEnvironment;
101
176
  signTransaction?: StellarSignTransaction;
@@ -111,14 +186,52 @@ interface StellarTransactEnvironment {
111
186
  recipientStellarAddress: string;
112
187
  walletPublicKey: string;
113
188
  }) => Promise<TransferRecipientExecutionContext>;
114
- buildTransferOnboardingAtExecute?: (input: BuildTransferOnboardingAtExecuteInput) => Promise<OnboardingPayload>;
115
189
  resolveWalletPublicKey?: () => Promise<string>;
116
190
  poolMerkleState?: PoolMerkleStatePort;
117
191
  leafEphemeral?: LeafEphemeralStatePort;
118
192
  }
119
193
 
194
+ type StellarAddress = string;
120
195
  type StellarAssetId = string;
121
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
+ }
122
235
  interface StellarNetworkConfig {
123
236
  id: string;
124
237
  rpcUrl: string;
@@ -129,27 +242,31 @@ interface StellarNetworkConfig {
129
242
  }
130
243
  interface StellarBrowserAssets {
131
244
  sdkWasm: ArrayBuffer;
132
- circuitWasm: ArrayBuffer;
133
- provingKey: ArrayBuffer;
134
245
  }
135
246
 
136
247
  declare class PrivacyPoolService {
137
248
  private readonly assets?;
138
249
  private readonly applicationId?;
139
250
  private readonly auditPublicKey?;
251
+ private readonly zkCircuits?;
252
+ private readonly zkConfigNonce?;
253
+ private readonly zkArtifactBaseUrl?;
140
254
  private sdk;
141
255
  private initPromise;
142
- 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);
143
257
  private ensureInit;
144
258
  getInitializedSdk(): Promise<PrivacyPoolSDK>;
145
259
  getAuditPublicKey(): [string, string] | undefined;
146
260
  getApplicationId(): string;
147
- generatePrivateAddressFromStellarSignature(signature: string): Promise<string>;
261
+ generatePrivateAddressFromStellarSignature(signature: string, domain: SpendScalarDomain): Promise<string>;
148
262
  sharedSecretX(recipientScalarHex: string, ephemeralKeyEncoded: string): Promise<string>;
149
263
  buildAlignedDepositSlot(parameters: {
150
264
  privateAddressStpl1: string;
151
265
  amountStroops: bigint;
152
266
  tokenAddress: string;
267
+ escrowNonce?: string;
268
+ recipientHi?: string;
269
+ recipientLo?: string;
153
270
  }): Promise<AlignedDepositSlot>;
154
271
  createAlignedShieldCoinData(parameters: {
155
272
  privateAddressStpl1: string;
@@ -163,7 +280,7 @@ declare class PrivacyPoolService {
163
280
  merkleRootBytes: Buffer$1;
164
281
  tokenAddress: string;
165
282
  }): Promise<ProofResult>;
166
- calculateNullifierHash(nullifier: string): Promise<string>;
283
+ calculateNullifierHash(nullifier: string, privKeyScalar: string): Promise<string>;
167
284
  prepareWithdrawTransactProof(parameters: {
168
285
  coin: CoinData;
169
286
  state: StateFile;
@@ -192,6 +309,9 @@ declare function createPrivacyPoolService(input?: {
192
309
  assets?: StellarBrowserAssets;
193
310
  applicationId?: string;
194
311
  auditPublicKey?: [string, string];
312
+ zkCircuits?: Record<string, StellarZkCircuitDefinition>;
313
+ zkConfigNonce?: bigint;
314
+ zkArtifactBaseUrl?: string;
195
315
  }): PrivacyPoolService;
196
316
  declare function configurePrivacyPoolService(service: PrivacyPoolService): void;
197
317
  declare function getPrivacyPoolService(): PrivacyPoolService;
@@ -200,28 +320,111 @@ declare function parseAuditPublicKeyFromEnvHex(raw: string): AuditPublicKey;
200
320
  declare function buildPoolTransactionAuditParameters(input: {
201
321
  applicationId: string;
202
322
  auditPublicKey?: AuditPublicKey;
323
+ nAuditSlots?: number;
203
324
  }): TransactionAuditParams;
204
325
  declare function resolvePoolApplicationId(applicationId: string | undefined): string;
205
326
 
206
- type DecodedPrivateAddress = {
207
- x: string;
208
- y: string;
327
+ type BlindedRecipientTagChallengeFields = {
328
+ stellarAddress: string;
329
+ networkPassphrase: string;
330
+ issuedAt: string;
331
+ expiresAt: string;
332
+ nonce: string;
209
333
  };
210
- type PrivateAddressGenerator = (signature: string) => string | Promise<string>;
211
- type PrivateAddressSdk = {
212
- 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;
213
343
  };
214
- declare function buildPrivateAddressSignMessage(publicKey: string, nonce: string): string;
215
- declare function decodePrivateAddress(value: string): DecodedPrivateAddress;
216
- declare function encodePrivateAddress(decoded: DecodedPrivateAddress): string;
217
- declare function encodePrivateAddressFromHexCoordinates(publicKeyXHex: string, publicKeyYHex: string): string;
218
- declare function recipientPublicKeysDecimalFromPrivateAddress(value: string): unknown;
219
- 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>;
220
425
 
221
426
  interface LoadBrowserAssetsInput {
222
427
  sdkWasmUrl: string;
223
- circuitWasmUrl: string;
224
- provingKeyUrl: string;
225
428
  cacheBust?: boolean;
226
429
  }
227
430
  declare function loadStellarBrowserAssets(input: LoadBrowserAssetsInput): Promise<StellarBrowserAssets>;
@@ -229,30 +432,18 @@ declare function loadDefaultStellarBrowserAssets(options?: {
229
432
  cacheBust?: boolean;
230
433
  }): Promise<StellarBrowserAssets>;
231
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>;
232
442
  declare function generateTemporaryRecipientPrivateAddress(): Promise<{
233
443
  temporaryScalarHex: string;
234
444
  temporaryPrivateAddressStpl1: string;
235
445
  }>;
236
446
 
237
- type TransferOnboardingRecipientNoteInput = {
238
- tokenAddress: string;
239
- nullifier: string;
240
- secret: string;
241
- value: string;
242
- };
243
- type TemporaryRecipientKeyMaterial = {
244
- temporaryScalarHex: string;
245
- temporaryPrivateAddressStpl1: string;
246
- };
247
- declare function generateRandomDepositScalarHex(): Promise<string>;
248
- declare function buildOnboardingPayload(parameters: {
249
- ownerStellarAddress: string;
250
- temporaryKey: TemporaryRecipientKeyMaterial;
251
- recipientNotes: TransferOnboardingRecipientNoteInput[];
252
- permanentPrivateAddressStpl1?: string;
253
- }): OnboardingPayload;
254
- declare function buildTransferOnboardingAtExecute(input: BuildTransferOnboardingAtExecuteInput): Promise<OnboardingPayload>;
255
-
256
447
  declare class KytInspectError extends Error {
257
448
  readonly reasonCode: string;
258
449
  readonly decisionId?: string;
@@ -288,7 +479,8 @@ interface SubmitSorobanConfidentialTransferInput {
288
479
  walletPublicKey: string;
289
480
  proofHex: string;
290
481
  publicHex: string;
291
- onboarding?: OnboardingPayload;
482
+ ciphertextHex?: string;
483
+ outputNoteEphemeralScalars?: string[];
292
484
  applicationIdsPlaintext?: KytApplicationIdHints;
293
485
  networkPassphrase: string;
294
486
  sorobanRpcUrl: string;
@@ -310,7 +502,6 @@ type PrepareConfidentialTransferProofDualParameters = {
310
502
  coinA: CoinData;
311
503
  coinB: CoinData;
312
504
  state: StateFile;
313
- senderGAddress: string;
314
505
  senderPrivKeyScalarHex: string;
315
506
  ephemeralAKey: string;
316
507
  ephemeralBKey: string;
@@ -318,10 +509,14 @@ type PrepareConfidentialTransferProofDualParameters = {
318
509
  recipientPrivateAddressStpl1: string;
319
510
  selfPrivateAddressStpl1ForChange: string | undefined;
320
511
  tokenAddress: string;
512
+ escrowSend?: TransferEscrowSend;
513
+ escrowClaimantLimbs?: TransferEscrowClaimantLimbs;
321
514
  };
322
515
  type PrepareConfidentialTransferProofDualResult = {
323
516
  proof_hex: string;
324
517
  public_hex: string;
518
+ ciphertext_hex?: string;
519
+ output_note_ephemeral_scalars?: string[];
325
520
  applicationIdsPlaintext: KytApplicationIdHints;
326
521
  recipientCoin: GeneratedOutputCoin;
327
522
  changeCoin?: GeneratedOutputCoin;
@@ -331,17 +526,20 @@ declare function prepareConfidentialTransferProofDual(parameters: PrepareConfide
331
526
  type PrepareConfidentialTransferProofParameters = {
332
527
  coin: CoinData;
333
528
  state: StateFile;
334
- senderGAddress: string;
335
529
  senderPrivKeyScalarHex: string;
336
530
  depositorEphemeralKey: string;
337
531
  transferStroops: bigint;
338
532
  recipientPrivateAddressStpl1: string;
339
533
  selfPrivateAddressStpl1ForChange: string | undefined;
340
534
  tokenAddress: string;
535
+ escrowSend?: TransferEscrowSend;
536
+ escrowClaimantLimbs?: TransferEscrowClaimantLimbs;
341
537
  };
342
538
  type PrepareConfidentialTransferProofResult = {
343
539
  proof_hex: string;
344
540
  public_hex: string;
541
+ ciphertext_hex?: string;
542
+ output_note_ephemeral_scalars?: string[];
345
543
  applicationIdsPlaintext: KytApplicationIdHints;
346
544
  recipientCoin: GeneratedOutputCoin;
347
545
  changeCoin?: GeneratedOutputCoin;
@@ -384,7 +582,8 @@ interface RequestKytPassageForPoolInteractionInput {
384
582
  poolContract: string;
385
583
  proofHex: string;
386
584
  publicHex: string;
387
- onboarding?: OnboardingPayload;
585
+ ciphertextHex?: string;
586
+ outputNoteEphemeralScalars?: string[];
388
587
  decryptedAuditSlots?: DecryptedKytAuditSlot[];
389
588
  applicationIdsPlaintext?: KytApplicationIdHints;
390
589
  networkPassphrase: string;
@@ -402,4 +601,106 @@ declare function runTtlPreflight(assembledTransaction: unknown): Promise<void>;
402
601
 
403
602
  declare function attachPoolStatePorts(transactEnvironment: StellarTransactEnvironment | undefined, state: StateBridgeAdapter): StellarTransactEnvironment | undefined;
404
603
 
405
- 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 };