@arcanetech/privacy-sdk-stellar 0.5.4 → 0.6.1

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/dist/index.d.ts CHANGED
@@ -64,6 +64,11 @@ interface StellarWalletPrivateAddressRecord {
64
64
  privateAddress: string;
65
65
  createdAt: number;
66
66
  }
67
+ interface StellarLeanImtNode {
68
+ level: number;
69
+ index: number;
70
+ value: string;
71
+ }
67
72
  interface StellarPoolMerkleState {
68
73
  poolContract: string;
69
74
  commitments: string[];
@@ -71,6 +76,7 @@ interface StellarPoolMerkleState {
71
76
  merkleRootHex: string;
72
77
  updatedAt: number;
73
78
  syncedLedger?: number;
79
+ nodes?: StellarLeanImtNode[];
74
80
  }
75
81
  interface StellarLeafEphemeral {
76
82
  poolContract: string;
@@ -176,6 +182,12 @@ interface LeafEphemeralStatePort {
176
182
  }): Promise<StellarLeafEphemeral | undefined>;
177
183
  set(ephemeral: StellarLeafEphemeral): Promise<void>;
178
184
  }
185
+ interface CachedPoolMerkleView {
186
+ commitments: string[];
187
+ updatedAt: number;
188
+ merkleRootHex?: string;
189
+ nodes?: StellarLeanImtNode[];
190
+ }
179
191
 
180
192
  type StellarSignTransaction = (input: {
181
193
  xdr: string;
@@ -364,29 +376,15 @@ interface FetchContractMerkleResult {
364
376
  commitments: string[];
365
377
  merkleRootHex: string;
366
378
  updatedAt: number;
379
+ nodes?: StellarLeanImtNode[];
367
380
  }
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
- */
374
- declare function fetchAndMergeMerkleState(parameters: {
381
+ declare function persistFetchedMerkleState(input: {
375
382
  poolContractId: string;
376
- walletPublicKey: string;
377
- transactEnvironment: StellarTransactEnvironment;
383
+ commitments: string[];
384
+ merkleRootHex: string;
385
+ cachedState: CachedPoolMerkleView | undefined;
378
386
  poolMerkleState?: PoolMerkleStatePort;
379
387
  }): Promise<FetchContractMerkleResult>;
380
- declare function readLeafEphemeralHex(parameters: {
381
- poolContractId: string;
382
- walletPublicKey: string;
383
- leafIndex: number;
384
- transactEnvironment: StellarTransactEnvironment;
385
- leafEphemeral?: LeafEphemeralStatePort;
386
- }): Promise<{
387
- xHex: string;
388
- yHex: string;
389
- }>;
390
388
 
391
389
  type StellarTransactionDetails = {
392
390
  txHash: string;
@@ -440,6 +438,7 @@ declare function composeStellarPrivacyClient(config: ResolvedStellarPrivacyClien
440
438
  commitments: string[];
441
439
  merkleRootHex: string;
442
440
  syncedLedger?: number;
441
+ nodes?: StellarPoolMerkleState["nodes"];
443
442
  }): Promise<void>;
444
443
  getWalletPrivateAddressRecord(input: {
445
444
  owner: StellarAddress;
@@ -620,6 +619,7 @@ declare function composeStellarStateService(adapter: StateBridgeAdapter): {
620
619
  commitments: string[];
621
620
  merkleRootHex: string;
622
621
  syncedLedger?: number;
622
+ nodes?: StellarPoolMerkleState["nodes"];
623
623
  }): Promise<void>;
624
624
  getWalletPrivateAddressRecord(input: {
625
625
  owner: StellarAddress;
@@ -721,6 +721,18 @@ declare function createStateDelegates(state: StellarStateService): {
721
721
  };
722
722
  type StellarPrivacyClientStateDelegates = ReturnType<typeof createStateDelegates>;
723
723
 
724
+ type StellarPrivacyStateHydration = {
725
+ poolMerkleStates?: StellarPoolMerkleState[];
726
+ privateRecords?: StellarPrivateRecord[];
727
+ walletPrivateAddressRecords?: StellarWalletPrivateAddressRecord[];
728
+ walletPrivateAddressScalars?: StellarWalletPrivateAddressScalar[];
729
+ walletDefaultPrivateAddressNonces?: Array<{
730
+ owner: string;
731
+ nonce: string;
732
+ }>;
733
+ assets?: StellarAsset[];
734
+ };
735
+
724
736
  type StellarPrivacyClientNetwork = ComposedStellarPrivacyClient['network'];
725
737
  type StellarPrivacyClientOperations = ComposedStellarPrivacyClient['operations'];
726
738
  type StellarPrivacyClient = {
@@ -738,7 +750,9 @@ type StellarPrivacyClient = {
738
750
  waitForTransactionConfirmation: StellarPrivacyClientNetwork['waitForTransactionConfirmation'];
739
751
  fetchTransactionConfirmationStatus: StellarPrivacyClientNetwork['fetchTransactionConfirmationStatus'];
740
752
  getTransactionDetails: StellarPrivacyClientNetwork['getTransactionDetails'];
741
- } & StellarPrivacyClientStateDelegates;
753
+ } & StellarPrivacyClientStateDelegates & {
754
+ hydrateState: (snapshot: StellarPrivacyStateHydration) => Promise<void>;
755
+ };
742
756
 
743
757
  type CreateStellarPrivacyClientResult = StellarPrivacyClient | ReturnType<typeof createRejectedOperation>;
744
758
  declare function isStellarPrivacyClient(result: CreateStellarPrivacyClientResult): result is StellarPrivacyClient;
@@ -1096,6 +1110,29 @@ type PrepareConfidentialTransferProofResult = {
1096
1110
  };
1097
1111
  declare function prepareConfidentialTransferProof(parameters: PrepareConfidentialTransferProofParameters): Promise<PrepareConfidentialTransferProofResult>;
1098
1112
 
1113
+ /**
1114
+ * Loads pool Merkle leaves without `get_commitments()`. That helper walks the
1115
+ * whole tree in one simulate and exceeds the Soroban host budget on a live
1116
+ * stand. Completes the cached prefix from persistent `TreeDataKey::Leaf`
1117
+ * ledger entries instead.
1118
+ */
1119
+ declare function fetchAndMergeMerkleState(parameters: {
1120
+ poolContractId: string;
1121
+ walletPublicKey: string;
1122
+ transactEnvironment: StellarTransactEnvironment;
1123
+ poolMerkleState?: PoolMerkleStatePort;
1124
+ }): Promise<Awaited<ReturnType<typeof persistFetchedMerkleState>>>;
1125
+ declare function readLeafEphemeralHex(parameters: {
1126
+ poolContractId: string;
1127
+ walletPublicKey: string;
1128
+ leafIndex: number;
1129
+ transactEnvironment: StellarTransactEnvironment;
1130
+ leafEphemeral?: LeafEphemeralStatePort;
1131
+ }): Promise<{
1132
+ xHex: string;
1133
+ yHex: string;
1134
+ }>;
1135
+
1099
1136
  interface DecryptedKytAuditSlot {
1100
1137
  slot: number;
1101
1138
  decryptOk: boolean;
@@ -1231,4 +1268,4 @@ declare function isEscrowPreparedOperation(prepared: StellarPreparedOperation):
1231
1268
  declare function evaluateRequiredSubmissionMethod(prepared: StellarPreparedOperation, zkConfigNonce?: bigint): RequiredSubmissionMethodResult;
1232
1269
  declare function requiredSubmissionMethod(prepared: StellarPreparedOperation, zkConfigNonce?: bigint): SubmissionMethod;
1233
1270
 
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 };
1271
+ 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 StellarLeanImtNode, type StellarNetworkConfig, type StellarOperationReceipt, type StellarPolicyAdapter, type StellarPoolMerkleState, type StellarPreparedOperation, type StellarPrivacyClient, type StellarPrivacyClientConfig, type StellarPrivacyStateHydration, 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 };