-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathTXcache.js
70 lines (65 loc) · 2.12 KB
/
TXcache.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/**
* StromDAO Business Object: Cache of Energy Transaction
* =========================================
*
* @author Thorsten Zoerner thorsten.zoerner@stromdao.de
* */
this.txcache = function(obj_or_address) {
if(typeof obj_or_address == "undefined") obj_or_address=parent.options.contracts["StromDAO-BO.sol_TXCache"];
var p1 = new Promise(function(resolve, reject) {
var instance=parent._objInstance(obj_or_address,'StromDAO-BO.sol_TXCache');
instance.test = {};
instance.length=function() {
var p2 = new Promise(function(resolve2, reject2) {
instance.obj.length().then(function(o) {
resolve2(o[0].toString());
});
});
return p2;
};
instance.txs=function(uint256_idx) {
var p2 = new Promise(function(resolve2, reject2) {
instance.obj.txs(uint256_idx).then(function(o) {
resolve2(o);
});
});
return p2;
};
instance.from=function(uint256_idx) {
var p2 = new Promise(function(resolve2, reject2) {
instance.obj.from(uint256_idx).then(function(o) {
console.log("FROM",o);
resolve2(o[0].toString());
});
});
return p2;
};
instance.to=function(uint256_idx) {
var p2 = new Promise(function(resolve2, reject2) {
instance.obj.to(uint256_idx).then(function(o) {
resolve2(o[0].toString());
});
});
return p2;
};
instance.base=function(uint256_idx) {
var p2 = new Promise(function(resolve2, reject2) {
instance.obj.base(uint256_idx).then(function(o) {
resolve2(o[0].toString());
});
});
return p2;
};
instance.value=function(uint256_idx) {
var p2 = new Promise(function(resolve2, reject2) {
instance.obj.value(uint256_idx).then(function(o) {
resolve2(o[0].toString());
});
});
return p2;
};
//
resolve(instance);
});
return p1;
};