ethereumjs-account
Advanced tools
Comparing version 2.0.2 to 2.0.4
21
index.js
@@ -39,25 +39,10 @@ const ethUtil = require('ethereumjs-util') | ||
state.getRaw(this.codeHash, function (err, val) { | ||
var compiled = val[0] === 1 | ||
val = val.slice(1) | ||
cb(err, val, compiled) | ||
}) | ||
state.getRaw(this.codeHash, cb) | ||
} | ||
Account.prototype.setCode = function (trie, code, compiled, cb) { | ||
Account.prototype.setCode = function (trie, code, cb) { | ||
var self = this | ||
if (arguments.length === 3) { | ||
cb = compiled | ||
compiled = false | ||
} | ||
this.codeHash = ethUtil.sha3(code) | ||
// store code for a new contract | ||
if (!compiled) { | ||
this.codeHash = ethUtil.sha3(code) | ||
} | ||
// set the compile flag | ||
code = Buffer.concat([new Buffer([compiled]), code]) | ||
if (this.codeHash.toString('hex') === ethUtil.SHA3_NULL_S) { | ||
@@ -64,0 +49,0 @@ cb(null, new Buffer([])) |
{ | ||
"name": "ethereumjs-account", | ||
"version": "2.0.2", | ||
"version": "2.0.4", | ||
"description": "Encoding, decoding and validation of Ethereum's Account schema", | ||
@@ -11,2 +11,4 @@ "main": "index.js", | ||
"scripts": { | ||
"coverage": "istanbul cover ./test/index.js", | ||
"coveralls": "npm run coverage && coveralls <coverage/lcov.info", | ||
"lint": "standard", | ||
@@ -30,2 +32,4 @@ "test": "tape ./test/index.js" | ||
"devDependencies": { | ||
"coveralls": "^2.11.4", | ||
"istanbul": "^0.4.1", | ||
"standard": "^5.4.1", | ||
@@ -32,0 +36,0 @@ "tape": "^4.0.3" |
# SYNOPSIS | ||
[![NPM Package](https://img.shields.io/npm/v/ethereumjs-account.svg?style=flat-square)](https://www.npmjs.org/package/ethereumjs-account) | ||
[![Build Status](https://img.shields.io/travis/ethereumjs/ethereumjs-account.svg?branch=master&style=flat-square)](https://travis-ci.org/ethereumjs/ethereumjs-account) | ||
[![Coverage Status](https://img.shields.io/coveralls/ethereumjs/ethereumjs-account.svg?style=flat-square)](https://coveralls.io/r/ethereumjs/ethereumjs-account) | ||
[![Gitter](https://img.shields.io/gitter/room/ethereum/ethereumjs-lib.svg?style=flat-square)](https://gitter.im/ethereum/ethereumjs-lib) or #ethereumjs on freenode | ||
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ethereum/ethereumjs-lib?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) or #ethereumjs on freenode | ||
@@ -4,0 +9,0 @@ |
const Account = require('../index.js') | ||
const rlp = require('rlp') | ||
const tape = require('tape') | ||
const ethUtil = require('ethereumjs-util') | ||
@@ -22,6 +20,6 @@ tape('empty constructor', function (tester) { | ||
var raw = [ | ||
'0x02', //nonce | ||
'0x0384', //balance | ||
'0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421', //stateRoot | ||
'0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470' //codeHash | ||
'0x02', // nonce | ||
'0x0384', // balance | ||
'0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421', // stateRoot | ||
'0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470' // codeHash | ||
] | ||
@@ -89,3 +87,3 @@ var account = new Account(raw) | ||
codeHash: '0xc5d2461236f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470' | ||
}; | ||
} | ||
var account = new Account(raw) | ||
@@ -92,0 +90,0 @@ t.equal(account.isContract(), true) |
11253
5
98
4
151