How to use the @truffle/codec.decodeVariable function in @truffle/codec

To help you get started, we’ve selected a few @truffle/codec examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github trufflesuite / truffle / packages / debugger / lib / data / sagas / index.js View on Github external
let userDefinedTypes = yield select(data.views.userDefinedTypes);
  let state = yield select(data.current.state);
  let mappingKeys = yield select(data.views.mappingKeys);
  let allocations = yield select(data.info.allocations);
  let instances = yield select(data.views.instances);
  let contexts = yield select(data.views.contexts);
  let currentContext = yield select(data.current.context);
  let internalFunctionsTable = yield select(
    data.current.functionsByProgramCounter
  );
  let blockNumber = yield select(data.views.blockNumber);

  let ZERO_WORD = new Uint8Array(Codec.Evm.Utils.WORD_SIZE); //automatically filled with zeroes
  let NO_CODE = new Uint8Array(); //empty array

  let decoder = Codec.decodeVariable(definition, ref, {
    userDefinedTypes,
    state,
    mappingKeys,
    allocations,
    contexts,
    currentContext,
    internalFunctionsTable
  });

  debug("beginning decoding");
  let result = decoder.next();
  while (!result.done) {
    debug("request received");
    let request = result.value;
    let response;
    switch (request.type) {