@waves/node-api-js 1.3.0 → 1.3.10-beta.2
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/README.md +2 -2
- package/cjs/api-node/activation/index.d.ts +21 -21
- package/cjs/api-node/activation/index.js +19 -19
- package/cjs/api-node/addresses/index.d.ts +81 -81
- package/cjs/api-node/addresses/index.js +173 -173
- package/cjs/api-node/addresses/index.js.map +1 -1
- package/cjs/api-node/alias/index.d.ts +6 -6
- package/cjs/api-node/alias/index.js +21 -21
- package/cjs/api-node/assets/index.d.ts +79 -79
- package/cjs/api-node/assets/index.js +171 -171
- package/cjs/api-node/blocks/index.d.ts +143 -131
- package/cjs/api-node/blocks/index.js +209 -209
- package/cjs/api-node/consensus/index.d.ts +39 -39
- package/cjs/api-node/consensus/index.js +36 -36
- package/cjs/api-node/debug/index.d.ts +189 -189
- package/cjs/api-node/debug/index.js +244 -244
- package/cjs/api-node/eth/index.d.ts +3 -3
- package/cjs/api-node/eth/index.js +14 -14
- package/cjs/api-node/leasing/index.d.ts +22 -22
- package/cjs/api-node/leasing/index.js +41 -41
- package/cjs/api-node/node/index.d.ts +11 -11
- package/cjs/api-node/node/index.js +19 -19
- package/cjs/api-node/peers/index.d.ts +46 -46
- package/cjs/api-node/peers/index.js +59 -59
- package/cjs/api-node/rewards/index.d.ts +21 -21
- package/cjs/api-node/rewards/index.js +20 -20
- package/cjs/api-node/transactions/index.d.ts +73 -73
- package/cjs/api-node/transactions/index.js +192 -192
- package/cjs/api-node/utils/index.d.ts +110 -110
- package/cjs/api-node/utils/index.js +210 -210
- package/cjs/api-node/wallet/index.d.ts +5 -5
- package/cjs/api-node/wallet/index.js +6 -6
- package/cjs/constants.d.ts +40 -40
- package/cjs/constants.js +42 -42
- package/cjs/create.d.ts +1238 -1240
- package/cjs/create.js +115 -118
- package/cjs/create.js.map +1 -1
- package/cjs/index.d.ts +9 -9
- package/cjs/index.js +17 -17
- package/cjs/interface.d.ts +44 -44
- package/cjs/interface.js +9 -9
- package/cjs/tools/adresses/availableSponsoredBalances.d.ts +7 -7
- package/cjs/tools/adresses/availableSponsoredBalances.js +29 -29
- package/cjs/tools/adresses/ethAddress2waves.d.ts +1 -1
- package/cjs/tools/adresses/ethAddress2waves.js +46 -46
- package/cjs/tools/adresses/getAssetIdListByTx.d.ts +2 -2
- package/cjs/tools/adresses/getAssetIdListByTx.js +47 -47
- package/cjs/tools/adresses/getAssetsByTransaction.d.ts +3 -3
- package/cjs/tools/adresses/getAssetsByTransaction.js +13 -13
- package/cjs/tools/adresses/getTransactionsWithAssets.d.ts +6 -6
- package/cjs/tools/adresses/getTransactionsWithAssets.js +12 -12
- package/cjs/tools/adresses/watch.d.ts +24 -24
- package/cjs/tools/adresses/watch.js +167 -167
- package/cjs/tools/adresses/wavesAddress2eth.d.ts +1 -1
- package/cjs/tools/adresses/wavesAddress2eth.js +9 -9
- package/cjs/tools/assets/wavesAsset2eth.d.ts +1 -1
- package/cjs/tools/assets/wavesAsset2eth.js +9 -9
- package/cjs/tools/blocks/detectInterval.d.ts +1 -1
- package/cjs/tools/blocks/detectInterval.js +11 -11
- package/cjs/tools/blocks/getNetworkByte.d.ts +1 -1
- package/cjs/tools/blocks/getNetworkByte.js +53 -53
- package/cjs/tools/blocks/getNetworkCode.d.ts +1 -1
- package/cjs/tools/blocks/getNetworkCode.js +10 -10
- package/cjs/tools/blocks/waitHeight.d.ts +3 -3
- package/cjs/tools/blocks/waitHeight.js +64 -64
- package/cjs/tools/parse.d.ts +1 -1
- package/cjs/tools/parse.js +7 -7
- package/cjs/tools/query.d.ts +4 -4
- package/cjs/tools/query.js +40 -40
- package/cjs/tools/request.d.ts +64 -64
- package/cjs/tools/request.js +41 -41
- package/cjs/tools/resolve.d.ts +1 -1
- package/cjs/tools/resolve.js +6 -6
- package/cjs/tools/stringify.d.ts +1 -1
- package/cjs/tools/stringify.js +20 -20
- package/cjs/tools/transactions/broadcast.d.ts +14 -14
- package/cjs/tools/transactions/broadcast.js +59 -59
- package/cjs/tools/transactions/ethTxId2waves.d.ts +1 -1
- package/cjs/tools/transactions/ethTxId2waves.js +10 -10
- package/cjs/tools/transactions/wait.d.ts +10 -10
- package/cjs/tools/transactions/wait.js +41 -41
- package/cjs/tools/utils.d.ts +32 -32
- package/cjs/tools/utils.js +117 -117
- package/dist/node-api.js +2368 -2420
- package/dist/node-api.min.js +2 -2
- package/es/api-node/activation/index.d.ts +21 -21
- package/es/api-node/activation/index.js +12 -12
- package/es/api-node/addresses/index.d.ts +81 -81
- package/es/api-node/addresses/index.js +110 -110
- package/es/api-node/addresses/index.js.map +1 -1
- package/es/api-node/alias/index.d.ts +6 -6
- package/es/api-node/alias/index.js +13 -13
- package/es/api-node/assets/index.d.ts +79 -79
- package/es/api-node/assets/index.js +102 -102
- package/es/api-node/blocks/index.d.ts +143 -131
- package/es/api-node/blocks/index.js +178 -178
- package/es/api-node/consensus/index.d.ts +39 -39
- package/es/api-node/consensus/index.js +26 -26
- package/es/api-node/debug/index.d.ts +189 -189
- package/es/api-node/debug/index.js +200 -200
- package/es/api-node/eth/index.d.ts +3 -3
- package/es/api-node/eth/index.js +7 -7
- package/es/api-node/leasing/index.d.ts +22 -22
- package/es/api-node/leasing/index.js +21 -21
- package/es/api-node/node/index.d.ts +11 -11
- package/es/api-node/node/index.js +9 -9
- package/es/api-node/peers/index.d.ts +46 -46
- package/es/api-node/peers/index.js +45 -45
- package/es/api-node/rewards/index.d.ts +21 -21
- package/es/api-node/rewards/index.js +12 -12
- package/es/api-node/transactions/index.d.ts +73 -73
- package/es/api-node/transactions/index.js +136 -136
- package/es/api-node/utils/index.d.ts +110 -110
- package/es/api-node/utils/index.js +192 -192
- package/es/api-node/wallet/index.d.ts +5 -5
- package/es/api-node/wallet/index.js +6 -6
- package/es/constants.d.ts +40 -40
- package/es/constants.js +39 -39
- package/es/create.d.ts +1238 -1240
- package/es/create.js +89 -92
- package/es/create.js.map +1 -1
- package/es/index.d.ts +9 -9
- package/es/index.js +8 -8
- package/es/interface.d.ts +44 -44
- package/es/interface.js +2 -2
- package/es/tools/adresses/availableSponsoredBalances.d.ts +7 -7
- package/es/tools/adresses/availableSponsoredBalances.js +26 -26
- package/es/tools/adresses/ethAddress2waves.d.ts +1 -1
- package/es/tools/adresses/ethAddress2waves.js +30 -30
- package/es/tools/adresses/getAssetIdListByTx.d.ts +2 -2
- package/es/tools/adresses/getAssetIdListByTx.js +23 -23
- package/es/tools/adresses/getAssetsByTransaction.d.ts +3 -3
- package/es/tools/adresses/getAssetsByTransaction.js +7 -7
- package/es/tools/adresses/getTransactionsWithAssets.d.ts +6 -6
- package/es/tools/adresses/getTransactionsWithAssets.js +6 -6
- package/es/tools/adresses/watch.d.ts +24 -24
- package/es/tools/adresses/watch.js +133 -133
- package/es/tools/adresses/wavesAddress2eth.d.ts +1 -1
- package/es/tools/adresses/wavesAddress2eth.js +6 -6
- package/es/tools/assets/wavesAsset2eth.d.ts +1 -1
- package/es/tools/assets/wavesAsset2eth.js +6 -6
- package/es/tools/blocks/detectInterval.d.ts +1 -1
- package/es/tools/blocks/detectInterval.js +8 -8
- package/es/tools/blocks/getNetworkByte.d.ts +1 -1
- package/es/tools/blocks/getNetworkByte.js +50 -50
- package/es/tools/blocks/getNetworkCode.d.ts +1 -1
- package/es/tools/blocks/getNetworkCode.js +4 -4
- package/es/tools/blocks/waitHeight.d.ts +3 -3
- package/es/tools/blocks/waitHeight.js +35 -35
- package/es/tools/parse.d.ts +1 -1
- package/es/tools/parse.js +4 -4
- package/es/tools/query.d.ts +4 -4
- package/es/tools/query.js +11 -11
- package/es/tools/request.d.ts +64 -64
- package/es/tools/request.js +21 -21
- package/es/tools/resolve.d.ts +1 -1
- package/es/tools/resolve.js +3 -3
- package/es/tools/stringify.d.ts +1 -1
- package/es/tools/stringify.js +17 -17
- package/es/tools/transactions/broadcast.d.ts +14 -14
- package/es/tools/transactions/broadcast.js +42 -42
- package/es/tools/transactions/ethTxId2waves.d.ts +1 -1
- package/es/tools/transactions/ethTxId2waves.js +7 -7
- package/es/tools/transactions/wait.d.ts +10 -10
- package/es/tools/transactions/wait.js +38 -38
- package/es/tools/utils.d.ts +32 -32
- package/es/tools/utils.js +72 -72
- package/package.json +66 -66
- package/cjs/tools/transactions/transactions.d.ts +0 -0
- package/cjs/tools/transactions/transactions.js +0 -2
- package/cjs/tools/transactions/transactions.js.map +0 -1
- package/dist/0.node-api.js +0 -467
- package/dist/node-api.min.js.LICENSE.txt +0 -17
- package/dist/node_fs-node_path.node-api.js +0 -23
- package/dist/vendors-node_modules_node-fetch_src_utils_multipart-parser_js.node-api.js +0 -599
- package/es/tools/transactions/transactions.d.ts +0 -0
- package/es/tools/transactions/transactions.js +0 -2
- package/es/tools/transactions/transactions.js.map +0 -1
|
@@ -1,193 +1,193 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
14
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
15
|
-
if (!m) return o;
|
|
16
|
-
var i = m.call(o), r, ar = [], e;
|
|
17
|
-
try {
|
|
18
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
19
|
-
}
|
|
20
|
-
catch (error) { e = { error: error }; }
|
|
21
|
-
finally {
|
|
22
|
-
try {
|
|
23
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
24
|
-
}
|
|
25
|
-
finally { if (e) throw e.error; }
|
|
26
|
-
}
|
|
27
|
-
return ar;
|
|
28
|
-
};
|
|
29
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
30
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
31
|
-
};
|
|
32
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
exports.broadcast = exports.fetchStatus = exports.fetchMultipleInfo = exports.fetchInfo = exports.fetchUnconfirmedInfo = exports.fetchTransactions = exports.fetchUnconfirmed = exports.fetchCalculateFee = exports.fetchUnconfirmedSize = void 0;
|
|
34
|
-
var constants_1 = require("../../constants");
|
|
35
|
-
var blocks_1 = require("../blocks");
|
|
36
|
-
var request_1 = __importDefault(require("../../tools/request"));
|
|
37
|
-
var query_1 = __importDefault(require("../../tools/query"));
|
|
38
|
-
var utils_1 = require("../../tools/utils");
|
|
39
|
-
var stringify_1 = __importDefault(require("../../tools/stringify"));
|
|
40
|
-
/**
|
|
41
|
-
* GET /transactions/unconfirmed/size
|
|
42
|
-
* Number of unconfirmed transactions
|
|
43
|
-
*/
|
|
44
|
-
function fetchUnconfirmedSize(base) {
|
|
45
|
-
return request_1.default({
|
|
46
|
-
base: base,
|
|
47
|
-
url: '/transactions/unconfirmed/size'
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
exports.fetchUnconfirmedSize = fetchUnconfirmedSize;
|
|
51
|
-
// @TODO: when correct API key is received
|
|
52
|
-
/**
|
|
53
|
-
* POST /transactions/sign/{signerAddress}
|
|
54
|
-
* Sign a transaction with a non-default private key
|
|
55
|
-
*/
|
|
56
|
-
/**
|
|
57
|
-
* POST /transactions/calculateFee
|
|
58
|
-
* Calculate transaction fee
|
|
59
|
-
*/
|
|
60
|
-
function fetchCalculateFee(base, tx, options) {
|
|
61
|
-
if (options === void 0) { options = Object.create(null); }
|
|
62
|
-
return request_1.default({
|
|
63
|
-
base: base,
|
|
64
|
-
url: '/transactions/calculateFee',
|
|
65
|
-
options: utils_1.deepAssign(__assign({}, options), {
|
|
66
|
-
method: 'POST',
|
|
67
|
-
body: stringify_1.default(tx),
|
|
68
|
-
headers: {
|
|
69
|
-
'Content-Type': 'application/json'
|
|
70
|
-
}
|
|
71
|
-
})
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
exports.fetchCalculateFee = fetchCalculateFee;
|
|
75
|
-
/**
|
|
76
|
-
* GET /transactions/unconfirmed
|
|
77
|
-
* Unconfirmed transactions
|
|
78
|
-
*/
|
|
79
|
-
function fetchUnconfirmed(base, options) {
|
|
80
|
-
if (options === void 0) { options = Object.create(null); }
|
|
81
|
-
return request_1.default({
|
|
82
|
-
base: base,
|
|
83
|
-
url: '/transactions/unconfirmed',
|
|
84
|
-
options: options
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
exports.fetchUnconfirmed = fetchUnconfirmed;
|
|
88
|
-
/**
|
|
89
|
-
* Список транзакций по адресу
|
|
90
|
-
* @param address
|
|
91
|
-
* @param limit максимальное количество транзакций в результате
|
|
92
|
-
* @param after искать транзакции после ID указанного в after
|
|
93
|
-
* @param retry количество попыток на выполнение запроса
|
|
94
|
-
*/
|
|
95
|
-
function fetchTransactions(base, address, limit, after, retry, options) {
|
|
96
|
-
if (options === void 0) { options = Object.create(null); }
|
|
97
|
-
return request_1.default({
|
|
98
|
-
base: base,
|
|
99
|
-
url: "/transactions/address/" + address + "/limit/" + limit + query_1.default({ after: after }),
|
|
100
|
-
options: options
|
|
101
|
-
}).then(function (_a) {
|
|
102
|
-
var _b = __read(_a, 1), list = _b[0];
|
|
103
|
-
return list;
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
exports.fetchTransactions = fetchTransactions;
|
|
107
|
-
/**
|
|
108
|
-
* GET /transactions/unconfirmed/info/{id}
|
|
109
|
-
* Unconfirmed transaction info
|
|
110
|
-
*/
|
|
111
|
-
function fetchUnconfirmedInfo(base, id, options) {
|
|
112
|
-
if (options === void 0) { options = Object.create(null); }
|
|
113
|
-
return request_1.default({
|
|
114
|
-
base: base,
|
|
115
|
-
url: "/transactions/unconfirmed/info/" + id,
|
|
116
|
-
options: options
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
exports.fetchUnconfirmedInfo = fetchUnconfirmedInfo;
|
|
120
|
-
// @TODO when correct API key is received
|
|
121
|
-
/**
|
|
122
|
-
* POST /transactions/sign
|
|
123
|
-
* Sign a transaction
|
|
124
|
-
*/
|
|
125
|
-
/**
|
|
126
|
-
* GET /transactions/info/{id}
|
|
127
|
-
* Transaction info
|
|
128
|
-
*/
|
|
129
|
-
function fetchInfo(base, id, options) {
|
|
130
|
-
if (options === void 0) { options = Object.create(null); }
|
|
131
|
-
return request_1.default({
|
|
132
|
-
base: base,
|
|
133
|
-
url: "/transactions/info/" + id,
|
|
134
|
-
options: options
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
exports.fetchInfo = fetchInfo;
|
|
138
|
-
/**
|
|
139
|
-
* GET /transactions/info/
|
|
140
|
-
* Get transactions by IDs
|
|
141
|
-
*/
|
|
142
|
-
function fetchMultipleInfo(base, ids, options) {
|
|
143
|
-
if (options === void 0) { options = Object.create(null); }
|
|
144
|
-
return request_1.default({
|
|
145
|
-
base: base,
|
|
146
|
-
url: "/transactions/info" + query_1.default({ id: ids }),
|
|
147
|
-
options: options
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
exports.fetchMultipleInfo = fetchMultipleInfo;
|
|
151
|
-
function fetchStatus(base, list) {
|
|
152
|
-
var DEFAULT_STATUS = {
|
|
153
|
-
id: '',
|
|
154
|
-
confirmations: -1,
|
|
155
|
-
height: -1,
|
|
156
|
-
inUTX: false,
|
|
157
|
-
status: constants_1.TRANSACTION_STATUSES.NOT_FOUND
|
|
158
|
-
};
|
|
159
|
-
var loadAllTxInfo = list.map(function (id) {
|
|
160
|
-
return fetchUnconfirmedInfo(base, id)
|
|
161
|
-
.then(function () { return (__assign(__assign({}, DEFAULT_STATUS), { id: id, status: constants_1.TRANSACTION_STATUSES.UNCONFIRMED, inUTX: true })); })
|
|
162
|
-
.catch(function () { return fetchInfo(base, id)
|
|
163
|
-
.then(function (tx) { return (__assign(__assign({}, DEFAULT_STATUS), { id: id, status: constants_1.TRANSACTION_STATUSES.IN_BLOCKCHAIN, height: tx.height, applicationStatus: tx.applicationStatus })); }); })
|
|
164
|
-
.catch(function () { return (__assign(__assign({}, DEFAULT_STATUS), { id: id })); });
|
|
165
|
-
});
|
|
166
|
-
return Promise.all([
|
|
167
|
-
blocks_1.fetchHeight(base),
|
|
168
|
-
Promise.all(loadAllTxInfo)
|
|
169
|
-
]).then(function (_a) {
|
|
170
|
-
var _b = __read(_a, 2), height = _b[0].height, statuses = _b[1];
|
|
171
|
-
return ({
|
|
172
|
-
height: height,
|
|
173
|
-
statuses: statuses.map(function (item) { return (__assign(__assign({}, item), { confirmations: item.status === constants_1.TRANSACTION_STATUSES.IN_BLOCKCHAIN ? height - item.height : item.confirmations })); })
|
|
174
|
-
});
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
exports.fetchStatus = fetchStatus;
|
|
178
|
-
function broadcast(base, tx, options) {
|
|
179
|
-
if (options === void 0) { options = Object.create(null); }
|
|
180
|
-
return request_1.default({
|
|
181
|
-
base: base,
|
|
182
|
-
url: '/transactions/broadcast',
|
|
183
|
-
options: utils_1.deepAssign(__assign({}, options), {
|
|
184
|
-
method: 'POST',
|
|
185
|
-
body: stringify_1.default(tx),
|
|
186
|
-
headers: {
|
|
187
|
-
'Content-Type': 'application/json'
|
|
188
|
-
}
|
|
189
|
-
})
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
exports.broadcast = broadcast;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
14
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
15
|
+
if (!m) return o;
|
|
16
|
+
var i = m.call(o), r, ar = [], e;
|
|
17
|
+
try {
|
|
18
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
19
|
+
}
|
|
20
|
+
catch (error) { e = { error: error }; }
|
|
21
|
+
finally {
|
|
22
|
+
try {
|
|
23
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
24
|
+
}
|
|
25
|
+
finally { if (e) throw e.error; }
|
|
26
|
+
}
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
30
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
31
|
+
};
|
|
32
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
+
exports.broadcast = exports.fetchStatus = exports.fetchMultipleInfo = exports.fetchInfo = exports.fetchUnconfirmedInfo = exports.fetchTransactions = exports.fetchUnconfirmed = exports.fetchCalculateFee = exports.fetchUnconfirmedSize = void 0;
|
|
34
|
+
var constants_1 = require("../../constants");
|
|
35
|
+
var blocks_1 = require("../blocks");
|
|
36
|
+
var request_1 = __importDefault(require("../../tools/request"));
|
|
37
|
+
var query_1 = __importDefault(require("../../tools/query"));
|
|
38
|
+
var utils_1 = require("../../tools/utils");
|
|
39
|
+
var stringify_1 = __importDefault(require("../../tools/stringify"));
|
|
40
|
+
/**
|
|
41
|
+
* GET /transactions/unconfirmed/size
|
|
42
|
+
* Number of unconfirmed transactions
|
|
43
|
+
*/
|
|
44
|
+
function fetchUnconfirmedSize(base) {
|
|
45
|
+
return request_1.default({
|
|
46
|
+
base: base,
|
|
47
|
+
url: '/transactions/unconfirmed/size'
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
exports.fetchUnconfirmedSize = fetchUnconfirmedSize;
|
|
51
|
+
// @TODO: when correct API key is received
|
|
52
|
+
/**
|
|
53
|
+
* POST /transactions/sign/{signerAddress}
|
|
54
|
+
* Sign a transaction with a non-default private key
|
|
55
|
+
*/
|
|
56
|
+
/**
|
|
57
|
+
* POST /transactions/calculateFee
|
|
58
|
+
* Calculate transaction fee
|
|
59
|
+
*/
|
|
60
|
+
function fetchCalculateFee(base, tx, options) {
|
|
61
|
+
if (options === void 0) { options = Object.create(null); }
|
|
62
|
+
return request_1.default({
|
|
63
|
+
base: base,
|
|
64
|
+
url: '/transactions/calculateFee',
|
|
65
|
+
options: utils_1.deepAssign(__assign({}, options), {
|
|
66
|
+
method: 'POST',
|
|
67
|
+
body: stringify_1.default(tx),
|
|
68
|
+
headers: {
|
|
69
|
+
'Content-Type': 'application/json'
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
exports.fetchCalculateFee = fetchCalculateFee;
|
|
75
|
+
/**
|
|
76
|
+
* GET /transactions/unconfirmed
|
|
77
|
+
* Unconfirmed transactions
|
|
78
|
+
*/
|
|
79
|
+
function fetchUnconfirmed(base, options) {
|
|
80
|
+
if (options === void 0) { options = Object.create(null); }
|
|
81
|
+
return request_1.default({
|
|
82
|
+
base: base,
|
|
83
|
+
url: '/transactions/unconfirmed',
|
|
84
|
+
options: options
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
exports.fetchUnconfirmed = fetchUnconfirmed;
|
|
88
|
+
/**
|
|
89
|
+
* Список транзакций по адресу
|
|
90
|
+
* @param address
|
|
91
|
+
* @param limit максимальное количество транзакций в результате
|
|
92
|
+
* @param after искать транзакции после ID указанного в after
|
|
93
|
+
* @param retry количество попыток на выполнение запроса
|
|
94
|
+
*/
|
|
95
|
+
function fetchTransactions(base, address, limit, after, retry, options) {
|
|
96
|
+
if (options === void 0) { options = Object.create(null); }
|
|
97
|
+
return request_1.default({
|
|
98
|
+
base: base,
|
|
99
|
+
url: "/transactions/address/" + address + "/limit/" + limit + query_1.default({ after: after }),
|
|
100
|
+
options: options
|
|
101
|
+
}).then(function (_a) {
|
|
102
|
+
var _b = __read(_a, 1), list = _b[0];
|
|
103
|
+
return list;
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
exports.fetchTransactions = fetchTransactions;
|
|
107
|
+
/**
|
|
108
|
+
* GET /transactions/unconfirmed/info/{id}
|
|
109
|
+
* Unconfirmed transaction info
|
|
110
|
+
*/
|
|
111
|
+
function fetchUnconfirmedInfo(base, id, options) {
|
|
112
|
+
if (options === void 0) { options = Object.create(null); }
|
|
113
|
+
return request_1.default({
|
|
114
|
+
base: base,
|
|
115
|
+
url: "/transactions/unconfirmed/info/" + id,
|
|
116
|
+
options: options
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
exports.fetchUnconfirmedInfo = fetchUnconfirmedInfo;
|
|
120
|
+
// @TODO when correct API key is received
|
|
121
|
+
/**
|
|
122
|
+
* POST /transactions/sign
|
|
123
|
+
* Sign a transaction
|
|
124
|
+
*/
|
|
125
|
+
/**
|
|
126
|
+
* GET /transactions/info/{id}
|
|
127
|
+
* Transaction info
|
|
128
|
+
*/
|
|
129
|
+
function fetchInfo(base, id, options) {
|
|
130
|
+
if (options === void 0) { options = Object.create(null); }
|
|
131
|
+
return request_1.default({
|
|
132
|
+
base: base,
|
|
133
|
+
url: "/transactions/info/" + id,
|
|
134
|
+
options: options
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
exports.fetchInfo = fetchInfo;
|
|
138
|
+
/**
|
|
139
|
+
* GET /transactions/info/
|
|
140
|
+
* Get transactions by IDs
|
|
141
|
+
*/
|
|
142
|
+
function fetchMultipleInfo(base, ids, options) {
|
|
143
|
+
if (options === void 0) { options = Object.create(null); }
|
|
144
|
+
return request_1.default({
|
|
145
|
+
base: base,
|
|
146
|
+
url: "/transactions/info" + query_1.default({ id: ids }),
|
|
147
|
+
options: options
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
exports.fetchMultipleInfo = fetchMultipleInfo;
|
|
151
|
+
function fetchStatus(base, list) {
|
|
152
|
+
var DEFAULT_STATUS = {
|
|
153
|
+
id: '',
|
|
154
|
+
confirmations: -1,
|
|
155
|
+
height: -1,
|
|
156
|
+
inUTX: false,
|
|
157
|
+
status: constants_1.TRANSACTION_STATUSES.NOT_FOUND
|
|
158
|
+
};
|
|
159
|
+
var loadAllTxInfo = list.map(function (id) {
|
|
160
|
+
return fetchUnconfirmedInfo(base, id)
|
|
161
|
+
.then(function () { return (__assign(__assign({}, DEFAULT_STATUS), { id: id, status: constants_1.TRANSACTION_STATUSES.UNCONFIRMED, inUTX: true })); })
|
|
162
|
+
.catch(function () { return fetchInfo(base, id)
|
|
163
|
+
.then(function (tx) { return (__assign(__assign({}, DEFAULT_STATUS), { id: id, status: constants_1.TRANSACTION_STATUSES.IN_BLOCKCHAIN, height: tx.height, applicationStatus: tx.applicationStatus })); }); })
|
|
164
|
+
.catch(function () { return (__assign(__assign({}, DEFAULT_STATUS), { id: id })); });
|
|
165
|
+
});
|
|
166
|
+
return Promise.all([
|
|
167
|
+
blocks_1.fetchHeight(base),
|
|
168
|
+
Promise.all(loadAllTxInfo)
|
|
169
|
+
]).then(function (_a) {
|
|
170
|
+
var _b = __read(_a, 2), height = _b[0].height, statuses = _b[1];
|
|
171
|
+
return ({
|
|
172
|
+
height: height,
|
|
173
|
+
statuses: statuses.map(function (item) { return (__assign(__assign({}, item), { confirmations: item.status === constants_1.TRANSACTION_STATUSES.IN_BLOCKCHAIN ? height - item.height : item.confirmations })); })
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
exports.fetchStatus = fetchStatus;
|
|
178
|
+
function broadcast(base, tx, options) {
|
|
179
|
+
if (options === void 0) { options = Object.create(null); }
|
|
180
|
+
return request_1.default({
|
|
181
|
+
base: base,
|
|
182
|
+
url: '/transactions/broadcast',
|
|
183
|
+
options: utils_1.deepAssign(__assign({}, options), {
|
|
184
|
+
method: 'POST',
|
|
185
|
+
body: stringify_1.default(tx),
|
|
186
|
+
headers: {
|
|
187
|
+
'Content-Type': 'application/json'
|
|
188
|
+
}
|
|
189
|
+
})
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
exports.broadcast = broadcast;
|
|
193
193
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
import { Transaction, WithApiMixin } from '@waves/ts-types';
|
|
2
|
-
import { TLong } from '../../interface';
|
|
3
|
-
/**
|
|
4
|
-
* GET /utils/seed
|
|
5
|
-
* Generate random seed
|
|
6
|
-
*/
|
|
7
|
-
export declare function fetchSeed(base: string, length?: number): Promise<{
|
|
8
|
-
seed: string;
|
|
9
|
-
}>;
|
|
10
|
-
/**
|
|
11
|
-
* POST /utils/script/compileCode
|
|
12
|
-
* Compiles string code to base64 script representation
|
|
13
|
-
*/
|
|
14
|
-
export declare function fetchCompileCode(base: string, body: string): Promise<ICompileCode>;
|
|
15
|
-
/**
|
|
16
|
-
* POST /utils/script/compileWithImports
|
|
17
|
-
* Compiles string code with imports to base64 script representation
|
|
18
|
-
*/
|
|
19
|
-
export declare function fetchCompileWithImports(base: string, body: ICompileWithImportsBody): Promise<ICompileCode>;
|
|
20
|
-
/**
|
|
21
|
-
* POST /utils/script/estimate
|
|
22
|
-
* Estimates compiled code in Base64 representation
|
|
23
|
-
*/
|
|
24
|
-
export declare function fetchEstimate(base: string, body: string): Promise<IEstimate>;
|
|
25
|
-
/**
|
|
26
|
-
* POST /utils/script/evaluate
|
|
27
|
-
* Evaluates the provided expression, taking into account the deployed dApp contract
|
|
28
|
-
*/
|
|
29
|
-
export declare function fetchEvaluate(base: string, address: string, expr: string): Promise<IEvaluate>;
|
|
30
|
-
/**
|
|
31
|
-
* POST /utils/transactionSerialize
|
|
32
|
-
* Serialize transaction
|
|
33
|
-
*/
|
|
34
|
-
export declare function fetchTransactionSerialize(base: string, body: Transaction<TLong> & WithApiMixin): Promise<ITransactionSerialize>;
|
|
35
|
-
/**
|
|
36
|
-
* POST /utils/hash/secure
|
|
37
|
-
* Return SecureCryptographicHash of specified message
|
|
38
|
-
*/
|
|
39
|
-
export declare function fetchHashSecure(base: string, body: string): Promise<IHashSecure>;
|
|
40
|
-
/**
|
|
41
|
-
* POST /utils/hash/fast
|
|
42
|
-
* Return FastCryptographicHash of specified message
|
|
43
|
-
*/
|
|
44
|
-
export declare function fetchHashFast(base: string, body: string): Promise<IHashSecure>;
|
|
45
|
-
/**
|
|
46
|
-
* POST /utils/script/meta
|
|
47
|
-
* Account's script meta
|
|
48
|
-
*/
|
|
49
|
-
export declare function fetchScriptMeta(base: string, body: string): Promise<IScriptMeta>;
|
|
50
|
-
/**
|
|
51
|
-
* POST /utils/script/decompile
|
|
52
|
-
* Decompiles base64 script representation to string code
|
|
53
|
-
*/
|
|
54
|
-
export declare function fetchScriptDecompile(base: string, body: string): Promise<IScriptDecompile>;
|
|
55
|
-
/**
|
|
56
|
-
* POST /utils/sign/{privateKey}
|
|
57
|
-
* Return FastCryptographicHash of specified message
|
|
58
|
-
*/
|
|
59
|
-
export declare function fetchSignPrivateKey(base: string, privateKey: string, body: string): Promise<ISignPrivateKey>;
|
|
60
|
-
/**
|
|
61
|
-
* GET /utils/time
|
|
62
|
-
* Current Node time (UTC)
|
|
63
|
-
*/
|
|
64
|
-
export declare function fetchNodeTime(base: string): Promise<INodeTime>;
|
|
65
|
-
interface IScriptMeta {
|
|
66
|
-
version?: string;
|
|
67
|
-
callableFuncTypes?: Array<Record<string, Record<string, 'Int' | 'String' | 'Binary'>>>;
|
|
68
|
-
}
|
|
69
|
-
interface IScriptDecompile {
|
|
70
|
-
STDLIB_VERSION: number;
|
|
71
|
-
CONTENT_TYPE: string;
|
|
72
|
-
script: string;
|
|
73
|
-
SCRIPT_TYPE?: string;
|
|
74
|
-
}
|
|
75
|
-
export interface ICompileCode {
|
|
76
|
-
script: string;
|
|
77
|
-
complexity: number;
|
|
78
|
-
callableComplexities: Record<string, number>;
|
|
79
|
-
verifierComplexity: number;
|
|
80
|
-
extraFee: TLong;
|
|
81
|
-
}
|
|
82
|
-
export interface IEstimate extends ICompileCode {
|
|
83
|
-
scriptText: string;
|
|
84
|
-
}
|
|
85
|
-
export interface IEvaluate {
|
|
86
|
-
address: string;
|
|
87
|
-
expr: string;
|
|
88
|
-
result: object;
|
|
89
|
-
complexity: number;
|
|
90
|
-
}
|
|
91
|
-
interface ICompileWithImportsBody {
|
|
92
|
-
script: string;
|
|
93
|
-
imports: object;
|
|
94
|
-
}
|
|
95
|
-
interface IHashSecure {
|
|
96
|
-
message: string;
|
|
97
|
-
hash: string;
|
|
98
|
-
}
|
|
99
|
-
interface ITransactionSerialize {
|
|
100
|
-
bytes: Array<number>;
|
|
101
|
-
}
|
|
102
|
-
interface ISignPrivateKey {
|
|
103
|
-
message: string;
|
|
104
|
-
signature: string;
|
|
105
|
-
}
|
|
106
|
-
interface INodeTime {
|
|
107
|
-
system: number;
|
|
108
|
-
NTP: number;
|
|
109
|
-
}
|
|
110
|
-
export {};
|
|
1
|
+
import { Transaction, WithApiMixin } from '@waves/ts-types';
|
|
2
|
+
import { TLong } from '../../interface';
|
|
3
|
+
/**
|
|
4
|
+
* GET /utils/seed
|
|
5
|
+
* Generate random seed
|
|
6
|
+
*/
|
|
7
|
+
export declare function fetchSeed(base: string, length?: number): Promise<{
|
|
8
|
+
seed: string;
|
|
9
|
+
}>;
|
|
10
|
+
/**
|
|
11
|
+
* POST /utils/script/compileCode
|
|
12
|
+
* Compiles string code to base64 script representation
|
|
13
|
+
*/
|
|
14
|
+
export declare function fetchCompileCode(base: string, body: string): Promise<ICompileCode>;
|
|
15
|
+
/**
|
|
16
|
+
* POST /utils/script/compileWithImports
|
|
17
|
+
* Compiles string code with imports to base64 script representation
|
|
18
|
+
*/
|
|
19
|
+
export declare function fetchCompileWithImports(base: string, body: ICompileWithImportsBody): Promise<ICompileCode>;
|
|
20
|
+
/**
|
|
21
|
+
* POST /utils/script/estimate
|
|
22
|
+
* Estimates compiled code in Base64 representation
|
|
23
|
+
*/
|
|
24
|
+
export declare function fetchEstimate(base: string, body: string): Promise<IEstimate>;
|
|
25
|
+
/**
|
|
26
|
+
* POST /utils/script/evaluate
|
|
27
|
+
* Evaluates the provided expression, taking into account the deployed dApp contract
|
|
28
|
+
*/
|
|
29
|
+
export declare function fetchEvaluate(base: string, address: string, expr: string): Promise<IEvaluate>;
|
|
30
|
+
/**
|
|
31
|
+
* POST /utils/transactionSerialize
|
|
32
|
+
* Serialize transaction
|
|
33
|
+
*/
|
|
34
|
+
export declare function fetchTransactionSerialize(base: string, body: Transaction<TLong> & WithApiMixin): Promise<ITransactionSerialize>;
|
|
35
|
+
/**
|
|
36
|
+
* POST /utils/hash/secure
|
|
37
|
+
* Return SecureCryptographicHash of specified message
|
|
38
|
+
*/
|
|
39
|
+
export declare function fetchHashSecure(base: string, body: string): Promise<IHashSecure>;
|
|
40
|
+
/**
|
|
41
|
+
* POST /utils/hash/fast
|
|
42
|
+
* Return FastCryptographicHash of specified message
|
|
43
|
+
*/
|
|
44
|
+
export declare function fetchHashFast(base: string, body: string): Promise<IHashSecure>;
|
|
45
|
+
/**
|
|
46
|
+
* POST /utils/script/meta
|
|
47
|
+
* Account's script meta
|
|
48
|
+
*/
|
|
49
|
+
export declare function fetchScriptMeta(base: string, body: string): Promise<IScriptMeta>;
|
|
50
|
+
/**
|
|
51
|
+
* POST /utils/script/decompile
|
|
52
|
+
* Decompiles base64 script representation to string code
|
|
53
|
+
*/
|
|
54
|
+
export declare function fetchScriptDecompile(base: string, body: string): Promise<IScriptDecompile>;
|
|
55
|
+
/**
|
|
56
|
+
* POST /utils/sign/{privateKey}
|
|
57
|
+
* Return FastCryptographicHash of specified message
|
|
58
|
+
*/
|
|
59
|
+
export declare function fetchSignPrivateKey(base: string, privateKey: string, body: string): Promise<ISignPrivateKey>;
|
|
60
|
+
/**
|
|
61
|
+
* GET /utils/time
|
|
62
|
+
* Current Node time (UTC)
|
|
63
|
+
*/
|
|
64
|
+
export declare function fetchNodeTime(base: string): Promise<INodeTime>;
|
|
65
|
+
interface IScriptMeta {
|
|
66
|
+
version?: string;
|
|
67
|
+
callableFuncTypes?: Array<Record<string, Record<string, 'Int' | 'String' | 'Binary'>>>;
|
|
68
|
+
}
|
|
69
|
+
interface IScriptDecompile {
|
|
70
|
+
STDLIB_VERSION: number;
|
|
71
|
+
CONTENT_TYPE: string;
|
|
72
|
+
script: string;
|
|
73
|
+
SCRIPT_TYPE?: string;
|
|
74
|
+
}
|
|
75
|
+
export interface ICompileCode {
|
|
76
|
+
script: string;
|
|
77
|
+
complexity: number;
|
|
78
|
+
callableComplexities: Record<string, number>;
|
|
79
|
+
verifierComplexity: number;
|
|
80
|
+
extraFee: TLong;
|
|
81
|
+
}
|
|
82
|
+
export interface IEstimate extends ICompileCode {
|
|
83
|
+
scriptText: string;
|
|
84
|
+
}
|
|
85
|
+
export interface IEvaluate {
|
|
86
|
+
address: string;
|
|
87
|
+
expr: string;
|
|
88
|
+
result: object;
|
|
89
|
+
complexity: number;
|
|
90
|
+
}
|
|
91
|
+
interface ICompileWithImportsBody {
|
|
92
|
+
script: string;
|
|
93
|
+
imports: object;
|
|
94
|
+
}
|
|
95
|
+
interface IHashSecure {
|
|
96
|
+
message: string;
|
|
97
|
+
hash: string;
|
|
98
|
+
}
|
|
99
|
+
interface ITransactionSerialize {
|
|
100
|
+
bytes: Array<number>;
|
|
101
|
+
}
|
|
102
|
+
interface ISignPrivateKey {
|
|
103
|
+
message: string;
|
|
104
|
+
signature: string;
|
|
105
|
+
}
|
|
106
|
+
interface INodeTime {
|
|
107
|
+
system: number;
|
|
108
|
+
NTP: number;
|
|
109
|
+
}
|
|
110
|
+
export {};
|