[][src]Trait grin_wallet::libwallet::types::NodeClient

pub trait NodeClient: Sync + Send + Clone {
    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: &TxWrapper, fluff: bool) -> Result<(), Error>;
fn get_chain_height(&self) -> Result<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,
        max_outputs: u64
    ) -> Result<(u64, u64, Vec<(Commitment, RangeProof, bool, u64, u64)>), Error>; }

Encapsulate all wallet-node communication functions. No functions within libwallet should care about communication details

Required methods

fn node_url(&self) -> &str

Return the URL of the check node

fn set_node_url(&mut self, node_url: &str)

Set the node URL

fn node_api_secret(&self) -> Option<String>

Return the node api secret

fn set_node_api_secret(&mut self, node_api_secret: Option<String>)

Change the API secret

fn post_tx(&self, tx: &TxWrapper, fluff: bool) -> Result<(), Error>

Posts a transaction to a grin node

fn get_chain_height(&self) -> Result<u64, Error>

retrieves the current tip from the specified grin node

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

fn get_outputs_by_pmmr_index(
    &self,
    start_height: 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))

Loading content...

Implementors

impl NodeClient for HTTPNodeClient[src]

fn post_tx(&self, tx: &TxWrapper, fluff: bool) -> Result<(), Error>[src]

Posts a transaction to a grin node

fn get_chain_height(&self) -> Result<u64, Error>[src]

Return the chain tip from a given node

fn get_outputs_from_node(
    &self,
    wallet_outputs: Vec<Commitment>
) -> Result<HashMap<Commitment, (String, u64, u64)>, Error>
[src]

Retrieve outputs from node

impl NodeClient for LocalWalletClient[src]

fn post_tx(&self, tx: &TxWrapper, _fluff: bool) -> Result<(), Error>[src]

Posts a transaction to a grin node In this case it will create a new block with award rewarded to

fn get_chain_height(&self) -> Result<u64, Error>[src]

Return the chain tip from a given node

fn get_outputs_from_node(
    &self,
    wallet_outputs: Vec<Commitment>
) -> Result<HashMap<Commitment, (String, u64, u64)>, Error>
[src]

Retrieve outputs from node

Loading content...