Struct ethers_signers::Ledger
source · pub struct Ledger { /* private fields */ }
Expand description
A Ledger Ethereum App.
This is a simple wrapper around the Ledger transport
Implementations§
source§impl LedgerEthereum
impl LedgerEthereum
sourcepub async fn new(
derivation: DerivationType,
chain_id: u64
) -> Result<Self, LedgerError>
pub async fn new(
derivation: DerivationType,
chain_id: u64
) -> Result<Self, LedgerError>
Instantiate the application by acquiring a lock on the ledger device.
use ethers_signers::{Ledger, HDPath};
let ledger = Ledger::new(HDPath::LedgerLive(0), 1).await?;
sourcepub async fn get_address(&self) -> Result<Address, LedgerError>
pub async fn get_address(&self) -> Result<Address, LedgerError>
Get the account which corresponds to our derivation path
sourcepub async fn get_address_with_path(
&self,
derivation: &DerivationType
) -> Result<Address, LedgerError>
pub async fn get_address_with_path(
&self,
derivation: &DerivationType
) -> Result<Address, LedgerError>
Gets the account which corresponds to the provided derivation path
sourcepub async fn version(&self) -> Result<String, LedgerError>
pub async fn version(&self) -> Result<String, LedgerError>
Returns the semver of the Ethereum ledger app
sourcepub async fn sign_tx(
&self,
tx: &TypedTransaction
) -> Result<Signature, LedgerError>
pub async fn sign_tx(
&self,
tx: &TypedTransaction
) -> Result<Signature, LedgerError>
Signs an Ethereum transaction (requires confirmation on the ledger)
sourcepub async fn sign_message<S: AsRef<[u8]>>(
&self,
message: S
) -> Result<Signature, LedgerError>
pub async fn sign_message<S: AsRef<[u8]>>(
&self,
message: S
) -> Result<Signature, LedgerError>
Signs an ethereum personal message
sourcepub async fn sign_typed_struct<T>(
&self,
payload: &T
) -> Result<Signature, LedgerError>where
T: Eip712,
pub async fn sign_typed_struct<T>(
&self,
payload: &T
) -> Result<Signature, LedgerError>where
T: Eip712,
Signs an EIP712 encoded domain separator and message
pub async fn sign_payload(
&self,
command: INS,
payload: Vec<u8>
) -> Result<Signature, LedgerError>
Trait Implementations§
source§impl Debug for LedgerEthereum
impl Debug for LedgerEthereum
source§impl Signer for LedgerEthereum
impl Signer for LedgerEthereum
source§fn sign_message<'life0, 'async_trait, S>(
&'life0 self,
message: S
) -> Pin<Box<dyn Future<Output = Result<Signature, Self::Error>> + Send + 'async_trait>>where
S: 'async_trait + Send + Sync + AsRef<[u8]>,
'life0: 'async_trait,
Self: 'async_trait,
fn sign_message<'life0, 'async_trait, S>(
&'life0 self,
message: S
) -> Pin<Box<dyn Future<Output = Result<Signature, Self::Error>> + Send + 'async_trait>>where
S: 'async_trait + Send + Sync + AsRef<[u8]>,
'life0: 'async_trait,
Self: 'async_trait,
Signs the hash of the provided message after prefixing it
source§fn sign_transaction<'life0, 'life1, 'async_trait>(
&'life0 self,
message: &'life1 TypedTransaction
) -> Pin<Box<dyn Future<Output = Result<Signature, Self::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn sign_transaction<'life0, 'life1, 'async_trait>(
&'life0 self,
message: &'life1 TypedTransaction
) -> Pin<Box<dyn Future<Output = Result<Signature, Self::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Signs the transaction
source§fn sign_typed_data<'life0, 'life1, 'async_trait, T>(
&'life0 self,
payload: &'life1 T
) -> Pin<Box<dyn Future<Output = Result<Signature, Self::Error>> + Send + 'async_trait>>where
T: 'async_trait + Eip712 + Send + Sync,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn sign_typed_data<'life0, 'life1, 'async_trait, T>(
&'life0 self,
payload: &'life1 T
) -> Pin<Box<dyn Future<Output = Result<Signature, Self::Error>> + Send + 'async_trait>>where
T: 'async_trait + Eip712 + Send + Sync,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Signs a EIP712 derived struct
type Error = LedgerError
source§fn with_chain_id<T: Into<u64>>(self, chain_id: T) -> Self
fn with_chain_id<T: Into<u64>>(self, chain_id: T) -> Self
Sets the signer’s chain id