@umbra-privacy/sdk 2.0.5 → 2.1.0

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.
@@ -1734,6 +1734,21 @@ interface ScannedUtxoResult {
1734
1734
  publicSelfBurnable: ScannedUtxoData[];
1735
1735
  /** Public-balance deposit UTXOs sent to you by others via public ATA. */
1736
1736
  publicReceived: ScannedUtxoData[];
1737
+ /**
1738
+ * The insertion index to pass as `startInsertionIndex` on the next scan call.
1739
+ *
1740
+ * Computed as `max(insertionIndex across all indexer results) + 1` when the
1741
+ * indexer returned at least one UTXO, or `startInsertionIndex` when none were
1742
+ * returned (i.e., the tree range was empty).
1743
+ *
1744
+ * @example
1745
+ * ```typescript
1746
+ * const result = await scan(treeIndex, savedStartIndex);
1747
+ * // process result.selfBurnable, result.received, etc.
1748
+ * savedStartIndex = result.nextScanStartIndex;
1749
+ * ```
1750
+ */
1751
+ nextScanStartIndex: U32;
1737
1752
  }
1738
1753
  /**
1739
1754
  * Result of a batch merkle proof fetch from the indexer.
@@ -1734,6 +1734,21 @@ interface ScannedUtxoResult {
1734
1734
  publicSelfBurnable: ScannedUtxoData[];
1735
1735
  /** Public-balance deposit UTXOs sent to you by others via public ATA. */
1736
1736
  publicReceived: ScannedUtxoData[];
1737
+ /**
1738
+ * The insertion index to pass as `startInsertionIndex` on the next scan call.
1739
+ *
1740
+ * Computed as `max(insertionIndex across all indexer results) + 1` when the
1741
+ * indexer returned at least one UTXO, or `startInsertionIndex` when none were
1742
+ * returned (i.e., the tree range was empty).
1743
+ *
1744
+ * @example
1745
+ * ```typescript
1746
+ * const result = await scan(treeIndex, savedStartIndex);
1747
+ * // process result.selfBurnable, result.received, etc.
1748
+ * savedStartIndex = result.nextScanStartIndex;
1749
+ * ```
1750
+ */
1751
+ nextScanStartIndex: U32;
1737
1752
  }
1738
1753
  /**
1739
1754
  * Result of a batch merkle proof fetch from the indexer.
@@ -1,4 +1,4 @@
1
- import { o as AesDecryptorFunction, p as AesEncryptorFunction, d as IUmbraClient } from '../client-DkVBHMWb.cjs';
1
+ import { o as AesDecryptorFunction, p as AesEncryptorFunction, d as IUmbraClient } from '../client-Cb53GYes.cjs';
2
2
  import { b as SubBrandedType, B as Bytes, f as U256, U as U128, S as SubSubBrandedType, a as SubSubSubBrandedType } from '../types-C_V_CaKK.cjs';
3
3
  import { T as PseudorandomU512DeriverFunction, a5 as Kmac256Function, x as MasterSeedBasedFieldElementDeriverFunction, N as PoseidonHashFunction, D as DailyViewingKeyGeneratorFunction, E as EphemeralMasterSeedDeriverFunction, k as EphemeralRescueCommitmentBlindingFactorDeriverFunction, l as EphemeralUtxoH2RandomSecretDeriverFunction, m as EphemeralUtxoMasterViewingKeyBlindingFactorDeriverFunction, n as EphemeralUtxoMasterViewingKeyDeriverFunction, o as EphemeralUtxoNullifierDeriverFunction, p as EphemeralUtxoPoseidonPrivateKeyBlindingFactorDeriverFunction, q as EphemeralUtxoPoseidonPrivateKeyDeriverFunction, w as HourlyViewingKeyGeneratorFunction, b as MasterViewingKeyBlindingFactorDeriverFunction, a as MasterViewingKeyDeriverFunction, C as Curve25519KeypairGeneratorFunction, z as MintViewingKeyDeriverFunction, M as MintX25519KeypairDeriverFunction, A as MinuteViewingKeyGeneratorFunction, G as MonthlyViewingKeyGeneratorFunction, d as PolynomialCommitmentFactorDeriverFunction, c as PoseidonBlindingFactorDeriverFunction, O as PoseidonKeystreamBlindingFactorDeriverFunction, P as PoseidonPrivateKeyDeriverFunction, R as RescueCommitmentBlindingFactorDeriverFunction, a1 as SecondViewingKeyGeneratorFunction, a4 as YearlyViewingKeyGeneratorFunction, r as FieldArithmetic, X as RescueCipherDeps, Y as RescueCipherInstance, $ as RescuePrimeHashDeps, a0 as RescuePrimeHashFunction, Q as PoseidonKeystreamGeneratorFunction, S as PoseidonPrfFunction, K as KeystreamCommitmentFunction, J as PoseidonDecryptorFunction, L as PoseidonEncryptorFunction, u as H2GeneratorFns, a6 as RandomNonceGeneratorFunction, f as RcEncryptorWithNonceFunction, a7 as X25519GetSharedSecretFunction, V as RcDecryptorFunction, W as RcEncryptorFunction, e as RcKeyGeneratorFunction, j as ChallengePowersDeps, g as ChallengePowersFunction, F as FiatShamirChallengeGeneratorFunction, B as ModuloPowCurve25519Function, I as PolynomialEvaluatorDeps, h as PolynomialEvaluatorFunction, a2 as UserCommitmentGeneratorDeps, U as UserCommitmentGeneratorFunction } from '../interfaces-43cReBcS.cjs';
4
4
  export { H as H2CircuitProvableHashFunction, s as H2CircuitProvableParams, t as H2FullParams, v as H2HashFunction, y as MasterSeedGeneratorFunction, i as PoseidonAggregatorHashFunction, Z as RescueKeyDerivationFunction, _ as RescuePermuteFunction, a3 as ViewingKeyGeneratorOptions } from '../interfaces-43cReBcS.cjs';
@@ -1,4 +1,4 @@
1
- import { o as AesDecryptorFunction, p as AesEncryptorFunction, d as IUmbraClient } from '../client-V4AF6Bz9.js';
1
+ import { o as AesDecryptorFunction, p as AesEncryptorFunction, d as IUmbraClient } from '../client-CJ5S6Qln.js';
2
2
  import { b as SubBrandedType, B as Bytes, f as U256, U as U128, S as SubSubBrandedType, a as SubSubSubBrandedType } from '../types-C_V_CaKK.js';
3
3
  import { T as PseudorandomU512DeriverFunction, a5 as Kmac256Function, x as MasterSeedBasedFieldElementDeriverFunction, N as PoseidonHashFunction, D as DailyViewingKeyGeneratorFunction, E as EphemeralMasterSeedDeriverFunction, k as EphemeralRescueCommitmentBlindingFactorDeriverFunction, l as EphemeralUtxoH2RandomSecretDeriverFunction, m as EphemeralUtxoMasterViewingKeyBlindingFactorDeriverFunction, n as EphemeralUtxoMasterViewingKeyDeriverFunction, o as EphemeralUtxoNullifierDeriverFunction, p as EphemeralUtxoPoseidonPrivateKeyBlindingFactorDeriverFunction, q as EphemeralUtxoPoseidonPrivateKeyDeriverFunction, w as HourlyViewingKeyGeneratorFunction, b as MasterViewingKeyBlindingFactorDeriverFunction, a as MasterViewingKeyDeriverFunction, C as Curve25519KeypairGeneratorFunction, z as MintViewingKeyDeriverFunction, M as MintX25519KeypairDeriverFunction, A as MinuteViewingKeyGeneratorFunction, G as MonthlyViewingKeyGeneratorFunction, d as PolynomialCommitmentFactorDeriverFunction, c as PoseidonBlindingFactorDeriverFunction, O as PoseidonKeystreamBlindingFactorDeriverFunction, P as PoseidonPrivateKeyDeriverFunction, R as RescueCommitmentBlindingFactorDeriverFunction, a1 as SecondViewingKeyGeneratorFunction, a4 as YearlyViewingKeyGeneratorFunction, r as FieldArithmetic, X as RescueCipherDeps, Y as RescueCipherInstance, $ as RescuePrimeHashDeps, a0 as RescuePrimeHashFunction, Q as PoseidonKeystreamGeneratorFunction, S as PoseidonPrfFunction, K as KeystreamCommitmentFunction, J as PoseidonDecryptorFunction, L as PoseidonEncryptorFunction, u as H2GeneratorFns, a6 as RandomNonceGeneratorFunction, f as RcEncryptorWithNonceFunction, a7 as X25519GetSharedSecretFunction, V as RcDecryptorFunction, W as RcEncryptorFunction, e as RcKeyGeneratorFunction, j as ChallengePowersDeps, g as ChallengePowersFunction, F as FiatShamirChallengeGeneratorFunction, B as ModuloPowCurve25519Function, I as PolynomialEvaluatorDeps, h as PolynomialEvaluatorFunction, a2 as UserCommitmentGeneratorDeps, U as UserCommitmentGeneratorFunction } from '../interfaces-z_xYJlgV.js';
4
4
  export { H as H2CircuitProvableHashFunction, s as H2CircuitProvableParams, t as H2FullParams, v as H2HashFunction, y as MasterSeedGeneratorFunction, i as PoseidonAggregatorHashFunction, Z as RescueKeyDerivationFunction, _ as RescuePermuteFunction, a3 as ViewingKeyGeneratorOptions } from '../interfaces-z_xYJlgV.js';
@@ -1,4 +1,4 @@
1
- import { s as ComputationMonitorOptions, u as ComputationMonitorResult, v as ComputationMonitorResultWithSignature, I as IUmbraSigner, G as GetLatestBlockhash, T as TransactionForwarder, c as ComputationMonitor, L as GetMasterSeedFunction, d as IUmbraClient, A as AccountInfoProviderFunction, p as AesEncryptorFunction, a as GetEpochInfo, B as BatchMerkleProofFetcherFunction, k as ClaimableUtxoData } from './client-DkVBHMWb.cjs';
1
+ import { s as ComputationMonitorOptions, u as ComputationMonitorResult, v as ComputationMonitorResultWithSignature, I as IUmbraSigner, G as GetLatestBlockhash, T as TransactionForwarder, c as ComputationMonitor, L as GetMasterSeedFunction, d as IUmbraClient, A as AccountInfoProviderFunction, p as AesEncryptorFunction, a as GetEpochInfo, B as BatchMerkleProofFetcherFunction, k as ClaimableUtxoData } from './client-Cb53GYes.cjs';
2
2
  import { V as RcDecryptorFunction, a as MasterViewingKeyDeriverFunction, b as MasterViewingKeyBlindingFactorDeriverFunction, P as PoseidonPrivateKeyDeriverFunction, c as PoseidonBlindingFactorDeriverFunction, C as Curve25519KeypairGeneratorFunction, a1 as SecondViewingKeyGeneratorFunction, o as EphemeralUtxoNullifierDeriverFunction, l as EphemeralUtxoH2RandomSecretDeriverFunction, O as PoseidonKeystreamBlindingFactorDeriverFunction, N as PoseidonHashFunction, f as RcEncryptorWithNonceFunction, F as FiatShamirChallengeGeneratorFunction, U as UserCommitmentGeneratorFunction, u as H2GeneratorFns, K as KeystreamCommitmentFunction, L as PoseidonEncryptorFunction, Q as PoseidonKeystreamGeneratorFunction, n as EphemeralUtxoMasterViewingKeyDeriverFunction, m as EphemeralUtxoMasterViewingKeyBlindingFactorDeriverFunction, q as EphemeralUtxoPoseidonPrivateKeyDeriverFunction, p as EphemeralUtxoPoseidonPrivateKeyBlindingFactorDeriverFunction, i as PoseidonAggregatorHashFunction, e as RcKeyGeneratorFunction, M as MintX25519KeypairDeriverFunction } from './interfaces-43cReBcS.cjs';
3
3
  import './interfaces-D2NO6kDD.cjs';
4
4
  import * as _solana_kit from '@solana/kit';
@@ -1,4 +1,4 @@
1
- import { s as ComputationMonitorOptions, u as ComputationMonitorResult, v as ComputationMonitorResultWithSignature, I as IUmbraSigner, G as GetLatestBlockhash, T as TransactionForwarder, c as ComputationMonitor, L as GetMasterSeedFunction, d as IUmbraClient, A as AccountInfoProviderFunction, p as AesEncryptorFunction, a as GetEpochInfo, B as BatchMerkleProofFetcherFunction, k as ClaimableUtxoData } from './client-V4AF6Bz9.js';
1
+ import { s as ComputationMonitorOptions, u as ComputationMonitorResult, v as ComputationMonitorResultWithSignature, I as IUmbraSigner, G as GetLatestBlockhash, T as TransactionForwarder, c as ComputationMonitor, L as GetMasterSeedFunction, d as IUmbraClient, A as AccountInfoProviderFunction, p as AesEncryptorFunction, a as GetEpochInfo, B as BatchMerkleProofFetcherFunction, k as ClaimableUtxoData } from './client-CJ5S6Qln.js';
2
2
  import { V as RcDecryptorFunction, a as MasterViewingKeyDeriverFunction, b as MasterViewingKeyBlindingFactorDeriverFunction, P as PoseidonPrivateKeyDeriverFunction, c as PoseidonBlindingFactorDeriverFunction, C as Curve25519KeypairGeneratorFunction, a1 as SecondViewingKeyGeneratorFunction, o as EphemeralUtxoNullifierDeriverFunction, l as EphemeralUtxoH2RandomSecretDeriverFunction, O as PoseidonKeystreamBlindingFactorDeriverFunction, N as PoseidonHashFunction, f as RcEncryptorWithNonceFunction, F as FiatShamirChallengeGeneratorFunction, U as UserCommitmentGeneratorFunction, u as H2GeneratorFns, K as KeystreamCommitmentFunction, L as PoseidonEncryptorFunction, Q as PoseidonKeystreamGeneratorFunction, n as EphemeralUtxoMasterViewingKeyDeriverFunction, m as EphemeralUtxoMasterViewingKeyBlindingFactorDeriverFunction, q as EphemeralUtxoPoseidonPrivateKeyDeriverFunction, p as EphemeralUtxoPoseidonPrivateKeyBlindingFactorDeriverFunction, i as PoseidonAggregatorHashFunction, e as RcKeyGeneratorFunction, M as MintX25519KeypairDeriverFunction } from './interfaces-z_xYJlgV.js';
3
3
  import './interfaces-B8xKNl_6.js';
4
4
  import * as _solana_kit from '@solana/kit';
package/dist/index.cjs CHANGED
@@ -1187,6 +1187,7 @@ function getClaimableUtxoScannerFunction(args, deps) {
1187
1187
  const absoluteEndIndex = endInsertionIndex === void 0 ? treeEndAbsoluteIndex : treeOffset + endInsertionIndex;
1188
1188
  const allDecrypted = [];
1189
1189
  let cursor = absoluteStartIndex;
1190
+ let lastSeenInsertionIndex = null;
1190
1191
  while (cursor <= absoluteEndIndex) {
1191
1192
  let result;
1192
1193
  try {
@@ -1203,6 +1204,9 @@ function getClaimableUtxoScannerFunction(args, deps) {
1203
1204
  if (utxo.treeIndex !== treeIndex) {
1204
1205
  continue;
1205
1206
  }
1207
+ if (lastSeenInsertionIndex === null || utxo.insertionIndex > lastSeenInsertionIndex) {
1208
+ lastSeenInsertionIndex = utxo.insertionIndex;
1209
+ }
1206
1210
  const decrypted = await tryDecryptUtxo(
1207
1211
  utxo,
1208
1212
  clientX25519PrivateKey,
@@ -1221,8 +1225,9 @@ function getClaimableUtxoScannerFunction(args, deps) {
1221
1225
  }
1222
1226
  cursor = result.nextCursor;
1223
1227
  }
1228
+ const nextScanStartIndex = lastSeenInsertionIndex !== null ? lastSeenInsertionIndex + 1n : startInsertionIndex;
1224
1229
  if (allDecrypted.length === 0) {
1225
- return { selfBurnable: [], received: [], publicSelfBurnable: [], publicReceived: [] };
1230
+ return { selfBurnable: [], received: [], publicSelfBurnable: [], publicReceived: [], nextScanStartIndex };
1226
1231
  }
1227
1232
  const selfBurnableUtxos = [];
1228
1233
  const receivedUtxos = [];
@@ -1252,7 +1257,8 @@ function getClaimableUtxoScannerFunction(args, deps) {
1252
1257
  selfBurnable: selfBurnableUtxos,
1253
1258
  received: receivedUtxos,
1254
1259
  publicSelfBurnable: publicSelfBurnableUtxos,
1255
- publicReceived: publicReceivedUtxos
1260
+ publicReceived: publicReceivedUtxos,
1261
+ nextScanStartIndex
1256
1262
  };
1257
1263
  }, "fetchClaimableUtxos");
1258
1264
  }