@arcanetech/privacy-sdk-stellar 0.5.1 → 0.5.4
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 +1 -0
- package/dist/index.d.ts +40 -10
- package/dist/index.js +971 -335
- package/dist/index.js.map +1 -1
- package/dist/node.d.ts +7 -5
- package/dist/node.js +947 -319
- package/dist/node.js.map +1 -1
- package/dist/testing/index.d.ts +1 -0
- package/dist/transact/index.d.ts +40 -10
- package/dist/transact/index.js +905 -291
- package/dist/transact/index.js.map +1 -1
- package/package.json +6 -6
package/dist/testing/index.d.ts
CHANGED
package/dist/transact/index.d.ts
CHANGED
|
@@ -155,14 +155,15 @@ interface StellarTransactEnvironment {
|
|
|
155
155
|
network: StellarNetworkConfig;
|
|
156
156
|
/**
|
|
157
157
|
* Nonce (persistent storage key) of the pool's `ZkConfig` entry this
|
|
158
|
-
* environment's proofs/circuit shape target. Defaults to `
|
|
159
|
-
*
|
|
160
|
-
*
|
|
158
|
+
* environment's proofs/circuit shape target. Defaults to `3n` (bundled 2×2
|
|
159
|
+
* binding layout) when omitted. Also bundled: `7n` (6×6). The value must
|
|
160
|
+
* match the on-chain pool config or bootstrap/execute fails with
|
|
161
|
+
* `no zk circuit configured for nonce …`.
|
|
161
162
|
*/
|
|
162
163
|
zkConfigNonce?: bigint;
|
|
163
164
|
/**
|
|
164
|
-
* Optional nonce-keyed circuit map. Defaults to the SDK bundled 2×2 (nonce
|
|
165
|
-
* and 6×6 (nonce
|
|
165
|
+
* Optional nonce-keyed circuit map. Defaults to the SDK bundled 2×2 (nonce 3)
|
|
166
|
+
* and 6×6 (nonce 7) schemes. URL fields are only for a custom/dev circuit.
|
|
166
167
|
*/
|
|
167
168
|
zkCircuits?: Record<string, StellarZkCircuitDefinition>;
|
|
168
169
|
/**
|
|
@@ -231,6 +232,7 @@ interface StellarTransactArtifacts {
|
|
|
231
232
|
};
|
|
232
233
|
executeFinalizeRequired?: boolean;
|
|
233
234
|
spendSource?: 'privateAddress' | 'escrow';
|
|
235
|
+
zkConfigNonce?: bigint;
|
|
234
236
|
}
|
|
235
237
|
interface StellarNetworkConfig {
|
|
236
238
|
id: string;
|
|
@@ -244,6 +246,17 @@ interface StellarBrowserAssets {
|
|
|
244
246
|
sdkWasm: ArrayBuffer;
|
|
245
247
|
}
|
|
246
248
|
|
|
249
|
+
type FeeOutputSpec = {
|
|
250
|
+
requiredFee: bigint;
|
|
251
|
+
feeCollectorPrivateAddress: string;
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
type FeeOutputKindInput = {
|
|
255
|
+
kind: OperationKind;
|
|
256
|
+
spendSource?: StellarTransactArtifacts['spendSource'];
|
|
257
|
+
escrowSend?: boolean;
|
|
258
|
+
};
|
|
259
|
+
|
|
247
260
|
declare class PrivacyPoolService {
|
|
248
261
|
private readonly assets?;
|
|
249
262
|
private readonly applicationId?;
|
|
@@ -251,11 +264,12 @@ declare class PrivacyPoolService {
|
|
|
251
264
|
private readonly zkCircuits?;
|
|
252
265
|
private readonly zkConfigNonce?;
|
|
253
266
|
private readonly zkArtifactBaseUrl?;
|
|
254
|
-
private
|
|
255
|
-
private
|
|
267
|
+
private readonly sdks;
|
|
268
|
+
private readonly initPromises;
|
|
256
269
|
constructor(assets?: StellarBrowserAssets | undefined, applicationId?: string | undefined, auditPublicKey?: [string, string] | undefined, zkCircuits?: Record<string, StellarZkCircuitDefinition> | undefined, zkConfigNonce?: bigint | undefined, zkArtifactBaseUrl?: string | undefined);
|
|
257
|
-
|
|
258
|
-
|
|
270
|
+
getInitializedSdk(nonce?: bigint): Promise<PrivacyPoolSDK>;
|
|
271
|
+
feeBearingZkConfigNonce(input: FeeOutputKindInput): bigint;
|
|
272
|
+
private initializeSdk;
|
|
259
273
|
getAuditPublicKey(): [string, string] | undefined;
|
|
260
274
|
getApplicationId(): string;
|
|
261
275
|
generatePrivateAddressFromStellarSignature(signature: string, domain: SpendScalarDomain): Promise<string>;
|
|
@@ -279,6 +293,8 @@ declare class PrivacyPoolService {
|
|
|
279
293
|
depositScalarHex: string;
|
|
280
294
|
merkleRootBytes: Buffer$1;
|
|
281
295
|
tokenAddress: string;
|
|
296
|
+
publicDepositStroops?: bigint;
|
|
297
|
+
feeOutput?: FeeOutputSpec;
|
|
282
298
|
}): Promise<ProofResult>;
|
|
283
299
|
calculateNullifierHash(nullifier: string, privKeyScalar: string): Promise<string>;
|
|
284
300
|
prepareWithdrawTransactProof(parameters: {
|
|
@@ -290,6 +306,7 @@ declare class PrivacyPoolService {
|
|
|
290
306
|
withdrawAmountStroops: bigint;
|
|
291
307
|
changePrivateAddressStpl1: string | undefined;
|
|
292
308
|
tokenAddress: string;
|
|
309
|
+
feeOutput?: FeeOutputSpec;
|
|
293
310
|
}): Promise<ProofWithChange>;
|
|
294
311
|
prepareWithdrawTransactProofDual(parameters: {
|
|
295
312
|
coinA: CoinData;
|
|
@@ -302,6 +319,7 @@ declare class PrivacyPoolService {
|
|
|
302
319
|
withdrawAmountStroops: bigint;
|
|
303
320
|
changePrivateAddressStpl1: string | undefined;
|
|
304
321
|
tokenAddress: string;
|
|
322
|
+
feeOutput?: FeeOutputSpec;
|
|
305
323
|
}): Promise<ProofWithChange>;
|
|
306
324
|
}
|
|
307
325
|
|
|
@@ -434,7 +452,9 @@ declare function loadDefaultStellarBrowserAssets(options?: {
|
|
|
434
452
|
|
|
435
453
|
declare const STANDARD_ZK_CONFIG_NONCE = 0n;
|
|
436
454
|
declare const COMMITMENT_V2_ZK_NONCE = 2n;
|
|
455
|
+
declare const BINDING_ZK_NONCE = 3n;
|
|
437
456
|
declare const SIX_BY_SIX_ZK_NONCE = 6n;
|
|
457
|
+
declare const SIX_BY_SIX_BINDING_ZK_NONCE = 7n;
|
|
438
458
|
declare const DEFAULT_ZK_CONFIG_NONCE = 3n;
|
|
439
459
|
declare function resolveZkConfigNonce(transactEnvironment: StellarTransactEnvironment): bigint;
|
|
440
460
|
|
|
@@ -482,6 +502,7 @@ interface SubmitSorobanConfidentialTransferInput {
|
|
|
482
502
|
ciphertextHex?: string;
|
|
483
503
|
outputNoteEphemeralScalars?: string[];
|
|
484
504
|
applicationIdsPlaintext?: KytApplicationIdHints;
|
|
505
|
+
zkConfigNonce?: bigint;
|
|
485
506
|
networkPassphrase: string;
|
|
486
507
|
sorobanRpcUrl: string;
|
|
487
508
|
transactEnvironment: StellarTransactEnvironment;
|
|
@@ -511,6 +532,7 @@ type PrepareConfidentialTransferProofDualParameters = {
|
|
|
511
532
|
tokenAddress: string;
|
|
512
533
|
escrowSend?: TransferEscrowSend;
|
|
513
534
|
escrowClaimantLimbs?: TransferEscrowClaimantLimbs;
|
|
535
|
+
feeOutput?: FeeOutputSpec;
|
|
514
536
|
};
|
|
515
537
|
type PrepareConfidentialTransferProofDualResult = {
|
|
516
538
|
proof_hex: string;
|
|
@@ -534,6 +556,7 @@ type PrepareConfidentialTransferProofParameters = {
|
|
|
534
556
|
tokenAddress: string;
|
|
535
557
|
escrowSend?: TransferEscrowSend;
|
|
536
558
|
escrowClaimantLimbs?: TransferEscrowClaimantLimbs;
|
|
559
|
+
feeOutput?: FeeOutputSpec;
|
|
537
560
|
};
|
|
538
561
|
type PrepareConfidentialTransferProofResult = {
|
|
539
562
|
proof_hex: string;
|
|
@@ -552,6 +575,12 @@ interface FetchContractMerkleResult {
|
|
|
552
575
|
merkleRootHex: string;
|
|
553
576
|
updatedAt: number;
|
|
554
577
|
}
|
|
578
|
+
/**
|
|
579
|
+
* Loads pool Merkle leaves without `get_commitments()`. That helper walks the
|
|
580
|
+
* whole tree in one simulate and exceeds the Soroban host budget on a live
|
|
581
|
+
* stand. Completes the cached prefix from persistent `TreeDataKey::Leaf`
|
|
582
|
+
* ledger entries instead.
|
|
583
|
+
*/
|
|
555
584
|
declare function fetchAndMergeMerkleState(parameters: {
|
|
556
585
|
poolContractId: string;
|
|
557
586
|
walletPublicKey: string;
|
|
@@ -586,6 +615,7 @@ interface RequestKytPassageForPoolInteractionInput {
|
|
|
586
615
|
outputNoteEphemeralScalars?: string[];
|
|
587
616
|
decryptedAuditSlots?: DecryptedKytAuditSlot[];
|
|
588
617
|
applicationIdsPlaintext?: KytApplicationIdHints;
|
|
618
|
+
zkConfigNonce?: bigint;
|
|
589
619
|
networkPassphrase: string;
|
|
590
620
|
sorobanRpcUrl: string;
|
|
591
621
|
transactEnvironment: StellarTransactEnvironment;
|
|
@@ -703,4 +733,4 @@ declare function isEscrowPreparedOperation(prepared: StellarPreparedOperation):
|
|
|
703
733
|
declare function evaluateRequiredSubmissionMethod(prepared: StellarPreparedOperation, zkConfigNonce?: bigint): RequiredSubmissionMethodResult;
|
|
704
734
|
declare function requiredSubmissionMethod(prepared: StellarPreparedOperation, zkConfigNonce?: bigint): SubmissionMethod;
|
|
705
735
|
|
|
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 };
|
|
736
|
+
export { type AlignedDepositSlot, BINDING_ZK_NONCE, 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_BINDING_ZK_NONCE, 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 };
|