EOSIO / eosjs

General purpose library for the EOSIO blockchain.
http://eosio.github.io/eosjs
MIT License
1.43k stars 463 forks source link

Error: exception: unspecified\nInvalid hex character when deploying a contract. #36

Closed luoxianjiao closed 6 years ago

luoxianjiao commented 6 years ago

when I use eosjs-7.1.1 , run " eos.setcode('xx', 0, 0, wast, abi); " to deploy contract, it occurs errors as title

luoxianjiao commented 6 years ago

sometimes, I use eosjs-7.1.1 to run " eos.setcode('xx', 0, 0, wast, abi)“ code,it occurs errors blow ! {"code":500,"message":"Internal Service Error","details":"0 exception: unspecified\nInvalid hex character 'O'\n {\"c\":\"O\"}\n hex.cpp:13 from_hex"} (node:22643) UnhandledPromiseRejectionWarning: {"code":500,"message":"Internal Service Error","details":"0 exception: unspecified\nInvalid hex character 'O'\n {\"c\":\"O\"}\n hex.cpp:13 from_hex"} (node:22643) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:22643) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

chris-allnutt commented 6 years ago

@luoxianjiao 's error

{"code":500,"message":"Internal Service Error","details":"0 exception: unspecified\nInvalid hex character 'O'\n    {\"c\":\"O\"}\n      hex.cpp:13 from_hex"} (node:20012) UnhandledPromiseRejectionWarning: {"code":500,"message":"Internal Service Error","details":"0 exception: unspecified\nInvalid hex character 'O'\n    {\"c\":\"O\"}\n      hex.cpp:13 from_hex"} (node:20012) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:20012) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
chris-allnutt commented 6 years ago

@luoxianjiao can you provide the abi and wasm you're trying to deploy?

jcalfee commented 6 years ago

It works for me .. Make sure wast is a buffer and abi is an object:

> Buffer.isBuffer(wast)
true
> eos.setcode('currency', 0, 0, wast)
> eos.setabi('currency', JSON.parse(abi))