I am using parity ethereum, When I use the call() function from web3 js, the data which I receive data = data + params which is embedded. Is it possible to send from web3 js data and param separately which I mean data = data, params = params below is web3js and rust code. At server request, I want to get method and parameter separately.

//get the balance
function balanceOf(contract_adrress, from_address) {
    var contract_address = contract_adrress;
    var abi = JSON.parse(fs.readFileSync("./erc-20/TokenInterface.json"));
    var Contract = new web3.eth.Contract(abi, contract_address);
    // Return new promise
    return new Promise(function (resolve, reject) {
        // Do async job
        Contract.methods.balanceOf(from_address).call().then(total_balance => {
        }).catch(err => {
fn call(&self, request: CallRequest, num: Option<BlockNumber>) -> Result<Bytes> {

        let contract_address = request.to.unwrap();
        let params = request.data.unwrap(); //data contains both balanceof method name + from address

pub struct CallRequest {
    /// From
    pub from: Option<H160>,
    /// To
    pub to: Option<H160>,
    /// Data
    pub data: Option<Bytes>,
    /// params
    pub params:Option<Bytes>

Its is possible to get method and parameter separate from web3 js.

| improve this question | | | | |
  • 1
    The code does not seem to be related to your question in any way. There is no data or params anywhere! – goodvibration Mar 24 at 6:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.