@arcanetech/privacy-sdk-stellar 0.5.2 → 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 +28 -5
- package/dist/index.js +708 -226
- package/dist/index.js.map +1 -1
- package/dist/node.d.ts +1 -0
- package/dist/node.js +693 -219
- package/dist/node.js.map +1 -1
- package/dist/testing/index.d.ts +1 -0
- package/dist/transact/index.d.ts +28 -5
- package/dist/transact/index.js +677 -217
- 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
|
@@ -232,6 +232,7 @@ interface StellarTransactArtifacts {
|
|
|
232
232
|
};
|
|
233
233
|
executeFinalizeRequired?: boolean;
|
|
234
234
|
spendSource?: 'privateAddress' | 'escrow';
|
|
235
|
+
zkConfigNonce?: bigint;
|
|
235
236
|
}
|
|
236
237
|
interface StellarNetworkConfig {
|
|
237
238
|
id: string;
|
|
@@ -245,6 +246,17 @@ interface StellarBrowserAssets {
|
|
|
245
246
|
sdkWasm: ArrayBuffer;
|
|
246
247
|
}
|
|
247
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
|
+
|
|
248
260
|
declare class PrivacyPoolService {
|
|
249
261
|
private readonly assets?;
|
|
250
262
|
private readonly applicationId?;
|
|
@@ -252,11 +264,12 @@ declare class PrivacyPoolService {
|
|
|
252
264
|
private readonly zkCircuits?;
|
|
253
265
|
private readonly zkConfigNonce?;
|
|
254
266
|
private readonly zkArtifactBaseUrl?;
|
|
255
|
-
private
|
|
256
|
-
private
|
|
267
|
+
private readonly sdks;
|
|
268
|
+
private readonly initPromises;
|
|
257
269
|
constructor(assets?: StellarBrowserAssets | undefined, applicationId?: string | undefined, auditPublicKey?: [string, string] | undefined, zkCircuits?: Record<string, StellarZkCircuitDefinition> | undefined, zkConfigNonce?: bigint | undefined, zkArtifactBaseUrl?: string | undefined);
|
|
258
|
-
|
|
259
|
-
|
|
270
|
+
getInitializedSdk(nonce?: bigint): Promise<PrivacyPoolSDK>;
|
|
271
|
+
feeBearingZkConfigNonce(input: FeeOutputKindInput): bigint;
|
|
272
|
+
private initializeSdk;
|
|
260
273
|
getAuditPublicKey(): [string, string] | undefined;
|
|
261
274
|
getApplicationId(): string;
|
|
262
275
|
generatePrivateAddressFromStellarSignature(signature: string, domain: SpendScalarDomain): Promise<string>;
|
|
@@ -280,6 +293,8 @@ declare class PrivacyPoolService {
|
|
|
280
293
|
depositScalarHex: string;
|
|
281
294
|
merkleRootBytes: Buffer$1;
|
|
282
295
|
tokenAddress: string;
|
|
296
|
+
publicDepositStroops?: bigint;
|
|
297
|
+
feeOutput?: FeeOutputSpec;
|
|
283
298
|
}): Promise<ProofResult>;
|
|
284
299
|
calculateNullifierHash(nullifier: string, privKeyScalar: string): Promise<string>;
|
|
285
300
|
prepareWithdrawTransactProof(parameters: {
|
|
@@ -291,6 +306,7 @@ declare class PrivacyPoolService {
|
|
|
291
306
|
withdrawAmountStroops: bigint;
|
|
292
307
|
changePrivateAddressStpl1: string | undefined;
|
|
293
308
|
tokenAddress: string;
|
|
309
|
+
feeOutput?: FeeOutputSpec;
|
|
294
310
|
}): Promise<ProofWithChange>;
|
|
295
311
|
prepareWithdrawTransactProofDual(parameters: {
|
|
296
312
|
coinA: CoinData;
|
|
@@ -303,6 +319,7 @@ declare class PrivacyPoolService {
|
|
|
303
319
|
withdrawAmountStroops: bigint;
|
|
304
320
|
changePrivateAddressStpl1: string | undefined;
|
|
305
321
|
tokenAddress: string;
|
|
322
|
+
feeOutput?: FeeOutputSpec;
|
|
306
323
|
}): Promise<ProofWithChange>;
|
|
307
324
|
}
|
|
308
325
|
|
|
@@ -435,7 +452,9 @@ declare function loadDefaultStellarBrowserAssets(options?: {
|
|
|
435
452
|
|
|
436
453
|
declare const STANDARD_ZK_CONFIG_NONCE = 0n;
|
|
437
454
|
declare const COMMITMENT_V2_ZK_NONCE = 2n;
|
|
455
|
+
declare const BINDING_ZK_NONCE = 3n;
|
|
438
456
|
declare const SIX_BY_SIX_ZK_NONCE = 6n;
|
|
457
|
+
declare const SIX_BY_SIX_BINDING_ZK_NONCE = 7n;
|
|
439
458
|
declare const DEFAULT_ZK_CONFIG_NONCE = 3n;
|
|
440
459
|
declare function resolveZkConfigNonce(transactEnvironment: StellarTransactEnvironment): bigint;
|
|
441
460
|
|
|
@@ -483,6 +502,7 @@ interface SubmitSorobanConfidentialTransferInput {
|
|
|
483
502
|
ciphertextHex?: string;
|
|
484
503
|
outputNoteEphemeralScalars?: string[];
|
|
485
504
|
applicationIdsPlaintext?: KytApplicationIdHints;
|
|
505
|
+
zkConfigNonce?: bigint;
|
|
486
506
|
networkPassphrase: string;
|
|
487
507
|
sorobanRpcUrl: string;
|
|
488
508
|
transactEnvironment: StellarTransactEnvironment;
|
|
@@ -512,6 +532,7 @@ type PrepareConfidentialTransferProofDualParameters = {
|
|
|
512
532
|
tokenAddress: string;
|
|
513
533
|
escrowSend?: TransferEscrowSend;
|
|
514
534
|
escrowClaimantLimbs?: TransferEscrowClaimantLimbs;
|
|
535
|
+
feeOutput?: FeeOutputSpec;
|
|
515
536
|
};
|
|
516
537
|
type PrepareConfidentialTransferProofDualResult = {
|
|
517
538
|
proof_hex: string;
|
|
@@ -535,6 +556,7 @@ type PrepareConfidentialTransferProofParameters = {
|
|
|
535
556
|
tokenAddress: string;
|
|
536
557
|
escrowSend?: TransferEscrowSend;
|
|
537
558
|
escrowClaimantLimbs?: TransferEscrowClaimantLimbs;
|
|
559
|
+
feeOutput?: FeeOutputSpec;
|
|
538
560
|
};
|
|
539
561
|
type PrepareConfidentialTransferProofResult = {
|
|
540
562
|
proof_hex: string;
|
|
@@ -593,6 +615,7 @@ interface RequestKytPassageForPoolInteractionInput {
|
|
|
593
615
|
outputNoteEphemeralScalars?: string[];
|
|
594
616
|
decryptedAuditSlots?: DecryptedKytAuditSlot[];
|
|
595
617
|
applicationIdsPlaintext?: KytApplicationIdHints;
|
|
618
|
+
zkConfigNonce?: bigint;
|
|
596
619
|
networkPassphrase: string;
|
|
597
620
|
sorobanRpcUrl: string;
|
|
598
621
|
transactEnvironment: StellarTransactEnvironment;
|
|
@@ -710,4 +733,4 @@ declare function isEscrowPreparedOperation(prepared: StellarPreparedOperation):
|
|
|
710
733
|
declare function evaluateRequiredSubmissionMethod(prepared: StellarPreparedOperation, zkConfigNonce?: bigint): RequiredSubmissionMethodResult;
|
|
711
734
|
declare function requiredSubmissionMethod(prepared: StellarPreparedOperation, zkConfigNonce?: bigint): SubmissionMethod;
|
|
712
735
|
|
|
713
|
-
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 };
|