@aeternity/aepp-sdk 8.2.1 → 10.0.0

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 (159) hide show
  1. package/CHANGELOG.md +216 -337
  2. package/README.md +16 -9
  3. package/dist/aepp-sdk.browser-script.js +1 -1
  4. package/dist/aepp-sdk.browser-script.js.LICENSE.txt +0 -9
  5. package/dist/aepp-sdk.browser-script.js.map +1 -1
  6. package/dist/aepp-sdk.browser.js +1 -1
  7. package/dist/aepp-sdk.browser.js.map +1 -1
  8. package/dist/aepp-sdk.js +1 -1
  9. package/dist/aepp-sdk.js.map +1 -1
  10. package/es/account/base.js +36 -120
  11. package/es/account/base.js.map +1 -1
  12. package/es/account/memory.js +17 -19
  13. package/es/account/memory.js.map +1 -1
  14. package/es/account/multiple.js +79 -156
  15. package/es/account/multiple.js.map +1 -1
  16. package/es/ae/aens.js +205 -626
  17. package/es/ae/aens.js.map +1 -1
  18. package/es/ae/contract.js +114 -918
  19. package/es/ae/contract.js.map +1 -1
  20. package/es/ae/index.js +90 -250
  21. package/es/ae/index.js.map +1 -1
  22. package/es/ae/oracle.js +136 -504
  23. package/es/ae/oracle.js.map +1 -1
  24. package/es/ae/universal.js.map +1 -1
  25. package/es/chain/index.js +12 -27
  26. package/es/chain/index.js.map +1 -1
  27. package/es/chain/node.js +289 -1020
  28. package/es/chain/node.js.map +1 -1
  29. package/es/channel/handlers.js +597 -1086
  30. package/es/channel/handlers.js.map +1 -1
  31. package/es/channel/index.js +238 -465
  32. package/es/channel/index.js.map +1 -1
  33. package/es/channel/internal.js +129 -301
  34. package/es/channel/internal.js.map +1 -1
  35. package/es/contract/aci/index.js +328 -495
  36. package/es/contract/aci/index.js.map +1 -1
  37. package/es/contract/aci/transformation.js +35 -711
  38. package/es/contract/aci/transformation.js.map +1 -1
  39. package/es/contract/compiler.js +131 -203
  40. package/es/contract/compiler.js.map +1 -1
  41. package/es/contract/ga/helpers.js +17 -122
  42. package/es/contract/ga/helpers.js.map +1 -1
  43. package/es/contract/ga/index.js +108 -249
  44. package/es/contract/ga/index.js.map +1 -1
  45. package/es/contract/index.js +7 -3
  46. package/es/contract/index.js.map +1 -1
  47. package/es/index.js +3 -3
  48. package/es/index.js.map +1 -1
  49. package/es/node-pool/index.js +57 -74
  50. package/es/node-pool/index.js.map +1 -1
  51. package/es/node.js +65 -161
  52. package/es/node.js.map +1 -1
  53. package/es/other.d.ts +1 -1
  54. package/es/tx/builder/helpers.js +62 -115
  55. package/es/tx/builder/helpers.js.map +1 -1
  56. package/es/tx/builder/index.js +218 -309
  57. package/es/tx/builder/index.js.map +1 -1
  58. package/es/tx/builder/schema.js +586 -573
  59. package/es/tx/builder/schema.js.map +1 -1
  60. package/es/tx/index.js +102 -13
  61. package/es/tx/index.js.map +1 -1
  62. package/es/tx/tx-object.js +114 -138
  63. package/es/tx/tx-object.js.map +1 -1
  64. package/es/tx/tx.js +810 -1586
  65. package/es/tx/tx.js.map +1 -1
  66. package/es/tx/validator.js +191 -426
  67. package/es/tx/validator.js.map +1 -1
  68. package/es/utils/aepp-wallet-communication/connection/browser-runtime.js +20 -23
  69. package/es/utils/aepp-wallet-communication/connection/browser-runtime.js.map +1 -1
  70. package/es/utils/aepp-wallet-communication/connection/browser-window-message.js +53 -80
  71. package/es/utils/aepp-wallet-communication/connection/browser-window-message.js.map +1 -1
  72. package/es/utils/aepp-wallet-communication/connection/index.js +2 -1
  73. package/es/utils/aepp-wallet-communication/connection/index.js.map +1 -1
  74. package/es/utils/aepp-wallet-communication/content-script-bridge.js +24 -19
  75. package/es/utils/aepp-wallet-communication/content-script-bridge.js.map +1 -1
  76. package/es/utils/aepp-wallet-communication/helpers.js +60 -105
  77. package/es/utils/aepp-wallet-communication/helpers.js.map +1 -1
  78. package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.js +191 -514
  79. package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.js.map +1 -1
  80. package/es/utils/aepp-wallet-communication/rpc/rpc-client.js +78 -93
  81. package/es/utils/aepp-wallet-communication/rpc/rpc-client.js.map +1 -1
  82. package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.js +381 -613
  83. package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.js.map +1 -1
  84. package/es/utils/aepp-wallet-communication/schema.js +43 -39
  85. package/es/utils/aepp-wallet-communication/schema.js.map +1 -1
  86. package/es/utils/aepp-wallet-communication/wallet-detector.js +32 -58
  87. package/es/utils/aepp-wallet-communication/wallet-detector.js.map +1 -1
  88. package/es/utils/amount-formatter.js +41 -61
  89. package/es/utils/amount-formatter.js.map +1 -1
  90. package/es/utils/async-init.js +28 -64
  91. package/es/utils/async-init.js.map +1 -1
  92. package/es/utils/bignumber.js +3 -11
  93. package/es/utils/bignumber.js.map +1 -1
  94. package/es/utils/bytes.js +5 -9
  95. package/es/utils/bytes.js.map +1 -1
  96. package/es/utils/crypto.js +41 -106
  97. package/es/utils/crypto.js.map +1 -1
  98. package/es/utils/hd-wallet.js +45 -81
  99. package/es/utils/hd-wallet.js.map +1 -1
  100. package/es/utils/json-big.js +16 -49
  101. package/es/utils/json-big.js.map +1 -1
  102. package/es/utils/keystore.js +81 -246
  103. package/es/utils/keystore.js.map +1 -1
  104. package/es/utils/mptree.js +88 -134
  105. package/es/utils/mptree.js.map +1 -1
  106. package/es/utils/other.js +10 -60
  107. package/es/utils/other.js.map +1 -1
  108. package/es/utils/semver-satisfies.js +9 -28
  109. package/es/utils/semver-satisfies.js.map +1 -1
  110. package/es/utils/string.js +4 -13
  111. package/es/utils/string.js.map +1 -1
  112. package/es/utils/swagger.js +87 -224
  113. package/es/utils/swagger.js.map +1 -1
  114. package/package.json +51 -44
  115. package/src/account/base.js +11 -10
  116. package/src/account/multiple.js +24 -18
  117. package/src/ae/aens.js +64 -61
  118. package/src/ae/contract.js +71 -248
  119. package/src/ae/index.js +34 -9
  120. package/src/ae/oracle.js +30 -22
  121. package/src/ae/universal.js +3 -1
  122. package/src/chain/index.js +10 -16
  123. package/src/chain/node.js +38 -38
  124. package/src/channel/handlers.js +10 -4
  125. package/src/channel/index.js +44 -20
  126. package/src/contract/aci/index.js +234 -112
  127. package/src/contract/aci/transformation.js +30 -422
  128. package/src/contract/compiler.js +50 -5
  129. package/src/contract/ga/helpers.js +6 -14
  130. package/src/contract/ga/index.js +28 -28
  131. package/src/contract/index.js +6 -2
  132. package/src/index.js +4 -4
  133. package/src/node-pool/index.js +24 -13
  134. package/src/node.js +29 -30
  135. package/src/tx/builder/helpers.js +31 -56
  136. package/src/tx/builder/index.js +67 -28
  137. package/src/tx/builder/schema.js +79 -121
  138. package/src/tx/index.js +101 -12
  139. package/src/tx/tx-object.js +25 -8
  140. package/src/tx/tx.js +229 -150
  141. package/src/tx/validator.js +134 -202
  142. package/src/utils/aepp-wallet-communication/connection/browser-runtime.js +3 -2
  143. package/src/utils/aepp-wallet-communication/connection/browser-window-message.js +25 -7
  144. package/src/utils/aepp-wallet-communication/connection/index.js +2 -1
  145. package/src/utils/aepp-wallet-communication/content-script-bridge.js +10 -4
  146. package/src/utils/aepp-wallet-communication/helpers.js +4 -2
  147. package/src/utils/aepp-wallet-communication/rpc/aepp-rpc.js +33 -12
  148. package/src/utils/aepp-wallet-communication/rpc/rpc-client.js +9 -5
  149. package/src/utils/aepp-wallet-communication/rpc/wallet-rpc.js +59 -29
  150. package/src/utils/aepp-wallet-communication/schema.js +1 -3
  151. package/src/utils/aepp-wallet-communication/wallet-detector.js +4 -1
  152. package/src/utils/amount-formatter.ts +1 -1
  153. package/src/utils/bignumber.ts +2 -1
  154. package/src/utils/crypto.js +4 -68
  155. package/src/utils/keystore.js +10 -2
  156. package/src/utils/other.ts +1 -1
  157. package/src/utils/semver-satisfies.ts +1 -1
  158. package/src/utils/swagger.js +22 -10
  159. package/src/contract/aci/helpers.js +0 -140
@@ -1,29 +1,3 @@
1
- import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
2
- import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
3
- import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
4
- import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
5
- import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
6
- import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
7
- import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
8
- import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
9
- import _reduce from "ramda/src/reduce";
10
- import _typeof from "@babel/runtime-corejs3/helpers/typeof";
11
- import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
12
- import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
13
- import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
14
- import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
15
-
16
- function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); if (enumerableOnly) { symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
17
-
18
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context10; _forEachInstanceProperty(_context10 = ownKeys(Object(source), true)).call(_context10, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context11; _forEachInstanceProperty(_context11 = ownKeys(Object(source))).call(_context11, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
19
-
20
- import _reduceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reduce";
21
- import _Object$entries from "@babel/runtime-corejs3/core-js-stable/object/entries";
22
- import _parseInt from "@babel/runtime-corejs3/core-js-stable/parse-int";
23
- import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
24
- import _JSON$stringify from "@babel/runtime-corejs3/core-js-stable/json/stringify";
25
- import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
26
-
27
1
  /*
28
2
  * ISC License (ISC)
29
3
  * Copyright (c) 2018 aeternity developers
@@ -55,14 +29,11 @@ import * as handlers from './handlers';
55
29
  import { eventEmitters, status as channelStatus, state as channelState, initialize, enqueueAction, send, channelId, call, disconnect as channelDisconnect, fsmId as channelFsmId } from './internal';
56
30
 
57
31
  function snakeToPascalObjKeys(obj) {
58
- var _context;
59
-
60
- return _reduceInstanceProperty(_context = _Object$entries(obj)).call(_context, function (result, _ref) {
61
- var _ref2 = _slicedToArray(_ref, 2),
62
- key = _ref2[0],
63
- val = _ref2[1];
64
-
65
- return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, snakeToPascal(key), val));
32
+ return Object.entries(obj).reduce((result, _ref) => {
33
+ let [key, val] = _ref;
34
+ return { ...result,
35
+ [snakeToPascal(key)]: val
36
+ };
66
37
  }, {});
67
38
  }
68
39
  /**
@@ -121,8 +92,8 @@ function status() {
121
92
  */
122
93
 
123
94
 
124
- function state() {
125
- return _state.apply(this, arguments);
95
+ async function state() {
96
+ return snakeToPascalObjKeys(await call(this, 'channels.get.offchain_state', {}));
126
97
  }
127
98
  /**
128
99
  * Get current round
@@ -134,40 +105,17 @@ function state() {
134
105
  */
135
106
 
136
107
 
137
- function _state() {
138
- _state = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
139
- return _regeneratorRuntime.wrap(function _callee2$(_context3) {
140
- while (1) {
141
- switch (_context3.prev = _context3.next) {
142
- case 0:
143
- _context3.t0 = snakeToPascalObjKeys;
144
- _context3.next = 3;
145
- return call(this, 'channels.get.offchain_state', {});
146
-
147
- case 3:
148
- _context3.t1 = _context3.sent;
149
- return _context3.abrupt("return", (0, _context3.t0)(_context3.t1));
150
-
151
- case 5:
152
- case "end":
153
- return _context3.stop();
154
- }
155
- }
156
- }, _callee2, this);
157
- }));
158
- return _state.apply(this, arguments);
159
- }
160
-
161
108
  function round() {
162
- var state = channelState.get(this);
109
+ const state = channelState.get(this);
163
110
 
164
111
  if (!state) {
165
112
  return null;
166
113
  }
167
114
 
168
- var _unpackTx$tx$encodedT = unpackTx(channelState.get(this)).tx.encodedTx,
169
- txType = _unpackTx$tx$encodedT.txType,
170
- tx = _unpackTx$tx$encodedT.tx;
115
+ const {
116
+ txType,
117
+ tx
118
+ } = unpackTx(channelState.get(this)).tx.encodedTx;
171
119
 
172
120
  switch (txType) {
173
121
  case TX_TYPE.channelCreate:
@@ -176,7 +124,7 @@ function round() {
176
124
  case TX_TYPE.channelOffChain:
177
125
  case TX_TYPE.channelWithdraw:
178
126
  case TX_TYPE.channelDeposit:
179
- return _parseInt(tx.round, 10);
127
+ return parseInt(tx.round, 10);
180
128
 
181
129
  default:
182
130
  return null;
@@ -231,28 +179,24 @@ function fsmId() {
231
179
 
232
180
 
233
181
  function update(from, to, amount, sign, metadata) {
234
- var _this = this;
235
-
236
- return new _Promise(function (resolve, reject) {
237
- enqueueAction(_this, function (channel, state) {
238
- return state.handler === handlers.channelOpen;
239
- }, function (channel, state) {
182
+ return new Promise((resolve, reject) => {
183
+ enqueueAction(this, (channel, state) => state.handler === handlers.channelOpen, (channel, state) => {
240
184
  send(channel, {
241
185
  jsonrpc: '2.0',
242
186
  method: 'channels.update.new',
243
187
  params: {
244
- from: from,
245
- to: to,
246
- amount: amount,
188
+ from,
189
+ to,
190
+ amount,
247
191
  meta: metadata
248
192
  }
249
193
  });
250
194
  return {
251
195
  handler: handlers.awaitingOffChainTx,
252
196
  state: {
253
- resolve: resolve,
254
- reject: reject,
255
- sign: sign
197
+ resolve,
198
+ reject,
199
+ sign
256
200
  }
257
201
  };
258
202
  });
@@ -278,8 +222,15 @@ function update(from, to, amount, sign, metadata) {
278
222
  */
279
223
 
280
224
 
281
- function poi(_x) {
282
- return _poi.apply(this, arguments);
225
+ async function poi(_ref2) {
226
+ let {
227
+ accounts,
228
+ contracts
229
+ } = _ref2;
230
+ return (await call(this, 'channels.get.poi', {
231
+ accounts,
232
+ contracts
233
+ })).poi;
283
234
  }
284
235
  /**
285
236
  * Get balances
@@ -302,35 +253,10 @@ function poi(_x) {
302
253
  */
303
254
 
304
255
 
305
- function _poi() {
306
- _poi = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref3) {
307
- var accounts, contracts;
308
- return _regeneratorRuntime.wrap(function _callee3$(_context4) {
309
- while (1) {
310
- switch (_context4.prev = _context4.next) {
311
- case 0:
312
- accounts = _ref3.accounts, contracts = _ref3.contracts;
313
- _context4.next = 3;
314
- return call(this, 'channels.get.poi', {
315
- accounts: accounts,
316
- contracts: contracts
317
- });
318
-
319
- case 3:
320
- return _context4.abrupt("return", _context4.sent.poi);
321
-
322
- case 4:
323
- case "end":
324
- return _context4.stop();
325
- }
326
- }
327
- }, _callee3, this);
328
- }));
329
- return _poi.apply(this, arguments);
330
- }
331
-
332
- function balances(_x2) {
333
- return _balances.apply(this, arguments);
256
+ async function balances(accounts) {
257
+ return Object.fromEntries((await call(this, 'channels.get.balances', {
258
+ accounts
259
+ })).map(item => [item.account, item.balance]));
334
260
  }
335
261
  /**
336
262
  * Leave channel
@@ -352,45 +278,9 @@ function balances(_x2) {
352
278
  */
353
279
 
354
280
 
355
- function _balances() {
356
- _balances = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(accounts) {
357
- return _regeneratorRuntime.wrap(function _callee4$(_context5) {
358
- while (1) {
359
- switch (_context5.prev = _context5.next) {
360
- case 0:
361
- _context5.t0 = _reduce;
362
-
363
- _context5.t1 = function (acc, item) {
364
- return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, item.account, item.balance));
365
- };
366
-
367
- _context5.t2 = {};
368
- _context5.next = 5;
369
- return call(this, 'channels.get.balances', {
370
- accounts: accounts
371
- });
372
-
373
- case 5:
374
- _context5.t3 = _context5.sent;
375
- return _context5.abrupt("return", (0, _context5.t0)(_context5.t1, _context5.t2, _context5.t3));
376
-
377
- case 7:
378
- case "end":
379
- return _context5.stop();
380
- }
381
- }
382
- }, _callee4, this);
383
- }));
384
- return _balances.apply(this, arguments);
385
- }
386
-
387
281
  function leave() {
388
- var _this2 = this;
389
-
390
- return new _Promise(function (resolve, reject) {
391
- enqueueAction(_this2, function (channel, state) {
392
- return state.handler === handlers.channelOpen;
393
- }, function (channel, state) {
282
+ return new Promise((resolve, reject) => {
283
+ enqueueAction(this, (channel, state) => state.handler === handlers.channelOpen, (channel, state) => {
394
284
  send(channel, {
395
285
  jsonrpc: '2.0',
396
286
  method: 'channels.leave',
@@ -399,8 +289,8 @@ function leave() {
399
289
  return {
400
290
  handler: handlers.awaitingLeave,
401
291
  state: {
402
- resolve: resolve,
403
- reject: reject
292
+ resolve,
293
+ reject
404
294
  }
405
295
  };
406
296
  });
@@ -421,12 +311,8 @@ function leave() {
421
311
 
422
312
 
423
313
  function shutdown(sign) {
424
- var _this3 = this;
425
-
426
- return new _Promise(function (resolve, reject) {
427
- enqueueAction(_this3, function (channel, state) {
428
- return state.handler === handlers.channelOpen;
429
- }, function (channel, state) {
314
+ return new Promise((resolve, reject) => {
315
+ enqueueAction(this, (channel, state) => state.handler === handlers.channelOpen, (channel, state) => {
430
316
  send(channel, {
431
317
  jsonrpc: '2.0',
432
318
  method: 'channels.shutdown',
@@ -435,9 +321,9 @@ function shutdown(sign) {
435
321
  return {
436
322
  handler: handlers.awaitingShutdownTx,
437
323
  state: {
438
- sign: sign,
439
- resolve: resolve,
440
- reject: reject
324
+ sign,
325
+ resolve,
326
+ reject
441
327
  }
442
328
  };
443
329
  });
@@ -473,7 +359,8 @@ function shutdown(sign) {
473
359
  * @param {Number} amount - Amount of tokens to withdraw
474
360
  * @param {Function} sign - Function which verifies and signs withdraw transaction
475
361
  * @param {Object} [callbacks]
476
- * @param {Function} [callbacks.onOnChainTx] - Called when withdraw transaction has been posted on chain
362
+ * @param {Function} [callbacks.onOnChainTx] - Called when withdraw transaction has been posted
363
+ * on chain
477
364
  * @param {Function} [callbacks.onOwnWithdrawLocked]
478
365
  * @param {Function} [callbacks.onWithdrawLocked]
479
366
  * @return {Promise<Object>}
@@ -492,33 +379,29 @@ function shutdown(sign) {
492
379
 
493
380
 
494
381
  function withdraw(amount, sign) {
495
- var _this4 = this;
496
-
497
- var _ref4 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
498
- onOnChainTx = _ref4.onOnChainTx,
499
- onOwnWithdrawLocked = _ref4.onOwnWithdrawLocked,
500
- onWithdrawLocked = _ref4.onWithdrawLocked;
501
-
502
- return new _Promise(function (resolve, reject) {
503
- enqueueAction(_this4, function (channel, state) {
504
- return state.handler === handlers.channelOpen;
505
- }, function (channel, state) {
382
+ let {
383
+ onOnChainTx,
384
+ onOwnWithdrawLocked,
385
+ onWithdrawLocked
386
+ } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
387
+ return new Promise((resolve, reject) => {
388
+ enqueueAction(this, (channel, state) => state.handler === handlers.channelOpen, (channel, state) => {
506
389
  send(channel, {
507
390
  jsonrpc: '2.0',
508
391
  method: 'channels.withdraw',
509
392
  params: {
510
- amount: amount
393
+ amount
511
394
  }
512
395
  });
513
396
  return {
514
397
  handler: handlers.awaitingWithdrawTx,
515
398
  state: {
516
- sign: sign,
517
- resolve: resolve,
518
- reject: reject,
519
- onOnChainTx: onOnChainTx,
520
- onOwnWithdrawLocked: onOwnWithdrawLocked,
521
- onWithdrawLocked: onWithdrawLocked
399
+ sign,
400
+ resolve,
401
+ reject,
402
+ onOnChainTx,
403
+ onOwnWithdrawLocked,
404
+ onWithdrawLocked
522
405
  }
523
406
  };
524
407
  });
@@ -554,7 +437,8 @@ function withdraw(amount, sign) {
554
437
  * @param {Number} amount - Amount of tokens to deposit
555
438
  * @param {Function} sign - Function which verifies and signs deposit transaction
556
439
  * @param {Object} [callbacks]
557
- * @param {Function} [callbacks.onOnChainTx] - Called when deposit transaction has been posted on chain
440
+ * @param {Function} [callbacks.onOnChainTx] - Called when deposit transaction has been posted
441
+ * on chain
558
442
  * @param {Function} [callbacks.onOwnDepositLocked]
559
443
  * @param {Function} [callbacks.onDepositLocked]
560
444
  * @return {Promise<Object>}
@@ -574,33 +458,29 @@ function withdraw(amount, sign) {
574
458
 
575
459
 
576
460
  function deposit(amount, sign) {
577
- var _this5 = this;
578
-
579
- var _ref5 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
580
- onOnChainTx = _ref5.onOnChainTx,
581
- onOwnDepositLocked = _ref5.onOwnDepositLocked,
582
- onDepositLocked = _ref5.onDepositLocked;
583
-
584
- return new _Promise(function (resolve, reject) {
585
- enqueueAction(_this5, function (channel, state) {
586
- return state.handler === handlers.channelOpen;
587
- }, function (channel, state) {
461
+ let {
462
+ onOnChainTx,
463
+ onOwnDepositLocked,
464
+ onDepositLocked
465
+ } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
466
+ return new Promise((resolve, reject) => {
467
+ enqueueAction(this, (channel, state) => state.handler === handlers.channelOpen, (channel, state) => {
588
468
  send(channel, {
589
469
  jsonrpc: '2.0',
590
470
  method: 'channels.deposit',
591
471
  params: {
592
- amount: amount
472
+ amount
593
473
  }
594
474
  });
595
475
  return {
596
476
  handler: handlers.awaitingDepositTx,
597
477
  state: {
598
- sign: sign,
599
- resolve: resolve,
600
- reject: reject,
601
- onOnChainTx: onOnChainTx,
602
- onOwnDepositLocked: onOwnDepositLocked,
603
- onDepositLocked: onDepositLocked
478
+ sign,
479
+ resolve,
480
+ reject,
481
+ onOnChainTx,
482
+ onOwnDepositLocked,
483
+ onDepositLocked
604
484
  }
605
485
  };
606
486
  });
@@ -640,25 +520,23 @@ function deposit(amount, sign) {
640
520
  */
641
521
 
642
522
 
643
- function createContract(_ref6, sign) {
644
- var _this6 = this;
645
-
646
- var code = _ref6.code,
647
- callData = _ref6.callData,
648
- deposit = _ref6.deposit,
649
- vmVersion = _ref6.vmVersion,
650
- abiVersion = _ref6.abiVersion;
651
- return new _Promise(function (resolve, reject) {
652
- enqueueAction(_this6, function (channel, state) {
653
- return state.handler === handlers.channelOpen;
654
- }, function (channel, state) {
523
+ function createContract(_ref3, sign) {
524
+ let {
525
+ code,
526
+ callData,
527
+ deposit,
528
+ vmVersion,
529
+ abiVersion
530
+ } = _ref3;
531
+ return new Promise((resolve, reject) => {
532
+ enqueueAction(this, (channel, state) => state.handler === handlers.channelOpen, (channel, state) => {
655
533
  send(channel, {
656
534
  jsonrpc: '2.0',
657
535
  method: 'channels.update.new_contract',
658
536
  params: {
659
- code: code,
537
+ code,
660
538
  call_data: callData,
661
- deposit: deposit,
539
+ deposit,
662
540
  vm_version: vmVersion,
663
541
  abi_version: abiVersion
664
542
  }
@@ -666,9 +544,9 @@ function createContract(_ref6, sign) {
666
544
  return {
667
545
  handler: handlers.awaitingNewContractTx,
668
546
  state: {
669
- sign: sign,
670
- resolve: resolve,
671
- reject: reject
547
+ sign,
548
+ resolve,
549
+ reject
672
550
  }
673
551
  };
674
552
  });
@@ -712,22 +590,20 @@ function createContract(_ref6, sign) {
712
590
  */
713
591
 
714
592
 
715
- function callContract(_ref7, sign) {
716
- var _this7 = this;
717
-
718
- var amount = _ref7.amount,
719
- callData = _ref7.callData,
720
- contract = _ref7.contract,
721
- abiVersion = _ref7.abiVersion;
722
- return new _Promise(function (resolve, reject) {
723
- enqueueAction(_this7, function (channel, state) {
724
- return state.handler === handlers.channelOpen;
725
- }, function (channel, state) {
593
+ function callContract(_ref4, sign) {
594
+ let {
595
+ amount,
596
+ callData,
597
+ contract,
598
+ abiVersion
599
+ } = _ref4;
600
+ return new Promise((resolve, reject) => {
601
+ enqueueAction(this, (channel, state) => state.handler === handlers.channelOpen, (channel, state) => {
726
602
  send(channel, {
727
603
  jsonrpc: '2.0',
728
604
  method: 'channels.update.call_contract',
729
605
  params: {
730
- amount: amount,
606
+ amount,
731
607
  call_data: callData,
732
608
  contract_id: contract,
733
609
  abi_version: abiVersion
@@ -736,9 +612,9 @@ function callContract(_ref7, sign) {
736
612
  return {
737
613
  handler: handlers.awaitingCallContractUpdateTx,
738
614
  state: {
739
- resolve: resolve,
740
- reject: reject,
741
- sign: sign
615
+ resolve,
616
+ reject,
617
+ sign
742
618
  }
743
619
  };
744
620
  });
@@ -773,45 +649,40 @@ function callContract(_ref7, sign) {
773
649
  */
774
650
 
775
651
 
776
- function forceProgress(_ref8, sign) {
777
- var _this8 = this;
778
-
779
- var amount = _ref8.amount,
780
- callData = _ref8.callData,
781
- contract = _ref8.contract,
782
- abiVersion = _ref8.abiVersion,
783
- _ref8$gas = _ref8.gas,
784
- gas = _ref8$gas === void 0 ? 1000000 : _ref8$gas,
785
- _ref8$gasPrice = _ref8.gasPrice,
786
- gasPrice = _ref8$gasPrice === void 0 ? 1000000000 : _ref8$gasPrice,
787
- nonce = _ref8.nonce;
788
-
789
- var _ref9 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
790
- onOnChainTx = _ref9.onOnChainTx;
791
-
792
- return new _Promise(function (resolve, reject) {
793
- enqueueAction(_this8, function (channel, state) {
794
- return state.handler === handlers.channelOpen;
795
- }, function (channel, state) {
652
+ function forceProgress(_ref5, sign) {
653
+ let {
654
+ amount,
655
+ callData,
656
+ contract,
657
+ abiVersion,
658
+ gas = 1000000,
659
+ gasPrice = 1000000000,
660
+ nonce
661
+ } = _ref5;
662
+ let {
663
+ onOnChainTx
664
+ } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
665
+ return new Promise((resolve, reject) => {
666
+ enqueueAction(this, (channel, state) => state.handler === handlers.channelOpen, (channel, state) => {
796
667
  send(channel, {
797
668
  jsonrpc: '2.0',
798
669
  method: 'channels.force_progress',
799
670
  params: {
800
- amount: amount,
671
+ amount,
801
672
  call_data: callData,
802
673
  contract_id: contract,
803
674
  abi_version: abiVersion,
804
675
  gas_price: gasPrice,
805
- gas: gas
676
+ gas
806
677
  }
807
678
  });
808
679
  return {
809
680
  handler: handlers.awaitingCallContractForceProgressUpdate,
810
681
  state: {
811
- resolve: resolve,
812
- reject: reject,
813
- sign: sign,
814
- onOnChainTx: onOnChainTx
682
+ resolve,
683
+ reject,
684
+ sign,
685
+ onOnChainTx
815
686
  }
816
687
  };
817
688
  });
@@ -846,8 +717,19 @@ function forceProgress(_ref8, sign) {
846
717
  */
847
718
 
848
719
 
849
- function callContractStatic(_x3) {
850
- return _callContractStatic.apply(this, arguments);
720
+ async function callContractStatic(_ref6) {
721
+ let {
722
+ amount,
723
+ callData,
724
+ contract,
725
+ abiVersion
726
+ } = _ref6;
727
+ return snakeToPascalObjKeys(await call(this, 'channels.dry_run.call_contract', {
728
+ amount,
729
+ call_data: callData,
730
+ contract_id: contract,
731
+ abi_version: abiVersion
732
+ }));
851
733
  }
852
734
  /**
853
735
  * Get contract call result
@@ -870,39 +752,17 @@ function callContractStatic(_x3) {
870
752
  */
871
753
 
872
754
 
873
- function _callContractStatic() {
874
- _callContractStatic = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref10) {
875
- var amount, callData, contract, abiVersion;
876
- return _regeneratorRuntime.wrap(function _callee5$(_context6) {
877
- while (1) {
878
- switch (_context6.prev = _context6.next) {
879
- case 0:
880
- amount = _ref10.amount, callData = _ref10.callData, contract = _ref10.contract, abiVersion = _ref10.abiVersion;
881
- _context6.t0 = snakeToPascalObjKeys;
882
- _context6.next = 4;
883
- return call(this, 'channels.dry_run.call_contract', {
884
- amount: amount,
885
- call_data: callData,
886
- contract_id: contract,
887
- abi_version: abiVersion
888
- });
889
-
890
- case 4:
891
- _context6.t1 = _context6.sent;
892
- return _context6.abrupt("return", (0, _context6.t0)(_context6.t1));
893
-
894
- case 6:
895
- case "end":
896
- return _context6.stop();
897
- }
898
- }
899
- }, _callee5, this);
755
+ async function getContractCall(_ref7) {
756
+ let {
757
+ caller,
758
+ contract,
759
+ round
760
+ } = _ref7;
761
+ return snakeToPascalObjKeys(await call(this, 'channels.get.contract_call', {
762
+ caller_id: caller,
763
+ contract_id: contract,
764
+ round
900
765
  }));
901
- return _callContractStatic.apply(this, arguments);
902
- }
903
-
904
- function getContractCall(_x4) {
905
- return _getContractCall.apply(this, arguments);
906
766
  }
907
767
  /**
908
768
  * Get contract latest state
@@ -917,38 +777,13 @@ function getContractCall(_x4) {
917
777
  */
918
778
 
919
779
 
920
- function _getContractCall() {
921
- _getContractCall = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref11) {
922
- var caller, contract, round;
923
- return _regeneratorRuntime.wrap(function _callee6$(_context7) {
924
- while (1) {
925
- switch (_context7.prev = _context7.next) {
926
- case 0:
927
- caller = _ref11.caller, contract = _ref11.contract, round = _ref11.round;
928
- _context7.t0 = snakeToPascalObjKeys;
929
- _context7.next = 4;
930
- return call(this, 'channels.get.contract_call', {
931
- caller_id: caller,
932
- contract_id: contract,
933
- round: round
934
- });
935
-
936
- case 4:
937
- _context7.t1 = _context7.sent;
938
- return _context7.abrupt("return", (0, _context7.t0)(_context7.t1));
939
-
940
- case 6:
941
- case "end":
942
- return _context7.stop();
943
- }
944
- }
945
- }, _callee6, this);
946
- }));
947
- return _getContractCall.apply(this, arguments);
948
- }
949
-
950
- function getContractState(_x5) {
951
- return _getContractState.apply(this, arguments);
780
+ async function getContractState(contract) {
781
+ const result = await call(this, 'channels.get.contract', {
782
+ pubkey: contract
783
+ });
784
+ return snakeToPascalObjKeys({ ...result,
785
+ contract: snakeToPascalObjKeys(result.contract)
786
+ });
952
787
  }
953
788
  /**
954
789
  * Clean up all locally stored contract calls
@@ -962,41 +797,9 @@ function getContractState(_x5) {
962
797
  */
963
798
 
964
799
 
965
- function _getContractState() {
966
- _getContractState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(contract) {
967
- var result;
968
- return _regeneratorRuntime.wrap(function _callee7$(_context8) {
969
- while (1) {
970
- switch (_context8.prev = _context8.next) {
971
- case 0:
972
- _context8.next = 2;
973
- return call(this, 'channels.get.contract', {
974
- pubkey: contract
975
- });
976
-
977
- case 2:
978
- result = _context8.sent;
979
- return _context8.abrupt("return", snakeToPascalObjKeys(_objectSpread(_objectSpread({}, result), {}, {
980
- contract: snakeToPascalObjKeys(result.contract)
981
- })));
982
-
983
- case 4:
984
- case "end":
985
- return _context8.stop();
986
- }
987
- }
988
- }, _callee7, this);
989
- }));
990
- return _getContractState.apply(this, arguments);
991
- }
992
-
993
800
  function cleanContractCalls() {
994
- var _this9 = this;
995
-
996
- return new _Promise(function (resolve, reject) {
997
- enqueueAction(_this9, function (channel, state) {
998
- return state.handler === handlers.channelOpen;
999
- }, function (channel, state) {
801
+ return new Promise((resolve, reject) => {
802
+ enqueueAction(this, (channel, state) => state.handler === handlers.channelOpen, (channel, state) => {
1000
803
  send(channel, {
1001
804
  jsonrpc: '2.0',
1002
805
  method: 'channels.clean_contract_calls',
@@ -1005,8 +808,8 @@ function cleanContractCalls() {
1005
808
  return {
1006
809
  handler: handlers.awaitingCallsPruned,
1007
810
  state: {
1008
- resolve: resolve,
1009
- reject: reject
811
+ resolve,
812
+ reject
1010
813
  }
1011
814
  };
1012
815
  });
@@ -1031,35 +834,28 @@ function cleanContractCalls() {
1031
834
 
1032
835
 
1033
836
  function sendMessage(message, recipient) {
1034
- var _this10 = this;
837
+ let info = message;
1035
838
 
1036
- var info = message;
1037
-
1038
- if (_typeof(message) === 'object') {
1039
- info = _JSON$stringify(message);
839
+ if (typeof message === 'object') {
840
+ info = JSON.stringify(message);
1040
841
  }
1041
842
 
1042
- var doSend = function doSend(channel) {
1043
- return send(channel, {
1044
- jsonrpc: '2.0',
1045
- method: 'channels.message',
1046
- params: {
1047
- info: info,
1048
- to: recipient
1049
- }
1050
- });
1051
- };
843
+ const doSend = channel => send(channel, {
844
+ jsonrpc: '2.0',
845
+ method: 'channels.message',
846
+ params: {
847
+ info,
848
+ to: recipient
849
+ }
850
+ });
1052
851
 
1053
852
  if (this.status() === 'connecting') {
1054
- var onStatusChanged = function onStatusChanged(status) {
853
+ const onStatusChanged = status => {
1055
854
  if (status !== 'connecting') {
1056
855
  // For some reason we can't immediately send a message when connection is
1057
856
  // established. Thus we wait 500ms which seems to work.
1058
- _setTimeout(function () {
1059
- return doSend(_this10);
1060
- }, 500);
1061
-
1062
- _this10.off('statusChanged', onStatusChanged);
857
+ setTimeout(() => doSend(this), 500);
858
+ this.off('statusChanged', onStatusChanged);
1063
859
  }
1064
860
  };
1065
861
 
@@ -1069,8 +865,13 @@ function sendMessage(message, recipient) {
1069
865
  }
1070
866
  }
1071
867
 
1072
- function reconnect(_x6, _x7) {
1073
- return _reconnect.apply(this, arguments);
868
+ async function reconnect(options, txParams) {
869
+ const {
870
+ sign
871
+ } = options;
872
+ return Channel({ ...options,
873
+ reconnectTx: await sign('reconnect', buildTx(txParams, TX_TYPE.channelReconnect).tx)
874
+ });
1074
875
  }
1075
876
  /**
1076
877
  * Channel
@@ -1084,23 +885,42 @@ function reconnect(_x6, _x7) {
1084
885
  * @param {String} options.initiatorId - Initiator's public key
1085
886
  * @param {String} options.responderId - Responder's public key
1086
887
  * @param {Number} options.pushAmount - Initial deposit in favour of the responder by the initiator
1087
- * @param {Number} options.initiatorAmount - Amount of tokens the initiator has committed to the channel
1088
- * @param {Number} options.responderAmount - Amount of tokens the responder has committed to the channel
888
+ * @param {Number} options.initiatorAmount - Amount of tokens the initiator has committed to
889
+ * the channel
890
+ * @param {Number} options.responderAmount - Amount of tokens the responder has committed to
891
+ * the channel
1089
892
  * @param {Number} options.channelReserve - The minimum amount both peers need to maintain
1090
893
  * @param {Number} [options.ttl] - Minimum block height to include the channel_create_tx
1091
894
  * @param {String} options.host - Host of the responder's node
1092
895
  * @param {Number} options.port - The port of the responders node
1093
896
  * @param {Number} options.lockPeriod - Amount of blocks for disputing a solo close
1094
- * @param {Number} [options.existingChannelId] - Existing channel id (required if reestablishing a channel)
1095
- * @param {Number} [options.offchainTx] - Offchain transaction (required if reestablishing a channel)
1096
- * @param {Number} [options.timeoutIdle] - The time waiting for a new event to be initiated (default: 600000)
1097
- * @param {Number} [options.timeoutFundingCreate] - The time waiting for the initiator to produce the create channel transaction after the noise session had been established (default: 120000)
1098
- * @param {Number} [options.timeoutFundingSign] - The time frame the other client has to sign an off-chain update after our client had initiated and signed it. This applies only for double signed on-chain intended updates: channel create transaction, deposit, withdrawal and etc. (default: 120000)
1099
- * @param {Number} [options.timeoutFundingLock] - The time frame the other client has to confirm an on-chain transaction reaching maturity (passing minimum depth) after the local node has detected this. This applies only for double signed on-chain intended updates: channel create transaction, deposit, withdrawal and etc. (default: 360000)
1100
- * @param {Number} [options.timeoutSign] - The time frame the client has to return a signed off-chain update or to decline it. This applies for all off-chain updates (default: 500000)
1101
- * @param {Number} [options.timeoutAccept] - The time frame the other client has to react to an event. This applies for all off-chain updates that are not meant to land on-chain, as well as some special cases: opening a noise connection, mutual closing acknowledgement and reestablishing an existing channel (default: 120000)
1102
- * @param {Number} [options.timeoutInitialized] - the time frame the responder has to accept an incoming noise session. Applicable only for initiator (default: timeout_accept's value)
1103
- * @param {Number} [options.timeoutAwaitingOpen] - The time frame the initiator has to start an outgoing noise session to the responder's node. Applicable only for responder (default: timeout_idle's value)
897
+ * @param {Number} [options.existingChannelId] - Existing channel id (required if reestablishing a
898
+ * channel)
899
+ * @param {Number} [options.offchainTx] - Offchain transaction (required if reestablishing
900
+ * a channel)
901
+ * @param {Number} [options.timeoutIdle] - The time waiting for a new event to be initiated
902
+ * (default: 600000)
903
+ * @param {Number} [options.timeoutFundingCreate] - The time waiting for the initiator to produce
904
+ * the create channel transaction after the noise session had been established (default: 120000)
905
+ * @param {Number} [options.timeoutFundingSign] - The time frame the other client has to sign an
906
+ * off-chain update after our client had initiated and signed it. This applies only for double
907
+ * signed on-chain intended updates: channel create transaction, deposit, withdrawal and etc.
908
+ * (default: 120000)
909
+ * @param {Number} [options.timeoutFundingLock] - The time frame the other client has to confirm an
910
+ * on-chain transaction reaching maturity (passing minimum depth) after the local node has detected
911
+ * this. This applies only for double signed on-chain intended updates: channel create transaction,
912
+ * deposit, withdrawal and etc. (default: 360000)
913
+ * @param {Number} [options.timeoutSign] - The time frame the client has to return a signed
914
+ * off-chain update or to decline it. This applies for all off-chain updates (default: 500000)
915
+ * @param {Number} [options.timeoutAccept] - The time frame the other client has to react to an
916
+ * event. This applies for all off-chain updates that are not meant to land on-chain, as well as
917
+ * some special cases: opening a noise connection, mutual closing acknowledgement and
918
+ * reestablishing an existing channel (default: 120000)
919
+ * @param {Number} [options.timeoutInitialized] - the time frame the responder has to accept an
920
+ * incoming noise session. Applicable only for initiator (default: timeout_accept's value)
921
+ * @param {Number} [options.timeoutAwaitingOpen] - The time frame the initiator has to start an
922
+ * outgoing noise session to the responder's node. Applicable only for responder (default:
923
+ * timeout_idle's value)
1104
924
  * @param {Number} [options.debug=false] - Log websocket communication
1105
925
  * @param {Function} options.sign - Function which verifies and signs transactions
1106
926
  * @return {Promise<Object>} Channel instance
@@ -1122,85 +942,38 @@ function reconnect(_x6, _x7) {
1122
942
  */
1123
943
 
1124
944
 
1125
- function _reconnect() {
1126
- _reconnect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(options, txParams) {
1127
- var sign;
1128
- return _regeneratorRuntime.wrap(function _callee8$(_context9) {
1129
- while (1) {
1130
- switch (_context9.prev = _context9.next) {
1131
- case 0:
1132
- sign = options.sign;
1133
- _context9.t0 = Channel;
1134
- _context9.t1 = _objectSpread;
1135
- _context9.t2 = _objectSpread({}, options);
1136
- _context9.t3 = {};
1137
- _context9.next = 7;
1138
- return sign('reconnect', buildTx(txParams, TX_TYPE.channelReconnect).tx);
1139
-
1140
- case 7:
1141
- _context9.t4 = _context9.sent;
1142
- _context9.t5 = {
1143
- reconnectTx: _context9.t4
1144
- };
1145
- _context9.t6 = (0, _context9.t1)(_context9.t2, _context9.t3, _context9.t5);
1146
- return _context9.abrupt("return", (0, _context9.t0)(_context9.t6));
1147
-
1148
- case 11:
1149
- case "end":
1150
- return _context9.stop();
1151
- }
1152
- }
1153
- }, _callee8);
1154
- }));
1155
- return _reconnect.apply(this, arguments);
1156
- }
1157
-
1158
- var Channel = AsyncInit.compose({
1159
- init: function init(options) {
1160
- var _this11 = this;
1161
-
1162
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
1163
- return _regeneratorRuntime.wrap(function _callee$(_context2) {
1164
- while (1) {
1165
- switch (_context2.prev = _context2.next) {
1166
- case 0:
1167
- initialize(_this11, options);
1168
-
1169
- case 1:
1170
- case "end":
1171
- return _context2.stop();
1172
- }
1173
- }
1174
- }, _callee);
1175
- }))();
945
+ const Channel = AsyncInit.compose({
946
+ async init(options) {
947
+ initialize(this, options);
1176
948
  },
949
+
1177
950
  methods: {
1178
- on: on,
1179
- off: off,
1180
- status: status,
1181
- state: state,
1182
- round: round,
1183
- id: id,
1184
- fsmId: fsmId,
1185
- update: update,
1186
- poi: poi,
1187
- balances: balances,
1188
- leave: leave,
1189
- shutdown: shutdown,
1190
- sendMessage: sendMessage,
1191
- withdraw: withdraw,
1192
- deposit: deposit,
1193
- createContract: createContract,
1194
- callContract: callContract,
1195
- callContractStatic: callContractStatic,
1196
- getContractCall: getContractCall,
1197
- getContractState: getContractState,
1198
- disconnect: disconnect,
1199
- cleanContractCalls: cleanContractCalls,
1200
- forceProgress: forceProgress
951
+ on,
952
+ off,
953
+ status,
954
+ state,
955
+ round,
956
+ id,
957
+ fsmId,
958
+ update,
959
+ poi,
960
+ balances,
961
+ leave,
962
+ shutdown,
963
+ sendMessage,
964
+ withdraw,
965
+ deposit,
966
+ createContract,
967
+ callContract,
968
+ callContractStatic,
969
+ getContractCall,
970
+ getContractState,
971
+ disconnect,
972
+ cleanContractCalls,
973
+ forceProgress
1201
974
  },
1202
975
  statics: {
1203
- reconnect: reconnect
976
+ reconnect
1204
977
  }
1205
978
  });
1206
979
  export default Channel;