let acc = hook_account()
accept(toHex(acc), 18)
// "HookReturnString": "36444639304543413242354330423435414132453144364539393342463744394443423232364233"
Conclusion:
I think we should allow the ability to send in the buffer/byte array and have it return the hex of that. To match the behavior of the c hooks.
If I update the macro with the following then I can send the byte array into the accept, with as_hex=true and then get the account id as the HookReturnString.
if (JS_IsBool(as_hex) && !!JS_ToBool(ctx, as_hex))\
{\
auto in = FromJSIntArrayOrHexString(ctx, error_msg, 64*1024);\
if (in.has_value())\
{\
if (in->size() > 1024)\
in->resize(1024);\
hookCtx.result.exitReason = std::string((const char*)in->data(), in->size());\
}\
}\
There is also a function is_UTF16LE in the c path and I think we should decide if we want to incorporate this as well.
When doing
accept
orrollback
in jshooks you cannot send in data and have it return the hex value. If you send in a hex, it will hex that again.Current Behavior:
Conclusion:
I think we should allow the ability to send in the buffer/byte array and have it return the hex of that. To match the behavior of the c hooks.
If I update the macro with the following then I can send the byte array into the accept, with
as_hex=true
and then get the account id as theHookReturnString
.