rust-web3 icon indicating copy to clipboard operation
rust-web3 copied to clipboard

Parameter key unusable in sign_transaction

Open Dirky14 opened this issue 2 years ago • 1 comments

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 !

Dirky14 avatar May 16 '22 22:05 Dirky14

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'

Nobyliti713 avatar Nov 01 '22 12:11 Nobyliti713