[Ethereum] How to pass a blank bytes calldata into a solidity function call

contract-developmentsoliditytruffletruffle-compiletruffle-contract

I have a function that looks like this:

function foo(uint _someVar, bytes calldata _data) public {
    ...
}

Then I make a call to it from another function with "" as _data:

foo(123, "");

"" seems to be the default way to pass blank bytes. However, I get this truffle compilation error:

TypeError: Invalid type for argument in function call. Invalid implicit conversion from literal_string "" to bytes calldata requested.

I have tried to declare and pass variables, but it all comes down to trying to assign blank calldata bytes. Any tips on how to do this?

Best Answer

Try to use "0x". It helps me.

Related Topic