[−][src]Struct grin_api::Foreign
Main interface into all node API functions. Node APIs are split into two seperate blocks of functionality called the 'Owner' and 'Foreign' APIs
Methods in this API are intended to be 'single use'.
Fields
chain: Weak<Chain>
tx_pool: Weak<RwLock<TransactionPool<B, P, V>>>
sync_state: Weak<SyncState>
Implementations
impl<B, P, V> Foreign<B, P, V> where
B: BlockChain,
P: PoolAdapter,
V: VerifierCache + 'static,
[src]
B: BlockChain,
P: PoolAdapter,
V: VerifierCache + 'static,
pub fn new(
chain: Weak<Chain>,
tx_pool: Weak<RwLock<TransactionPool<B, P, V>>>,
sync_state: Weak<SyncState>
) -> Self
[src]
chain: Weak<Chain>,
tx_pool: Weak<RwLock<TransactionPool<B, P, V>>>,
sync_state: Weak<SyncState>
) -> Self
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.
pub fn get_header(
&self,
height: Option<u64>,
hash: Option<Hash>,
commit: Option<String>
) -> Result<BlockHeaderPrintable, Error>
[src]
&self,
height: Option<u64>,
hash: Option<Hash>,
commit: Option<String>
) -> Result<BlockHeaderPrintable, Error>
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.
pub fn get_block(
&self,
height: Option<u64>,
hash: Option<Hash>,
commit: Option<String>
) -> Result<BlockPrintable, Error>
[src]
&self,
height: Option<u64>,
hash: Option<Hash>,
commit: Option<String>
) -> Result<BlockPrintable, Error>
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_version(&self) -> Result<Version, Error>
[src]
Returns the node version and block header version (used by grin-wallet).
Returns
pub fn get_tip(&self) -> Result<Tip, Error>
[src]
Returns details about the state of the current fork tip.
Returns
pub fn get_kernel(
&self,
excess: String,
min_height: Option<u64>,
max_height: Option<u64>
) -> Result<LocatedTxKernel, Error>
[src]
&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.
pub fn get_outputs(
&self,
commits: Option<Vec<String>>,
start_height: Option<u64>,
end_height: Option<u64>,
include_proof: Option<bool>,
include_merkle_proof: Option<bool>
) -> Result<Vec<OutputPrintable>, Error>
[src]
&self,
commits: Option<Vec<String>>,
start_height: Option<u64>,
end_height: Option<u64>,
include_proof: Option<bool>,
include_merkle_proof: Option<bool>
) -> Result<Vec<OutputPrintable>, Error>
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.
pub fn get_unspent_outputs(
&self,
start_index: u64,
end_index: Option<u64>,
max: u64,
include_proof: Option<bool>
) -> Result<OutputListing, Error>
[src]
&self,
start_index: u64,
end_index: Option<u64>,
max: u64,
include_proof: Option<bool>
) -> Result<OutputListing, Error>
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>
[src]
&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.
pub fn get_pool_size(&self) -> Result<usize, Error>
[src]
Returns the number of transaction in the transaction pool.
Returns
- Result Containing:
usize
- or
Error
if an error is encountered.
pub fn get_stempool_size(&self) -> Result<usize, Error>
[src]
Returns the number of transaction in the stem transaction pool.
Returns
- Result Containing:
usize
- or
Error
if an error is encountered.
pub fn get_unconfirmed_transactions(&self) -> Result<Vec<PoolEntry>, Error>
[src]
Returns the unconfirmed transactions in the transaction pool. Will not return transactions in the stempool.
Returns
pub fn push_transaction(
&self,
tx: Transaction,
fluff: Option<bool>
) -> Result<(), Error>
[src]
&self,
tx: Transaction,
fluff: Option<bool>
) -> Result<(), Error>
Trait Implementations
impl<B, P, V> ForeignRpc for Foreign<B, P, V> where
B: BlockChain,
P: PoolAdapter,
V: VerifierCache + 'static,
[src]
B: BlockChain,
P: PoolAdapter,
V: VerifierCache + 'static,
pub fn get_header(
&self,
height: Option<u64>,
hash: Option<String>,
commit: Option<String>
) -> Result<BlockHeaderPrintable, ErrorKind>
[src]
&self,
height: Option<u64>,
hash: Option<String>,
commit: Option<String>
) -> Result<BlockHeaderPrintable, ErrorKind>
pub fn get_block(
&self,
height: Option<u64>,
hash: Option<String>,
commit: Option<String>
) -> Result<BlockPrintable, ErrorKind>
[src]
&self,
height: Option<u64>,
hash: Option<String>,
commit: Option<String>
) -> Result<BlockPrintable, ErrorKind>
pub fn get_version(&self) -> Result<Version, ErrorKind>
[src]
pub fn get_tip(&self) -> Result<Tip, ErrorKind>
[src]
pub fn get_kernel(
&self,
excess: String,
min_height: Option<u64>,
max_height: Option<u64>
) -> Result<LocatedTxKernel, ErrorKind>
[src]
&self,
excess: String,
min_height: Option<u64>,
max_height: Option<u64>
) -> Result<LocatedTxKernel, ErrorKind>
pub fn get_outputs(
&self,
commits: Option<Vec<String>>,
start_height: Option<u64>,
end_height: Option<u64>,
include_proof: Option<bool>,
include_merkle_proof: Option<bool>
) -> Result<Vec<OutputPrintable>, ErrorKind>
[src]
&self,
commits: Option<Vec<String>>,
start_height: Option<u64>,
end_height: Option<u64>,
include_proof: Option<bool>,
include_merkle_proof: Option<bool>
) -> Result<Vec<OutputPrintable>, ErrorKind>
pub fn get_unspent_outputs(
&self,
start_index: u64,
end_index: Option<u64>,
max: u64,
include_proof: Option<bool>
) -> Result<OutputListing, ErrorKind>
[src]
&self,
start_index: u64,
end_index: Option<u64>,
max: u64,
include_proof: Option<bool>
) -> Result<OutputListing, ErrorKind>
pub fn get_pmmr_indices(
&self,
start_block_height: u64,
end_block_height: Option<u64>
) -> Result<OutputListing, ErrorKind>
[src]
&self,
start_block_height: u64,
end_block_height: Option<u64>
) -> Result<OutputListing, ErrorKind>
pub fn get_pool_size(&self) -> Result<usize, ErrorKind>
[src]
pub fn get_stempool_size(&self) -> Result<usize, ErrorKind>
[src]
pub fn get_unconfirmed_transactions(&self) -> Result<Vec<PoolEntry>, ErrorKind>
[src]
pub fn push_transaction(
&self,
tx: Transaction,
fluff: Option<bool>
) -> Result<(), ErrorKind>
[src]
&self,
tx: Transaction,
fluff: Option<bool>
) -> Result<(), ErrorKind>
Auto Trait Implementations
impl<B, P, V> !RefUnwindSafe for Foreign<B, P, V>
[src]
impl<B, P, V> Send for Foreign<B, P, V>
[src]
impl<B, P, V> Sync for Foreign<B, P, V>
[src]
impl<B, P, V> Unpin for Foreign<B, P, V>
[src]
impl<B, P, V> !UnwindSafe for Foreign<B, P, V>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SafeBorrow<T> for T where
T: ?Sized,
T: ?Sized,
pub fn borrow_replacement(ptr: &T) -> &T
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> UnsafeAny for T where
T: Any,
T: Any,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,