Trait CitreaClientT

Source
pub trait CitreaClientT:
    Send
    + Sync
    + Debug
    + Clone
    + 'static {
    // Required methods
    fn new<'async_trait>(
        citrea_rpc_url: String,
        light_client_prover_url: String,
        chain_id: u32,
        secret_key: Option<PrivateKeySigner>,
        timeout: Option<Duration>,
    ) -> Pin<Box<dyn Future<Output = Result<Self, BridgeError>> + Send + 'async_trait>>
       where Self: 'async_trait;
    fn collect_deposit_move_txids<'life0, 'async_trait>(
        &'life0 self,
        last_deposit_idx: Option<u32>,
        to_height: u64,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<(u64, Txid)>, BridgeError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn collect_withdrawal_utxos<'life0, 'async_trait>(
        &'life0 self,
        last_withdrawal_idx: Option<u32>,
        to_height: u64,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<(u64, OutPoint)>, BridgeError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_light_client_proof<'life0, 'async_trait>(
        &'life0 self,
        l1_height: u64,
        paramset: &'static ProtocolParamset,
    ) -> Pin<Box<dyn Future<Output = Result<Option<(LightClientProof, Receipt, u64)>, BridgeError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_citrea_l2_height_range<'life0, 'async_trait>(
        &'life0 self,
        block_height: u64,
        timeout: Duration,
        paramset: &'static ProtocolParamset,
    ) -> Pin<Box<dyn Future<Output = Result<(u64, u64), BridgeError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_replacement_deposit_move_txids<'life0, 'async_trait>(
        &'life0 self,
        from_height: u64,
        to_height: u64,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<(u32, Txid)>, BridgeError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn check_nofn_correctness<'life0, 'async_trait>(
        &'life0 self,
        nofn_xonly_pk: XOnlyPublicKey,
    ) -> Pin<Box<dyn Future<Output = Result<(), BridgeError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_storage_proof<'life0, 'async_trait>(
        &'life0 self,
        l2_height: u64,
        deposit_index: u32,
    ) -> Pin<Box<dyn Future<Output = Result<StorageProof, BridgeError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn fetch_validate_and_store_lcp<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        payout_block_height: u64,
        deposit_index: u32,
        db: &'life1 Database,
        dbtx: Option<DatabaseTransaction<'life2>>,
        paramset: &'static ProtocolParamset,
    ) -> Pin<Box<dyn Future<Output = Result<Receipt, BridgeError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_current_l2_block_height<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<u32, BridgeError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}

Required Methods§

Source

fn new<'async_trait>( citrea_rpc_url: String, light_client_prover_url: String, chain_id: u32, secret_key: Option<PrivateKeySigner>, timeout: Option<Duration>, ) -> Pin<Box<dyn Future<Output = Result<Self, BridgeError>> + Send + 'async_trait>>
where Self: 'async_trait,

§Parameters
  • citrea_rpc_url: URL of the Citrea RPC.
  • light_client_prover_url: URL of the Citrea light client prover RPC.
  • chain_id: Citrea’s EVM chain id.
  • secret_key: EVM secret key of the EVM user. If not given, random secret key is used (wallet is not required). This is given mostly for testing purposes.
Source

fn collect_deposit_move_txids<'life0, 'async_trait>( &'life0 self, last_deposit_idx: Option<u32>, to_height: u64, ) -> Pin<Box<dyn Future<Output = Result<Vec<(u64, Txid)>, BridgeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns deposit move txids, starting from the last deposit index.

§Parameters
  • last_deposit_idx: Last deposit index. None if no deposit
  • to_height: End block height (inclusive)
Source

fn collect_withdrawal_utxos<'life0, 'async_trait>( &'life0 self, last_withdrawal_idx: Option<u32>, to_height: u64, ) -> Pin<Box<dyn Future<Output = Result<Vec<(u64, OutPoint)>, BridgeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns withdrawal utxos, starting from the last withdrawal index.

§Parameters
  • last_withdrawal_idx: Last withdrawal index. None if no withdrawal
  • to_height: End block height (inclusive)
Source

fn get_light_client_proof<'life0, 'async_trait>( &'life0 self, l1_height: u64, paramset: &'static ProtocolParamset, ) -> Pin<Box<dyn Future<Output = Result<Option<(LightClientProof, Receipt, u64)>, BridgeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the light client proof and its L2 height for the given L1 block height.

§Returns

A tuple, wrapped around a Some if present:

If not present, None is returned.

Source

fn get_citrea_l2_height_range<'life0, 'async_trait>( &'life0 self, block_height: u64, timeout: Duration, paramset: &'static ProtocolParamset, ) -> Pin<Box<dyn Future<Output = Result<(u64, u64), BridgeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the L2 block height range for the given L1 block height.

§Parameters
  • block_height: L1 block height.
  • timeout: Timeout duration.
§Returns

A tuple of:

  • u64: Start of the L2 block height (not inclusive)
  • u64: End of the L2 block height (inclusive)
Source

fn get_replacement_deposit_move_txids<'life0, 'async_trait>( &'life0 self, from_height: u64, to_height: u64, ) -> Pin<Box<dyn Future<Output = Result<Vec<(u32, Txid)>, BridgeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the replacement deposit move txids for the given range of blocks.

§Parameters
  • from_height: Start block height (inclusive)
  • to_height: End block height (inclusive)
§Returns

A vector of tuples, each containing:

  • [Txid]: The original move txid.
  • [Txid]: The replacement move txid.
Source

fn check_nofn_correctness<'life0, 'async_trait>( &'life0 self, nofn_xonly_pk: XOnlyPublicKey, ) -> Pin<Box<dyn Future<Output = Result<(), BridgeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_storage_proof<'life0, 'async_trait>( &'life0 self, l2_height: u64, deposit_index: u32, ) -> Pin<Box<dyn Future<Output = Result<StorageProof, BridgeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn fetch_validate_and_store_lcp<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, payout_block_height: u64, deposit_index: u32, db: &'life1 Database, dbtx: Option<DatabaseTransaction<'life2>>, paramset: &'static ProtocolParamset, ) -> Pin<Box<dyn Future<Output = Result<Receipt, BridgeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn get_current_l2_block_height<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<u32, BridgeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the current L2 block height from Citrea.

§Returns
  • Result<u32, BridgeError>: Current L2 block height, or an error if the request fails or the value doesn’t fit in u32.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§