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]

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]

Wrap authentication around create_raw_transaction

pub async fn create_transaction_kernel_protected(
    self,
    params: Params,
    meta: Meta
) -> Result<Value, Error>
[src]

Wrap authentication around create_transaction_kernel

pub async fn create_transaction_protected(
    self,
    params: Params,
    meta: Meta
) -> Result<Value, Error>
[src]

Wrap authentication around create_transaction

pub async fn get_record_commitment_count_protected(
    self,
    params: Params,
    meta: Meta
) -> Result<Value, Error>
[src]

Wrap authentication around get_record_commitment_count

pub async fn get_record_commitments_protected(
    self,
    params: Params,
    meta: Meta
) -> Result<Value, Error>
[src]

Wrap authentication around get_record_commitments

pub async fn get_raw_record_protected(
    self,
    params: Params,
    meta: Meta
) -> Result<Value, Error>
[src]

Wrap authentication around get_raw_record

pub async fn decode_record_protected(
    self,
    params: Params,
    meta: Meta
) -> Result<Value, Error>
[src]

Wrap authentication around decode_record

pub async fn decrypt_record_protected(
    self,
    params: Params,
    meta: Meta
) -> Result<Value, Error>
[src]

Wrap authentication around decrypt_record

pub async fn create_account_protected(
    self,
    params: Params,
    meta: Meta
) -> Result<Value, Error>
[src]

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]

impl<S: Storage> Deref for RpcImpl<S>[src]

type Target = RpcInner<S>

The resulting type after dereferencing.

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]

Create a new transaction, returning the encoded transaction and the new records.

fn create_transaction_kernel(
    &self,
    transaction_input: TransactionInputs
) -> Result<String, RpcError>
[src]

Generates and returns a new transaction kernel.

fn create_transaction(
    &self,
    transaction_kernel: String
) -> Result<CreateRawTransactionOuput, RpcError>
[src]

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]

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]

Returns the hex encoded bytes of a transaction from its transaction id.

fn get_transaction_info(
    &self,
    transaction_id: String
) -> Result<TransactionInfo, RpcError>
[src]

Returns information about a transaction from a transaction id.

fn decode_raw_transaction(
    &self,
    transaction_bytes: String
) -> Result<TransactionInfo, RpcError>
[src]

Returns information about a transaction from serialized transaction bytes.

fn send_raw_transaction(
    &self,
    transaction_bytes: String
) -> Result<String, RpcError>
[src]

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]

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.

Auto Trait Implementations

impl<S> !RefUnwindSafe for RpcImpl<S>

impl<S> Send for RpcImpl<S> where
    S: Send + Sync

impl<S> Sync for RpcImpl<S> where
    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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> WithSubscriber for T[src]