@waves/node-api-js 1.2.10 → 1.3.10-beta.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/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 -99
- package/cjs/api-node/utils/index.js +210 -192
- package/cjs/api-node/utils/index.js.map +1 -1
- 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 -2402
- 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 -99
- package/es/api-node/utils/index.js +192 -175
- package/es/api-node/utils/index.js.map +1 -1
- 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,54 +1,54 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var blocks_1 = require("../../api-node/blocks");
|
|
4
|
-
function default_1(base) {
|
|
5
|
-
return blocks_1.fetchHeadersLast(base).then(function (header) { return base58Decode(header.generator)[1]; });
|
|
6
|
-
}
|
|
7
|
-
exports.default = default_1;
|
|
8
|
-
var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
|
|
9
|
-
var ALPHABET_MAP = {};
|
|
10
|
-
for (var i = 0; i < ALPHABET.length; i++) {
|
|
11
|
-
ALPHABET_MAP[ALPHABET.charAt(i)] = i;
|
|
12
|
-
}
|
|
13
|
-
function base58Decode(string) {
|
|
14
|
-
var bytes, c, carry, j, i;
|
|
15
|
-
if (string.length === 0) {
|
|
16
|
-
return new Uint8Array(0);
|
|
17
|
-
}
|
|
18
|
-
i = void 0;
|
|
19
|
-
j = void 0;
|
|
20
|
-
bytes = [0];
|
|
21
|
-
i = 0;
|
|
22
|
-
while (i < string.length) {
|
|
23
|
-
c = string[i];
|
|
24
|
-
if (!(c in ALPHABET_MAP)) {
|
|
25
|
-
throw 'Base58.decode received unacceptable input. Character \'' + c + '\' is not in the Base58 alphabet.';
|
|
26
|
-
}
|
|
27
|
-
j = 0;
|
|
28
|
-
while (j < bytes.length) {
|
|
29
|
-
bytes[j] *= 58;
|
|
30
|
-
j++;
|
|
31
|
-
}
|
|
32
|
-
bytes[0] += ALPHABET_MAP[c];
|
|
33
|
-
carry = 0;
|
|
34
|
-
j = 0;
|
|
35
|
-
while (j < bytes.length) {
|
|
36
|
-
bytes[j] += carry;
|
|
37
|
-
carry = bytes[j] >> 8;
|
|
38
|
-
bytes[j] &= 0xff;
|
|
39
|
-
++j;
|
|
40
|
-
}
|
|
41
|
-
while (carry) {
|
|
42
|
-
bytes.push(carry & 0xff);
|
|
43
|
-
carry >>= 8;
|
|
44
|
-
}
|
|
45
|
-
i++;
|
|
46
|
-
}
|
|
47
|
-
i = 0;
|
|
48
|
-
while (string[i] === '1' && i < string.length - 1) {
|
|
49
|
-
bytes.push(0);
|
|
50
|
-
i++;
|
|
51
|
-
}
|
|
52
|
-
return new Uint8Array(bytes.reverse());
|
|
53
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var blocks_1 = require("../../api-node/blocks");
|
|
4
|
+
function default_1(base) {
|
|
5
|
+
return blocks_1.fetchHeadersLast(base).then(function (header) { return base58Decode(header.generator)[1]; });
|
|
6
|
+
}
|
|
7
|
+
exports.default = default_1;
|
|
8
|
+
var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
|
|
9
|
+
var ALPHABET_MAP = {};
|
|
10
|
+
for (var i = 0; i < ALPHABET.length; i++) {
|
|
11
|
+
ALPHABET_MAP[ALPHABET.charAt(i)] = i;
|
|
12
|
+
}
|
|
13
|
+
function base58Decode(string) {
|
|
14
|
+
var bytes, c, carry, j, i;
|
|
15
|
+
if (string.length === 0) {
|
|
16
|
+
return new Uint8Array(0);
|
|
17
|
+
}
|
|
18
|
+
i = void 0;
|
|
19
|
+
j = void 0;
|
|
20
|
+
bytes = [0];
|
|
21
|
+
i = 0;
|
|
22
|
+
while (i < string.length) {
|
|
23
|
+
c = string[i];
|
|
24
|
+
if (!(c in ALPHABET_MAP)) {
|
|
25
|
+
throw 'Base58.decode received unacceptable input. Character \'' + c + '\' is not in the Base58 alphabet.';
|
|
26
|
+
}
|
|
27
|
+
j = 0;
|
|
28
|
+
while (j < bytes.length) {
|
|
29
|
+
bytes[j] *= 58;
|
|
30
|
+
j++;
|
|
31
|
+
}
|
|
32
|
+
bytes[0] += ALPHABET_MAP[c];
|
|
33
|
+
carry = 0;
|
|
34
|
+
j = 0;
|
|
35
|
+
while (j < bytes.length) {
|
|
36
|
+
bytes[j] += carry;
|
|
37
|
+
carry = bytes[j] >> 8;
|
|
38
|
+
bytes[j] &= 0xff;
|
|
39
|
+
++j;
|
|
40
|
+
}
|
|
41
|
+
while (carry) {
|
|
42
|
+
bytes.push(carry & 0xff);
|
|
43
|
+
carry >>= 8;
|
|
44
|
+
}
|
|
45
|
+
i++;
|
|
46
|
+
}
|
|
47
|
+
i = 0;
|
|
48
|
+
while (string[i] === '1' && i < string.length - 1) {
|
|
49
|
+
bytes.push(0);
|
|
50
|
+
i++;
|
|
51
|
+
}
|
|
52
|
+
return new Uint8Array(bytes.reverse());
|
|
53
|
+
}
|
|
54
54
|
//# sourceMappingURL=getNetworkByte.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function (base: string): Promise<string>;
|
|
1
|
+
export default function (base: string): Promise<string>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var getNetworkByte_1 = __importDefault(require("./getNetworkByte"));
|
|
7
|
-
function default_1(base) {
|
|
8
|
-
return getNetworkByte_1.default(base).then(function (byte) { return String.fromCharCode(byte); });
|
|
9
|
-
}
|
|
10
|
-
exports.default = default_1;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var getNetworkByte_1 = __importDefault(require("./getNetworkByte"));
|
|
7
|
+
function default_1(base) {
|
|
8
|
+
return getNetworkByte_1.default(base).then(function (byte) { return String.fromCharCode(byte); });
|
|
9
|
+
}
|
|
10
|
+
exports.default = default_1;
|
|
11
11
|
//# sourceMappingURL=getNetworkCode.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export default function (base: string, current?: number): Promise<{
|
|
2
|
-
height: number;
|
|
3
|
-
}>;
|
|
1
|
+
export default function (base: string, current?: number): Promise<{
|
|
2
|
+
height: number;
|
|
3
|
+
}>;
|
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
-
if (!m) return o;
|
|
5
|
-
var i = m.call(o), r, ar = [], e;
|
|
6
|
-
try {
|
|
7
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
-
}
|
|
9
|
-
catch (error) { e = { error: error }; }
|
|
10
|
-
finally {
|
|
11
|
-
try {
|
|
12
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
-
}
|
|
14
|
-
finally { if (e) throw e.error; }
|
|
15
|
-
}
|
|
16
|
-
return ar;
|
|
17
|
-
};
|
|
18
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
19
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
20
|
-
};
|
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
var blocks_1 = require("../../api-node/blocks");
|
|
23
|
-
var utils_1 = require("../utils");
|
|
24
|
-
var detectInterval_1 = __importDefault(require("./detectInterval"));
|
|
25
|
-
var storage = Object.create(null);
|
|
26
|
-
function default_1(base, current) {
|
|
27
|
-
return Promise.all([
|
|
28
|
-
getInterval(base),
|
|
29
|
-
current == undefined ? blocks_1.fetchHeight(base).then(function (_a) {
|
|
30
|
-
var height = _a.height;
|
|
31
|
-
return height + 1;
|
|
32
|
-
}) : current
|
|
33
|
-
]).then(function (_a) {
|
|
34
|
-
var _b = __read(_a, 2), interval = _b[0], current = _b[1];
|
|
35
|
-
return loop(interval, current);
|
|
36
|
-
});
|
|
37
|
-
function loop(interval, current) {
|
|
38
|
-
return blocks_1.fetchHeadersLast(base).then(function (_a) {
|
|
39
|
-
var height = _a.height, timestamp = _a.timestamp;
|
|
40
|
-
if (height >= current) {
|
|
41
|
-
return { height: height };
|
|
42
|
-
}
|
|
43
|
-
var blocksToWait = current - height;
|
|
44
|
-
var now = Date.now();
|
|
45
|
-
var timeout = (((blocksToWait - 1) * interval) + ((interval - Math.abs(now - timestamp)))) * 0.8;
|
|
46
|
-
return utils_1.wait(inRange(timeout, 200, (interval * blocksToWait) * 0.8)).then(function () { return loop(interval, current); });
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.default = default_1;
|
|
51
|
-
function inRange(current, min, max) {
|
|
52
|
-
return Math.round(Math.min(Math.max(current, min), max));
|
|
53
|
-
}
|
|
54
|
-
function getInterval(base) {
|
|
55
|
-
if (storage[base]) {
|
|
56
|
-
return Promise.resolve(storage[base]);
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
return detectInterval_1.default(base).then(function (interval) {
|
|
60
|
-
storage[base] = interval;
|
|
61
|
-
return interval;
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
+
if (!m) return o;
|
|
5
|
+
var i = m.call(o), r, ar = [], e;
|
|
6
|
+
try {
|
|
7
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
+
}
|
|
9
|
+
catch (error) { e = { error: error }; }
|
|
10
|
+
finally {
|
|
11
|
+
try {
|
|
12
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
+
}
|
|
14
|
+
finally { if (e) throw e.error; }
|
|
15
|
+
}
|
|
16
|
+
return ar;
|
|
17
|
+
};
|
|
18
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
19
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
var blocks_1 = require("../../api-node/blocks");
|
|
23
|
+
var utils_1 = require("../utils");
|
|
24
|
+
var detectInterval_1 = __importDefault(require("./detectInterval"));
|
|
25
|
+
var storage = Object.create(null);
|
|
26
|
+
function default_1(base, current) {
|
|
27
|
+
return Promise.all([
|
|
28
|
+
getInterval(base),
|
|
29
|
+
current == undefined ? blocks_1.fetchHeight(base).then(function (_a) {
|
|
30
|
+
var height = _a.height;
|
|
31
|
+
return height + 1;
|
|
32
|
+
}) : current
|
|
33
|
+
]).then(function (_a) {
|
|
34
|
+
var _b = __read(_a, 2), interval = _b[0], current = _b[1];
|
|
35
|
+
return loop(interval, current);
|
|
36
|
+
});
|
|
37
|
+
function loop(interval, current) {
|
|
38
|
+
return blocks_1.fetchHeadersLast(base).then(function (_a) {
|
|
39
|
+
var height = _a.height, timestamp = _a.timestamp;
|
|
40
|
+
if (height >= current) {
|
|
41
|
+
return { height: height };
|
|
42
|
+
}
|
|
43
|
+
var blocksToWait = current - height;
|
|
44
|
+
var now = Date.now();
|
|
45
|
+
var timeout = (((blocksToWait - 1) * interval) + ((interval - Math.abs(now - timestamp)))) * 0.8;
|
|
46
|
+
return utils_1.wait(inRange(timeout, 200, (interval * blocksToWait) * 0.8)).then(function () { return loop(interval, current); });
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.default = default_1;
|
|
51
|
+
function inRange(current, min, max) {
|
|
52
|
+
return Math.round(Math.min(Math.max(current, min), max));
|
|
53
|
+
}
|
|
54
|
+
function getInterval(base) {
|
|
55
|
+
if (storage[base]) {
|
|
56
|
+
return Promise.resolve(storage[base]);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
return detectInterval_1.default(base).then(function (interval) {
|
|
60
|
+
storage[base] = interval;
|
|
61
|
+
return interval;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
65
|
//# sourceMappingURL=waitHeight.js.map
|
package/cjs/tools/parse.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function (json: string): any;
|
|
1
|
+
export default function (json: string): any;
|
package/cjs/tools/parse.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var reg = new RegExp('((?!\\\\)"\\w+"):\\s*(-?[\\d|\\.]{14,})', 'g');
|
|
4
|
-
function default_1(json) {
|
|
5
|
-
return JSON.parse(json.replace(reg, "$1:\"$2\""));
|
|
6
|
-
}
|
|
7
|
-
exports.default = default_1;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var reg = new RegExp('((?!\\\\)"\\w+"):\\s*(-?[\\d|\\.]{14,})', 'g');
|
|
4
|
+
function default_1(json) {
|
|
5
|
+
return JSON.parse(json.replace(reg, "$1:\"$2\""));
|
|
6
|
+
}
|
|
7
|
+
exports.default = default_1;
|
|
8
8
|
//# sourceMappingURL=parse.js.map
|
package/cjs/tools/query.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export default function <T extends Record<string, any>>(params: T, evolver?: TEvolver<T>): string;
|
|
2
|
-
export declare type TEvolver<T extends Record<string, any>> = {
|
|
3
|
-
[Key in keyof T]?: (value: T[Key]) => string | undefined;
|
|
4
|
-
};
|
|
1
|
+
export default function <T extends Record<string, any>>(params: T, evolver?: TEvolver<T>): string;
|
|
2
|
+
export declare type TEvolver<T extends Record<string, any>> = {
|
|
3
|
+
[Key in keyof T]?: (value: T[Key]) => string | undefined;
|
|
4
|
+
};
|
package/cjs/tools/query.js
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
-
if (!m) return o;
|
|
5
|
-
var i = m.call(o), r, ar = [], e;
|
|
6
|
-
try {
|
|
7
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
-
}
|
|
9
|
-
catch (error) { e = { error: error }; }
|
|
10
|
-
finally {
|
|
11
|
-
try {
|
|
12
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
-
}
|
|
14
|
-
finally { if (e) throw e.error; }
|
|
15
|
-
}
|
|
16
|
-
return ar;
|
|
17
|
-
};
|
|
18
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
var utils_1 = require("./utils");
|
|
20
|
-
function default_1(params, evolver) {
|
|
21
|
-
if (evolver === void 0) { evolver = Object.create(null); }
|
|
22
|
-
var query = Object.keys(params)
|
|
23
|
-
.map(function (key) { return [key, params[key]]; })
|
|
24
|
-
.map(function (_a) {
|
|
25
|
-
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
26
|
-
return [key, Object.prototype.hasOwnProperty.call(evolver, key) ? evolver[key](value) : value];
|
|
27
|
-
})
|
|
28
|
-
.filter(function (_a) {
|
|
29
|
-
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
30
|
-
return value != null;
|
|
31
|
-
})
|
|
32
|
-
.map(function (_a) {
|
|
33
|
-
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
34
|
-
return utils_1.toArray(value).map(function (v) { return key + "=" + v; }).join('&');
|
|
35
|
-
})
|
|
36
|
-
.join('&');
|
|
37
|
-
return query.length ? "?" + query : '';
|
|
38
|
-
}
|
|
39
|
-
exports.default = default_1;
|
|
40
|
-
;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
+
if (!m) return o;
|
|
5
|
+
var i = m.call(o), r, ar = [], e;
|
|
6
|
+
try {
|
|
7
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
+
}
|
|
9
|
+
catch (error) { e = { error: error }; }
|
|
10
|
+
finally {
|
|
11
|
+
try {
|
|
12
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
+
}
|
|
14
|
+
finally { if (e) throw e.error; }
|
|
15
|
+
}
|
|
16
|
+
return ar;
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
var utils_1 = require("./utils");
|
|
20
|
+
function default_1(params, evolver) {
|
|
21
|
+
if (evolver === void 0) { evolver = Object.create(null); }
|
|
22
|
+
var query = Object.keys(params)
|
|
23
|
+
.map(function (key) { return [key, params[key]]; })
|
|
24
|
+
.map(function (_a) {
|
|
25
|
+
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
26
|
+
return [key, Object.prototype.hasOwnProperty.call(evolver, key) ? evolver[key](value) : value];
|
|
27
|
+
})
|
|
28
|
+
.filter(function (_a) {
|
|
29
|
+
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
30
|
+
return value != null;
|
|
31
|
+
})
|
|
32
|
+
.map(function (_a) {
|
|
33
|
+
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
34
|
+
return utils_1.toArray(value).map(function (v) { return key + "=" + v; }).join('&');
|
|
35
|
+
})
|
|
36
|
+
.join('&');
|
|
37
|
+
return query.length ? "?" + query : '';
|
|
38
|
+
}
|
|
39
|
+
exports.default = default_1;
|
|
40
|
+
;
|
|
41
41
|
//# sourceMappingURL=query.js.map
|
package/cjs/tools/request.d.ts
CHANGED
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
export default function <T>(params: IRequestParams<T>): Promise<T>;
|
|
2
|
-
export declare function parseResponse<T>(r: Response): Promise<T>;
|
|
3
|
-
export interface IRequestParams<T> {
|
|
4
|
-
url: string;
|
|
5
|
-
base: string;
|
|
6
|
-
options?: RequestInit | undefined;
|
|
7
|
-
}
|
|
8
|
-
export interface RequestInit {
|
|
9
|
-
/**
|
|
10
|
-
* A BodyInit object or null to set request's body.
|
|
11
|
-
*/
|
|
12
|
-
body?: BodyInit | null;
|
|
13
|
-
/**
|
|
14
|
-
* A string indicating how the request will interact with the browser's cache to set request's cache.
|
|
15
|
-
* Not supported in nodejs environment
|
|
16
|
-
*/
|
|
17
|
-
cache?: RequestCache;
|
|
18
|
-
/**
|
|
19
|
-
* A string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL. Sets request's credentials.
|
|
20
|
-
*/
|
|
21
|
-
credentials?: RequestCredentials;
|
|
22
|
-
/**
|
|
23
|
-
* A Headers object, an object literal, or an array of two-item arrays to set request's headers.
|
|
24
|
-
* Not supported in nodejs environment
|
|
25
|
-
*/
|
|
26
|
-
headers?: HeadersInit;
|
|
27
|
-
/**
|
|
28
|
-
* A cryptographic hash of the resource to be fetched by request. Sets request's integrity.
|
|
29
|
-
*/
|
|
30
|
-
integrity?: string;
|
|
31
|
-
/**
|
|
32
|
-
* A boolean to set request's keepalive.
|
|
33
|
-
*/
|
|
34
|
-
keepalive?: boolean;
|
|
35
|
-
/**
|
|
36
|
-
* A string to set request's method.
|
|
37
|
-
*/
|
|
38
|
-
method?: string;
|
|
39
|
-
/**
|
|
40
|
-
* A string to indicate whether the request will use CORS, or will be restricted to same-origin URLs. Sets request's mode.
|
|
41
|
-
* Not supported in nodejs environment
|
|
42
|
-
*/
|
|
43
|
-
mode?: RequestMode;
|
|
44
|
-
/**
|
|
45
|
-
* A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect.
|
|
46
|
-
*/
|
|
47
|
-
redirect?: RequestRedirect;
|
|
48
|
-
/**
|
|
49
|
-
* A string whose value is a same-origin URL, "about:client", or the empty string, to set request's referrer.
|
|
50
|
-
*/
|
|
51
|
-
referrer?: string;
|
|
52
|
-
/**
|
|
53
|
-
* A referrer policy to set request's referrerPolicy.
|
|
54
|
-
*/
|
|
55
|
-
referrerPolicy?: ReferrerPolicy;
|
|
56
|
-
/**
|
|
57
|
-
* An AbortSignal to set request's signal.
|
|
58
|
-
*/
|
|
59
|
-
signal?: AbortSignal | null;
|
|
60
|
-
/**
|
|
61
|
-
* Can only be null. Used to disassociate request from any Window.
|
|
62
|
-
*/
|
|
63
|
-
window?: any;
|
|
64
|
-
}
|
|
1
|
+
export default function <T>(params: IRequestParams<T>): Promise<T>;
|
|
2
|
+
export declare function parseResponse<T>(r: Response): Promise<T>;
|
|
3
|
+
export interface IRequestParams<T> {
|
|
4
|
+
url: string;
|
|
5
|
+
base: string;
|
|
6
|
+
options?: RequestInit | undefined;
|
|
7
|
+
}
|
|
8
|
+
export interface RequestInit {
|
|
9
|
+
/**
|
|
10
|
+
* A BodyInit object or null to set request's body.
|
|
11
|
+
*/
|
|
12
|
+
body?: BodyInit | null;
|
|
13
|
+
/**
|
|
14
|
+
* A string indicating how the request will interact with the browser's cache to set request's cache.
|
|
15
|
+
* Not supported in nodejs environment
|
|
16
|
+
*/
|
|
17
|
+
cache?: RequestCache;
|
|
18
|
+
/**
|
|
19
|
+
* A string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL. Sets request's credentials.
|
|
20
|
+
*/
|
|
21
|
+
credentials?: RequestCredentials;
|
|
22
|
+
/**
|
|
23
|
+
* A Headers object, an object literal, or an array of two-item arrays to set request's headers.
|
|
24
|
+
* Not supported in nodejs environment
|
|
25
|
+
*/
|
|
26
|
+
headers?: HeadersInit;
|
|
27
|
+
/**
|
|
28
|
+
* A cryptographic hash of the resource to be fetched by request. Sets request's integrity.
|
|
29
|
+
*/
|
|
30
|
+
integrity?: string;
|
|
31
|
+
/**
|
|
32
|
+
* A boolean to set request's keepalive.
|
|
33
|
+
*/
|
|
34
|
+
keepalive?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* A string to set request's method.
|
|
37
|
+
*/
|
|
38
|
+
method?: string;
|
|
39
|
+
/**
|
|
40
|
+
* A string to indicate whether the request will use CORS, or will be restricted to same-origin URLs. Sets request's mode.
|
|
41
|
+
* Not supported in nodejs environment
|
|
42
|
+
*/
|
|
43
|
+
mode?: RequestMode;
|
|
44
|
+
/**
|
|
45
|
+
* A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect.
|
|
46
|
+
*/
|
|
47
|
+
redirect?: RequestRedirect;
|
|
48
|
+
/**
|
|
49
|
+
* A string whose value is a same-origin URL, "about:client", or the empty string, to set request's referrer.
|
|
50
|
+
*/
|
|
51
|
+
referrer?: string;
|
|
52
|
+
/**
|
|
53
|
+
* A referrer policy to set request's referrerPolicy.
|
|
54
|
+
*/
|
|
55
|
+
referrerPolicy?: ReferrerPolicy;
|
|
56
|
+
/**
|
|
57
|
+
* An AbortSignal to set request's signal.
|
|
58
|
+
*/
|
|
59
|
+
signal?: AbortSignal | null;
|
|
60
|
+
/**
|
|
61
|
+
* Can only be null. Used to disassociate request from any Window.
|
|
62
|
+
*/
|
|
63
|
+
window?: any;
|
|
64
|
+
}
|
package/cjs/tools/request.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.parseResponse = void 0;
|
|
18
|
-
var resolve_1 = __importDefault(require("./resolve"));
|
|
19
|
-
var parse_1 = __importDefault(require("./parse"));
|
|
20
|
-
var request = typeof fetch === 'function' ? fetch : require('node-fetch');
|
|
21
|
-
function default_1(params) {
|
|
22
|
-
return request(resolve_1.default(params.url, params.base), updateHeaders(params.options))
|
|
23
|
-
.then(parseResponse);
|
|
24
|
-
}
|
|
25
|
-
exports.default = default_1;
|
|
26
|
-
function parseResponse(r) {
|
|
27
|
-
return r.text().then(function (message) { return r.ok ? parse_1.default(message) : Promise.reject(tryParse(message)); });
|
|
28
|
-
}
|
|
29
|
-
exports.parseResponse = parseResponse;
|
|
30
|
-
function tryParse(message) {
|
|
31
|
-
try {
|
|
32
|
-
return JSON.parse(message);
|
|
33
|
-
}
|
|
34
|
-
catch (e) {
|
|
35
|
-
return message;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function updateHeaders(options) {
|
|
39
|
-
if (options === void 0) { options = Object.create(null); }
|
|
40
|
-
return __assign({ credentials: 'include' }, options);
|
|
41
|
-
}
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.parseResponse = void 0;
|
|
18
|
+
var resolve_1 = __importDefault(require("./resolve"));
|
|
19
|
+
var parse_1 = __importDefault(require("./parse"));
|
|
20
|
+
var request = typeof fetch === 'function' ? fetch : require('node-fetch');
|
|
21
|
+
function default_1(params) {
|
|
22
|
+
return request(resolve_1.default(params.url, params.base), updateHeaders(params.options))
|
|
23
|
+
.then(parseResponse);
|
|
24
|
+
}
|
|
25
|
+
exports.default = default_1;
|
|
26
|
+
function parseResponse(r) {
|
|
27
|
+
return r.text().then(function (message) { return r.ok ? parse_1.default(message) : Promise.reject(tryParse(message)); });
|
|
28
|
+
}
|
|
29
|
+
exports.parseResponse = parseResponse;
|
|
30
|
+
function tryParse(message) {
|
|
31
|
+
try {
|
|
32
|
+
return JSON.parse(message);
|
|
33
|
+
}
|
|
34
|
+
catch (e) {
|
|
35
|
+
return message;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function updateHeaders(options) {
|
|
39
|
+
if (options === void 0) { options = Object.create(null); }
|
|
40
|
+
return __assign({ credentials: 'include' }, options);
|
|
41
|
+
}
|
|
42
42
|
//# sourceMappingURL=request.js.map
|
package/cjs/tools/resolve.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function (path: string, base: string): string;
|
|
1
|
+
export default function (path: string, base: string): string;
|
package/cjs/tools/resolve.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
function default_1(path, base) {
|
|
4
|
-
return new URL(path, base).toString();
|
|
5
|
-
}
|
|
6
|
-
exports.default = default_1;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
function default_1(path, base) {
|
|
4
|
+
return new URL(path, base).toString();
|
|
5
|
+
}
|
|
6
|
+
exports.default = default_1;
|
|
7
7
|
//# sourceMappingURL=resolve.js.map
|
package/cjs/tools/stringify.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function <T extends Record<string, any>>(data: T): string;
|
|
1
|
+
export default function <T extends Record<string, any>>(data: T): string;
|