@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 CHANGED
@@ -16,6 +16,7 @@ This package provides:
16
16
  - `buildBlindedRecipientTagChallengeMessage()` (`@arcanetech/privacy-sdk-stellar/transact`) — builds the wallet-signed challenge used to issue blinded recipient tags so a recipient can discover escrow notes after they register
17
17
  - `fetchEscrowOutputNoteEvents({ transactEnvironment, txId, poolAddress })` — loads escrow output-note ciphertexts for a claim using the environment's network configuration
18
18
  - `unsignedEscrowAuthorizationForSweep({ prepared, transactEnvironment, relayerPublicKey })` — simulates the relayer invocation and returns the unsigned claimant authorization entry to sign offline
19
+ - Protocol fee: deposit, transfer, and withdraw quote Required Fee and attach a private Fee Output (2×2 for deposit/withdraw, 6×6 for transfer with change). Escrow sweep does not attach a Fee Output.
19
20
 
20
21
  ## Browser Example
21
22
 
package/dist/index.d.ts CHANGED
@@ -308,6 +308,7 @@ interface StellarTransactArtifacts {
308
308
  };
309
309
  executeFinalizeRequired?: boolean;
310
310
  spendSource?: 'privateAddress' | 'escrow';
311
+ zkConfigNonce?: bigint;
311
312
  }
312
313
  interface StellarOperationReceipt {
313
314
  operationId: string;
@@ -772,6 +773,17 @@ declare function encodePrivateAddressFromHexCoordinates(publicKeyXHex: string, p
772
773
  declare function recipientPublicKeysDecimalFromPrivateAddress(value: string): unknown;
773
774
  declare function privateAddressSdk(sdk: PrivacyPoolSDK): PrivateAddressSdk;
774
775
 
776
+ type FeeOutputSpec = {
777
+ requiredFee: bigint;
778
+ feeCollectorPrivateAddress: string;
779
+ };
780
+
781
+ type FeeOutputKindInput = {
782
+ kind: OperationKind;
783
+ spendSource?: StellarTransactArtifacts['spendSource'];
784
+ escrowSend?: boolean;
785
+ };
786
+
775
787
  declare class PrivacyPoolService {
776
788
  private readonly assets?;
777
789
  private readonly applicationId?;
@@ -779,11 +791,12 @@ declare class PrivacyPoolService {
779
791
  private readonly zkCircuits?;
780
792
  private readonly zkConfigNonce?;
781
793
  private readonly zkArtifactBaseUrl?;
782
- private sdk;
783
- private initPromise;
794
+ private readonly sdks;
795
+ private readonly initPromises;
784
796
  constructor(assets?: StellarBrowserAssets | undefined, applicationId?: string | undefined, auditPublicKey?: [string, string] | undefined, zkCircuits?: Record<string, StellarZkCircuitDefinition> | undefined, zkConfigNonce?: bigint | undefined, zkArtifactBaseUrl?: string | undefined);
785
- private ensureInit;
786
- getInitializedSdk(): Promise<PrivacyPoolSDK>;
797
+ getInitializedSdk(nonce?: bigint): Promise<PrivacyPoolSDK>;
798
+ feeBearingZkConfigNonce(input: FeeOutputKindInput): bigint;
799
+ private initializeSdk;
787
800
  getAuditPublicKey(): [string, string] | undefined;
788
801
  getApplicationId(): string;
789
802
  generatePrivateAddressFromStellarSignature(signature: string, domain: SpendScalarDomain): Promise<string>;
@@ -807,6 +820,8 @@ declare class PrivacyPoolService {
807
820
  depositScalarHex: string;
808
821
  merkleRootBytes: Buffer$1;
809
822
  tokenAddress: string;
823
+ publicDepositStroops?: bigint;
824
+ feeOutput?: FeeOutputSpec;
810
825
  }): Promise<ProofResult>;
811
826
  calculateNullifierHash(nullifier: string, privKeyScalar: string): Promise<string>;
812
827
  prepareWithdrawTransactProof(parameters: {
@@ -818,6 +833,7 @@ declare class PrivacyPoolService {
818
833
  withdrawAmountStroops: bigint;
819
834
  changePrivateAddressStpl1: string | undefined;
820
835
  tokenAddress: string;
836
+ feeOutput?: FeeOutputSpec;
821
837
  }): Promise<ProofWithChange>;
822
838
  prepareWithdrawTransactProofDual(parameters: {
823
839
  coinA: CoinData;
@@ -830,6 +846,7 @@ declare class PrivacyPoolService {
830
846
  withdrawAmountStroops: bigint;
831
847
  changePrivateAddressStpl1: string | undefined;
832
848
  tokenAddress: string;
849
+ feeOutput?: FeeOutputSpec;
833
850
  }): Promise<ProofWithChange>;
834
851
  }
835
852
 
@@ -962,7 +979,9 @@ declare function loadDefaultStellarBrowserAssets(options?: {
962
979
 
963
980
  declare const STANDARD_ZK_CONFIG_NONCE = 0n;
964
981
  declare const COMMITMENT_V2_ZK_NONCE = 2n;
982
+ declare const BINDING_ZK_NONCE = 3n;
965
983
  declare const SIX_BY_SIX_ZK_NONCE = 6n;
984
+ declare const SIX_BY_SIX_BINDING_ZK_NONCE = 7n;
966
985
  declare const DEFAULT_ZK_CONFIG_NONCE = 3n;
967
986
  declare function resolveZkConfigNonce(transactEnvironment: StellarTransactEnvironment): bigint;
968
987
 
@@ -1010,6 +1029,7 @@ interface SubmitSorobanConfidentialTransferInput {
1010
1029
  ciphertextHex?: string;
1011
1030
  outputNoteEphemeralScalars?: string[];
1012
1031
  applicationIdsPlaintext?: KytApplicationIdHints;
1032
+ zkConfigNonce?: bigint;
1013
1033
  networkPassphrase: string;
1014
1034
  sorobanRpcUrl: string;
1015
1035
  transactEnvironment: StellarTransactEnvironment;
@@ -1039,6 +1059,7 @@ type PrepareConfidentialTransferProofDualParameters = {
1039
1059
  tokenAddress: string;
1040
1060
  escrowSend?: TransferEscrowSend;
1041
1061
  escrowClaimantLimbs?: TransferEscrowClaimantLimbs;
1062
+ feeOutput?: FeeOutputSpec;
1042
1063
  };
1043
1064
  type PrepareConfidentialTransferProofDualResult = {
1044
1065
  proof_hex: string;
@@ -1062,6 +1083,7 @@ type PrepareConfidentialTransferProofParameters = {
1062
1083
  tokenAddress: string;
1063
1084
  escrowSend?: TransferEscrowSend;
1064
1085
  escrowClaimantLimbs?: TransferEscrowClaimantLimbs;
1086
+ feeOutput?: FeeOutputSpec;
1065
1087
  };
1066
1088
  type PrepareConfidentialTransferProofResult = {
1067
1089
  proof_hex: string;
@@ -1091,6 +1113,7 @@ interface RequestKytPassageForPoolInteractionInput {
1091
1113
  outputNoteEphemeralScalars?: string[];
1092
1114
  decryptedAuditSlots?: DecryptedKytAuditSlot[];
1093
1115
  applicationIdsPlaintext?: KytApplicationIdHints;
1116
+ zkConfigNonce?: bigint;
1094
1117
  networkPassphrase: string;
1095
1118
  sorobanRpcUrl: string;
1096
1119
  transactEnvironment: StellarTransactEnvironment;
@@ -1208,4 +1231,4 @@ declare function isEscrowPreparedOperation(prepared: StellarPreparedOperation):
1208
1231
  declare function evaluateRequiredSubmissionMethod(prepared: StellarPreparedOperation, zkConfigNonce?: bigint): RequiredSubmissionMethodResult;
1209
1232
  declare function requiredSubmissionMethod(prepared: StellarPreparedOperation, zkConfigNonce?: bigint): SubmissionMethod;
1210
1233
 
1211
- export { type AlignedDepositSlot, type BlindedRecipientTagChallengeFields, COMMITMENT_V2_ZK_NONCE, type CreateStellarPrivacyClientResult, 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 StellarAddress, type StellarAsset, type StellarAssetId, type StellarAssetsCatalog, type StellarAvailablePrivateRecordsFilter, type StellarBrowserAssets, type StellarBrowserPrivacyClientConfig, type StellarBundledZkCircuitDefinition, type StellarCustomZkCircuitDefinition, type StellarDeliverySyncState, type StellarIncomingDeliveriesFilter, type StellarIncomingDelivery, type StellarKytEnvironment, type StellarLeafEphemeral, type StellarNetworkConfig, type StellarOperationReceipt, type StellarPolicyAdapter, type StellarPoolMerkleState, type StellarPreparedOperation, type StellarPrivacyClient, type StellarPrivacyClientConfig, type StellarPrivateAssetRow, type StellarPrivateRecord, type StellarPrivateRecordStatus, type StellarPublicBalance, type StellarPublicBalanceInput, type StellarRegistryLookup, type StellarStateAdapter, type StellarSubmissionPayload, type StellarTransactEngine, type StellarTransactEnvironment, type StellarTransactionDetails, type StellarTransactionStatus, type StellarTransferFromAddress, type StellarTransferIntent, type StellarZkCircuitDefinition, type SubmissionMethod, type TransferEscrowClaimantLimbs, type TransferEscrowSend, type TransferRecipientExecutionContext, type TransferTemporaryRecipientKey, ZERO_STROOPS, assertEscrowSweepClaimant, assetLegToTokenAddress, attachEscrowAuthorization, attachPoolStatePorts, buildBlindedRecipientTagChallengeMessage, buildPoolTransactionAuditParameters, buildPrivateAddressSignMessage, configurePrivacyPoolService, createDefaultTransactEngine, createPrivacyPoolService, createStellarPolicyAdapterFromEnvironment, createStellarPrivacyClient, createStellarPrivacyClientFromResolvedConfig, decodePrivateAddress, deriveEscrowRecipientFromStellarAddress, encodePrivateAddress, encodePrivateAddressFromHexCoordinates, evaluateRequiredSubmissionMethod, fetchAndMergeMerkleState, fetchEscrowOutputNoteEvents, finalizeSpendOperationAtExecute, frDecimalToPaddedBytes32, generateRandomDepositScalarHex, generateTemporaryRecipientPrivateAddress, getPrivacyPoolService, isEscrowPreparedOperation, isStellarPrivacyClient, listWalletPrivateAddressRecordsForOwnerFromStateSnapshot, listWalletPrivateAddressScalarsForOwnerFromStateSnapshot, loadDefaultStellarBrowserAssets, loadStellarBrowserAssets, optionalZkArtifactBaseUrl, parseAuditPublicKeyFromEnvHex, parseKytReasonCode, prepareConfidentialTransferProof, prepareConfidentialTransferProofDual, prepareEscrowSweepOperation, prepareRelayTransactPackage, prepareRelayTransactPackageFromPrepared, privateAddressSdk, readLeafEphemeralHex, readPrivateRecordsFromStateSnapshot, readRelayTransactSupportedProfile, readWalletDefaultPrivateAddressNonceFromStateSnapshot, readWalletPrivateAddressRecordFromStateSnapshot, readWalletPrivateAddressScalarFromStateSnapshot, recipientPublicKeysDecimalFromPrivateAddress, reconstructEscrowNote, requestKytPassageForPoolInteraction, requiredSubmissionMethod, resolvePoolApplicationId, resolveStellarPrivacyClientConfig, resolveZkConfigNonce, runTtlPreflight, stellarStateDefinitions, submitSorobanConfidentialTransfer, submitSorobanDeposit, tokenAddressToAssetLeg, unsignedEscrowAuthorizationForSweep };
1234
+ export { type AlignedDepositSlot, BINDING_ZK_NONCE, type BlindedRecipientTagChallengeFields, COMMITMENT_V2_ZK_NONCE, type CreateStellarPrivacyClientResult, 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 StellarAddress, type StellarAsset, type StellarAssetId, type StellarAssetsCatalog, type StellarAvailablePrivateRecordsFilter, type StellarBrowserAssets, type StellarBrowserPrivacyClientConfig, type StellarBundledZkCircuitDefinition, type StellarCustomZkCircuitDefinition, type StellarDeliverySyncState, type StellarIncomingDeliveriesFilter, type StellarIncomingDelivery, type StellarKytEnvironment, type StellarLeafEphemeral, type StellarNetworkConfig, type StellarOperationReceipt, type StellarPolicyAdapter, type StellarPoolMerkleState, type StellarPreparedOperation, type StellarPrivacyClient, type StellarPrivacyClientConfig, type StellarPrivateAssetRow, type StellarPrivateRecord, type StellarPrivateRecordStatus, type StellarPublicBalance, type StellarPublicBalanceInput, type StellarRegistryLookup, type StellarStateAdapter, type StellarSubmissionPayload, type StellarTransactEngine, type StellarTransactEnvironment, type StellarTransactionDetails, type StellarTransactionStatus, type StellarTransferFromAddress, type StellarTransferIntent, type StellarZkCircuitDefinition, type SubmissionMethod, type TransferEscrowClaimantLimbs, type TransferEscrowSend, type TransferRecipientExecutionContext, type TransferTemporaryRecipientKey, ZERO_STROOPS, assertEscrowSweepClaimant, assetLegToTokenAddress, attachEscrowAuthorization, attachPoolStatePorts, buildBlindedRecipientTagChallengeMessage, buildPoolTransactionAuditParameters, buildPrivateAddressSignMessage, configurePrivacyPoolService, createDefaultTransactEngine, createPrivacyPoolService, createStellarPolicyAdapterFromEnvironment, createStellarPrivacyClient, createStellarPrivacyClientFromResolvedConfig, decodePrivateAddress, deriveEscrowRecipientFromStellarAddress, encodePrivateAddress, encodePrivateAddressFromHexCoordinates, evaluateRequiredSubmissionMethod, fetchAndMergeMerkleState, fetchEscrowOutputNoteEvents, finalizeSpendOperationAtExecute, frDecimalToPaddedBytes32, generateRandomDepositScalarHex, generateTemporaryRecipientPrivateAddress, getPrivacyPoolService, isEscrowPreparedOperation, isStellarPrivacyClient, listWalletPrivateAddressRecordsForOwnerFromStateSnapshot, listWalletPrivateAddressScalarsForOwnerFromStateSnapshot, loadDefaultStellarBrowserAssets, loadStellarBrowserAssets, optionalZkArtifactBaseUrl, parseAuditPublicKeyFromEnvHex, parseKytReasonCode, prepareConfidentialTransferProof, prepareConfidentialTransferProofDual, prepareEscrowSweepOperation, prepareRelayTransactPackage, prepareRelayTransactPackageFromPrepared, privateAddressSdk, readLeafEphemeralHex, readPrivateRecordsFromStateSnapshot, readRelayTransactSupportedProfile, readWalletDefaultPrivateAddressNonceFromStateSnapshot, readWalletPrivateAddressRecordFromStateSnapshot, readWalletPrivateAddressScalarFromStateSnapshot, recipientPublicKeysDecimalFromPrivateAddress, reconstructEscrowNote, requestKytPassageForPoolInteraction, requiredSubmissionMethod, resolvePoolApplicationId, resolveStellarPrivacyClientConfig, resolveZkConfigNonce, runTtlPreflight, stellarStateDefinitions, submitSorobanConfidentialTransfer, submitSorobanDeposit, tokenAddressToAssetLeg, unsignedEscrowAuthorizationForSweep };