diff --git a/packages/rs-platform-wallet/src/wallet/platform_addresses/provider.rs b/packages/rs-platform-wallet/src/wallet/platform_addresses/provider.rs index 92e438ff81..bc36e530e1 100644 --- a/packages/rs-platform-wallet/src/wallet/platform_addresses/provider.rs +++ b/packages/rs-platform-wallet/src/wallet/platform_addresses/provider.rs @@ -434,6 +434,16 @@ impl PlatformPaymentAddressProvider { self.last_known_recent_block = result.last_known_recent_block; } + /// Current `last_known_recent_block` watermark. + /// + /// Crate-visible mirror of the field used by the `AddressProvider` + /// trait implementation, so wallet-level helpers (notably + /// [`super::wallet::PlatformAddressWallet::sync_watermark`]) can + /// read the value without going through the trait. + pub(crate) fn last_known_recent_block(&self) -> u64 { + self.last_known_recent_block + } + /// Restore incremental-sync watermark from persisted state. pub(crate) fn set_stored_sync_state( &mut self, diff --git a/packages/rs-platform-wallet/src/wallet/platform_addresses/wallet.rs b/packages/rs-platform-wallet/src/wallet/platform_addresses/wallet.rs index 7ce09f58a3..8364e2c733 100644 --- a/packages/rs-platform-wallet/src/wallet/platform_addresses/wallet.rs +++ b/packages/rs-platform-wallet/src/wallet/platform_addresses/wallet.rs @@ -293,6 +293,21 @@ impl PlatformAddressWallet { .unwrap_or_default() } + /// Current incremental-sync watermark (`last_known_recent_block`) + /// from the unified platform-address provider. + /// + /// Returns `None` when the provider hasn't been initialised yet or + /// when no incremental sync has produced a watermark. A zero-valued + /// watermark is reported as `None` to match the "no stored watermark" + /// convention used by [`Self::apply_sync_state`]. Intended for + /// progress checks where the precise "uninitialised vs. zero" + /// distinction is not material. + pub async fn sync_watermark(&self) -> Option { + let guard = self.provider.read().await; + let raw = guard.as_ref().map(|p| p.last_known_recent_block())?; + (raw > 0).then_some(raw) + } + /// Get total platform credits across all addresses. /// /// Returns the sum of all cached balances.