I am looking to receive Proposal
data from a Sputnik v2 DAO Contract. I want to call get_proposals
but that returns a json list of the proposals. I am unsure as to what the method signature on the callback function would look like to receive the data. Since sputnik-dao-contract
is not a published Rust Crate, I cannot import the Proposal
struct and use it to deserialize. What is the best approach to processing the response and getting the Proposal
id?
Here is the method I want to call: https://github.com/near-daos/sputnik-dao-contract#view-multiple-proposals
How to I recieve, deserialize and use the response programmatically in Rust?
It turned out the answer was to create a barebones struct that matched the json response. The barebones struct of
pub struct Proposal {
pub id: u64,
}
(from https://github.com/near-daos/sputnik-dao-contract/blob/main/sputnikdao2/src/views.rs#L12) got me what I needed. I added other fields as necessary.