pub struct Accounts<T> { /* private fields */ }Expand description
Accounts namespace
Implementations
sourceimpl<T: Transport> Accounts<T>
impl<T: Transport> Accounts<T>
sourcepub async fn sign_transaction<K: Key>(
&self,
tx: TransactionParameters,
key: K
) -> Result<SignedTransaction>
pub async fn sign_transaction<K: Key>(
&self,
tx: TransactionParameters,
key: K
) -> Result<SignedTransaction>
Signs an Ethereum transaction with a given private key.
Transaction signing can perform RPC requests in order to fill missing
parameters required for signing nonce, gas_price and chain_id. Note
that if all transaction parameters were provided, this future will resolve
immediately.
sourcepub fn sign<S>(&self, message: S, key: impl Key) -> SignedDatawhere
S: AsRef<[u8]>,
pub fn sign<S>(&self, message: S, key: impl Key) -> SignedDatawhere
S: AsRef<[u8]>,
Sign arbitrary string data.
The data is UTF-8 encoded and enveloped the same way as with
hash_message. The returned signed data’s signature is in ‘Electrum’
notation, that is the recovery value v is either 27 or 28 (as
opposed to the standard notation where v is either 0 or 1). This
is important to consider when using this signature with other crates.
sourceimpl<T: Transport> Accounts<T>
impl<T: Transport> Accounts<T>
sourcepub fn hash_message<S>(&self, message: S) -> H256where
S: AsRef<[u8]>,
pub fn hash_message<S>(&self, message: S) -> H256where
S: AsRef<[u8]>,
Hash a message according to EIP-191.
The data is a UTF-8 encoded string and will enveloped as follows:
"\x19Ethereum Signed Message:\n" + message.length + message and hashed
using keccak256.