pub trait NodeClient:
Send
+ Sync
+ Clone {
// Required methods
fn node_url(&self) -> &str;
fn set_node_url(&mut self, node_url: &str);
fn node_api_secret(&self) -> Option<String>;
fn set_node_api_secret(&mut self, node_api_secret: Option<String>);
fn post_tx(&self, tx: &Transaction, fluff: bool) -> Result<(), Error>;
fn get_version_info(&mut self) -> Option<NodeVersionInfo>;
fn get_chain_tip(&self) -> Result<(u64, String), Error>;
fn get_kernel(
&mut self,
excess: &Commitment,
min_height: Option<u64>,
max_height: Option<u64>,
) -> Result<Option<(TxKernel, u64, u64)>, Error>;
fn get_outputs_from_node(
&self,
wallet_outputs: Vec<Commitment>,
) -> Result<HashMap<Commitment, (String, u64, u64)>, Error>;
fn get_outputs_by_pmmr_index(
&self,
start_height: u64,
end_height: Option<u64>,
max_outputs: u64,
) -> Result<(u64, u64, Vec<(Commitment, RangeProof, bool, u64, u64)>), Error>;
fn height_range_to_pmmr_indices(
&self,
start_height: u64,
end_height: Option<u64>,
) -> Result<(u64, u64), Error>;
}
Expand description
Encapsulate all wallet-node communication functions. No functions within libwallet should care about communication details
Required Methods§
Sourcefn set_node_url(&mut self, node_url: &str)
fn set_node_url(&mut self, node_url: &str)
Set the node URL
Sourcefn node_api_secret(&self) -> Option<String>
fn node_api_secret(&self) -> Option<String>
Return the node api secret
Sourcefn set_node_api_secret(&mut self, node_api_secret: Option<String>)
fn set_node_api_secret(&mut self, node_api_secret: Option<String>)
Change the API secret
Sourcefn post_tx(&self, tx: &Transaction, fluff: bool) -> Result<(), Error>
fn post_tx(&self, tx: &Transaction, fluff: bool) -> Result<(), Error>
Posts a transaction to a grin node
Sourcefn get_version_info(&mut self) -> Option<NodeVersionInfo>
fn get_version_info(&mut self) -> Option<NodeVersionInfo>
Returns the api version string and block header version as reported by the node. Result can be cached for later use
Sourcefn get_chain_tip(&self) -> Result<(u64, String), Error>
fn get_chain_tip(&self) -> Result<(u64, String), Error>
retrieves the current tip (height, hash) from the specified grin node
Sourcefn get_kernel(
&mut self,
excess: &Commitment,
min_height: Option<u64>,
max_height: Option<u64>,
) -> Result<Option<(TxKernel, u64, u64)>, Error>
fn get_kernel( &mut self, excess: &Commitment, min_height: Option<u64>, max_height: Option<u64>, ) -> Result<Option<(TxKernel, u64, u64)>, Error>
Get a kernel and the height of the block it’s included in. Returns (tx_kernel, height, mmr_index)
Sourcefn get_outputs_from_node(
&self,
wallet_outputs: Vec<Commitment>,
) -> Result<HashMap<Commitment, (String, u64, u64)>, Error>
fn get_outputs_from_node( &self, wallet_outputs: Vec<Commitment>, ) -> Result<HashMap<Commitment, (String, u64, u64)>, Error>
retrieve a list of outputs from the specified grin node need “by_height” and “by_id” variants
Sourcefn get_outputs_by_pmmr_index(
&self,
start_height: u64,
end_height: Option<u64>,
max_outputs: u64,
) -> Result<(u64, u64, Vec<(Commitment, RangeProof, bool, u64, u64)>), Error>
fn get_outputs_by_pmmr_index( &self, start_height: u64, end_height: Option<u64>, max_outputs: u64, ) -> Result<(u64, u64, Vec<(Commitment, RangeProof, bool, u64, u64)>), Error>
Get a list of outputs from the node by traversing the UTXO set in PMMR index order. Returns (last available output index, last insertion index retrieved, outputs(commit, proof, is_coinbase, height, mmr_index))
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.