Struct epic_api::Foreign [−][src]
pub struct Foreign {
pub chain: Weak<Chain>,
pub tx_pool: Weak<RwLock<TransactionPool>>,
pub sync_state: Weak<SyncState>,
}
Expand description
Fields
chain: Weak<Chain>
tx_pool: Weak<RwLock<TransactionPool>>
sync_state: Weak<SyncState>
Implementations
Create a new API instance with the chain, transaction pool, peers and sync_state
. All subsequent
API calls will operate on this instance of node API.
Arguments
chain
- A non-owning reference of the chain.tx_pool
- A non-owning reference of the transaction pool.peers
- A non-owning reference of the peers.sync_state
- A non-owning reference of thesync_state
.
Returns
- An instance of the Node holding references to the current chain, transaction pool, peers and sync_state.
Gets block header given either a height, a hash or an unspent output commitment. Only one parameters is needed. If multiple parameters are provided only the first one in the list is used.
Arguments
height
- block height.hash
- block hash.commit
- output commitment.
Returns
- Result Containing:
- A
BlockHeaderPrintable
- or
Error
if an error is encountered.
Gets block details given either a height, a hash or an unspent output commitment. Only one parameters is needed. If multiple parameters are provided only the first one in the list is used.
Arguments
height
- block height.hash
- block hash.commit
- output commitment.
Returns
- Result Containing:
- A
BlockPrintable
- or
Error
if an error is encountered.
pub fn get_kernel(
&self,
excess: String,
min_height: Option<u64>,
max_height: Option<u64>
) -> Result<LocatedTxKernel, Error>
pub fn get_kernel(
&self,
excess: String,
min_height: Option<u64>,
max_height: Option<u64>
) -> Result<LocatedTxKernel, Error>
Returns a LocatedTxKernel
based on the kernel excess.
The min_height
and max_height
parameters are both optional.
If not supplied, min_height
will be set to 0 and max_height
will be set to the head of the chain.
The method will start at the block height max_height
and traverse the kernel MMR backwards,
until either the kernel is found or min_height
is reached.
Arguments
excess
- kernel excess to look for.min_height
- minimum height to stop the lookup.max_height
- maximum height to start the lookup.
Returns
- Result Containing:
- A
LocatedTxKernel
- or
Error
if an error is encountered.
Retrieves details about specifics outputs. Supports retrieval of multiple outputs in a single request. Support retrieval by both commitment string and block height.
Arguments
commits
- a vector of unspent output commitments.start_height
- start height to start the lookup.end_height
- end height to stop the lookup.include_proof
- whether or not to include the range proof in the response.include_merkle_proof
- whether or not to include the merkle proof in the response.
Returns
- Result Containing:
- An
OutputPrintable
- or
Error
if an error is encountered.
UTXO traversal. Retrieves last utxos since a start_index
until a max
.
Arguments
start_index
- start index in the MMR.end_index
- optional index so stop in the MMR.max
- max index in the MMR.include_proof
- whether or not to include the range proof in the response.
Returns
- Result Containing:
- An
OutputListing
- or
Error
if an error is encountered.
pub fn get_pmmr_indices(
&self,
start_block_height: u64,
end_block_height: Option<u64>
) -> Result<OutputListing, Error>
pub fn get_pmmr_indices(
&self,
start_block_height: u64,
end_block_height: Option<u64>
) -> Result<OutputListing, Error>
Retrieves the PMMR indices based on the provided block height(s).
Arguments
start_block_height
- start index in the MMR.end_block_height
- optional index so stop in the MMR.
Returns
- Result Containing:
- An
OutputListing
- or
Error
if an error is encountered.
Trait Implementations
Networked version of Foreign::get_header. Read more
Networked version of Foreign::get_block. Read more
Networked version of Foreign::get_version. Read more
fn get_kernel(
&self,
excess: String,
min_height: Option<u64>,
max_height: Option<u64>
) -> Result<LocatedTxKernel, ErrorKind>
fn get_kernel(
&self,
excess: String,
min_height: Option<u64>,
max_height: Option<u64>
) -> Result<LocatedTxKernel, ErrorKind>
Networked version of Foreign::get_kernel. Read more
Networked version of Foreign::get_outputs. Read more
Networked version of Foreign::get_unspent_outputs. Read more
fn get_pmmr_indices(
&self,
start_block_height: u64,
end_block_height: Option<u64>
) -> Result<OutputListing, ErrorKind>
fn get_pmmr_indices(
&self,
start_block_height: u64,
end_block_height: Option<u64>
) -> Result<OutputListing, ErrorKind>
Networked version of Foreign::get_pmmr_indices. Read more
Networked version of Foreign::get_pool_size. Read more
Networked version of Foreign::get_stempool_size. Read more
Networked version of Foreign::get_unconfirmed_transactions. Read more
Networked version of Foreign::push_transaction. Read more
Auto Trait Implementations
impl !RefUnwindSafe for Foreign
impl !UnwindSafe for Foreign
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<T> SafeBorrow<T> for T where
T: ?Sized,
impl<T> SafeBorrow<T> for T where
T: ?Sized,
pub fn borrow_replacement(ptr: &T) -> &T
pub fn borrow_replacement(ptr: &T) -> &T
Given ptr
, which was obtained from a prior call to Self::borrow()
,
return a value with the same nominal lifetime which is guaranteed to
survive mutations to Self
. Read more
type Output = T
type Output = T
Should always be Self