Struct snarkos_rpc::RpcImpl [−][src]
pub struct RpcImpl<S: Storage>(_);
Implements JSON-RPC HTTP endpoint functions for a node. The constructor is given Arc::clone() copies of all needed node components.
Implementations
impl<S: Storage + Send + Sync + 'static> RpcImpl<S>
[src]
pub fn new(
storage: Arc<MerkleTreeLedger<S>>,
credentials: Option<RpcCredentials>,
node: Node<S>
) -> Self
[src]
storage: Arc<MerkleTreeLedger<S>>,
credentials: Option<RpcCredentials>,
node: Node<S>
) -> Self
Creates a new struct for calling public and private RPC endpoints.
pub fn consensus_layer(&self) -> Result<&Arc<Consensus<S>>, RpcError>
[src]
pub fn consensus_parameters(&self) -> Result<&ConsensusParameters, RpcError>
[src]
pub fn parameters(&self) -> Result<&PublicParameters<Components>, RpcError>
[src]
pub fn memory_pool(&self) -> Result<&Mutex<MemoryPool<Tx>>, RpcError>
[src]
impl<S: Storage + Send + Sync + 'static> RpcImpl<S>
[src]
The following *_protected
functions wrap an authentication check around sensitive functions
before being exposed as an RPC endpoint
pub fn validate_auth(&self, meta: Meta) -> Result<(), Error>
[src]
Validate the authentication header in the request metadata
pub async fn create_raw_transaction_protected(
self,
params: Params,
meta: Meta
) -> Result<Value, Error>
[src]
self,
params: Params,
meta: Meta
) -> Result<Value, Error>
Wrap authentication around create_raw_transaction
pub async fn create_transaction_kernel_protected(
self,
params: Params,
meta: Meta
) -> Result<Value, Error>
[src]
self,
params: Params,
meta: Meta
) -> Result<Value, Error>
Wrap authentication around create_transaction_kernel
pub async fn create_transaction_protected(
self,
params: Params,
meta: Meta
) -> Result<Value, Error>
[src]
self,
params: Params,
meta: Meta
) -> Result<Value, Error>
Wrap authentication around create_transaction
pub async fn get_record_commitment_count_protected(
self,
params: Params,
meta: Meta
) -> Result<Value, Error>
[src]
self,
params: Params,
meta: Meta
) -> Result<Value, Error>
Wrap authentication around get_record_commitment_count
pub async fn get_record_commitments_protected(
self,
params: Params,
meta: Meta
) -> Result<Value, Error>
[src]
self,
params: Params,
meta: Meta
) -> Result<Value, Error>
Wrap authentication around get_record_commitments
pub async fn get_raw_record_protected(
self,
params: Params,
meta: Meta
) -> Result<Value, Error>
[src]
self,
params: Params,
meta: Meta
) -> Result<Value, Error>
Wrap authentication around get_raw_record
pub async fn decode_record_protected(
self,
params: Params,
meta: Meta
) -> Result<Value, Error>
[src]
self,
params: Params,
meta: Meta
) -> Result<Value, Error>
Wrap authentication around decode_record
pub async fn decrypt_record_protected(
self,
params: Params,
meta: Meta
) -> Result<Value, Error>
[src]
self,
params: Params,
meta: Meta
) -> Result<Value, Error>
Wrap authentication around decrypt_record
pub async fn create_account_protected(
self,
params: Params,
meta: Meta
) -> Result<Value, Error>
[src]
self,
params: Params,
meta: Meta
) -> Result<Value, Error>
Wrap authentication around create_account
pub fn add_protected(&self, io: &mut MetaIoHandler<Meta>)
[src]
Expose the protected functions as RPC enpoints
Trait Implementations
impl<S: Storage> Clone for RpcImpl<S>
[src]
fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<S: Storage> Deref for RpcImpl<S>
[src]
type Target = RpcInner<S>
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
impl<S: Storage + Send + Sync + 'static> ProtectedRpcFunctions for RpcImpl<S>
[src]
Functions that are sensitive and need to be protected with authentication.
The authentication logic is defined in validate_auth
fn create_account(&self) -> Result<RpcAccount, RpcError>
[src]
Generate a new account private key, account view key, and account address.
fn create_raw_transaction(
&self,
transaction_input: TransactionInputs
) -> Result<CreateRawTransactionOuput, RpcError>
[src]
&self,
transaction_input: TransactionInputs
) -> Result<CreateRawTransactionOuput, RpcError>
Create a new transaction, returning the encoded transaction and the new records.
fn create_transaction_kernel(
&self,
transaction_input: TransactionInputs
) -> Result<String, RpcError>
[src]
&self,
transaction_input: TransactionInputs
) -> Result<String, RpcError>
Generates and returns a new transaction kernel.
fn create_transaction(
&self,
transaction_kernel: String
) -> Result<CreateRawTransactionOuput, RpcError>
[src]
&self,
transaction_kernel: String
) -> Result<CreateRawTransactionOuput, RpcError>
Create a new transaction for a given transaction kernel.
fn get_record_commitment_count(&self) -> Result<usize, RpcError>
[src]
Returns the number of record commitments that are stored on the full node.
fn get_record_commitments(&self) -> Result<Vec<String>, RpcError>
[src]
Returns a list of record commitments that are stored on the full node.
fn get_raw_record(&self, record_commitment: String) -> Result<String, RpcError>
[src]
Returns the hex encoded bytes of a record from its record commitment
fn decrypt_record(
&self,
decryption_input: DecryptRecordInput
) -> Result<String, RpcError>
[src]
&self,
decryption_input: DecryptRecordInput
) -> Result<String, RpcError>
Decrypts the record ciphertext and returns the hex encoded bytes of the record.
fn decode_record(&self, record_bytes: String) -> Result<RecordInfo, RpcError>
[src]
Returns information about a record from serialized record bytes.
impl<S: Storage + Send + Sync + 'static> RpcFunctions for RpcImpl<S>
[src]
fn get_block(&self, block_hash_string: String) -> Result<BlockInfo, RpcError>
[src]
Returns information about a block from a block hash.
fn get_block_count(&self) -> Result<u32, RpcError>
[src]
Returns the number of blocks in the canonical chain.
fn get_best_block_hash(&self) -> Result<String, RpcError>
[src]
Returns the block hash of the head of the canonical chain.
fn get_block_hash(&self, block_height: u32) -> Result<String, RpcError>
[src]
Returns the block hash of the index specified if it exists in the canonical chain.
fn get_raw_transaction(
&self,
transaction_id: String
) -> Result<String, RpcError>
[src]
&self,
transaction_id: String
) -> Result<String, RpcError>
Returns the hex encoded bytes of a transaction from its transaction id.
fn get_transaction_info(
&self,
transaction_id: String
) -> Result<TransactionInfo, RpcError>
[src]
&self,
transaction_id: String
) -> Result<TransactionInfo, RpcError>
Returns information about a transaction from a transaction id.
fn decode_raw_transaction(
&self,
transaction_bytes: String
) -> Result<TransactionInfo, RpcError>
[src]
&self,
transaction_bytes: String
) -> Result<TransactionInfo, RpcError>
Returns information about a transaction from serialized transaction bytes.
fn send_raw_transaction(
&self,
transaction_bytes: String
) -> Result<String, RpcError>
[src]
&self,
transaction_bytes: String
) -> Result<String, RpcError>
Send raw transaction bytes to this node to be added into the mempool. If valid, the transaction will be stored and propagated to all peers. Returns the transaction id if valid.
fn validate_raw_transaction(
&self,
transaction_bytes: String
) -> Result<bool, RpcError>
[src]
&self,
transaction_bytes: String
) -> Result<bool, RpcError>
Validate and return if the transaction is valid.
fn get_connection_count(&self) -> Result<usize, RpcError>
[src]
Fetch the number of connected peers this node has.
fn get_peer_info(&self) -> Result<PeerInfo, RpcError>
[src]
Returns this nodes connected peers.
fn get_node_info(&self) -> Result<NodeInfo, RpcError>
[src]
Returns data about the node.
fn get_block_template(&self) -> Result<BlockTemplate, RpcError>
[src]
Returns the current mempool and consensus information known by this node.
fn to_delegate<M: Metadata>(self) -> IoDelegate<Self, M>
[src]
Auto Trait Implementations
impl<S> !RefUnwindSafe for RpcImpl<S>
impl<S> Send for RpcImpl<S> where
S: Send + Sync,
S: Send + Sync,
impl<S> Sync for RpcImpl<S> where
S: Send + Sync,
S: Send + Sync,
impl<S> Unpin for RpcImpl<S>
impl<S> !UnwindSafe for RpcImpl<S>
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> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
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<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
pub fn vzip(self) -> V
impl<T> WithSubscriber for T
[src]
pub fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]
S: Into<Dispatch>,