@waves/node-api-js 1.2.5-beta.12 → 1.2.5-beta.15
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/cjs/api-node/activation/index.js +2 -2
- package/cjs/api-node/activation/index.js.map +1 -1
- package/cjs/api-node/addresses/index.js +45 -54
- package/cjs/api-node/addresses/index.js.map +1 -1
- package/cjs/api-node/alias/index.js +5 -5
- package/cjs/api-node/alias/index.js.map +1 -1
- package/cjs/api-node/assets/index.d.ts +12 -0
- package/cjs/api-node/assets/index.js +69 -114
- package/cjs/api-node/assets/index.js.map +1 -1
- package/cjs/api-node/blocks/index.js +49 -60
- package/cjs/api-node/blocks/index.js.map +1 -1
- package/cjs/api-node/consensus/index.js +5 -6
- package/cjs/api-node/consensus/index.js.map +1 -1
- package/cjs/api-node/debug/index.js +14 -17
- package/cjs/api-node/debug/index.js.map +1 -1
- package/cjs/api-node/eth/index.js +5 -5
- package/cjs/api-node/eth/index.js.map +1 -1
- package/cjs/api-node/leasing/index.js +7 -19
- package/cjs/api-node/leasing/index.js.map +1 -1
- package/cjs/api-node/node/index.js +5 -7
- package/cjs/api-node/node/index.js.map +1 -1
- package/cjs/api-node/peers/index.js +13 -17
- package/cjs/api-node/peers/index.js.map +1 -1
- package/cjs/api-node/rewards/index.js +5 -6
- package/cjs/api-node/rewards/index.js.map +1 -1
- package/cjs/api-node/transactions/index.js +42 -82
- package/cjs/api-node/transactions/index.js.map +1 -1
- package/cjs/api-node/utils/index.js +22 -22
- package/cjs/api-node/utils/index.js.map +1 -1
- package/cjs/create.js +59 -59
- package/cjs/create.js.map +1 -1
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +5 -5
- package/cjs/index.js.map +1 -1
- package/cjs/interface.js +2 -6
- package/cjs/interface.js.map +1 -1
- package/cjs/tools/adresses/availableSponsoredBalances.js +9 -9
- package/cjs/tools/adresses/availableSponsoredBalances.js.map +1 -1
- package/cjs/tools/adresses/ethAddress2waves.js +16 -29
- package/cjs/tools/adresses/ethAddress2waves.js.map +1 -1
- package/cjs/tools/adresses/getAssetIdListByTx.js +15 -36
- package/cjs/tools/adresses/getAssetIdListByTx.js.map +1 -1
- package/cjs/tools/adresses/getAssetsByTransaction.js +4 -4
- package/cjs/tools/adresses/getAssetsByTransaction.js.map +1 -1
- package/cjs/tools/adresses/getTransactionsWithAssets.js +3 -3
- package/cjs/tools/adresses/getTransactionsWithAssets.js.map +1 -1
- package/cjs/tools/adresses/watch.js +56 -85
- package/cjs/tools/adresses/watch.js.map +1 -1
- package/cjs/tools/adresses/wavesAddress2eth.js +4 -4
- package/cjs/tools/adresses/wavesAddress2eth.js.map +1 -1
- package/cjs/tools/assets/wavesAsset2eth.js +4 -4
- package/cjs/tools/assets/wavesAsset2eth.js.map +1 -1
- package/cjs/tools/blocks/detectInterval.js +4 -4
- package/cjs/tools/blocks/detectInterval.js.map +1 -1
- package/cjs/tools/blocks/getNetworkByte.js +6 -6
- package/cjs/tools/blocks/getNetworkByte.js.map +1 -1
- package/cjs/tools/blocks/getNetworkCode.js +2 -2
- package/cjs/tools/blocks/getNetworkCode.js.map +1 -1
- package/cjs/tools/blocks/waitHeight.js +13 -36
- package/cjs/tools/blocks/waitHeight.js.map +1 -1
- package/cjs/tools/parse.js +2 -2
- package/cjs/tools/parse.js.map +1 -1
- package/cjs/tools/query.js +8 -34
- package/cjs/tools/query.js.map +1 -1
- package/cjs/tools/request.d.ts +1 -1
- package/cjs/tools/request.js +7 -19
- package/cjs/tools/request.js.map +1 -1
- package/cjs/tools/stringify.js +3 -3
- package/cjs/tools/stringify.js.map +1 -1
- package/cjs/tools/transactions/broadcast.js +18 -29
- package/cjs/tools/transactions/broadcast.js.map +1 -1
- package/cjs/tools/transactions/ethTxId2waves.js +2 -2
- package/cjs/tools/transactions/ethTxId2waves.js.map +1 -1
- package/cjs/tools/transactions/transactions.js +52 -75
- package/cjs/tools/transactions/transactions.js.map +1 -1
- package/cjs/tools/transactions/wait.js +16 -16
- package/cjs/tools/transactions/wait.js.map +1 -1
- package/cjs/tools/utils.js +30 -63
- package/cjs/tools/utils.js.map +1 -1
- package/dist/node-api.js +585 -55
- package/dist/node-api.min.js +5 -5
- package/es/api-node/assets/index.d.ts +12 -0
- package/es/api-node/assets/index.js +7 -0
- package/es/api-node/assets/index.js.map +1 -1
- package/es/index.d.ts +1 -0
- package/es/index.js.map +1 -1
- package/es/tools/request.d.ts +1 -1
- package/es/tools/request.js +1 -1
- package/es/tools/request.js.map +1 -1
- package/es/tools/transactions/transactions.js +1 -10
- package/es/tools/transactions/transactions.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,50 +1,23 @@
|
|
|
1
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
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
30
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
31
4
|
};
|
|
32
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
6
|
exports.broadcast = exports.fetchStatus = exports.fetchInfo = exports.fetchUnconfirmedInfo = exports.fetchTransactions = exports.fetchUnconfirmed = exports.fetchCalculateFee = exports.fetchUnconfirmedSize = void 0;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
7
|
+
const constants_1 = require("../../constants");
|
|
8
|
+
const blocks_1 = require("../blocks");
|
|
9
|
+
const request_1 = __importDefault(require("../../tools/request"));
|
|
10
|
+
const query_1 = __importDefault(require("../../tools/query"));
|
|
11
|
+
const utils_1 = require("../../tools/utils");
|
|
12
|
+
const stringify_1 = __importDefault(require("../../tools/stringify"));
|
|
13
|
+
const transactions_1 = require("../../tools/transactions/transactions");
|
|
41
14
|
/**
|
|
42
15
|
* GET /transactions/unconfirmed/size
|
|
43
16
|
* Number of unconfirmed transactions
|
|
44
17
|
*/
|
|
45
18
|
function fetchUnconfirmedSize(base) {
|
|
46
19
|
return request_1.default({
|
|
47
|
-
base
|
|
20
|
+
base,
|
|
48
21
|
url: '/transactions/unconfirmed/size'
|
|
49
22
|
});
|
|
50
23
|
}
|
|
@@ -58,12 +31,11 @@ exports.fetchUnconfirmedSize = fetchUnconfirmedSize;
|
|
|
58
31
|
* POST /transactions/calculateFee
|
|
59
32
|
* Calculate transaction fee
|
|
60
33
|
*/
|
|
61
|
-
function fetchCalculateFee(base, tx, options) {
|
|
62
|
-
if (options === void 0) { options = Object.create(null); }
|
|
34
|
+
function fetchCalculateFee(base, tx, options = Object.create(null)) {
|
|
63
35
|
return request_1.default({
|
|
64
|
-
base
|
|
36
|
+
base,
|
|
65
37
|
url: '/transactions/calculateFee',
|
|
66
|
-
options: utils_1.deepAssign(
|
|
38
|
+
options: utils_1.deepAssign(Object.assign({}, options), {
|
|
67
39
|
method: 'POST',
|
|
68
40
|
body: stringify_1.default(tx),
|
|
69
41
|
headers: {
|
|
@@ -77,12 +49,11 @@ exports.fetchCalculateFee = fetchCalculateFee;
|
|
|
77
49
|
* GET /transactions/unconfirmed
|
|
78
50
|
* Unconfirmed transactions
|
|
79
51
|
*/
|
|
80
|
-
function fetchUnconfirmed(base, options) {
|
|
81
|
-
if (options === void 0) { options = Object.create(null); }
|
|
52
|
+
function fetchUnconfirmed(base, options = Object.create(null)) {
|
|
82
53
|
return request_1.default({
|
|
83
|
-
base
|
|
54
|
+
base,
|
|
84
55
|
url: '/transactions/unconfirmed',
|
|
85
|
-
options
|
|
56
|
+
options
|
|
86
57
|
});
|
|
87
58
|
}
|
|
88
59
|
exports.fetchUnconfirmed = fetchUnconfirmed;
|
|
@@ -93,15 +64,13 @@ exports.fetchUnconfirmed = fetchUnconfirmed;
|
|
|
93
64
|
* @param after искать транзакции после ID указанного в after
|
|
94
65
|
* @param retry количество попыток на выполнение запроса
|
|
95
66
|
*/
|
|
96
|
-
function fetchTransactions(base, address, limit, after, retry, options) {
|
|
97
|
-
if (options === void 0) { options = Object.create(null); }
|
|
67
|
+
function fetchTransactions(base, address, limit, after, retry, options = Object.create(null)) {
|
|
98
68
|
return request_1.default({
|
|
99
|
-
base
|
|
100
|
-
url:
|
|
101
|
-
options
|
|
102
|
-
}).then(
|
|
103
|
-
|
|
104
|
-
list.forEach(function (transaction) { return transactions_1.addStateUpdateField(transaction); });
|
|
69
|
+
base,
|
|
70
|
+
url: `/transactions/address/${address}/limit/${limit}${query_1.default({ after })}`,
|
|
71
|
+
options
|
|
72
|
+
}).then(([list]) => {
|
|
73
|
+
list.forEach(transaction => transactions_1.addStateUpdateField(transaction));
|
|
105
74
|
return list;
|
|
106
75
|
});
|
|
107
76
|
}
|
|
@@ -110,12 +79,11 @@ exports.fetchTransactions = fetchTransactions;
|
|
|
110
79
|
* GET /transactions/unconfirmed/info/{id}
|
|
111
80
|
* Unconfirmed transaction info
|
|
112
81
|
*/
|
|
113
|
-
function fetchUnconfirmedInfo(base, id, options) {
|
|
114
|
-
if (options === void 0) { options = Object.create(null); }
|
|
82
|
+
function fetchUnconfirmedInfo(base, id, options = Object.create(null)) {
|
|
115
83
|
return request_1.default({
|
|
116
|
-
base
|
|
117
|
-
url:
|
|
118
|
-
options
|
|
84
|
+
base,
|
|
85
|
+
url: `/transactions/unconfirmed/info/${id}`,
|
|
86
|
+
options
|
|
119
87
|
});
|
|
120
88
|
}
|
|
121
89
|
exports.fetchUnconfirmedInfo = fetchUnconfirmedInfo;
|
|
@@ -128,48 +96,40 @@ exports.fetchUnconfirmedInfo = fetchUnconfirmedInfo;
|
|
|
128
96
|
* GET /transactions/info/{id}
|
|
129
97
|
* Transaction info
|
|
130
98
|
*/
|
|
131
|
-
function fetchInfo(base, id, options) {
|
|
132
|
-
if (options === void 0) { options = Object.create(null); }
|
|
99
|
+
function fetchInfo(base, id, options = Object.create(null)) {
|
|
133
100
|
return request_1.default({
|
|
134
|
-
base
|
|
135
|
-
url:
|
|
136
|
-
options
|
|
137
|
-
}).then(
|
|
101
|
+
base,
|
|
102
|
+
url: `/transactions/info/${id}`,
|
|
103
|
+
options
|
|
104
|
+
}).then(transaction => transactions_1.addStateUpdateField(transaction));
|
|
138
105
|
}
|
|
139
106
|
exports.fetchInfo = fetchInfo;
|
|
140
107
|
function fetchStatus(base, list) {
|
|
141
|
-
|
|
108
|
+
const DEFAULT_STATUS = {
|
|
142
109
|
id: '',
|
|
143
110
|
confirmations: -1,
|
|
144
111
|
height: -1,
|
|
145
112
|
inUTX: false,
|
|
146
113
|
status: constants_1.TRANSACTION_STATUSES.NOT_FOUND
|
|
147
114
|
};
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
.catch(function () { return (__assign(__assign({}, DEFAULT_STATUS), { id: id })); });
|
|
154
|
-
});
|
|
115
|
+
const loadAllTxInfo = list.map(id => fetchUnconfirmedInfo(base, id)
|
|
116
|
+
.then(() => (Object.assign(Object.assign({}, DEFAULT_STATUS), { id, status: constants_1.TRANSACTION_STATUSES.UNCONFIRMED, inUTX: true })))
|
|
117
|
+
.catch(() => fetchInfo(base, id)
|
|
118
|
+
.then(tx => (Object.assign(Object.assign({}, DEFAULT_STATUS), { id, status: constants_1.TRANSACTION_STATUSES.IN_BLOCKCHAIN, height: tx.height, applicationStatus: tx.applicationStatus }))))
|
|
119
|
+
.catch(() => (Object.assign(Object.assign({}, DEFAULT_STATUS), { id }))));
|
|
155
120
|
return Promise.all([
|
|
156
121
|
blocks_1.fetchHeight(base),
|
|
157
122
|
Promise.all(loadAllTxInfo)
|
|
158
|
-
]).then(
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
statuses: statuses.map(function (item) { return (__assign(__assign({}, item), { confirmations: item.status === constants_1.TRANSACTION_STATUSES.IN_BLOCKCHAIN ? height - item.height : item.confirmations })); })
|
|
163
|
-
});
|
|
164
|
-
});
|
|
123
|
+
]).then(([{ height }, statuses]) => ({
|
|
124
|
+
height,
|
|
125
|
+
statuses: statuses.map(item => (Object.assign(Object.assign({}, item), { confirmations: item.status === constants_1.TRANSACTION_STATUSES.IN_BLOCKCHAIN ? height - item.height : item.confirmations })))
|
|
126
|
+
}));
|
|
165
127
|
}
|
|
166
128
|
exports.fetchStatus = fetchStatus;
|
|
167
|
-
function broadcast(base, tx, options) {
|
|
168
|
-
if (options === void 0) { options = Object.create(null); }
|
|
129
|
+
function broadcast(base, tx, options = Object.create(null)) {
|
|
169
130
|
return request_1.default({
|
|
170
|
-
base:
|
|
171
|
-
|
|
172
|
-
options: utils_1.deepAssign(__assign({}, options), {
|
|
131
|
+
base, url: '/transactions/broadcast',
|
|
132
|
+
options: utils_1.deepAssign(Object.assign({}, options), {
|
|
173
133
|
method: 'POST',
|
|
174
134
|
body: stringify_1.default(tx),
|
|
175
135
|
headers: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api-node/transactions/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api-node/transactions/index.ts"],"names":[],"mappings":";;;;;;AAAA,+CAA2E;AAE3E,sCAAsC;AACtC,kEAAyD;AACzD,8DAAsC;AACtC,6CAA6C;AAC7C,sEAA8C;AAE9C,wEAAwF;AAGxF;;;GAGG;AACH,SAAgB,oBAAoB,CAAC,IAAY;IAC7C,OAAO,iBAAO,CAAC;QACX,IAAI;QACJ,GAAG,EAAE,gCAAgC;KACxC,CAAC,CAAA;AACN,CAAC;AALD,oDAKC;AAOD,0CAA0C;AAC1C;;;GAGG;AAEH;;;GAGG;AACH,SAAgB,iBAAiB,CAC7B,IAAY,EACZ,EAAmD,EACnD,UAAuB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;IAE1C,OAAO,iBAAO,CAAC;QACX,IAAI;QACJ,GAAG,EAAE,4BAA4B;QACjC,OAAO,EAAE,kBAAU,mBACX,OAAO,GACX;YACI,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,mBAAS,CAAC,EAAE,CAAC;YACnB,OAAO,EAAE;gBACL,cAAc,EAAE,kBAAkB;aACrC;SACJ,CACJ;KACJ,CAAC,CAAC;AACP,CAAC;AAnBD,8CAmBC;AAOD;;;GAGG;AACH,SAAgB,gBAAgB,CAAC,IAAY,EAAE,UAAuB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;IACrF,OAAO,iBAAO,CAAC;QACX,IAAI;QACJ,GAAG,EAAE,2BAA2B;QAChC,OAAO;KACV,CAAC,CAAA;AACN,CAAC;AAND,4CAMC;AAED;;;;;;GAMG;AACH,SAAgB,iBAAiB,CAC7B,IAAY,EACZ,OAAe,EACf,KAAa,EACb,KAAc,EACd,KAAc,EACd,UAAuB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;IAE1C,OAAO,iBAAO,CAAmD;QAC7D,IAAI;QACJ,GAAG,EAAE,yBAAyB,OAAO,UAAU,KAAK,GAAG,eA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C,EAAE,CAAC;YACnB,OAAO,EAAE;gBACL,cAAc,EAAE,kBAAkB;aACrC;SACJ,CACJ;KACJ,CAAC,CAAC;AACP,CAAC;AAdD,8BAcC"}
|
|
@@ -4,16 +4,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.fetchNodeTime = exports.fetchSignPrivateKey = exports.fetchScriptDecompile = exports.fetchScriptMeta = exports.fetchHashFast = exports.fetchHashSecure = exports.fetchTransactionSerialize = exports.fetchEstimate = exports.fetchCompileWithImports = exports.fetchCompileCode = exports.fetchSeed = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const request_1 = __importDefault(require("../../tools/request"));
|
|
8
|
+
const stringify_1 = __importDefault(require("../../tools/stringify"));
|
|
9
9
|
/**
|
|
10
10
|
* GET /utils/seed
|
|
11
11
|
* Generate random seed
|
|
12
12
|
*/
|
|
13
13
|
function fetchSeed(base, length) {
|
|
14
14
|
return request_1.default({
|
|
15
|
-
base
|
|
16
|
-
url:
|
|
15
|
+
base,
|
|
16
|
+
url: `/utils/seed${length ? `/${length}` : ''}`
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
exports.fetchSeed = fetchSeed;
|
|
@@ -23,11 +23,11 @@ exports.fetchSeed = fetchSeed;
|
|
|
23
23
|
*/
|
|
24
24
|
function fetchCompileCode(base, body) {
|
|
25
25
|
return request_1.default({
|
|
26
|
-
base
|
|
26
|
+
base,
|
|
27
27
|
url: '/utils/script/compileCode',
|
|
28
28
|
options: {
|
|
29
29
|
method: 'POST',
|
|
30
|
-
body
|
|
30
|
+
body,
|
|
31
31
|
headers: {
|
|
32
32
|
'Content-Type': 'application/json'
|
|
33
33
|
}
|
|
@@ -41,7 +41,7 @@ exports.fetchCompileCode = fetchCompileCode;
|
|
|
41
41
|
*/
|
|
42
42
|
function fetchCompileWithImports(base, body) {
|
|
43
43
|
return request_1.default({
|
|
44
|
-
base
|
|
44
|
+
base,
|
|
45
45
|
url: '/utils/script/compileWithImports',
|
|
46
46
|
options: {
|
|
47
47
|
method: 'POST',
|
|
@@ -59,11 +59,11 @@ exports.fetchCompileWithImports = fetchCompileWithImports;
|
|
|
59
59
|
*/
|
|
60
60
|
function fetchEstimate(base, body) {
|
|
61
61
|
return request_1.default({
|
|
62
|
-
base
|
|
62
|
+
base,
|
|
63
63
|
url: '/utils/script/estimate',
|
|
64
64
|
options: {
|
|
65
65
|
method: 'POST',
|
|
66
|
-
body
|
|
66
|
+
body,
|
|
67
67
|
headers: {
|
|
68
68
|
'Content-Type': 'application/json'
|
|
69
69
|
}
|
|
@@ -77,7 +77,7 @@ exports.fetchEstimate = fetchEstimate;
|
|
|
77
77
|
*/
|
|
78
78
|
function fetchTransactionSerialize(base, body) {
|
|
79
79
|
return request_1.default({
|
|
80
|
-
base
|
|
80
|
+
base,
|
|
81
81
|
url: '/utils/transactionSerialize',
|
|
82
82
|
options: {
|
|
83
83
|
method: 'POST',
|
|
@@ -95,11 +95,11 @@ exports.fetchTransactionSerialize = fetchTransactionSerialize;
|
|
|
95
95
|
*/
|
|
96
96
|
function fetchHashSecure(base, body) {
|
|
97
97
|
return request_1.default({
|
|
98
|
-
base
|
|
98
|
+
base,
|
|
99
99
|
url: '/utils/hash/secure',
|
|
100
100
|
options: {
|
|
101
101
|
method: 'POST',
|
|
102
|
-
body
|
|
102
|
+
body,
|
|
103
103
|
headers: {
|
|
104
104
|
'Content-Type': 'application/json'
|
|
105
105
|
}
|
|
@@ -113,11 +113,11 @@ exports.fetchHashSecure = fetchHashSecure;
|
|
|
113
113
|
*/
|
|
114
114
|
function fetchHashFast(base, body) {
|
|
115
115
|
return request_1.default({
|
|
116
|
-
base
|
|
116
|
+
base,
|
|
117
117
|
url: '/utils/hash/fast',
|
|
118
118
|
options: {
|
|
119
119
|
method: 'POST',
|
|
120
|
-
body
|
|
120
|
+
body,
|
|
121
121
|
headers: {
|
|
122
122
|
'Content-Type': 'application/json'
|
|
123
123
|
}
|
|
@@ -131,11 +131,11 @@ exports.fetchHashFast = fetchHashFast;
|
|
|
131
131
|
*/
|
|
132
132
|
function fetchScriptMeta(base, body) {
|
|
133
133
|
return request_1.default({
|
|
134
|
-
base
|
|
134
|
+
base,
|
|
135
135
|
url: '/utils/script/meta',
|
|
136
136
|
options: {
|
|
137
137
|
method: 'POST',
|
|
138
|
-
body
|
|
138
|
+
body,
|
|
139
139
|
headers: {
|
|
140
140
|
'Content-Type': 'application/json'
|
|
141
141
|
}
|
|
@@ -149,11 +149,11 @@ exports.fetchScriptMeta = fetchScriptMeta;
|
|
|
149
149
|
*/
|
|
150
150
|
function fetchScriptDecompile(base, body) {
|
|
151
151
|
return request_1.default({
|
|
152
|
-
base
|
|
152
|
+
base,
|
|
153
153
|
url: '/utils/script/decompile',
|
|
154
154
|
options: {
|
|
155
155
|
method: 'POST',
|
|
156
|
-
body
|
|
156
|
+
body,
|
|
157
157
|
headers: {
|
|
158
158
|
'Content-Type': 'application/json'
|
|
159
159
|
}
|
|
@@ -167,11 +167,11 @@ exports.fetchScriptDecompile = fetchScriptDecompile;
|
|
|
167
167
|
*/
|
|
168
168
|
function fetchSignPrivateKey(base, privateKey, body) {
|
|
169
169
|
return request_1.default({
|
|
170
|
-
base
|
|
171
|
-
url:
|
|
170
|
+
base,
|
|
171
|
+
url: `/utils/sign/${privateKey}`,
|
|
172
172
|
options: {
|
|
173
173
|
method: 'POST',
|
|
174
|
-
body
|
|
174
|
+
body,
|
|
175
175
|
headers: {
|
|
176
176
|
'Content-Type': 'application/json'
|
|
177
177
|
}
|
|
@@ -185,7 +185,7 @@ exports.fetchSignPrivateKey = fetchSignPrivateKey;
|
|
|
185
185
|
*/
|
|
186
186
|
function fetchNodeTime(base) {
|
|
187
187
|
return request_1.default({
|
|
188
|
-
base
|
|
188
|
+
base,
|
|
189
189
|
url: '/utils/time'
|
|
190
190
|
});
|
|
191
191
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api-node/utils/index.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api-node/utils/index.ts"],"names":[],"mappings":";;;;;;AAAA,kEAA0C;AAC1C,sEAA8C;AAI9C;;;GAGG;AACH,SAAgB,SAAS,CAAC,IAAY,EAAE,MAAe;IACnD,OAAO,iBAAO,CAAC;QACX,IAAI;QACJ,GAAG,EAAE,cAAc,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;KAClD,CAAC,CAAA;AACN,CAAC;AALD,8BAKC;AAED;;;GAGG;AACH,SAAgB,gBAAgB,CAAC,IAAY,EAAE,IAAY;IACvD,OAAO,iBAAO,CAAC;QACX,IAAI;QACJ,GAAG,EAAE,2BAA2B;QAChC,OAAO,EAAE;YACL,MAAM,EAAE,MAAM;YACd,IAAI;YACJ,OAAO,EAAE;gBACL,cAAc,EAAE,kBAAkB;aACrC;SACJ;KACJ,CAAC,CAAA;AACN,CAAC;AAZD,4CAYC;AAED;;;GAGG;AACH,SAAgB,uBAAuB,CAAC,IAAY,EAAE,IAA6B;IAC/E,OAAO,iBAAO,CAAC;QACX,IAAI;QACJ,GAAG,EAAE,kCAAkC;QACvC,OAAO,EAAE;YACL,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,mBAAS,CAAC,IAAI,CAAC;YACrB,OAAO,EAAE;gBACL,cAAc,EAAE,kBAAkB;aACrC;SACJ;KACJ,CAAC,CAAA;AACN,CAAC;AAZD,0DAYC;AAED;;;GAGG;AACH,SAAgB,aAAa,CAAC,IAAY,EAAE,IAAY;IACpD,OAAO,iBAAO,CAAC;QACX,IAAI;QACJ,GAAG,EAAE,wBAAwB;QAC7B,OAAO,EAAE;YACL,MAAM,EAAE,MAAM;YACd,IAAI;YACJ,OAAO,EAAE;gBACL,cAAc,EAAE,kBAA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OAAO,iBAAO,CAAC;QACX,IAAI;QACJ,GAAG,EAAE,yBAAyB;QAC9B,OAAO,EAAE;YACL,MAAM,EAAE,MAAM;YACd,IAAI;YACJ,OAAO,EAAE;gBACL,cAAc,EAAE,kBAAkB;aACrC;SACJ;KACJ,CAAC,CAAA;AACN,CAAC;AAZD,oDAYC;AAED;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,IAAY,EAAE,UAAkB,EAAE,IAAY;IAC9E,OAAO,iBAAO,CAAC;QACX,IAAI;QACJ,GAAG,EAAE,eAAe,UAAU,EAAE;QAChC,OAAO,EAAE;YACL,MAAM,EAAE,MAAM;YACd,IAAI;YACJ,OAAO,EAAE;gBACL,cAAc,EAAE,kBAAkB;aACrC;SACJ;KACJ,CAAC,CAAA;AACN,CAAC;AAZD,kDAYC;AAED;;;GAGG;AACH,SAAgB,aAAa,CAAC,IAAY;IACtC,OAAO,iBAAO,CAAC;QACX,IAAI;QACJ,GAAG,EAAE,aAAa;KACrB,CAAC,CAAA;AACN,CAAC;AALD,sCAKC"}
|
package/cjs/create.js
CHANGED
|
@@ -23,50 +23,50 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.create = void 0;
|
|
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
|
-
|
|
26
|
+
const addressesModule = __importStar(require("./api-node/addresses"));
|
|
27
|
+
const blocksModule = __importStar(require("./api-node/blocks"));
|
|
28
|
+
const transactionsModule = __importStar(require("./api-node/transactions"));
|
|
29
|
+
const leasingModule = __importStar(require("./api-node/leasing"));
|
|
30
|
+
const peersModule = __importStar(require("./api-node/peers"));
|
|
31
|
+
const rewardsModule = __importStar(require("./api-node/rewards"));
|
|
32
|
+
const utilsModule = __importStar(require("./api-node/utils"));
|
|
33
|
+
const debugModule = __importStar(require("./api-node/debug"));
|
|
34
|
+
const aliasModule = __importStar(require("./api-node/alias"));
|
|
35
|
+
const consensusModule = __importStar(require("./api-node/consensus"));
|
|
36
|
+
const activationModule = __importStar(require("./api-node/activation"));
|
|
37
|
+
const nodeModule = __importStar(require("./api-node/node"));
|
|
38
|
+
const assetsModule = __importStar(require("./api-node/assets"));
|
|
39
|
+
const ethModule = __importStar(require("./api-node/eth"));
|
|
40
|
+
const query_1 = __importDefault(require("./tools/query"));
|
|
41
|
+
const resolve_1 = __importDefault(require("./tools/resolve"));
|
|
42
|
+
const request_1 = __importDefault(require("./tools/request"));
|
|
43
|
+
const broadcast_1 = __importDefault(require("./tools/transactions/broadcast"));
|
|
44
|
+
const getAssetsByTransaction_1 = __importDefault(require("./tools/adresses/getAssetsByTransaction"));
|
|
45
|
+
const getAssetIdListByTx_1 = __importDefault(require("./tools/adresses/getAssetIdListByTx"));
|
|
46
|
+
const getTransactionsWithAssets_1 = __importDefault(require("./tools/adresses/getTransactionsWithAssets"));
|
|
47
|
+
const availableSponsoredBalances_1 = __importDefault(require("./tools/adresses/availableSponsoredBalances"));
|
|
48
|
+
const wait_1 = __importDefault(require("./tools/transactions/wait"));
|
|
49
|
+
const parse_1 = __importDefault(require("./tools/parse"));
|
|
50
|
+
const getNetworkByte_1 = __importDefault(require("./tools/blocks/getNetworkByte"));
|
|
51
|
+
const getNetworkCode_1 = __importDefault(require("./tools/blocks/getNetworkCode"));
|
|
52
|
+
const watch_1 = __importDefault(require("./tools/adresses/watch"));
|
|
53
|
+
const toolsUtilsModule = __importStar(require("./tools/utils"));
|
|
54
54
|
function create(base) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
55
|
+
const addresses = wrapRecord(base, addressesModule);
|
|
56
|
+
const blocks = wrapRecord(base, blocksModule);
|
|
57
|
+
const transactions = wrapRecord(base, transactionsModule);
|
|
58
|
+
const leasing = wrapRecord(base, leasingModule);
|
|
59
|
+
const peers = wrapRecord(base, peersModule);
|
|
60
|
+
const rewards = wrapRecord(base, rewardsModule);
|
|
61
|
+
const utils = wrapRecord(base, utilsModule);
|
|
62
|
+
const debug = wrapRecord(base, debugModule);
|
|
63
|
+
const alias = wrapRecord(base, aliasModule);
|
|
64
|
+
const consensus = wrapRecord(base, consensusModule);
|
|
65
|
+
const activation = wrapRecord(base, activationModule);
|
|
66
|
+
const node = wrapRecord(base, nodeModule);
|
|
67
|
+
const assets = wrapRecord(base, assetsModule);
|
|
68
|
+
const eth = wrapRecord(base, ethModule);
|
|
69
|
+
const tools = {
|
|
70
70
|
transactions: {
|
|
71
71
|
broadcast: wrapRequest(base, broadcast_1.default),
|
|
72
72
|
wait: wrapRequest(base, wait_1.default)
|
|
@@ -89,26 +89,26 @@ function create(base) {
|
|
|
89
89
|
parse: parse_1.default
|
|
90
90
|
};
|
|
91
91
|
return {
|
|
92
|
-
addresses
|
|
93
|
-
blocks
|
|
94
|
-
transactions
|
|
95
|
-
leasing
|
|
96
|
-
tools
|
|
97
|
-
peers
|
|
98
|
-
rewards
|
|
99
|
-
utils
|
|
100
|
-
debug
|
|
101
|
-
alias
|
|
102
|
-
consensus
|
|
103
|
-
activation
|
|
104
|
-
node
|
|
105
|
-
assets
|
|
106
|
-
eth
|
|
92
|
+
addresses,
|
|
93
|
+
blocks,
|
|
94
|
+
transactions,
|
|
95
|
+
leasing,
|
|
96
|
+
tools,
|
|
97
|
+
peers,
|
|
98
|
+
rewards,
|
|
99
|
+
utils,
|
|
100
|
+
debug,
|
|
101
|
+
alias,
|
|
102
|
+
consensus,
|
|
103
|
+
activation,
|
|
104
|
+
node,
|
|
105
|
+
assets,
|
|
106
|
+
eth
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
109
|
exports.create = create;
|
|
110
110
|
function wrapRecord(base, hash) {
|
|
111
|
-
return Object.keys(hash).reduce(
|
|
111
|
+
return Object.keys(hash).reduce((acc, methodName) => {
|
|
112
112
|
acc[methodName] = wrapRequest(base, hash[methodName]);
|
|
113
113
|
return acc;
|
|
114
114
|
}, {});
|
package/cjs/create.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sEAAwD;AACxD,gEAAkD;AAClD,4EAA8D;AAC9D,kEAAoD;AACpD,8DAAgD;AAChD,kEAAoD;AACpD,8DAAgD;AAChD,8DAAgD;AAChD,8DAAgD;AAChD,sEAAwD;AACxD,wEAA0D;AAC1D,4DAA8C;AAC9C,gEAAkD;AAClD,0DAA4C;AAC5C,0DAAkC;AAClC,8DAAsC;AACtC,8DAAsC;AACtC,+EAAoF;AACpF,qGAA6E;AAC7E,6FAAqE;AACrE,2GAAmF;AACnF,6GAAqF;AACrF,qEAA6C;AAC7C,0DAAkC;AAClC,mFAA2D;AAC3D,mFAA2D;AAC3D,mEAAiD;AACjD,gEAAkD;AAYlD,SAAgB,MAAM,CAAC,IAAY;IAC/B,MAAM,SAAS,GAAwC,UAAU,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;IACzF,MAAM,MAAM,GAAqC,UAAU,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IAChF,MAAM,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jE,kBAAkB,EAAlB,4BAAkB;YAClB,yBAAyB,EAAE,WAAW,CAAC,IAAI,EAAE,mCAAyB,CAAC;YACvE,0BAA0B,EAAE,WAAW,CAAC,IAAI,EAAE,oCAA0B,CAAC;SAC5E;QACD,KAAK,EAAE,gBAAgB;QACvB,KAAK,EAAL,eAAK;QACL,OAAO,EAAP,iBAAO;QACP,OAAO,EAAP,iBAAO;QACP,KAAK,EAAL,eAAK;KACR,CAAC;IAEF,OAAO;QACH,SAAS;QACT,MAAM;QACN,YAAY;QACZ,OAAO;QACP,KAAK;QACL,KAAK;QACL,OAAO;QACP,KAAK;QACL,KAAK;QACL,KAAK;QACL,SAAS;QACT,UAAU;QACV,IAAI;QACJ,MAAM;QACN,GAAG;KACN,CAAC;AACN,CAAC;AAxDD,wBAwDC;AAED,SAAS,UAAU,CAAuE,IAAY,EAAE,IAAO;IAC3G,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAiB,CAAC,GAAG,EAAE,UAAmB,EAAE,EAAE;QACzE,GAAG,CAAC,UAAU,CAAC,GAAG,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;QACtD,OAAO,GAAG,CAAC;IACf,CAAC,EAAE,EAAS,CAAC,CAAC;AAClB,CAAC;AAED,SAAS,WAAW,CAAuD,IAAY,EAAE,QAAW;IAChG,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAQ,CAAC;AAC5C,CAAC"}
|
package/cjs/index.d.ts
CHANGED
|
@@ -6,3 +6,4 @@ import { create as createFn } from './create';
|
|
|
6
6
|
export { wavesAddress2eth, ethAddress2waves, wavesAsset2Eth, ethTxId2waves };
|
|
7
7
|
export declare const create: typeof createFn;
|
|
8
8
|
export default createFn;
|
|
9
|
+
export { ICallableFuncArgumentType, TCallableFuncArgumentsArray, TCallableFuncArgumentsRecord, TCallableFuncArguments, } from './api-node/addresses';
|
package/cjs/index.js
CHANGED
|
@@ -4,15 +4,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.create = exports.ethTxId2waves = exports.wavesAsset2Eth = exports.ethAddress2waves = exports.wavesAddress2eth = void 0;
|
|
7
|
-
|
|
7
|
+
const wavesAddress2eth_1 = __importDefault(require("./tools/adresses/wavesAddress2eth"));
|
|
8
8
|
exports.wavesAddress2eth = wavesAddress2eth_1.default;
|
|
9
|
-
|
|
9
|
+
const ethAddress2waves_1 = __importDefault(require("./tools/adresses/ethAddress2waves"));
|
|
10
10
|
exports.ethAddress2waves = ethAddress2waves_1.default;
|
|
11
|
-
|
|
11
|
+
const wavesAsset2eth_1 = __importDefault(require("./tools/assets/wavesAsset2eth"));
|
|
12
12
|
exports.wavesAsset2Eth = wavesAsset2eth_1.default;
|
|
13
|
-
|
|
13
|
+
const ethTxId2waves_1 = __importDefault(require("./tools/transactions/ethTxId2waves"));
|
|
14
14
|
exports.ethTxId2waves = ethTxId2waves_1.default;
|
|
15
|
-
|
|
15
|
+
const create_1 = require("./create");
|
|
16
16
|
exports.create = create_1.create;
|
|
17
17
|
exports.default = create_1.create;
|
|
18
18
|
//# sourceMappingURL=index.js.map
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,yFAAiE;AAQ7D,2BARG,0BAAgB,CAQH;AAPpB,yFAAiE;AAQ7D,2BARG,0BAAgB,CAQH;AAPpB,mFAA2D;AAQvD,yBARG,wBAAc,CAQH;AAPlB,uFAA+D;AAQ3D,wBARG,uBAAa,CAQH;AANjB,qCAA8C;AASjC,QAAA,MAAM,GAAG,eAAQ,CAAC;AAE/B,kBAAe,eAAQ,CAAC"}
|
package/cjs/interface.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isCallableFuncRecordArguments = exports.isCallableFuncArrayArguments = void 0;
|
|
4
|
-
exports.isCallableFuncArrayArguments =
|
|
5
|
-
|
|
6
|
-
};
|
|
7
|
-
exports.isCallableFuncRecordArguments = function (scriptInfoMeta) {
|
|
8
|
-
return !scriptInfoMeta.isArrayArguments;
|
|
9
|
-
};
|
|
4
|
+
exports.isCallableFuncArrayArguments = (scriptInfoMeta) => !!scriptInfoMeta.isArrayArguments;
|
|
5
|
+
exports.isCallableFuncRecordArguments = (scriptInfoMeta) => !scriptInfoMeta.isArrayArguments;
|
|
10
6
|
//# sourceMappingURL=interface.js.map
|
package/cjs/interface.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../src/interface.ts"],"names":[],"mappings":";;;AAiDa,QAAA,4BAA4B,GAAG,
|
|
1
|
+
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../src/interface.ts"],"names":[],"mappings":";;;AAiDa,QAAA,4BAA4B,GAAG,CAAC,cAAuD,EAAkE,EAAE,CACpK,CAAC,CAAC,cAAc,CAAC,gBAAgB,CAAA;AAExB,QAAA,6BAA6B,GAAG,CAAC,cAAuD,EAAmE,EAAE,CACtK,CAAC,cAAc,CAAC,gBAAgB,CAAA"}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const bignumber_1 = require("@waves/bignumber");
|
|
4
|
+
const assets_1 = require("../../api-node/assets");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
6
|
function default_1(base, address, wavesFee) {
|
|
7
7
|
return assets_1.fetchAssetsBalance(base, address).then(utils_1.pipe(utils_1.prop('balances'), utils_1.filter(canBeSponsor(wavesFee)), utils_1.map(currentFee(wavesFee))));
|
|
8
8
|
}
|
|
9
9
|
exports.default = default_1;
|
|
10
10
|
function canBeSponsor(wavesFee) {
|
|
11
|
-
return
|
|
11
|
+
return balance => (balance.minSponsoredAssetFee
|
|
12
12
|
&& bignumber_1.BigNumber.toBigNumber(balance.sponsorBalance || 0)
|
|
13
13
|
.gte(wavesFee)
|
|
14
14
|
&& bignumber_1.BigNumber.toBigNumber(wavesFee)
|
|
15
15
|
.div(0.001 * Math.pow(10, 8))
|
|
16
16
|
.mul(balance.minSponsoredAssetFee)
|
|
17
|
-
.lte(balance.balance)) || false;
|
|
17
|
+
.lte(balance.balance)) || false;
|
|
18
18
|
}
|
|
19
19
|
function currentFee(wavesFee) {
|
|
20
|
-
|
|
20
|
+
const count = bignumber_1.BigNumber.toBigNumber(wavesFee)
|
|
21
21
|
.div(0.001 * Math.pow(10, 8));
|
|
22
|
-
return
|
|
22
|
+
return balance => ({
|
|
23
23
|
assetId: balance.assetId,
|
|
24
|
-
wavesFee
|
|
24
|
+
wavesFee,
|
|
25
25
|
assetFee: bignumber_1.BigNumber.toBigNumber(balance.minSponsoredAssetFee)
|
|
26
26
|
.mul(count)
|
|
27
27
|
.toFixed()
|
|
28
|
-
});
|
|
28
|
+
});
|
|
29
29
|
}
|
|
30
30
|
//# sourceMappingURL=availableSponsoredBalances.js.map
|