pub struct MiningLedger { /* private fields */ }Expand description
Global mining ledger client
Implementations§
Source§impl MiningLedger
impl MiningLedger
Sourcepub async fn connect(config: LedgerConfig) -> Result<Self, LedgerError>
pub async fn connect(config: LedgerConfig) -> Result<Self, LedgerError>
Connect to the global mining ledger
Sourcepub async fn get_block_height(&self) -> Result<u64, LedgerError>
pub async fn get_block_height(&self) -> Result<u64, LedgerError>
Get current block height
Sourcepub async fn register_miner(
&self,
public_key: &[u8],
capabilities: &[u8],
stats: &PerformanceStats,
signature: &[u8],
) -> Result<String, LedgerError>
pub async fn register_miner( &self, public_key: &[u8], capabilities: &[u8], stats: &PerformanceStats, signature: &[u8], ) -> Result<String, LedgerError>
Register a new miner
Sourcepub async fn submit_proof(
&self,
miner: &[u8],
reward_type: MiningRewardType,
proof: &[u8],
signature: &[u8],
) -> Result<String, LedgerError>
pub async fn submit_proof( &self, miner: &[u8], reward_type: MiningRewardType, proof: &[u8], signature: &[u8], ) -> Result<String, LedgerError>
Submit a mining proof
Sourcepub async fn claim_rewards(
&self,
miner: &[u8],
amount: u128,
recipient: &str,
proof: &[u8],
signature: &[u8],
) -> Result<String, LedgerError>
pub async fn claim_rewards( &self, miner: &[u8], amount: u128, recipient: &str, proof: &[u8], signature: &[u8], ) -> Result<String, LedgerError>
Claim accumulated rewards
Sourcepub async fn teleport_out(
&self,
from: &[u8],
destination: TeleportDestination,
to_address: &str,
amount: u128,
signature: &[u8],
) -> Result<TeleportTransfer, LedgerError>
pub async fn teleport_out( &self, from: &[u8], destination: TeleportDestination, to_address: &str, amount: u128, signature: &[u8], ) -> Result<TeleportTransfer, LedgerError>
Teleport AI coins to an EVM chain
Sourcepub async fn get_miner_state(
&self,
address: &str,
) -> Result<Option<MinerState>, LedgerError>
pub async fn get_miner_state( &self, address: &str, ) -> Result<Option<MinerState>, LedgerError>
Get miner state from ledger
Sourcepub async fn get_pending_rewards(
&self,
miner: &[u8],
) -> Result<u128, LedgerError>
pub async fn get_pending_rewards( &self, miner: &[u8], ) -> Result<u128, LedgerError>
Get pending rewards for a miner
Sourcepub async fn get_teleport_status(
&self,
teleport_id: &str,
) -> Result<TeleportStatus, LedgerError>
pub async fn get_teleport_status( &self, teleport_id: &str, ) -> Result<TeleportStatus, LedgerError>
Get teleport transfer status
Sourcepub async fn submit_vote(
&self,
voter: &[u8],
block_hash: [u8; 32],
vote_type: VoteType,
signature: &[u8],
) -> Result<(), LedgerError>
pub async fn submit_vote( &self, voter: &[u8], block_hash: [u8; 32], vote_type: VoteType, signature: &[u8], ) -> Result<(), LedgerError>
Submit a consensus vote
Sourcepub async fn get_transaction_status(
&self,
tx_hash: &str,
) -> Result<TransactionStatus, LedgerError>
pub async fn get_transaction_status( &self, tx_hash: &str, ) -> Result<TransactionStatus, LedgerError>
Get transaction status
Sourcepub async fn subscribe_blocks(
&self,
callback: impl Fn(BlockHeader) + Send + Sync + 'static,
)
pub async fn subscribe_blocks( &self, callback: impl Fn(BlockHeader) + Send + Sync + 'static, )
Subscribe to new blocks
Sourcepub async fn get_stats(&self) -> LedgerStats
pub async fn get_stats(&self) -> LedgerStats
Get ledger statistics
Auto Trait Implementations§
impl Freeze for MiningLedger
impl !RefUnwindSafe for MiningLedger
impl Send for MiningLedger
impl Sync for MiningLedger
impl Unpin for MiningLedger
impl UnsafeUnpin for MiningLedger
impl !UnwindSafe for MiningLedger
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more