MCPcopy Create free account
hub / github.com/LUX-Core/lux / jsToBytes

Function jsToBytes

src/cpp-ethereum/libdevcore/CommonJS.cpp:31–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29{
30
31bytes jsToBytes(string const& _s, OnFailed _f)
32{
33 try
34 {
35 return fromHex(_s, WhenError::Throw);
36 }
37 catch (...)
38 {
39 if (_f == OnFailed::InterpretRaw)
40 return asBytes(_s);
41 else if (_f == OnFailed::Throw)
42 throw invalid_argument("Cannot intepret '" + _s + "' as bytes; must be 0x-prefixed hex or decimal.");
43 }
44 return bytes();
45}
46
47bytes padded(bytes _b, unsigned _l)
48{

Callers 8

BOOST_AUTO_TEST_CASEFunction · 0.85
web3_sha3Method · 0.85
toTransactionSkeletonFunction · 0.85
toMessageFunction · 0.85
toSealedFunction · 0.85
toWatchFunction · 0.85

Calls 1

asBytesFunction · 0.85

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.68