-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathweb3_wan.js
executable file
·117 lines (101 loc) · 3.08 KB
/
web3_wan.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
const Method = require("web3/lib/web3/method");
const formatters = require('web3/lib/web3/formatters');
function Wan(web3) {
this._requestManager = web3._requestManager;
var self = this;
methods().forEach(function(method) {
method.attachToObject(self);
method.setRequestManager(self._requestManager);
});
properties().forEach(function(p) {
p.attachToObject(self);
p.setRequestManager(self._requestManager);
});
}
var methods = function () {
var pendingTransactions = new Method({
name: 'pendingTransactions',
call: 'eth_pendingTransactions',
params: 1
});
var getOTAMixSet = new Method({
name: 'getOTAMixSet',
call: 'wan_getOTAMixSet',
params: 2
});
var getOTABalance = new Method({
name: 'getOTABalance',
call: 'eth_getOTABalance',
params: 1
});
var getWanAddress = new Method({
name: 'getWanAddress',
call: 'wan_getWanAddress',
params: 1,
inputFormatter: [formatters.inputAddressFormatter]
});
var generateOneTimeAddress = new Method({
name: 'generateOneTimeAddress',
call: 'wan_generateOneTimeAddress',
params: 1,
inputFormatter: [null]
});
var sendPrivacyCxtTransaction = new Method({
name: 'sendPrivacyCxtTransaction',
call: 'personal_sendPrivacyCxtTransaction',
params: 2,
inputFormatter: [formatters.inputTransactionFormatter, null]
});
var computeOTAPPKeys = new Method({
name: 'computeOTAPPKeys',
call: 'wan_computeOTAPPKeys',
params: 2,
inputFormatter: [formatters.inputAddressFormatter, null]
});
var genRingSignData = new Method({
name: 'genRingSignData',
call: 'personal_genRingSignData',
params: 3,
});
var getOTABalance = new Method({
name: 'getOTABalance',
call: 'wan_getOTABalance',
params: 2,
inputFormatter: [null, formatters.inputDefaultBlockNumberFormatter],
outputFormatter: formatters.outputBigNumberFormatter
});
var scanOTAbyAccount = new Method ({
name: 'scanOTAbyAccount',
call: 'wan_scanOTAbyAccount',
params: 2,
inputFormatter: [formatters.inputAddressFormatter,formatters.inputBlockNumberFormatter]
});
var getSupportWanCoinOTABalances = new Method ({
name: 'getSupportWanCoinOTABalances',
call: 'wan_getSupportWanCoinOTABalances',
params: 0,
});
var getSupportStampOTABalances = new Method ({
name: 'getSupportStampOTABalances',
call: 'wan_getSupportStampOTABalances',
params: 0,
});
return [
pendingTransactions,
computeOTAPPKeys,
getOTAMixSet,
getOTABalance,
getWanAddress,
generateOneTimeAddress,
sendPrivacyCxtTransaction,
genRingSignData,
getOTABalance,
scanOTAbyAccount,
getSupportWanCoinOTABalances,
getSupportStampOTABalances
];
};
var properties = function () {
return [];
};
module.exports = Wan;