Closed dominic-healid closed 3 years ago
Try something like this:
const buffer = new SerialBuffer({
textEncoder: api.textEncoder,
textDecoder: api.textDecoder,
});
api.abiTypes.get('abi_def').serialize(buffer, JSON.parse(abi));
const converted = buffer.asUint8Array();
@tbfleming I need to reference the SerialBuffer, something like an import function. That's what I need to know because I can't use SerailBuffer without referencing, I'm getting undefined error.
It's in the Serialize module, which is exported from the top level.
Added to docs label: these probably need to go in the docs. Please keep open until then.
@tbfleming can you please give me some pointers how to access the SerialBuffer? I'm still getting SerialBuffer is not defined
Really need some help with been struggling with this for a few days now.
What toolchain are you using to build your browser app? webpack? browserify? other? none? each method has a different approach to accessing the modules which make up eosjs.
webpack, on the dist-web folder I only got, eosjs-api, eosjs-jssig, eosjs-jsonrpc
The dist-web folder isn't designed to work with webpack and restricts the set of available modules.
If you're using webpack with Babel, import modules using the instructions at https://eosio.github.io/eosjs/latest/basic-usage/es-modules
If you're using webpack without Babel, import modules using the instructions at https://eosio.github.io/eosjs/latest/basic-usage/commonjs
Either method allows you to import Serialize
, which contains SerialBuffer
Cleaning up old issues so we can focus on more recent issues. Please reopen this ticket if needed. Thank you.
I'm having issues with setabi, please help how to achieve this on browser. I am able to setcode but not with setabi.