-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
40 lines (35 loc) · 1.13 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const { accountTrie } = require('./src/db');
const util = require('@ethereumjs/util');
accountTrie.root = Buffer.from(
'8caa5b7bb119dbc31ace24affce3b049f5514efabe487503ee76e215c27d1f79',
'hex'
);
accountTrie.get('one').then(console.log);
// const isHex = util.isHexString('0x12345');
// console.log(isHex);
// const obj = new Proxy(accountTrie, {
// get: function (target, name, receiver) {
// if (name === 'root') return util.bufferToHex(target[name]);
// return Reflect.get(target, name, receiver);
// },
// set: function (target, name, value, receiver) {
// if (name === 'root') {
// // change value to buffer if not
// let changedVal = value;
// if (!Buffer.isBuffer(value)) {
// changedVal = Buffer.from(util.stripHexPrefix(value), 'hex');
// }
// return (target[name] = changedVal);
// }
// return Reflect.set(target, name, changedVal, receiver);
// }
// });
// class sth {
// bla = 'some';
// get root() {
// return this.bla + ' 1';
// }
// }
// const b = new sth();
// console.log(typeof b.root, b.root);
// // getter and setter are not considered as function;