How to use the ethereumjs-vm/dist/cache.prototype function in ethereumjs-vm

To help you get started, we’ve selected a few ethereumjs-vm 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 / sawtooth-seth-provider / src / monkeyPatches.js View on Github external
fields.forEach(function(field) {
        if (keys.indexOf(field.name) !== -1)
          self[field.name] = data[field.name];
        if (keys.indexOf(field.alias) !== -1)
          self[field.alias] = data[field.alias];
      });
    } else {
      throw new Error("invalid data");
    }
  }
};

const async = require("async");
let Cache = require("ethereumjs-vm/dist/cache");

Cache.prototype.warm = function(addresses, cb) {
  var self = this;
  // shim till async supports iterators
  var accountArr = [];
  addresses.forEach(function(val) {
    if (val) accountArr.push(val);
  });

  async.eachSeries(
    accountArr,
    function(addressHex, done) {
      var address = Buffer.from(addressHex.replace("0x", ""), "hex");
      self._lookupAccount(address, function(err, account) {
        if (err) return done(err);
        self._update(address, account, false, account.exists);
        done();
      });

ethereumjs-vm

An Ethereum VM implementation

MPL-2.0
Latest version published 4 years ago

Package Health Score

61 / 100
Full package analysis