Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions dash-spv/src/bridge/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,28 @@ impl SpvClient {
}
}

#[uniffi::export]
impl SpvClient {
/// Returns all governance proposals known to the SPV client.
///
/// Governance sync is not yet implemented in the SPV client, so this method
/// always returns an empty `Vec`. It is exported so foreign-language
/// bindings can be generated and call-sites can be wired up in advance.
pub async fn get_governance_proposals(&self) -> Vec<GovernanceProposal> {
vec![]
}

/// Looks up a single governance proposal by its hash.
///
/// Governance sync is not yet implemented in the SPV client, so this method
/// always returns `None`. It is exported so foreign-language bindings can
/// be generated and call-sites can be wired up in advance.
pub async fn get_governance_proposal(&self, hash: String) -> Option<GovernanceProposal> {
let _ = hash;
None
}
}

// ============ Stub functions ============

/// Returns a greeting string (sanity-check export).
Expand Down Expand Up @@ -1540,4 +1562,32 @@ mod tests {
"should return empty vec when engine has no list yet"
);
}

// ---- get_governance_proposals / get_governance_proposal stub tests ----

/// `get_governance_proposals` always returns an empty vec (governance not yet implemented).
#[tokio::test]
async fn test_get_governance_proposals_returns_empty() {
let temp_dir = TempDir::new().expect("Failed to create temp dir");
let config = ClientConfig::regtest().without_filters().with_storage_path(temp_dir.path());

let client = SpvClient::new(config).await.expect("SpvClient construction must succeed");
assert!(
client.get_governance_proposals().await.is_empty(),
"get_governance_proposals should return empty vec (stub)"
);
}

/// `get_governance_proposal` always returns `None` (governance not yet implemented).
#[tokio::test]
async fn test_get_governance_proposal_returns_none() {
let temp_dir = TempDir::new().expect("Failed to create temp dir");
let config = ClientConfig::regtest().without_filters().with_storage_path(temp_dir.path());

let client = SpvClient::new(config).await.expect("SpvClient construction must succeed");
assert!(
client.get_governance_proposal("deadbeef".to_string()).await.is_none(),
"get_governance_proposal should return None (stub)"
);
}
}
Loading