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

Why does `<Web3>.eth().compile_*` need to pass in a `String` instead of `&str` #622

Open hzqd opened 2 years ago

hzqd commented 2 years ago

In src/api/eth.rs and its impl Eth<T>:

    /// Compile Solidity
    pub fn compile_solidity(&self, code: String) -> CallFuture<Bytes, T::Out> {
        let code = helpers::serialize(&code);
        CallFuture::new(self.transport.execute("eth_compileSolidity", vec![code]))
    }

The code parameter used in helpers::serialize() in a reference way.

Why does the type of the parameter code be String, not &str?

hzqd commented 2 years ago

Call these methods, I get: Rpc method deprecated error.

Should it be marked deprecated, or delete it in this project?