@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.
Files changed (180) hide show
  1. package/README.md +2 -2
  2. package/cjs/api-node/activation/index.d.ts +21 -21
  3. package/cjs/api-node/activation/index.js +19 -19
  4. package/cjs/api-node/addresses/index.d.ts +81 -81
  5. package/cjs/api-node/addresses/index.js +173 -173
  6. package/cjs/api-node/addresses/index.js.map +1 -1
  7. package/cjs/api-node/alias/index.d.ts +6 -6
  8. package/cjs/api-node/alias/index.js +21 -21
  9. package/cjs/api-node/assets/index.d.ts +79 -79
  10. package/cjs/api-node/assets/index.js +171 -171
  11. package/cjs/api-node/blocks/index.d.ts +143 -131
  12. package/cjs/api-node/blocks/index.js +209 -209
  13. package/cjs/api-node/consensus/index.d.ts +39 -39
  14. package/cjs/api-node/consensus/index.js +36 -36
  15. package/cjs/api-node/debug/index.d.ts +189 -189
  16. package/cjs/api-node/debug/index.js +244 -244
  17. package/cjs/api-node/eth/index.d.ts +3 -3
  18. package/cjs/api-node/eth/index.js +14 -14
  19. package/cjs/api-node/leasing/index.d.ts +22 -22
  20. package/cjs/api-node/leasing/index.js +41 -41
  21. package/cjs/api-node/node/index.d.ts +11 -11
  22. package/cjs/api-node/node/index.js +19 -19
  23. package/cjs/api-node/peers/index.d.ts +46 -46
  24. package/cjs/api-node/peers/index.js +59 -59
  25. package/cjs/api-node/rewards/index.d.ts +21 -21
  26. package/cjs/api-node/rewards/index.js +20 -20
  27. package/cjs/api-node/transactions/index.d.ts +73 -73
  28. package/cjs/api-node/transactions/index.js +192 -192
  29. package/cjs/api-node/utils/index.d.ts +110 -99
  30. package/cjs/api-node/utils/index.js +210 -192
  31. package/cjs/api-node/utils/index.js.map +1 -1
  32. package/cjs/api-node/wallet/index.d.ts +5 -5
  33. package/cjs/api-node/wallet/index.js +6 -6
  34. package/cjs/constants.d.ts +40 -40
  35. package/cjs/constants.js +42 -42
  36. package/cjs/create.d.ts +1238 -1240
  37. package/cjs/create.js +115 -118
  38. package/cjs/create.js.map +1 -1
  39. package/cjs/index.d.ts +9 -9
  40. package/cjs/index.js +17 -17
  41. package/cjs/interface.d.ts +44 -44
  42. package/cjs/interface.js +9 -9
  43. package/cjs/tools/adresses/availableSponsoredBalances.d.ts +7 -7
  44. package/cjs/tools/adresses/availableSponsoredBalances.js +29 -29
  45. package/cjs/tools/adresses/ethAddress2waves.d.ts +1 -1
  46. package/cjs/tools/adresses/ethAddress2waves.js +46 -46
  47. package/cjs/tools/adresses/getAssetIdListByTx.d.ts +2 -2
  48. package/cjs/tools/adresses/getAssetIdListByTx.js +47 -47
  49. package/cjs/tools/adresses/getAssetsByTransaction.d.ts +3 -3
  50. package/cjs/tools/adresses/getAssetsByTransaction.js +13 -13
  51. package/cjs/tools/adresses/getTransactionsWithAssets.d.ts +6 -6
  52. package/cjs/tools/adresses/getTransactionsWithAssets.js +12 -12
  53. package/cjs/tools/adresses/watch.d.ts +24 -24
  54. package/cjs/tools/adresses/watch.js +167 -167
  55. package/cjs/tools/adresses/wavesAddress2eth.d.ts +1 -1
  56. package/cjs/tools/adresses/wavesAddress2eth.js +9 -9
  57. package/cjs/tools/assets/wavesAsset2eth.d.ts +1 -1
  58. package/cjs/tools/assets/wavesAsset2eth.js +9 -9
  59. package/cjs/tools/blocks/detectInterval.d.ts +1 -1
  60. package/cjs/tools/blocks/detectInterval.js +11 -11
  61. package/cjs/tools/blocks/getNetworkByte.d.ts +1 -1
  62. package/cjs/tools/blocks/getNetworkByte.js +53 -53
  63. package/cjs/tools/blocks/getNetworkCode.d.ts +1 -1
  64. package/cjs/tools/blocks/getNetworkCode.js +10 -10
  65. package/cjs/tools/blocks/waitHeight.d.ts +3 -3
  66. package/cjs/tools/blocks/waitHeight.js +64 -64
  67. package/cjs/tools/parse.d.ts +1 -1
  68. package/cjs/tools/parse.js +7 -7
  69. package/cjs/tools/query.d.ts +4 -4
  70. package/cjs/tools/query.js +40 -40
  71. package/cjs/tools/request.d.ts +64 -64
  72. package/cjs/tools/request.js +41 -41
  73. package/cjs/tools/resolve.d.ts +1 -1
  74. package/cjs/tools/resolve.js +6 -6
  75. package/cjs/tools/stringify.d.ts +1 -1
  76. package/cjs/tools/stringify.js +20 -20
  77. package/cjs/tools/transactions/broadcast.d.ts +14 -14
  78. package/cjs/tools/transactions/broadcast.js +59 -59
  79. package/cjs/tools/transactions/ethTxId2waves.d.ts +1 -1
  80. package/cjs/tools/transactions/ethTxId2waves.js +10 -10
  81. package/cjs/tools/transactions/wait.d.ts +10 -10
  82. package/cjs/tools/transactions/wait.js +41 -41
  83. package/cjs/tools/utils.d.ts +32 -32
  84. package/cjs/tools/utils.js +117 -117
  85. package/dist/node-api.js +2368 -2402
  86. package/dist/node-api.min.js +2 -2
  87. package/es/api-node/activation/index.d.ts +21 -21
  88. package/es/api-node/activation/index.js +12 -12
  89. package/es/api-node/addresses/index.d.ts +81 -81
  90. package/es/api-node/addresses/index.js +110 -110
  91. package/es/api-node/addresses/index.js.map +1 -1
  92. package/es/api-node/alias/index.d.ts +6 -6
  93. package/es/api-node/alias/index.js +13 -13
  94. package/es/api-node/assets/index.d.ts +79 -79
  95. package/es/api-node/assets/index.js +102 -102
  96. package/es/api-node/blocks/index.d.ts +143 -131
  97. package/es/api-node/blocks/index.js +178 -178
  98. package/es/api-node/consensus/index.d.ts +39 -39
  99. package/es/api-node/consensus/index.js +26 -26
  100. package/es/api-node/debug/index.d.ts +189 -189
  101. package/es/api-node/debug/index.js +200 -200
  102. package/es/api-node/eth/index.d.ts +3 -3
  103. package/es/api-node/eth/index.js +7 -7
  104. package/es/api-node/leasing/index.d.ts +22 -22
  105. package/es/api-node/leasing/index.js +21 -21
  106. package/es/api-node/node/index.d.ts +11 -11
  107. package/es/api-node/node/index.js +9 -9
  108. package/es/api-node/peers/index.d.ts +46 -46
  109. package/es/api-node/peers/index.js +45 -45
  110. package/es/api-node/rewards/index.d.ts +21 -21
  111. package/es/api-node/rewards/index.js +12 -12
  112. package/es/api-node/transactions/index.d.ts +73 -73
  113. package/es/api-node/transactions/index.js +136 -136
  114. package/es/api-node/utils/index.d.ts +110 -99
  115. package/es/api-node/utils/index.js +192 -175
  116. package/es/api-node/utils/index.js.map +1 -1
  117. package/es/api-node/wallet/index.d.ts +5 -5
  118. package/es/api-node/wallet/index.js +6 -6
  119. package/es/constants.d.ts +40 -40
  120. package/es/constants.js +39 -39
  121. package/es/create.d.ts +1238 -1240
  122. package/es/create.js +89 -92
  123. package/es/create.js.map +1 -1
  124. package/es/index.d.ts +9 -9
  125. package/es/index.js +8 -8
  126. package/es/interface.d.ts +44 -44
  127. package/es/interface.js +2 -2
  128. package/es/tools/adresses/availableSponsoredBalances.d.ts +7 -7
  129. package/es/tools/adresses/availableSponsoredBalances.js +26 -26
  130. package/es/tools/adresses/ethAddress2waves.d.ts +1 -1
  131. package/es/tools/adresses/ethAddress2waves.js +30 -30
  132. package/es/tools/adresses/getAssetIdListByTx.d.ts +2 -2
  133. package/es/tools/adresses/getAssetIdListByTx.js +23 -23
  134. package/es/tools/adresses/getAssetsByTransaction.d.ts +3 -3
  135. package/es/tools/adresses/getAssetsByTransaction.js +7 -7
  136. package/es/tools/adresses/getTransactionsWithAssets.d.ts +6 -6
  137. package/es/tools/adresses/getTransactionsWithAssets.js +6 -6
  138. package/es/tools/adresses/watch.d.ts +24 -24
  139. package/es/tools/adresses/watch.js +133 -133
  140. package/es/tools/adresses/wavesAddress2eth.d.ts +1 -1
  141. package/es/tools/adresses/wavesAddress2eth.js +6 -6
  142. package/es/tools/assets/wavesAsset2eth.d.ts +1 -1
  143. package/es/tools/assets/wavesAsset2eth.js +6 -6
  144. package/es/tools/blocks/detectInterval.d.ts +1 -1
  145. package/es/tools/blocks/detectInterval.js +8 -8
  146. package/es/tools/blocks/getNetworkByte.d.ts +1 -1
  147. package/es/tools/blocks/getNetworkByte.js +50 -50
  148. package/es/tools/blocks/getNetworkCode.d.ts +1 -1
  149. package/es/tools/blocks/getNetworkCode.js +4 -4
  150. package/es/tools/blocks/waitHeight.d.ts +3 -3
  151. package/es/tools/blocks/waitHeight.js +35 -35
  152. package/es/tools/parse.d.ts +1 -1
  153. package/es/tools/parse.js +4 -4
  154. package/es/tools/query.d.ts +4 -4
  155. package/es/tools/query.js +11 -11
  156. package/es/tools/request.d.ts +64 -64
  157. package/es/tools/request.js +21 -21
  158. package/es/tools/resolve.d.ts +1 -1
  159. package/es/tools/resolve.js +3 -3
  160. package/es/tools/stringify.d.ts +1 -1
  161. package/es/tools/stringify.js +17 -17
  162. package/es/tools/transactions/broadcast.d.ts +14 -14
  163. package/es/tools/transactions/broadcast.js +42 -42
  164. package/es/tools/transactions/ethTxId2waves.d.ts +1 -1
  165. package/es/tools/transactions/ethTxId2waves.js +7 -7
  166. package/es/tools/transactions/wait.d.ts +10 -10
  167. package/es/tools/transactions/wait.js +38 -38
  168. package/es/tools/utils.d.ts +32 -32
  169. package/es/tools/utils.js +72 -72
  170. package/package.json +66 -66
  171. package/cjs/tools/transactions/transactions.d.ts +0 -0
  172. package/cjs/tools/transactions/transactions.js +0 -2
  173. package/cjs/tools/transactions/transactions.js.map +0 -1
  174. package/dist/0.node-api.js +0 -467
  175. package/dist/node-api.min.js.LICENSE.txt +0 -17
  176. package/dist/node_fs-node_path.node-api.js +0 -23
  177. package/dist/vendors-node_modules_node-fetch_src_utils_multipart-parser_js.node-api.js +0 -599
  178. package/es/tools/transactions/transactions.d.ts +0 -0
  179. package/es/tools/transactions/transactions.js +0 -2
  180. package/es/tools/transactions/transactions.js.map +0 -1
@@ -1,48 +1,48 @@
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 __spread = (this && this.__spread) || function () {
19
- for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
20
- return ar;
21
- };
22
- var _a;
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- var utils_1 = require("../utils");
25
- var constants_1 = require("../../constants");
26
- var getAssetIdList = utils_1.switchTransactionByType((_a = {},
27
- _a[constants_1.NAME_MAP.transfer] = function (tx) { return [tx.assetId, tx.feeAssetId]; },
28
- _a[constants_1.NAME_MAP.burn] = function (tx) { return [tx.assetId]; },
29
- _a[constants_1.NAME_MAP.reissue] = function (tx) { return [tx.assetId]; },
30
- _a[constants_1.NAME_MAP.exchange] = function (tx) { return Array.from(new Set([
31
- tx.order1.assetPair.amountAsset,
32
- tx.order1.assetPair.priceAsset,
33
- tx.order1.version === 3 ? tx.order1.matcherFeeAssetId : null,
34
- tx.order2.version === 3 ? tx.order2.matcherFeeAssetId : null
35
- ])); },
36
- _a[constants_1.NAME_MAP.massTransfer] = function (tx) { return [tx.assetId]; },
37
- _a[constants_1.NAME_MAP.setAssetScript] = function (tx) { return [tx.assetId]; },
38
- _a[constants_1.NAME_MAP.sponsorship] = function (tx) { return [tx.assetId]; },
39
- _a[constants_1.NAME_MAP.invoke] = function (tx) { return __spread((tx.payment || []).map(utils_1.prop('assetId')), [tx.feeAssetId]); },
40
- _a[constants_1.NAME_MAP.updateAsset] = function (tx) { return [tx.assetId]; },
41
- _a));
42
- function default_1(tx) {
43
- // @ts-ignore
44
- var idList = utils_1.toArray(tx).reduce(function (acc, tx) { return acc.concat(getAssetIdList(tx) || []); }, []).filter(function (x) { return x != null; });
45
- return idList;
46
- }
47
- exports.default = default_1;
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 __spread = (this && this.__spread) || function () {
19
+ for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
20
+ return ar;
21
+ };
22
+ var _a;
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ var utils_1 = require("../utils");
25
+ var constants_1 = require("../../constants");
26
+ var getAssetIdList = utils_1.switchTransactionByType((_a = {},
27
+ _a[constants_1.NAME_MAP.transfer] = function (tx) { return [tx.assetId, tx.feeAssetId]; },
28
+ _a[constants_1.NAME_MAP.burn] = function (tx) { return [tx.assetId]; },
29
+ _a[constants_1.NAME_MAP.reissue] = function (tx) { return [tx.assetId]; },
30
+ _a[constants_1.NAME_MAP.exchange] = function (tx) { return Array.from(new Set([
31
+ tx.order1.assetPair.amountAsset,
32
+ tx.order1.assetPair.priceAsset,
33
+ tx.order1.version === 3 ? tx.order1.matcherFeeAssetId : null,
34
+ tx.order2.version === 3 ? tx.order2.matcherFeeAssetId : null
35
+ ])); },
36
+ _a[constants_1.NAME_MAP.massTransfer] = function (tx) { return [tx.assetId]; },
37
+ _a[constants_1.NAME_MAP.setAssetScript] = function (tx) { return [tx.assetId]; },
38
+ _a[constants_1.NAME_MAP.sponsorship] = function (tx) { return [tx.assetId]; },
39
+ _a[constants_1.NAME_MAP.invoke] = function (tx) { return __spread((tx.payment || []).map(utils_1.prop('assetId')), [tx.feeAssetId]); },
40
+ _a[constants_1.NAME_MAP.updateAsset] = function (tx) { return [tx.assetId]; },
41
+ _a));
42
+ function default_1(tx) {
43
+ // @ts-ignore
44
+ var idList = utils_1.toArray(tx).reduce(function (acc, tx) { return acc.concat(getAssetIdList(tx) || []); }, []).filter(function (x) { return x != null; });
45
+ return idList;
46
+ }
47
+ exports.default = default_1;
48
48
  //# sourceMappingURL=getAssetIdListByTx.js.map
@@ -1,3 +1,3 @@
1
- import { TAssetDetails } from '../../api-node/assets';
2
- import { Transaction, TransactionFromNode } from '@waves/ts-types';
3
- export default function (base: string, tx: Array<Transaction> | Transaction | TransactionFromNode | TransactionFromNode[]): Promise<Record<string, TAssetDetails>>;
1
+ import { TAssetDetails } from '../../api-node/assets';
2
+ import { Transaction, TransactionFromNode } from '@waves/ts-types';
3
+ export default function (base: string, tx: Array<Transaction> | Transaction | TransactionFromNode | TransactionFromNode[]): Promise<Record<string, TAssetDetails>>;
@@ -1,14 +1,14 @@
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 assets_1 = require("../../api-node/assets");
7
- var getAssetIdListByTx_1 = __importDefault(require("./getAssetIdListByTx"));
8
- var utils_1 = require("../utils");
9
- function default_1(base, tx) {
10
- return assets_1.fetchDetails(base, getAssetIdListByTx_1.default(tx))
11
- .then(function (list) { return utils_1.indexBy(utils_1.prop('assetId'), list); });
12
- }
13
- 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 assets_1 = require("../../api-node/assets");
7
+ var getAssetIdListByTx_1 = __importDefault(require("./getAssetIdListByTx"));
8
+ var utils_1 = require("../utils");
9
+ function default_1(base, tx) {
10
+ return assets_1.fetchDetails(base, getAssetIdListByTx_1.default(tx))
11
+ .then(function (list) { return utils_1.indexBy(utils_1.prop('assetId'), list); });
12
+ }
13
+ exports.default = default_1;
14
14
  //# sourceMappingURL=getAssetsByTransaction.js.map
@@ -1,6 +1,6 @@
1
- import { TAssetDetails } from '../../api-node/assets';
2
- import { TransactionFromNode } from '@waves/ts-types';
3
- export default function (base: string, address: string, limit: number, after?: string): Promise<{
4
- transactions: Array<TransactionFromNode>;
5
- assets: Record<string, TAssetDetails>;
6
- }>;
1
+ import { TAssetDetails } from '../../api-node/assets';
2
+ import { TransactionFromNode } from '@waves/ts-types';
3
+ export default function (base: string, address: string, limit: number, after?: string): Promise<{
4
+ transactions: Array<TransactionFromNode>;
5
+ assets: Record<string, TAssetDetails>;
6
+ }>;
@@ -1,13 +1,13 @@
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 transactions_1 = require("../../api-node/transactions");
7
- var getAssetsByTransaction_1 = __importDefault(require("./getAssetsByTransaction"));
8
- function default_1(base, address, limit, after) {
9
- return transactions_1.fetchTransactions(base, address, limit, after)
10
- .then(function (transactions) { return getAssetsByTransaction_1.default(base, transactions).then(function (assets) { return ({ transactions: transactions, assets: assets }); }); });
11
- }
12
- 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 transactions_1 = require("../../api-node/transactions");
7
+ var getAssetsByTransaction_1 = __importDefault(require("./getAssetsByTransaction"));
8
+ function default_1(base, address, limit, after) {
9
+ return transactions_1.fetchTransactions(base, address, limit, after)
10
+ .then(function (transactions) { return getAssetsByTransaction_1.default(base, transactions).then(function (assets) { return ({ transactions: transactions, assets: assets }); }); });
11
+ }
12
+ exports.default = default_1;
13
13
  //# sourceMappingURL=getTransactionsWithAssets.js.map
@@ -1,24 +1,24 @@
1
- import { Transaction, WithApiMixin } from '@waves/ts-types';
2
- import { TLong } from '../../interface';
3
- import { EventEmitter } from 'typed-ts-events';
4
- export declare class Watch {
5
- readonly address: string;
6
- private readonly _base;
7
- private readonly _interval;
8
- private readonly _emitter;
9
- private _lastBlock;
10
- private _timer;
11
- constructor(base: string, address: string, tx: (Transaction<TLong> & WithApiMixin) | null, interval?: number);
12
- on<K extends keyof IEvents>(event: K, handler: EventEmitter.IHandler<IEvents[K], any>): void;
13
- once<K extends keyof IEvents>(event: K, handler: EventEmitter.IHandler<IEvents[K], any>): void;
14
- off(event?: keyof IEvents, handler?: EventEmitter.IHandler<IEvents[keyof IEvents], any>): void;
15
- private _run;
16
- private getTransactionsInHeight;
17
- private _addTimeout;
18
- private static _groupByHeight;
19
- private static _getTransactionsToDispatch;
20
- }
21
- export interface IEvents {
22
- 'change-state': Array<Transaction<TLong> & WithApiMixin>;
23
- }
24
- export default function (base: string, address: string, interval?: number): Promise<Watch>;
1
+ import { Transaction, WithApiMixin } from '@waves/ts-types';
2
+ import { TLong } from '../../interface';
3
+ import { EventEmitter } from 'typed-ts-events';
4
+ export declare class Watch {
5
+ readonly address: string;
6
+ private readonly _base;
7
+ private readonly _interval;
8
+ private readonly _emitter;
9
+ private _lastBlock;
10
+ private _timer;
11
+ constructor(base: string, address: string, tx: (Transaction<TLong> & WithApiMixin) | null, interval?: number);
12
+ on<K extends keyof IEvents>(event: K, handler: EventEmitter.IHandler<IEvents[K], any>): void;
13
+ once<K extends keyof IEvents>(event: K, handler: EventEmitter.IHandler<IEvents[K], any>): void;
14
+ off(event?: keyof IEvents, handler?: EventEmitter.IHandler<IEvents[keyof IEvents], any>): void;
15
+ private _run;
16
+ private getTransactionsInHeight;
17
+ private _addTimeout;
18
+ private static _groupByHeight;
19
+ private static _getTransactionsToDispatch;
20
+ }
21
+ export interface IEvents {
22
+ 'change-state': Array<Transaction<TLong> & WithApiMixin>;
23
+ }
24
+ export default function (base: string, address: string, interval?: number): Promise<Watch>;
@@ -1,168 +1,168 @@
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 __spread = (this && this.__spread) || function () {
19
- for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
20
- return ar;
21
- };
22
- Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.Watch = void 0;
24
- var transactions_1 = require("../../api-node/transactions");
25
- var utils_1 = require("../utils");
26
- var typed_ts_events_1 = require("typed-ts-events");
27
- var Watch = /** @class */ (function () {
28
- function Watch(base, address, tx, interval) {
29
- this._emitter = new typed_ts_events_1.EventEmitter();
30
- this._timer = null;
31
- this.address = address;
32
- this._interval = interval || 1000;
33
- this._base = base;
34
- this._lastBlock = {
35
- lastId: (tx === null || tx === void 0 ? void 0 : tx.id) || '',
36
- height: (tx === null || tx === void 0 ? void 0 : tx.height) || 0,
37
- transactions: tx ? [tx] : []
38
- };
39
- this._addTimeout();
40
- }
41
- Watch.prototype.on = function (event, handler) {
42
- this._emitter.on(event, handler);
43
- };
44
- Watch.prototype.once = function (event, handler) {
45
- this._emitter.once(event, handler);
46
- };
47
- Watch.prototype.off = function (event, handler) {
48
- this._emitter.off(event, handler);
49
- };
50
- Watch.prototype._run = function () {
51
- var _this = this;
52
- if (this._timer) {
53
- clearTimeout(this._timer);
54
- }
55
- var onError = function () { return _this._addTimeout(); };
56
- transactions_1.fetchTransactions(this._base, this.address, 1)
57
- .then(function (_a) {
58
- var _b = __read(_a, 1), tx = _b[0];
59
- if (!tx) {
60
- _this._addTimeout();
61
- return null;
62
- }
63
- _this.getTransactionsInHeight(tx, 310)
64
- .then(function (list) {
65
- var _a;
66
- var hash = Watch._groupByHeight(list);
67
- var heightList = utils_1.keys(hash)
68
- .map(Number)
69
- .sort(function (a, b) { return b - a; });
70
- var _b = __read(heightList, 2), last = _b[0], prev = _b[1];
71
- if (!_this._lastBlock.height) {
72
- _this._lastBlock = {
73
- height: last,
74
- lastId: hash[prev] && hash[prev].length ? hash[prev][0].id : '',
75
- transactions: hash[last]
76
- };
77
- _this._emitter.trigger('change-state', list);
78
- }
79
- else {
80
- var wasDispatchHash = utils_1.indexBy(utils_1.prop('id'), _this._lastBlock.transactions);
81
- var toDispatch = Watch._getTransactionsToDispatch(__spread(hash[last], (hash[prev] || [])), wasDispatchHash, _this._lastBlock.lastId);
82
- if (_this._lastBlock.height !== last) {
83
- _this._lastBlock = {
84
- height: last,
85
- lastId: hash[prev] && hash[prev].length ? hash[prev][0].id : '',
86
- transactions: hash[last]
87
- };
88
- }
89
- else {
90
- (_a = _this._lastBlock.transactions).push.apply(_a, __spread(toDispatch));
91
- }
92
- if (toDispatch.length) {
93
- _this._emitter.trigger('change-state', toDispatch);
94
- }
95
- }
96
- _this._addTimeout();
97
- }, onError);
98
- })
99
- .catch(onError);
100
- };
101
- Watch.prototype.getTransactionsInHeight = function (from, limit) {
102
- var _this = this;
103
- var height = from.height;
104
- var loop = function (downloaded) {
105
- if (downloaded.length >= limit) {
106
- return Promise.resolve(downloaded);
107
- }
108
- return transactions_1.fetchTransactions(_this._base, _this.address, downloaded.length + 100).then(function (list) {
109
- if (downloaded.length === list.length) {
110
- return downloaded;
111
- }
112
- var hash = Watch._groupByHeight(list);
113
- var heightList = utils_1.keys(hash)
114
- .map(Number)
115
- .sort(function (a, b) { return b - a; });
116
- var _a = __read(heightList, 2), last = _a[0], prev = _a[1];
117
- if (last === height) {
118
- return prev ? __spread(hash[last], [hash[prev][0]]) : loop(list);
119
- }
120
- else {
121
- return loop(list);
122
- }
123
- });
124
- };
125
- return loop([from]);
126
- };
127
- Watch.prototype._addTimeout = function () {
128
- var _this = this;
129
- this._timer = setTimeout(function () {
130
- _this._run();
131
- }, this._interval);
132
- };
133
- Watch._groupByHeight = function (list) {
134
- return list.reduce(function (hash, tx) {
135
- if (!hash[tx.height]) {
136
- hash[tx.height] = [tx];
137
- }
138
- else {
139
- hash[tx.height].push(tx);
140
- }
141
- return hash;
142
- }, Object.create(null));
143
- };
144
- Watch._getTransactionsToDispatch = function (list, dispatched, lastId) {
145
- var result = [];
146
- for (var i = 0; i < list.length; i++) {
147
- var tx = list[i];
148
- if (tx.id === lastId) {
149
- break;
150
- }
151
- if (!dispatched[tx.id]) {
152
- result.push(tx);
153
- }
154
- }
155
- return result;
156
- };
157
- return Watch;
158
- }());
159
- exports.Watch = Watch;
160
- function default_1(base, address, interval) {
161
- return transactions_1.fetchTransactions(base, address, 1)
162
- .then(function (_a) {
163
- var _b = __read(_a, 1), tx = _b[0];
164
- return new Watch(base, address, tx, interval);
165
- });
166
- }
167
- exports.default = default_1;
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 __spread = (this && this.__spread) || function () {
19
+ for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
20
+ return ar;
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.Watch = void 0;
24
+ var transactions_1 = require("../../api-node/transactions");
25
+ var utils_1 = require("../utils");
26
+ var typed_ts_events_1 = require("typed-ts-events");
27
+ var Watch = /** @class */ (function () {
28
+ function Watch(base, address, tx, interval) {
29
+ this._emitter = new typed_ts_events_1.EventEmitter();
30
+ this._timer = null;
31
+ this.address = address;
32
+ this._interval = interval || 1000;
33
+ this._base = base;
34
+ this._lastBlock = {
35
+ lastId: (tx === null || tx === void 0 ? void 0 : tx.id) || '',
36
+ height: (tx === null || tx === void 0 ? void 0 : tx.height) || 0,
37
+ transactions: tx ? [tx] : []
38
+ };
39
+ this._addTimeout();
40
+ }
41
+ Watch.prototype.on = function (event, handler) {
42
+ this._emitter.on(event, handler);
43
+ };
44
+ Watch.prototype.once = function (event, handler) {
45
+ this._emitter.once(event, handler);
46
+ };
47
+ Watch.prototype.off = function (event, handler) {
48
+ this._emitter.off(event, handler);
49
+ };
50
+ Watch.prototype._run = function () {
51
+ var _this = this;
52
+ if (this._timer) {
53
+ clearTimeout(this._timer);
54
+ }
55
+ var onError = function () { return _this._addTimeout(); };
56
+ transactions_1.fetchTransactions(this._base, this.address, 1)
57
+ .then(function (_a) {
58
+ var _b = __read(_a, 1), tx = _b[0];
59
+ if (!tx) {
60
+ _this._addTimeout();
61
+ return null;
62
+ }
63
+ _this.getTransactionsInHeight(tx, 310)
64
+ .then(function (list) {
65
+ var _a;
66
+ var hash = Watch._groupByHeight(list);
67
+ var heightList = utils_1.keys(hash)
68
+ .map(Number)
69
+ .sort(function (a, b) { return b - a; });
70
+ var _b = __read(heightList, 2), last = _b[0], prev = _b[1];
71
+ if (!_this._lastBlock.height) {
72
+ _this._lastBlock = {
73
+ height: last,
74
+ lastId: hash[prev] && hash[prev].length ? hash[prev][0].id : '',
75
+ transactions: hash[last]
76
+ };
77
+ _this._emitter.trigger('change-state', list);
78
+ }
79
+ else {
80
+ var wasDispatchHash = utils_1.indexBy(utils_1.prop('id'), _this._lastBlock.transactions);
81
+ var toDispatch = Watch._getTransactionsToDispatch(__spread(hash[last], (hash[prev] || [])), wasDispatchHash, _this._lastBlock.lastId);
82
+ if (_this._lastBlock.height !== last) {
83
+ _this._lastBlock = {
84
+ height: last,
85
+ lastId: hash[prev] && hash[prev].length ? hash[prev][0].id : '',
86
+ transactions: hash[last]
87
+ };
88
+ }
89
+ else {
90
+ (_a = _this._lastBlock.transactions).push.apply(_a, __spread(toDispatch));
91
+ }
92
+ if (toDispatch.length) {
93
+ _this._emitter.trigger('change-state', toDispatch);
94
+ }
95
+ }
96
+ _this._addTimeout();
97
+ }, onError);
98
+ })
99
+ .catch(onError);
100
+ };
101
+ Watch.prototype.getTransactionsInHeight = function (from, limit) {
102
+ var _this = this;
103
+ var height = from.height;
104
+ var loop = function (downloaded) {
105
+ if (downloaded.length >= limit) {
106
+ return Promise.resolve(downloaded);
107
+ }
108
+ return transactions_1.fetchTransactions(_this._base, _this.address, downloaded.length + 100).then(function (list) {
109
+ if (downloaded.length === list.length) {
110
+ return downloaded;
111
+ }
112
+ var hash = Watch._groupByHeight(list);
113
+ var heightList = utils_1.keys(hash)
114
+ .map(Number)
115
+ .sort(function (a, b) { return b - a; });
116
+ var _a = __read(heightList, 2), last = _a[0], prev = _a[1];
117
+ if (last === height) {
118
+ return prev ? __spread(hash[last], [hash[prev][0]]) : loop(list);
119
+ }
120
+ else {
121
+ return loop(list);
122
+ }
123
+ });
124
+ };
125
+ return loop([from]);
126
+ };
127
+ Watch.prototype._addTimeout = function () {
128
+ var _this = this;
129
+ this._timer = setTimeout(function () {
130
+ _this._run();
131
+ }, this._interval);
132
+ };
133
+ Watch._groupByHeight = function (list) {
134
+ return list.reduce(function (hash, tx) {
135
+ if (!hash[tx.height]) {
136
+ hash[tx.height] = [tx];
137
+ }
138
+ else {
139
+ hash[tx.height].push(tx);
140
+ }
141
+ return hash;
142
+ }, Object.create(null));
143
+ };
144
+ Watch._getTransactionsToDispatch = function (list, dispatched, lastId) {
145
+ var result = [];
146
+ for (var i = 0; i < list.length; i++) {
147
+ var tx = list[i];
148
+ if (tx.id === lastId) {
149
+ break;
150
+ }
151
+ if (!dispatched[tx.id]) {
152
+ result.push(tx);
153
+ }
154
+ }
155
+ return result;
156
+ };
157
+ return Watch;
158
+ }());
159
+ exports.Watch = Watch;
160
+ function default_1(base, address, interval) {
161
+ return transactions_1.fetchTransactions(base, address, 1)
162
+ .then(function (_a) {
163
+ var _b = __read(_a, 1), tx = _b[0];
164
+ return new Watch(base, address, tx, interval);
165
+ });
166
+ }
167
+ exports.default = default_1;
168
168
  //# sourceMappingURL=watch.js.map
@@ -1 +1 @@
1
- export default function wavesAddress2eth(wavesAddress: string): string;
1
+ export default function wavesAddress2eth(wavesAddress: string): string;
@@ -1,10 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var ts_lib_crypto_1 = require("@waves/ts-lib-crypto");
4
- function wavesAddress2eth(wavesAddress) {
5
- var rawBytes = ts_lib_crypto_1.base58Decode(wavesAddress);
6
- var bytes = rawBytes.slice(2, rawBytes.byteLength - 4);
7
- return "0x" + ts_lib_crypto_1.base16Encode(bytes);
8
- }
9
- exports.default = wavesAddress2eth;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var ts_lib_crypto_1 = require("@waves/ts-lib-crypto");
4
+ function wavesAddress2eth(wavesAddress) {
5
+ var rawBytes = ts_lib_crypto_1.base58Decode(wavesAddress);
6
+ var bytes = rawBytes.slice(2, rawBytes.byteLength - 4);
7
+ return "0x" + ts_lib_crypto_1.base16Encode(bytes);
8
+ }
9
+ exports.default = wavesAddress2eth;
10
10
  //# sourceMappingURL=wavesAddress2eth.js.map
@@ -1 +1 @@
1
- export default function wavesAsset2Eth(wavesAsset: string): string;
1
+ export default function wavesAsset2Eth(wavesAsset: string): string;
@@ -1,10 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var ts_lib_crypto_1 = require("@waves/ts-lib-crypto");
4
- function wavesAsset2Eth(wavesAsset) {
5
- var rawBytes = ts_lib_crypto_1.base58Decode(wavesAsset);
6
- var bytes = rawBytes.slice(0, 20);
7
- return "0x" + ts_lib_crypto_1.base16Encode(bytes);
8
- }
9
- exports.default = wavesAsset2Eth;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var ts_lib_crypto_1 = require("@waves/ts-lib-crypto");
4
+ function wavesAsset2Eth(wavesAsset) {
5
+ var rawBytes = ts_lib_crypto_1.base58Decode(wavesAsset);
6
+ var bytes = rawBytes.slice(0, 20);
7
+ return "0x" + ts_lib_crypto_1.base16Encode(bytes);
8
+ }
9
+ exports.default = wavesAsset2Eth;
10
10
  //# sourceMappingURL=wavesAsset2eth.js.map
@@ -1 +1 @@
1
- export default function (base: string): Promise<number>;
1
+ export default function (base: string): Promise<number>;
@@ -1,12 +1,12 @@
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) {
6
- var firstHeight = Math.max(2, header.height - 1000);
7
- return blocks_1.fetchHeadersAt(base, firstHeight)
8
- .then(function (oldHeader) { return Math.floor((header.timestamp - oldHeader.timestamp) / (header.height - firstHeight)); });
9
- });
10
- }
11
- exports.default = default_1;
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) {
6
+ var firstHeight = Math.max(2, header.height - 1000);
7
+ return blocks_1.fetchHeadersAt(base, firstHeight)
8
+ .then(function (oldHeader) { return Math.floor((header.timestamp - oldHeader.timestamp) / (header.height - firstHeight)); });
9
+ });
10
+ }
11
+ exports.default = default_1;
12
12
  //# sourceMappingURL=detectInterval.js.map
@@ -1 +1 @@
1
- export default function (base: string): Promise<number>;
1
+ export default function (base: string): Promise<number>;