tomusdrw / rust-web3

Ethereum JSON-RPC multi-transport client. Rust implementation of web3 library. ENS address: rust-web3.eth
MIT License
1.45k stars 465 forks source link

Parameter key unusable in sign_transaction #635

Open Dirky14 opened 2 years ago

Dirky14 commented 2 years ago

Hello, The parameter Key in the sign_transaction method on the Account struct in the crate need a secp256k1::key::SecretKey. However, it seems now that the key module is private and SecretKey is reachable from secp256k1::SecretKey. Can you correct this ? Thanks !

Nobyliti713 commented 1 year ago

I've just encountered the same problem

error[E0271]: type mismatch resolving '<&SecretKey as Deref>::Target == secp256k1:: key::SecretKey' expected struct 'secp256k1:: key::SecretKey', found struct 'SecretKey'

code causing error: let private_key = SecretKey::from_str(&env::var("PRIVATE_TEST_KEY").unwrap()).unwrap(); let signed_transaction = web3s.accounts().sign_transaction(transact_obj, &private_key).await.unwrap();

Crate Versions: web3 = '0.18.0' secp256k1 = '0.24.1'