@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/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
|
@@ -231,14 +231,15 @@ interface StellarTransactEnvironment {
|
|
|
231
231
|
network: StellarNetworkConfig;
|
|
232
232
|
/**
|
|
233
233
|
* Nonce (persistent storage key) of the pool's `ZkConfig` entry this
|
|
234
|
-
* environment's proofs/circuit shape target. Defaults to `
|
|
235
|
-
*
|
|
236
|
-
*
|
|
234
|
+
* environment's proofs/circuit shape target. Defaults to `3n` (bundled 2×2
|
|
235
|
+
* binding layout) when omitted. Also bundled: `7n` (6×6). The value must
|
|
236
|
+
* match the on-chain pool config or bootstrap/execute fails with
|
|
237
|
+
* `no zk circuit configured for nonce …`.
|
|
237
238
|
*/
|
|
238
239
|
zkConfigNonce?: bigint;
|
|
239
240
|
/**
|
|
240
|
-
* Optional nonce-keyed circuit map. Defaults to the SDK bundled 2×2 (nonce
|
|
241
|
-
* and 6×6 (nonce
|
|
241
|
+
* Optional nonce-keyed circuit map. Defaults to the SDK bundled 2×2 (nonce 3)
|
|
242
|
+
* and 6×6 (nonce 7) schemes. URL fields are only for a custom/dev circuit.
|
|
242
243
|
*/
|
|
243
244
|
zkCircuits?: Record<string, StellarZkCircuitDefinition>;
|
|
244
245
|
/**
|
|
@@ -307,6 +308,7 @@ interface StellarTransactArtifacts {
|
|
|
307
308
|
};
|
|
308
309
|
executeFinalizeRequired?: boolean;
|
|
309
310
|
spendSource?: 'privateAddress' | 'escrow';
|
|
311
|
+
zkConfigNonce?: bigint;
|
|
310
312
|
}
|
|
311
313
|
interface StellarOperationReceipt {
|
|
312
314
|
operationId: string;
|
|
@@ -363,6 +365,12 @@ interface FetchContractMerkleResult {
|
|
|
363
365
|
merkleRootHex: string;
|
|
364
366
|
updatedAt: number;
|
|
365
367
|
}
|
|
368
|
+
/**
|
|
369
|
+
* Loads pool Merkle leaves without `get_commitments()`. That helper walks the
|
|
370
|
+
* whole tree in one simulate and exceeds the Soroban host budget on a live
|
|
371
|
+
* stand. Completes the cached prefix from persistent `TreeDataKey::Leaf`
|
|
372
|
+
* ledger entries instead.
|
|
373
|
+
*/
|
|
366
374
|
declare function fetchAndMergeMerkleState(parameters: {
|
|
367
375
|
poolContractId: string;
|
|
368
376
|
walletPublicKey: string;
|
|
@@ -765,6 +773,17 @@ declare function encodePrivateAddressFromHexCoordinates(publicKeyXHex: string, p
|
|
|
765
773
|
declare function recipientPublicKeysDecimalFromPrivateAddress(value: string): unknown;
|
|
766
774
|
declare function privateAddressSdk(sdk: PrivacyPoolSDK): PrivateAddressSdk;
|
|
767
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
|
+
|
|
768
787
|
declare class PrivacyPoolService {
|
|
769
788
|
private readonly assets?;
|
|
770
789
|
private readonly applicationId?;
|
|
@@ -772,11 +791,12 @@ declare class PrivacyPoolService {
|
|
|
772
791
|
private readonly zkCircuits?;
|
|
773
792
|
private readonly zkConfigNonce?;
|
|
774
793
|
private readonly zkArtifactBaseUrl?;
|
|
775
|
-
private
|
|
776
|
-
private
|
|
794
|
+
private readonly sdks;
|
|
795
|
+
private readonly initPromises;
|
|
777
796
|
constructor(assets?: StellarBrowserAssets | undefined, applicationId?: string | undefined, auditPublicKey?: [string, string] | undefined, zkCircuits?: Record<string, StellarZkCircuitDefinition> | undefined, zkConfigNonce?: bigint | undefined, zkArtifactBaseUrl?: string | undefined);
|
|
778
|
-
|
|
779
|
-
|
|
797
|
+
getInitializedSdk(nonce?: bigint): Promise<PrivacyPoolSDK>;
|
|
798
|
+
feeBearingZkConfigNonce(input: FeeOutputKindInput): bigint;
|
|
799
|
+
private initializeSdk;
|
|
780
800
|
getAuditPublicKey(): [string, string] | undefined;
|
|
781
801
|
getApplicationId(): string;
|
|
782
802
|
generatePrivateAddressFromStellarSignature(signature: string, domain: SpendScalarDomain): Promise<string>;
|
|
@@ -800,6 +820,8 @@ declare class PrivacyPoolService {
|
|
|
800
820
|
depositScalarHex: string;
|
|
801
821
|
merkleRootBytes: Buffer$1;
|
|
802
822
|
tokenAddress: string;
|
|
823
|
+
publicDepositStroops?: bigint;
|
|
824
|
+
feeOutput?: FeeOutputSpec;
|
|
803
825
|
}): Promise<ProofResult>;
|
|
804
826
|
calculateNullifierHash(nullifier: string, privKeyScalar: string): Promise<string>;
|
|
805
827
|
prepareWithdrawTransactProof(parameters: {
|
|
@@ -811,6 +833,7 @@ declare class PrivacyPoolService {
|
|
|
811
833
|
withdrawAmountStroops: bigint;
|
|
812
834
|
changePrivateAddressStpl1: string | undefined;
|
|
813
835
|
tokenAddress: string;
|
|
836
|
+
feeOutput?: FeeOutputSpec;
|
|
814
837
|
}): Promise<ProofWithChange>;
|
|
815
838
|
prepareWithdrawTransactProofDual(parameters: {
|
|
816
839
|
coinA: CoinData;
|
|
@@ -823,6 +846,7 @@ declare class PrivacyPoolService {
|
|
|
823
846
|
withdrawAmountStroops: bigint;
|
|
824
847
|
changePrivateAddressStpl1: string | undefined;
|
|
825
848
|
tokenAddress: string;
|
|
849
|
+
feeOutput?: FeeOutputSpec;
|
|
826
850
|
}): Promise<ProofWithChange>;
|
|
827
851
|
}
|
|
828
852
|
|
|
@@ -955,7 +979,9 @@ declare function loadDefaultStellarBrowserAssets(options?: {
|
|
|
955
979
|
|
|
956
980
|
declare const STANDARD_ZK_CONFIG_NONCE = 0n;
|
|
957
981
|
declare const COMMITMENT_V2_ZK_NONCE = 2n;
|
|
982
|
+
declare const BINDING_ZK_NONCE = 3n;
|
|
958
983
|
declare const SIX_BY_SIX_ZK_NONCE = 6n;
|
|
984
|
+
declare const SIX_BY_SIX_BINDING_ZK_NONCE = 7n;
|
|
959
985
|
declare const DEFAULT_ZK_CONFIG_NONCE = 3n;
|
|
960
986
|
declare function resolveZkConfigNonce(transactEnvironment: StellarTransactEnvironment): bigint;
|
|
961
987
|
|
|
@@ -1003,6 +1029,7 @@ interface SubmitSorobanConfidentialTransferInput {
|
|
|
1003
1029
|
ciphertextHex?: string;
|
|
1004
1030
|
outputNoteEphemeralScalars?: string[];
|
|
1005
1031
|
applicationIdsPlaintext?: KytApplicationIdHints;
|
|
1032
|
+
zkConfigNonce?: bigint;
|
|
1006
1033
|
networkPassphrase: string;
|
|
1007
1034
|
sorobanRpcUrl: string;
|
|
1008
1035
|
transactEnvironment: StellarTransactEnvironment;
|
|
@@ -1032,6 +1059,7 @@ type PrepareConfidentialTransferProofDualParameters = {
|
|
|
1032
1059
|
tokenAddress: string;
|
|
1033
1060
|
escrowSend?: TransferEscrowSend;
|
|
1034
1061
|
escrowClaimantLimbs?: TransferEscrowClaimantLimbs;
|
|
1062
|
+
feeOutput?: FeeOutputSpec;
|
|
1035
1063
|
};
|
|
1036
1064
|
type PrepareConfidentialTransferProofDualResult = {
|
|
1037
1065
|
proof_hex: string;
|
|
@@ -1055,6 +1083,7 @@ type PrepareConfidentialTransferProofParameters = {
|
|
|
1055
1083
|
tokenAddress: string;
|
|
1056
1084
|
escrowSend?: TransferEscrowSend;
|
|
1057
1085
|
escrowClaimantLimbs?: TransferEscrowClaimantLimbs;
|
|
1086
|
+
feeOutput?: FeeOutputSpec;
|
|
1058
1087
|
};
|
|
1059
1088
|
type PrepareConfidentialTransferProofResult = {
|
|
1060
1089
|
proof_hex: string;
|
|
@@ -1084,6 +1113,7 @@ interface RequestKytPassageForPoolInteractionInput {
|
|
|
1084
1113
|
outputNoteEphemeralScalars?: string[];
|
|
1085
1114
|
decryptedAuditSlots?: DecryptedKytAuditSlot[];
|
|
1086
1115
|
applicationIdsPlaintext?: KytApplicationIdHints;
|
|
1116
|
+
zkConfigNonce?: bigint;
|
|
1087
1117
|
networkPassphrase: string;
|
|
1088
1118
|
sorobanRpcUrl: string;
|
|
1089
1119
|
transactEnvironment: StellarTransactEnvironment;
|
|
@@ -1201,4 +1231,4 @@ declare function isEscrowPreparedOperation(prepared: StellarPreparedOperation):
|
|
|
1201
1231
|
declare function evaluateRequiredSubmissionMethod(prepared: StellarPreparedOperation, zkConfigNonce?: bigint): RequiredSubmissionMethodResult;
|
|
1202
1232
|
declare function requiredSubmissionMethod(prepared: StellarPreparedOperation, zkConfigNonce?: bigint): SubmissionMethod;
|
|
1203
1233
|
|
|
1204
|
-
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 };
|