Commit dbb9b6eacbc6786a69bbe76a01aa4fb1d930ff18
Environment: include addAcount
Alex Beregszaszi committed on 8/23/2016, 12:27:46 AMParent: f324186087b016b58970772948aea63c250cbdb5
Files changed
environment.js | changed |
environment.js | ||
---|---|---|
@@ -32,8 +32,18 @@ | ||
32 | 32 | |
33 | 33 | Object.assign(this, defaults, data || {}) |
34 | 34 | } |
35 | 35 | |
36 | + addAccount (address, trie) { | |
37 | + let account = new Map() | |
38 | + account.set('nonce', trie.nonce || new U256(0)) | |
39 | + account.set('balance', trie.balance || new U256(0)) | |
40 | + account.set('code', trie.code || new Uint8Array()) | |
41 | + account.set('storage', trie.storage || new Map()) | |
42 | + | |
43 | + this.state.set(address.toString(), account) | |
44 | + } | |
45 | + | |
36 | 46 | getBalance (address) { |
37 | 47 | return this.state.get(address.toString()).balance |
38 | 48 | } |
39 | 49 |
Built with git-ssb-web