Struct Rpc

Source
pub struct Rpc {
    pub client: Client,
    pub url: Url,
    pub id_generator: IdGenerator,
}

Fields§

§client: Client§url: Url§id_generator: IdGenerator

Implementations§

Source§

impl Rpc

Source

pub fn new(uri: &str, client: Client) -> Self

Source

pub fn get_block(&self, _hash: H256) -> Result<Option<BlockView>, Error>

Source

pub fn get_fork_block(&self, _hash: H256) -> Result<Option<BlockView>, Error>

Source

pub fn get_block_by_number( &self, _number: BlockNumber, ) -> Result<Option<BlockView>, Error>

Source

pub fn get_header(&self, _hash: H256) -> Result<Option<HeaderView>, Error>

Source

pub fn get_header_by_number( &self, _number: BlockNumber, ) -> Result<Option<HeaderView>, Error>

Source

pub fn get_transaction( &self, _hash: H256, ) -> Result<Option<TransactionWithStatus>, Error>

Source

pub fn get_block_hash( &self, _number: BlockNumber, ) -> Result<Option<H256>, Error>

Source

pub fn get_tip_header(&self) -> Result<HeaderView, Error>

Source

pub fn get_cells_by_lock_hash( &self, _lock_hash: H256, _from: BlockNumber, _to: BlockNumber, ) -> Result<Vec<CellOutputWithOutPoint>, Error>

Source

pub fn get_live_cell( &self, _out_point: OutPoint, _with_data: bool, ) -> Result<CellWithStatus, Error>

Source

pub fn get_tip_block_number(&self) -> Result<BlockNumber, Error>

Source

pub fn get_current_epoch(&self) -> Result<EpochView, Error>

Source

pub fn get_epoch_by_number( &self, number: EpochNumber, ) -> Result<Option<EpochView>, Error>

Source

pub fn local_node_info(&self) -> Result<LocalNode, Error>

Source

pub fn get_peers(&self) -> Result<Vec<RemoteNode>, Error>

Source

pub fn get_banned_addresses(&self) -> Result<Vec<BannedAddr>, Error>

Source

pub fn set_ban( &self, address: String, command: String, ban_time: Option<Timestamp>, absolute: Option<bool>, reason: Option<String>, ) -> Result<(), Error>

Source

pub fn get_block_template( &self, bytes_limit: Option<Uint64>, proposals_limit: Option<Uint64>, max_version: Option<Version>, ) -> Result<BlockTemplate, Error>

Source

pub fn submit_block( &self, _work_id: String, _data: Block, ) -> Result<H256, Error>

Source

pub fn get_blockchain_info(&self) -> Result<ChainInfo, Error>

Source

pub fn get_peers_state(&self) -> Result<Vec<PeerState>, Error>

Source

pub fn compute_transaction_hash(&self, tx: Transaction) -> Result<H256, Error>

Source

pub fn dry_run_transaction( &self, _tx: Transaction, ) -> Result<DryRunResult, Error>

Source

pub fn send_transaction(&self, tx: Transaction) -> Result<H256, Error>

Source

pub fn tx_pool_info(&self) -> Result<TxPoolInfo, Error>

Source

pub fn send_alert(&self, alert: Alert) -> Result<(), Error>

Source

pub fn add_node(&self, peer_id: String, address: String) -> Result<(), Error>

Source

pub fn remove_node(&self, peer_id: String) -> Result<(), Error>

Source

pub fn process_block_without_verify( &self, _data: Block, ) -> Result<Option<H256>, Error>

Source

pub fn get_live_cells_by_lock_hash( &self, lock_hash: H256, page: Uint64, per_page: Uint64, reverse_order: Option<bool>, ) -> Result<Vec<LiveCell>, Error>

Source

pub fn get_transactions_by_lock_hash( &self, lock_hash: H256, page: Uint64, per_page: Uint64, reverse_order: Option<bool>, ) -> Result<Vec<CellTransaction>, Error>

Source

pub fn index_lock_hash( &self, lock_hash: H256, index_from: Option<BlockNumber>, ) -> Result<LockHashIndexState, Error>

Source

pub fn deindex_lock_hash(&self, lock_hash: H256) -> Result<(), Error>

Source

pub fn get_lock_hash_index_states( &self, ) -> Result<Vec<LockHashIndexState>, Error>

Source

pub fn calculate_dao_maximum_withdraw( &self, _out_point: OutPoint, _hash: H256, ) -> Result<Capacity, Error>

Source

pub fn get_cellbase_output_capacity_details( &self, _hash: H256, ) -> Result<Option<BlockReward>, Error>

Source

pub fn broadcast_transaction( &self, tx: Transaction, cycles: Cycle, ) -> Result<H256, Error>

Source

pub fn estimate_fee_rate( &self, expect_confirm_blocks: Uint64, ) -> Result<EstimateResult, Error>

Auto Trait Implementations§

§

impl !Freeze for Rpc

§

impl !RefUnwindSafe for Rpc

§

impl Send for Rpc

§

impl Sync for Rpc

§

impl Unpin for Rpc

§

impl !UnwindSafe for Rpc

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsAny for T
where T: Any,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

TODO(doc): @quake
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> Erased for T

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T