openethereum / sol-rs

Solaris - Solidity testing framework in Rust.
GNU General Public License v3.0
54 stars 14 forks source link

make signing easy to do from sol-rs #16

Open snd opened 6 years ago

snd commented 6 years ago

i'm trying to replicate a truffle test that uses web.eth.sign (https://github.com/ethereum/wiki/wiki/JavaScript-API#web3ethsign)

how can i best do this in rust?

tomusdrw commented 6 years ago

This needs to be a separate API of evm object, the code is in ethkey, you can have a look at accounts_provider.mod.

I think the API should look like this:

let account = evm.new_account();
let signed = account.sign(data);

contract.functions().do_sth(signed).transact(evm.with_sender(account.address()));
snd commented 6 years ago

thanks for the pointer!

lght commented 6 years ago

Thank you for opening this issue, working on something similar myself for the PrivateContract example.

@tomusdrw this will likely solve the issues I'm having with recovering correct addresses, many thanks!

snd commented 6 years ago

i'll figure this out and try to make it easy to use from sol-rs