rust-web3
rust-web3 copied to clipboard
Parameter key unusable in sign_transaction
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 !
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'