tomusdrw / rust-web3

Ethereum JSON-RPC multi-transport client. Rust implementation of web3 library. ENS address: rust-web3.eth

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to structure data for contract.signed_call

romanzac opened this issue · comments

Hi there,

May I get some help with data structure ? I am getting rejected by blockchain API on invalid data.

My ABI is:

{"constant":false,"inputs":[{"name":"index","type":"uint256"}],"name":"forceWithdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}

My call is:

let withdraw_res = sc.signed_call(
"forceWithdraw",
Tokenize::into_tokens("100000000".to_string()),
Options::default(),
SecretKeyRef::new(&prvk))
.await
.unwrap();

Were you ever able to figure this out? Would appreciate some guidance since the documentation is pretty sparse.

Yes, I moved over to another library: https://crates.io/crates/ethers
Supportive community. I am happy using it.

Lol. If anyone should happen to stumble across this in the future, there's something up with the versioning on secp256k1.

To get this to work, you must use secp256k1 = "0.21.1" in your toml, and the key must be typed as let prvk: secp256k1::SecretKey = .... The key parameter in signed_call is then SecretKeyRef::new(&prvk)).