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

How to create &secp256k1::key::SecretKey from hex string #618

Closed romanzac closed 2 years ago

romanzac commented 2 years ago

Hi there, I cannot resolve problem with type mismatch for prvk. I haven't found any example how to perform more complex call for contract. What am I doing wrong ?

use secp256k1::SecretKey;

let prvk = SecretKey::from_str(pkey.as_str()).unwrap();

let withdraw_res = matic.signed_call( "withdraw", (), Options::default(), &prvk) .await .unwrap();

Rust newbie :) Thanks.

romanzac commented 2 years ago

Solved by resolving secp256k1 version conflict.

francesco-gaglione commented 2 years ago

@romanzac can you report the conflict? I have the same problem