@xelis/sdk 0.9.11 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/address/address.js +55 -0
- package/dist/cjs/address/bech32.js +167 -0
- package/dist/cjs/config.js +4 -2
- package/dist/cjs/daemon/rpc.js +122 -71
- package/dist/cjs/daemon/types.js +44 -24
- package/dist/cjs/daemon/websocket.js +129 -105
- package/dist/cjs/data/element.js +84 -0
- package/dist/cjs/data/value.js +327 -0
- package/dist/cjs/{lib/rpc.js → rpc/http.js} +68 -18
- package/dist/cjs/rpc/parse_json/parse_json.js +15 -0
- package/dist/cjs/{lib → rpc}/websocket.js +119 -79
- package/dist/cjs/wallet/rpc.js +81 -70
- package/dist/cjs/wallet/types.js +44 -1
- package/dist/cjs/wallet/websocket.js +77 -14
- package/dist/cjs/xswd/websocket.js +3 -3
- package/dist/esm/address/address.js +53 -0
- package/dist/esm/address/bech32.js +161 -0
- package/dist/esm/config.js +3 -1
- package/dist/esm/daemon/rpc.js +122 -71
- package/dist/esm/daemon/types.js +44 -24
- package/dist/esm/daemon/websocket.js +130 -106
- package/dist/esm/data/element.js +81 -0
- package/dist/esm/data/value.js +324 -0
- package/dist/esm/{lib/rpc.js → rpc/http.js} +67 -17
- package/dist/esm/rpc/parse_json/parse_json.js +8 -0
- package/dist/esm/{lib → rpc}/websocket.js +118 -78
- package/dist/esm/wallet/rpc.js +81 -70
- package/dist/esm/wallet/types.js +43 -0
- package/dist/esm/wallet/websocket.js +77 -14
- package/dist/esm/xswd/websocket.js +3 -3
- package/dist/types/address/address.d.ts +12 -0
- package/dist/types/address/bech32.d.ts +6 -0
- package/dist/types/config.d.ts +2 -0
- package/dist/types/daemon/rpc.d.ts +68 -51
- package/dist/types/daemon/types.d.ts +216 -44
- package/dist/types/daemon/websocket.d.ts +77 -56
- package/dist/types/data/element.d.ts +20 -0
- package/dist/types/data/value.d.ts +50 -0
- package/dist/types/rpc/http.d.ts +9 -0
- package/dist/types/rpc/parse_json/parse_json.d.ts +1 -0
- package/dist/types/{lib → rpc}/websocket.d.ts +14 -10
- package/dist/types/wallet/rpc.d.ts +45 -26
- package/dist/types/wallet/types.d.ts +244 -21
- package/dist/types/wallet/websocket.d.ts +47 -22
- package/dist/types/xswd/websocket.d.ts +3 -3
- package/package.json +5 -4
- package/dist/cjs/lib/parse_data.js +0 -15
- package/dist/esm/lib/parse_data.js +0 -11
- package/dist/types/lib/parse_data.d.ts +0 -1
- package/dist/types/lib/rpc.d.ts +0 -7
- /package/dist/cjs/{lib → rpc}/types.js +0 -0
- /package/dist/esm/{lib → rpc}/types.js +0 -0
- /package/dist/types/{lib → rpc}/types.d.ts +0 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
var bech32_1 = require("./bech32");
|
|
4
|
+
var value_1 = require("../data/value");
|
|
5
|
+
var PrefixAddress = "xel";
|
|
6
|
+
var TestnetPrefixAddress = "xet";
|
|
7
|
+
var ExtraDataLimit = 1024;
|
|
8
|
+
var ErrIntegratedDataLimit = "invalid data in integrated address, maximum size reached";
|
|
9
|
+
var ErrInvalidNetworkPrefix = "invalid network prefix (xel or xet)";
|
|
10
|
+
var Address = /** @class */ (function () {
|
|
11
|
+
function Address(data, hrp) {
|
|
12
|
+
this.isMainnet = hrp === PrefixAddress;
|
|
13
|
+
this.publicKey = data.splice(0, 32);
|
|
14
|
+
var addrType = data.splice(0, 1)[0];
|
|
15
|
+
switch (addrType) {
|
|
16
|
+
case 0:
|
|
17
|
+
this.isIntegrated = false;
|
|
18
|
+
break;
|
|
19
|
+
case 1:
|
|
20
|
+
this.isIntegrated = true;
|
|
21
|
+
var reader = new value_1.ValueReader(new Uint8Array(data));
|
|
22
|
+
this.extraData = reader.read();
|
|
23
|
+
break;
|
|
24
|
+
default:
|
|
25
|
+
throw "invalid address type";
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
Address.fromString = function (addr) {
|
|
29
|
+
var _a = (0, bech32_1.decode)(addr), hrp = _a.hrp, decoded = _a.decoded;
|
|
30
|
+
if (hrp !== PrefixAddress && hrp !== TestnetPrefixAddress) {
|
|
31
|
+
throw ErrInvalidNetworkPrefix;
|
|
32
|
+
}
|
|
33
|
+
var bits = (0, bech32_1.convertBits)(decoded, 5, 8, false);
|
|
34
|
+
return new Address(bits, hrp);
|
|
35
|
+
};
|
|
36
|
+
Address.isValid = function (addr) {
|
|
37
|
+
try {
|
|
38
|
+
Address.fromString(addr);
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
catch (_a) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
Address.prototype.format = function () {
|
|
46
|
+
var bits = (0, bech32_1.convertBits)(this.publicKey, 8, 5, true);
|
|
47
|
+
var hrp = PrefixAddress;
|
|
48
|
+
if (!this.isMainnet) {
|
|
49
|
+
hrp = TestnetPrefixAddress;
|
|
50
|
+
}
|
|
51
|
+
return (0, bech32_1.encode)(hrp, bits);
|
|
52
|
+
};
|
|
53
|
+
return Address;
|
|
54
|
+
}());
|
|
55
|
+
exports["default"] = Address;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
11
|
+
exports.__esModule = true;
|
|
12
|
+
exports.encode = exports.decode = exports.convertBits = void 0;
|
|
13
|
+
var CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
|
|
14
|
+
var GENERATOR = [0x3b6a57b2, 0x26508e6d, 0x1ea119fa, 0x3d4233dd, 0x2a1462b3];
|
|
15
|
+
var SEPARTOR = ":";
|
|
16
|
+
var ErrHrpMixCase = "mix case is not allowed in human readable part";
|
|
17
|
+
var ErrInvalidChecksum = "invalid checksum";
|
|
18
|
+
var ErrNonZeroPadding = "non zero padding";
|
|
19
|
+
var ErrIllegalZeroPadding = "illegal zero padding";
|
|
20
|
+
var ErrHrpEmpty = "human readable part is empty";
|
|
21
|
+
function ErrSeparatorInvalidPosition(pos) {
|
|
22
|
+
return "invalid separator position: ".concat(pos);
|
|
23
|
+
}
|
|
24
|
+
function ErrHrpInvalidCharacter(c) {
|
|
25
|
+
return "invalid character value in human readable part: ".concat(c);
|
|
26
|
+
}
|
|
27
|
+
function ErrInvalidIndex(index) {
|
|
28
|
+
return "invalid index ".concat(index);
|
|
29
|
+
}
|
|
30
|
+
function ErrInvalidValue(value, max) {
|
|
31
|
+
return "invalid value: ".concat(value, ", max is ").concat(max);
|
|
32
|
+
}
|
|
33
|
+
function ErrInvalidDataRange(value, from) {
|
|
34
|
+
return "invalid data range: ".concat(value, ", max is ").concat(from);
|
|
35
|
+
}
|
|
36
|
+
function polymod(values) {
|
|
37
|
+
var chk = 1;
|
|
38
|
+
values.forEach(function (value) {
|
|
39
|
+
var top = chk >> 25;
|
|
40
|
+
chk = ((chk & 0x1ffffff) << 5) ^ value;
|
|
41
|
+
GENERATOR.forEach(function (item, i) {
|
|
42
|
+
if (((top >> i) & 1) === 1) {
|
|
43
|
+
chk ^= item;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
return chk;
|
|
48
|
+
}
|
|
49
|
+
function hrpExpand(hrp) {
|
|
50
|
+
var encoder = new TextEncoder();
|
|
51
|
+
var bytes = encoder.encode(hrp);
|
|
52
|
+
var result = [];
|
|
53
|
+
bytes.forEach(function (c) { return result.push(c >> 5); });
|
|
54
|
+
result.push(0);
|
|
55
|
+
bytes.forEach(function (c) { return result.push(c & 31); });
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
58
|
+
function verifyChecksum(hrp, data) {
|
|
59
|
+
var vec = hrpExpand(hrp);
|
|
60
|
+
vec = __spreadArray(__spreadArray([], vec, true), data, true);
|
|
61
|
+
return polymod(vec) === 1;
|
|
62
|
+
}
|
|
63
|
+
function createChecksum(hrp, data) {
|
|
64
|
+
var result = [0, 0, 0, 0, 0, 0];
|
|
65
|
+
var values = __spreadArray(__spreadArray(__spreadArray([], hrpExpand(hrp), true), data, true), result, true);
|
|
66
|
+
var pm = polymod(values) ^ 1;
|
|
67
|
+
for (var i = 0; i < 6; i++) {
|
|
68
|
+
result[i] = pm >> (5 * (5 - i)) & 31;
|
|
69
|
+
}
|
|
70
|
+
return result;
|
|
71
|
+
}
|
|
72
|
+
function convertBits(data, from, to, pad) {
|
|
73
|
+
var result = [];
|
|
74
|
+
var acc = 0;
|
|
75
|
+
var bits = 0;
|
|
76
|
+
var maxValue = (1 << to) - 1;
|
|
77
|
+
data.forEach(function (value) {
|
|
78
|
+
if (value >> from !== 0) {
|
|
79
|
+
throw ErrInvalidDataRange(value, from);
|
|
80
|
+
}
|
|
81
|
+
acc = (acc << from) | value;
|
|
82
|
+
bits += from;
|
|
83
|
+
while (bits >= to) {
|
|
84
|
+
bits -= to;
|
|
85
|
+
result.push((acc >> bits) & maxValue);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
if (pad) {
|
|
89
|
+
if (bits > 0) {
|
|
90
|
+
result.push((acc << (to - bits)) & maxValue);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
else if (bits >= from) {
|
|
94
|
+
throw ErrIllegalZeroPadding;
|
|
95
|
+
}
|
|
96
|
+
else if (((acc << (to - bits)) & maxValue) !== 0) {
|
|
97
|
+
throw ErrNonZeroPadding;
|
|
98
|
+
}
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
101
|
+
exports.convertBits = convertBits;
|
|
102
|
+
function decode(bech) {
|
|
103
|
+
if (bech.toUpperCase() !== bech && bech.toLowerCase() !== bech) {
|
|
104
|
+
throw ErrHrpMixCase;
|
|
105
|
+
}
|
|
106
|
+
var pos = bech.indexOf(SEPARTOR);
|
|
107
|
+
if (pos < 1 || pos + 7 > bech.length) {
|
|
108
|
+
throw ErrSeparatorInvalidPosition(pos);
|
|
109
|
+
}
|
|
110
|
+
var hrp = bech.substring(0, pos);
|
|
111
|
+
var encoder = new TextEncoder();
|
|
112
|
+
var hrpBytes = encoder.encode(hrp);
|
|
113
|
+
var decoded = [];
|
|
114
|
+
hrpBytes.forEach(function (value) {
|
|
115
|
+
if (value < 33 || value > 126) {
|
|
116
|
+
throw ErrHrpInvalidCharacter(value);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
for (var i = pos + 1; i < bech.length; i++) {
|
|
120
|
+
if (i >= bech.length) {
|
|
121
|
+
throw ErrInvalidIndex(i);
|
|
122
|
+
}
|
|
123
|
+
var c = bech[i];
|
|
124
|
+
var index = CHARSET.indexOf(c);
|
|
125
|
+
if (index === -1) {
|
|
126
|
+
throw ErrHrpInvalidCharacter;
|
|
127
|
+
}
|
|
128
|
+
decoded.push(index);
|
|
129
|
+
}
|
|
130
|
+
if (!verifyChecksum(hrp, decoded)) {
|
|
131
|
+
throw ErrInvalidChecksum;
|
|
132
|
+
}
|
|
133
|
+
decoded.splice(decoded.length - 6, 6);
|
|
134
|
+
return { hrp: hrp, decoded: decoded };
|
|
135
|
+
}
|
|
136
|
+
exports.decode = decode;
|
|
137
|
+
function encode(hrp, data) {
|
|
138
|
+
if (hrp.length === 0) {
|
|
139
|
+
throw ErrHrpEmpty;
|
|
140
|
+
}
|
|
141
|
+
var encoder = new TextEncoder();
|
|
142
|
+
var hrpBytes = encoder.encode(hrp);
|
|
143
|
+
hrpBytes.forEach(function (value) {
|
|
144
|
+
if (value < 33 || value > 126) {
|
|
145
|
+
throw ErrHrpInvalidCharacter(value);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
if (hrp.toUpperCase() !== hrp && hrp.toLowerCase() !== hrp) {
|
|
149
|
+
throw ErrHrpMixCase;
|
|
150
|
+
}
|
|
151
|
+
hrp = hrp.toLowerCase();
|
|
152
|
+
var combined = __spreadArray(__spreadArray([], data, true), createChecksum(hrp, data), true);
|
|
153
|
+
var result = __spreadArray(__spreadArray([], Array.from(hrpBytes), true), [SEPARTOR.charCodeAt(0)], false);
|
|
154
|
+
combined.forEach(function (index) {
|
|
155
|
+
if (index > CHARSET.length) {
|
|
156
|
+
throw ErrInvalidValue(index, CHARSET.length);
|
|
157
|
+
}
|
|
158
|
+
var value = CHARSET.charCodeAt(index);
|
|
159
|
+
if (!value) {
|
|
160
|
+
throw ErrInvalidIndex(index);
|
|
161
|
+
}
|
|
162
|
+
result.push(value);
|
|
163
|
+
});
|
|
164
|
+
var decoder = new TextDecoder();
|
|
165
|
+
return decoder.decode(new Uint8Array(result));
|
|
166
|
+
}
|
|
167
|
+
exports.encode = encode;
|
package/dist/cjs/config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
exports.__esModule = true;
|
|
3
|
-
exports.XELIS_ASSET = exports.LOCAL_XSWD_WS = exports.LOCAL_XSWD_URL = exports.LOCAL_WALLET_WS = exports.LOCAL_WALLET_RPC = exports.LOCAL_WALLET_URL = exports.LOCAL_NODE_WS = exports.TESTNET_NODE_WS = exports.MAINNET_NODE_WS = exports.LOCAL_NODE_RPC = exports.TESTNET_NODE_RPC = exports.MAINNET_NODE_RPC = exports.LOCAL_NODE_URL = exports.TESTNET_NODE_URL = exports.MAINNET_NODE_URL = exports.XSWD_PORT = exports.WALLET_RPC_PORT = exports.DAEMON_RPC_PORT = void 0;
|
|
3
|
+
exports.XELIS_DECIMALS = exports.XELIS_ASSET = exports.LOCAL_XSWD_WS = exports.LOCAL_XSWD_URL = exports.LOCAL_WALLET_WS = exports.LOCAL_WALLET_RPC = exports.LOCAL_WALLET_URL = exports.LOCAL_NODE_WS = exports.TESTNET_NODE_WS = exports.MAINNET_NODE_WS = exports.LOCAL_NODE_RPC = exports.TESTNET_NODE_RPC = exports.MAINNET_NODE_RPC = exports.LOCAL_NODE_URL = exports.TESTNET_NODE_URL = exports.MAINNET_NODE_URL = exports.XSWD_PORT = exports.WALLET_RPC_PORT = exports.DAEMON_RPC_PORT = void 0;
|
|
4
4
|
exports.DAEMON_RPC_PORT = "8080";
|
|
5
5
|
exports.WALLET_RPC_PORT = "8081";
|
|
6
6
|
exports.XSWD_PORT = "44325";
|
|
@@ -19,6 +19,7 @@ exports.LOCAL_WALLET_WS = "ws://".concat(exports.LOCAL_WALLET_URL, "/json_rpc");
|
|
|
19
19
|
exports.LOCAL_XSWD_URL = "127.0.0.1:".concat(exports.XSWD_PORT);
|
|
20
20
|
exports.LOCAL_XSWD_WS = "ws://".concat(exports.LOCAL_XSWD_URL, "/xswd");
|
|
21
21
|
exports.XELIS_ASSET = "0000000000000000000000000000000000000000000000000000000000000000";
|
|
22
|
+
exports.XELIS_DECIMALS = 8;
|
|
22
23
|
exports["default"] = {
|
|
23
24
|
MAINNET_NODE_URL: exports.MAINNET_NODE_URL,
|
|
24
25
|
TESTNET_NODE_URL: exports.TESTNET_NODE_URL,
|
|
@@ -36,5 +37,6 @@ exports["default"] = {
|
|
|
36
37
|
LOCAL_WALLET_WS: exports.LOCAL_WALLET_WS,
|
|
37
38
|
LOCAL_XSWD_URL: exports.LOCAL_XSWD_URL,
|
|
38
39
|
LOCAL_XSWD_WS: exports.LOCAL_XSWD_WS,
|
|
39
|
-
XELIS_ASSET: exports.XELIS_ASSET
|
|
40
|
+
XELIS_ASSET: exports.XELIS_ASSET,
|
|
41
|
+
XELIS_DECIMALS: exports.XELIS_DECIMALS
|
|
40
42
|
};
|
package/dist/cjs/daemon/rpc.js
CHANGED
|
@@ -17,157 +17,208 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
17
17
|
exports.__esModule = true;
|
|
18
18
|
exports.RPC = void 0;
|
|
19
19
|
var types_1 = require("./types");
|
|
20
|
-
var
|
|
20
|
+
var http_1 = require("../rpc/http");
|
|
21
21
|
var RPC = /** @class */ (function (_super) {
|
|
22
22
|
__extends(RPC, _super);
|
|
23
23
|
function RPC() {
|
|
24
24
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
25
25
|
}
|
|
26
26
|
RPC.prototype.getVersion = function () {
|
|
27
|
-
return this.
|
|
27
|
+
return this.request(types_1.RPCMethod.GetVersion);
|
|
28
28
|
};
|
|
29
29
|
RPC.prototype.getHeight = function () {
|
|
30
|
-
return this.
|
|
30
|
+
return this.request(types_1.RPCMethod.GetHeight);
|
|
31
31
|
};
|
|
32
32
|
RPC.prototype.getTopoheight = function () {
|
|
33
|
-
return this.
|
|
33
|
+
return this.request(types_1.RPCMethod.GetTopoheight);
|
|
34
|
+
};
|
|
35
|
+
RPC.prototype.getPrunedTopoheight = function () {
|
|
36
|
+
return this.request(types_1.RPCMethod.GetPrunedTopoheight);
|
|
37
|
+
};
|
|
38
|
+
RPC.prototype.getInfo = function () {
|
|
39
|
+
return this.request(types_1.RPCMethod.GetInfo);
|
|
40
|
+
};
|
|
41
|
+
RPC.prototype.getDifficulty = function () {
|
|
42
|
+
return this.request(types_1.RPCMethod.GetDifficulty);
|
|
43
|
+
};
|
|
44
|
+
RPC.prototype.getTips = function () {
|
|
45
|
+
return this.request(types_1.RPCMethod.GetTips);
|
|
46
|
+
};
|
|
47
|
+
RPC.prototype.getDevFeeThresholds = function () {
|
|
48
|
+
return this.request(types_1.RPCMethod.GetDevFeeThresholds);
|
|
49
|
+
};
|
|
50
|
+
RPC.prototype.getSizeOnDisk = function () {
|
|
51
|
+
return this.request(types_1.RPCMethod.GetSizeOnDisk);
|
|
34
52
|
};
|
|
35
53
|
RPC.prototype.getStableHeight = function () {
|
|
36
|
-
return this.
|
|
54
|
+
return this.request(types_1.RPCMethod.GetStableHeight);
|
|
37
55
|
};
|
|
38
56
|
RPC.prototype.getStableTopoheight = function () {
|
|
39
|
-
return this.
|
|
57
|
+
return this.request(types_1.RPCMethod.GetStableTopoheight);
|
|
40
58
|
};
|
|
41
|
-
RPC.prototype.
|
|
42
|
-
return this.
|
|
43
|
-
};
|
|
44
|
-
RPC.prototype.getBlockTemplate = function (address) {
|
|
45
|
-
return this.post(types_1.RPCMethod.GetBlockTemplate, { address: address });
|
|
59
|
+
RPC.prototype.getHardForks = function () {
|
|
60
|
+
return this.request(types_1.RPCMethod.GetHardForks);
|
|
46
61
|
};
|
|
47
62
|
RPC.prototype.getBlockAtTopoheight = function (params) {
|
|
48
|
-
return this.
|
|
63
|
+
return this.request(types_1.RPCMethod.GetBlockAtTopoheight, params);
|
|
49
64
|
};
|
|
50
65
|
RPC.prototype.getBlocksAtHeight = function (params) {
|
|
51
|
-
return this.
|
|
66
|
+
return this.request(types_1.RPCMethod.GetBlocksAtHeight, params);
|
|
52
67
|
};
|
|
53
68
|
RPC.prototype.getBlockByHash = function (params) {
|
|
54
|
-
return this.
|
|
69
|
+
return this.request(types_1.RPCMethod.GetBlockByHash, params);
|
|
55
70
|
};
|
|
56
71
|
RPC.prototype.getTopBlock = function (params) {
|
|
57
|
-
return this.
|
|
58
|
-
};
|
|
59
|
-
RPC.prototype.submitBlock = function (params) {
|
|
60
|
-
return this.post(types_1.RPCMethod.SubmitBlock, params);
|
|
72
|
+
return this.request(types_1.RPCMethod.GetTopBlock, params);
|
|
61
73
|
};
|
|
62
74
|
RPC.prototype.getBalance = function (params) {
|
|
63
|
-
return this.
|
|
75
|
+
return this.request(types_1.RPCMethod.GetBalance, params);
|
|
76
|
+
};
|
|
77
|
+
RPC.prototype.getStableBalance = function (params) {
|
|
78
|
+
return this.request(types_1.RPCMethod.GetStableBalance, params);
|
|
64
79
|
};
|
|
65
80
|
RPC.prototype.hasBalance = function (params) {
|
|
66
|
-
return this.
|
|
81
|
+
return this.request(types_1.RPCMethod.HasBalance, params);
|
|
67
82
|
};
|
|
68
83
|
RPC.prototype.getBalanceAtTopoheight = function (params) {
|
|
69
|
-
return this.
|
|
70
|
-
};
|
|
71
|
-
RPC.prototype.getInfo = function () {
|
|
72
|
-
return this.post(types_1.RPCMethod.GetInfo);
|
|
84
|
+
return this.request(types_1.RPCMethod.GetBalanceAtTopoheight, params);
|
|
73
85
|
};
|
|
74
86
|
RPC.prototype.getNonce = function (params) {
|
|
75
|
-
return this.
|
|
87
|
+
return this.request(types_1.RPCMethod.GetNonce, params);
|
|
76
88
|
};
|
|
77
89
|
RPC.prototype.hasNonce = function (params) {
|
|
78
|
-
return this.
|
|
90
|
+
return this.request(types_1.RPCMethod.HasNonce, params);
|
|
79
91
|
};
|
|
80
92
|
RPC.prototype.getNonceAtTopoheight = function (params) {
|
|
81
|
-
return this.
|
|
93
|
+
return this.request(types_1.RPCMethod.GetNonceAtTopoheight, params);
|
|
82
94
|
};
|
|
83
95
|
RPC.prototype.getAsset = function (params) {
|
|
84
|
-
return this.
|
|
96
|
+
return this.request(types_1.RPCMethod.GetAsset, params);
|
|
85
97
|
};
|
|
86
98
|
RPC.prototype.getAssets = function (params) {
|
|
87
|
-
return this.
|
|
99
|
+
return this.request(types_1.RPCMethod.GetAssets, params);
|
|
88
100
|
};
|
|
89
101
|
RPC.prototype.countAssets = function () {
|
|
90
|
-
return this.
|
|
102
|
+
return this.request(types_1.RPCMethod.CountAssets);
|
|
103
|
+
};
|
|
104
|
+
RPC.prototype.countTransactions = function () {
|
|
105
|
+
return this.request(types_1.RPCMethod.CountTransactions);
|
|
91
106
|
};
|
|
92
107
|
RPC.prototype.countAccounts = function () {
|
|
93
|
-
return this.
|
|
108
|
+
return this.request(types_1.RPCMethod.CountAccounts);
|
|
94
109
|
};
|
|
95
|
-
RPC.prototype.
|
|
96
|
-
return this.
|
|
110
|
+
RPC.prototype.countContracts = function () {
|
|
111
|
+
return this.request(types_1.RPCMethod.CountContracts);
|
|
97
112
|
};
|
|
98
113
|
RPC.prototype.submitTransaction = function (hexData) {
|
|
99
|
-
return this.
|
|
114
|
+
return this.request(types_1.RPCMethod.SubmitTransaction, { data: hexData });
|
|
115
|
+
};
|
|
116
|
+
RPC.prototype.getTransationExecutor = function (hash) {
|
|
117
|
+
return this.request(types_1.RPCMethod.GetTransactionExecutor, { hash: hash });
|
|
100
118
|
};
|
|
101
119
|
RPC.prototype.getTransaction = function (hash) {
|
|
102
|
-
return this.
|
|
120
|
+
return this.request(types_1.RPCMethod.GetTransaction, { hash: hash });
|
|
121
|
+
};
|
|
122
|
+
RPC.prototype.getTransactions = function (txHashes) {
|
|
123
|
+
return this.request(types_1.RPCMethod.GetTransactions, { tx_hashes: txHashes });
|
|
124
|
+
};
|
|
125
|
+
RPC.prototype.isTxExecutedInBlock = function (params) {
|
|
126
|
+
return this.request(types_1.RPCMethod.IsTxExecutedInBlock, params);
|
|
103
127
|
};
|
|
104
128
|
RPC.prototype.p2pStatus = function () {
|
|
105
|
-
return this.
|
|
129
|
+
return this.request(types_1.RPCMethod.P2PStatus);
|
|
106
130
|
};
|
|
107
131
|
RPC.prototype.getPeers = function () {
|
|
108
|
-
return this.
|
|
132
|
+
return this.request(types_1.RPCMethod.GetPeers);
|
|
109
133
|
};
|
|
110
134
|
RPC.prototype.getMemPool = function () {
|
|
111
|
-
return this.
|
|
135
|
+
return this.request(types_1.RPCMethod.GetMempool);
|
|
112
136
|
};
|
|
113
|
-
RPC.prototype.
|
|
114
|
-
return this.
|
|
137
|
+
RPC.prototype.getMempoolCache = function (address) {
|
|
138
|
+
return this.request(types_1.RPCMethod.GetMempoolCache, { address: address });
|
|
139
|
+
};
|
|
140
|
+
RPC.prototype.getEstimatedFeeRates = function () {
|
|
141
|
+
return this.request(types_1.RPCMethod.GetEstimatedFeeRates);
|
|
115
142
|
};
|
|
116
143
|
RPC.prototype.getDAGOrder = function (params) {
|
|
117
|
-
return this.
|
|
144
|
+
return this.request(types_1.RPCMethod.GetDAGOrder, params);
|
|
118
145
|
};
|
|
119
146
|
RPC.prototype.getBlocksRangeByTopoheight = function (params) {
|
|
120
|
-
return this.
|
|
147
|
+
return this.request(types_1.RPCMethod.GetBlocksRangeByTopoheight, params);
|
|
121
148
|
};
|
|
122
149
|
RPC.prototype.getBlocksRangeByHeight = function (params) {
|
|
123
|
-
return this.
|
|
124
|
-
};
|
|
125
|
-
RPC.prototype.getTransactions = function (txHashes) {
|
|
126
|
-
return this.post(types_1.RPCMethod.GetTransactions, { tx_hashes: txHashes });
|
|
150
|
+
return this.request(types_1.RPCMethod.GetBlocksRangeByHeight, params);
|
|
127
151
|
};
|
|
128
152
|
RPC.prototype.getAccountHistory = function (params) {
|
|
129
|
-
return this.
|
|
153
|
+
return this.request(types_1.RPCMethod.GetAccountHistory, params);
|
|
130
154
|
};
|
|
131
155
|
RPC.prototype.getAccountAssets = function (address) {
|
|
132
|
-
return this.
|
|
156
|
+
return this.request(types_1.RPCMethod.GetAccountAssets, { address: address });
|
|
133
157
|
};
|
|
134
158
|
RPC.prototype.getAccounts = function (params) {
|
|
135
|
-
return this.
|
|
159
|
+
return this.request(types_1.RPCMethod.GetAccounts, params);
|
|
136
160
|
};
|
|
137
|
-
RPC.prototype.
|
|
138
|
-
return this.
|
|
161
|
+
RPC.prototype.isAccountRegistered = function (params) {
|
|
162
|
+
return this.request(types_1.RPCMethod.IsAccountRegistered, params);
|
|
139
163
|
};
|
|
140
|
-
RPC.prototype.
|
|
141
|
-
return this.
|
|
164
|
+
RPC.prototype.getAccountRegistrationTopoheight = function (address) {
|
|
165
|
+
return this.request(types_1.RPCMethod.GetAccountRegistrationTopoheight, { address: address });
|
|
142
166
|
};
|
|
143
|
-
RPC.prototype.
|
|
144
|
-
return this.
|
|
167
|
+
RPC.prototype.validateAddress = function (params) {
|
|
168
|
+
return this.request(types_1.RPCMethod.ValidateAddress, params);
|
|
145
169
|
};
|
|
146
|
-
RPC.prototype.
|
|
147
|
-
return this.
|
|
170
|
+
RPC.prototype.splitAddress = function (params) {
|
|
171
|
+
return this.request(types_1.RPCMethod.SplitAddress, params);
|
|
148
172
|
};
|
|
149
|
-
RPC.prototype.
|
|
150
|
-
return this.
|
|
173
|
+
RPC.prototype.extractKeyFromAddress = function (params) {
|
|
174
|
+
return this.request(types_1.RPCMethod.ExtractKeyFromAddress, params);
|
|
151
175
|
};
|
|
152
|
-
RPC.prototype.
|
|
153
|
-
return this.
|
|
176
|
+
RPC.prototype.makeIntegratedAddress = function (params) {
|
|
177
|
+
return this.request(types_1.RPCMethod.MakeIntegratedAddress, params);
|
|
154
178
|
};
|
|
155
|
-
RPC.prototype.
|
|
156
|
-
return this.
|
|
179
|
+
RPC.prototype.decryptExtraData = function (params) {
|
|
180
|
+
return this.request(types_1.RPCMethod.DecryptExtraData, params);
|
|
157
181
|
};
|
|
158
|
-
RPC.prototype.
|
|
159
|
-
return this.
|
|
182
|
+
RPC.prototype.getMultisigAtTopoheight = function (params) {
|
|
183
|
+
return this.request(types_1.RPCMethod.GetMultisigAtTopoheight, params);
|
|
160
184
|
};
|
|
161
|
-
RPC.prototype.
|
|
162
|
-
return this.
|
|
185
|
+
RPC.prototype.getMultisig = function (params) {
|
|
186
|
+
return this.request(types_1.RPCMethod.GetMultisig, params);
|
|
187
|
+
};
|
|
188
|
+
RPC.prototype.hasMultisig = function (params) {
|
|
189
|
+
return this.request(types_1.RPCMethod.HasMultisig, params);
|
|
190
|
+
};
|
|
191
|
+
RPC.prototype.hasMultisigAtTopoheight = function (params) {
|
|
192
|
+
return this.request(types_1.RPCMethod.HasMultisigAtTopoheight, params);
|
|
193
|
+
};
|
|
194
|
+
RPC.prototype.getContractOutputs = function (params) {
|
|
195
|
+
return this.request(types_1.RPCMethod.GetContractOutputs, params);
|
|
196
|
+
};
|
|
197
|
+
RPC.prototype.getContractModule = function (params) {
|
|
198
|
+
return this.request(types_1.RPCMethod.GetContractModule, params);
|
|
199
|
+
};
|
|
200
|
+
RPC.prototype.getContractData = function (params) {
|
|
201
|
+
return this.request(types_1.RPCMethod.GetContractData, params);
|
|
202
|
+
};
|
|
203
|
+
RPC.prototype.getContractDataAtTopoheight = function (params) {
|
|
204
|
+
return this.request(types_1.RPCMethod.GetContractDataAtTopoheight, params);
|
|
205
|
+
};
|
|
206
|
+
RPC.prototype.getContractBalance = function (params) {
|
|
207
|
+
return this.request(types_1.RPCMethod.GetContractBalance, params);
|
|
208
|
+
};
|
|
209
|
+
RPC.prototype.getContractBalanceAtTopoheight = function (params) {
|
|
210
|
+
return this.request(types_1.RPCMethod.GetContractBalanceAtTopoheight, params);
|
|
211
|
+
};
|
|
212
|
+
RPC.prototype.getBlockTemplate = function (address) {
|
|
213
|
+
return this.request(types_1.RPCMethod.GetBlockTemplate, { address: address });
|
|
163
214
|
};
|
|
164
215
|
RPC.prototype.getMinerWork = function (params) {
|
|
165
|
-
return this.
|
|
216
|
+
return this.request(types_1.RPCMethod.GetMinerWork, params);
|
|
166
217
|
};
|
|
167
|
-
RPC.prototype.
|
|
168
|
-
return this.
|
|
218
|
+
RPC.prototype.submitBlock = function (params) {
|
|
219
|
+
return this.request(types_1.RPCMethod.SubmitBlock, params);
|
|
169
220
|
};
|
|
170
221
|
return RPC;
|
|
171
|
-
}(
|
|
222
|
+
}(http_1.HttpRPC));
|
|
172
223
|
exports.RPC = RPC;
|
|
173
224
|
exports["default"] = RPC;
|
package/dist/cjs/daemon/types.js
CHANGED
|
@@ -17,53 +17,70 @@ var BlockType;
|
|
|
17
17
|
var RPCMethod;
|
|
18
18
|
(function (RPCMethod) {
|
|
19
19
|
RPCMethod["GetVersion"] = "get_version";
|
|
20
|
-
RPCMethod["GetInfo"] = "get_info";
|
|
21
20
|
RPCMethod["GetHeight"] = "get_height";
|
|
22
21
|
RPCMethod["GetTopoheight"] = "get_topoheight";
|
|
22
|
+
RPCMethod["GetPrunedTopoheight"] = "get_pruned_topoheight";
|
|
23
|
+
RPCMethod["GetInfo"] = "get_info";
|
|
24
|
+
RPCMethod["GetDifficulty"] = "get_difficulty";
|
|
25
|
+
RPCMethod["GetTips"] = "get_tips";
|
|
26
|
+
RPCMethod["GetDevFeeThresholds"] = "get_dev_fee_thresholds";
|
|
27
|
+
RPCMethod["GetSizeOnDisk"] = "get_size_on_disk";
|
|
23
28
|
RPCMethod["GetStableHeight"] = "get_stable_height";
|
|
24
29
|
RPCMethod["GetStableTopoheight"] = "get_stable_topoheight";
|
|
25
|
-
RPCMethod["
|
|
26
|
-
RPCMethod["GetBlockTemplate"] = "get_block_template";
|
|
30
|
+
RPCMethod["GetHardForks"] = "get_hard_forks";
|
|
27
31
|
RPCMethod["GetBlockAtTopoheight"] = "get_block_at_topoheight";
|
|
28
32
|
RPCMethod["GetBlocksAtHeight"] = "get_blocks_at_height";
|
|
29
33
|
RPCMethod["GetBlockByHash"] = "get_block_by_hash";
|
|
30
34
|
RPCMethod["GetTopBlock"] = "get_top_block";
|
|
31
|
-
RPCMethod["GetNonce"] = "get_nonce";
|
|
32
|
-
RPCMethod["GetNonceAtTopoheight"] = "get_nonce_at_topoheight";
|
|
33
|
-
RPCMethod["HasNonce"] = "has_nonce";
|
|
34
35
|
RPCMethod["GetBalance"] = "get_balance";
|
|
36
|
+
RPCMethod["GetStableBalance"] = "get_stable_balance";
|
|
35
37
|
RPCMethod["HasBalance"] = "has_balance";
|
|
36
38
|
RPCMethod["GetBalanceAtTopoheight"] = "get_balance_at_topoheight";
|
|
39
|
+
RPCMethod["GetNonce"] = "get_nonce";
|
|
40
|
+
RPCMethod["HasNonce"] = "has_nonce";
|
|
41
|
+
RPCMethod["GetNonceAtTopoheight"] = "get_nonce_at_topoheight";
|
|
37
42
|
RPCMethod["GetAsset"] = "get_asset";
|
|
38
43
|
RPCMethod["GetAssets"] = "get_assets";
|
|
39
44
|
RPCMethod["CountAssets"] = "count_assets";
|
|
40
45
|
RPCMethod["CountTransactions"] = "count_transactions";
|
|
41
|
-
RPCMethod["
|
|
42
|
-
RPCMethod["
|
|
43
|
-
RPCMethod["
|
|
44
|
-
RPCMethod["
|
|
46
|
+
RPCMethod["CountAccounts"] = "count_accounts";
|
|
47
|
+
RPCMethod["CountContracts"] = "count_contracts";
|
|
48
|
+
RPCMethod["SubmitTransaction"] = "submit_transaction";
|
|
49
|
+
RPCMethod["GetTransactionExecutor"] = "get_transaction_executor";
|
|
45
50
|
RPCMethod["GetTransaction"] = "get_transaction";
|
|
46
51
|
RPCMethod["GetTransactions"] = "get_transactions";
|
|
52
|
+
RPCMethod["IsTxExecutedInBlock"] = "is_tx_executed_in_block";
|
|
53
|
+
RPCMethod["P2PStatus"] = "p2p_status";
|
|
54
|
+
RPCMethod["GetPeers"] = "get_peers";
|
|
55
|
+
RPCMethod["GetMempool"] = "get_mempool";
|
|
56
|
+
RPCMethod["GetMempoolCache"] = "get_mempool_cache";
|
|
57
|
+
RPCMethod["GetEstimatedFeeRates"] = "get_estimated_fee_rates";
|
|
58
|
+
RPCMethod["GetDAGOrder"] = "get_dag_order";
|
|
47
59
|
RPCMethod["GetBlocksRangeByTopoheight"] = "get_blocks_range_by_topoheight";
|
|
48
60
|
RPCMethod["GetBlocksRangeByHeight"] = "get_blocks_range_by_height";
|
|
49
|
-
RPCMethod["GetAccounts"] = "get_accounts";
|
|
50
|
-
RPCMethod["SubmitBlock"] = "submit_block";
|
|
51
|
-
RPCMethod["SubmitTransaction"] = "submit_transaction";
|
|
52
|
-
RPCMethod["CountAccounts"] = "count_accounts";
|
|
53
61
|
RPCMethod["GetAccountHistory"] = "get_account_history";
|
|
54
62
|
RPCMethod["GetAccountAssets"] = "get_account_assets";
|
|
55
|
-
RPCMethod["
|
|
56
|
-
RPCMethod["GetDevFeeThresholds"] = "get_dev_fee_thresholds";
|
|
57
|
-
RPCMethod["GetSizeOnDisk"] = "get_size_on_disk";
|
|
58
|
-
RPCMethod["IsTxExecutedInBlock"] = "is_tx_executed_in_block";
|
|
59
|
-
RPCMethod["GetAccountRegistrationTopoheight"] = "get_account_registration_topoheight";
|
|
63
|
+
RPCMethod["GetAccounts"] = "get_accounts";
|
|
60
64
|
RPCMethod["IsAccountRegistered"] = "is_account_registered";
|
|
61
|
-
RPCMethod["
|
|
62
|
-
RPCMethod["GetDifficulty"] = "get_difficulty";
|
|
65
|
+
RPCMethod["GetAccountRegistrationTopoheight"] = "get_account_registration_topoheight";
|
|
63
66
|
RPCMethod["ValidateAddress"] = "validate_address";
|
|
67
|
+
RPCMethod["SplitAddress"] = "split_address";
|
|
64
68
|
RPCMethod["ExtractKeyFromAddress"] = "extract_key_from_address";
|
|
69
|
+
RPCMethod["MakeIntegratedAddress"] = "make_integrated_address";
|
|
70
|
+
RPCMethod["DecryptExtraData"] = "decrypt_extra_data";
|
|
71
|
+
RPCMethod["GetMultisigAtTopoheight"] = "get_multisig_at_topoheight";
|
|
72
|
+
RPCMethod["GetMultisig"] = "get_multisig";
|
|
73
|
+
RPCMethod["HasMultisig"] = "has_multisig";
|
|
74
|
+
RPCMethod["HasMultisigAtTopoheight"] = "has_multisig_at_topoheight";
|
|
75
|
+
RPCMethod["GetContractOutputs"] = "get_contract_outputs";
|
|
76
|
+
RPCMethod["GetContractModule"] = "get_contract_module";
|
|
77
|
+
RPCMethod["GetContractData"] = "get_contract_data";
|
|
78
|
+
RPCMethod["GetContractDataAtTopoheight"] = "get_contract_data_at_topoheight";
|
|
79
|
+
RPCMethod["GetContractBalance"] = "get_contract_balance";
|
|
80
|
+
RPCMethod["GetContractBalanceAtTopoheight"] = "get_contract_balance_at_topoheight";
|
|
81
|
+
RPCMethod["GetBlockTemplate"] = "get_block_template";
|
|
65
82
|
RPCMethod["GetMinerWork"] = "get_miner_work";
|
|
66
|
-
RPCMethod["
|
|
83
|
+
RPCMethod["SubmitBlock"] = "submit_block";
|
|
67
84
|
})(RPCMethod = exports.RPCMethod || (exports.RPCMethod = {}));
|
|
68
85
|
var RPCEvent;
|
|
69
86
|
(function (RPCEvent) {
|
|
@@ -71,14 +88,17 @@ var RPCEvent;
|
|
|
71
88
|
RPCEvent["BlockOrdered"] = "block_ordered";
|
|
72
89
|
RPCEvent["BlockOrphaned"] = "block_orphaned";
|
|
73
90
|
RPCEvent["StableHeightChanged"] = "stable_height_changed";
|
|
91
|
+
RPCEvent["StableTopoHeightChanged"] = "stable_topo_height_changed";
|
|
74
92
|
RPCEvent["TransactionOrphaned"] = "transaction_orphaned";
|
|
75
93
|
RPCEvent["TransactionAddedInMempool"] = "transaction_added_in_mempool";
|
|
76
94
|
RPCEvent["TransactionExecuted"] = "transaction_executed";
|
|
77
|
-
RPCEvent["
|
|
95
|
+
RPCEvent["InvokeContract"] = "invoke_contract";
|
|
96
|
+
RPCEvent["DeployContract"] = "deploy_contract";
|
|
78
97
|
RPCEvent["NewAsset"] = "new_asset";
|
|
79
98
|
RPCEvent["PeerConnected"] = "peer_connected";
|
|
80
99
|
RPCEvent["PeerDisconnected"] = "peer_disconnected";
|
|
81
|
-
RPCEvent["PeerPeerListUpdated"] = "peer_peer_list_updated";
|
|
82
100
|
RPCEvent["PeerStateUpdated"] = "peer_state_updated";
|
|
101
|
+
RPCEvent["PeerPeerListUpdated"] = "peer_peer_list_updated";
|
|
83
102
|
RPCEvent["PeerPeerDisconnected"] = "peer_peer_disconnected";
|
|
103
|
+
RPCEvent["NewBlockTemplate"] = "new_block_template";
|
|
84
104
|
})(RPCEvent = exports.RPCEvent || (exports.RPCEvent = {}));
|