pub struct MiningWallet { /* private fields */ }Expand description
Quantum-safe mining wallet
Implementations§
Source§impl MiningWallet
impl MiningWallet
Sourcepub async fn generate(level: SecurityLevel) -> Result<Self, WalletError>
pub async fn generate(level: SecurityLevel) -> Result<Self, WalletError>
Generate a new quantum-safe wallet
Sourcepub async fn generate_default() -> Result<Self, WalletError>
pub async fn generate_default() -> Result<Self, WalletError>
Generate with default security level (Level 3)
Sourcepub fn from_secret_key(
secret_key: &[u8],
level: SecurityLevel,
) -> Result<Self, WalletError>
pub fn from_secret_key( secret_key: &[u8], level: SecurityLevel, ) -> Result<Self, WalletError>
Import wallet from secret key
Sourcepub async fn import_encrypted(
path: &Path,
passphrase: &str,
) -> Result<Self, WalletError>
pub async fn import_encrypted( path: &Path, passphrase: &str, ) -> Result<Self, WalletError>
Import wallet from encrypted file
Sourcepub fn import_from_bytes(
encrypted_data: &[u8],
passphrase: &str,
) -> Result<Self, WalletError>
pub fn import_from_bytes( encrypted_data: &[u8], passphrase: &str, ) -> Result<Self, WalletError>
Import wallet from encrypted bytes (in-memory)
Sourcepub fn public_key(&self) -> &[u8] ⓘ
pub fn public_key(&self) -> &[u8] ⓘ
Get public key bytes
Sourcepub fn security_level(&self) -> SecurityLevel
pub fn security_level(&self) -> SecurityLevel
Get security level
Sourcepub async fn sign(&self, message: &[u8]) -> Result<Vec<u8>, WalletError>
pub async fn sign(&self, message: &[u8]) -> Result<Vec<u8>, WalletError>
Sign a message with ML-DSA
Sourcepub async fn sign_transaction(
&self,
tx_hash: &[u8; 32],
) -> Result<Vec<u8>, WalletError>
pub async fn sign_transaction( &self, tx_hash: &[u8; 32], ) -> Result<Vec<u8>, WalletError>
Sign a transaction hash
Sourcepub fn export_encrypted(
&self,
path: &Path,
passphrase: &str,
) -> Result<(), WalletError>
pub fn export_encrypted( &self, path: &Path, passphrase: &str, ) -> Result<(), WalletError>
Export encrypted wallet to file
Sourcepub fn export_to_bytes(&self, passphrase: &str) -> Result<Vec<u8>, WalletError>
pub fn export_to_bytes(&self, passphrase: &str) -> Result<Vec<u8>, WalletError>
Export wallet to encrypted bytes (in-memory)
Sourcepub async fn register_miner(
&self,
ledger: &MiningLedger,
capabilities: &[u8],
stats: &PerformanceStats,
) -> Result<String, WalletError>
pub async fn register_miner( &self, ledger: &MiningLedger, capabilities: &[u8], stats: &PerformanceStats, ) -> Result<String, WalletError>
Register as a miner on the ledger
Sourcepub async fn submit_proof(
&self,
ledger: &MiningLedger,
reward_type: MiningRewardType,
proof: &[u8],
) -> Result<String, WalletError>
pub async fn submit_proof( &self, ledger: &MiningLedger, reward_type: MiningRewardType, proof: &[u8], ) -> Result<String, WalletError>
Submit a mining proof
Sourcepub async fn claim_rewards(
&self,
ledger: &MiningLedger,
amount: u128,
recipient: Option<&str>,
) -> Result<String, WalletError>
pub async fn claim_rewards( &self, ledger: &MiningLedger, amount: u128, recipient: Option<&str>, ) -> Result<String, WalletError>
Claim mining rewards
Sourcepub async fn teleport_to_evm(
&self,
ledger: &MiningLedger,
destination: TeleportDestination,
amount: u128,
to_address: Option<&str>,
) -> Result<TeleportTransfer, WalletError>
pub async fn teleport_to_evm( &self, ledger: &MiningLedger, destination: TeleportDestination, amount: u128, to_address: Option<&str>, ) -> Result<TeleportTransfer, WalletError>
Teleport AI coins to an EVM chain
Sourcepub async fn get_pending_rewards(
&self,
ledger: &MiningLedger,
) -> Result<u128, WalletError>
pub async fn get_pending_rewards( &self, ledger: &MiningLedger, ) -> Result<u128, WalletError>
Get pending rewards from ledger
Sourcepub async fn get_evm_balance(
&self,
chain: TeleportDestination,
) -> Result<u128, WalletError>
pub async fn get_evm_balance( &self, chain: TeleportDestination, ) -> Result<u128, WalletError>
Get EVM balance (after teleport)
Sourcepub fn verify(
public_key: &[u8],
message: &[u8],
signature: &[u8],
level: SecurityLevel,
) -> Result<bool, WalletError>
pub fn verify( public_key: &[u8], message: &[u8], signature: &[u8], level: SecurityLevel, ) -> Result<bool, WalletError>
Verify a signature
Trait Implementations§
Source§impl Drop for MiningWallet
impl Drop for MiningWallet
Auto Trait Implementations§
impl Freeze for MiningWallet
impl RefUnwindSafe for MiningWallet
impl Send for MiningWallet
impl Sync for MiningWallet
impl Unpin for MiningWallet
impl UnsafeUnpin for MiningWallet
impl UnwindSafe for MiningWallet
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